mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. 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
This commit is contained in:
@@ -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.
|
||||
|
@@ -118,6 +118,10 @@
|
||||
<!-- -->
|
||||
<!-- WCM Dialogs -->
|
||||
|
||||
<dialog name="snapshotSandbox" page="/jsp/wcm/snapshot-sandbox.jsp" managed-bean="SnapshotSandboxDialog"
|
||||
icon="/images/icons/create_snapshot_large.gif" title-id="sandbox_snapshot"
|
||||
description-id="sandbox_snapshot_info" />
|
||||
|
||||
<dialog name="deleteAvmFile" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFileDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_file"
|
||||
description-id="delete_avm_file_info" />
|
||||
|
@@ -880,8 +880,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
if (node != null)
|
||||
{
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
List<Pair<Integer, String>> versionPaths =
|
||||
new ArrayList<Pair<Integer, String>>();
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
versionPaths.add(new Pair<Integer, String>(-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<AVMDifference> diffs = this.avmSyncService.compare(-1, store + ":/", -1, getStagingStore() + ":/");
|
||||
List<Pair<Integer, String>> versionPaths =
|
||||
new ArrayList<Pair<Integer, String>>();
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, diff.getSourcePath()));
|
||||
@@ -974,8 +972,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
tx = Repository.getUserTransaction(context, false);
|
||||
tx.begin();
|
||||
|
||||
List<Pair<Integer, String>> versionPaths =
|
||||
new ArrayList<Pair<Integer, String>>();
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, node.getPath()));
|
||||
@@ -1016,7 +1013,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> 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();
|
||||
|
@@ -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<SelectItem> getFormChoices()
|
||||
{
|
||||
final Collection<Form> ttl = FormsService.getInstance().getForms();
|
||||
final List<SelectItem> sil = new ArrayList<SelectItem>(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<ChildAssociationRef> webFormRefs = this.nodeService.getChildAssocs(
|
||||
website.getNodeRef(), ContentModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL);
|
||||
List<SelectItem> items = new ArrayList<SelectItem>(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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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<String, String> params = new HashMap<String, String>(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);
|
||||
}
|
||||
|
@@ -2290,6 +2290,23 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Snapshot Sandbox Dialog
|
||||
</description>
|
||||
<managed-bean-name>SnapshotSandboxDialog</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.SnapshotSandboxDialog</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Delete AVM File Dialog
|
||||
|
BIN
source/web/images/icons/create_snapshot.gif
Normal file
BIN
source/web/images/icons/create_snapshot.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
source/web/images/icons/create_snapshot_large.gif
Normal file
BIN
source/web/images/icons/create_snapshot_large.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@@ -106,8 +106,7 @@
|
||||
<td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
|
||||
<td align=right>
|
||||
<a:actionLink id="actPreview" value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" href="#{AVMBrowseBean.stagingPreviewUrl}" target="new" />
|
||||
<%-- TODO: add this action back once we can create in a specific sub-folder --%>
|
||||
<%--<a:actionLink id="actCreate" value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />--%>
|
||||
<a:actionLink id="actSnap" value="#{msg.sandbox_snapshot}" image="/images/icons/create_snapshot.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="dialog:snapshotSandbox" />
|
||||
<a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -94,7 +94,7 @@
|
||||
|
||||
<h:outputText value=""/>
|
||||
<h:outputText value="#{msg.form}:"/>
|
||||
<h:selectOneMenu value="#{WizardManager.bean.formName}">
|
||||
<h:selectOneMenu value="#{WizardManager.bean.formName}" disabled="#{WizardManager.bean.formSelectDisabled}">
|
||||
<f:selectItems value="#{WizardManager.bean.formChoices}" />
|
||||
</h:selectOneMenu>
|
||||
</h:panelGrid>
|
||||
|
20
source/web/jsp/wcm/snapshot-sandbox.jsp
Normal file
20
source/web/jsp/wcm/snapshot-sandbox.jsp
Normal file
@@ -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" %>
|
Reference in New Issue
Block a user