mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Fix for AWC-693 - Added evaluator so the user cannot try to Take Ownership of a locked item
. Fixes for AWC-640 and AWC-457 - Company Home, Guest Home and My Home links now disable/enable depending on the user permissions on the respective locations - Guest can now longer see Company Home link if they do not have access (which is the default) . Company/Home/Guest link toolbar no longer highlights the selected item (as it is not the only way to navigate to it) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2958 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -94,6 +94,7 @@ recent_spaces=Recent Spaces
|
||||
shortcuts=Shortcuts
|
||||
company_home=Company Home
|
||||
my_home=My Home
|
||||
guest_home=Guest Home
|
||||
new_search=New Search
|
||||
search_results=Search Results
|
||||
search_detail=Search for \"{0}\" results shown below
|
||||
|
@@ -381,6 +381,7 @@
|
||||
<permissions>
|
||||
<permission allow="true">TakeOwnership</permission>
|
||||
</permissions>
|
||||
<evaluator>org.alfresco.web.action.evaluator.TakeOwnershipDocEvaluator</evaluator>
|
||||
<label-id>take_ownership</label-id>
|
||||
<image>/images/icons/take_ownership.gif</image>
|
||||
<action-listener>#{DocumentDetailsBean.takeOwnership}</action-listener>
|
||||
|
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Take ownership of a document.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public final class TakeOwnershipDocEvaluator implements ActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
return (node.isLocked() == false);
|
||||
}
|
||||
}
|
@@ -72,6 +72,7 @@ public class Application
|
||||
private static String emailTemplatesFolderName;
|
||||
private static String savedSearchesFolderName;
|
||||
private static String scriptsFolderName;
|
||||
private static String guestHomeFolderName;
|
||||
|
||||
/**
|
||||
* Private constructor to prevent instantiation of this class
|
||||
@@ -380,7 +381,6 @@ public class Application
|
||||
return getSavedSearchesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Return the JavaScript scripts folder name
|
||||
*/
|
||||
@@ -397,6 +397,22 @@ public class Application
|
||||
return getScriptsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Return the Guest Home folder name
|
||||
*/
|
||||
public static String getGuestHomeFolderName(ServletContext context)
|
||||
{
|
||||
return getGuestHomeFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Return the Guest Home folder name
|
||||
*/
|
||||
public static String getGuestHomeFolderName(FacesContext context)
|
||||
{
|
||||
return getGuestHomeFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the language locale for the current user context
|
||||
*
|
||||
@@ -764,6 +780,24 @@ public class Application
|
||||
return scriptsFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Guest Home folder name name
|
||||
*
|
||||
* @param context The spring context
|
||||
* @return The Guest Home folder name
|
||||
*/
|
||||
private static String getGuestHomeFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (guestHomeFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
guestHomeFolderName = configuration.getProperty("spaces.guest_home.childname");
|
||||
}
|
||||
|
||||
return guestHomeFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configured error page for the application
|
||||
*
|
||||
|
@@ -484,6 +484,67 @@ public class NavigationBean
|
||||
return this.dispatchContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node representing the Company Home folder
|
||||
*/
|
||||
public Node getCompanyHomeNode()
|
||||
{
|
||||
if (this.companyHomeNode == null)
|
||||
{
|
||||
NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId());
|
||||
this.companyHomeNode = new Node(companyRootRef);
|
||||
}
|
||||
return this.companyHomeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node representing the Guest Home Space folder
|
||||
*/
|
||||
public Node getGuestHomeNode()
|
||||
{
|
||||
if (this.guestHomeNode == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
String xpath = Application.getRootPath(fc) + "/" + Application.getGuestHomeFolderName(fc);
|
||||
List<NodeRef> guestHomeRefs = this.searchService.selectNodes(
|
||||
this.nodeService.getRootNode(Repository.getStoreRef()),
|
||||
xpath, null, this.namespaceService, false);
|
||||
if (guestHomeRefs.size() == 1)
|
||||
{
|
||||
this.guestHomeNode = new Node(guestHomeRefs.get(0));
|
||||
}
|
||||
}
|
||||
catch (InvalidNodeRefException err1)
|
||||
{
|
||||
// cannot continue if this occurs
|
||||
}
|
||||
catch (AccessDeniedException err2)
|
||||
{
|
||||
// cannot see node if this occurs
|
||||
}
|
||||
}
|
||||
return this.guestHomeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the Company home node is accessable to the current user
|
||||
*/
|
||||
public boolean getCompanyHomeVisible()
|
||||
{
|
||||
return getCompanyHomeNode().hasPermission(PermissionService.READ);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the Guest home node is accessable to the current user
|
||||
*/
|
||||
public boolean getGuestHomeVisible()
|
||||
{
|
||||
Node guestHome = getGuestHomeNode();
|
||||
return guestHome != null && guestHome.hasPermission(PermissionService.READ);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Navigation action event handlers
|
||||
@@ -522,11 +583,10 @@ public class NavigationBean
|
||||
if (LOCATION_COMPANY.equals(location))
|
||||
{
|
||||
List<IBreadcrumbHandler> elements = new ArrayList<IBreadcrumbHandler>(1);
|
||||
NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId());
|
||||
String companySpaceName = Repository.getNameForNode(this.nodeService, companyRootRef);
|
||||
elements.add(new NavigationBreadcrumbHandler(companyRootRef, companySpaceName));
|
||||
Node companyHome = getCompanyHomeNode();
|
||||
elements.add(new NavigationBreadcrumbHandler(companyHome.getNodeRef(), companyHome.getName()));
|
||||
setLocation(elements);
|
||||
setCurrentNodeId(companyRootRef.getId());
|
||||
setCurrentNodeId(companyHome.getId());
|
||||
}
|
||||
else if (LOCATION_HOME.equals(location))
|
||||
{
|
||||
@@ -538,6 +598,14 @@ public class NavigationBean
|
||||
setLocation(elements);
|
||||
setCurrentNodeId(homeSpaceRef.getId());
|
||||
}
|
||||
else if (LOCATION_GUEST.equals(location))
|
||||
{
|
||||
List<IBreadcrumbHandler> elements = new ArrayList<IBreadcrumbHandler>(1);
|
||||
Node guestHome = getGuestHomeNode();
|
||||
elements.add(new NavigationBreadcrumbHandler(guestHome.getNodeRef(), guestHome.getName()));
|
||||
setLocation(elements);
|
||||
setCurrentNodeId(guestHome.getId());
|
||||
}
|
||||
|
||||
// we need to force a navigation to refresh the browse screen breadcrumb
|
||||
context.getApplication().getNavigationHandler().handleNavigation(context, null, "browse");
|
||||
@@ -665,6 +733,7 @@ public class NavigationBean
|
||||
/** constant values used by the toolbar location modelist control */
|
||||
private static final String LOCATION_COMPANY = "company";
|
||||
private static final String LOCATION_HOME = "home";
|
||||
private static final String LOCATION_GUEST = "guest";
|
||||
|
||||
private static final String ERROR_DELETED_FOLDER = "error_deleted_folder";
|
||||
|
||||
@@ -701,6 +770,12 @@ public class NavigationBean
|
||||
/** Node we are using for dispatching */
|
||||
private Node dispatchContext = null;
|
||||
|
||||
/** Node representing the guest home */
|
||||
private Node guestHomeNode = null;
|
||||
|
||||
/** Node representing the company home */
|
||||
private Node companyHomeNode = null;
|
||||
|
||||
/** Current toolbar location */
|
||||
private String toolbarLocation = LOCATION_HOME;
|
||||
|
||||
|
@@ -26,10 +26,11 @@
|
||||
<td width=100% style="background-image: url(<%=request.getContextPath()%>/images/parts/titlebar_bg.gif)">
|
||||
<%-- Toolbar --%>
|
||||
<a:modeList itemSpacing="3" iconColumnWidth="0" horizontal="true"
|
||||
itemStyleClass="topToolbar" itemLinkStyleClass="topToolbarLink" selectedStyleClass="topToolbarHighlight" selectedLinkStyleClass="topToolbarLinkHighlight"
|
||||
itemStyleClass="topToolbar" itemLinkStyleClass="topToolbarLink" selectedStyleClass="topToolbar" selectedLinkStyleClass="topToolbarLink"
|
||||
value="#{NavigationBean.toolbarLocation}" actionListener="#{NavigationBean.toolbarLocationChanged}">
|
||||
<a:listItem value="company" label="#{msg.company_home}" />
|
||||
<a:listItem value="company" label="#{msg.company_home}" rendered="#{NavigationBean.companyHomeVisible}" />
|
||||
<a:listItem value="home" label="#{msg.my_home}" />
|
||||
<a:listItem value="guest" label="#{msg.guest_home}" rendered="#{NavigationBean.isGuest == false && NavigationBean.guestHomeVisible}" />
|
||||
</a:modeList>
|
||||
</td>
|
||||
<td><img src="<%=request.getContextPath()%>/images/parts/titlebar_end.gif" width=8 height=30></td>
|
||||
|
Reference in New Issue
Block a user