diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index f2a560bbc3..5f40a41cd8 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -867,6 +867,8 @@ sandbox_submitall=Submit All sandbox_submitselected=Submit Selected sandbox_revertselected=Undo Selected sandbox_icon=Browse Website +sandbox_snapshot=Create Snapshot +sandbox_snapshot_info=Create a snaphost of this sandbox. import_website_content=Import Website Content title_browse_sandbox=Browse Sandbox sandbox_info=Use this view to browse the files and folders within the sandbox for a web project. diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 7915a53baf..3e5cbfa2e5 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -118,6 +118,10 @@ + + diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index a3dcdeca7d..1fb6fc3758 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -880,8 +880,7 @@ public class AVMBrowseBean implements IContextListener if (node != null) { Map args = new HashMap(1, 1.0f); - List> versionPaths = - new ArrayList>(); + List> versionPaths = new ArrayList>(); versionPaths.add(new Pair(-1, path)); args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths); Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args); @@ -926,8 +925,7 @@ public class AVMBrowseBean implements IContextListener // calcluate the list of differences between the user store and the staging area List diffs = this.avmSyncService.compare(-1, store + ":/", -1, getStagingStore() + ":/"); - List> versionPaths = - new ArrayList>(); + List> versionPaths = new ArrayList>(); for (AVMDifference diff : diffs) { versionPaths.add(new Pair(-1, diff.getSourcePath())); @@ -974,8 +972,7 @@ public class AVMBrowseBean implements IContextListener tx = Repository.getUserTransaction(context, false); tx.begin(); - List> versionPaths = - new ArrayList>(); + List> versionPaths = new ArrayList>(); for (AVMNodeDescriptor node : selected) { versionPaths.add(new Pair(-1, node.getPath())); @@ -1016,7 +1013,7 @@ public class AVMBrowseBean implements IContextListener { UIActionLink link = (UIActionLink)event.getComponent(); Map params = link.getParameterMap(); - String id = params.get("form-id"); + String id = params.get(UIUserSandboxes.PARAM_FORM_ID); // pass form ID to the wizard - to be picked up in init() FacesContext fc = FacesContext.getCurrentInstance(); diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index 8e0e88385e..7dc2553534 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,18 +35,26 @@ 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.avm.AVMNodeConverter; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.web.app.Application; import org.alfresco.web.bean.content.BaseContentWizard; +import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.*; +import org.alfresco.web.forms.Form; +import org.alfresco.web.forms.FormInstanceData; +import org.alfresco.web.forms.FormInstanceDataImpl; +import org.alfresco.web.forms.FormProcessor; +import org.alfresco.web.forms.FormsService; +import org.alfresco.web.forms.Rendition; +import org.alfresco.web.ui.wcm.component.UIUserSandboxes; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; @@ -104,11 +111,13 @@ public class CreateWebContentWizard extends BaseContentWizard this.mimeType = MimetypeMap.MIMETYPE_XML; // check for a form ID being passed in as a parameter - if (this.parameters.get("form-id") != null) + if (this.parameters.get(UIUserSandboxes.PARAM_FORM_ID) != null) { // it is used to init the dialog to a specific template - String formId = parameters.get("form-id"); - Form form = FormsService.getInstance().getForm(new NodeRef(Repository.getStoreRef(), formId)); + String webFormId = parameters.get(UIUserSandboxes.PARAM_FORM_ID); + NodeRef webFormRef = new NodeRef(Repository.getStoreRef(), webFormId); + String formName = (String)this.nodeService.getProperty(webFormRef, ContentModel.PROP_FORMNAME); + Form form = FormsService.getInstance().getForm(formName); if (form != null) { this.formName = form.getName(); @@ -226,20 +235,32 @@ public class CreateWebContentWizard extends BaseContentWizard } /** - * @return the available forms that can be created. + * @return the available forms from this web project that can be created. */ public List getFormChoices() { - final Collection
ttl = FormsService.getInstance().getForms(); - final List sil = new ArrayList(ttl.size()); - for (Form tt : ttl) + Node website = this.avmBrowseBean.getWebsite(); + if (website == null) { - sil.add(new SelectItem(tt.getName(), tt.getName())); + throw new IllegalStateException("CreateWebContentWizard must be called within a Web Project context!"); + } + List webFormRefs = this.nodeService.getChildAssocs( + website.getNodeRef(), ContentModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL); + List items = new ArrayList(webFormRefs.size()); + for (ChildAssociationRef ref : webFormRefs) + { + String formName = (String)this.nodeService.getProperty(ref.getChildRef(), ContentModel.PROP_FORMNAME); + Form form = FormsService.getInstance().getForm(formName); + if (form != null) + { + items.add(new SelectItem(formName, formName)); + } } - final QuickSort sorter = new QuickSort(sil, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + final QuickSort sorter = new QuickSort(items, "label", true, IDataContainer.SORT_CASEINSENSITIVE); sorter.sort(); - return sil; + + return items; } /** diff --git a/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java b/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java new file mode 100644 index 0000000000..b2c2a02518 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java @@ -0,0 +1,62 @@ +/* + * 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.service.cmr.avm.AVMService; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Roast + */ +public class SnapshotSandboxDialog extends BaseDialogBean +{ + private static final Log logger = LogFactory.getLog(SnapshotSandboxDialog.class); + + protected AVMService avmService; + protected AVMBrowseBean avmBrowseBean; + + + /** + * @param avmBrowseBean The avmBrowseBean to set. + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + + /** + * @param avmService The avmService to set. + */ + public void setAvmService(AVMService avmService) + { + this.avmService = avmService; + } + + + /** + * @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 + { + return null; + } +} 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 84390b36aa..68d3d50f21 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -107,6 +107,8 @@ public class UIUserSandboxes extends SelfRenderingComponent private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; + public static final String PARAM_FORM_ID = "form-id"; + /** website to show sandboxes for */ private NodeRef value; @@ -690,7 +692,7 @@ public class UIUserSandboxes extends SelfRenderingComponent // create content action passes the ID of the Form to uses Map params = new HashMap(1, 1.0f); // setup a data-binding param for the Form ID - params.put("form-id", "#{" + REQUEST_FORM_REF + ".id}"); + params.put(PARAM_FORM_ID, "#{" + REQUEST_FORM_REF + ".id}"); action = createAction(fc, userStorePrefix, username, ACT_CREATE_FORM_CONTENT, "/images/icons/new_content.gif", "#{AVMBrowseBean.createFormContent}", null, null, params); } diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index fba6e74eb6..189c190b83 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2290,6 +2290,23 @@ + + + The bean that backs up the Snapshot Sandbox Dialog + + SnapshotSandboxDialog + org.alfresco.web.bean.wcm.SnapshotSandboxDialog + session + + avmService + #{AVMService} + + + avmBrowseBean + #{AVMBrowseBean} + + + The bean that backs up the Delete AVM File Dialog diff --git a/source/web/images/icons/create_snapshot.gif b/source/web/images/icons/create_snapshot.gif new file mode 100644 index 0000000000..51e4f1c52a Binary files /dev/null and b/source/web/images/icons/create_snapshot.gif differ diff --git a/source/web/images/icons/create_snapshot_large.gif b/source/web/images/icons/create_snapshot_large.gif new file mode 100644 index 0000000000..43a269c1df Binary files /dev/null and b/source/web/images/icons/create_snapshot_large.gif differ diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index fe83033cbc..2234dd8d7b 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -106,8 +106,7 @@ - <%-- TODO: add this action back once we can create in a specific sub-folder --%> - <%----%> + 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 1ee4399fb6..1fc517dd1a 100644 --- a/source/web/jsp/wcm/create-web-content-wizard/details.jsp +++ b/source/web/jsp/wcm/create-web-content-wizard/details.jsp @@ -94,7 +94,7 @@ - + diff --git a/source/web/jsp/wcm/snapshot-sandbox.jsp b/source/web/jsp/wcm/snapshot-sandbox.jsp new file mode 100644 index 0000000000..51e8a7d601 --- /dev/null +++ b/source/web/jsp/wcm/snapshot-sandbox.jsp @@ -0,0 +1,20 @@ +<%-- + 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" %>