diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index a538619ec1..e7b931f8ea 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -931,6 +931,7 @@ create_form_content=Create Content recent_snapshots=Recent Snapshots snapshot_revert=Revert snapshot_preview=Preview +webapp_current=Current Webapp Folder # Website actions and dialog messages title_import_content=Import Content into Website @@ -974,6 +975,9 @@ submit_no_workflow_warning=No suitable workflows could be found for the modified submit_submit_info=The following items will be submitted submit_items_title=Submit Items submit_items_desc=This page helps you to submit modified items for publishing on the website. +create_webapp=Create Webapp Folder +create_webapp_title=Create Webapp Folder +create_webapp_desc=Create a new root Webapp folder for this web project # New User Wizard messages new_user_title=New User Wizard diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 69d2802cc0..6e06e8a857 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -181,6 +181,10 @@ + + diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index 3de257fa48..027e8fc1a3 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -135,6 +135,16 @@ dialog:createAvmFolder + + + + CreateChildren + + create_webapp + /images/icons/create_webapp.gif + dialog:createWebappFolder + + @@ -206,7 +216,7 @@ - Write + Write,CreateChildren edit_website /images/icons/edit_website.gif @@ -308,6 +318,7 @@ + diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 0eac6ba7cc..bb61ea7a74 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -29,6 +29,7 @@ import java.util.ResourceBundle; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; +import javax.faces.model.SelectItem; import javax.transaction.UserTransaction; import org.alfresco.model.WCMAppModel; @@ -110,11 +111,22 @@ public class AVMBrowseBean implements IContextListener /** Snapshot date filter selection */ private String snapshotDateFilter = UISandboxSnapshots.FILTER_DATE_TODAY; + /** Current sandbox store context for actions and sandbox view */ private String sandbox; + + /** Current username context for actions and sandbox view */ private String username; + + /** Current webapp context for actions and sandbox view */ + private String webapp; + + /** Sandbox title message */ private String sandboxTitle = null; + + /** Current AVM path and node representing the current path */ private String currentPath = null; private AVMNode currentPathNode = null; + private boolean submitAll = false; /* component references */ @@ -419,6 +431,41 @@ public class AVMBrowseBean implements IContextListener this.username = username; } + /** + * @return current webapp context + */ + public String getWebapp() + { + if (this.webapp == null) + { + this.webapp = (String)getWebsite().getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP); + } + return this.webapp; + } + + /** + * @param webapp Webapp folder context + */ + public void setWebapp(String webapp) + { + this.webapp = webapp; + } + + /** + * @return list of available root webapp folders for this Web project + */ + public List getWebapps() + { + String path = AVMConstants.buildAVMStoreRootPath(getStagingStore()); + Map folders = this.avmService.getDirectoryListing(-1, path); + List webapps = new ArrayList(folders.size()); + for (AVMNodeDescriptor node : folders.values()) + { + webapps.add(new SelectItem(node.getName(), node.getName())); + } + return webapps; + } + /** * @return Returns the sandboxTitle. */ @@ -511,8 +558,7 @@ public class AVMBrowseBean implements IContextListener { if (this.currentPath == null) { - String webapp = (String)getWebsite().getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP); - this.currentPath = AVMConstants.buildAVMStoreWebappPath(getSandbox(), webapp); + this.currentPath = AVMConstants.buildAVMStoreWebappPath(getSandbox(), getWebapp()); } return this.currentPath; } diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java index da549a834c..b47877da46 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java @@ -42,8 +42,8 @@ public class CreateFolderDialog extends BaseDialogBean protected AVMService avmService; protected AVMBrowseBean avmBrowseBean; - private String name; - private String description; + protected String name; + protected String description; /** diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index 955a1d76e2..5a9d394294 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -354,7 +354,7 @@ public class CreateWebContentWizard extends BaseContentWizard List diffs = new ArrayList(8); // construct diffs for selected items for submission - String webapp = (String)website.getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP); + String webapp = this.avmBrowseBean.getWebapp(); String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()); if (form) { diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java new file mode 100644 index 0000000000..014f811db6 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java @@ -0,0 +1,55 @@ +/* + * 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 javax.faces.context.FacesContext; + +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Bean implementation for the AVM "Create Webapp Folder" dialog. + * + * @author Kevin Roast + */ +public class CreateWebappDialog extends CreateFolderDialog +{ + // ------------------------------------------------------------------------------ + // Dialog implementation + + /** + * @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 + { + String parent = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getStagingStore()); + this.avmService.createDirectory(parent, this.name); + + String path = parent + '/' + this.name; + NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path); + this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + if (this.description != null && this.description.length() != 0) + { + this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); + } + + return outcome; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java index 1b418262ab..2bca48c840 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -177,7 +177,19 @@ public class EditWebsiteWizard extends CreateWebsiteWizard // can be used to apply the modified and previous settings from scratch clearWebProjectModel(nodeRef); - // TODO: add the ability to change/rename the root webapp and DNS name for the website + // change/create the root webapp name for the website + if (this.webapp != null && this.webapp.length() != 0) + { + String stagingStore = AVMConstants.buildAVMStagingStoreName(this.dnsName); + String webappPath = AVMConstants.buildAVMStoreWebappPath(stagingStore, this.webapp); + if (this.avmService.lookup(-1, webappPath) == null) + { + this.avmService.createDirectory(AVMConstants.buildAVMStoreRootPath(stagingStore), this.webapp); + } + this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, this.webapp); + } + + // TODO: allow change of dns name - via store rename functionality // persist the forms, templates, workflows and workflow defaults to the model for this web project saveWebProjectModel(nodeRef); diff --git a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java index e42213d9e4..4f31369618 100644 --- a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java @@ -79,6 +79,7 @@ public class ImportWebsiteDialog protected FileFolderService fileFolderService; protected ContentService contentService; protected NavigationBean navigationBean; + protected AVMBrowseBean avmBrowseBean; protected AVMService avmService; protected NodeService nodeService; @@ -107,6 +108,14 @@ public class ImportWebsiteDialog this.navigationBean = navigationBean; } + /** + * @param avmBrowseBean The AVMBrowseBean to set. + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + /** * @param avmService The AVMService to set. */ @@ -203,7 +212,7 @@ public class ImportWebsiteDialog // import the content into the appropriate store for the website Node website = this.navigationBean.getCurrentNode(); String storeRoot = (String)website.getProperties().get(WCMAppModel.PROP_AVMSTORE); - String webapp = (String)website.getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP); + String webapp = this.avmBrowseBean.getWebapp(); if (storeRoot != null && webapp != null) { String store = AVMConstants.buildAVMStagingStoreName(storeRoot); diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index bafa873690..44045f36b4 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -427,9 +427,10 @@ public class SubmitDialog extends BaseDialogBean List selected; if (this.avmBrowseBean.getSubmitAll()) { - String userStore = this.avmBrowseBean.getSandbox() + ":/"; - String stagingStore = this.avmBrowseBean.getStagingStore() + ":/"; - List diffs = avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher); + String webapp = this.avmBrowseBean.getWebapp(); + String userStore = AVMConstants.buildAVMStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp); + String stagingStore = AVMConstants.buildAVMStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp); + List diffs = this.avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher); selected = new ArrayList(diffs.size()); for (AVMDifference diff : diffs) { diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index 5924e3f33f..cd740c07ba 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -130,6 +130,9 @@ public class UIUserSandboxes extends SelfRenderingComponent /** website to show sandboxes for */ private NodeRef value; + /** webapp to filter list by */ + private String webapp; + /** cached converter instance */ private ByteSizeConverter sizeConverter = null; @@ -472,28 +475,29 @@ public class UIUserSandboxes extends SelfRenderingComponent DateFormat df = Utils.getDateTimeFormat(fc); ResourceBundle bundle = Application.getBundle(fc); - // build the paths to the stores to compare - String userStorePrefix = AVMConstants.buildAVMUserMainStoreName(storeRoot, username); - String userStore = userStorePrefix + ":/"; - String stagingStore = AVMConstants.buildAVMStagingStoreName(storeRoot) + ":/"; + // build the paths to the stores to compare - filter by current webapp + String userStore = AVMConstants.buildAVMUserMainStoreName(storeRoot, username); + String userStorePath = AVMConstants.buildAVMStoreWebappPath(userStore, getWebapp()); + String stagingStore = AVMConstants.buildAVMStagingStoreName(storeRoot); + String stagingStorePath = AVMConstants.buildAVMStoreWebappPath(stagingStore, getWebapp()); // info we need to calculate preview paths for assets - String dns = AVMConstants.lookupStoreDNS(userStorePrefix); - int rootPathIndex = AVMConstants.buildAVMStoreRootPath(userStorePrefix).length(); + String dns = AVMConstants.lookupStoreDNS(userStore); + int rootPathIndex = AVMConstants.buildAVMStoreRootPath(userStore).length(); ClientConfigElement config = Application.getClientConfig(fc); // get the UIActions component responsible for rendering context related user actions // TODO: we may need a component per user instance? (or use evaluators for roles...) - UIActions uiFileActions = aquireUIActions(ACTIONS_FILE, userStorePrefix); - UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER, userStorePrefix); - UIActions uiDeletedActions = aquireUIActions(ACTIONS_DELETED, userStorePrefix); + UIActions uiFileActions = aquireUIActions(ACTIONS_FILE, userStore); + UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER, userStore); + UIActions uiDeletedActions = aquireUIActions(ACTIONS_DELETED, userStore); String id = getClientId(fc); // use the sync service to get the list of diffs between the stores NameMatcher matcher = (NameMatcher)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean( "globalPathExcluder"); - List diffs = avmSyncService.compare(-1, userStore, -1, stagingStore, matcher); + List diffs = avmSyncService.compare(-1, userStorePath, -1, stagingStorePath, matcher); if (diffs.size() != 0) { // store lookup of username to list of modified nodes @@ -665,11 +669,11 @@ public class UIUserSandboxes extends SelfRenderingComponent out.write(bundle.getString(MSG_SELECTED)); out.write(": "); Utils.encodeRecursive(fc, aquireAction( - fc, userStorePrefix, username, ACT_SANDBOX_SUBMITSELECTED, "/images/icons/submit_all.gif", + fc, userStore, username, ACT_SANDBOX_SUBMITSELECTED, "/images/icons/submit_all.gif", "#{AVMBrowseBean.setupSandboxAction}", "dialog:submitSandboxItems")); out.write(" "); Utils.encodeRecursive(fc, aquireAction( - fc, userStorePrefix, username, ACT_SANDBOX_REVERTSELECTED, "/images/icons/revert_all.gif", + fc, userStore, username, ACT_SANDBOX_REVERTSELECTED, "/images/icons/revert_all.gif", "#{AVMBrowseBean.revertSelected}", null)); out.write(""); @@ -1023,6 +1027,28 @@ public class UIUserSandboxes extends SelfRenderingComponent this.value = value; } + /** + * @return Returns the webapp to filter file list by + */ + public String getWebapp() + { + ValueBinding vb = getValueBinding("webapp"); + if (vb != null) + { + this.webapp = (String)vb.getValue(getFacesContext()); + } + + return this.webapp; + } + + /** + * @param webapp The webapp to filter file list by + */ + public void setWebapp(String webapp) + { + this.webapp = webapp; + } + /** * Get the selected nodes for a specified sandbox user * diff --git a/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java b/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java index 271f1f1376..34ff7de1d2 100644 --- a/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java +++ b/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java @@ -49,6 +49,7 @@ public class UserSandboxesTag extends BaseComponentTag super.setProperties(component); setStringProperty(component, "value", this.value); + setStringProperty(component, "webapp", this.webapp); } /** @@ -58,6 +59,7 @@ public class UserSandboxesTag extends BaseComponentTag { super.release(); this.value = null; + this.webapp = null; } /** @@ -70,6 +72,20 @@ public class UserSandboxesTag extends BaseComponentTag this.value = value; } + /** + * Set the webapp + * + * @param webapp the webapp + */ + public void setWebapp(String webapp) + { + this.webapp = webapp; + } + + + /** the webapp */ + private String webapp; + /** the value (root store name to display sandboxes for) */ private String value; } diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 12e516c0d7..a2f2fc3cf7 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2235,6 +2235,10 @@ avmService #{AVMService} + + avmBrowseBean + #{AVMBrowseBean} + @@ -2471,6 +2475,27 @@ + + + The bean that backs up the Create AVM Webapp Folder Dialog + + CreateWebappDialog + org.alfresco.web.bean.wcm.CreateWebappDialog + session + + avmService + #{AVMService} + + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + + + The bean that backs up the AVM Add Content Dialog diff --git a/source/web/WEB-INF/wcm.tld b/source/web/WEB-INF/wcm.tld index e9278bb122..adb5067b44 100644 --- a/source/web/WEB-INF/wcm.tld +++ b/source/web/WEB-INF/wcm.tld @@ -42,6 +42,12 @@ false true + + + webapp + true + true + diff --git a/source/web/images/icons/create_webapp.gif b/source/web/images/icons/create_webapp.gif new file mode 100644 index 0000000000..acb4beac34 Binary files /dev/null and b/source/web/images/icons/create_webapp.gif differ diff --git a/source/web/images/icons/create_webapp_large.gif b/source/web/images/icons/create_webapp_large.gif new file mode 100644 index 0000000000..60dfc1d99a Binary files /dev/null and b/source/web/images/icons/create_webapp_large.gif differ diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index 15c9a9d9e4..5ea7034afa 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -77,20 +77,20 @@ - - <%-- Create actions menu --%> - - - - - - + - <%-- More actions menu --%> + <%-- Create actions menu --%> + + + + + + <%-- More actions menu --%> + <%-- - + --%> diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index c8bdff2897..28eda57489 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -31,7 +31,7 @@ <%-- load a bundle of properties with I18N strings --%> - + <%-- Main outer table --%> @@ -83,7 +83,7 @@ -
+ <%-- Import website content action --%> @@ -108,57 +108,65 @@
+ <%-- Current Webapp selection --%> + :  + + + + +
+ <%-- Staging Sandbox Info --%> <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> - - - - - - - - - - - - - - -
- - - -
-
- -
-
- -
- <%-- Sandbox snapshots list --%> - - - - - - -
: - - - - - - -
-
- -
-
-
+ + + + + + + + + + + + + + +
+ + + +
+
+ +
+
+ +
+ <%-- Sandbox snapshots list --%> + + + + + + +
: + + + + + + +
+
+ +
+
+
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
@@ -175,7 +183,7 @@ <%-- User Sandboxes List --%> - + diff --git a/source/web/jsp/wcm/create-webapp.jsp b/source/web/jsp/wcm/create-webapp.jsp new file mode 100644 index 0000000000..c4d736aee4 --- /dev/null +++ b/source/web/jsp/wcm/create-webapp.jsp @@ -0,0 +1,106 @@ +<%-- + 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" %> + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + +
+ + + + + + + +
+
diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp index c254c915eb..8a7ed4b36f 100644 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/details.jsp @@ -126,8 +126,7 @@
- <%-- disabled="#{WizardManager.bean.editMode}" --%> +