Index: lams_build/lib/lams/lams.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v diff -u -r1.420.2.97 -r1.420.2.98 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java,v diff -u -r1.45.2.11 -r1.45.2.12 --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java 24 Oct 2016 14:55:28 -0000 1.45.2.11 +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java 27 Oct 2016 16:02:36 -0000 1.45.2.12 @@ -115,6 +115,10 @@ request.setAttribute("tools", getLearningDesignService().getToolDTOs(false, false, request.getRemoteUser())); } + + //set whether organisation is favorite + boolean isFavorite = service.isOrganisationFavorite(orgId, user.getUserId()); + iob.setFavorite(isFavorite); } return mapping.findForward("group"); Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java,v diff -u -r1.54.2.9 -r1.54.2.10 --- lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java 24 Oct 2016 14:55:28 -0000 1.54.2.9 +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java 27 Oct 2016 16:02:36 -0000 1.54.2.10 @@ -43,6 +43,7 @@ import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.config.Registration; import org.lamsfoundation.lams.index.IndexLinkBean; +import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.OrganisationDTO; @@ -123,6 +124,9 @@ if (reg != null) { request.setAttribute("lamsCommunityEnabled", reg.isEnableLamsCommunityIntegration()); } + + List favoriteOrganisations = userManagementService.getFavoriteOrganisationsByUser(userDTO.getUserID()); + request.setAttribute("favoriteOrganisations", favoriteOrganisations); return mapping.findForward("main"); } @@ -159,7 +163,7 @@ } /** - * Returns list of organisations for . + * Returns list of organisations for user. Used by offcanvas tablesorter on main.jsp. */ public ActionForward getOrgs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse res) throws IOException, ServletException, JSONException { @@ -206,7 +210,53 @@ res.getWriter().print(new String(responcedata.toString())); return null; } + + /** + * Toggles whether organisation is marked as favorite. + */ + public ActionForward toggleFavoriteOrganisation(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse res) throws IOException, ServletException { + getUserManagementService(); + Integer orgId = WebUtil.readIntParam(request, "orgId", false); + Integer userId = getUserId(); + if (orgId != null) { + userManagementService.toggleOrganisationFavorite(orgId, userId); + } + + List favoriteOrganisations = userManagementService.getFavoriteOrganisationsByUser(userId); + request.setAttribute("favoriteOrganisations", favoriteOrganisations); + + String activeOrgId = request.getParameter("activeOrgId"); + request.setAttribute("activeOrgId", activeOrgId); + + return mapping.findForward("favoriteOrganisations"); + } + + /** + * Saves to DB last visited organisation. It's required for displaying some org on main.jsp next time user logs in. + */ + public ActionForward storeLastVisitedOrganisation(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse res) throws IOException, ServletException { + getUserManagementService(); + Integer lastVisitedOrganisationId = WebUtil.readIntParam(request, "orgId", false); + + //saves to DB last visited organisation + if (lastVisitedOrganisationId != null) { + User user = userManagementService.getUserByLogin(request.getRemoteUser()); + user.setLastVisitedOrganisationId(lastVisitedOrganisationId); + userManagementService.save(user); + } + + return null; + } + + private Integer getUserId() { + HttpSession ss = SessionManager.getSession(); + UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER); + return learner != null ? learner.getUserID() : null; + } + private IUserManagementService getUserManagementService() { if (userManagementService == null) { WebApplicationContext ctx = WebApplicationContextUtils Fisheye: Tag 1.1.14.6 refers to a dead (removed) revision in file `lams_central/src/java/org/lamsfoundation/lams/web/UpdateCollapsedGroupServlet.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_central/web/editprofile.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/editprofile.jsp,v diff -u -r1.23.2.5 -r1.23.2.6 --- lams_central/web/editprofile.jsp 24 Oct 2016 14:55:28 -0000 1.23.2.5 +++ lams_central/web/editprofile.jsp 27 Oct 2016 16:02:36 -0000 1.23.2.6 @@ -17,7 +17,7 @@ - + - + @@ -84,13 +83,13 @@ PRIVATE_NOTIFICATIONS_READ_ALL_HINT : '', MY_PROFILE : '', + REMOVE_ORG_FAVORITE : '', + MARK_ORG_FAVORITE : '', }, stateId = 1, // TODO Figure out when stateId is required to be equal 3. Old version code: stateId = tabName == 'profile' ? 3 : 1; - activeOrgId = -1; //not set for now + activeOrgId = null${lastVisitedOrganisationId}; $(document).ready(function(){ - initMainPage(); - <%-- If it's the user's first login, display a dialog asking if tutorial videos should be shown --%> @@ -100,135 +99,39 @@ $.get("${disableAllTutorialVideosUrl}"); } - - var $tablesorter = $(".tablesorter").tablesorter({ - theme: 'bootstrap', - headerTemplate : '{content} {icon}', - widgets: ["filter"], - widgetOptions : { - filter_columnFilters: false - }, - widthFixed: true, - sortInitialOrder: 'desc', - sortList: [[1]], - headers: { 0: { sorter: false, filter: false} } - }); - - $.tablesorter.filter.bindSearch($tablesorter, $('#offcanvas-search-input') ); - - $(".tablesorter").each(function() { - $(this).tablesorterPager({ - savePages: false, - container: $(this).find(".ts-pager"), - output: '{startRow} to {endRow} ({totalRows})', - cssPageDisplay: '.pagedisplay', - cssPageSize: '.pagesize', - cssDisabled: 'disabled', - ajaxUrl : "?dispatch=getOrgs&page={page}&size={size}&{sortList:column}&{filterList:fcol}", - ajaxProcessing: function (data, table) { - if (data && data.hasOwnProperty('rows')) { - var rows = [], - json = {}; - - for (i = 0; i < data.rows.length; i++){ - var orgData = data.rows[i]; - var orgId = orgData["id"]; - - rows += ''; - - rows += ''; - rows += ''; - - rows += ''; - rows += ''; - rows += orgData["name"]; - rows += ''; - rows += ''; - - rows += ''; - } - - json.total = data.total_rows; - json.rows = $(rows); - return json; - } - } - }) - }); - - $('.tablesorter').bind('filterEnd pagerComplete', function(event, data){ - - //hide pager if total amount of courses is less than 10 - if (data.totalRows < 10) { - $(".tablesorter-pager").hide(); - } else { - $(".tablesorter-pager").show(); - } - - //in case active course is not yet chosen by user, select the fist one from the list - if ((activeOrgId < 0) && (event.type == "pagerComplete") && (data.totalRows > 0)) { - var firstOrgId = $('.tablesorter a').first().data("id"); - selectOrganisation(firstOrgId); - } - }); - }); - +class="offcanvas-hidden"> @@ -335,8 +238,6 @@ @@ -355,9 +256,7 @@
-
-
-
+
Index: lams_central/web/passwordChangeContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/passwordChangeContent.jsp,v diff -u -r1.10.12.5 -r1.10.12.6 --- lams_central/web/passwordChangeContent.jsp 27 Oct 2016 03:14:11 -0000 1.10.12.5 +++ lams_central/web/passwordChangeContent.jsp 27 Oct 2016 16:02:36 -0000 1.10.12.6 @@ -23,7 +23,7 @@ - + - + Index: lams_central/web/profile.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/profile.jsp,v diff -u -r1.23.2.3 -r1.23.2.4 --- lams_central/web/profile.jsp 24 Oct 2016 14:55:28 -0000 1.23.2.3 +++ lams_central/web/profile.jsp 27 Oct 2016 16:02:36 -0000 1.23.2.4 @@ -17,7 +17,7 @@ - + - + +