mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Multiple webapp folders now supported for a Web Project
- Creation of new root webapp folders via specific action or via Edit Web Project wizard - Modification of default webapp folder in Edit Web Project wizard - Switching of 'current' webapp for staging/sandbox views in the browse web project screen - Filtering of files in sandbox modified file list by current webapp - Submit All action correctly respects the current webapp . A few minor UI tweaks to placement of menus and actions in web project/sandbox views git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4594 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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<SelectItem> getWebapps()
|
||||
{
|
||||
String path = AVMConstants.buildAVMStoreRootPath(getStagingStore());
|
||||
Map<String, AVMNodeDescriptor> folders = this.avmService.getDirectoryListing(-1, path);
|
||||
List<SelectItem> webapps = new ArrayList<SelectItem>(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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -354,7 +354,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
|
||||
List<AVMDifference> diffs = new ArrayList<AVMDifference>(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)
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -427,9 +427,10 @@ public class SubmitDialog extends BaseDialogBean
|
||||
List<AVMNodeDescriptor> selected;
|
||||
if (this.avmBrowseBean.getSubmitAll())
|
||||
{
|
||||
String userStore = this.avmBrowseBean.getSandbox() + ":/";
|
||||
String stagingStore = this.avmBrowseBean.getStagingStore() + ":/";
|
||||
List<AVMDifference> 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<AVMDifference> diffs = this.avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher);
|
||||
selected = new ArrayList<AVMNodeDescriptor>(diffs.size());
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
|
@@ -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<AVMDifference> diffs = avmSyncService.compare(-1, userStore, -1, stagingStore, matcher);
|
||||
List<AVMDifference> 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("</td></tr>");
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user