annotate rhodecode/templates/admin/repos/repo_edit_perms.html @ 1602:1915f02f6d62 beta

Ui fixes for tables
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 26 Oct 2011 20:14:38 +0200
parents 9a7d0fbc4a80
children b702d0d4b030
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1602
1915f02f6d62 Ui fixes for tables
Marcin Kuzminski <marcin@python-works.com>
parents: 1455
diff changeset
1 <table id="permissions_manage" class="noborder">
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 <td>${_('none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 <td>${_('read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 <td>${_('write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 <td>${_('admin')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <td>${_('member')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 <td></td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 </tr>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
10 ## USERS
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 %for r2p in c.repo_info.repo_to_perm:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 %if r2p.user.username =='default' and c.repo_info.private:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 <td colspan="4">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 <span class="private_repo_msg">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 ${_('private repository')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 </td>
1051
90eadff2c2a8 changed all urls for IMAGES files to use pylons url function
Marcin Kuzminski <marcin@python-works.com>
parents: 1015
diff changeset
19 <td class="private_repo_msg"><img style="vertical-align:bottom" src="${h.url("/images/icons/user.png")}"/>${r2p.user.username}</td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 %else:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 <tr id="id${id(r2p.user.username)}">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
27 <td style="white-space: nowrap;">
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
28 <img style="vertical-align:bottom" src="${h.url('/images/icons/user.png')}"/>${r2p.user.username}
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
29 </td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 <td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 %if r2p.user.username !='default':
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 <span class="delete_icon action_button" onclick="ajaxActionUser(${r2p.user.user_id},'${'id%s'%id(r2p.user.username)}')">
1378
832399a4a45c fixes issue #203, added revoke message
Marcin Kuzminski <marcin@python-works.com>
parents: 1051
diff changeset
33 ${_('revoke')}
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 %endif
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 %endif
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 %endfor
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
41 ## USERS GROUPS
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 %for g2p in c.repo_info.users_group_to_perm:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 <tr id="id${id(g2p.users_group.users_group_name)}">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
48 <td style="white-space: nowrap;">
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
49 <img style="vertical-align:bottom" src="${h.url('/images/icons/group.png')}"/>${g2p.users_group.users_group_name}
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
50 </td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
51 <td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52 <span class="delete_icon action_button" onclick="ajaxActionUsersGroup(${g2p.users_group.users_group_id},'${'id%s'%id(g2p.users_group.users_group_name)}')">
1378
832399a4a45c fixes issue #203, added revoke message
Marcin Kuzminski <marcin@python-works.com>
parents: 1051
diff changeset
53 ${_('revoke')}
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57 %endfor
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 <tr id="add_perm_input">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 <td>${h.radio('perm_new_member','repository.none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 <td>${h.radio('perm_new_member','repository.read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 <td>${h.radio('perm_new_member','repository.write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 <td>${h.radio('perm_new_member','repository.admin')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 <td class='ac'>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 <div class="perm_ac" id="perm_ac">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 ${h.text('perm_new_member_name',class_='yui-ac-input')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66 ${h.hidden('perm_new_member_type')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67 <div id="perm_container"></div>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
68 </div>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
69 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
70 <td></td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
71 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 <td colspan="6">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 <span id="add_perm" class="add_icon" style="cursor: pointer;">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 ${_('Add another member')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
76 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 </tr>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
79 </table>
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
80 <script type="text/javascript">
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
81 function ajaxActionUser(user_id, field_id) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
82 var sUrl = "${h.url('delete_repo_user',repo_name=c.repo_name)}";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
83 var callback = {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
84 success: function (o) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
85 var tr = YUD.get(String(field_id));
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
86 tr.parentNode.removeChild(tr);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
87 },
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
88 failure: function (o) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
89 alert("${_('Failed to remove user')}");
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
90 },
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
91 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
92 var postData = '_method=delete&user_id=' + user_id;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
93 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
94 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
95
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
96 function ajaxActionUsersGroup(users_group_id,field_id){
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
97 var sUrl = "${h.url('delete_repo_users_group',repo_name=c.repo_name)}";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
98 var callback = {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
99 success:function(o){
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
100 var tr = YUD.get(String(field_id));
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
101 tr.parentNode.removeChild(tr);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
102 },
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
103 failure:function(o){
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
104 alert("${_('Failed to remove users group')}");
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
105 },
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
106 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
107 var postData = '_method=delete&users_group_id='+users_group_id;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
108 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
109 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
110
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
111 YUE.onDOMReady(function () {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
112 if (!YUD.hasClass('perm_new_member_name', 'error')) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
113 YUD.setStyle('add_perm_input', 'display', 'none');
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
114 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
115 YAHOO.util.Event.addListener('add_perm', 'click', function () {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
116 YUD.setStyle('add_perm_input', 'display', '');
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
117 YUD.setStyle('add_perm', 'opacity', '0.6');
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
118 YUD.setStyle('add_perm', 'cursor', 'default');
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
119 });
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
120 });
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
121
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
122 YAHOO.example.FnMultipleFields = function () {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
123 var myUsers = ${c.users_array|n};
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
124 var myGroups = ${c.users_groups_array|n};
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
125
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
126 // Define a custom search function for the DataSource of users
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
127 var matchUsers = function (sQuery) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
128 // Case insensitive matching
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
129 var query = sQuery.toLowerCase();
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
130 var i = 0;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
131 var l = myUsers.length;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
132 var matches = [];
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
133
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
134 // Match against each name of each contact
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
135 for (; i < l; i++) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
136 contact = myUsers[i];
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
137 if ((contact.fname.toLowerCase().indexOf(query) > -1) || (contact.lname.toLowerCase().indexOf(query) > -1) || (contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
138 matches[matches.length] = contact;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
139 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
140 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
141 return matches;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
142 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
143
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
144 // Define a custom search function for the DataSource of usersGroups
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
145 var matchGroups = function (sQuery) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
146 // Case insensitive matching
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
147 var query = sQuery.toLowerCase();
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
148 var i = 0;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
149 var l = myGroups.length;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
150 var matches = [];
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
151
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
152 // Match against each name of each contact
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
153 for (; i < l; i++) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
154 matched_group = myGroups[i];
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
155 if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
156 matches[matches.length] = matched_group;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
157 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
158 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
159 return matches;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
160 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
161
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
162 //match all
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
163 var matchAll = function (sQuery) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
164 u = matchUsers(sQuery);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
165 g = matchGroups(sQuery);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
166 return u.concat(g);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
167 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
168
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
169 // DataScheme for members
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
170 var memberDS = new YAHOO.util.FunctionDataSource(matchAll);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
171 memberDS.responseSchema = {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
172 fields: ["id", "fname", "lname", "nname", "grname", "grmembers"]
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
173 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
174
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
175 // DataScheme for owner
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
176 var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
177 ownerDS.responseSchema = {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
178 fields: ["id", "fname", "lname", "nname"]
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
179 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
180
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
181 // Instantiate AutoComplete for perms
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
182 var membersAC = new YAHOO.widget.AutoComplete("perm_new_member_name", "perm_container", memberDS);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
183 membersAC.useShadow = false;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
184 membersAC.resultTypeList = false;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
185
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
186 // Instantiate AutoComplete for owner
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
187 var ownerAC = new YAHOO.widget.AutoComplete("user", "owner_container", ownerDS);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
188 ownerAC.useShadow = false;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
189 ownerAC.resultTypeList = false;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
190
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
191
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
192 // Helper highlight function for the formatter
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
193 var highlightMatch = function (full, snippet, matchindex) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
194 return full.substring(0, matchindex) + "<span class='match'>" + full.substr(matchindex, snippet.length) + "</span>" + full.substring(matchindex + snippet.length);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
195 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
196
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
197 // Custom formatter to highlight the matching letters
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
198 var custom_formatter = function (oResultData, sQuery, sResultMatch) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
199 var query = sQuery.toLowerCase();
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
200
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
201 if (oResultData.grname != undefined) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
202 var grname = oResultData.grname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
203 var grmembers = oResultData.grmembers;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
204 var grnameMatchIndex = grname.toLowerCase().indexOf(query);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
205 var grprefix = "${_('Group')}: ";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
206 var grsuffix = " (" + grmembers + " ${_('members')})";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
207
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
208 if (grnameMatchIndex > -1) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
209 return grprefix + highlightMatch(grname, query, grnameMatchIndex) + grsuffix;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
210 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
211
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
212 return grprefix + oResultData.grname + grsuffix;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
213 } else if (oResultData.fname != undefined) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
214
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
215 var fname = oResultData.fname,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
216 lname = oResultData.lname,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
217 nname = oResultData.nname || "",
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
218 // Guard against null value
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
219 fnameMatchIndex = fname.toLowerCase().indexOf(query),
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
220 lnameMatchIndex = lname.toLowerCase().indexOf(query),
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
221 nnameMatchIndex = nname.toLowerCase().indexOf(query),
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
222 displayfname, displaylname, displaynname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
223
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
224 if (fnameMatchIndex > -1) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
225 displayfname = highlightMatch(fname, query, fnameMatchIndex);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
226 } else {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
227 displayfname = fname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
228 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
229
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
230 if (lnameMatchIndex > -1) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
231 displaylname = highlightMatch(lname, query, lnameMatchIndex);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
232 } else {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
233 displaylname = lname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
234 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
235
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
236 if (nnameMatchIndex > -1) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
237 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
238 } else {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
239 displaynname = nname ? "(" + nname + ")" : "";
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
240 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
241
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
242 return displayfname + " " + displaylname + " " + displaynname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
243 } else {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
244 return '';
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
245 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
246 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
247 membersAC.formatResult = custom_formatter;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
248 ownerAC.formatResult = custom_formatter;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
249
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
250 var myHandler = function (sType, aArgs) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
251
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
252 var myAC = aArgs[0]; // reference back to the AC instance
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
253 var elLI = aArgs[1]; // reference to the selected LI element
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
254 var oData = aArgs[2]; // object literal of selected item's result data
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
255 //fill the autocomplete with value
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
256 if (oData.nname != undefined) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
257 //users
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
258 myAC.getInputEl().value = oData.nname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
259 YUD.get('perm_new_member_type').value = 'user';
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
260 } else {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
261 //groups
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
262 myAC.getInputEl().value = oData.grname;
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
263 YUD.get('perm_new_member_type').value = 'users_group';
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
264 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
265
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
266 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
267
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
268 membersAC.itemSelectEvent.subscribe(myHandler);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
269 if(ownerAC.itemSelectEvent){
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
270 ownerAC.itemSelectEvent.subscribe(myHandler);
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
271 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
272
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
273 return {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
274 memberDS: memberDS,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
275 ownerDS: ownerDS,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
276 membersAC: membersAC,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
277 ownerAC: ownerAC,
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
278 };
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
279 }();
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
280
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
281 </script>