Merged 1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4229 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4230 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4232 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4233 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4234 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4235 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4239 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4240 .
   svn resolved root\projects\web-client\source\java\org\alfresco\web\app\AlfrescoNavigationHandler.java
   svn resolved root\projects\web-client\source\web\WEB-INF\faces-config-beans.xml
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4241 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4242 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4243 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4244 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4244 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4245 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4245 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4246 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4247 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4248 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4248 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4249 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4250 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4251 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4251 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4252 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4633 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-12-18 13:18:44 +00:00
parent 549ce68112
commit 3627699e04
15 changed files with 2258 additions and 41 deletions

View File

@@ -21,6 +21,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
@@ -50,7 +51,8 @@ public class EditDocCIFSEvaluator implements ActionEvaluator
"cifs".equals(Application.getClientConfig(fc).getEditLinkType()))
{
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
(node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.WRITE)) ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
result = true;
}

View File

@@ -21,6 +21,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
@@ -50,8 +51,9 @@ public class EditDocHttpEvaluator implements ActionEvaluator
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) == true ||
"http".equals(Application.getClientConfig(fc).getEditLinkType()))
{
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
if (node.isWorkingCopyOwner() == true ||
(node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.WRITE)) ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
result = true;
}

View File

@@ -21,6 +21,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
@@ -50,7 +51,8 @@ public class EditDocWebDavEvaluator implements ActionEvaluator
"webdav".equals(Application.getClientConfig(fc).getEditLinkType()))
{
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
(node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.WRITE)) ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
result = true;
}

View File

@@ -26,7 +26,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigService;
import org.alfresco.web.app.servlet.ExternalAccessServlet;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.dialog.DialogManager;
import org.alfresco.web.bean.dialog.DialogState;
@@ -121,6 +121,13 @@ public class AlfrescoNavigationHandler extends NavigationHandler
}
}
// reset the dispatch context
Object bean = FacesHelper.getManagedBean(context, CONFIG_NAV_BEAN);
if (bean instanceof NavigationBean)
{
((NavigationBean)bean).resetDispatchContext();
}
if (logger.isDebugEnabled())
logger.debug("view stack: " + getViewStack(context));
}
@@ -659,28 +666,14 @@ public class AlfrescoNavigationHandler extends NavigationHandler
}
else
{
// the details pages can be loaded via the external access servlet,
// if this is the case the details page would not have been loaded as
// a dialog, in this scenario just use the global "browse" outcome.
String referer = (String)context.getExternalContext().
getRequestHeaderMap().get("referer");
if ((referer != null) &&
((referer.indexOf(ExternalAccessServlet.OUTCOME_DOCDETAILS) != -1) ||
(referer.indexOf(ExternalAccessServlet.OUTCOME_SPACEDETAILS) != -1)))
// we are trying to close a dialog when one hasn't been opened!
// return to the main page of the app (print warning if debug is enabled)
if (logger.isDebugEnabled())
{
navigate(context, fromAction, "browse");
}
else
{
// we are trying to close a dialog when one hasn't been opened!
// log a warning and return a null outcome to stay on the same page
if (logger.isWarnEnabled())
{
logger.warn("Attempting to close a " + closingItem + " with an empty view stack, returning null outcome");
}
navigate(context, fromAction, null);
logger.debug("Attempting to close a " + closingItem + " with an empty view stack, returning 'browse' outcome");
}
navigate(context, fromAction, "browse");
}
}

View File

@@ -251,7 +251,7 @@ public class TransientNode extends Node
TypeDefinition typeDef = ddService.getType(this.type);
if (typeDef == null)
{
throw new AlfrescoRuntimeException("Failed to find type definition for start task: " + this.type);
throw new AlfrescoRuntimeException("Failed to find type definition: " + this.type);
}
this.aspects = new HashSet<QName>();

View File

@@ -229,7 +229,7 @@ public final class User
Map<QName, Serializable> props = nodeService.getProperties(user);
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
String fullName = firstName + ((lastName != null && lastName.length() > 0) ? " " + lastName : "");
return fullName;
}

View File

@@ -460,16 +460,18 @@ public class CreateSpaceWizard extends BaseWizardBean
FacesContext context = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(context) + "/" + Application.getGlossaryFolderName(context) +
"/" + Application.getSpaceTemplatesFolderName(context) + "/*";
NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
NamespaceService resolver = Repository.getServiceRegistry(context).getNamespaceService();
List<NodeRef> results = this.searchService.selectNodes(rootNodeRef, xpath, null, resolver, false);
NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
List<NodeRef> results = this.searchService.selectNodes(rootNodeRef, xpath, null, this.namespaceService, false);
if (results.size() > 0)
{
for (NodeRef assocRef : results)
{
Node childNode = new Node(assocRef);
this.templates.add(new SelectItem(childNode.getId(), childNode.getName()));
if (this.dictionaryService.isSubClass(childNode.getType(), ContentModel.TYPE_FOLDER))
{
this.templates.add(new SelectItem(childNode.getId(), childNode.getName()));
}
}
// make sure the list is sorted by the label

View File

@@ -532,6 +532,22 @@ public class StartWorkflowWizard extends BaseWizardBean
return availableWorkflows;
}
/**
* Returns the URL to the Workflow Definition Image of the current task
*
* @return the url
*/
public String getWorkflowDefinitionImageUrl()
{
String url = null;
if (selectedWorkflow != null)
{
WorkflowDefinition def = workflows.get(selectedWorkflow);
url = "/workflowdefinitionimage/" + def.id;
}
return url;
}
/**
* Returns a list of resources associated with this task
* i.e. the children of the workflow package

View File

@@ -2,8 +2,10 @@ package org.alfresco.web.bean.workflow;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
@@ -14,13 +16,17 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition;
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
import org.alfresco.service.cmr.workflow.WorkflowTransition;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.TransientMapNode;
import org.alfresco.web.bean.repository.TransientNode;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -31,6 +37,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class WorkflowBean
{
protected NavigationBean navigationBean;
protected NodeService nodeService;
protected WorkflowService workflowService;
protected List<Node> tasks;
@@ -141,6 +148,16 @@ public class WorkflowBean
return this.completedTasks;
}
/**
* Sets the navigation bean to use
*
* @param navigationBean The NavigationBean to set.
*/
public void setNavigationBean(NavigationBean navigationBean)
{
this.navigationBean = navigationBean;
}
/**
* Sets the workflow service to use
*
@@ -161,6 +178,24 @@ public class WorkflowBean
this.nodeService = nodeService;
}
// ------------------------------------------------------------------------------
// Navigation handlers
public void setupTaskDialog(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
String type = params.get("type");
// setup the dispatch context with the task we're opening a dialog for
TransientNode node = new TransientNode(QName.createQName(type), id, null);
this.navigationBean.setupDispatchContext(node);
// pass on parameters for the dialog
Application.getDialogManager().setupParameters(event);
}
// ------------------------------------------------------------------------------
// Helper methods
@@ -181,7 +216,7 @@ public class WorkflowBean
// add properties for the other useful metadata
node.getProperties().put(ContentModel.PROP_NAME.toString(), task.title);
node.getProperties().put("type", taskDef.metadata.getTitle());
node.getProperties().put("type", node.getType().toString());
node.getProperties().put("id", task.id);
// add extra properties for completed tasks