Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java,v
diff -u -r1.1 -r1.2
--- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java 16 Jan 2017 15:28:10 -0000 1.1
+++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java 24 Mar 2017 16:37:06 -0000 1.2
@@ -172,11 +172,9 @@
}
ToolAccessMode mode = getAccessMode(request);
- if (mode.isAuthor()) {
- return mapping.findForward(DokumaranConstants.SUCCESS);
- } else {
- return mapping.findForward(DokumaranConstants.DEFINE_LATER);
- }
+ request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());
+
+ return mapping.findForward(DokumaranConstants.SUCCESS);
}
/**
@@ -203,28 +201,26 @@
// **********************************Get Dokumaran PO*********************
Dokumaran dokumaranPO = service.getDokumaranByContentId(dokumaran.getContentId());
if (dokumaranPO == null) {
- // new Dokumaran, create it.
+ // new Dokumaran, create it
dokumaranPO = dokumaran;
dokumaranPO.setCreated(new Timestamp(new Date().getTime()));
dokumaranPO.setUpdated(new Timestamp(new Date().getTime()));
+
} else {
- if (mode.isAuthor()) {
- Long uid = dokumaranPO.getUid();
- PropertyUtils.copyProperties(dokumaranPO, dokumaran);
+ Long uid = dokumaranPO.getUid();
+ PropertyUtils.copyProperties(dokumaranPO, dokumaran);
- // copyProperties() above may result in "collection assigned to two objects in a session" exception
- // Below we remove reference to one of Assessment objects,
- // so maybe there will be just one object in session when save is done
- // If this fails, we may have to evict the object from session using DAO
- dokumaranForm.setDokumaran(null);
- dokumaran = null;
- // get back UID
- dokumaranPO.setUid(uid);
- } else { // if it is Teacher, then just update basic tab content
- // (definelater)
- dokumaranPO.setInstructions(dokumaran.getInstructions());
- dokumaranPO.setTitle(dokumaran.getTitle());
- // change define later status
+ // copyProperties() above may result in "collection assigned to two objects in a session" exception
+ // Below we remove reference to one of Assessment objects,
+ // so maybe there will be just one object in session when save is done
+ // If this fails, we may have to evict the object from session using DAO
+ dokumaranForm.setDokumaran(null);
+ dokumaran = null;
+ // get back UID
+ dokumaranPO.setUid(uid);
+
+ // if it's a teacher - change define later status
+ if (mode.isTeacher()) {
dokumaranPO.setDefineLater(false);
}
dokumaranPO.setUpdated(new Timestamp(new Date().getTime()));
@@ -249,11 +245,9 @@
dokumaranForm.setDokumaran(dokumaranPO);
request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
- if (mode.isAuthor()) {
- return mapping.findForward("author");
- } else {
- return mapping.findForward("monitor");
- }
+ request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());
+
+ return mapping.findForward(DokumaranConstants.SUCCESS);
}
// *************************************************************************************
Index: lams_tool_doku/web/WEB-INF/struts-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_doku/web/WEB-INF/struts-config.xml,v
diff -u -r1.4 -r1.5
--- lams_tool_doku/web/WEB-INF/struts-config.xml 6 Mar 2017 21:58:41 -0000 1.4
+++ lams_tool_doku/web/WEB-INF/struts-config.xml 24 Mar 2017 16:37:06 -0000 1.5
@@ -73,16 +73,14 @@
parameter="initPage"
validate="false">
-
-
-
+
+
@@ -43,35 +44,35 @@
-
- <%@ include file="/common/messages.jsp"%>
-
-
-
-
-
-
+
+ <%@ include file="/common/messages.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- Default value
+ cancelButtonLabelKey="label.authoring.cancel.button"
+ saveButtonLabelKey="label.authoring.save.button"
+ cancelConfirmMsgKey="authoring.msg.cancel.save"
+ accessMode="author"
+ --%>
+
+
+
+
-
-
-
-
-
-
- <%-- Default value
- cancelButtonLabelKey="label.authoring.cancel.button"
- saveButtonLabelKey="label.authoring.save.button"
- cancelConfirmMsgKey="authoring.msg.cancel.save"
- accessMode="author"
- --%>
-
-
-
-
-