protected void checkRunData(HttpServletRequest req) { if (req.getAttribute(ATTR_RUNDATA) != null) return; // set in VmServlet ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS); JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params); req.setAttribute(ATTR_RUNDATA, rundata); }
/** * This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg. */ protected Map<String,String> getContext(RunData data) { // get template from the servlet config String template = getServletConfig().getInitParameter("template"); Map<String,String> rv = new HashMap<String,String>(); rv.put("template", template); return rv; }
protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata) { HttpServletRequest req = rundata.getRequest(); Session session = SessionManager.getCurrentSession(); if (getVmReference("is_wireless_device", req) == null) { Object c = session.getAttribute("is_wireless_device"); setVmReference("is_wireless_device", c, req); } // Set a CSRF token for velocity-based forms if (getVmReference(SAKAI_CSRF_TOKEN, req) == null) { Object csrfToken = session.getAttribute(UsageSessionService.SAKAI_CSRF_SESSION_ATTRIBUTE); setVmReference(SAKAI_CSRF_TOKEN, csrfToken, req); } }
context.put("action", getState(req).getAttribute(STATE_ACTION)); context.put("pid", getPid(req)); String methodName = panelMethodName(panel); args[1] = context; args[2] = rundata; args[3] = getState(req); String template = (String) method.invoke(this, args); template = (String) getContext(rundata).get("template") + "-" + panel; String msg = (String) getState(req).getAttribute(STATE_MESSAGE); if (msg != null) getState(req).removeAttribute(STATE_MESSAGE); Alert alert = getAlert(req); if (!alert.isEmpty()) setVmReference(ALERT_ATTR, alert, req); setVmReference("alertMessage", buf.toString(), req); String sNotif = (String) getState(req).getAttribute(STATE_NOTIF); if (sNotif != null) getState(req).removeAttribute(STATE_NOTIF);
/** * Handle a request to set options. */ public void doOptions(RunData runData, Context context) { // ignore if not allowed if (!allowedToOptions()) { return; //msg = "you do not have permission to set options for this Worksite."; } Placement placement = ToolManager.getCurrentPlacement(); String pid = null; if (placement != null) pid = placement.getId(); SessionState state = ((JetspeedRunData) runData).getPortletSessionState(pid); // go into options mode state.setAttribute(STATE_MODE, MODE_OPTIONS); // disable auto-updates while editing disableObservers(state); // if we're not in the main panel for this tool, schedule an update of the main panel String currentPanelId = runData.getParameters().getString(ActionURL.PARAM_PANEL); if (!LAYOUT_MAIN.equals(currentPanelId)) { String mainPanelId = mainPanelUpdateId(pid); schedulePeerFrameRefresh(mainPanelId); } } // doOptions
if (!checkCSRFToken(req, rundata, action)) return; String helperClass = (String) getState(req).getAttribute(STATE_HELPER); if (helperClass != null) helperActionDispatch("", action, req, res, helperClass); actionDispatch("", action, req, res); String newPanel = (String) getState(req).getAttribute(STATE_NEW_PANEL); getState(req).removeAttribute(STATE_NEW_PANEL);
/** * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode */ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException { // set in VmServlet ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS); // we will need some covers... Note: parameters are parsed (i.e. files are read) here Context context = new Context(this, req); Placement placement = ToolManager.getCurrentPlacement(); PortletConfig config = new PortletConfig(getServletConfig(), placement.getPlacementConfig(), placement.getTool() .getRegisteredConfig(), placement); VelocityPortlet portlet = new VelocityPortlet(getPid(req), config); JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params); req.setAttribute(ATTR_CONTEXT, context); req.setAttribute(ATTR_CONFIG, config); req.setAttribute(ATTR_PORTLET, portlet); req.setAttribute(ATTR_RUNDATA, rundata); super.doGet(req, res); }
setVmReference("config", ServerConfigurationService.getInstance(), request); setVmReference("pid", getPid(request), request); setVmReference("portalCdnQuery", query, request); setVmReference("topRefresh", Boolean.TRUE, request); session.removeAttribute(ATTR_TOP_REFRESH); if (ids != null) setVmReference("frameRefresh", ids, request); session.removeAttribute(ATTR_FRAME_REFRESH); if (focusPath != null) setVmReference("focusChange", focusPath, request); session.removeAttribute(ATTR_FRAME_FOCUS); if (tool != null) setVmReference("toolTitle", tool.getTitle(), request);
/** * Add the options to the menu bar, if allowed. * * @param bar * The menu bar to add to, * @param ref * The resource reference to base the security decision upon. */ protected void addOptionsMenu(Menu bar, JetspeedRunData data) // %%% don't need data -ggolden { if (allowedToOptions()) { bar.add(new MenuEntry(rb.getString("options"), "doOptions")); } } // addOptionsMenu
context.put("action", getState(req).getAttribute(STATE_ACTION)); context.put("pid", getPid(req)); String methodName = panelMethodName(panel); args[1] = context; args[2] = rundata; args[3] = getState(req); String template = (String) method.invoke(this, args); template = (String) getContext(rundata).get("template") + "-" + panel; String msg = (String) getState(req).getAttribute(STATE_MESSAGE); if (msg != null) getState(req).removeAttribute(STATE_MESSAGE); Alert alert = getAlert(req); if (!alert.isEmpty()) setVmReference(ALERT_ATTR, alert, req); setVmReference("alertMessage", buf.toString(), req); String sNotif = (String) getState(req).getAttribute(STATE_NOTIF); if (sNotif != null) getState(req).removeAttribute(STATE_NOTIF);
/** * Handle a request to set options. */ public void doOptions(RunData runData, Context context) { // ignore if not allowed if (!allowedToOptions()) { return; //msg = "you do not have permission to set options for this Worksite."; } Placement placement = ToolManager.getCurrentPlacement(); String pid = null; if (placement != null) pid = placement.getId(); SessionState state = ((JetspeedRunData) runData).getPortletSessionState(pid); // go into options mode state.setAttribute(STATE_MODE, MODE_OPTIONS); // disable auto-updates while editing disableObservers(state); // if we're not in the main panel for this tool, schedule an update of the main panel String currentPanelId = runData.getParameters().getString(ActionURL.PARAM_PANEL); if (!LAYOUT_MAIN.equals(currentPanelId)) { String mainPanelId = mainPanelUpdateId(pid); schedulePeerFrameRefresh(mainPanelId); } } // doOptions
if (!checkCSRFToken(req, rundata, action)) return; String helperClass = (String) getState(req).getAttribute(STATE_HELPER); if (helperClass != null) helperActionDispatch("", action, req, res, helperClass); actionDispatch("", action, req, res); String newPanel = (String) getState(req).getAttribute(STATE_NEW_PANEL); getState(req).removeAttribute(STATE_NEW_PANEL);
/** * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode */ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException { // set in VmServlet ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS); // we will need some covers... Note: parameters are parsed (i.e. files are read) here Context context = new Context(this, req); Placement placement = ToolManager.getCurrentPlacement(); PortletConfig config = new PortletConfig(getServletConfig(), placement.getPlacementConfig(), placement.getTool() .getRegisteredConfig(), placement); VelocityPortlet portlet = new VelocityPortlet(getPid(req), config); JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params); req.setAttribute(ATTR_CONTEXT, context); req.setAttribute(ATTR_CONFIG, config); req.setAttribute(ATTR_PORTLET, portlet); req.setAttribute(ATTR_RUNDATA, rundata); super.doGet(req, res); }
setVmReference("config", ServerConfigurationService.getInstance(), request); setVmReference("pid", getPid(request), request); setVmReference("portalCdnQuery", query, request); setVmReference("topRefresh", Boolean.TRUE, request); session.removeAttribute(ATTR_TOP_REFRESH); if (ids != null) setVmReference("frameRefresh", ids, request); session.removeAttribute(ATTR_FRAME_REFRESH); if (focusPath != null) setVmReference("focusChange", focusPath, request); session.removeAttribute(ATTR_FRAME_FOCUS); if (tool != null) setVmReference("toolTitle", tool.getTitle(), request);
/** * Add the options to the menu bar, if allowed. * * @param bar * The menu bar to add to, * @param ref * The resource reference to base the security decision upon. */ protected void addOptionsMenu(Menu bar, JetspeedRunData data) // %%% don't need data -ggolden { if (allowedToOptions()) { bar.add(new MenuEntry(rb.getString("options"), "doOptions")); } } // addOptionsMenu
protected void checkRunData(HttpServletRequest req) { if (req.getAttribute(ATTR_RUNDATA) != null) return; // set in VmServlet ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS); JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params); req.setAttribute(ATTR_RUNDATA, rundata); }
protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata) { HttpServletRequest req = rundata.getRequest(); Session session = SessionManager.getCurrentSession(); if (getVmReference("is_wireless_device", req) == null) { Object c = session.getAttribute("is_wireless_device"); setVmReference("is_wireless_device", c, req); } // Set a CSRF token for velocity-based forms if (getVmReference(SAKAI_CSRF_TOKEN, req) == null) { Object csrfToken = session.getAttribute(UsageSessionService.SAKAI_CSRF_SESSION_ATTRIBUTE); setVmReference(SAKAI_CSRF_TOKEN, csrfToken, req); } }
/** * This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg. */ protected Map<String,String> getContext(RunData data) { // get template from the servlet config String template = getServletConfig().getInitParameter("template"); Map<String,String> rv = new HashMap<String,String>(); rv.put("template", template); return rv; }