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

META-INF.resources.user.user_groups.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 userGroups = (List)request.getAttribute("user.userGroups");

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






	






	

	
		

		
			
				<%= removeUserGroupIcon %>
			
		
	

	



	

	
		var Util = Liferay.Util;

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

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

		var addUserGroupIds = [];
		var deleteUserGroupIds = [];

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

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

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

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

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

					Util.toggleDisabled(selectButton, false);
				}

				searchContainer.deleteRow(tr, rowId);

				A.Array.removeItem(addUserGroupIds, rowId);

				deleteUserGroupIds.push(rowId);

				document.fm.addUserGroupIds.value = addUserGroupIds.join(',');
				document.fm.deleteUserGroupIds.value = deleteUserGroupIds.join(',');
			},
			'.modify-link'
		);

		Liferay.on(
			'enableRemovedUserGroups',
			function(event) {
				event.selectors.each(
					function(item, index, collection) {
						var userGroupId = item.attr('data-usergroupid');

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

		A.one('#openUserGroupsLink').on(
			'click',
			function(event) {
				Util.selectEntity(
					{
						dialog: {
							constrain: true,
							modal: true
						},
						id: 'selectUserGroup',
						title: '',

						
							
							
						

						uri: '<%= selectUserGroupURL.toString() %>'
					},
					function(event) {
						var A = AUI();

						var rowColumns = [];

						rowColumns.push(A.Escape.html(event.usergroupname));
						rowColumns.push('<%= UnicodeFormatter.toString(removeUserGroupIcon) %>');

						searchContainer.addRow(rowColumns, event.usergroupid);

						searchContainer.updateDataStore();

						A.Array.removeItem(deleteUserGroupIds, event.usergroupid);

						addUserGroupIds.push(event.usergroupid);

						document.fm.addUserGroupIds.value = addUserGroupIds.join(',');
						document.fm.deleteUserGroupIds.value = deleteUserGroupIds.join(',');
					}
				);
			}
		);
	




© 2015 - 2025 Weber Informatics LLC | Privacy Policy