From: mka Date: Thu, 11 Jul 2013 10:32:53 +0000 (+0000) Subject: When reviewing a document, the first item of the document pop-up menu is "Demote... X-Git-Tag: Delivery_V1_0_2013_07_12~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c41f659f1080afcd04c756dde95629c50079184a;p=tools%2Fsiman.git When reviewing a document, the first item of the document pop-up menu is "Demote". In this context this item was renamed as "Reject" --- diff --git a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java index 001e781..e489c5d 100644 --- a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java +++ b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java @@ -831,6 +831,70 @@ public class ApplicationSettings { } } } + + /** + * Add Actualize menu item. + */ + protected void addActualize() { + addItem(MNU_ACTUALIZE, new PopupItem(MNU_NAME_ACTUALIZE) + .icon(IMG_ACCEPT).action(ACT_ACTUALIZE) + .confirmation("message.actualize.document")); + } + /** + * Add Review menu item. + */ + protected void addReview() { + addItem(MNU_PROMOTE, new PopupItem("menu.review").icon( + "image.review.png").action("setDocument?action=review") + .confirmation("message.review.document")); + } + /** + * Add Demote menu item. + * @param author + * indicates if the connected user is the author of the document. + */ + protected void addDemote(final boolean author) { + String itemName; + if(author) { + itemName = MNU_NAME_DEMOTE; + } else { + itemName = "menu.reject"; + } + addItem(MNU_DEMOTE, new PopupItem(itemName).icon( + IMG_DEMOTE).action("setDocument?action=demote") + .confirmation("message.demote.document")); + } + /** + * Add Version menu item. + */ + protected void addVersion() { + addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon( + IMG_VERSION).action(ACT_VERSION)); + } + /** + * Add Attach menu item. + */ + protected void addAttach() { + addItem(MNU_ATTACH, new PopupItem(MNU_NAME_ATTACH).icon(IMG_ATTACH) + .action(ACT_ATTACH)); + } + /** + * Add Remove menu item. + */ + protected void addRemove() { + addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon( + IMG_DELETE).action("remove-document").confirmation( + "message.delete.document")); + } + /** + * Add Approve menu item. + */ + protected void addApprove() { + addItem("approve", new PopupItem("menu.approve").icon( + "icon.APPROVED.png").action("setDocument?action=approve") + .confirmation("message.approve.document")); + + } } /** @@ -870,13 +934,13 @@ public class ApplicationSettings { } /** - * Popup of In-Draft documents. + * Popup of In-Draft documents when connected user is the author of the document. */ - private static class ReviewableDocumentPopup extends DocumentPopup { + private static class ReviewableDocumentPopupAuthor extends DocumentPopup { /** * Document popup menu constructor. */ - private ReviewableDocumentPopup() { + private ReviewableDocumentPopupAuthor() { super(); addItem(MNU_ACTUALIZE, new PopupItem(MNU_NAME_ACTUALIZE) .icon(IMG_ACCEPT).action(ACT_ACTUALIZE) @@ -893,21 +957,41 @@ public class ApplicationSettings { addSeparator(); addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon( IMG_VERSION).action(ACT_VERSION)); - addSeparator(); /* + * addSeparator(); * addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE).action( ACT_NOT_YET_IMPLEMENTED).confirmation( "message.purge.document")); */ } } + + /** + * Popup of In-Draft documents when connected user is not the author of the document. + */ + private static class ReviewableDocumentPopupNonAuthor extends DocumentPopup { + /** + * Default constructor. + */ + private ReviewableDocumentPopupNonAuthor() { + super(); + addActualize(); + addDemote(false); + addReview(); + addSeparator(); + addAttach(); + addSeparator(); + addVersion(); + } + } /** - * Popup menu for documents which are not results of a step. + * Popup menu for documents which are not results of a step + * when connected user is the author of the document. */ - private static class NotResultDocumentPopup extends DocumentPopup { + private static class NotResultDocumentPopupAuthor extends DocumentPopup { /** * Default constructor. */ - private NotResultDocumentPopup() { + private NotResultDocumentPopupAuthor() { super(); addItem(MNU_ACTUALIZE, new PopupItem(MNU_NAME_ACTUALIZE) .icon(IMG_ACCEPT).action(ACT_ACTUALIZE) @@ -930,15 +1014,37 @@ public class ApplicationSettings { "message.delete.document")); } } + + /** + * Popup menu for documents which are not results of a step + * when connected user is not the author of the document. + */ + private static class NotResultDocumentPopupNonAuthor extends DocumentPopup { + /** + * Default constructor. + */ + private NotResultDocumentPopupNonAuthor() { + super(); + addActualize(); + addDemote(false); + addSeparator(); + addAttach(); + addSeparator(); + addVersion(); + addSeparator(); + addRemove(); + } + } /** - * Popup of In-Check documents. + * Popup of In-Check documents + * when connected user is the author of the document. */ - private static class ApprovableDocumentPopup extends DocumentPopup { + private static class ApprovableDocumentPopupAuthor extends DocumentPopup { /** * Default constructor. */ - private ApprovableDocumentPopup() { + private ApprovableDocumentPopupAuthor() { super(); addItem(MNU_ACTUALIZE, new PopupItem(MNU_NAME_ACTUALIZE) .icon(IMG_ACCEPT).action(ACT_ACTUALIZE) @@ -957,6 +1063,22 @@ public class ApplicationSettings { } } + /** + * Popup of In-Check documents + * when connected user is not the author of the document. + */ + private static class ApprovableDocumentPopupNonAuthor extends DocumentPopup { + /** + * Default constructor. + */ + private ApprovableDocumentPopupNonAuthor() { + super(); + addActualize(); + addDemote(false); + addApprove(); + } + } + /** * Popup of Approved documents. */ @@ -1209,9 +1331,12 @@ public class ApplicationSettings { _popups.put("stapprovable", new ApprovableStudyPopup()); _popups.put("editable", new EditableDocumentPopup()); - _popups.put("notresult", new NotResultDocumentPopup()); - _popups.put("reviewable", new ReviewableDocumentPopup()); - _popups.put("approvable", new ApprovableDocumentPopup()); + _popups.put("notresult", new NotResultDocumentPopupAuthor()); + _popups.put("reviewable", new ReviewableDocumentPopupAuthor()); + _popups.put("approvable", new ApprovableDocumentPopupAuthor()); + _popups.put("notresultNonAuthor", new NotResultDocumentPopupNonAuthor()); + _popups.put("reviewableNonAuthor", new ReviewableDocumentPopupNonAuthor()); + _popups.put("approvableNonAuthor", new ApprovableDocumentPopupNonAuthor()); _popups.put("approved", new ApprovedPopup()); _popups.put("extern", new ExternPopup()); _popups.put("scontext", new ScontextPopup()); diff --git a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java index accc56b..8ad50a9 100644 --- a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java +++ b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java @@ -14,6 +14,7 @@ import java.util.List; import java.util.ResourceBundle; import org.splat.dal.bo.kernel.Relation; +import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.ConvertsRelation; import org.splat.dal.bo.som.Document; import org.splat.dal.bo.som.DocumentType; @@ -589,17 +590,28 @@ public class DocumentFacade implements HistoryFacade { } else if (_state == ProgressState.inWORK) { _popup = getApplicationSettings().getPopupMenu("editable"); } else if (_state == ProgressState.inDRAFT) { - _popup = getApplicationSettings().getPopupMenu("reviewable"); + if(_owner.getUser().equals(_me.value().getAuthor())) { //connected usr is the author of the document + _popup = getApplicationSettings().getPopupMenu("reviewable"); + } else { + _popup = getApplicationSettings().getPopupMenu("reviewableNonAuthor"); + } } else if (_state == ProgressState.APPROVED) { _popup = getApplicationSettings().getPopupMenu("approved"); } else { // (state == ProgressState.inCHECK) DocumentType aType = _me.value().getType(); // Only result documents need to be approved Step aStep = getPublicationService().getInvolvedStep(_me); if (aType.isResultOf(aStep.getStep())) { - _popup = getApplicationSettings() - .getPopupMenu("approvable"); + if(_owner.getUser().equals(_me.value().getAuthor())) { + _popup = getApplicationSettings().getPopupMenu("approvable"); + } else { + _popup = getApplicationSettings().getPopupMenu("approvableNonAuthor"); + } } else { - _popup = getApplicationSettings().getPopupMenu("notresult"); + if(_owner.getUser().equals(_me.value().getAuthor())) { //connected usr is the author of the document + _popup = getApplicationSettings().getPopupMenu("notresult"); + } else { + _popup = getApplicationSettings().getPopupMenu("notresultNonAuthor"); + } } } }