. Refactored client AVM Node class to extend existing Node class - allows the use of existing PermissionEvaluators etc. for a node action

. Permission evaluators added to AVM browse screen top-level actions and file/folder actions
. Permission evaluators added to Edit Details action in File/Folder Details screens
. Each user sandbox is now only visible to the assigned user and all Content Managers
. Import Website Content action hidden unless user has appropriate Write permissions to the main staging area (Content Managers only)
. Added Titled aspect to shtml content created through the XML Templating Service.
. Remove Create Content action from sandbox screen - makes no sense here until we can create via workflow or destination folder
. Fix nasty bug in Create Form Wizard where no default extension would be specified
  - this led to the XForms generating files such as "myfile.xml" and "myfile." - the generated HTML did not have a file extension...

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4048 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-10-06 12:53:22 +00:00
parent 66714eedca
commit 1ee6e16326
22 changed files with 244 additions and 188 deletions

View File

@@ -642,7 +642,7 @@ text_content=Plain Text Content
html_content=HTML Content html_content=HTML Content
xml_content=XML Content xml_content=XML Content
create_form_title=Create Form Wizard create_form_title=Create Form Wizard
create_form_desc=Create Form create_form_desc=Create an XML Form definition from XML Schema and Templates
create_form_step1_title=Upload an XML Schema create_form_step1_title=Upload an XML Schema
create_form_step1_desc=Upload an XML Schema create_form_step1_desc=Upload an XML Schema
create_form_step2_title=Edit the XML Schema create_form_step2_title=Edit the XML Schema

View File

@@ -10,7 +10,7 @@
<!-- a list of permissions to evaluate action against before checking other preconditions --> <!-- a list of permissions to evaluate action against before checking other preconditions -->
<permissions> <permissions>
<!-- each permission can be an Allow or Deny check --> <!-- each permission can be an Allow or Deny check -->
<permission allow="te">Write</permission> <permission allow="true">Write</permission>
<permission allow="false">AddChildren</permission> <permission allow="false">AddChildren</permission>
</permissions> </permissions>
<!-- the evaluator is a class implementing the org.alfresco.web.action.ActionEvaluator contract, <!-- the evaluator is a class implementing the org.alfresco.web.action.ActionEvaluator contract,
@@ -326,9 +326,6 @@
<!-- Create XML content type --> <!-- Create XML content type -->
<action id="create_form"> <action id="create_form">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>create_form</label-id> <label-id>create_form</label-id>
<image>/images/icons/new_content.gif</image> <image>/images/icons/new_content.gif</image>
<action>wizard:createForm</action> <action>wizard:createForm</action>
@@ -356,9 +353,6 @@
<!-- Create Website Wizard --> <!-- Create Website Wizard -->
<action id="create_website_wizard"> <action id="create_website_wizard">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<!-- TODO: check for role and in Websites folder --> <!-- TODO: check for role and in Websites folder -->
<label-id>create_website</label-id> <label-id>create_website</label-id>
<image>/images/icons/create_website.gif</image> <image>/images/icons/create_website.gif</image>

View File

@@ -5,6 +5,9 @@
<!-- Edit WCM document --> <!-- Edit WCM document -->
<action id="edit_file"> <action id="edit_file">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label-id>edit</label-id> <label-id>edit</label-id>
<image>/images/icons/edit_icon.gif</image> <image>/images/icons/edit_icon.gif</image>
<action-listener>#{AVMEditBean.setupEditAction}</action-listener> <action-listener>#{AVMEditBean.setupEditAction}</action-listener>
@@ -15,6 +18,9 @@
<!-- Delete AVM file --> <!-- Delete AVM file -->
<action id="delete_file"> <action id="delete_file">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -26,6 +32,9 @@
<!-- Delete AVM file, with a return navigation outcome parameter --> <!-- Delete AVM file, with a return navigation outcome parameter -->
<action id="delete_file_browse"> <action id="delete_file_browse">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -37,6 +46,9 @@
<!-- Delete AVM folder --> <!-- Delete AVM folder -->
<action id="delete_folder"> <action id="delete_folder">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -48,6 +60,9 @@
<!-- Delete AVM folder, with a return navigation outcome parameter --> <!-- Delete AVM folder, with a return navigation outcome parameter -->
<action id="delete_folder_browse"> <action id="delete_folder_browse">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -59,6 +74,9 @@
<!-- Submit AVM node --> <!-- Submit AVM node -->
<action id="submit"> <action id="submit">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<label-id>submit</label-id> <label-id>submit</label-id>
<image>/images/icons/submit.gif</image> <image>/images/icons/submit.gif</image>
<action-listener>#{AVMBrowseBean.submitNode}</action-listener> <action-listener>#{AVMBrowseBean.submitNode}</action-listener>
@@ -85,6 +103,9 @@
<!-- Create AVM Content --> <!-- Create AVM Content -->
<action id="create_content"> <action id="create_content">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>sandbox_create</label-id> <label-id>sandbox_create</label-id>
<image>/images/icons/new_content.gif</image> <image>/images/icons/new_content.gif</image>
<action>wizard:createWebContent</action> <action>wizard:createWebContent</action>
@@ -92,6 +113,9 @@
<!-- Create AVM folder --> <!-- Create AVM folder -->
<action id="create_folder"> <action id="create_folder">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>create_folder</label-id> <label-id>create_folder</label-id>
<image>/images/icons/create_space.gif</image> <image>/images/icons/create_space.gif</image>
<action>dialog:createAvmFolder</action> <action>dialog:createAvmFolder</action>
@@ -99,6 +123,9 @@
<!-- Upload Content --> <!-- Upload Content -->
<action id="add_content"> <action id="add_content">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>add_content</label-id> <label-id>add_content</label-id>
<image>/images/icons/add.gif</image> <image>/images/icons/add.gif</image>
<action>addAvmContent</action> <action>addAvmContent</action>
@@ -107,6 +134,9 @@
<!-- Update document --> <!-- Update document -->
<action id="update_file"> <action id="update_file">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label-id>update</label-id> <label-id>update</label-id>
<image>/images/icons/update.gif</image> <image>/images/icons/update.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>

View File

@@ -66,6 +66,11 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
private static final String FILE_TEMPLATEOUTPUT = "template-output-method";
private static final String FILE_SCHEMA = "schema";
/** /**
* Simple wrapper class to represent a template output method * Simple wrapper class to represent a template output method
*/ */
@@ -204,8 +209,6 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
this.schemaRootTagName = null; this.schemaRootTagName = null;
this.templateName = null; this.templateName = null;
this.templateOutputMethods = new ArrayList<TemplateOutputMethodData>(); this.templateOutputMethods = new ArrayList<TemplateOutputMethodData>();
clearUpload("schema");
clearUpload("template-output-method");
} }
@Override @Override
@@ -275,7 +278,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
*/ */
public String removeUploadedSchemaFile() public String removeUploadedSchemaFile()
{ {
clearUpload("schema"); clearUpload(FILE_SCHEMA);
// refresh the current page // refresh the current page
return null; return null;
@@ -286,7 +289,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
*/ */
public String removeUploadedTemplateOutputMethodFile() public String removeUploadedTemplateOutputMethodFile()
{ {
clearUpload("template-output-method"); clearUpload(FILE_TEMPLATEOUTPUT);
// refresh the current page // refresh the current page
return null; return null;
@@ -369,7 +372,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
*/ */
public File getSchemaFile() public File getSchemaFile()
{ {
return this.getFile("schema"); return this.getFile(FILE_SCHEMA);
} }
/** /**
@@ -379,7 +382,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
{ {
// try and retrieve the file and filename from the file upload bean // try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded. // representing the file we previously uploaded.
return this.getFileName("schema"); return this.getFileName(FILE_SCHEMA);
} }
/** /**
@@ -387,7 +390,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
*/ */
public String getTemplateOutputMethodFileName() public String getTemplateOutputMethodFileName()
{ {
return this.getFileName("template-output-method"); return this.getFileName(FILE_TEMPLATEOUTPUT);
} }
/** /**
@@ -395,7 +398,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
*/ */
public File getTemplateOutputMethodFile() public File getTemplateOutputMethodFile()
{ {
return this.getFile("template-output-method"); return this.getFile(FILE_TEMPLATEOUTPUT);
} }
/** /**
@@ -490,12 +493,12 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
{ {
// remove the file upload bean from the session // remove the file upload bean from the session
FacesContext ctx = FacesContext.getCurrentInstance(); FacesContext ctx = FacesContext.getCurrentInstance();
FileUploadBean fileBean = (FileUploadBean) FileUploadBean fileBean =
ctx.getExternalContext().getSessionMap(). (FileUploadBean)ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id));
get(FileUploadBean.getKey(id));
if (fileBean != null) if (fileBean != null)
{ {
fileBean.setFile(null); fileBean.setFile(null);
fileBean.setFileName(null);
} }
} }
} }

View File

@@ -89,7 +89,7 @@ public class Node implements Serializable
/** /**
* @return All the properties known about this node. * @return All the properties known about this node.
*/ */
public final Map<String, Object> getProperties() public Map<String, Object> getProperties()
{ {
if (this.propsRetrieved == false) if (this.propsRetrieved == false)
{ {
@@ -289,7 +289,7 @@ public class Node implements Serializable
/** /**
* @return The display name for the node * @return The display name for the node
*/ */
public final String getName() public String getName()
{ {
if (this.name == null) if (this.name == null)
{ {
@@ -339,20 +339,20 @@ public class Node implements Serializable
public boolean hasPermission(String permission) public boolean hasPermission(String permission)
{ {
Boolean valid = null; Boolean valid = null;
if (permissions != null) if (this.permissions != null)
{ {
valid = permissions.get(permission); valid = this.permissions.get(permission);
} }
else else
{ {
permissions = new HashMap<String, Boolean>(5, 1.0f); this.permissions = new HashMap<String, Boolean>(8, 1.0f);
} }
if (valid == null) if (valid == null)
{ {
PermissionService service = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); PermissionService service = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
valid = Boolean.valueOf(service.hasPermission(this.nodeRef, permission) == AccessStatus.ALLOWED); valid = Boolean.valueOf(service.hasPermission(this.nodeRef, permission) == AccessStatus.ALLOWED);
permissions.put(permission, valid); this.permissions.put(permission, valid);
} }
return valid.booleanValue(); return valid.booleanValue();
@@ -369,7 +369,7 @@ public class Node implements Serializable
/** /**
* @return The path for the node * @return The path for the node
*/ */
public final String getPath() public String getPath()
{ {
if (this.path == null) if (this.path == null)
{ {

View File

@@ -90,6 +90,7 @@ public class AVMBrowseBean implements IContextListener
private String username; private String username;
private String sandboxTitle = null; private String sandboxTitle = null;
private String currentPath = null; private String currentPath = null;
private AVMNode currentPathNode = null;
/* component references */ /* component references */
private UIRichList foldersRichList; private UIRichList foldersRichList;
@@ -100,7 +101,7 @@ public class AVMBrowseBean implements IContextListener
private List<Map> files = null; private List<Map> files = null;
private List<Map> folders = null; private List<Map> folders = null;
/** Current AVM Node context*/ /** Current AVM Node action context */
private AVMNode avmNode = null; private AVMNode avmNode = null;
private String wcmDomain; private String wcmDomain;
@@ -415,25 +416,25 @@ public class AVMBrowseBean implements IContextListener
} }
/** /**
* @return Returns the current AVM node context. * @return Returns the current AVM node action context.
*/ */
public AVMNode getAvmNode() public AVMNode getAvmActionNode()
{ {
return this.avmNode; return this.avmNode;
} }
/** /**
* @param avmNode The AVM node context to set. * @param avmNode The AVM node action context to set.
*/ */
public void setAvmNode(AVMNode avmNode) public void setAvmActionNode(AVMNode avmNode)
{ {
this.avmNode = avmNode; this.avmNode = avmNode;
} }
/** /**
* @param avmRef The AVMNodeDescriptor context to set. * @param avmRef The AVMNodeDescriptor action context to set.
*/ */
public void setAVMNodeDescriptor(AVMNodeDescriptor avmRef) public void setAVMActionNodeDescriptor(AVMNodeDescriptor avmRef)
{ {
AVMNode avmNode = new AVMNode(avmRef); AVMNode avmNode = new AVMNode(avmRef);
this.avmNode = avmNode; this.avmNode = avmNode;
@@ -457,11 +458,29 @@ public class AVMBrowseBean implements IContextListener
public void setCurrentPath(String path) public void setCurrentPath(String path)
{ {
this.currentPath = path; this.currentPath = path;
if (path == null)
{
// clear dependant objects (recreated when the path is reinitialised)
this.currentPathNode = null;
}
// update UI state ready for screen refresh // update UI state ready for screen refresh
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
} }
/**
* @return the AVMNode that represents the current browsing path
*/
public AVMNode getCurrentPathNode()
{
if (this.currentPathNode == null)
{
AVMNodeDescriptor node = this.avmService.lookup(-1, getCurrentPath(), true);
this.currentPathNode = new AVMNode(node);
}
return this.currentPathNode;
}
/** /**
* @return Breadcrumb location list * @return Breadcrumb location list
*/ */
@@ -638,11 +657,11 @@ public class AVMBrowseBean implements IContextListener
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Setup content action for path: " + path); logger.debug("Setup content action for path: " + path);
AVMNodeDescriptor node = avmService.lookup(-1, path, true); AVMNodeDescriptor node = avmService.lookup(-1, path, true);
setAVMNodeDescriptor(node); setAVMActionNodeDescriptor(node);
} }
else else
{ {
setAvmNode(null); setAvmActionNode(null);
} }
// update UI state ready for return after dialog close // update UI state ready for return after dialog close
@@ -667,14 +686,14 @@ public class AVMBrowseBean implements IContextListener
tx.begin(); tx.begin();
Action action = this.actionService.createAction(ACTION_AVM_SUBMIT); Action action = this.actionService.createAction(ACTION_AVM_SUBMIT);
this.actionService.executeAction(action, getAvmNode().getNodeRef()); this.actionService.executeAction(action, getAvmActionNode().getNodeRef());
// commit the transaction // commit the transaction
tx.commit(); tx.commit();
// if we get here, all was well - output friendly status message to the user // if we get here, all was well - output friendly status message to the user
String msg = MessageFormat.format(Application.getMessage( String msg = MessageFormat.format(Application.getMessage(
context, MSG_SUBMIT_SUCCESS), getAvmNode().getName()); context, MSG_SUBMIT_SUCCESS), getAvmActionNode().getName());
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context); String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg); context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);

View File

@@ -116,7 +116,7 @@ public class AVMEditBean
*/ */
public AVMNode getAvmNode() public AVMNode getAvmNode()
{ {
return this.avmBrowseBean.getAvmNode(); return this.avmBrowseBean.getAvmActionNode();
} }
/** /**

View File

@@ -20,25 +20,23 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue; import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.QNameMap; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/** /**
* Node class representing an AVM specific Node.
*
* Handles AVM related notions such as Path and Version. Provides the usual properties and
* property resolving functions, and appropriate method overrides for the AVM world.
*
* @author Kevin Roast * @author Kevin Roast
*/ */
public class AVMNode implements Map<String, Object> public class AVMNode extends Node implements Map<String, Object>
{ {
private QNameMap<String, Object> properties = null;
private ServiceRegistry services = null;
private AVMNodeDescriptor avmRef; private AVMNodeDescriptor avmRef;
private String path; private String path;
private int version; private int version;
@@ -47,46 +45,51 @@ public class AVMNode implements Map<String, Object>
/** /**
* Constructor * Constructor
*
* @param avmRef The AVMNodeDescriptor that describes this node
*/ */
public AVMNode(AVMNodeDescriptor avmRef) public AVMNode(AVMNodeDescriptor avmRef)
{ {
super(AVMNodeConverter.ToNodeRef(-1, avmRef.getPath()));
this.avmRef = avmRef; this.avmRef = avmRef;
this.version = -1; // TODO: always -1 for now... this.version = -1; // TODO: always -1 for now...
this.path = avmRef.getPath(); this.path = avmRef.getPath();
this.id = this.path;
} }
/**
* Constructor
*
* @param avmRef The AVMNodeDescriptor that describes this node
* @param deleted True if the node represents a ghosted deleted node
*/
public AVMNode(AVMNodeDescriptor avmRef, boolean deleted) public AVMNode(AVMNodeDescriptor avmRef, boolean deleted)
{ {
this(avmRef); this(avmRef);
this.deleted = deleted; this.deleted = deleted;
} }
public String getPath() public final String getPath()
{ {
return this.path; return this.path;
} }
public int getVersion() public final int getVersion()
{ {
return this.version; return this.version;
} }
public String getName() public final String getName()
{ {
return this.avmRef.getName(); return this.avmRef.getName();
} }
public NodeRef getNodeRef() public final boolean isDirectory()
{
return AVMNodeConverter.ToNodeRef(this.version, this.path);
}
public boolean isDirectory()
{ {
return this.avmRef.isDirectory(); return this.avmRef.isDirectory();
} }
public boolean isFile() public final boolean isFile()
{ {
return this.avmRef.isFile(); return this.avmRef.isFile();
} }
@@ -96,10 +99,8 @@ public class AVMNode implements Map<String, Object>
*/ */
public final Map<String, Object> getProperties() public final Map<String, Object> getProperties()
{ {
if (this.properties == null) if (this.propsRetrieved == false)
{ {
this.properties = new QNameMap<String, Object>(getServiceRegistry().getNamespaceService());
if (this.deleted == false) if (this.deleted == false)
{ {
Map<QName, PropertyValue> props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.path); Map<QName, PropertyValue> props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.path);
@@ -117,31 +118,13 @@ public class AVMNode implements Map<String, Object>
this.properties.put("created", this.avmRef.getCreateDate()); this.properties.put("created", this.avmRef.getCreateDate());
this.properties.put("modified", this.avmRef.getModDate()); this.properties.put("modified", this.avmRef.getModDate());
this.properties.put("creator", this.avmRef.getCreator()); this.properties.put("creator", this.avmRef.getCreator());
this.propsRetrieved = true;
} }
return this.properties; return this.properties;
} }
/**
* Determines whether the given property name is held by this node
*
* @param propertyName Property to test existence of
* @return true if property exists, false otherwise
*/
public final boolean hasProperty(String propertyName)
{
return getProperties().containsKey(propertyName);
}
private ServiceRegistry getServiceRegistry()
{
if (this.services == null)
{
this.services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
}
return this.services;
}
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
// Map implementation - allows the Node bean to be accessed using JSF expression syntax // Map implementation - allows the Node bean to be accessed using JSF expression syntax

View File

@@ -131,7 +131,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
{ {
foundCurrentUser = true; foundCurrentUser = true;
} }
if (ROLE_CONTENT_MANAGER.equals(userRole)) if (ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{ {
managers.add(authority); managers.add(authority);
} }

View File

@@ -49,7 +49,7 @@ public class DeleteFileDialog extends BaseDialogBean
throws Exception throws Exception
{ {
// get the content to delete // get the content to delete
AVMNode node = this.avmBrowseBean.getAvmNode(); AVMNode node = this.avmBrowseBean.getAvmActionNode();
if (node != null) if (node != null)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -101,6 +101,6 @@ public class DeleteFileDialog extends BaseDialogBean
"delete_avm_file_confirm"); "delete_avm_file_confirm");
return MessageFormat.format(fileConfirmMsg, return MessageFormat.format(fileConfirmMsg,
new Object[] {this.avmBrowseBean.getAvmNode().getName()}); new Object[] {this.avmBrowseBean.getAvmActionNode().getName()});
} }
} }

View File

@@ -49,7 +49,7 @@ public class DeleteFolderDialog extends BaseDialogBean
throws Exception throws Exception
{ {
// get the content to delete // get the content to delete
AVMNode node = this.avmBrowseBean.getAvmNode(); AVMNode node = this.avmBrowseBean.getAvmActionNode();
if (node != null) if (node != null)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -101,6 +101,6 @@ public class DeleteFolderDialog extends BaseDialogBean
"delete_avm_folder_confirm"); "delete_avm_folder_confirm");
return MessageFormat.format(fileConfirmMsg, return MessageFormat.format(fileConfirmMsg,
new Object[] {this.avmBrowseBean.getAvmNode().getName()}); new Object[] {this.avmBrowseBean.getAvmActionNode().getName()});
} }
} }

View File

@@ -78,7 +78,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
@Override @Override
protected Node initEditableNode() protected Node initEditableNode()
{ {
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef()); return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef());
} }
@Override @Override
@@ -170,7 +170,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
String name = this.editableNode.getName(); String name = this.editableNode.getName();
String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond();
String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name;
this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath))); this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath)));
return outcome; return outcome;
} }
@@ -194,7 +194,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
{ {
return MessageFormat.format(Application.getMessage( return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF),
new Object[] {this.avmBrowseBean.getAvmNode().getPath()}); new Object[] {this.avmBrowseBean.getAvmActionNode().getPath()});
} }
else else
{ {

View File

@@ -77,7 +77,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog
@Override @Override
protected Node initEditableNode() protected Node initEditableNode()
{ {
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef()); return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef());
} }
@Override @Override
@@ -154,7 +154,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog
String name = this.editableNode.getName(); String name = this.editableNode.getName();
String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond();
String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name;
this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath))); this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath)));
return outcome; return outcome;
} }

View File

@@ -35,7 +35,7 @@ public class FileDetailsBean extends AVMDetailsBean
@Override @Override
public AVMNode getAvmNode() public AVMNode getAvmNode()
{ {
return this.avmBrowseBean.getAvmNode(); return this.avmBrowseBean.getAvmActionNode();
} }
/** /**

View File

@@ -35,7 +35,7 @@ public class FolderDetailsBean extends AVMDetailsBean
@Override @Override
public AVMNode getAvmNode() public AVMNode getAvmNode()
{ {
return this.avmBrowseBean.getAvmNode(); return this.avmBrowseBean.getAvmActionNode();
} }
/** /**

View File

@@ -18,6 +18,7 @@ package org.alfresco.web.templating;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -30,6 +31,7 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.wcm.AVMConstants; import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -83,6 +85,9 @@ public class OutputUtil
nodeService.setProperty(outputNodeRef, nodeService.setProperty(outputNodeRef,
TemplatingService.TT_QNAME, TemplatingService.TT_QNAME,
tt.getName()); tt.getName());
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, fileName);
nodeService.addAspect(outputNodeRef, ContentModel.ASPECT_TITLED, titledProps);
LOGGER.debug("generated " + generatedFileName + " using " + tom); LOGGER.debug("generated " + generatedFileName + " using " + tom);

View File

@@ -42,6 +42,8 @@ import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.DownloadContentServlet; import org.alfresco.web.app.servlet.DownloadContentServlet;
@@ -184,6 +186,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
ResourceBundle bundle = Application.getBundle(context); ResourceBundle bundle = Application.getBundle(context);
AVMService avmService = getAVMService(context); AVMService avmService = getAVMService(context);
NodeService nodeService = getNodeService(context); NodeService nodeService = getNodeService(context);
PermissionService permissionService = getPermissionService(context);
UserTransaction tx = null; UserTransaction tx = null;
try try
{ {
@@ -191,13 +194,14 @@ public class UIUserSandboxes extends SelfRenderingComponent
tx.begin(); tx.begin();
NodeRef websiteRef = getValue(); NodeRef websiteRef = getValue();
if (value == null) if (websiteRef == null)
{ {
throw new IllegalArgumentException("Website NodeRef must be specified."); throw new IllegalArgumentException("Website NodeRef must be specified.");
} }
String storeRoot = (String)nodeService.getProperty(websiteRef, ContentModel.PROP_AVMSTORE); String storeRoot = (String)nodeService.getProperty(websiteRef, ContentModel.PROP_AVMSTORE);
// get the list of users who have a sandbox in the website // get the list of users who have a sandbox in the website
String currentUser = Application.getCurrentUser(context).getUserName();
int index = 0; int index = 0;
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs( List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
websiteRef, ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); websiteRef, ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
@@ -213,83 +217,92 @@ public class UIUserSandboxes extends SelfRenderingComponent
// check it exists before we render the view // check it exists before we render the view
if (avmService.getAVMStore(mainStore) != null) if (avmService.getAVMStore(mainStore) != null)
{ {
// check the permissions on this store for the current user
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Building sandbox view for user store: " + mainStore); logger.debug("Checking user permissions for store: " + mainStore);
if (permissionService.hasPermission(
// for each user sandbox, generate an outer panel table AVMNodeConverter.ToNodeRef(-1, AVMConstants.buildAVMStoreRootPath(mainStore)),
PanelGenerator.generatePanelStart(out, PermissionService.READ) == AccessStatus.ALLOWED)
context.getExternalContext().getRequestContextPath(),
"white",
"white");
// components for the current username, preview, browse and modified items inner list
out.write("<table cellspacing=2 cellpadding=2 border=0 width=100%><tr><td>");
// show the icon for the sandbox as a clickable browse link image
// this is currently identical to the sandbox_browse action as below
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32,
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
out.write("</td><td width=100%>");
out.write("<b>");
out.write(bundle.getString(MSG_USERNAME));
out.write(":</b>&nbsp;");
out.write(username);
out.write(" (");
out.write(bundle.getString(userrole));
out.write(")</td><td><nobr>");
// direct actions for a sandbox
String sandboxUrl = AVMConstants.buildAVMStoreUrl(mainStore);
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif",
null, null, sandboxUrl));
out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif",
"#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null));
out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif",
"#{AVMBrowseBean.submitAll}", null, null));
out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif",
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
out.write("</nobr></td></tr>");
// modified items panel
out.write("<tr><td></td><td colspan=2>");
String panelImage = WebResources.IMAGE_COLLAPSED;
if (this.expandedPanels.contains(username))
{ {
panelImage = WebResources.IMAGE_EXPANDED; if (logger.isDebugEnabled())
} logger.debug("Building sandbox view for user store: " + mainStore);
out.write(Utils.buildImageTag(context, panelImage, 11, 11, "",
Utils.generateFormSubmit(context, this, getClientId(context), username))); // for each user sandbox, generate an outer panel table
out.write("&nbsp;<b>"); PanelGenerator.generatePanelStart(out,
out.write(bundle.getString(MSG_MODIFIED_ITEMS)); context.getExternalContext().getRequestContextPath(),
out.write("</b>"); "white",
if (this.expandedPanels.contains(username)) "white");
{
out.write("<div style='padding:2px'></div>"); // components for the current username, preview, browse and modified items inner list
out.write("<table cellspacing=2 cellpadding=2 border=0 width=100%><tr><td>");
// list the modified docs for this sandbox user // show the icon for the sandbox as a clickable browse link image
renderUserFiles(context, out, username, storeRoot); // this is currently identical to the sandbox_browse action as below
} Utils.encodeRecursive(context, aquireAction(
out.write("</td></tr></table>"); context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32,
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
// end the outer panel for this sandbox out.write("</td><td width=100%>");
PanelGenerator.generatePanelEnd(out, out.write("<b>");
context.getExternalContext().getRequestContextPath(), out.write(bundle.getString(MSG_USERNAME));
"white"); out.write(":</b>&nbsp;");
out.write(username);
// spacer row out.write(" (");
if (index++ < userInfoRefs.size() - 1) out.write(bundle.getString(userrole));
{ out.write(")</td><td><nobr>");
out.write("<div style='padding:4px'></div>");
// direct actions for a sandbox
String sandboxUrl = AVMConstants.buildAVMStoreUrl(mainStore);
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif",
null, null, sandboxUrl));
out.write("&nbsp;");
// TODO: add this action back once we can create in a specific sub-folder
/*Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif",
"#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null));
out.write("&nbsp;");*/
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif",
"#{AVMBrowseBean.submitAll}", null, null));
out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif",
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
out.write("</nobr></td></tr>");
// modified items panel
out.write("<tr><td></td><td colspan=2>");
String panelImage = WebResources.IMAGE_COLLAPSED;
if (this.expandedPanels.contains(username))
{
panelImage = WebResources.IMAGE_EXPANDED;
}
out.write(Utils.buildImageTag(context, panelImage, 11, 11, "",
Utils.generateFormSubmit(context, this, getClientId(context), username)));
out.write("&nbsp;<b>");
out.write(bundle.getString(MSG_MODIFIED_ITEMS));
out.write("</b>");
if (this.expandedPanels.contains(username))
{
out.write("<div style='padding:2px'></div>");
// list the modified docs for this sandbox user
renderUserFiles(context, out, username, storeRoot);
}
out.write("</td></tr></table>");
// end the outer panel for this sandbox
PanelGenerator.generatePanelEnd(out,
context.getExternalContext().getRequestContextPath(),
"white");
// spacer row
if (index++ < userInfoRefs.size() - 1)
{
out.write("<div style='padding:4px'></div>");
}
} }
} }
} }
@@ -664,6 +677,11 @@ public class UIUserSandboxes extends SelfRenderingComponent
return (AVMSyncService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMSyncService"); return (AVMSyncService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMSyncService");
} }
private PermissionService getPermissionService(FacesContext fc)
{
return Repository.getServiceRegistry(fc).getPermissionService();
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Strongly typed component property accessors // Strongly typed component property accessors

View File

@@ -79,14 +79,16 @@
</td> </td>
<td style="padding-left:4px" width=52> <td style="padding-left:4px" width=52>
<%-- Create actions menu --%> <%-- Create actions menu --%>
<a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap"> <r:permissionEvaluator value="#{AVMBrowseBean.currentPathNode}" allow="CreateChildren" id="eval1">
<r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.avmNode}" /> <a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
</a:menu> <r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.currentPathNode}" />
</a:menu>
</r:permissionEvaluator>
</td> </td>
<td style="padding-left:4px" width=80> <td style="padding-left:4px" width=80>
<%-- More actions menu --%> <%-- More actions menu --%>
<a:menu id="actionsMenu" itemSpacing="4" label="#{msg.more_actions}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap"> <a:menu id="actionsMenu" itemSpacing="4" label="#{msg.more_actions}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
<r:actions id="acts_more" value="avm_more_menu" context="#{AVMBrowseBean.avmNode}" /> <r:actions id="acts_more" value="avm_more_menu" context="#{AVMBrowseBean.currentPathNode}" />
</a:menu> </a:menu>
</td> </td>
</tr> </tr>

View File

@@ -76,7 +76,9 @@
</td> </td>
<td align=right> <td align=right>
<%-- Import website content action --%> <%-- Import website content action --%>
<a:actionLink value="#{msg.import_website_content}" image="/images/icons/import_website.gif" padding="2" action="dialog:importContent" actionListener="#{ImportWebsiteDialog.start}" /> <r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval1">
<a:actionLink value="#{msg.import_website_content}" image="/images/icons/import_website.gif" padding="2" action="dialog:importContent" actionListener="#{ImportWebsiteDialog.start}" />
</r:permissionEvaluator>
</td> </td>
</tr> </tr>
</table> </table>
@@ -106,7 +108,8 @@
<td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td> <td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
<td align=right> <td align=right>
<a:actionLink id="actPreview" value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" href="#{AVMBrowseBean.stagingPreviewUrl}" target="new" /> <a:actionLink id="actPreview" value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" href="#{AVMBrowseBean.stagingPreviewUrl}" target="new" />
<a:actionLink id="actCreate" value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" /> <%-- 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="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" /> <a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
</td> </td>
</tr> </tr>

View File

@@ -28,11 +28,11 @@
<script type="text/javascript"> <script type="text/javascript">
function upload_file(el) function upload_file(el)
{ {
el.form.method = "post"; el.form.method = "post";
el.form.enctype = "multipart/form-data"; el.form.enctype = "multipart/form-data";
el.form.action = "<%= request.getContextPath() %>/uploadFileServlet"; el.form.action = "<%= request.getContextPath() %>/uploadFileServlet";
el.form.submit(); el.form.submit();
return false; return false;
} }
</script> </script>
</f:verbatim> </f:verbatim>
@@ -79,17 +79,16 @@ if (upload == null || upload.getFile() == null)
} }
%> %>
<h:graphicImage id="required_image_file_extension" <h:graphicImage id="required_image_file_extension"
value="/images/icons/required_field.gif" alt="Required Field" /> value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="file_extension_output_text" <h:outputText id="file_extension_output_text"
value="#{msg.extension_for_generated_assets}:"/> value="#{msg.extension_for_generated_assets}:"/>
<h:inputText id="file-extension" value="" <h:inputText id="file-extension" value="shtml"
maxlength="10" size="10"/> maxlength="10" size="10"/>
</h:panelGrid> </h:panelGrid>
<h:panelGroup id="step-2-panel-group" styleClass="mainSubText"> <h:panelGroup id="step-2-panel-group" styleClass="mainSubText">
<h:outputText id="step-2-output-text" value="2." /> <h:outputText id="step-2-output-text" value="2." />
<h:commandButton id="add-to-list-button" <h:commandButton id="add-to-list-button" value="#{msg.add_to_list_button}"
value="#{msg.add_to_list_button}"
actionListener="#{CreateXmlContentTypeWizard.addSelectedTemplateOutputMethod}" actionListener="#{CreateXmlContentTypeWizard.addSelectedTemplateOutputMethod}"
styleClass="wizardButton" /> styleClass="wizardButton" />
</h:panelGroup> </h:panelGroup>

View File

@@ -132,9 +132,9 @@
<h:panelGroup id="props-panel-facets"> <h:panelGroup id="props-panel-facets">
<f:facet name="title"> <f:facet name="title">
<%--<r:permissionEvaluator value="#{FileDetailsBean.document}" allow="Write">--%> <r:permissionEvaluator value="#{FileDetailsBean.document}" allow="Write">
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFileProperties" /> <a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFileProperties" />
<%--</r:permissionEvaluator>--%> </r:permissionEvaluator>
</f:facet> </f:facet>
</h:panelGroup> </h:panelGroup>
<a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true" <a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true"

View File

@@ -125,9 +125,9 @@
<h:panelGroup id="props-panel-facets"> <h:panelGroup id="props-panel-facets">
<f:facet name="title"> <f:facet name="title">
<%--<r:permissionEvaluator value="#{FolderDetailsBean.folder}" allow="Write">--%> <r:permissionEvaluator value="#{FolderDetailsBean.folder}" allow="Write">
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFolderProperties" /> <a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFolderProperties" />
<%--</r:permissionEvaluator>--%> </r:permissionEvaluator>
</f:facet> </f:facet>
</h:panelGroup> </h:panelGroup>
<a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true" <a:panel label="#{msg.properties}" id="properties-panel" facetsId="props-panel-facets" progressive="true"