/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.workplace.CmsWorkplace) */ public boolean isEnabled(CmsWorkplace wp) { return isEnabled(wp.getCms()); }
/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isVisible(org.opencms.workplace.CmsWorkplace) */ public boolean isVisible(CmsWorkplace wp) { return isVisible(wp.getCms()); }
/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.workplace.CmsWorkplace) */ public boolean isEnabled(CmsWorkplace wp) { return isEnabled(wp.getCms()); }
/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isVisible(org.opencms.workplace.CmsWorkplace) */ public boolean isVisible(CmsWorkplace wp) { return isVisible(wp.getCms()); }
/** * Helper method to change back from the temporary project to the current project.<p> * * @throws CmsException if switching back fails */ protected void switchToCurrentProject() throws CmsException { if (m_currentProjectId != null) { // switch back to the current users project getCms().getRequestContext().setCurrentProject(getCms().readProject(m_currentProjectId)); } }
/** * Helper method to change back from the temporary project to the current project.<p> * * @throws CmsException if switching back fails */ protected void switchToCurrentProject() throws CmsException { if (m_currentProjectId != null) { // switch back to the current users project getCms().getRequestContext().setCurrentProject(getCms().readProject(m_currentProjectId)); } }
/** * @see org.opencms.workplace.list.A_CmsListIndependentJsAction#jsCode(CmsWorkplace) */ @Override public String jsCode(CmsWorkplace wp) { String url = OpenCms.getLinkManager().substituteLink( wp.getCms(), "/system/workplace/commons/list-print.jsp?" + CmsListPrintDialog.PARAM_LISTCLASS + "=" + CmsEncoder.encode(wp.getClass().getName())); String opts = "toolbar=no,location=no,directories=no,status=yes,menubar=0,scrollbars=yes,resizable=yes,top=50,left=50,width=700,height=500"; StringBuffer js = new StringBuffer(512); js.append("javascript:window.open('"); js.append(url); js.append("', 'opencmsprintlist', '"); js.append(opts); js.append("');"); return js.toString(); } }
/** * Returns true if the online help for the users current workplace language is installed.<p> * * @return true if the online help for the users current workplace language is installed */ public boolean isHelpEnabled() { return getCms().existsResource( resolveMacros(CmsHelpTemplateBean.PATH_HELP), CmsResourceFilter.IGNORE_EXPIRATION); }
/** * Returns all parameters of the current workplace class * as hidden field tags that can be inserted in a form.<p> * * @return all parameters of the current workplace class * as hidden field tags that can be inserted in a html form */ public String allParamsAsHidden() { StringBuffer result = new StringBuffer(512); Map<String, Object> params = allParamValues(); Iterator<Entry<String, Object>> i = params.entrySet().iterator(); while (i.hasNext()) { Entry<String, Object> entry = i.next(); result.append("<input type=\"hidden\" name=\""); result.append(entry.getKey()); result.append("\" value=\""); String encoded = CmsEncoder.encode(entry.getValue().toString(), getCms().getRequestContext().getEncoding()); result.append(encoded); result.append("\">\n"); } return result.toString(); }
/** * Returns all initialized parameters of the current workplace class * as request parameters, i.e. in the form <code>key1=value1&key2=value2</code> etc. * * @return all initialized parameters of the current workplace class * as request parameters */ public String paramsAsRequest() { StringBuffer result = new StringBuffer(512); Map<String, Object> params = paramValues(); Iterator<Entry<String, Object>> i = params.entrySet().iterator(); while (i.hasNext()) { Entry<String, Object> entry = i.next(); result.append(entry.getKey()); result.append("="); result.append(CmsEncoder.encode(entry.getValue().toString(), getCms().getRequestContext().getEncoding())); if (i.hasNext()) { result.append("&"); } } return result.toString(); }
/** * Returns the uri (including context path) to the explorer file list.<p> * * @return the uri (including context path) to the explorer file list */ public String getExplorerFileListFullUri() { if (m_file_explorer_filelist != null) { return m_file_explorer_filelist; } synchronized (this) { m_file_explorer_filelist = OpenCms.getLinkManager().substituteLink(getCms(), FILE_EXPLORER_FILELIST); } return m_file_explorer_filelist; }
/** * Returns the uri (including context path) to the explorer file list.<p> * * @return the uri (including context path) to the explorer file list */ public String getExplorerFileListFullUri() { if (m_file_explorer_filelist != null) { return m_file_explorer_filelist; } synchronized (this) { m_file_explorer_filelist = OpenCms.getLinkManager().substituteLink(getCms(), FILE_EXPLORER_FILELIST); } return m_file_explorer_filelist; }
/** * @see org.opencms.workplace.tools.A_CmsToolHandler#isEnabled(org.opencms.workplace.CmsWorkplace) */ @Override public boolean isEnabled(CmsWorkplace wp) { if (getPath().startsWith("/searchindex/singleindex/search") && (getParameters(wp).get(A_CmsEditSearchIndexDialog.PARAM_INDEXNAME) != null) && (getParameters(wp).get(A_CmsEditSearchIndexDialog.PARAM_INDEXNAME).length > 0)) { String indexName = getParameters(wp).get(A_CmsEditSearchIndexDialog.PARAM_INDEXNAME)[0]; if (!CmsSearchManager.isLuceneIndex(indexName)) { return false; } } return isEnabled(wp.getCms()); }
/** * @see org.opencms.workplace.tools.A_CmsToolHandler#getParameters(org.opencms.workplace.CmsWorkplace) */ @Override public Map getParameters(CmsWorkplace wp) { if (OpenCms.getRoleManager().hasRole(wp.getCms(), CmsRole.PROJECT_MANAGER)) { return super.getParameters(wp); } else { Map argMap = new HashMap(); argMap.put(PROJECT_ID, wp.getCms().getRequestContext().getCurrentProject().getUuid().toString()); argMap.put(PROJECT_NAME, wp.getCms().getRequestContext().getCurrentProject().getName()); if (wp instanceof CmsProjectFilesDialog) { argMap.put(A_CmsListExplorerDialog.PARAM_SHOW_EXPLORER, "false"); } if (wp instanceof CmsAdminDialog) { argMap.put(A_CmsListExplorerDialog.PARAM_SHOW_EXPLORER, "true"); } return argMap; } }
/** * Helper method to change the current project to the temporary file project.<p> * * The id of the old project is stored in a member variable to switch back.<p> * * @return the id of the tempfileproject * @throws CmsException if getting the tempfileproject id fails */ protected CmsUUID switchToTempProject() throws CmsException { // store the current project id in member variable m_currentProjectId = getSettings().getProject(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); getCms().getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); return tempProjectId; }
/** * Decodes an individual parameter value.<p> * * In special cases some parameters might require a different-from-default * encoding. This is the case if the content of the parameter was * encoded using the JavaScript encodeURIComponent() method on the client, * which always encodes in UTF-8.<p> * * @param paramName the name of the parameter * @param paramValue the unencoded value of the parameter * * @return the encoded value of the parameter */ protected String decodeParamValue(String paramName, String paramValue) { if ((paramName != null) && (paramValue != null)) { return CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); } else { return null; } }
/** * Helper method to change the current project to the temporary file project.<p> * * The id of the old project is stored in a member variable to switch back.<p> * * @return the id of the tempfileproject * @throws CmsException if getting the tempfileproject id fails */ protected CmsUUID switchToTempProject() throws CmsException { // store the current project id in member variable m_currentProjectId = getSettings().getProject(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); getCms().getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); return tempProjectId; }
/** * Decodes an individual parameter value.<p> * * In special cases some parameters might require a different-from-default * encoding. This is the case if the content of the parameter was * encoded using the JavaScript encodeURIComponent() method on the client, * which always encodes in UTF-8.<p> * * @param paramName the name of the parameter * @param paramValue the unencoded value of the parameter * * @return the encoded value of the parameter */ protected String decodeParamValue(String paramName, String paramValue) { if ((paramName != null) && (paramValue != null)) { return CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); } else { return null; } }
/** * @see org.opencms.workplace.list.CmsListDirectAction#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } return defButtonHtml( wp.getCms(), getId() + getItem().getId(), getId(), resolveName(wp.getLocale()), resolveHelpText(wp.getLocale()), isEnabled(), getIconPath(), null, resolveOnClic(wp.getLocale()), getColumnForTexts() == null); }
/** * @see org.opencms.workplace.list.CmsListDirectAction#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } return defButtonHtml( wp.getCms(), getId() + getItem().getId(), getId(), resolveName(wp.getLocale()), resolveHelpText(wp.getLocale()), isEnabled(), getIconPath(), null, resolveOnClic(wp.getLocale()), getColumnForTexts() == null); }