All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.view_flat_users.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.6
Show newest version
<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library 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 Lesser General Public License for more
 * details.
 */
--%>

<%@ include file="/init.jsp" %>

<%
String backURL = GetterUtil.getString(request.getAttribute("view.jsp-backURL"));
int inactiveUsersCount = GetterUtil.getInteger(request.getAttribute("view.jsp-inactiveUsersCount"));
PortletURL portletURL = (PortletURL)request.getAttribute("view.jsp-portletURL");
int status = GetterUtil.getInteger(request.getAttribute("view.jsp-status"));
String usersListView = GetterUtil.getString(request.getAttribute("view.jsp-usersListView"));
String viewUsersRedirect = GetterUtil.getString(request.getAttribute("view.jsp-viewUsersRedirect"));

SearchContainer searchContainer = new UserSearch(renderRequest, "cur2", currentURLObj);

UserSearchTerms searchTerms = (UserSearchTerms)searchContainer.getSearchTerms();

boolean hasAddUserPermission = PortalPermissionUtil.contains(permissionChecker, ActionKeys.ADD_USER);

if (!searchTerms.isSearch() && hasAddUserPermission) {
	searchContainer.setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
}

RowChecker rowChecker = new EmptyOnClickRowChecker(renderResponse);

rowChecker.setRowIds("rowIdsUser");

searchContainer.setRowChecker(rowChecker);

if (!ParamUtil.getBoolean(renderRequest, "advancedSearch")) {
	currentURLObj.setParameter("status", String.valueOf(status));
}

String displayStyle = ParamUtil.getString(request, "displayStyle", "list");
String navigation = ParamUtil.getString(request, "navigation", "active");
String toolbarItem = ParamUtil.getString(request, "toolbarItem", "view-all-users");

if (navigation.equals("active")) {
	status = WorkflowConstants.STATUS_APPROVED;
	searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
else if (navigation.equals("inactive")) {
	status = WorkflowConstants.STATUS_INACTIVE;
	searchTerms.setStatus(WorkflowConstants.STATUS_INACTIVE);
}

portletURL.setParameter("navigation", navigation);
portletURL.setParameter("status", String.valueOf(status));

boolean showDeleteButton = (searchTerms.getStatus() != WorkflowConstants.STATUS_ANY) && (searchTerms.isActive() || (!searchTerms.isActive() && PropsValues.USERS_DELETE));
boolean showRestoreButton = (searchTerms.getStatus() != WorkflowConstants.STATUS_ANY) && !searchTerms.isActive();
%>


	
		

		
	

	
		
	

	
		

			<%
			String taglibOnClick = "javascript:" + renderResponse.getNamespace() + "deleteUsers('" + Constants.RESTORE + "');";
			%>

			
		

		

			<%
			String taglibOnClick = "javascript:" + renderResponse.getNamespace() + "deleteUsers('" + (searchTerms.isActive() ? Constants.DEACTIVATE : Constants.DELETE) + "');";
			%>

			
		
	



	
	
	
	

	
		
	

	
		
		
		

		<%
		if ((searchTerms.getOrganizationId() > 0) && !OrganizationPermissionUtil.contains(permissionChecker, searchTerms.getOrganizationId(), ActionKeys.MANAGE_USERS)) {
			inactiveUsersCount = 0;

			status = WorkflowConstants.STATUS_APPROVED;
		}

		UserDisplayTerms displayTerms = (UserDisplayTerms)userSearchContainer.getDisplayTerms();

		if (!searchTerms.isAdvancedSearch()) {
			if (status == WorkflowConstants.STATUS_APPROVED) {
				displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
				searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
			}
			else {
				displayTerms.setStatus(WorkflowConstants.STATUS_INACTIVE);
				searchTerms.setStatus(WorkflowConstants.STATUS_INACTIVE);
			}
		}

		long userOrganizationId = searchTerms.getOrganizationId();
		long roleId = searchTerms.getRoleId();
		long userGroupId = searchTerms.getUserGroupId();

		Organization userOrganization = null;

		if (userOrganizationId > 0) {
			try {
				userOrganization = OrganizationLocalServiceUtil.getOrganization(userOrganizationId);

				userSearchContainer.setEmptyResultsMessage("this-organization-does-not-have-any-users");
			}
			catch (NoSuchOrganizationException nsoe) {
			}
		}

		Role role = null;

		if (roleId > 0) {
			try {
				role = RoleLocalServiceUtil.getRole(roleId);
			}
			catch (NoSuchRoleException nsre) {
			}
		}

		UserGroup userGroup = null;

		if (userGroupId > 0) {
			try {
				userGroup = UserGroupLocalServiceUtil.getUserGroup(userGroupId);
			}
			catch (NoSuchUserGroupException nsuge) {
			}
		}

		if (role != null) {
			PortalUtil.addPortletBreadcrumbEntry(request, role.getName(), null);
			PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "all-users"), currentURL);
		}

		if (userGroup != null) {
			PortalUtil.addPortletBreadcrumbEntry(request, userGroup.getName(), null);
			PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "all-users"), currentURL);
		}
		%>

		

			<%
			if (userOrganization != null) {
				UsersAdminUtil.addPortletBreadcrumbEntries(userOrganization, request, renderResponse);

				PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "all-users"), currentURL);
			}
			%>

			
				
			
		

		
			

			

				<%
				portletDisplay.setShowBackIcon(true);
				portletDisplay.setURLBack(backURL);

				renderResponse.setTitle(userOrganization.getName());
				%>

			
		

		
			

			<%
			portletDisplay.setShowBackIcon(true);
			portletDisplay.setURLBack(backURL);

			renderResponse.setTitle(role.getTitle(locale));
			%>

		

		
			

			<%
			portletDisplay.setShowBackIcon(true);
			portletDisplay.setURLBack(backURL);

			renderResponse.setTitle(userGroup.getName());
			%>

		

		<%
		LinkedHashMap userParams = new LinkedHashMap();

		if (userOrganizationId > 0) {
			userParams.put("usersOrgs", Long.valueOf(userOrganizationId));
		}
		else if (usersListView.equals(UserConstants.LIST_VIEW_TREE) && Validator.isNull(searchTerms.getKeywords())) {
			userParams.put("noOrganizations", Boolean.TRUE);
			userParams.put("usersOrgsCount", 0);
		}
		else {
			if (filterManageableOrganizations && !UserPermissionUtil.contains(permissionChecker, ResourceConstants.PRIMKEY_DNE, ActionKeys.VIEW)) {
				long[] organizationIds = user.getOrganizationIds();

				if (ArrayUtil.isEmpty(organizationIds)) {
					organizationIds = new long[] {0};
				}

				userParams.put("usersOrgs", ArrayUtil.toLongArray(organizationIds));
			}
		}

		if (roleId > 0) {
			userParams.put("usersRoles", Long.valueOf(roleId));
		}

		if (userGroupId > 0) {
			userParams.put("usersUserGroups", Long.valueOf(userGroupId));
		}
		%>

		

		
			
				
				
				
			

			<%
			if (!UserPermissionUtil.contains(permissionChecker, user2.getUserId(), ActionKeys.UPDATE)) {
				rowURL = null;
			}

			boolean organizationContextView = false;
			long organizationGroupId = 0;
			%>

			<%@ include file="/user/search_columns.jspf" %>

			
		

		<%
		List results = searchContainer.getResults();

		showDeleteButton = !results.isEmpty() && showDeleteButton;
		showRestoreButton = !results.isEmpty() && showRestoreButton;
		%>

		<%
		if (!showDeleteButton && !showRestoreButton) {
			userSearchContainer.setRowChecker(null);
		}
		%>

		
	



	
		
			
			
		

		
			
			
		

		
	



	Liferay.Util.toggleSearchContainerButton('#deactivate', '#<%= searchContainerReference.getId(request, "userSearchContainer") %>SearchContainer', document.fm, 'allRowIds');
	Liferay.Util.toggleSearchContainerButton('#restore', '#<%= searchContainerReference.getId(request, "userSearchContainer") %>SearchContainer', document.fm, 'allRowIds');




© 2015 - 2025 Weber Informatics LLC | Privacy Policy