Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r8a5eb613f404b4bf118cceeca6eb1c5f2c54a471 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 8a5eb613f404b4bf118cceeca6eb1c5f2c54a471) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -250,7 +250,7 @@ config.xmpp.conference = Chat server conference config.xmpp.admin = Chat server admin username config.xmpp.password = Chat server admin password -config.allow.direct.lesson.launch = Allow direct lesson launch +config.allow.direct.lesson.launch = Allow direct lesson and course launch config.allow.live.edit = Allow Live Edit config.ldap.provisioning.enabled = Enable provisioning config.ldap.provider.url = LDAP server URL Index: lams_admin/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r9fcc85311d9c8a57737b060b3cc7872b5f324bd2 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 9fcc85311d9c8a57737b060b3cc7872b5f324bd2) +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -250,7 +250,7 @@ config.xmpp.conference = Chat server conference config.xmpp.admin = Chat server admin username config.xmpp.password = Chat server admin password -config.allow.direct.lesson.launch = Allow direct lesson launch +config.allow.direct.lesson.launch = Allow direct lesson and course launch config.allow.live.edit = Allow Live Edit config.ldap.provisioning.enabled = Enable provisioning config.ldap.provider.url = LDAP server URL Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r7b3eba5d7b856941bb0b89cb6e49a1498a8feac4 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7b3eba5d7b856941bb0b89cb6e49a1498a8feac4) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -73,6 +73,9 @@ index.addlesson = Add Lesson index.monitor = Monitor index.dummymonitor = Dummy Monitor +index.organisation.link = Copy course link +index.organisation.link.tooltip = Copy direct access course URL to clipboard +index.organisation.link.success = Course URL copied to clipboard title.import.result = Import tool content result title.import = Import tool content title.import.instruction = Please choose LAMS design to import. Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupController.java =================================================================== diff -u -r1fb317e9f6db7094ec64f77782bf0be389012e43 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupController.java (.../DisplayGroupController.java) (revision 1fb317e9f6db7094ec64f77782bf0be389012e43) +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupController.java (.../DisplayGroupController.java) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -55,6 +55,7 @@ import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.IndexUtils; +import org.lamsfoundation.lams.util.WebUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -149,59 +150,55 @@ moreLinks.add(new IndexLinkBean("index.classman", "javascript:openOrgManagement(" + organisationId + ")", "fa fa-fw fa-ellipsis-v", null)); } - if ((roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_AUTHOR) - || roles.contains(Role.ROLE_MONITOR))) { - moreLinks.add(new IndexLinkBean("index.orggroup", - "javascript:showOrgGroupingDialog(" + organisationId + ")", "fa fa-fw fa-users", null)); - } + moreLinks.add(new IndexLinkBean("index.orggroup", + "javascript:showOrgGroupingDialog(" + organisationId + ")", "fa fa-fw fa-users", null)); - if (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR)) { - String name = org.getEnableSingleActivityLessons() ? "index.addlesson.single" : "index.addlesson"; - links.add(new IndexLinkBean(name, "javascript:showAddLessonDialog(" + organisationId + ")", - "fa fa-fw fa-plus", null)); - } + String name = org.getEnableSingleActivityLessons() ? "index.addlesson.single" : "index.addlesson"; + links.add(new IndexLinkBean(name, "javascript:showAddLessonDialog(" + organisationId + ")", + "fa fa-fw fa-plus", null)); + moreLinks.add(new IndexLinkBean("index.searchlesson", "javascript:showSearchLessonDialog(" + organisationId + ")", "fa fa-fw fa-search", "index.searchlesson.tooltip")); // Adding course notifications links if enabled - if (org.getEnableCourseNotifications() - && (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR))) { + if (org.getEnableCourseNotifications()) { moreLinks.add(new IndexLinkBean("index.emailnotifications", "javascript:showNotificationsDialog(" + organisationId + ",null)", "fa fa-fw fa-bullhorn", "index.emailnotifications.tooltip")); } // Adding lesson sorting link - if (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR)) { + // make sure the group or any of its subgroups has at least one lesson + boolean hasLesson = !orgBean.getLessons().isEmpty(); + for (IndexOrgBean childOrgBean : orgBean.getChildIndexOrgBeans()) { + hasLesson |= (childOrgBean.getLessons() != null) && !childOrgBean.getLessons().isEmpty(); + } - // make sure the group or any of its subgroups has at least one lesson - boolean hasLesson = !orgBean.getLessons().isEmpty(); - for (IndexOrgBean childOrgBean : orgBean.getChildIndexOrgBeans()) { - hasLesson |= (childOrgBean.getLessons() != null) && !childOrgBean.getLessons().isEmpty(); - } + if (hasLesson) { + moreLinks.add(new IndexLinkBean("label.enable.lesson.sorting", "javascript:makeOrgSortable()", + "fa fa-fw fa-sort sorting tour-sorting", "label.enable.lesson.sorting")); + } - if (hasLesson) { - moreLinks.add(new IndexLinkBean("label.enable.lesson.sorting", "javascript:makeOrgSortable()", - "fa fa-fw fa-sort sorting tour-sorting", "label.enable.lesson.sorting")); - } + String link = "javascript:showGradebookCourseDialog(" + organisationId + ")"; + moreLinks.add(new IndexLinkBean("index.coursegradebook", link, "fa fa-fw fa-list-ol", + "index.coursegradebook.tooltip")); - String link = "javascript:showGradebookCourseDialog(" + organisationId + ")"; - moreLinks.add(new IndexLinkBean("index.coursegradebook", link, "fa fa-fw fa-list-ol", - "index.coursegradebook.tooltip")); + if (Configuration.getAsBoolean(ConfigurationKeys.ALLOW_DIRECT_LESSON_LAUNCH)) { + String orgUrl = Configuration.get(ConfigurationKeys.SERVER_URL) + "r/" + + WebUtil.ORG_SHORTENING_PREFIX + WebUtil.encodeIdForDirectLaunch(organisationId); + link = "javascript:copyOrgUrlToClipboard('" + orgUrl + "')"; + moreLinks.add(new IndexLinkBean("index.organisation.link", link, "fa fa-fw fa-clipboard", + "index.organisation.link.tooltip")); } } else {// CLASS_TYPE - if (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR)) { - String name = org.getParentOrganisation().getEnableSingleActivityLessons() - ? "index.addlesson.single" - : "index.addlesson"; - links.add(new IndexLinkBean(name, "javascript:showAddLessonDialog(" + organisationId + ")", - "fa fa-fw fa-plus", null)); + String name = org.getParentOrganisation().getEnableSingleActivityLessons() ? "index.addlesson.single" + : "index.addlesson"; + links.add(new IndexLinkBean(name, "javascript:showAddLessonDialog(" + organisationId + ")", + "fa fa-fw fa-plus", null)); - String link = "javascript:showGradebookCourseDialog(" + organisationId + ")"; - moreLinks.add( - new IndexLinkBean("index.coursegradebook.subgroup", link, "fa fa-fw fa-list-ol", null)); - } + String link = "javascript:showGradebookCourseDialog(" + organisationId + ")"; + moreLinks.add(new IndexLinkBean("index.coursegradebook.subgroup", link, "fa fa-fw fa-list-ol", null)); } } Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexController.java =================================================================== diff -u -r1fb317e9f6db7094ec64f77782bf0be389012e43 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/src/java/org/lamsfoundation/lams/web/IndexController.java (.../IndexController.java) (revision 1fb317e9f6db7094ec64f77782bf0be389012e43) +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexController.java (.../IndexController.java) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -179,7 +179,8 @@ List favoriteOrganisations = userManagementService .getFavoriteOrganisationsByUser(userDTO.getUserID()); request.setAttribute("favoriteOrganisations", favoriteOrganisations); - request.setAttribute("activeOrgId", user.getLastVisitedOrganisationId()); + Integer targetOrgId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); + request.setAttribute("activeOrgId", targetOrgId == null ? user.getLastVisitedOrganisationId() : targetOrgId); boolean isAppadmin = request.isUserInRole(Role.APPADMIN) || request.isUserInRole(Role.SYSADMIN); int userCoursesCount = userManagementService.getCountActiveCoursesByUser(userDTO.getUserID(), isAppadmin, null); Index: lams_central/web/css/_main_base.scss =================================================================== diff -u -r56857f6d73efbd7089c7e1d5a682e0716cad12eb -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/web/css/_main_base.scss (.../_main_base.scss) (revision 56857f6d73efbd7089c7e1d5a682e0716cad12eb) +++ lams_central/web/css/_main_base.scss (.../_main_base.scss) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -492,3 +492,7 @@ border-bottom: $border-thin-default; padding-bottom: 15px; } + +#direct-org-launch-link-copy-button { + cursor: pointer; +} \ No newline at end of file Index: lams_central/web/includes/javascript/main.js =================================================================== diff -u -rb28b1e41d273fdce6c086a72a4e6a9f2e1a8a946 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/web/includes/javascript/main.js (.../main.js) (revision b28b1e41d273fdce6c086a72a4e6a9f2e1a8a946) +++ lams_central/web/includes/javascript/main.js (.../main.js) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -639,3 +639,23 @@ } } } + +function copyOrgUrlToClipboard(url){ + navigator.clipboard.writeText(url); + + $.blockUI({ + message: '

' + LABELS.ORG_LINK_COPY_SUCCESS_MESSAGE + '

', + fadeIn: 700, + fadeOut: 700, + timeout: 4000, + showOverlay: false, + centerY: true, + css: { + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px', + opacity: .6, + color: '#fff' + } + }); +} \ No newline at end of file Index: lams_central/web/main.jsp =================================================================== diff -u -rad80b813ce57fb0277896d5ba213d15b559af004 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_central/web/main.jsp (.../main.jsp) (revision ad80b813ce57fb0277896d5ba213d15b559af004) +++ lams_central/web/main.jsp (.../main.jsp) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -90,7 +90,9 @@ OUTCOME_MANAGE_TITLE : '', - OUTCOME_COURSE_MANAGE_TITLE : '' + OUTCOME_COURSE_MANAGE_TITLE : '', + + ORG_LINK_COPY_SUCCESS_MESSAGE : '' }, activeOrgId = null${activeOrgId}; Index: lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java =================================================================== diff -u -rd7075108a6a77341ebefaa6dfdb8ce46f9d87c4a -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java (.../WebUtil.java) (revision d7075108a6a77341ebefaa6dfdb8ce46f9d87c4a) +++ lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java (.../WebUtil.java) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -57,6 +57,8 @@ private static final String URL_SHORTENING_CYPHER = "jbdnuteywk"; + public static final String ORG_SHORTENING_PREFIX = "c-"; + /** * @exception IllegalArgumentException * - if not set @@ -494,23 +496,23 @@ /** * Converse lessonId into alphabetic sequence for using it in URL shortening * - * @param lessonId + * @param id * @return */ - public static String encodeLessonId(Long lessonId) { - String encodedLessonId = lessonId.toString(); - encodedLessonId = encodedLessonId.replace('0', URL_SHORTENING_CYPHER.charAt(0)); - encodedLessonId = encodedLessonId.replace('1', URL_SHORTENING_CYPHER.charAt(1)); - encodedLessonId = encodedLessonId.replace('2', URL_SHORTENING_CYPHER.charAt(2)); - encodedLessonId = encodedLessonId.replace('3', URL_SHORTENING_CYPHER.charAt(3)); - encodedLessonId = encodedLessonId.replace('4', URL_SHORTENING_CYPHER.charAt(4)); - encodedLessonId = encodedLessonId.replace('5', URL_SHORTENING_CYPHER.charAt(5)); - encodedLessonId = encodedLessonId.replace('6', URL_SHORTENING_CYPHER.charAt(6)); - encodedLessonId = encodedLessonId.replace('7', URL_SHORTENING_CYPHER.charAt(7)); - encodedLessonId = encodedLessonId.replace('8', URL_SHORTENING_CYPHER.charAt(8)); - encodedLessonId = encodedLessonId.replace('9', URL_SHORTENING_CYPHER.charAt(9)); + public static String encodeIdForDirectLaunch(Number id) { + String encodedId = id.toString(); + encodedId = encodedId.replace('0', URL_SHORTENING_CYPHER.charAt(0)); + encodedId = encodedId.replace('1', URL_SHORTENING_CYPHER.charAt(1)); + encodedId = encodedId.replace('2', URL_SHORTENING_CYPHER.charAt(2)); + encodedId = encodedId.replace('3', URL_SHORTENING_CYPHER.charAt(3)); + encodedId = encodedId.replace('4', URL_SHORTENING_CYPHER.charAt(4)); + encodedId = encodedId.replace('5', URL_SHORTENING_CYPHER.charAt(5)); + encodedId = encodedId.replace('6', URL_SHORTENING_CYPHER.charAt(6)); + encodedId = encodedId.replace('7', URL_SHORTENING_CYPHER.charAt(7)); + encodedId = encodedId.replace('8', URL_SHORTENING_CYPHER.charAt(8)); + encodedId = encodedId.replace('9', URL_SHORTENING_CYPHER.charAt(9)); - return encodedLessonId; + return encodedId; } /** @@ -519,26 +521,30 @@ * @param encodedlessonId * @return */ - public static String decodeLessonId(String encodedLessonId) throws IllegalArgumentException { + public static String decodeIdForDirectLaunch(String encodedId) throws IllegalArgumentException { + boolean isOrganisationId = encodedId.startsWith(ORG_SHORTENING_PREFIX); + if (isOrganisationId) { + encodedId = encodedId.replaceFirst(ORG_SHORTENING_PREFIX, ""); + } // it should contain only the characters from URL_SHORTENING_CYPHER - if (!encodedLessonId.matches("[" + URL_SHORTENING_CYPHER + "]*")) { - throw new IllegalArgumentException("LessonId: " + encodedLessonId + " has wrong format."); + if (!encodedId.matches("[" + URL_SHORTENING_CYPHER + "]*")) { + throw new IllegalArgumentException("Lesson or organisation ID: " + encodedId + " has wrong format."); } - String decodedLessonId = encodedLessonId; - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(0), '0'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(1), '1'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(2), '2'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(3), '3'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(4), '4'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(5), '5'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(6), '6'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(7), '7'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(8), '8'); - decodedLessonId = decodedLessonId.replace(URL_SHORTENING_CYPHER.charAt(9), '9'); + String decodedId = encodedId; + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(0), '0'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(1), '1'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(2), '2'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(3), '3'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(4), '4'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(5), '5'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(6), '6'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(7), '7'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(8), '8'); + decodedId = decodedId.replace(URL_SHORTENING_CYPHER.charAt(9), '9'); - return decodedLessonId; + return decodedId; } public static Document getDocument() throws ParserConfigurationException { Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java =================================================================== diff -u -r7b3eba5d7b856941bb0b89cb6e49a1498a8feac4 -rb6d55d571ea99a87a367fec36df40ec45627b0ea --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java (.../MonitoringController.java) (revision 7b3eba5d7b856941bb0b89cb6e49a1498a8feac4) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java (.../MonitoringController.java) (revision b6d55d571ea99a87a367fec36df40ec45627b0ea) @@ -1009,7 +1009,7 @@ lessonDTO.setCreateDateTimeStr(sfm.format(lessonDTO.getCreateDateTime())); } // prepare encoded lessonId for shortened learner URL - lessonDTO.setEncodedLessonID(WebUtil.encodeLessonId(lessonId)); + lessonDTO.setEncodedLessonID(WebUtil.encodeIdForDirectLaunch(lessonId)); if (!securityService.isLessonMonitor(lessonId, user.getUserID(), "monitor lesson")) { response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson");