diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index f64bb23275..cc5e815159 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -808,19 +808,23 @@ website_dnsname=DNS name validation_invalid_dns_name=Invalid website DNS name, a minimum of 2 alpha-numeric characters are accepted. website_forms=Form Templates website_selected_forms=Selected Web Content Forms -website_save_scripts=Save Scripts -website_save_scripts_info=Use the following scripts when saving changes -website_pre_script=Pre-script -website_post_script=Post-script +website_save_location=Save Location +website_save_location_info=Use the following pattern when saving content +website_filename_pattern=Filename pattern website_workflow=Workflow website_workflow_info=Use the following workflow +website_form_summary=Using workflow ''{0}'', with filename pattern ''{1}'', {2} template(s) selected. form_template_details=Form Details form_template_details_desc=Edit the details of this Form Template form_template_conf_workflow=Configure Workflow form_template_select_templates=Select Templates +form_template_templates=Manage Presentation Templates +form_template_templates_desc=Setup the Presentation Templates you want to use for the Web Content Form. create_website_step2_title=Step Two - Form Templates create_website_step2_desc=Setup the forms you want to use in this project. website_select_form=Select Form Templates to use +website_select_templates=Select Presentation Templates to use +website_selected_templates=Selected Presentation Templates website_invite=Invite Users create_website_step3_title=Step Three - Invite Users create_website_step3_desc=Select users and their roles. diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 18fb1b95d6..e0cb212603 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -146,9 +146,13 @@ managed-bean="EditFolderPropertiesDialog" icon="/images/icons/details_large.gif" title-id="edit_folder_properties" description-id="edit_folder_description" /> - + + diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 8a73357fda..28adb3177a 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -17,6 +17,7 @@ package org.alfresco.web.bean.wcm; import java.io.Serializable; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -50,6 +51,7 @@ import org.alfresco.web.bean.wizard.BaseWizardBean; import org.alfresco.web.bean.wizard.InviteUsersWizard.UserGroupRole; import org.alfresco.web.forms.Form; import org.alfresco.web.forms.FormsService; +import org.alfresco.web.forms.RenderingEngine; import org.alfresco.web.ui.common.component.UIListItem; import org.alfresco.web.ui.common.component.UISelectList; import org.alfresco.web.ui.wcm.WebResources; @@ -65,6 +67,8 @@ public class CreateWebsiteWizard extends BaseWizardBean private static final String MSG_DESCRIPTION = "description"; private static final String MSG_NAME = "name"; private static final String MSG_USERROLES = "create_website_summary_users"; + private static final String MSG_FORM_SUMMARY = "website_form_summary"; + private static final String MSG_NONE = "value_not_set"; private static final String ROLE_CONTENT_MANAGER = "ContentManager"; @@ -108,7 +112,7 @@ public class CreateWebsiteWizard extends BaseWizardBean this.title = null; this.description = null; this.formsDataModel = null; - this.forms = new ArrayList(); + this.forms = new ArrayList(8); // init the dependant bean we are using for the invite users pages InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); @@ -346,7 +350,7 @@ public class CreateWebsiteWizard extends BaseWizardBean for (Form form : forms) { UIListItem item = new UIListItem(); - item.setValue(form.getName()); + item.setValue(form); item.setLabel(form.getName()); item.setDescription((String)this.nodeService.getProperty( form.getNodeRef(), ContentModel.PROP_DESCRIPTION)); @@ -366,7 +370,8 @@ public class CreateWebsiteWizard extends BaseWizardBean int index = selectList.getRowIndex(); if (index != -1) { - this.forms.add(new FormWrapper((String)this.formsList.get(index).getValue())); + Form form = (Form)this.formsList.get(index).getValue(); + this.forms.add(new FormWrapper(form)); } } @@ -670,19 +675,27 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public static class FormWrapper { - private String name; + private Form form; private String title; private String description; + private String workflow; + private String filenamePattern; + private List templates = new ArrayList(8); - FormWrapper(String name) + FormWrapper(Form form) { - this.name = name; - this.title = name; + this.form = form; + this.title = form.getName(); + } + + public Form getForm() + { + return this.form; } public String getName() { - return this.name; + return this.form.getName(); } public String getTitle() @@ -705,9 +718,121 @@ public class CreateWebsiteWizard extends BaseWizardBean this.description = description; } + /** + * @return Returns the workflow. + */ + public String getWorkflow() + { + return this.workflow; + } + + /** + * @param workflow The workflow to set. + */ + public void setWorkflow(String workflow) + { + this.workflow = workflow; + } + + /** + * @return Returns the filename pattern. + */ + public String getFilenamePattern() + { + return this.filenamePattern; + } + + /** + * @param filenamePattern The filename pattern to set. + */ + public void setFilenamePattern(String filenamePattern) + { + this.filenamePattern = filenamePattern; + } + + /** + * @return Returns the presentation templates. + */ + public List getTemplates() + { + return this.templates; + } + + /** + * @param templates The presentation templates to set. + */ + public void setTemplates(List templates) + { + this.templates = templates; + } + + /** + * @return Human readable summary of the configuration for this form + */ public String getDetails() { - return "Using workflow 'default-workflow', pre-script, post-script, no templates selected."; + String none = '<' + Application.getMessage(FacesContext.getCurrentInstance(), MSG_NONE) + '>'; + return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_FORM_SUMMARY), + this.workflow != null ? this.workflow : none, + this.filenamePattern != null ? this.filenamePattern : none, + this.templates != null ? this.templates.size() : 0); + } + } + + public static class PresentationTemplate + { + private RenderingEngine engine; + private String title; + private String description; + private String filenamePattern; + + public PresentationTemplate(RenderingEngine engine, String filenamePattern) + { + this.engine = engine; + this.filenamePattern = filenamePattern; + } + + public RenderingEngine getRenderingEngine() + { + return this.engine; + } + + public String getTitle() + { + if (this.title == null) + { + this.title = (String)Repository.getServiceRegistry( + FacesContext.getCurrentInstance()).getNodeService().getProperty( + engine.getNodeRef(), ContentModel.PROP_NAME); + } + return this.title; + } + + public String getDescription() + { + if (this.description == null) + { + this.description = (String)Repository.getServiceRegistry( + FacesContext.getCurrentInstance()).getNodeService().getProperty( + engine.getNodeRef(), ContentModel.PROP_DESCRIPTION); + } + return this.description; + } + + /** + * @return Returns the filename pattern. + */ + public String getFilenamePattern() + { + return this.filenamePattern; + } + + /** + * @param filenamePattern The filename pattern to set. + */ + public void setFilenamePattern(String filenamePattern) + { + this.filenamePattern = filenamePattern; } } } diff --git a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java b/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java index c4025ee708..a4e1ecf7c9 100644 --- a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java @@ -21,10 +21,16 @@ import java.util.List; import java.util.Map; import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.web.bean.TemplateSupportBean; import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; import org.alfresco.web.ui.common.component.UIListItem; +import org.alfresco.web.ui.wcm.WebResources; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -40,9 +46,8 @@ public class FormDetailsDialog extends BaseDialogBean private String title; private String description; - private String preScript; - private String postScript; - private String[] workflowSelectedValue; + private String filenamePattern; + private String[] workflowSelectedValue = {"default"}; /** @@ -71,6 +76,14 @@ public class FormDetailsDialog extends BaseDialogBean { this.websiteWizard = wizard; } + + /** + * @return an object representing the form for the current action + */ + public FormWrapper getActionForm() + { + return this.websiteWizard.getActionForm(); + } /** * @return Returns the description. @@ -79,7 +92,7 @@ public class FormDetailsDialog extends BaseDialogBean { if (this.description == null) { - this.description = this.websiteWizard.getActionForm().getDescription(); + this.description = getActionForm().getDescription(); } return this.description; } @@ -99,7 +112,7 @@ public class FormDetailsDialog extends BaseDialogBean { if (this.title == null) { - this.title = this.websiteWizard.getActionForm().getTitle(); + this.title = getActionForm().getTitle(); } return this.title; } @@ -113,35 +126,23 @@ public class FormDetailsDialog extends BaseDialogBean } /** - * @return Returns the post-save Script. + * @return Returns the filename pattern */ - public String getPostScript() + public String getFilenamePattern() { - return this.postScript; + if (this.filenamePattern == null) + { + this.filenamePattern = getActionForm().getFilenamePattern(); + } + return this.filenamePattern; } /** - * @param postScript The post-save Script to set. + * @param pattern The filename pattern to set. */ - public void setPostScript(String postScript) + public void setFilenamePattern(String pattern) { - this.postScript = postScript; - } - - /** - * @return Returns the pre-save Script. - */ - public String getPreScript() - { - return this.preScript; - } - - /** - * @param preScript The pre-save Script to set. - */ - public void setPreScript(String preScript) - { - this.preScript = preScript; + this.filenamePattern = pattern; } /** @@ -160,10 +161,20 @@ public class FormDetailsDialog extends BaseDialogBean this.workflowSelectedValue = workflowSelectedValue; } + /** + * @return List of UIListItem object representing the available workflows for the template + */ public List getWorkflowList() { List items = new ArrayList(); + UIListItem item = new UIListItem(); + item.setValue("default"); + item.setLabel("Default"); + item.setDescription("Default adhoc workflow"); + item.setImage(WebResources.IMAGE_WORKFLOW_32); + items.add(item); + return items; } @@ -177,7 +188,24 @@ public class FormDetailsDialog extends BaseDialogBean @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { - // TODO: push values from title/description etc. back into action FormWrapper! + // push values from title/description etc. back into action FormWrapper + FormWrapper form = getActionForm(); + if (this.title != null) + { + form.setTitle(this.title); + } + if (this.description != null) + { + form.setDescription(this.description); + } + if (this.filenamePattern != null) + { + form.setFilenamePattern(this.filenamePattern); + } + if (this.workflowSelectedValue != null && this.workflowSelectedValue.length != 0) + { + form.setWorkflow(this.workflowSelectedValue[0]); + } return outcome; } } diff --git a/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java b/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java new file mode 100644 index 0000000000..04c0f7622b --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.bean.wcm; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.model.DataModel; +import javax.faces.model.ListDataModel; + +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; +import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate; +import org.alfresco.web.ui.common.component.UIListItem; +import org.alfresco.web.ui.common.component.UISelectList; +import org.alfresco.web.ui.wcm.WebResources; +import org.alfresco.web.forms.Form; +import org.alfresco.web.forms.RenderingEngine; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Roast + */ +public class FormTemplatesDialog extends BaseDialogBean +{ + private static final String COMPONENT_TEMPLATELIST = "template-list"; + + private static final Log logger = LogFactory.getLog(FormTemplatesDialog.class); + + protected AVMService avmService; + protected CreateWebsiteWizard websiteWizard; + + /** datamodel for table of selected presentation templates */ + private DataModel templatesDataModel = null; + + /** list of objects describing the selected presentation templates*/ + private List templates = null; + + /** transient list of template UIListItem objects */ + private List templateList = null; + + /** + * @param avmService The avmService to set. + */ + public void setAvmService(AVMService avmService) + { + this.avmService = avmService; + } + + /** + * @param wizard The Create Website Wizard to set. + */ + public void setCreateWebsiteWizard(CreateWebsiteWizard wizard) + { + this.websiteWizard = wizard; + } + + /** + * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) + */ + @Override + public void init(Map parameters) + { + super.init(parameters); + this.templatesDataModel = null; + this.templates = new ArrayList(getActionForm().getTemplates().size()); + this.templates.addAll(getActionForm().getTemplates()); + } + + /** + * @return an object representing the form for the current action + */ + public FormWrapper getActionForm() + { + return this.websiteWizard.getActionForm(); + } + + public DataModel getTemplatesDataModel() + { + if (this.templatesDataModel == null) + { + this.templatesDataModel = new ListDataModel(); + } + + this.templatesDataModel.setWrappedData(this.templates); + + return this.templatesDataModel; + } + + public void setTemplatesDataModel(DataModel templatesDataModel) + { + this.templatesDataModel = templatesDataModel; + } + + /** + * @return List of UIListItem objects representing the available presentation templates for selection + */ + public List getTemplatesList() + { + Form form = getActionForm().getForm(); + List engines = form.getRenderingEngines(); + List items = new ArrayList(engines.size()); + for (RenderingEngine engine : engines) + { + PresentationTemplate wrapper = new PresentationTemplate(engine, null); + UIListItem item = new UIListItem(); + item.setValue(wrapper); + item.setLabel(wrapper.getTitle()); + item.setDescription(wrapper.getDescription()); + item.setImage(WebResources.IMAGE_TEMPLATE_32); + items.add(item); + } + this.templateList = items; + return items; + } + + /** + * Action handler to add a template to the list for this form + */ + public void addTemplate(ActionEvent event) + { + UISelectList selectList = (UISelectList)event.getComponent().findComponent(COMPONENT_TEMPLATELIST); + int index = selectList.getRowIndex(); + if (index != -1) + { + PresentationTemplate template = (PresentationTemplate)this.templateList.get(index).getValue(); + // clone the PresentationTemplate into one the user can modify + this.templates.add(new PresentationTemplate(template.getRenderingEngine(), template.getFilenamePattern())); + } + } + + /** + * Remove a presentation template from the selected list + */ + public void removeTemplate(ActionEvent event) + { + PresentationTemplate wrapper = (PresentationTemplate)this.templatesDataModel.getRowData(); + if (wrapper != null) + { + this.templates.remove(wrapper); + } + } + + /** + * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) + */ + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + List list = getActionForm().getTemplates(); + list.clear(); + for (PresentationTemplate wrapper : this.templates) + { + list.add(wrapper); + } + return outcome; + } + + /** + * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() + */ + @Override + public boolean getFinishButtonDisabled() + { + return false; + } +} diff --git a/source/java/org/alfresco/web/ui/repo/WebResources.java b/source/java/org/alfresco/web/ui/repo/WebResources.java index 5f2ad468ce..c8a021d035 100644 --- a/source/java/org/alfresco/web/ui/repo/WebResources.java +++ b/source/java/org/alfresco/web/ui/repo/WebResources.java @@ -35,4 +35,5 @@ public class WebResources extends org.alfresco.web.ui.common.WebResources public static final String IMAGE_LOCK_OWNER = "/images/icons/locked_owner.gif"; public static final String IMAGE_PERSON = "/images/icons/person.gif"; public static final String IMAGE_GROUP = "/images/icons/group.gif"; + public static final String IMAGE_WORKFLOW_32 = "/images/icons/workflow_large.gif"; } diff --git a/source/java/org/alfresco/web/ui/wcm/WebResources.java b/source/java/org/alfresco/web/ui/wcm/WebResources.java index 8e13e48179..49c363c2c2 100644 --- a/source/java/org/alfresco/web/ui/wcm/WebResources.java +++ b/source/java/org/alfresco/web/ui/wcm/WebResources.java @@ -25,4 +25,5 @@ public class WebResources extends org.alfresco.web.ui.repo.WebResources public static final String IMAGE_SANDBOX_32 = "/images/icons/sandbox_large.gif"; public static final String IMAGE_USERSANDBOX_32 = "/images/icons/user_sandbox_large.gif"; public static final String IMAGE_WEBFORM_32 = "/images/icons/webform_large.gif"; + public static final String IMAGE_TEMPLATE_32 = "/images/icons/template_large.gif"; } diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index a36cc574e0..0e1a80fdf6 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2534,6 +2534,27 @@ + + + The bean that backs up the Form Template Details dialog + + FormTemplatesDialog + org.alfresco.web.bean.wcm.FormTemplatesDialog + session + + avmService + #{AVMService} + + + nodeService + #{NodeService} + + + createWebsiteWizard + #{CreateWebsiteWizard} + + + diff --git a/source/web/images/icons/template_large.gif b/source/web/images/icons/template_large.gif new file mode 100644 index 0000000000..def3c84410 Binary files /dev/null and b/source/web/images/icons/template_large.gif differ diff --git a/source/web/jsp/wcm/create-website-wizard/form-details.jsp b/source/web/jsp/wcm/create-website-wizard/form-details.jsp index 5ff3d81610..fc832cb954 100644 --- a/source/web/jsp/wcm/create-website-wizard/form-details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/form-details.jsp @@ -22,19 +22,49 @@ <%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> <%@ page isELIgnored="false" %> + + + + <%-- Form properties --%> - + +
+
+ + + + @@ -42,11 +72,12 @@ - +
@@ -62,49 +93,33 @@ - <%-- Save scripts --%> + <%-- Save location --%> - - - - diff --git a/source/web/jsp/wcm/create-website-wizard/form-templates.jsp b/source/web/jsp/wcm/create-website-wizard/form-templates.jsp new file mode 100644 index 0000000000..114e151f28 --- /dev/null +++ b/source/web/jsp/wcm/create-website-wizard/form-templates.jsp @@ -0,0 +1,66 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> + + + <%-- Template selection list --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/web/jsp/wcm/create-website-wizard/forms.jsp b/source/web/jsp/wcm/create-website-wizard/forms.jsp index a81cac558a..594a650b83 100644 --- a/source/web/jsp/wcm/create-website-wizard/forms.jsp +++ b/source/web/jsp/wcm/create-website-wizard/forms.jsp @@ -35,7 +35,7 @@ <%-- Selected Form table, with configuration buttons and info text --%> - + - - - + + +
- +
- +
- + - - - - -
- - - - - - - - +