Changeset 5540
- Timestamp:
- 08/08/14 08:26:55 (10 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/Application.properties
r1019 r5540 20 20 collections.deleteconfirm: Do you really want to delete "${name}"?\nThis \ 21 21 operation is permanent and cannot be undone. 22 collections.editpublishedconfirm: Do you really want to edit the PUBLISHED \ 23 collection "${name}"?\n\ 24 Any changes will be made public immediately after editing and cannot be \ 25 undone. Be aware that other users may not expect a published collection to \ 26 change! -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/pages/BrowseEditableCollectionsPanel.html
r5501 r5540 9 9 <div style="display: none" wicket:id="publishCollectionDialog"></div> 10 10 <div style="display: none" wicket:id="deleteCollectionDialog"></div> 11 <div style="display: none" wicket:id="editPublishedCollectionDialog"></div> 11 12 <div wicket:id="collectionsTable"></div> 12 13 </wicket:panel> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/pages/BrowseEditableCollectionsPanel.java
r5501 r5540 90 90 if (vc.isDeleted()) { 91 91 detailsItem.setVisible(false).setEnabled(false); 92 editItem.setVisible(false).setEnabled(false); 92 93 } 93 94 if (!vc.isPrivate()) { 94 editItem.setVisible(false).setEnabled(false);95 95 publishItem.setVisible(false).setEnabled(false); 96 96 deleteItem.setVisible(false).setEnabled(false); … … 144 144 if (vc.isDeleted()) { 145 145 detailsLink.setVisible(false).setEnabled(false); 146 editLink.setVisible(false).setEnabled(false); 146 147 } 147 148 if (!vc.isPrivate()) { 148 editLink.setVisible(false).setEnabled(false);149 149 publishLink.setVisible(false).setEnabled(false); 150 150 deleteLink.setVisible(false).setEnabled(false); … … 212 212 } // class BrowsePrivateCollectionsPage.PublishCollectionDialog 213 213 214 private final class EditPublishedCollectionDialog extends ConfirmationDialog { 215 216 private long vcId; 217 218 public EditPublishedCollectionDialog(String id, 219 final Component updateComponenet) { 220 super(id, updateComponenet); 221 setInitialWidth(400); 222 } 223 224 @Override 225 public void onConfirm(AjaxRequestTarget target) { 226 setResponsePage(EditVirtualCollectionPage.class, new PageParameters(Collections.singletonMap("id", vcId))); 227 } 228 229 public void showDialogue(AjaxRequestTarget target, VirtualCollection vc) { 230 this.vcId = vc.getId(); 231 super.show(target, 232 new StringResourceModel("collections.editpublishedconfirm", 233 new VolatileEntityModel<>(vc))); 234 } 235 } 236 214 237 private final PublishCollectionDialog publishDialog; 215 238 private final DeleteCollectionDialog deleteDialog; 239 private final EditPublishedCollectionDialog editPublishedDialog; 216 240 217 241 /** 218 * 242 * 219 243 * @param id panel id 220 244 * @param provider provider for collections that should be shown … … 238 262 add(table); 239 263 240 publishDialog = new PublishCollectionDialog("publishCollectionDialog", 241 table); 264 publishDialog = new PublishCollectionDialog("publishCollectionDialog", table); 242 265 add(publishDialog); 243 deleteDialog = new DeleteCollectionDialog("deleteCollectionDialog",244 266 267 deleteDialog = new DeleteCollectionDialog("deleteCollectionDialog", table); 245 268 add(deleteDialog); 246 } 247 248 private void doEdit(AjaxRequestTarget target, 249 VirtualCollection vc) { 250 setResponsePage(EditVirtualCollectionPage.class, new PageParameters(Collections.singletonMap("id", vc.getId()))); 269 270 editPublishedDialog = new EditPublishedCollectionDialog("editPublishedCollectionDialog", table); 271 add(editPublishedDialog); 272 273 } 274 275 private void doEdit(AjaxRequestTarget target, VirtualCollection vc) { 276 if (vc.isPublic()) { 277 // ask for confirmation when trying to edit a published collection 278 editPublishedDialog.showDialogue(target, vc); 279 } else { 280 setResponsePage(EditVirtualCollectionPage.class, new PageParameters(Collections.singletonMap("id", vc.getId()))); 281 } 251 282 } 252 283 -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/pages/EditVirtualCollectionPage.java
r5504 r5540 40 40 // do not allow editing of VC's that are non-private or owned 41 41 // by someone else! (except for admin) 42 if (!isUserAdmin() && 43 (vc.getState() != State.PRIVATE 42 if (!isUserAdmin() 43 && ( //only allow editing of private & public 44 !(vc.getState() == State.PRIVATE || vc.getState() == State.PUBLIC) 45 // only allow editing by the owner 44 46 || !vc.getOwner().equalsPrincipal(getUser()))) { 45 47 logger.warn("User {} attempts to edit virtual collection {} with state {} owned by {}", new Object[]{getUser().getName(), vc.getId(), vc.getState(), vc.getOwner().getName()}); -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/User.java
r5446 r5540 102 102 if (principal == null) { 103 103 throw new NullPointerException("principal == null"); 104 104 } 105 105 return name.equals(principal.getName()); 106 106 }
Note: See TracChangeset
for help on using the changeset viewer.