Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java
===================================================================
diff -u -rb15a3b889da23ac048a689fc2d661df42571b229 -r5d55a2c77e97273a4dee033db769bc7c3ffdf002
--- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision b15a3b889da23ac048a689fc2d661df42571b229)
+++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 5d55a2c77e97273a4dee033db769bc7c3ffdf002)
@@ -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
===================================================================
diff -u -r7a4b493a0008b281e8c3ec7aafbd325165085ed9 -r5d55a2c77e97273a4dee033db769bc7c3ffdf002
--- lams_tool_doku/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 7a4b493a0008b281e8c3ec7aafbd325165085ed9)
+++ lams_tool_doku/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 5d55a2c77e97273a4dee033db769bc7c3ffdf002)
@@ -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"
- --%>
-
-
-
-
-