Merged V2.0 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5146 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5147 .
      - WCM-225
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5149 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5151 .
      - WCM-339
      - 2 revisions


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5170 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-16 15:56:51 +00:00
parent aa5f666c21
commit c202a2221c
6 changed files with 61 additions and 34 deletions

View File

@@ -22,18 +22,10 @@
* http://www.alfresco.com/legal/licensing" */
package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.WCMAppModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* UI Action Evaluator - Edit Web Form in the Forms DataDictionary folder
@@ -47,23 +39,6 @@ public class EditFormEvaluator implements ActionEvaluator
*/
public boolean evaluate(final Node node)
{
if (node.hasAspect(WCMAppModel.ASPECT_FORM) && node.hasPermission(PermissionService.ADD_CHILDREN))
{
final FacesContext fc = FacesContext.getCurrentInstance();
final ServiceRegistry services = Repository.getServiceRegistry(fc);
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
// get the path to the current name - compare last element with the Website folder assoc name
final Path path = navigator.getCurrentNode().getNodePath();
final Path.Element element = path.get(path.size() - 1);
final String endPath = element.getPrefixedString(services.getNamespaceService());
// check we have the permission to create nodes in that Website folder
return (Application.getContentFormsFolderName(fc).equals(endPath));
}
else
{
return false;
}
return node.hasAspect(WCMAppModel.ASPECT_FORM);
}
}

View File

@@ -285,7 +285,7 @@ public class Node implements Serializable
/**
* @return Returns the type.
*/
public final QName getType()
public QName getType()
{
if (this.type == null)
{

View File

@@ -29,7 +29,9 @@ import java.util.Map;
import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.avm.AVMNodeType;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
@@ -174,6 +176,24 @@ public class AVMNode extends Node implements Map<String, Object>
return this.avmRef.getName();
}
@Override
public QName getType()
{
if (this.type == null)
{
if (this.deleted == false)
{
this.type = getServiceRegistry().getNodeService().getType(this.nodeRef);
}
else
{
this.type = avmRef.isDeletedDirectory() ? WCMModel.TYPE_AVM_FOLDER : WCMModel.TYPE_AVM_CONTENT;
}
}
return type;
}
public final boolean isDirectory()
{
return this.avmRef.isDirectory();

View File

@@ -229,9 +229,7 @@ public class CreateFormWizard
throws Exception
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("creating form " + this.getFormName());
}
// get the node ref of the node that will contain the content
final NodeRef contentFormsNodeRef = FormsService.getInstance().getContentFormsNodeRef();
@@ -239,11 +237,13 @@ public class CreateFormWizard
final FileInfo folderInfo =
this.fileFolderService.create(contentFormsNodeRef,
this.getFormName(),
ContentModel.TYPE_FOLDER);
FileInfo fileInfo =
WCMAppModel.TYPE_FORMFOLDER);
final FileInfo fileInfo =
this.fileFolderService.create(folderInfo.getNodeRef(),
this.getSchemaFileName(),
ContentModel.TYPE_CONTENT);
// get a writer for the content and put the file
final ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(),
ContentModel.PROP_CONTENT,