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

META-INF.resources.user.organizations.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" %>

<%
User selUser = (User)request.getAttribute("user.selUser");

List organizations = (List)request.getAttribute("user.organizations");

String organizationIdsString = ParamUtil.getString(request, "organizationsSearchContainerPrimaryKeys");

currentURLObj.setParameter("historyKey", renderResponse.getNamespace() + "organizations");
%>






	






	

	
		

		

		<%
		List userGroupRoles = new ArrayList();
		int userGroupRolesCount = 0;

		if (selUser != null) {
			userGroupRoles = UserGroupRoleLocalServiceUtil.getUserGroupRoles(selUser.getUserId(), organization.getGroupId(), 0, PropsValues.USERS_ADMIN_ROLE_COLUMN_LIMIT);
			userGroupRolesCount = UserGroupRoleLocalServiceUtil.getUserGroupRolesCount(selUser.getUserId(), organization.getGroupId());
		}
		%>

		

		
			
				<%= removeOrganizationIcon %>
			
		
	

	



	

	
		var AArray = A.Array;
		var Util = Liferay.Util;

		var addOrganizationIds = [];

		var organizationValues = document.fm.addOrganizationIds.value;

		if (organizationValues) {
			addOrganizationIds.push(organizationValues);
		}

		var deleteOrganizationIds = [];

		var searchContainer = Liferay.SearchContainer.get('organizationsSearchContainer');

		var searchContainerContentBox = searchContainer.get('contentBox');

		searchContainerContentBox.delegate(
			'click',
			function(event) {
				var link = event.currentTarget;

				var rowId = link.attr('data-rowId');

				var tr = link.ancestor('tr');

				var selectOrganization = Util.getWindow('selectOrganization');

				if (selectOrganization) {
					var selectButton = selectOrganization.iframe.node.get('contentWindow.document').one('.selector-button[data-organizationid="' + rowId + '"]');

					Util.toggleDisabled(selectButton, false);
				}

				searchContainer.deleteRow(tr, rowId);

				AArray.removeItem(addOrganizationIds, rowId);

				deleteOrganizationIds.push(rowId);

				document.fm.addOrganizationIds.value = addOrganizationIds.join(',');
				document.fm.deleteOrganizationIds.value = deleteOrganizationIds.join(',');
			},
			'.modify-link'
		);

		Liferay.on(
			'enableRemovedOrganizations',
			function(event) {
				event.selectors.each(
					function(item, index, collection) {
						var organizationId = item.attr('data-organizationid');

						if (deleteOrganizationIds.indexOf(organizationId) != -1) {
							Util.toggleDisabled(item, false);
						}
					}
				);
			}
		);

		var selectOrganizationLink = A.one('#selectOrganizationLink');

		if (selectOrganizationLink) {
			selectOrganizationLink.on(
				'click',
				function(event) {
					Util.selectEntity(
						{
							dialog: {
								constrain: true,
								modal: true
							},
							id: 'selectOrganization',
							title: '',
							uri: ''
						},
						function(event) {
							var rowColumns = [];

							rowColumns.push(event.name);
							rowColumns.push(event.type);
							rowColumns.push('');
							rowColumns.push('<%= UnicodeFormatter.toString(removeOrganizationIcon) %>');

							searchContainer.addRow(rowColumns, event.organizationid);

							searchContainer.updateDataStore();

							AArray.removeItem(deleteOrganizationIds, event.organizationid);

							addOrganizationIds.push(event.organizationid);

							document.fm.addOrganizationIds.value = addOrganizationIds.join(',');
							document.fm.deleteOrganizationIds.value = deleteOrganizationIds.join(',');
						}
					);
				}
			);
		}
	




© 2015 - 2025 Weber Informatics LLC | Privacy Policy