/** * Creates a list of possible elements of a template from the template property "template-elements".<p> * * @return the list of elements in a String array with element name, nice name (if present) and mandatory flag */ public List<CmsDialogElement> computeElements() { if (m_elementList == null) { m_elementList = computeElements(getCms(), getParamTempfile(), getElementLocale()); } return m_elementList; }
/** * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest) */ @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { // fill the parameter values in the get/set methods fillParamValues(request); // set the dialog type setParamDialogtype(DIALOG_TYPE); // set the action for the JSP switch if (DIALOG_UPDATE_ELEMENTS.equals(getParamAction())) { setAction(ACTION_UPDATE_ELEMENTS); } else { setAction(ACTION_DEFAULT); // build title for delete dialog setParamTitle(key( Messages.GUI_EDITOR_DIALOG_ELEMENTS_TITLE_1, new Object[] {CmsResource.getName(getParamResource())})); } } }
/** * Returns the current element locale.<p> * * @return the current element locale */ public Locale getElementLocale() { if (m_elementLocale == null) { m_elementLocale = CmsLocaleManager.getLocale(getParamElementlanguage()); } return m_elementLocale; }
List<CmsDialogElement> elementList = computeElements(); CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION); CmsXmlPage page = CmsXmlPageFactory.unmarshal(getCms(), file); boolean foundMandatory = false; m_changeElement = ""; || element.getName().equals(getParamElementname()) || Boolean.valueOf( getJsp().getRequest().getParameter(PREFIX_PARAM_BODY + element.getName())).booleanValue()) { if (!element.isExisting()) { page.addValue(element.getName(), getElementLocale()); page.setEnabled(element.getName(), getElementLocale(), true); if (element.isMandantory() && !foundMandatory) { m_changeElement = element.getName(); page.removeValue(element.getName(), getElementLocale()); getCms().writeFile(file); if (page.isEnabled(getParamElementname(), getElementLocale())) { m_changeElement = getParamElementname(); } else if (!foundMandatory) { if (elementList.size() > 0) { setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_UPDATE_ELEMENTS_0)); includeErrorpage(this, e);
retValue.append("<tr>\n"); retValue.append("\t<td class=\"textbold\" unselectable=\"on\">" + key(Messages.GUI_EDITOR_DIALOG_ELEMENTS_PAGEELEMENT_0) + "</td>\n"); retValue.append("\t<td class=\"textbold\" unselectable=\"on\"> " + key(Messages.GUI_EDITOR_DIALOG_ELEMENTS_ENABLED_0) + " </td>\n"); retValue.append("</tr>\n"); List elementList = computeElements(); CmsFile file = getCms().readFile(this.getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION); CmsXmlPage page = CmsXmlPageFactory.unmarshal(getCms(), file); retValue.append("\" value=\"true\""); if ((!page.hasValue(element.getName(), getElementLocale()) && element.isMandantory()) || page.isEnabled(element.getName(), getElementLocale())) { retValue.append(" checked=\"checked\""); if (element.isMandantory() || element.getName().equals(getParamElementname())) { retValue.append(" disabled=\"disabled\""); retValue.append(page.isEnabled(element.getName(), getElementLocale())); retValue.append(");</script>");
/** * Returns the list of active elements of the page.<p> * * @return the list of active elements of the page */ protected List<CmsDialogElement> getElementList() { if (m_elementList == null) { m_elementList = CmsDialogElements.computeElements(getCms(), m_page, getParamTempfile(), getElementLocale()); } return m_elementList; }
List elementList = computeElements(); CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION); CmsXmlPage page = CmsXmlPageFactory.unmarshal(getCms(), file); boolean foundMandatory = false; m_changeElement = ""; || element.getName().equals(getParamElementname()) || Boolean.valueOf(getJsp().getRequest().getParameter(PREFIX_PARAM_BODY + element.getName())).booleanValue()) { if (!element.isExisting()) { page.addValue(element.getName(), getElementLocale()); page.setEnabled(element.getName(), getElementLocale(), true); if (element.isMandantory() && !foundMandatory) { m_changeElement = element.getName(); page.removeValue(element.getName(), getElementLocale()); getCms().writeFile(file); if (page.isEnabled(getParamElementname(), getElementLocale())) { m_changeElement = getParamElementname(); } else if (!foundMandatory) { if (elementList.size() > 0) { setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_UPDATE_ELEMENTS_0)); includeErrorpage(this, e);
retValue.append( "\t<td class=\"textbold\" unselectable=\"on\">" + key(Messages.GUI_EDITOR_DIALOG_ELEMENTS_PAGEELEMENT_0) + "</td>\n"); retValue.append("\t<td class=\"textbold\" unselectable=\"on\"> " + key(Messages.GUI_EDITOR_DIALOG_ELEMENTS_ENABLED_0) + " </td>\n"); retValue.append("</tr>\n"); List<CmsDialogElement> elementList = computeElements(); CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION); CmsXmlPage page = CmsXmlPageFactory.unmarshal(getCms(), file); retValue.append("\" value=\"true\""); if ((!page.hasValue(element.getName(), getElementLocale()) && element.isMandantory()) || page.isEnabled(element.getName(), getElementLocale())) { retValue.append(" checked=\"checked\""); if (element.isMandantory() || element.getName().equals(getParamElementname())) { retValue.append(" disabled=\"disabled\""); retValue.append(page.isEnabled(element.getName(), getElementLocale())); retValue.append(");</script>");
/** * Returns the list of active elements of the page.<p> * * @return the list of active elements of the page */ protected List getElementList() { if (m_elementList == null) { m_elementList = CmsDialogElements.computeElements(getCms(), m_page, getParamTempfile(), getElementLocale()); } return m_elementList; }
/** * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest) */ @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { // fill the parameter values in the get/set methods fillParamValues(request); // set the dialog type setParamDialogtype(DIALOG_TYPE); // set the action for the JSP switch if (DIALOG_UPDATE_ELEMENTS.equals(getParamAction())) { setAction(ACTION_UPDATE_ELEMENTS); } else { setAction(ACTION_DEFAULT); // build title for delete dialog setParamTitle(key( Messages.GUI_EDITOR_DIALOG_ELEMENTS_TITLE_1, new Object[] {CmsResource.getName(getParamResource())})); } } }
/** * Creates a list of possible elements of a template from the template property "template-elements".<p> * * @return the list of elements in a String array with element name, nice name (if present) and mandatory flag */ public List computeElements() { if (m_elementList == null) { m_elementList = computeElements(getCms(), getParamTempfile(), getElementLocale()); } return m_elementList; }
/** * Creates a list of possible elements of a template from the template property "template-elements" * and the elements available in the provided resource file.<p> * * @param cms the CmsObject * @param xmlPageUri the resource to read the elements from * @param locale the current element locale * @return the list of elements in a String array with element name, nice name (if present) and mandatory flag */ public static List computeElements(CmsObject cms, String xmlPageUri, Locale locale) { CmsXmlPage page = null; try { // read the xmlpage file CmsFile pageFile = cms.readFile(xmlPageUri, CmsResourceFilter.IGNORE_EXPIRATION); page = CmsXmlPageFactory.unmarshal(cms, pageFile); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_XMLPAGE_FAILED_1, xmlPageUri), e); // xmlpage will be null, only "template-elements" property on template will be checked } return computeElements(cms, page, xmlPageUri, locale); }
/** * Returns the current element locale.<p> * * @return the current element locale */ public Locale getElementLocale() { if (m_elementLocale == null) { m_elementLocale = CmsLocaleManager.getLocale(getParamElementlanguage()); } return m_elementLocale; }
/** * Creates a list of possible elements of a template from the template property "template-elements" * and the elements available in the provided resource file.<p> * * @param cms the CmsObject * @param xmlPageUri the resource to read the elements from * @param locale the current element locale * @return the list of elements in a String array with element name, nice name (if present) and mandatory flag */ public static List<CmsDialogElement> computeElements(CmsObject cms, String xmlPageUri, Locale locale) { CmsXmlPage page = null; try { // read the xmlpage file CmsFile pageFile = cms.readFile(xmlPageUri, CmsResourceFilter.IGNORE_EXPIRATION); page = CmsXmlPageFactory.unmarshal(cms, pageFile); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_XMLPAGE_FAILED_1, xmlPageUri), e); // xmlpage will be null, only "template-elements" property on template will be checked } return computeElements(cms, page, xmlPageUri, locale); }