Package org.sakaiproject.cheftool
Class VelocityPortletPaneledAction
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.sakaiproject.vm.ComponentServlet
-
- org.sakaiproject.vm.VmServlet
-
- org.sakaiproject.cheftool.VmServlet
-
- org.sakaiproject.cheftool.ToolServlet
-
- org.sakaiproject.cheftool.VelocityPortletPaneledAction
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
NewPagedResourceAction,PagedResourceAction,PagedResourceActionII,PagedResourceHelperAction,VelocityPortletStateAction
public abstract class VelocityPortletPaneledAction extends ToolServlet
VelocityPortletPaneledAction ...
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringATTR_CONFIGA PortletConfig bound into the request attributes.protected static StringATTR_CONTEXTA Context bound into the request attributes.static StringATTR_FRAME_FOCUSTool session attribute name used to schedule a focus change.static StringATTR_FRAME_REFRESHTool session attribute name used to schedule a peer frame refresh.protected static StringATTR_PORTLETA VelocityPortlet bound into the request attributes.protected static StringATTR_RUNDATAA JetspeedRunData bound into the request attributes.static StringATTR_TOP_REFRESHTool session attribute name used to schedule a whole page refresh.protected static StringBUTTONprotected static StringCONTEXT_SITE_COLLECTION_IDThe name of the context variable containing the identifier for the site's root content collectionprotected static StringCONTEXT_SITE_COLLECTION_URLThe name of the context variable containing the access URL for the site's root content collectionprotected static StringHELPER_LINK_MODEConstants to handle helper situationsprotected static StringHELPER_MODE_DONEprotected static StringLAYOUT_MAINThe panel name of the main panel - append the tool's id.static StringMODE_OPTIONSStandard modes.static StringMODE_PERMISSIONSprotected static StringSAKAI_CSRF_TOKENThe name of the param used for CSRF protectionprotected static StringSTATE_ACTIONstatic StringSTATE_BUNDLE_KEYstatic StringSTATE_FLOATstatic StringSTATE_HELPERThe currently active helper mode static class.static StringSTATE_MESSAGEprotected static StringSTATE_MODEprotected static StringSTATE_NEW_PANELstatic StringSTATE_NOTIFprotected static StringSTATE_OBSERVERstatic StringSTATE_OBSERVER2static StringSTATE_PRESENCE_OBSERVERstatic StringSTATE_TOOLstatic StringSTATE_TOOL_KEY-
Fields inherited from class org.sakaiproject.cheftool.ToolServlet
ALERT_ATTR, ALERT_STATE_INITED, HELPER_ID, MAIN_PANEL, MENU_ATTR, PARAM_ACTION, PARAM_ACTION_COMBO, TITLE_PANEL, TOOL_MODE_ATTR, TOOL_MODE_DEFAULT
-
Fields inherited from class org.sakaiproject.cheftool.VmServlet
m_validator
-
Fields inherited from class org.sakaiproject.vm.ComponentServlet
ATTR_PARAMS
-
-
Constructor Summary
Constructors Constructor Description VelocityPortletPaneledAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactionDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Dispatch to a "processAction" method based on reflection.static voidaddAlert(org.sakaiproject.event.api.SessionState state, String message)Add another string to the alert message.static voidaddAlert(org.sakaiproject.event.api.SessionState state, String message, boolean removeDuplicates)Add another string to the alert message.static voidaddFlashNotif(org.sakaiproject.event.api.SessionState state, String message)Add another string to the flash notification message.protected voidaddOptionsMenu(org.sakaiproject.cheftool.api.Menu bar, JetspeedRunData data)Add the options to the menu bar, if allowed.protected booleanallowedToOptions()Check if the current user is allowed to do options for the current context (site based)protected Stringbuild_permissions_context(VelocityPortlet portlet, Context context, RunData data, org.sakaiproject.event.api.SessionState state)protected voidcancelOptions()Cancel the options process.booleancheckCSRFToken(javax.servlet.http.HttpServletRequest request, RunData rundata, String action)protected voidcheckRunData(javax.servlet.http.HttpServletRequest req)protected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool modevoiddoOptions(RunData runData, Context context)Handle a request to set options.voiddoReset(RunData runData, Context context)Handle the "reset tool" option from the Title bar.protected Map<String,String>getContext(RunData data)This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg.String[]getDateFormatString()String[]getTimeFormatString()Return a String array containing the "h", "m", "a", or "H" characters (corresponding to hour, minute, am/pm, or 24-hour) in the locale specific orderprotected voidhelperActionDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String className)Dispatch to a "processAction" method based on reflection in a helper class.protected voidinitState(org.sakaiproject.event.api.SessionState state, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Initialize for the first time the session state for this session.protected voidinitState(org.sakaiproject.event.api.SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)static StringmainPanelUpdateId(String toolId)Compute the courier update html element id for the main panel - add "." and other names for inner panels.protected StringpanelMethodName(String panel)Allow extension classes to control which build method gets called for this pannelvoidprocessAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Process a Portlet action.protected voidresetTool(org.sakaiproject.event.api.SessionState state)Reset the tool (state) to "home" conditions.protected voidsaveOptions()Complete the options process with a save.protected voidscheduleFocusRefresh(String[] path)Schedule a focus change.protected voidschedulePeerFrameRefresh(String id)Schedule a refresh for a peer frame.protected voidscheduleTopRefresh()Schedule a refresh for whole pageprotected voidsetVmStdRef(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Add some standard references to the vm context.static voidswitchPanel(org.sakaiproject.event.api.SessionState state, String newPanel)Switch to a new panelstatic StringtitlePanelUpdateId(String toolId)Compute the courier update html element id for the title panel.protected voidtoolModeDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Dispatch to a "do" method based on reflection.protected voidupdateState(org.sakaiproject.event.api.SessionState state, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Update for this request processing the session state.-
Methods inherited from class org.sakaiproject.cheftool.ToolServlet
doPost, getAlert, getAlert, getMenu, getPid, getState, getToolMode, prepState, sendToHelper, setToolMode, startHelper, startHelper
-
Methods inherited from class org.sakaiproject.vm.VmServlet
getActionURL, getVmReference, includeVm, setVmReference
-
Methods inherited from class org.sakaiproject.vm.ComponentServlet
sendParentRedirect, service, setNoCacheHeaders
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
BUTTON
protected static final String BUTTON
- See Also:
- Constant Field Values
-
STATE_HELPER
public static final String STATE_HELPER
The currently active helper mode static class.- See Also:
- Constant Field Values
-
STATE_MODE
protected static final String STATE_MODE
- See Also:
- Constant Field Values
-
STATE_OBSERVER
protected static final String STATE_OBSERVER
- See Also:
- Constant Field Values
-
STATE_ACTION
protected static final String STATE_ACTION
- See Also:
- Constant Field Values
-
STATE_NEW_PANEL
protected static final String STATE_NEW_PANEL
- See Also:
- Constant Field Values
-
CONTEXT_SITE_COLLECTION_ID
protected static final String CONTEXT_SITE_COLLECTION_ID
The name of the context variable containing the identifier for the site's root content collection- See Also:
- Constant Field Values
-
CONTEXT_SITE_COLLECTION_URL
protected static final String CONTEXT_SITE_COLLECTION_URL
The name of the context variable containing the access URL for the site's root content collection- See Also:
- Constant Field Values
-
LAYOUT_MAIN
protected static final String LAYOUT_MAIN
The panel name of the main panel - append the tool's id.- See Also:
- Constant Field Values
-
SAKAI_CSRF_TOKEN
protected static final String SAKAI_CSRF_TOKEN
The name of the param used for CSRF protection- See Also:
- Constant Field Values
-
HELPER_LINK_MODE
protected static final String HELPER_LINK_MODE
Constants to handle helper situations- See Also:
- Constant Field Values
-
HELPER_MODE_DONE
protected static final String HELPER_MODE_DONE
- See Also:
- Constant Field Values
-
STATE_OBSERVER2
public static final String STATE_OBSERVER2
- See Also:
- Constant Field Values
-
STATE_PRESENCE_OBSERVER
public static final String STATE_PRESENCE_OBSERVER
- See Also:
- Constant Field Values
-
STATE_FLOAT
public static final String STATE_FLOAT
- See Also:
- Constant Field Values
-
STATE_TOOL
public static final String STATE_TOOL
- See Also:
- Constant Field Values
-
STATE_TOOL_KEY
public static final String STATE_TOOL_KEY
- See Also:
- Constant Field Values
-
STATE_BUNDLE_KEY
public static final String STATE_BUNDLE_KEY
- See Also:
- Constant Field Values
-
STATE_MESSAGE
public static final String STATE_MESSAGE
- See Also:
- Constant Field Values
-
STATE_NOTIF
public static final String STATE_NOTIF
- See Also:
- Constant Field Values
-
MODE_OPTIONS
public static final String MODE_OPTIONS
Standard modes.- See Also:
- Constant Field Values
-
MODE_PERMISSIONS
public static final String MODE_PERMISSIONS
- See Also:
- Constant Field Values
-
ATTR_CONTEXT
protected static final String ATTR_CONTEXT
A Context bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_CONFIG
protected static final String ATTR_CONFIG
A PortletConfig bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_PORTLET
protected static final String ATTR_PORTLET
A VelocityPortlet bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_RUNDATA
protected static final String ATTR_RUNDATA
A JetspeedRunData bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_FRAME_REFRESH
public static final String ATTR_FRAME_REFRESH
Tool session attribute name used to schedule a peer frame refresh.- See Also:
- Constant Field Values
-
ATTR_TOP_REFRESH
public static final String ATTR_TOP_REFRESH
Tool session attribute name used to schedule a whole page refresh.- See Also:
- Constant Field Values
-
ATTR_FRAME_FOCUS
public static final String ATTR_FRAME_FOCUS
Tool session attribute name used to schedule a focus change.- See Also:
- Constant Field Values
-
-
Method Detail
-
initState
protected void initState(org.sakaiproject.event.api.SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
-
mainPanelUpdateId
public static String mainPanelUpdateId(String toolId)
Compute the courier update html element id for the main panel - add "." and other names for inner panels.- Parameters:
toolId- The tool (portlet) id.- Returns:
- The courier update html element id for the main panel.
-
titlePanelUpdateId
public static String titlePanelUpdateId(String toolId)
Compute the courier update html element id for the title panel.- Parameters:
toolId- The tool (portlet) id.- Returns:
- The courier update html element id for the title panel.
-
addAlert
public static void addAlert(org.sakaiproject.event.api.SessionState state, String message)Add another string to the alert message. Defaults to removing duplicates from the alert message- Parameters:
state- The session state.message- The string to add.
-
addAlert
public static void addAlert(org.sakaiproject.event.api.SessionState state, String message, boolean removeDuplicates)Add another string to the alert message.- Parameters:
state- The session state.message- The string to add.removeDuplicates- Remove duplicates from the alert
-
addFlashNotif
public static void addFlashNotif(org.sakaiproject.event.api.SessionState state, String message)Add another string to the flash notification message.- Parameters:
state- The session state.message- The string to add.
-
switchPanel
public static void switchPanel(org.sakaiproject.event.api.SessionState state, String newPanel)Switch to a new panel- Parameters:
state- The session state.newPanel- The new panel name
-
initState
protected void initState(org.sakaiproject.event.api.SessionState state, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Initialize for the first time the session state for this session. If overridden in a sub-class, make sure to call super.- Overrides:
initStatein classToolServlet- Parameters:
state- The session state.req- The current portlet request.res- The current portlet response.
-
updateState
protected void updateState(org.sakaiproject.event.api.SessionState state, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Update for this request processing the session state. If overridden in a sub-class, make sure to call super.- Overrides:
updateStatein classToolServlet- Parameters:
state- The session state.req- The current portlet request.res- The current portlet response.
-
toolModeDispatch
protected void toolModeDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws org.sakaiproject.tool.api.ToolException
Dispatch to a "do" method based on reflection. Override ToolServlet to support the old "build" ways.- Overrides:
toolModeDispatchin classToolServlet- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse- Throws:
org.sakaiproject.tool.api.ToolException
-
panelMethodName
protected String panelMethodName(String panel)
Allow extension classes to control which build method gets called for this pannel- Parameters:
panel-- Returns:
-
processAction
public void processAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Process a Portlet action.- Overrides:
processActionin classToolServlet
-
checkCSRFToken
public boolean checkCSRFToken(javax.servlet.http.HttpServletRequest request, RunData rundata, String action)
-
actionDispatch
protected void actionDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Dispatch to a "processAction" method based on reflection.- Overrides:
actionDispatchin classToolServlet- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse
-
helperActionDispatch
protected void helperActionDispatch(String methodBase, String methodExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String className)
Dispatch to a "processAction" method based on reflection in a helper class.- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse
-
getContext
protected Map<String,String> getContext(RunData data)
This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg.
-
build_permissions_context
protected String build_permissions_context(VelocityPortlet portlet, Context context, RunData data, org.sakaiproject.event.api.SessionState state)
-
saveOptions
protected void saveOptions()
Complete the options process with a save.
-
cancelOptions
protected void cancelOptions()
Cancel the options process.
-
addOptionsMenu
protected void addOptionsMenu(org.sakaiproject.cheftool.api.Menu bar, JetspeedRunData data)Add the options to the menu bar, if allowed.- Parameters:
bar- The menu bar to add to,ref- The resource reference to base the security decision upon.
-
allowedToOptions
protected boolean allowedToOptions()
Check if the current user is allowed to do options for the current context (site based)- Returns:
- true if the user is allowed to modify the current context's options, false if not.
-
doReset
public void doReset(RunData runData, Context context)
Handle the "reset tool" option from the Title bar.
-
resetTool
protected void resetTool(org.sakaiproject.event.api.SessionState state)
Reset the tool (state) to "home" conditions. Default here is to clear everything from state.- Parameters:
state- The tool's session state.
-
setVmStdRef
protected void setVmStdRef(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Add some standard references to the vm context.- Overrides:
setVmStdRefin classToolServlet- Parameters:
request- The render request.response- The render response.
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletExceptionRespond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode- Overrides:
doGetin classToolServlet- Throws:
javax.servlet.ServletException
-
checkRunData
protected void checkRunData(javax.servlet.http.HttpServletRequest req)
-
scheduleTopRefresh
protected void scheduleTopRefresh()
Schedule a refresh for whole page
-
schedulePeerFrameRefresh
protected void schedulePeerFrameRefresh(String id)
Schedule a refresh for a peer frame.- Parameters:
id- The peer frame's id.
-
scheduleFocusRefresh
protected void scheduleFocusRefresh(String[] path)
Schedule a focus change.- Parameters:
path- The desired focus path elements
-
getDateFormatString
public String[] getDateFormatString()
-
getTimeFormatString
public String[] getTimeFormatString()
Return a String array containing the "h", "m", "a", or "H" characters (corresponding to hour, minute, am/pm, or 24-hour) in the locale specific order
-
-