}
}
}
+
+ /**
+ * 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"));
+
+ }
}
/**
}
/**
- * 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)
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)
"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)
}
}
+ /**
+ * 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.
*/
_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());
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;
} 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");
+ }
}
}
}