Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r962b8e07bd2d3808bacc2960ab5acb6fb5dd107d -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 962b8e07bd2d3808bacc2960ab5acb6fb5dd107d) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -365,6 +365,10 @@ config.admin.screen.size =System Admin Screen Size config.gmap.section.title =Google Map Settings config.gmap.gmapkey =Google Map Key +label.tool = Tool +label.tool.version = Tool Version +label.database.version = Database Version + #======= End labels: Exported 358 labels for en AU ===== Index: lams_admin/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r962b8e07bd2d3808bacc2960ab5acb6fb5dd107d -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 962b8e07bd2d3808bacc2960ab5acb6fb5dd107d) +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -365,6 +365,9 @@ config.admin.screen.size =System Admin Screen Size config.gmap.section.title =Google Map Settings config.gmap.gmapkey =Google Map Key +label.tool = Tool +label.tool.version = Tool Version +label.database.version = Database Version #======= End labels: Exported 358 labels for en AU ===== Index: lams_admin/conf/language/rams/ApplicationResources.properties =================================================================== diff -u -re58357098773303e96bea0f5f82f9b03c2bcc770 -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e58357098773303e96bea0f5f82f9b03c2bcc770) +++ lams_admin/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -384,6 +384,9 @@ config.learner.screen.size =Learner Screen Size config.gmap.section.title =Google Map Settings config.gmap.gmapkey =Google Map Key +label.tool = Tool +label.tool.version = Tool Version +label.database.version = Database Version #======= End labels: Exported 378 labels for en AU ===== Index: lams_admin/conf/language/rams/ApplicationResources_en_AU.properties =================================================================== diff -u -re58357098773303e96bea0f5f82f9b03c2bcc770 -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e58357098773303e96bea0f5f82f9b03c2bcc770) +++ lams_admin/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -384,6 +384,9 @@ config.learner.screen.size =Learner Screen Size config.gmap.section.title =Google Map Settings config.gmap.gmapkey =Google Map Key +label.tool = Tool +label.tool.version = Tool Version +label.database.version = Database Version #======= End labels: Exported 378 labels for en AU ===== Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/ToolContentListAction.java =================================================================== diff -u -r870373d635bc769aee2dc271e6ff12818fcfcea6 -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/ToolContentListAction.java (.../ToolContentListAction.java) (revision 870373d635bc769aee2dc271e6ff12818fcfcea6) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/ToolContentListAction.java (.../ToolContentListAction.java) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -23,15 +23,19 @@ /* $Id$ */ package org.lamsfoundation.lams.admin.web; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.sql.DataSource; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; @@ -40,80 +44,101 @@ import org.lamsfoundation.lams.learningdesign.dto.LearningLibraryDTO; import org.lamsfoundation.lams.learningdesign.dto.LibraryActivityDTO; import org.lamsfoundation.lams.learningdesign.service.ILearningDesignService; +import org.lamsfoundation.lams.tool.Tool; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; /** * @author jliew - * - * @struts:action path="/toolcontentlist" - * scope="request" - * validate="false" * + * @struts:action path="/toolcontentlist" scope="request" validate="false" + * * @struts:action-forward name="toolcontentlist" path=".toolcontentlist" * @struts.action-forward name="error" path=".error" */ public class ToolContentListAction extends Action { - - //private static Logger log = Logger.getLogger(ToolContentListAction.class); - - private String getUserLanguage() { - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - return user != null ? user.getLocaleLanguage() : ""; + + private String getUserLanguage() { + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + return user != null ? user.getLocaleLanguage() : ""; + } + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { + + // check permission + if (!(request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.AUTHOR_ADMIN))) { + request.setAttribute("errorName", "ToolContentListAction"); + request.setAttribute("errorMessage", AdminServiceProxy.getMessageService(getServlet().getServletContext()) + .getMessage("error.authorisation")); + return mapping.findForward("error"); } - public ActionForward execute(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws Exception { - - // check permission - if(!(request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.AUTHOR_ADMIN))){ - request.setAttribute("errorName","ToolContentListAction"); - request.setAttribute("errorMessage",AdminServiceProxy.getMessageService(getServlet().getServletContext()) - .getMessage("error.authorisation")); - return mapping.findForward("error"); - } - - WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); - ILearningDesignService learningDesignService = (ILearningDesignService)ctx.getBean("learningDesignService"); - - List learningLibraryDTOs = learningDesignService.getAllLearningLibraryDetails(getUserLanguage()); - - ArrayList activeTools = filterActiveTools(learningLibraryDTOs); - request.setAttribute("activeTools", activeTools); - - return mapping.findForward("toolcontentlist"); + // get learning library dtos + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + ILearningDesignService learningDesignService = (ILearningDesignService) ctx.getBean("learningDesignService"); + + List learningLibraryDTOs = learningDesignService.getAllLearningLibraryDetails(getUserLanguage()); + + ArrayList activeTools = filterActiveTools(learningLibraryDTOs); + request.setAttribute("activeTools", activeTools); + + // get tool versions + IUserManagementService usermanagementService = (IUserManagementService) ctx.getBean("userManagementService"); + + HashMap toolVersions = new HashMap(); + List tools = usermanagementService.findAll(Tool.class); + for (Tool tool : tools) { + toolVersions.put(tool.getToolId(), tool.getToolVersion()); } - - // returns LibraryActivityDTOs of valid tools from full list of tools - private ArrayList filterActiveTools(List learningLibraryDTOs) { - ArrayList activeTools = new ArrayList(); - for (int i=0; i dbVersions = new HashMap(); + DataSource dataSource = (DataSource) ctx.getBean("dataSource"); + Connection conn = dataSource.getConnection(); + PreparedStatement query = conn.prepareStatement("select system_name, patch_level from patches"); + ResultSet results = query.executeQuery(); + while (results.next()) { + dbVersions.put(results.getString("system_name"), results.getInt("patch_level")); } - - private boolean toolExists(LibraryActivityDTO item, ArrayList list) { - for (LibraryActivityDTO l : list) { - if (StringUtils.equals(item.getToolSignature(),l.getToolSignature())) return true; + request.setAttribute("dbVersions", dbVersions); + + return mapping.findForward("toolcontentlist"); + } + + // returns LibraryActivityDTOs of valid tools from full list of tools + private ArrayList filterActiveTools(List learningLibraryDTOs) { + ArrayList activeTools = new ArrayList(); + for (int i = 0; i < learningLibraryDTOs.size(); i++) { + LearningLibraryDTO dto = (LearningLibraryDTO) learningLibraryDTOs.get(i); + if (dto.getValidFlag()) { + List templateActivities = dto.getTemplateActivities(); + for (int j = 0; j < templateActivities.size(); j++) { + LibraryActivityDTO template = (LibraryActivityDTO) templateActivities.get(j); + if (template.getToolContentID() != null) { + if (!toolExists(template, activeTools)) + activeTools.add(template); + } } - return false; + } } + return activeTools; + } + private boolean toolExists(LibraryActivityDTO item, ArrayList list) { + for (LibraryActivityDTO l : list) { + if (StringUtils.equals(item.getToolSignature(), l.getToolSignature())) + return true; + } + return false; + } + } Index: lams_admin/web/toolcontent/toolcontentlist.jsp =================================================================== diff -u -r7ab9e2377fd1ff4c3c5554bd1f6dffe3384f6f9a -r81664cec15f3a1f6cc57f59aeae16719aafcf464 --- lams_admin/web/toolcontent/toolcontentlist.jsp (.../toolcontentlist.jsp) (revision 7ab9e2377fd1ff4c3c5554bd1f6dffe3384f6f9a) +++ lams_admin/web/toolcontent/toolcontentlist.jsp (.../toolcontentlist.jsp) (revision 81664cec15f3a1f6cc57f59aeae16719aafcf464) @@ -20,32 +20,45 @@

- +
+ + + + + + + + + + + - - - - + +
+ + + + + +
?toolContentID=&contentFolderID=-1"> - - + + - -   - - + +    "> - + + -