annotate pylons_app/templates/admin/repos/repo_edit.html @ 298:15e96b5a2685

autocomplete for repository managment of users
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 26 Jun 2010 18:42:13 +0200
parents 29370bb76fa6
children d303aacb3349
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
1 ## -*- coding: utf-8 -*-
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
2 <%inherit file="/base/base.html"/>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
3
48
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
4 <%def name="title()">
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
5 ${_('Repositories administration')}
48
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
6 </%def>
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
7 <%def name="breadcrumbs()">
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
8 ${h.link_to(u'Admin',h.url('admin_home'))}
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
9 /
230
d982ed8e32d8 Admin templating updates, added rest permission controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 220
diff changeset
10 ${_('Repos')}
48
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
11 </%def>
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
12 <%def name="page_nav()">
182
11e8eb5a92e3 new way of menu generation for base, and all admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 174
diff changeset
13 ${self.menu('admin')}
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
14 ${self.submenu('repos')}
48
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
15 </%def>
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
16 <%def name="main()">
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
17 <div>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
18 <h2>${_('Repositories')} - ${_('edit')}</h2>
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
19 ${h.form(url('repo', id=c.repo_info.repo_name),method='put')}
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
20 <table>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
21 <tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
22 <td>${_('Name')}</td>
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
23 <td>${h.text('repo_name')}</td>
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
24 <td>${self.get_form_error('repo_name')}</td>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
25 </tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
26 <tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
27 <td>${_('Description')}</td>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
28 <td>${h.textarea('description',cols=23,rows=5)}</td>
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
29 <td>${self.get_form_error('description')}</td>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
30 </tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
31 <tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
32 <td>${_('Private')}</td>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
33 <td>${h.checkbox('private')}</td>
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
34 <td>${self.get_form_error('private')}</td>
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
35 </tr>
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
36 <tr>
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
37 <td>${_('Owner')}</td>
298
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
38 <td class='ac'>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
39 <div id="perm_ac">
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
40 ${h.text('user',class_='yui-ac-input')}
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
41 <div id="owner_container"></div>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
42 </div>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
43 </td>
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 230
diff changeset
44 <td>${self.get_form_error('user')}</td>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
45 </tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
46 <tr>
296
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
47 <td>${_('Permissions')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
48 <td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
49 <table>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
50 <tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
51 <td>${_('none')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
52 <td>${_('read')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
53 <td>${_('write')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
54 <td>${_('admin')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
55 <td>${_('user')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
56 </tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
57
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
58 %for r2p in c.repo_info.repo2perm:
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
59 <tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
60 <td>${h.radio('perm_%s' % r2p.user.username,'repository.none')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
61 <td>${h.radio('perm_%s' % r2p.user.username,'repository.read')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
62 <td>${h.radio('perm_%s' % r2p.user.username,'repository.write')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
63 <td>${h.radio('perm_%s' % r2p.user.username,'repository.admin')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
64 <td>${r2p.user.username}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
65 </tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
66 %endfor
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
67 <%
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
68 if not hasattr(c,'form_errors'):
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
69 d = 'display:none;'
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
70 else:
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
71 d=''
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
72 %>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
73
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
74 <tr id="add_perm_input" style="${d}">
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
75 <td>${h.radio('perm_new_user','repository.none')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
76 <td>${h.radio('perm_new_user','repository.read')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
77 <td>${h.radio('perm_new_user','repository.write')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
78 <td>${h.radio('perm_new_user','repository.admin')}</td>
298
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
79 <td class='ac'>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
80 <div id="perm_ac">
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
81 ${h.text('perm_new_user_name',class_='yui-ac-input')}
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
82 <div id="perm_container"></div>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
83 </div>
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
84 </td>
296
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
85 <td>${self.get_form_error('perm_new_user_name')}</td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
86 </tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
87 <tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
88 <td colspan="4">
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
89 <span id="add_perm" class="add_icon" style="cursor: pointer;">
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
90 ${_('Add another user')}
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
91 </span>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
92 </td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
93 </tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
94 </table>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
95 </td>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
96
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
97 </tr>
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
98 <tr>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
99 <td></td>
220
e6c802a8dede repo edit
Marcin Kuzminski <marcin@python-works.com>
parents: 216
diff changeset
100 <td>${h.submit('update','update')}</td>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
101 </tr>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
102
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
103 </table>
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
104 ${h.end_form()}
296
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
105 <script type="text/javascript">
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
106 YAHOO.util.Event.onDOMReady(function(){
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
107 var D = YAHOO.util.Dom;
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
108 YAHOO.util.Event.addListener('add_perm','click',function(){
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
109 D.setStyle('add_perm_input','display','');
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
110 D.setStyle('add_perm','opacity','0.6');
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
111 D.setStyle('add_perm','cursor','default');
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
112 });
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
113 });
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
114 </script>
298
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
115 <script type="text/javascript">
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
116 YAHOO.example.FnMultipleFields = function(){
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
117 var myContacts = ${c.users_array|n}
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
118
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
119 // Define a custom search function for the DataSource
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
120 var matchNames = function(sQuery) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
121 // Case insensitive matching
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
122 var query = sQuery.toLowerCase(),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
123 contact,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
124 i=0,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
125 l=myContacts.length,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
126 matches = [];
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
127
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
128 // Match against each name of each contact
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
129 for(; i<l; i++) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
130 contact = myContacts[i];
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
131 if((contact.fname.toLowerCase().indexOf(query) > -1) ||
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
132 (contact.lname.toLowerCase().indexOf(query) > -1) ||
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
133 (contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
134 matches[matches.length] = contact;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
135 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
136 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
137
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
138 return matches;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
139 };
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
140
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
141 // Use a FunctionDataSource
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
142 var oDS = new YAHOO.util.FunctionDataSource(matchNames);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
143 oDS.responseSchema = {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
144 fields: ["id", "fname", "lname", "nname"]
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
145 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
146
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
147 // Instantiate AutoComplete for perms
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
148 var oAC_perms = new YAHOO.widget.AutoComplete("perm_new_user_name", "perm_container", oDS);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
149 oAC_perms.useShadow = false;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
150 oAC_perms.resultTypeList = false;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
151
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
152 // Instantiate AutoComplete for owner
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
153 var oAC_owner = new YAHOO.widget.AutoComplete("user", "owner_container", oDS);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
154 oAC_owner.useShadow = false;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
155 oAC_owner.resultTypeList = false;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
156
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
157
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
158 // Custom formatter to highlight the matching letters
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
159 var custom_formatter = function(oResultData, sQuery, sResultMatch) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
160 var query = sQuery.toLowerCase(),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
161 fname = oResultData.fname,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
162 lname = oResultData.lname,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
163 nname = oResultData.nname || "", // Guard against null value
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
164 query = sQuery.toLowerCase(),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
165 fnameMatchIndex = fname.toLowerCase().indexOf(query),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
166 lnameMatchIndex = lname.toLowerCase().indexOf(query),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
167 nnameMatchIndex = nname.toLowerCase().indexOf(query),
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
168 displayfname, displaylname, displaynname;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
169
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
170 if(fnameMatchIndex > -1) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
171 displayfname = highlightMatch(fname, query, fnameMatchIndex);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
172 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
173 else {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
174 displayfname = fname;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
175 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
176
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
177 if(lnameMatchIndex > -1) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
178 displaylname = highlightMatch(lname, query, lnameMatchIndex);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
179 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
180 else {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
181 displaylname = lname;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
182 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
183
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
184 if(nnameMatchIndex > -1) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
185 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")";
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
186 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
187 else {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
188 displaynname = nname ? "(" + nname + ")" : "";
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
189 }
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
190
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
191 return displayfname + " " + displaylname + " " + displaynname;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
192
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
193 };
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
194 oAC_perms.formatResult = custom_formatter;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
195 oAC_owner.formatResult = custom_formatter;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
196
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
197 // Helper function for the formatter
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
198 var highlightMatch = function(full, snippet, matchindex) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
199 return full.substring(0, matchindex) +
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
200 "<span class='match'>" +
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
201 full.substr(matchindex, snippet.length) +
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
202 "</span>" +
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
203 full.substring(matchindex + snippet.length);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
204 };
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
205
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
206 var myHandler = function(sType, aArgs) {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
207 var myAC = aArgs[0]; // reference back to the AC instance
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
208 var elLI = aArgs[1]; // reference to the selected LI element
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
209 var oData = aArgs[2]; // object literal of selected item's result data
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
210 myAC.getInputEl().value = oData.nname;
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
211 };
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
212
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
213 oAC_perms.itemSelectEvent.subscribe(myHandler);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
214 oAC_owner.itemSelectEvent.subscribe(myHandler);
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
215
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
216 return {
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
217 oDS: oDS,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
218 oAC_perms: oAC_perms,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
219 oAC_owner: oAC_owner,
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
220 };
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
221 }();
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
222
15e96b5a2685 autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents: 296
diff changeset
223 </script>
48
8e250e86a670 Css fixes, implemented removal of users, and display draft
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
224 </div>
216
c8162373f214 Cleaned the way based was used to generate submenu for admin, now it's much more clear to use submenu. Cleaned admin and added comment to middleware
Marcin Kuzminski <marcin@python-works.com>
parents: 182
diff changeset
225 </%def>