. 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
This commit is contained in:
Kevin Roast
2006-10-06 15:58:59 +00:00
parent 96654d4dd4
commit d5604fda3d
4 changed files with 54 additions and 66 deletions

View File

@@ -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<TemplateOutputMethodData> templateOutputMethods = null;
private String fileExtension = "shtml";
// ------------------------------------------------------------------------------
// Wizard implementation
@@ -233,7 +224,12 @@ 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;
}
}
@@ -241,20 +237,39 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
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();
}

View File

@@ -82,25 +82,25 @@ if (upload == null || upload.getFile() == null)
value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="file_extension_output_text"
value="#{msg.extension_for_generated_assets}:"/>
<h:inputText id="file-extension" value="shtml"
<h:inputText id="file-extension" value="#{WizardManager.bean.fileExtension}"
maxlength="10" size="10"/>
</h:panelGrid>
<h:panelGroup id="step-2-panel-group" styleClass="mainSubText">
<h:outputText id="step-2-output-text" value="2." />
<h:commandButton id="add-to-list-button" value="#{msg.add_to_list_button}"
actionListener="#{CreateXmlContentTypeWizard.addSelectedTemplateOutputMethod}"
styleClass="wizardButton" />
actionListener="#{WizardManager.bean.addSelectedTemplateOutputMethod}"
styleClass="wizardButton" disabled="#{WizardManager.bean.addToListDisabled}" />
</h:panelGroup>
<h:outputText id="selected_template_output_methods_output_text"
styleClass="mainSubText" value="#{msg.selected_templateoutputmethods}" />
<h:panelGroup id="data-table-panel-group">
<h:dataTable id="template_output_method_data_table"
value="#{CreateXmlContentTypeWizard.templateOutputMethodsDataModel}" var="row"
value="#{WizardManager.bean.templateOutputMethodsDataModel}" var="row"
rowClasses="selectedItemsRow,selectedItemsRowAlt"
styleClass="selectedItems" headerClass="selectedItemsHeader"
cellspacing="0" cellpadding="4"
rendered="#{CreateXmlContentTypeWizard.templateOutputMethodsDataModel.rowCount != 0}">
rendered="#{WizardManager.bean.templateOutputMethodsDataModel.rowCount != 0}">
<h:column id="data-table-column-1">
<f:facet name="header">
<h:outputText id="data-table-name" value="#{msg.name}" />
@@ -109,13 +109,13 @@ if (upload == null || upload.getFile() == null)
</h:column>
<h:column id="data-table-column-2">
<a:actionLink id="remove-select-template-output-method-action-link"
actionListener="#{CreateXmlContentTypeWizard.removeSelectedTemplateOutputMethod}"
actionListener="#{WizardManager.bean.removeSelectedTemplateOutputMethod}"
image="/images/icons/delete.gif"
value="#{msg.remove}" showLink="false" style="padding-left:6px" />
</h:column>
</h:dataTable>
<a:panel id="no-items" rendered="#{CreateXmlContentTypeWizard.templateOutputMethodsDataModel.rowCount == 0}">
<a:panel id="no-items" rendered="#{WizardManager.bean.templateOutputMethodsDataModel.rowCount == 0}">
<h:panelGrid id="no-items-panel-grid" columns="1" cellpadding="2" styleClass="selectedItems" rowClasses="selectedItemsHeader,selectedItemsRow">
<h:outputText styleClass="selectedItemsHeader" id="no-items-name" value="#{msg.name}" />
<h:outputText styleClass="selectedItemsRow" id="no-items-msg" value="#{msg.no_selected_items}" />

View File

@@ -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)

View File

@@ -98,16 +98,3 @@
<f:selectItems value="#{WizardManager.bean.createTemplateTypes}" />
</h:selectOneMenu>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="3" cellspacing="3" border="0" style="padding-top: 4px;"
width="100%" rowClasses="wizardSectionHeading, paddingRow"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:outputText value="&nbsp;#{msg.other_properties}" escape="false" />
<h:outputText value="#{msg.modify_props_help_text}" />
</h:panelGrid>
<h:panelGrid style="padding-top: 2px;" columns="2"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:selectBooleanCheckbox value="#{WizardManager.bean.showOtherProperties}" />
<h:outputText value="#{msg.modify_props_when_wizard_closes}" />
</h:panelGrid>