/** * Performs the exit editor action.<p> * * @see org.opencms.workplace.editors.CmsEditor#actionExit() */ @Override public void actionExit() throws IOException, JspException, ServletException { if (getAction() == ACTION_CANCEL) { // save and exit was cancelled return; } // unlock resource if we are in direct edit mode actionClear(false); // close the editor actionClose(); }
/** * Performs the save content action.<p> * * @see org.opencms.workplace.editors.CmsEditor#actionSave() */ @Override public void actionSave() throws JspException { actionSave(getElementLocale()); if (getAction() != ACTION_CANCEL) { // save successful, set save action setAction(ACTION_SAVE); } }
fillParamValues(request); setParamDialogtype(EDITOR_TYPE); if (getParamNewLink() != null) { setParamAction(EDITOR_ACTION_NEW); } else { if ((getParamTempfile() != null) && !"null".equals(getParamTempfile())) { try { m_file = getCms().readFile(this.getParamTempfile(), CmsResourceFilter.ALL); m_content = CmsXmlContentFactory.unmarshal(getCloneCms(), m_file); } catch (CmsException e) { showErrorPage(this, e); } catch (JspException exc) { if (EDITOR_SAVE.equals(getParamAction())) { setAction(ACTION_SAVE); } else if (EDITOR_SAVEEXIT.equals(getParamAction())) { setAction(ACTION_SAVEEXIT); } else if (EDITOR_EXIT.equals(getParamAction())) { setAction(ACTION_EXIT); } else if (EDITOR_CLOSEBROWSER.equals(getParamAction())) { actionClear(true); return; } else if (EDITOR_ACTION_CHECK.equals(getParamAction())) { setAction(ACTION_CHECK);
boolean showErrors = (getAction() != ACTION_NEW) && (getAction() != ACTION_DEFAULT); if (!nested && showErrors && (getValidationHandler().hasErrors())) { result.append("<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 0.3em;\"></span>"); boolean differentLocaleErrors = false; if ((getValidationHandler().getErrors(getElementLocale()) == null) || (getValidationHandler().getErrors().size() > getValidationHandler().getErrors(getElementLocale()).size())) { result.append(key(Messages.ERR_EDITOR_XMLCONTENT_VALIDATION_ERROR_TITLE_0)); result.append("</div>"); Map locErrors = getValidationHandler().getErrors(); Iterator locErrorsIter = locErrors.entrySet().iterator(); while (locErrorsIter.hasNext()) { if (getElementLocale().equals(locale)) { continue; result.append(key( Messages.ERR_EDITOR_XMLCONTENT_VALIDATION_ERROR_LANG_1, new Object[] {locale.getLanguage()})); result.append("\tposition: 'center',\n"); result.append("\tdialogClass: 'ui-state-error',\n"); result.append("\ttitle: '").append(key(Messages.ERR_EDITOR_XMLCONTENT_VALIDATION_ERROR_TITLE_0)).append( "',\n"); result.append("\tmaxHeight: 600\n");
/** * Generates the HTML form for the XML content editor.<p> * * @return the HTML that generates the form for the XML editor */ public String getXmlEditorForm() { // set "editor mode" attribute (required for link replacement in the root site) getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE); // add customized message bundle eventually specified in XSD of XML content addMessages(m_content.getContentDefinition().getContentHandler().getMessages(getLocale())); // initialize tab lists for error handling before generating the editor form m_errorTabs = new ArrayList(); m_warningTabs = new ArrayList(); return getXmlEditorForm(m_content.getContentDefinition(), "", true, false).toString(); }
/** * Performs a configurable action performed by the editor.<p> * * The default action is: save resource, clear temporary files and publish the resource directly.<p> * * @throws IOException if a forward fails * @throws ServletException of a forward fails * @throws JspException if including a JSP fails */ public void actionDirectEdit() throws IOException, JspException, ServletException { // get the action class from the OpenCms runtime property I_CmsEditorActionHandler actionClass = OpenCms.getWorkplaceManager().getEditorActionHandler(); if (actionClass == null) { // error getting the action class, save content and exit the editor actionSave(); actionExit(); } else { actionClass.editorAction(this, getJsp()); } }
fillParamValues(request); setParamDialogtype(EDITOR_TYPE); if (getParamNewLink() != null) { setParamAction(EDITOR_ACTION_NEW); } else { if ((getParamTempfile() != null) && !"null".equals(getParamTempfile())) { try { m_file = getCms().readFile(getParamTempfile(), CmsResourceFilter.ALL); m_content = CmsXmlContentFactory.unmarshal(getCloneCms(), m_file); } catch (CmsException e) { showErrorPage(this, e); } catch (JspException exc) { if (EDITOR_SAVE.equals(getParamAction())) { setAction(ACTION_SAVE); } else if (EDITOR_SAVEEXIT.equals(getParamAction())) { setAction(ACTION_SAVEEXIT); } else if (EDITOR_EXIT.equals(getParamAction())) { setAction(ACTION_EXIT); } else if (EDITOR_ACTION_SUBCHOICES.equals(getParamAction())) { setAction(ACTION_SUBCHOICES); } else if (EDITOR_CLOSEBROWSER.equals(getParamAction())) { actionClear(true); return;
boolean showErrors = (getAction() != ACTION_NEW) && (getAction() != ACTION_DEFAULT) && (getAction() != ACTION_ELEMENT_ADD) && (getAction() != ACTION_ELEMENT_REMOVE) && (getAction() != ACTION_ELEMENT_MOVE_DOWN) && (getAction() != ACTION_ELEMENT_MOVE_UP); if (!nested && showErrors && (getValidationHandler().hasErrors())) { "<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 0.3em;\"></span>"); boolean differentLocaleErrors = false; if ((getValidationHandler().getErrors(getElementLocale()) == null) || (getValidationHandler().getErrors().size() > getValidationHandler().getErrors( getElementLocale()).size())) { result.append(key(Messages.ERR_EDITOR_XMLCONTENT_VALIDATION_ERROR_TITLE_0)); result.append("</div>"); Map<Locale, Map<String, String>> locErrors = getValidationHandler().getErrors(); Iterator<Map.Entry<Locale, Map<String, String>>> locErrorsIter = locErrors.entrySet().iterator(); while (locErrorsIter.hasNext()) { if (getElementLocale().equals(locale)) { continue; result.append(key( Messages.ERR_EDITOR_XMLCONTENT_VALIDATION_ERROR_LANG_1, new Object[] {locale.getLanguage()}));
/** * Generates the HTML form for the XML content editor.<p> * * @return the HTML that generates the form for the XML editor */ public String getXmlEditorForm() { // set "editor mode" attribute (required for link replacement in the root site) getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE); // add customized message bundle eventually specified in XSD of XML content addMessages(m_content.getHandler().getMessages(getLocale())); ((CmsMultiMessages)getMessages()).setFallbackHandler(m_content.getHandler().getMessageKeyHandler()); // initialize tab lists for error handling before generating the editor form m_errorTabs = new ArrayList<CmsXmlContentTab>(); m_warningTabs = new ArrayList<CmsXmlContentTab>(); return getXmlEditorForm(m_content.getContentDefinition(), "", true, false).toString(); }
/** * Performs a configurable action performed by the editor.<p> * * The default action is: save resource, clear temporary files and publish the resource directly.<p> * * @throws IOException if a forward fails * @throws ServletException of a forward fails * @throws JspException if including a JSP fails */ public void actionDirectEdit() throws IOException, JspException, ServletException { // get the action class from the OpenCms runtime property I_CmsEditorActionHandler actionClass = OpenCms.getWorkplaceManager().getEditorActionHandler(); if (actionClass == null) { // error getting the action class, save content and exit the editor actionSave(); actionExit(); } else { actionClass.editorAction(this, getJsp()); } }
/** * Performs the save content action.<p> * * @see org.opencms.workplace.editors.CmsEditor#actionSave() */ @Override public void actionSave() throws JspException { actionSave(getElementLocale()); if (getAction() != ACTION_CANCEL) { // save successful, set save action setAction(ACTION_SAVE); } }
/** * Performs the exit editor action.<p> * * @see org.opencms.workplace.editors.CmsEditor#actionExit() */ @Override public void actionExit() throws IOException, JspException, ServletException { if (getAction() == ACTION_CANCEL) { // save and exit was canceled return; } // unlock resource if we are in direct edit mode actionClear(false); // close the editor actionClose(); }