
META-INF.resources.view_tree.jsp Maven / Gradle / Ivy
<%--
/**
* 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"));
Organization organization = (Organization)request.getAttribute("view.jsp-organization");
long organizationId = GetterUtil.getLong(request.getAttribute("view.jsp-organizationId"));
long organizationGroupId = GetterUtil.getLong(request.getAttribute("view.jsp-organizationGroupId"));
PortletURL portletURL = (PortletURL)request.getAttribute("view.jsp-portletURL");
int status = GetterUtil.getInteger(request.getAttribute("view.jsp-status"));
String toolbarItem = GetterUtil.getString(request.getAttribute("view.jsp-toolbarItem"));
int usersCount = GetterUtil.getInteger(request.getAttribute("view.jsp-usersCount"));
String usersListView = GetterUtil.getString(request.getAttribute("view.jsp-usersListView"));
String viewUsersRedirect = GetterUtil.getString(request.getAttribute("view.jsp-viewUsersRedirect"));
String keywords = ParamUtil.getString(request, "keywords");
if (organization != null) {
organizationGroupId = organization.getGroupId();
}
LinkedHashMap organizationParams = new LinkedHashMap();
List organizations = new ArrayList();
if (filterManageableOrganizations) {
organizations = user.getOrganizations(true);
}
if (organizationId != OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID) {
organizations.clear();
organizations.add(OrganizationLocalServiceUtil.getOrganization(organizationId));
}
boolean showList = true;
if (filterManageableOrganizations && organizations.isEmpty()) {
showList = false;
}
if (organization != null) {
UsersAdminUtil.addPortletBreadcrumbEntries(organization, request, renderResponse);
}
%>
<%
int organizationsCount = OrganizationLocalServiceUtil.searchCount(company.getCompanyId(), _getParentOrganizationId(request, organization, filterManageableOrganizations), null, null, null, null, organizationParams);
%>
<%
long parentOrganizationId = OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID;
if (!organization.isRoot()) {
Organization parentOrganization = organization.getParentOrganization();
if (OrganizationPermissionUtil.contains(permissionChecker, parentOrganization, ActionKeys.VIEW)) {
parentOrganizationId = parentOrganization.getOrganizationId();
}
}
%>
<%
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(Validator.isNotNull(backURL) ? backURL : headerBackURL.toString());
renderResponse.setTitle(organization.getName());
%>
<%
boolean showOrganizations = false;
boolean showUsers = true;
if ((organization == null) && Validator.isNull(keywords) && !PortalPermissionUtil.contains(permissionChecker, ActionKeys.ADD_USER) && !PortalPermissionUtil.contains(permissionChecker, ActionKeys.IMPERSONATE)) {
showOrganizations = true;
showUsers = false;
}
if (organizationsCount > 0) {
showOrganizations = true;
}
if ((status == WorkflowConstants.STATUS_APPROVED) && (usersCount == 0) && (inactiveUsersCount > 0)) {
status = WorkflowConstants.STATUS_INACTIVE;
}
else if ((status == WorkflowConstants.STATUS_INACTIVE) && (usersCount > 0) && (inactiveUsersCount == 0)) {
status = WorkflowConstants.STATUS_APPROVED;
}
if ((organization != null) && !OrganizationPermissionUtil.contains(permissionChecker, organization, ActionKeys.MANAGE_USERS)) {
inactiveUsersCount = 0;
status = WorkflowConstants.STATUS_APPROVED;
}
%>
<%
String organizationsTitle = null;
if (Validator.isNotNull(keywords)) {
organizationsTitle = LanguageUtil.get(request, "organizations");
}
else if (organization == null) {
organizationsTitle = LanguageUtil.get(request, filterManageableOrganizations ? "my-organizations" : "top-level-organizations");
}
else if (organizationsCount == 1) {
organizationsTitle = LanguageUtil.format(request, "x-suborganization", String.valueOf(organizationsCount), false);
}
else {
organizationsTitle = LanguageUtil.format(request, "x-suborganizations", String.valueOf(organizationsCount), false);
}
%>
<%= organizationsTitle %>
<%
SearchContainer searchContainer = new OrganizationSearch(renderRequest, "cur1", currentURLObj);
RowChecker rowChecker = new EmptyOnClickRowChecker(renderResponse);
rowChecker.setRowIds("rowIdsOrganization");
searchContainer.setRowChecker(rowChecker);
%>
<%
OrganizationSearchTerms searchTerms = (OrganizationSearchTerms)organizationSearchContainer.getSearchTerms();
long parentOrganizationId = _getParentOrganizationId(request, organization, filterManageableOrganizations);
if (organization != null) {
parentOrganizationId = organization.getOrganizationId();
}
List excludedOrganizationIds = new ArrayList();
excludedOrganizationIds.add(parentOrganizationId);
organizationParams.put("excludedOrganizationIds", excludedOrganizationIds);
%>
<%
total = organizations.size();
searchContainer.setTotal(total);
results = ListUtil.subList(organizations, searchContainer.getStart(), searchContainer.getEnd());
searchContainer.setResults(results);
%>
<%
if (searchTerms.hasSearchTerms()) {
if (filterManageableOrganizations) {
organizationParams.put("organizationsTree", organizations);
}
else if (parentOrganizationId > 0) {
List organizationsTree = new ArrayList();
Organization parentOrganization = OrganizationLocalServiceUtil.getOrganization(parentOrganizationId);
organizationsTree.add(parentOrganization);
organizationParams.put("organizationsTree", organizationsTree);
}
parentOrganizationId = OrganizationConstants.ANY_PARENT_ORGANIZATION_ID;
}
%>
<%
List results = searchContainer.getResults();
%>
<%
if (!OrganizationPermissionUtil.contains(permissionChecker, curOrganization, ActionKeys.VIEW)) {
rowURL = null;
}
%>
<%@ include file="/organization/organization_columns.jspf" %>
<%
boolean active = false;
if (status == WorkflowConstants.STATUS_APPROVED) {
active = true;
}
String usersTitle = null;
if (Validator.isNotNull(keywords) || ((organization == null) && (organizationsCount == 0))) {
usersTitle = LanguageUtil.get(request, (active ? "users" : "inactive-users"));
}
else if (organization == null) {
usersTitle = LanguageUtil.get(request, (active ? "users-without-an-organization" : "inactive-users-without-an-organization"));
}
else if ((usersCount == 0) && (inactiveUsersCount == 0)) {
usersTitle = LanguageUtil.format(request, (active ? "x-users" : "x-inactive-users"), "0");
}
else {
if ((active && (usersCount == 1)) || (!active && (inactiveUsersCount == 1))) {
usersTitle = LanguageUtil.format(request, (active ? "x-user" : "x-inactive-user"), String.valueOf((active ? usersCount : inactiveUsersCount)), false);
}
else {
usersTitle = LanguageUtil.format(request, (active ? "x-users" : "x-inactive-users"), String.valueOf((active ? usersCount : inactiveUsersCount)), false);
}
}
%>
<%= usersTitle %>
<%
boolean organizationContextView = true;
%>
<%@ include file="/add_menu.jspf" %>
Liferay.Util.toggleSearchContainerButton('# delete', '# <%= searchContainerReference.getId(request, "organizationSearchContainer") %>SearchContainer', document. fm, ' allRowIds');
<%!
private long _getParentOrganizationId(HttpServletRequest request, Organization organization, boolean filterManageableOrganizations) {
if (organization != null) {
return organization.getOrganizationId();
}
if (filterManageableOrganizations) {
return OrganizationConstants.ANY_PARENT_ORGANIZATION_ID;
}
return ParamUtil.getLong(request, "parentOrganizationId", OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID);
}
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy