Index: lams_admin/conf/xdoclet/struts-message-resources.xml =================================================================== diff -u -rf8845fdf880cec49384de0f55bd7a49400fcdf6f -r001568fdeabd68c6ba46398e0ae42328fe64f5db --- lams_admin/conf/xdoclet/struts-message-resources.xml (.../struts-message-resources.xml) (revision f8845fdf880cec49384de0f55bd7a49400fcdf6f) +++ lams_admin/conf/xdoclet/struts-message-resources.xml (.../struts-message-resources.xml) (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -1,2 +1 @@ - - + Index: lams_admin/conf/xdoclet/taglibs.xml =================================================================== diff -u -rcf0f2fa25a0c6ff2116f6a3310292e72beea2c64 -r001568fdeabd68c6ba46398e0ae42328fe64f5db --- lams_admin/conf/xdoclet/taglibs.xml (.../taglibs.xml) (revision cf0f2fa25a0c6ff2116f6a3310292e72beea2c64) +++ lams_admin/conf/xdoclet/taglibs.xml (.../taglibs.xml) (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -51,22 +51,22 @@ http://java.sun.com/jstl/fmt - /WEB-INF/JSTL/tlds/fmt.tld + /WEB-INF/jstl/tlds/fmt.tld http://java.sun.com/jstl/fmt-rt - /WEB-INF/JSTL/tlds/fmt-rt.tld + /WEB-INF/jstl/tlds/fmt-rt.tld http://java.sun.com/jstl/core - /WEB-INF/JSTL/tlds/c.tld + /WEB-INF/jstl/tlds/c.tld http://java.sun.com/jstl/core-rt - /WEB-INF/JSTL/tlds/c-rt.tld + /WEB-INF/jstl/tlds/c-rt.tld Index: lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties =================================================================== diff -u -rf8845fdf880cec49384de0f55bd7a49400fcdf6f -r001568fdeabd68c6ba46398e0ae42328fe64f5db --- lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties (.../applicationResources.properties) (revision f8845fdf880cec49384de0f55bd7a49400fcdf6f) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties (.../applicationResources.properties) (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -5,4 +5,12 @@ #=========================Error Messages===========================# error.authorisation=You are not authorised to do this. error.newpassword.mismatch=Your new passwords don't match each other. -error.oldpassword.mismatch=Your old password is not correct. \ No newline at end of file +error.oldpassword.mismatch=Your old password is not correct. + +#===================== Cache Screen ==============================# +cache.title=Cache Management +cache.entries.title=Cache Nodes +cache.explanation1=Listed below are the current nodes in the cache. This keeps certain common objects in memory to speed up LAMS. It is managed automatically and should not require any intervention. However, if the system appears to be keeping "old values" e.g. an old first name, try clearing all the nodes in the cache. Once cleared, LAMS will reload the objects from the database. +cache.explanation2=Warning: Removing nodes will reduce the performance of the LAMS server. After a while, the cache will build up again and LAMS will run as usual. +cache.explanation3=Warning: If you remove a node, you will remove the node and all its child nodes. +cache.button.remove=Remove Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java =================================================================== diff -u --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java (revision 0) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -0,0 +1,131 @@ +package org.lamsfoundation.lams.admin.web; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.cache.CacheManager; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.HttpSessionManager; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + + +/** + * this is an action where all lams client environments launch. + * initial configuration of the individual environment setting is done here. + * + * @struts:action name="CacheActionForm" + * path="/cache" + * parameter="method" + * validate="false" + * @struts:action-forward name="cache" path="/cache.jsp" + * + */ +public class CacheAction extends LamsDispatchAction { + + public static final String CACHE_ENTRIES = "cache"; + public static final String NODE_KEY = "node"; + + private static Logger log = Logger.getLogger(CacheAction.class); + private static WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(HttpSessionManager.getInstance().getServletContext()); + private static CacheManager manager = (CacheManager) ctx.getBean("cacheManager"); + //private static UserManagementService service = (UserManagementService) ctx.getBean("userManagementServiceTarget"); + + /* + private boolean isUserInRole(String login,int orgId, String roleName) + { + if (service.getUserOrganisationRole(login, new Integer(orgId),roleName)==null) + return false; + return true; + } */ + + /** + * request for sysadmin environment + */ + public ActionForward unspecified(ActionMapping mapping, ActionForm form, + HttpServletRequest req, HttpServletResponse res) + throws IOException, ServletException { + + try { + + log.debug("cache lookup"); + + // todo restrict access to admin only. Can't do at present as don't know orgID + log.error("CacheAction should be restricted to admin only. No check being done. Please implement."); + /*String login = req.getRemoteUser(); + int orgId = new Integer(req.getParameter("orgId")).intValue(); + + if ( isUserInRole(login,orgId,Role.ADMIN)) + { + log.debug("user is admin"); + Organisation org = service.getOrganisationById(new Integer(orgId)); + AdminPreparer.prepare(org,req,service); + return mapping.findForward("admin"); + } + else + { + log.error("User "+login+" tried to get cache admin screen but isn't admin in organisation: "+orgId); + return mapping.findForward("error"); + } */ + + Map items = manager.getCachedItems(); + req.setAttribute(CACHE_ENTRIES, items); + return mapping.findForward("cache"); + + } catch (Exception e) { + e.printStackTrace(); + return mapping.findForward("error"); + } + } + + /** + * request for sysadmin environment + */ + public ActionForward remove(ActionMapping mapping, ActionForm form, + HttpServletRequest req, HttpServletResponse res) + throws IOException, ServletException { + + try { + + log.debug("remove"); + + // todo restrict access to admin only. Can't do at present as don't know orgID + log.error("CacheAction should be restricted to admin only. No check being done. Please implement."); + /*String login = req.getRemoteUser(); + int orgId = new Integer(req.getParameter("orgId")).intValue(); + + if ( isUserInRole(login,orgId,Role.ADMIN)) + { + log.debug("user is admin"); + Organisation org = service.getOrganisationById(new Integer(orgId)); + AdminPreparer.prepare(org,req,service); + return mapping.findForward("admin"); + } + else + { + log.error("User "+login+" tried to get cache admin screen but isn't admin in organisation: "+orgId); + return mapping.findForward("error"); + } */ + + String node = WebUtil.readStrParam(req, NODE_KEY, false); + manager.clearCache(node); + + Map items = manager.getCachedItems(); + req.setAttribute(CACHE_ENTRIES, items); + return mapping.findForward("cache"); + + } catch (Exception e) { + e.printStackTrace(); + return mapping.findForward("error"); + } + } +} \ No newline at end of file Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java =================================================================== diff -u --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java (revision 0) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -0,0 +1,43 @@ +package org.lamsfoundation.lams.admin.web; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionMapping; + +/** + * @author fmalikoff + * + * @struts:form name="CacheActionForm" + */ +public class CacheActionForm extends ActionForm { + + public static final String formName = "CacheActionForm"; // must match name in @struts:action section above + + private String node; + + public CacheActionForm() { + } + + + /** + * Reset all properties to their default values. + * + * @param mapping The mapping used to select this instance + * @param request The servlet request we are processing + */ + public void reset(ActionMapping mapping, HttpServletRequest request) { + setNode(null); + } + + + public String getNode() { + return node; + } + + + public void setNode(String node) { + this.node = node; + } + +} \ No newline at end of file Index: lams_admin/web/WEB-INF/struts/struts-config.xml =================================================================== diff -u -r0e43e21301c93315b5e7959c30e892f93411787f -r001568fdeabd68c6ba46398e0ae42328fe64f5db --- lams_admin/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 0e43e21301c93315b5e7959c30e892f93411787f) +++ lams_admin/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -22,6 +22,10 @@ type="org.lamsfoundation.lams.admin.web.UsersRemoveActionForm" /> + @@ -148,6 +152,21 @@ /> + + + - + http://java.sun.com/jstl/fmt - /WEB-INF/JSTL/tlds/fmt.tld + /WEB-INF/jstl/tlds/fmt.tld http://java.sun.com/jstl/fmt-rt - /WEB-INF/JSTL/tlds/fmt-rt.tld + /WEB-INF/jstl/tlds/fmt-rt.tld http://java.sun.com/jstl/core - /WEB-INF/JSTL/tlds/c.tld + /WEB-INF/jstl/tlds/c.tld http://java.sun.com/jstl/core-rt - /WEB-INF/JSTL/tlds/c-rt.tld + /WEB-INF/jstl/tlds/c-rt.tld Index: lams_admin/web/cache.jsp =================================================================== diff -u --- lams_admin/web/cache.jsp (revision 0) +++ lams_admin/web/cache.jsp (revision 001568fdeabd68c6ba46398e0ae42328fe64f5db) @@ -0,0 +1,47 @@ +<%@ taglib uri="tags-c" prefix="c" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-bean" prefix="bean" %> + +<% +String protocol = request.getProtocol(); +if(protocol.startsWith("HTTPS")){ + protocol = "https://"; +}else{ + protocol = "http://"; +} +String pathToRoot = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +String pathToShare = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/.."; +%> + + + +<bean:message key="cache.title"/> + + + + + + +

+ +

+

+

+
    + + + +

    + + + +
  • ">
    +Children: + +
    +
    + + +
+ +