From d5604fda3d81b41eafa15ded94e8a42e0f6376e9 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 6 Oct 2006 15:58:59 +0000 Subject: [PATCH] . UI bug fixes to the Create XML Form wizard: - fixed issue where the Add To List button was enabled when nothing was selected - caused null-ptr exception when pressed in this state - fixed Next button enabled state when nothing is selected on the Configure Template Output Methods screen . Removed "additional properties" checkbox and text in Create Web Content Wizard details page - not applicable for this wizard git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4051 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../content/CreateXmlContentTypeWizard.java | 79 +++++++++++-------- .../configure-template-output-methods.jsp | 14 ++-- .../jsp/wcm/create-form-wizard/details.jsp | 14 ---- .../wcm/create-web-content-wizard/details.jsp | 13 --- 4 files changed, 54 insertions(+), 66 deletions(-) diff --git a/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java index 577e2ac44e..1a014e30cb 100644 --- a/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java @@ -16,44 +16,34 @@ */ package org.alfresco.web.bean.content; -import java.io.*; -import java.util.*; +import java.io.File; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; -import javax.faces.component.UIOutput; +import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.faces.model.DataModel; import javax.faces.model.ListDataModel; -import javax.faces.context.FacesContext; -import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; -import javax.servlet.ServletContext; -import javax.xml.parsers.ParserConfigurationException; -import org.alfresco.config.Config; -import org.alfresco.config.ConfigElement; -import org.alfresco.config.ConfigService; + import org.alfresco.model.ContentModel; import org.alfresco.model.WCMModel; -import org.alfresco.repo.content.MimetypeMap; import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wizard.BaseWizardBean; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.templating.*; -import org.alfresco.web.templating.xforms.*; -import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.templating.TemplatingService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; /** @@ -121,6 +111,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean protected ContentService contentService; private DataModel templateOutputMethodsDataModel; private List templateOutputMethods = null; + private String fileExtension = "shtml"; // ------------------------------------------------------------------------------ // Wizard implementation @@ -233,28 +224,52 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean case 1: { disabled = (this.getSchemaFileName() == null || - this.getSchemaFileName().length() == 0); + this.getSchemaFileName().length() == 0); + break; + } + case 2: + { + disabled = (this.templateOutputMethods.size() == 0); break; } } return disabled; } + + /** + * @return true if the Add To List button on the Template Output Methods should be disabled + */ + public boolean getAddToListDisabled() + { + return (getTemplateOutputMethodFileName() == null || fileExtension == null || fileExtension.length() == 0); + } + /** + * @return Returns the fileExtension. + */ + public String getFileExtension() + { + return this.fileExtension; + } + + /** + * @param fileExtension The fileExtension to set. + */ + public void setFileExtension(String fileExtension) + { + this.fileExtension = fileExtension; + } + + /** + * Add the selected template output method to the list + */ public void addSelectedTemplateOutputMethod(ActionEvent event) { - final UIOutput fileNameComponent = (UIOutput) - event.getComponent().findComponent("template-output-method-file-name"); - final UIOutput fileExtensionComponent = (UIOutput) - event.getComponent().findComponent("file-extension"); - final String fileName = (String)fileNameComponent.getValue(); - assert fileName != null; - assert this.getTemplateOutputMethodFileName() != null; - assert this.getTemplateOutputMethodFileName().equals(fileName); final TemplateOutputMethodData data = - new TemplateOutputMethodData(fileName, + new TemplateOutputMethodData(this.getTemplateOutputMethodFileName(), this.getTemplateOutputMethodFile(), - (String)fileExtensionComponent.getValue()); + this.fileExtension); this.templateOutputMethods.add(data); this.removeUploadedTemplateOutputMethodFile(); } diff --git a/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp b/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp index 6768957fbc..b29921d4e0 100644 --- a/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp +++ b/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp @@ -82,25 +82,25 @@ if (upload == null || upload.getFile() == null) value="/images/icons/required_field.gif" alt="Required Field" /> - + actionListener="#{WizardManager.bean.addSelectedTemplateOutputMethod}" + styleClass="wizardButton" disabled="#{WizardManager.bean.addToListDisabled}" /> + rendered="#{WizardManager.bean.templateOutputMethodsDataModel.rowCount != 0}"> @@ -109,13 +109,13 @@ if (upload == null || upload.getFile() == null) - + diff --git a/source/web/jsp/wcm/create-form-wizard/details.jsp b/source/web/jsp/wcm/create-form-wizard/details.jsp index 1a4c39c3ee..cb247a8f03 100644 --- a/source/web/jsp/wcm/create-form-wizard/details.jsp +++ b/source/web/jsp/wcm/create-form-wizard/details.jsp @@ -35,20 +35,6 @@ document.getElementById("wizard:finish-button").onclick = function() {finishButtonPressed = true; clear_wizard();} } - function checkButtonState() - { - if (document.getElementById("wizard:wizard-body:file-input").value.length == 0 ) - { - document.getElementById("wizard:next-button").disabled = true; - document.getElementById("wizard:finish-button").disabled = true; - } - else - { - document.getElementById("wizard:next-button").disabled = false; - document.getElementById("wizard:finish-button").disabled = false; - } - } - function validate() { // if (finishButtonPressed) diff --git a/source/web/jsp/wcm/create-web-content-wizard/details.jsp b/source/web/jsp/wcm/create-web-content-wizard/details.jsp index 1ee4a2a749..db52f4be25 100644 --- a/source/web/jsp/wcm/create-web-content-wizard/details.jsp +++ b/source/web/jsp/wcm/create-web-content-wizard/details.jsp @@ -98,16 +98,3 @@ - - - - - - - - - -