diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 2552fc71ec..d7c37efd66 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -985,6 +985,10 @@ create_website_step2_desc=Optionally select an existing project to be used as th website_create_empty=Create a new empty Web Project website_create_existing=Create a Web Project based on an existing one. The Staging Sandbox structure, Web Forms, Workflow and Users will be copied from the selected Web Project website_sourcewebsite=Created from Web Project +website_sourcetemplate=Use as a template? +website_sourcenote=Note: Only those Web Projects marked for use as a template will be displayed by default. +website_sourceshowall=Show All Web Projects +website_sourceshowtemplates=Show Template Web Projects website_selected_forms=Selected Web Content Forms website_web_content_forms=Web Content Forms website_save_location=Save Location @@ -1145,7 +1149,7 @@ snapshot_success=Snapshot ''{0}'' created for sandbox: {1} snapshot_failure=Snapshot not created - the sandbox has not been modified since the last snapshot. snapshot_submitted_by=Submitted By title_website_details=Web Project Details -websitedetails_description=View the details of the web project. +webproject_details_of=Web Project Details of delete_sandbox=Delete Sandbox delete_sandbox_info=To remove this sandbox and the user from the Web Project, click OK. delete_sandbox_confirm=Are you sure you want to remove the user sandbox \"{0}\" from the Web Project? @@ -1193,7 +1197,7 @@ deploy_status_failed=FAILED deploy_status_partial=PARTIAL FAILURE reason=Reason snapshot=Snapshot -deploy_to_help=

A comma separated list of servers to deploy the website to. Each entry either represents the location of a Deployment Receiver or an Alfresco Repository.

A file server entry must be prefixed with '\\\\'. Each server can be represented by a host name or an IP address and may also contain an RMI port number. If an RMI port number is not specified for a Deployment Receiver the default of {0} will be used. If an RMI port number is not specified for an Alfresco Repository the default of {1} will be used.

Example: \\\\liveserver1, \\\\liveserver2:44200, liverserver3, liverserver4:50900

+deploy_to_help=A comma separated list of servers to deploy the website to. Each entry either represents the location of a Deployment Receiver or an Alfresco Repository.

A file server entry must be prefixed with '\\\\'. Each server can be represented by a host name or an IP address and may also contain an RMI port number. If an RMI port number is not specified for a Deployment Receiver the default of {0} will be used. If an RMI port number is not specified for an Alfresco Repository the default of {1} will be used.

Example: \\\\liveserver1, \\\\liveserver2:44200, liverserver3, liverserver4:50900 content_launch=Content Launch launch_date=Launch Date expiration_date_header=Content Expiration diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 62509f06a7..d740b1c3b1 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -91,6 +91,7 @@ public class CreateWebsiteWizard extends BaseWizardBean private static final String COMPONENT_WORKFLOWLIST = "workflow-list"; // wizard step names (that are referenced) + private static final String STEP_DETAILS = "details"; private static final String STEP_FORMS = "forms"; private static final String MATCH_DEFAULT = ".*"; @@ -114,6 +115,8 @@ public class CreateWebsiteWizard extends BaseWizardBean protected String createFrom = null; protected String[] sourceWebProject = null; protected ExpiringValueCache> webProjectsList; + protected boolean isSource; + protected boolean showAllSourceProjects; protected AVMService avmService; protected WorkflowService workflowService; @@ -168,12 +171,14 @@ public class CreateWebsiteWizard extends BaseWizardBean this.title = null; this.description = null; this.deployTo = null; + this.isSource = false; clearFormsWorkflowsAndUsers(); this.createFrom = CREATE_EMPTY; // requry existing web projects list every 10 seconds this.webProjectsList = new ExpiringValueCache>(1000L*10L); this.sourceWebProject = null; this.createFromValueChanged = false; + this.showAllSourceProjects = false; } private void clearFormsWorkflowsAndUsers() @@ -194,6 +199,9 @@ public class CreateWebsiteWizard extends BaseWizardBean @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { + // the Finish button can be pressed early in the steps - ensure the model is up-to-date + updateModelOnCreateFromChange(); + // create the website space in the correct parent folder final NodeRef websiteParent = WebProject.getWebsitesFolder(); @@ -216,6 +224,9 @@ public class CreateWebsiteWizard extends BaseWizardBean uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + // use as template source flag + this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); + // set the default webapp name for the project String webapp = (this.webapp != null && this.webapp.length() != 0) ? this.webapp : WEBAPP_DEFAULT; this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, webapp); @@ -249,8 +260,8 @@ public class CreateWebsiteWizard extends BaseWizardBean // create the default webapp folder under the hidden system folders if (branchStoreId == null) { - final String stagingStore = AVMUtil.buildStagingStoreName(avmStore); - final String stagingStoreRoot = AVMUtil.buildSandboxRootPath(stagingStore); + String stagingStore = AVMUtil.buildStagingStoreName(avmStore); + String stagingStoreRoot = AVMUtil.buildSandboxRootPath(stagingStore); this.avmService.createDirectory(stagingStoreRoot, webapp); this.avmService.addAspect(AVMNodeConverter.ExtendAVMPath(stagingStoreRoot, webapp), WCMAppModel.ASPECT_WEBAPP); @@ -295,6 +306,14 @@ public class CreateWebsiteWizard extends BaseWizardBean return outcome; } + @Override + public boolean getFinishButtonDisabled() + { + // allow finish from any step other than the initial details page + String stepName = Application.getWizardManager().getCurrentStepName(); + return (STEP_DETAILS.equals(stepName)); + } + /** * Persist the forms, templates, workflows and workflow defaults to the model for this web project * @@ -417,6 +436,11 @@ public class CreateWebsiteWizard extends BaseWizardBean this.dnsName = (String)props.get(WCMAppModel.PROP_AVMSTORE); this.webapp = (String)props.get(WCMAppModel.PROP_DEFAULTWEBAPP); this.deployTo = (List)props.get(WCMAppModel.PROP_DEPLOYTO); + Boolean isSource = (Boolean)props.get(WCMAppModel.PROP_ISSOURCE); + if (isSource != null) + { + this.isSource = isSource.booleanValue(); + } } if (loadUsers) @@ -749,6 +773,22 @@ public class CreateWebsiteWizard extends BaseWizardBean return name; } + /** + * @return true if this website is set to be a template source website for future web projects + */ + public boolean isSource() + { + return this.isSource; + } + + /** + * @param isSource true if this website is set to be a template source website for future web projects + */ + public void setSource(boolean isSource) + { + this.isSource = isSource; + } + /** * @return the existingWebProjects */ @@ -759,16 +799,23 @@ public class CreateWebsiteWizard extends BaseWizardBean { FacesContext fc = FacesContext.getCurrentInstance(); - // construct the query to retrieve all web projects + // construct the query to retrieve the web projects String path = Application.getRootPath(fc) + "/" + Application.getWebsitesFolderName(fc) + "/*"; - String query = "PATH:\"/" + path + "\" +TYPE:\"{" + NamespaceService.WCMAPP_MODEL_1_0_URI + "}webfolder\""; + StringBuilder query = new StringBuilder(200); + query.append("PATH:\"/").append(path).append("\""); + query.append(" +TYPE:\"{").append(NamespaceService.WCMAPP_MODEL_1_0_URI).append("}webfolder\""); + if (this.showAllSourceProjects == false) + { + // only query for web project templates by default + query.append(" +@").append(Repository.escapeQName(WCMAppModel.PROP_ISSOURCE)).append(":true"); + } ResultSet results = null; try { // execute the query results = searchService.query(Repository.getStoreRef(), - SearchService.LANGUAGE_LUCENE, query); + SearchService.LANGUAGE_LUCENE, query.toString()); webProjects = new ArrayList(results.length()); for (ResultSetRow row : results) { @@ -796,6 +843,25 @@ public class CreateWebsiteWizard extends BaseWizardBean return webProjects; } + /** + * Action handler called when toggle Show All/Show Template Web Projects link is clicked + */ + public void toggleWebProjectsList(ActionEvent event) + { + this.showAllSourceProjects = !this.showAllSourceProjects; + this.webProjectsList.clear(); + this.createFromValueChanged = true; + } + + /** + * @return true to show all Web Projects in the Create From list, + * false to only show those marked as templates + */ + public boolean getShowAllSourceProjects() + { + return this.showAllSourceProjects; + } + /** * @return the deploy to help text that gets displayed if the user * clicks the Help icon @@ -820,27 +886,35 @@ public class CreateWebsiteWizard extends BaseWizardBean { // if we have just entered the Forms page and the Create From page data has changed // then we need to pre-populate the Forms etc. from the template web project - if (this.createFromValueChanged) - { - if (CREATE_EXISTING.equals(this.createFrom)) - { - if (this.sourceWebProject != null && this.sourceWebProject.length != 0) - { - clearFormsWorkflowsAndUsers(); - loadWebProjectModel(new NodeRef(this.sourceWebProject[0]), false, true); - } - } - else - { - clearFormsWorkflowsAndUsers(); - } - - this.createFromValueChanged = false; - } + updateModelOnCreateFromChange(); } return super.next(); } + /** + * Update the wizard model when the value in the Create From page changes + */ + private void updateModelOnCreateFromChange() + { + if (this.createFromValueChanged) + { + if (CREATE_EXISTING.equals(this.createFrom)) + { + if (this.sourceWebProject != null && this.sourceWebProject.length != 0) + { + clearFormsWorkflowsAndUsers(); + loadWebProjectModel(new NodeRef(this.sourceWebProject[0]), false, true); + } + } + else + { + clearFormsWorkflowsAndUsers(); + } + + this.createFromValueChanged = false; + } + } + /** * @return summary text for the wizard */ diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java index 60ab07d429..171bdc3ba2 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -66,6 +66,13 @@ public class EditWebsiteWizard extends CreateWebsiteWizard loadWebProjectModel(websiteRef, true, false); } + @Override + public boolean getFinishButtonDisabled() + { + // always allow Finish as we are editing existing settings + return false; + } + /** * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) */ @@ -79,6 +86,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, this.title); this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEPLOYTO, (Serializable)this.deployTo); + this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); // clear the existing settings for forms, template and workflows - then the existing methods // can be used to apply the modified and previous settings from scratch diff --git a/source/java/org/alfresco/web/ui/common/component/UIListItems.java b/source/java/org/alfresco/web/ui/common/component/UIListItems.java index 68fffa4538..50eebd041e 100644 --- a/source/java/org/alfresco/web/ui/common/component/UIListItems.java +++ b/source/java/org/alfresco/web/ui/common/component/UIListItems.java @@ -35,6 +35,7 @@ import javax.faces.el.ValueBinding; public class UIListItems extends SelfRenderingComponent { private Object value; + private boolean cacheValue; /** * @see javax.faces.component.UIComponent#getFamily() @@ -49,7 +50,7 @@ public class UIListItems extends SelfRenderingComponent */ public Object getValue() { - if (this.value == null) + if (getCacheValue() == false || this.value == null) { ValueBinding vb = getValueBinding("value"); if (vb != null) @@ -68,6 +69,27 @@ public class UIListItems extends SelfRenderingComponent this.value = value; } + /** + * @return the cacheValue + */ + public boolean getCacheValue() + { + ValueBinding vb = getValueBinding("cacheValue"); + if (vb != null) + { + this.cacheValue = (Boolean)vb.getValue(getFacesContext());; + } + return this.cacheValue; + } + + /** + * @param cacheValue the cacheValue to set + */ + public void setCacheValue(boolean cacheValue) + { + this.cacheValue = cacheValue; + } + /** * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object) */ @@ -77,6 +99,7 @@ public class UIListItems extends SelfRenderingComponent // standard component attributes are restored by the super class super.restoreState(context, values[0]); this.value = values[1]; + this.cacheValue = (Boolean)values[2]; } /** @@ -85,7 +108,11 @@ public class UIListItems extends SelfRenderingComponent public Object saveState(FacesContext context) { // standard component attributes are saved by the super class - return new Object[] { super.saveState(context), this.value }; + return new Object[] { + super.saveState(context), + this.value, + this.cacheValue + }; } } diff --git a/source/java/org/alfresco/web/ui/common/tag/ListItemsTag.java b/source/java/org/alfresco/web/ui/common/tag/ListItemsTag.java index 7e37fa8465..4eecd56d0f 100644 --- a/source/java/org/alfresco/web/ui/common/tag/ListItemsTag.java +++ b/source/java/org/alfresco/web/ui/common/tag/ListItemsTag.java @@ -60,6 +60,7 @@ public class ListItemsTag extends BaseComponentTag super.setProperties(component); setStringBindingProperty(component, "value", this.value); + setBooleanProperty(component, "cacheValue", this.cacheValue); } /** @@ -78,5 +79,20 @@ public class ListItemsTag extends BaseComponentTag super.release(); this.value = null; + this.cacheValue = null; } + + /** + * Set the cacheValue + * + * @param cacheValue the cacheValue + */ + public void setCacheValue(String cacheValue) + { + this.cacheValue = cacheValue; + } + + + /** the cacheValue */ + private String cacheValue; } diff --git a/source/web/WEB-INF/alfresco.tld b/source/web/WEB-INF/alfresco.tld index 1b6018e022..7b49b60843 100644 --- a/source/web/WEB-INF/alfresco.tld +++ b/source/web/WEB-INF/alfresco.tld @@ -1143,6 +1143,12 @@ true true + + + cacheValue + false + true + diff --git a/source/web/jsp/wcm/create-website-wizard/create-from.jsp b/source/web/jsp/wcm/create-website-wizard/create-from.jsp index 646ccb58ce..de2683a9d5 100644 --- a/source/web/jsp/wcm/create-website-wizard/create-from.jsp +++ b/source/web/jsp/wcm/create-website-wizard/create-from.jsp @@ -36,8 +36,14 @@
- +
+
+ +
+ + +
\ No newline at end of file diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp index 1e6659ddc5..9daaabe0ec 100644 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/details.jsp @@ -106,7 +106,7 @@ - + @@ -124,7 +124,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -151,7 +151,7 @@ - + @@ -193,5 +193,18 @@ + + + + + + + + + + + + + diff --git a/source/web/jsp/wcm/website-details.jsp b/source/web/jsp/wcm/website-details.jsp index a055bab809..64e73916e8 100644 --- a/source/web/jsp/wcm/website-details.jsp +++ b/source/web/jsp/wcm/website-details.jsp @@ -77,9 +77,8 @@ -
''
+
''
:
-
<%-- Navigation --%>