/** * Returns the OpenCms user context to use.<p> * * @return the OpenCms user context to use */ protected CmsObject getCmsObject() { return m_jspActionElement.getCmsObject(); }
/** * Reads the editor configuration file valid for the current user and caches the result in a Map.<p> * * The configuration settings of the found file are stored in a Map holding the loaded configuration * with the configuration file name as key.<p> * * The configuration file name to use for the current user is stored in another Map with the user name * as key.<p> * * @param jsp the JSP action element to access the VFS and current user information * @return the display options to use for the current user or null if no display options were found */ public Properties getDisplayOptions(CmsJspActionElement jsp) { return getDisplayOptions(jsp.getCmsObject()); }
/** * Reads the editor configuration file valid for the current user and caches the result in a Map.<p> * * The configuration settings of the found file are stored in a Map holding the loaded configuration * with the configuration file name as key.<p> * * The configuration file name to use for the current user is stored in another Map with the user name * as key.<p> * * @param jsp the JSP action element to access the VFS and current user information * @return the display options to use for the current user or null if no display options were found */ public Properties getDisplayOptions(CmsJspActionElement jsp) { return getDisplayOptions(jsp.getCmsObject()); }
/** * Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the * site of the given explorerRootPath and show the folder given in the explorerRootPath. * <p> * * @param jsp * needed for link functionality. * * @param explorerRootPath * a root relative folder link (has to end with '/'). * * @return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the * site of the given explorerRootPath and show the folder given in the explorerRootPath. */ public static String getWorkplaceExplorerLink(final CmsJspActionElement jsp, final String explorerRootPath) { return getWorkplaceExplorerLink(jsp.getCmsObject(), explorerRootPath); }
/** * @see org.opencms.workplace.I_CmsDialogHandler#getDialogUri(java.lang.String, CmsJspActionElement) */ public String getDialogUri(String resource, CmsJspActionElement jsp) { switch (getDialogAction(jsp.getCmsObject())) { case TYPE_LOCK: return URI_LOCK_DIALOG; case TYPE_LOCKCHANGE: return URI_LOCKCHANGE_DIALOG; case TYPE_UNLOCK: return URI_UNLOCK_DIALOG; case TYPE_LOCKS: default: return URI_LOCKS_DIALOG; } }
/** * @see org.opencms.workplace.editors.I_CmsEditorActionHandler#isButtonActive(CmsJspActionElement, java.lang.String) */ public boolean isButtonActive(CmsJspActionElement jsp, String resourceName) { try { OpenCms.getPublishManager().getPublishList( jsp.getCmsObject(), jsp.getCmsObject().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION), false); return true; } catch (Exception e) { return false; } } }
/** * @see org.opencms.workplace.editors.I_CmsEditorActionHandler#isButtonActive(CmsJspActionElement, java.lang.String) */ public boolean isButtonActive(CmsJspActionElement jsp, String resourceName) { try { OpenCms.getPublishManager().getPublishList( jsp.getCmsObject(), jsp.getCmsObject().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION), false); return true; } catch (Exception e) { return false; } } }
/** * Initializes this workplace class instance.<p> * * This method can be used in case there a workplace class was generated using * {@link Class#forName(java.lang.String)} to initialize the class members.<p> * * @param jsp the initialized JSP context */ protected void initWorkplaceMembers(CmsJspActionElement jsp) { if (jsp != null) { m_jsp = jsp; initWorkplaceMembers(m_jsp.getCmsObject(), m_jsp.getRequest().getSession()); } }
/** * Returns the current uri for the navigation.<p> * * @return the current uri for the navigation */ public String getNavigationUri() { return getCmsObject().getRequestContext().getUri(); }
/** * Creates a <code>CmsNaviationListView</code> which uses the given * <code>CmsJspActionElement</code> for accessing the underlying * navigation API. <p> * * @param jsp the <code>CmsJspActionElement</code> to use */ public CmsHelpNavigationListView(CmsJspActionElement jsp) { m_jsp = jsp; m_navRootPath = m_jsp.getCmsObject().getRequestContext().getUri(); }
/** * Creates a <code>CmsNaviationListView</code> which uses the given * <code>CmsJspActionElement</code> for accessing the underlying * navigation API. <p> * * @param jsp the <code>CmsJspActionElement</code> to use */ public CmsHelpNavigationListView(CmsJspActionElement jsp) { m_jsp = jsp; m_navRootPath = m_jsp.getCmsObject().getRequestContext().getUri(); }
/** * Returns an initialized {@link CmsJspNavBuilder} instance.<p> * * @return an initialized navigation builder instance * * @see org.opencms.jsp.CmsJspNavBuilder */ public CmsJspNavBuilder getNavigation() { if (isNotInitialized()) { return null; } if (m_vfsNav == null) { m_vfsNav = new CmsJspNavBuilder(getCmsObject()); } return m_vfsNav; }
/** * Returns an initialized {@link CmsJspNavBuilder} instance.<p> * * @return CmsJspNavBuilder an initialized <code>CmsJspNavBuilder</code> * * @see org.opencms.jsp.CmsJspNavBuilder */ public CmsJspNavBuilder getNavigation() { if (isNotInitialized()) { return null; } if (m_navigation == null) { m_navigation = new CmsJspNavBuilder(getCmsObject()); } return m_navigation; }
/** * Redirects the response to the target link.<p> * * Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} * to avoid relative links with secure sites (and issues with apache).<p> * * @param jsp the OpenCms JSP context * @param target the target link * * @throws IOException if something goes wrong during redirection */ public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
/** * Redirects the response to the target link.<p> * * Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} * to avoid relative links with secure sites (and issues with apache).<p> * * @param jsp the OpenCms JSP context * @param target the target link * * @throws IOException if something goes wrong during redirection */ public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
/** * Constructor with the action element to use. <p> * * @param action the action element to use */ public CmsHelpSearchResultView(CmsJspActionElement action) { m_jsp = action; this.m_formCache = new TreeMap(); try { m_onlineProject = m_jsp.getCmsObject().readProject(CmsProject.ONLINE_PROJECT_ID); m_offlineProject = m_jsp.getRequestContext().currentProject(); } catch (CmsException e) { // failed to get online project, at least avoid NPE m_onlineProject = m_offlineProject; } }
/** * Redirects the response to the target link using a "301 - Moved Permanently" header.<p> * * This implementation will work only on JSP pages in OpenCms that use the default JSP loader implementation.<p> * * @param jsp the OpenCms JSP context * @param target the target link */ public static void redirectPermanently(CmsJspActionElement jsp, String target) { String newTarget = OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true); jsp.getRequest().setAttribute( CmsRequestUtil.ATTRIBUTE_ERRORCODE, new Integer(HttpServletResponse.SC_MOVED_PERMANENTLY)); jsp.getResponse().setHeader(HEADER_LOCATION, newTarget); jsp.getResponse().setHeader(HEADER_CONNECTION, "close"); }
/** * Constructor with the action element to use. <p> * * @param action the action element to use */ public CmsHelpSearchResultView(CmsJspActionElement action) { m_jsp = action; m_formCache = new TreeMap<String, String>(); try { m_onlineProject = m_jsp.getCmsObject().readProject(CmsProject.ONLINE_PROJECT_ID); m_offlineProject = m_jsp.getRequestContext().getCurrentProject(); } catch (CmsException e) { // failed to get online project, at least avoid NPE m_onlineProject = m_offlineProject; } }
/** * Returns a list of a categories related to the current request resource.<p> * * @return a list of a categories related to the current request resource * * @throws CmsException if something goes wrong */ protected List<CmsCategory> getResourceCategories() throws CmsException { if (m_resCats == null) { m_resCats = m_categoryService.readResourceCategories(getJsp().getCmsObject(), getParamResource()); } return m_resCats; }
/** * Returns a list of a categories related to the current request resource.<p> * * @return a list of a categories related to the current request resource * * @throws CmsException if something goes wrong */ protected List getResourceCategories() throws CmsException { if (m_resCats == null) { m_resCats = m_categoryService.readResourceCategories(getJsp().getCmsObject(), getParamResource()); } return m_resCats; }