Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r86521284ae546f32e01ae0a6bc1dfb99232d19cd -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 86521284ae546f32e01ae0a6bc1dfb99232d19cd) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -611,7 +611,6 @@ label.activate =Activate label.deactivate =Deactivate label.minor.change =Minor change -label.create.new.draft =Create a new draft label.policy.consents =Policy consents label.consented =Consented? label.consented.on =Consented on Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/PolicyManagementAction.java =================================================================== diff -u -r86521284ae546f32e01ae0a6bc1dfb99232d19cd -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/PolicyManagementAction.java (.../PolicyManagementAction.java) (revision 86521284ae546f32e01ae0a6bc1dfb99232d19cd) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/PolicyManagementAction.java (.../PolicyManagementAction.java) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -99,7 +99,6 @@ HttpServletResponse response) { Long policyUid = WebUtil.readLongParam(request, "policyUid", true); - boolean isEditingPreviousVersion = WebUtil.readBooleanParam(request, "isEditingPreviousVersion", false); if (policyUid != null && policyUid > 0) { Policy policy = policyService.getPolicyByUid(policyUid); if (policy != null) { @@ -112,7 +111,6 @@ policyForm.set("policyTypeId", policy.getPolicyTypeId()); policyForm.set("version", policy.getVersion()); policyForm.set("policyStateId", policy.getPolicyStateId()); - policyForm.set("editingPreviousVersion", isEditingPreviousVersion); request.setAttribute("policyForm", policyForm); } } @@ -129,66 +127,57 @@ String version = policyForm.getString("version"); Integer policyStateId = (Integer) policyForm.get("policyStateId"); Boolean isMinorChange = (Boolean) policyForm.get("minorChange"); - Boolean isEditingPreviousVersion = (Boolean) policyForm.get("editingPreviousVersion"); + Policy oldPolicy = (policyUid != null) && ((Long) policyUid > 0) + ? policyService.getPolicyByUid((Long) policyUid) + : null; + + // set policyId: generate Unique long ID in case of new policy and reuse existing one otherwise + Long policyId = oldPolicy == null ? policyId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE + : oldPolicy.getPolicyId(); + Policy policy; // edit existing policy only in case of minor change - if (isMinorChange) { - Policy oldPolicy = policyService.getPolicyByUid((Long) policyUid); - policy = oldPolicy; + if (isMinorChange) { + policy = policyService.getPolicyByUid((Long) policyUid); } else { //if it's not a minor change - then instantiate a new child policy policy = new Policy(); - - //set policy's policyId - Long policyId; - if (policyUid != null && (Long) policyUid > 0) { - Policy oldPolicy = policyService.getPolicyByUid((Long) policyUid); - policyId = oldPolicy.getPolicyId(); - } else { - // generate Unique long ID - policyId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; - } - policy.setPolicyId(policyId); - //set policy's version - if (policyUid != null && (Long) policyUid > 0) { - Policy oldPolicy = policyService.getPolicyByUid((Long) policyUid); - //if version was not changed by the user - append current date - if (oldPolicy.getVersion().equals(version)) { - version += " " + currentDate; - } + //set policy's version: if version was not changed by the user - append current date + if (oldPolicy != null && oldPolicy.getVersion().equals(version)) { + version += " " + currentDate; } + } - //take care about old policy/policies: if the new policy has Active status then set the old one(s) to Inactive - if (policyUid != null && (Long) policyUid > 0 && policyStateId.equals(Policy.STATUS_ACTIVE)) { + //set default version, if it's empty + if (StringUtils.isEmpty(version)) { + version = currentDate; + } - if (isEditingPreviousVersion) { - List policyFamily = policyService.getPreviousVersionsPolicies(policyId); - for (Policy policyFromFamily : policyFamily) { - if (!policyFromFamily.getUid().equals(policyUid) - && Policy.STATUS_ACTIVE.equals(policyFromFamily.getPolicyStateId())) { - policyFromFamily.setPolicyStateId(Policy.STATUS_INACTIVE); - userManagementService.save(policyFromFamily); - } + //in case we edit existing policy and the new policy is Active - set all other policy versions to Inactive + if (oldPolicy != null && Policy.STATUS_ACTIVE.equals(policyStateId)) { + + //in case old policy was active - we only need to deactivate it, otherwise we need to find an active one from the policy family + if (Policy.STATUS_ACTIVE.equals(oldPolicy.getPolicyStateId())) { + oldPolicy.setPolicyStateId(Policy.STATUS_INACTIVE); + userManagementService.save(oldPolicy); + + } else { + List policyFamily = policyService.getPreviousVersionsPolicies(policyId); + for (Policy policyFromFamily : policyFamily) { + if (!policyFromFamily.getUid().equals(policyUid) + && Policy.STATUS_ACTIVE.equals(policyFromFamily.getPolicyStateId())) { + policyFromFamily.setPolicyStateId(Policy.STATUS_INACTIVE); + userManagementService.save(policyFromFamily); } - - } else { - Policy oldPolicy = policyService.getPolicyByUid((Long) policyUid); - if (Policy.STATUS_ACTIVE.equals(oldPolicy.getPolicyStateId())) { - oldPolicy.setPolicyStateId(Policy.STATUS_INACTIVE); - userManagementService.save(oldPolicy); - } } - } + } } - //set default version, if it's empty - if (StringUtils.isEmpty(version)) { - version = currentDate; - } + policy.setPolicyId(policyId); policy.setVersion(version); policy.setSummary(policyForm.getString("summary")); policy.setFullPolicy(policyForm.getString("fullPolicy")); Index: lams_admin/web/WEB-INF/struts-config.xml =================================================================== diff -u -r86521284ae546f32e01ae0a6bc1dfb99232d19cd -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_admin/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 86521284ae546f32e01ae0a6bc1dfb99232d19cd) +++ lams_admin/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -170,7 +170,6 @@ - Index: lams_admin/web/policies/editPolicy.jsp =================================================================== diff -u -r86521284ae546f32e01ae0a6bc1dfb99232d19cd -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_admin/web/policies/editPolicy.jsp (.../editPolicy.jsp) (revision 86521284ae546f32e01ae0a6bc1dfb99232d19cd) +++ lams_admin/web/policies/editPolicy.jsp (.../editPolicy.jsp) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -67,7 +67,6 @@ - @@ -121,7 +120,7 @@ - + Index: lams_admin/web/policies/policyTable.jsp =================================================================== diff -u -r86521284ae546f32e01ae0a6bc1dfb99232d19cd -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_admin/web/policies/policyTable.jsp (.../policyTable.jsp) (revision 86521284ae546f32e01ae0a6bc1dfb99232d19cd) +++ lams_admin/web/policies/policyTable.jsp (.../policyTable.jsp) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -59,18 +59,9 @@
- - - - - - - - - - - - + + + Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r4c134bb552fd30a24e610ddd532846ec38a3a51c -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 4c134bb552fd30a24e610ddd532846ec38a3a51c) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -822,6 +822,7 @@ label.version =Version label.consented =Consented? label.consented.on =Consented on +label.policy.details =Policy details #=================== Specific to Team Based Learning (TBL) =========================# Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java =================================================================== diff -u -r4c134bb552fd30a24e610ddd532846ec38a3a51c -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java (.../ProfileAction.java) (revision 4c134bb552fd30a24e610ddd532846ec38a3a51c) +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java (.../ProfileAction.java) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -46,6 +46,7 @@ import org.lamsfoundation.lams.index.IndexOrgBean; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.lesson.dto.LessonDTO; +import org.lamsfoundation.lams.policies.Policy; import org.lamsfoundation.lams.policies.PolicyDTO; import org.lamsfoundation.lams.policies.service.IPolicyService; import org.lamsfoundation.lams.themes.Theme; @@ -64,6 +65,7 @@ import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.IndexUtils; import org.lamsfoundation.lams.util.LanguageUtil; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -200,7 +202,17 @@ return mapping.findForward("profilePolicyConsents"); } + + public ActionForward displayPolicyDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { + long policyUid = WebUtil.readLongParam(request, "policyUid"); + Policy policy = policyService.getPolicyByUid(policyUid); + request.setAttribute("policy", policy); + + return mapping.findForward("policyDetails"); + } + public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Index: lams_central/web/WEB-INF/struts-config.xml =================================================================== diff -u -r4c134bb552fd30a24e610ddd532846ec38a3a51c -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_central/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 4c134bb552fd30a24e610ddd532846ec38a3a51c) +++ lams_central/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -556,6 +556,11 @@ redirect="false" /> + + +<%@ page contentType="text/html; charset=utf-8" language="java"%> +<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-bean" prefix="bean"%> +<%@ taglib uri="tags-logic" prefix="logic"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams"%> + + + + <fmt:message key="label.policy.details" /> + + + + + + + +
+
+
+
+
+
+
+

+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ +
+ +
+ " + onclick="javascript:window.close();" /> +
+ +
+
+
+
+
+ +
Index: lams_central/web/profile/profilePolicyConsents.jsp =================================================================== diff -u -r4c134bb552fd30a24e610ddd532846ec38a3a51c -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b --- lams_central/web/profile/profilePolicyConsents.jsp (.../profilePolicyConsents.jsp) (revision 4c134bb552fd30a24e610ddd532846ec38a3a51c) +++ lams_central/web/profile/profilePolicyConsents.jsp (.../profilePolicyConsents.jsp) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) @@ -39,7 +39,7 @@
- +
@@ -49,9 +49,12 @@ - "> +
- + "> + + @@ -89,7 +92,7 @@
-
+
" onclick="javascript:document.location='index.do?method=profile'" />