mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
19363: *RECORD ONLY* Fix for ALF-1952 - multi-pass HTML stripping 19527: Fix for ALF-1037 - only documents modified by current user should be shown in My Documents dashlet filter 19528: Fix for ALF-944 - list of users for Group admin in Explorer now only retrieves data required for values on display git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19529 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.IContextListener;
|
||||
import org.alfresco.web.app.context.UIContextService;
|
||||
@@ -43,6 +44,7 @@ import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.dialog.ChangeViewSupport;
|
||||
import org.alfresco.web.bean.dialog.FilterViewSupport;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.data.DynamicResolver;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
@@ -459,9 +461,9 @@ public class GroupsDialog extends BaseDialogBean
|
||||
/**
|
||||
* @return The list of user objects to display. Returns the list of user for the current group.
|
||||
*/
|
||||
public List<Map<String,String>> getUsers()
|
||||
public List<Map<String, Object>> getUsers()
|
||||
{
|
||||
List<Map<String,String>> users;
|
||||
List<Map<String, Object>> users;
|
||||
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
@@ -481,26 +483,17 @@ public class GroupsDialog extends BaseDialogBean
|
||||
boolean immediate = (this.filterMode.equals(FILTER_CHILDREN));
|
||||
authorities = this.getAuthorityService().getContainedAuthorities(AuthorityType.USER, this.group, immediate);
|
||||
}
|
||||
users = new ArrayList<Map<String,String>>(authorities.size());
|
||||
users = new ArrayList<Map<String, Object>>(authorities.size());
|
||||
for (String authority : authorities)
|
||||
{
|
||||
Map<String, String> authMap = new HashMap<String, String>(5);
|
||||
final Map<String, Object> authMap = new HashMap<String, Object>(8);
|
||||
|
||||
String userName = this.getAuthorityService().getShortName(authority);
|
||||
final String userName = this.getAuthorityService().getShortName(authority);
|
||||
authMap.put("userName", userName);
|
||||
authMap.put("id", authority);
|
||||
|
||||
// get Person details for this Authority
|
||||
NodeRef ref = this.getPersonService().getPerson(authority);
|
||||
String firstName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME);
|
||||
|
||||
// build a sensible label for display
|
||||
StringBuilder label = new StringBuilder(48);
|
||||
label.append(firstName)
|
||||
.append(' ')
|
||||
.append(lastName != null ? lastName : "");
|
||||
authMap.put("name", label.toString());
|
||||
authMap.put("name", new AuthorityNamePropertyResolver(userName));
|
||||
authMap.put("firstName", new AuthorityPropertyResolver(userName, ContentModel.PROP_FIRSTNAME));
|
||||
authMap.put("lastName", new AuthorityPropertyResolver(userName, ContentModel.PROP_LASTNAME));
|
||||
|
||||
users.add(authMap);
|
||||
}
|
||||
@@ -512,7 +505,7 @@ public class GroupsDialog extends BaseDialogBean
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
users = Collections.<Map<String,String>>emptyList();
|
||||
users = Collections.<Map<String, Object>>emptyList();
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
}
|
||||
|
||||
@@ -723,6 +716,7 @@ public class GroupsDialog extends BaseDialogBean
|
||||
public String Label;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple wrapper bean exposing user authority and person details for JSF results list
|
||||
*/
|
||||
@@ -749,4 +743,62 @@ public class GroupsDialog extends BaseDialogBean
|
||||
private String name;
|
||||
private String authority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple dynamic resolver class to return authority properties at runtime
|
||||
*/
|
||||
public class AuthorityPropertyResolver implements DynamicResolver
|
||||
{
|
||||
final private String authority;
|
||||
final private QName property;
|
||||
private String value = null;
|
||||
|
||||
AuthorityPropertyResolver(String authority, QName property)
|
||||
{
|
||||
this.authority = authority;
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (this.value == null)
|
||||
{
|
||||
NodeRef ref = getPersonService().getPerson(this.authority);
|
||||
this.value = (String)getNodeService().getProperty(ref, this.property);
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public class AuthorityNamePropertyResolver implements DynamicResolver
|
||||
{
|
||||
final private String authority;
|
||||
private String value = null;
|
||||
|
||||
AuthorityNamePropertyResolver(String authority)
|
||||
{
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (this.value == null)
|
||||
{
|
||||
NodeRef ref = getPersonService().getPerson(this.authority);
|
||||
String firstName = (String)getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME);
|
||||
|
||||
// build a sensible label for display
|
||||
StringBuilder label = new StringBuilder(48);
|
||||
label.append(firstName != null ? firstName : "")
|
||||
.append(' ')
|
||||
.append(lastName != null ? lastName : "");
|
||||
this.value = label.toString();
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
35
source/java/org/alfresco/web/data/DynamicResolver.java
Normal file
35
source/java/org/alfresco/web/data/DynamicResolver.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.web.data;
|
||||
|
||||
/**
|
||||
* Interface marker used to indicate that a property is resolved at runtime
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public interface DynamicResolver
|
||||
{
|
||||
|
||||
}
|
@@ -183,6 +183,10 @@ public abstract class Sort
|
||||
{
|
||||
this.comparator = new TimestampComparator();
|
||||
}
|
||||
else if (DynamicResolver.class.isAssignableFrom(returnType))
|
||||
{
|
||||
this.comparator = new SimpleStringComparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_logger.warn("Unsupported sort data type: " + returnType + " defaulting to .toString()");
|
||||
|
@@ -131,7 +131,7 @@
|
||||
|
||||
<a:richList id="users-list" binding="#{DialogManager.bean.usersRichList}" viewMode="#{DialogManager.bean.viewMode}" pageSize="12"
|
||||
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
|
||||
value="#{DialogManager.bean.users}" var="r" initialSortColumn="name" initialSortDescending="true">
|
||||
value="#{DialogManager.bean.users}" var="r" initialSortColumn="userName" initialSortDescending="true">
|
||||
|
||||
<%-- Primary column for icons view mode --%>
|
||||
<a:column primary="true" style="padding:2px;text-align:left;vertical-align:top;font-weight: bold;" rendered="#{DialogManager.bean.viewMode == 'icons'}">
|
||||
@@ -144,12 +144,20 @@
|
||||
<%-- Primary column for details view mode --%>
|
||||
<a:column primary="true" style="padding:2px;text-align:left;" rendered="#{DialogManager.bean.viewMode == 'details'}">
|
||||
<f:facet name="small-icon">
|
||||
<h:graphicImage alt="#{r.name}" value="/images/icons/person.gif" />
|
||||
<h:graphicImage alt="#{r.firstName}" value="/images/icons/person.gif" />
|
||||
</f:facet>
|
||||
<f:facet name="header">
|
||||
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
|
||||
<a:sortLink label="#{msg.first_name}" value="firstName" mode="case-insensitive" styleClass="header"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{r.name}" />
|
||||
<h:outputText value="#{r.firstName}" />
|
||||
</a:column>
|
||||
|
||||
<%-- Last name column --%>
|
||||
<a:column width="120" style="text-align:left" rendered="#{DialogManager.bean.viewMode == 'details'}">
|
||||
<f:facet name="header">
|
||||
<a:sortLink label="#{msg.last_name}" value="lastName" styleClass="header" />
|
||||
</f:facet>
|
||||
<h:outputText value="#{r.lastName}" />
|
||||
</a:column>
|
||||
|
||||
<%-- Username column --%>
|
||||
|
Reference in New Issue
Block a user