mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V1.3 to HEAD (3027:3044)
svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3027 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3044 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3339 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -16,6 +16,35 @@
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Override the cut action to check for discussions, don't allow them to be cut -->
|
||||
<!-- Cut a document or space to the clipboard, from browse or doc details screens -->
|
||||
<action id="cut_node">
|
||||
<evaluator>org.alfresco.web.action.evaluator.DiscussionCutCopyEvaluator</evaluator>
|
||||
<permissions>
|
||||
<permission allow="true">Delete</permission>
|
||||
</permissions>
|
||||
<label-id>cut</label-id>
|
||||
<image>/images/icons/cut.gif</image>
|
||||
<action-listener>#{ClipboardBean.cutNode}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Override the copy action to check for discussions, don't allow them to be copied -->
|
||||
<!-- Copy a document or space to the clipboard, from browse or doc details screens -->
|
||||
<action id="copy_node">
|
||||
<evaluator>org.alfresco.web.action.evaluator.DiscussionCutCopyEvaluator</evaluator>
|
||||
<label-id>copy</label-id>
|
||||
<image>/images/icons/copy.gif</image>
|
||||
<action-listener>#{ClipboardBean.copyNode}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Discuss document or space e.g. jump to Forums view for this node -->
|
||||
<action id="discuss_node">
|
||||
|
@@ -35,32 +35,6 @@
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="fm:forums">
|
||||
<property-sheet>
|
||||
<show-property name="name"/>
|
||||
<show-property name="description"/>
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="fm:forum">
|
||||
<property-sheet>
|
||||
<show-property name="name"/>
|
||||
<show-property name="description"/>
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="fm:topic">
|
||||
<property-sheet>
|
||||
<show-property name="name" display-label-id="subject" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="dictionaryModel">
|
||||
<property-sheet>
|
||||
@@ -97,7 +71,7 @@
|
||||
<property-sheet>
|
||||
<!-- The 'name' property isn't part of the titled aspect -->
|
||||
<!-- but it's presence here will force it to the top of the -->
|
||||
<!-- list when custom types are defined in -->
|
||||
<!-- list when custom content types are defined in -->
|
||||
<!-- web-client-config-custom.xml -->
|
||||
<show-property name="name" />
|
||||
<show-property name="title" />
|
||||
@@ -105,6 +79,20 @@
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="aspect-name" condition="app:uifacets">
|
||||
<property-sheet>
|
||||
<!-- The 'name' property isn't part of the uifacets aspect -->
|
||||
<!-- but it's presence here will force it to the top of the -->
|
||||
<!-- list when custom folder types are defined in -->
|
||||
<!-- web-client-config-custom.xml -->
|
||||
<show-property name="name" />
|
||||
<show-property name="title" />
|
||||
<show-property name="description" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="aspect-name" condition="author">
|
||||
<property-sheet>
|
||||
<show-property name="author" />
|
||||
@@ -184,4 +172,39 @@
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- Configuration for discussion types -->
|
||||
|
||||
<config evaluator="node-type" condition="fm:forums">
|
||||
<property-sheet>
|
||||
<show-property name="name"/>
|
||||
<show-property name="description"/>
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
<!-- hide the title property -->
|
||||
<show-property name="title" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="fm:forum">
|
||||
<property-sheet>
|
||||
<show-property name="name"/>
|
||||
<show-property name="description"/>
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
<!-- hide the title property -->
|
||||
<show-property name="title" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="fm:topic">
|
||||
<property-sheet>
|
||||
<show-property name="name" display-label-id="subject" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||
component-generator="SpaceIconPickerGenerator" />
|
||||
<!-- hide the description and title properties -->
|
||||
<show-property name="description" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
<show-property name="title" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
</alfresco-config>
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
@@ -0,0 +1,45 @@
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* Evaluates whether the cut or copy action should be visible.
|
||||
*
|
||||
* If the node is a discussion don't allow the action.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DiscussionCutCopyEvaluator implements ActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
// if the node in question is a forum...
|
||||
if (node.getType().equals(ForumModel.TYPE_FORUM))
|
||||
{
|
||||
// get the association type
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
|
||||
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(node.getNodeRef());
|
||||
QName assocType = parentAssoc.getTypeQName();
|
||||
|
||||
// only allow the action if the association type is not the discussion assoc
|
||||
result = (assocType.equals(ForumModel.ASSOC_DISCUSSION) == false);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -17,7 +17,6 @@
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
|
@@ -261,13 +261,13 @@ public class TemplateContentServlet extends BaseServlet
|
||||
private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef templateRef, NodeRef nodeRef)
|
||||
{
|
||||
// build FreeMarker default model and merge
|
||||
Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(req.getSession()));
|
||||
Map root = DefaultModelHelper.buildDefaultModel(
|
||||
services, Application.getCurrentUser(req.getSession()), templateRef);
|
||||
|
||||
// put the current NodeRef in as "space" and "document"
|
||||
TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver);
|
||||
root.put("space", node);
|
||||
root.put("document", node);
|
||||
root.put("template", new TemplateNode(templateRef, services, this.imageResolver));
|
||||
|
||||
// add URL arguments as a map called 'args' to the root of the model
|
||||
Map<String, String> args = new HashMap<String, String>(8, 1.0f);
|
||||
|
@@ -40,6 +40,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.web.app.Application;
|
||||
@@ -568,16 +569,21 @@ public class GroupsBean implements IContextListener
|
||||
services.getNamespaceService(),
|
||||
false);
|
||||
|
||||
items = new SelectItem[nodes.size()];
|
||||
for (int index=0; index<nodes.size(); index++)
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
||||
for (NodeRef personRef : nodes)
|
||||
{
|
||||
NodeRef personRef = nodes.get(index);
|
||||
String firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||
items[index] = item;
|
||||
if (PermissionService.GUEST_AUTHORITY.equals(username) == false)
|
||||
{
|
||||
String firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
items = new SelectItem[itemList.size()];
|
||||
itemList.toArray(items);
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
|
@@ -297,7 +297,7 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate);
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
Map<String, Object> model = DefaultModelHelper.buildDefaultModel(
|
||||
services, Application.getCurrentUser(fc));
|
||||
services, Application.getCurrentUser(fc), templateRef);
|
||||
model.put("role", roleText);
|
||||
model.put("space", new TemplateNode(node, Repository.getServiceRegistry(fc), null));
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
package org.alfresco.web.config;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.config.evaluator.Evaluator;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -38,19 +37,18 @@ public final class AspectEvaluator implements Evaluator
|
||||
*/
|
||||
public boolean applies(Object obj, String condition)
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
if (obj instanceof Node)
|
||||
{
|
||||
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
|
||||
QName aspectQName = Repository.resolveToQName(condition);
|
||||
for (QName aspect : ((Node)obj).getAspects())
|
||||
Set aspects = ((Node)obj).getAspects();
|
||||
if (aspects != null)
|
||||
{
|
||||
if (dd.isSubClass(aspect, aspectQName) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
QName spaceQName = Repository.resolveToQName(condition);
|
||||
result = aspects.contains(spaceQName);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ public class DefaultModelHelper
|
||||
*
|
||||
* @return Map containing the default model.
|
||||
*/
|
||||
public static Map<String, Object> buildDefaultModel(ServiceRegistry services, User user)
|
||||
public static Map<String, Object> buildDefaultModel(ServiceRegistry services, User user, NodeRef template)
|
||||
{
|
||||
if (services == null)
|
||||
{
|
||||
@@ -85,6 +85,12 @@ public class DefaultModelHelper
|
||||
// supply the current user Node as "person"
|
||||
root.put("person", new TemplateNode(user.getPerson(), services, imageResolver));
|
||||
|
||||
// add the template itself as "template" if it comes from content on a node
|
||||
if (template != null)
|
||||
{
|
||||
root.put("template", new TemplateNode(template, services, imageResolver));
|
||||
}
|
||||
|
||||
// current date/time is useful to have and isn't supplied by FreeMarker by default
|
||||
root.put("date", new Date());
|
||||
|
||||
|
@@ -17,21 +17,16 @@
|
||||
package org.alfresco.web.ui.repo.component.template;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.el.ValueBinding;
|
||||
|
||||
import org.alfresco.repo.template.DateCompareMethod;
|
||||
import org.alfresco.repo.template.HasAspectMethod;
|
||||
import org.alfresco.repo.template.I18NMessageMethod;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.repository.TemplateException;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -108,9 +103,6 @@ public class UITemplate extends SelfRenderingComponent
|
||||
return;
|
||||
}
|
||||
|
||||
// get the data model to use - building default if required
|
||||
Object model = getModel();
|
||||
|
||||
// get the template to process
|
||||
String template = getTemplate();
|
||||
if (template != null && template.length() != 0)
|
||||
@@ -125,6 +117,9 @@ public class UITemplate extends SelfRenderingComponent
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
// get the data model to use - building default if required
|
||||
Object model = getModel();
|
||||
|
||||
// process the template against the model
|
||||
try
|
||||
{
|
||||
@@ -195,7 +190,16 @@ public class UITemplate extends SelfRenderingComponent
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
User user = Application.getCurrentUser(fc);
|
||||
Map root = DefaultModelHelper.buildDefaultModel(services, user);
|
||||
|
||||
// add the template itself to the model
|
||||
NodeRef templateRef = null;
|
||||
if (getTemplate().indexOf(StoreRef.URI_FILLER) != -1)
|
||||
{
|
||||
// found a noderef template
|
||||
templateRef = new NodeRef(getTemplate());
|
||||
}
|
||||
|
||||
Map root = DefaultModelHelper.buildDefaultModel(services, user, templateRef);
|
||||
|
||||
// merge models
|
||||
if (model instanceof Map)
|
||||
|
Reference in New Issue
Block a user