From 97cb403335c92e5eeff1d437cb9da2ad75c18f12 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Mon, 20 Nov 2006 15:00:35 +0000 Subject: [PATCH] . Fix to issue with Create Web Content form initialised with the correct form template in the drop-down . UI action and dialog framework for Snapshot Sandbox action git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4395 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 2 + config/alfresco/web-client-config-dialogs.xml | 4 ++ .../alfresco/web/bean/wcm/AVMBrowseBean.java | 11 ++-- .../web/bean/wcm/CreateWebContentWizard.java | 47 +++++++++---- .../web/bean/wcm/SnapshotSandboxDialog.java | 62 ++++++++++++++++++ .../web/ui/wcm/component/UIUserSandboxes.java | 4 +- source/web/WEB-INF/faces-config-beans.xml | 17 +++++ source/web/images/icons/create_snapshot.gif | Bin 0 -> 1062 bytes .../images/icons/create_snapshot_large.gif | Bin 0 -> 1638 bytes source/web/jsp/wcm/browse-website.jsp | 3 +- .../wcm/create-web-content-wizard/details.jsp | 2 +- source/web/jsp/wcm/snapshot-sandbox.jsp | 20 ++++++ 12 files changed, 148 insertions(+), 24 deletions(-) create mode 100644 source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java create mode 100644 source/web/images/icons/create_snapshot.gif create mode 100644 source/web/images/icons/create_snapshot_large.gif create mode 100644 source/web/jsp/wcm/snapshot-sandbox.jsp 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 0000000000000000000000000000000000000000..51e4f1c52a521a551a5639c5919bbefba9889d7c GIT binary patch literal 1062 zcmeHG{Yw)806jlYBMh-1iwf_7E%P5I-X_!WTM(>9Q@0a)BJ>Ie7$2WXqF{Jdh3-z+?H%qxrItJn8Vm7JCu$?xCCl+dh=EzR#Bo zmMWbr-1VsaQ@O@nrk*TQyIA-qHtDG#+~t}{u6Bmg;bD_gm7Sk?x*5J)UyB&4o4X{f zL~fHcN4yebE0m8Fz@s$9in9YmKhUx9Qk9dXc9j!uj&_>e;i({}XwujDjb?iDE1qVY zsd&qfzb+CPSuHO)ax+KPU86A6wV7Z9D-@u#CrX~YhgPEi>(EES_UabBP-WJd-_$}d zO`s^^%NTVEW_{~3w5uM`p*l0Jx3HeV%o71Rg>2;d9Nor;5znlN3e+@)<{e1vH z3Pi5z)lUFH%RuUy$X!#fpy;!BgZCg7u`Tw7BrHAjGDDUoP6=ilxY`@Mc70NoT>@Ko zru$AW8N>#9VA#>fP5Y8kLid2Vg=am0um748WkKF)dXTmGP+ZhC)^}%OV0hKSmqFX! zq57zkdv8`6N)nmroGn`~~U1-kpQ;*Xy{QjCEm-1uTKyXuVp%dDNj=iuzh9wu}+)5X8L zBOqks=5?pSQ!prb>w)V5Ze?gfiLYN^(1s|3E7f@VI-?;v9by#wB!EZvMDHF5-JUVj L=eI2^1c?0uf>y~U literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..43a269c1dfa1e940580a865a6f20581430eb79bd GIT binary patch literal 1638 zcmV-s2ATOsNk%w1VITk?0QUd@00030|Not(uydf$b)wRAq0x7w)OMrOd8XEQrPX_= z*m|eeeX81ZpUi%%+j*nVhO**?vEhfaW;eU zk-hAXt<96CzIUY4d8XBTsn~m{*L9%GeX7}jt=xaC+k&s&fv(+yu-}EU;dPzHhqU8= zsnvL($%?n;iMHi{s@9FV>5I7Mf~?qmq|Jb*(2KR;fvC}itksFI*?5}0f~L%QoW6aZ z!iTKUhpW+lp~Qis#e}BFgQdrSpT38t#fGKCeVMg~qrZrvyo8;$oT8|IpT32q!+)H( zgP^;Iq`!TauzZ%Uf}FL0nzM(Yx`v>*ewC|$m#u%6tb&=ZhMlsApR|Xbvx=d%f0L$z zm#K%Ft%;qlh?=W?m8ylEvWTFyf0U+vlcj^0s(_NAhnc5{ny7-2orII0g_NI(n4^P_ zn1_>`fsverm7s-@nTeI1h?Ja$lbeN-nuLy%h?19wk(P##m5rC2ke8Z zYWeqZ`S)}A_jURAcKZ2``}(E(`lkE(s{H)I{r%Ma{nypi((dl;=;-F#+u7;q==k+k z`uKzT_>21ZjQjbU`}v&w`my}`!2SHi@8eDHG>e*rP z=$nj-gX`LS^Xaeb+lP>jh4kvjs;HsJ#=q^|t&og?)~{98uU6KuUDmK)?%ukbmyEKl zqt~%)*RgKUq+aal)FNX)ETZrHh);m*4F^6cNgpz`I}@bK{e|Nj600000000000 z0000000000A^8LW008*_EC2ui03ZM$000R80P_hPNH8CyOqwJql%y#Wq=EJ76`VNG zR;EjjIMLdKNe~SpOX^6Z8?jA*3lnh~- zg{e>%D?sqfagySMfN|)~VUq?=+%|R-Z8?$@rOll)6DClgAOS*zD~6PqgY_)dt7NOf zWvz7SQkMxZEa5}fW1M3 zh7A{H@J+-?+q+??PMIPVEM7Kz0yB00LS$rug&7x`XUL#I2JH!5EGhdoO4uz?z(RG4 zmPw$bNl8dx9&8$9zySx(UGTyfpU^^&HQ%^nOfm9wLk&Hb7-R_>DhPO9dIqw$0R~?@ zGRrLG(Bn-z)ldTtH0zY(P$q`-0fYn;M3$a&31V=^i9nt>&paneG7BdNnZbo55Ku6I zWEaS=0d%ze803lVv~!{-jU{AA3OPW4BMg$kM%fD%Sb1fTpjeWLLWU?QMu1^O_5zxG zwNcBOS3YuxLQq)J*duuS;3QsQi4}z>K-K~ZpOYvQ!zVz>l86L2j>SS*DsaKbC!R3! z2Pao<5(q;=OcEp}UO?cgt13kQ5J6KY;9x=vlm_Vu8Vyn5N078+BFG#^$eO~jG?ie2 z10?9N36QkxF@-~Ls6pzLw9IjAQ^_t%LI_*PQYjX6JS0gFlhATyEqTy{0tzLR-~h8B zh)~6&CxU{8B;jpQgd$gd!b7~u&dUG^3W%_P4@1pD%Oq>`mya!r)DVWaKz?GwybdsM za0m)4umA{IT>A(Zhkz$gBzC;<>@2lR0*A*Wd<(L|2qcg|7UIexha8a4p?Nj8H%U4eT%l9V4l{`9udLv`|A2IUW!IJHcmPwEzGB literal 0 HcmV?d00001 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" %>