Mise en commentaire d'un code non générique.
[Plinn.git] / skins / generic / gruf_macros.pt
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3 <html xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/master">
4
5 <head>
6 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7 <title>GRUF Macros</title>
8 <link href="../content/plinn_style.css" rel="stylesheet" media="screen" />
9 <link href="../patch_skins/zpt_stylesheet.css" rel="stylesheet" media="screen">
10 </head>
11
12 <body tal:omit-tag="" metal:fill-slot="main" i18n:domain="plinn">
13 <pre>gruf_tree</pre>
14 <hr />
15 <table tal:define="treeDict here/makeGrufTree ;
16 tree treeDict/tree ;
17 rows treeDict/rows ;
18 rootNode python:rows.pop(0) ;
19 height tree/height ;
20 gtool here/portal_groups ;
21 group_prefix here/acl_users/getGroupPrefix ;
22 prefixLength python:len(group_prefix);
23 u0 request/URL0" metal:define-macro="gruf_tree">
24 <tr>
25 <th colspan="3" tal:attributes="colspan height" nowrap="nowrap" i18n:translate="">Group Tree</th>
26 </tr>
27 <tr tal:repeat="row rows">
28 <td colspan="1" tal:attributes="colspan indent" tal:define="indent python: row.depth - 1" tal:condition="indent">
29 <br />
30 </td>
31 <td tal:define="state row/state ; rlink row/branch ; msg python:state > 0 and 'collapse' or 'expand'" width="16">
32 <a href="#" tal:attributes="name row/id ; href string:$u0${rlink/link}; title msg" tal:condition="state" i18n:attributes="title"><img src="pl.gif" alt="" tal:attributes="src python:state > 0 and '/p_/mi' or '/p_/pl' ; alt msg" border="0" i18n:attributes="alt" /></a><span tal:condition="not:state" tal:omit-tag="">  </span>
33 </td>
34 <td colspan="1" tal:attributes="colspan python: height - row.depth" tal:define="object row/object ; group python:gtool.getGroupById(object.id)" nowrap="nowrap">
35 <a href="." tal:attributes="href string:${template_url}?group=${object/id}"><img src="GRUFGroups.gif" alt="Group id" tal:attributes="src here/GRUFGroups.gif/absolute_url ; alt object/id" border="0" /><span tal:replace="python:group.title or group.id[prefixLength:]">group</span></a>
36 </td>
37 </tr>
38 </table>
39 <pre>change_group_data</pre>
40 <hr />
41 <form action="change_group" method="post" tal:attributes="action string:${portal_url}/change_group" metal:define-macro="change_group_data">
42 <table class="TwoColumnForm" cellspacing="0" tal:define="wGroup python:here.portal_groups.getGroupById(requestedGroup) ;
43 sharedFolderUrl python:here.portal_groups.getGroupareaURL(id = requestedGroup)">
44 <tr>
45 <th i18n:translate="">Identifier</th>
46 <td>
47 <span tal:replace="requestedGroup">Group Name</span><input type="hidden" name="groupId" value="group" tal:attributes="value requestedGroup" />
48 </td>
49 </tr>
50 <tr>
51 <th i18n:translate="">Title</th>
52 <td>
53 <input type="text" name="title" size="51" tal:attributes="value wGroup/title" />
54 </td>
55 </tr>
56 <tr>
57 <th i18n:translate="">Description</th>
58 <td>
59 <textarea id="textareaName" name="description" rows="3" cols="38" tal:content="wGroup/description"></textarea>
60 </td>
61 </tr>
62 <tr tal:define="creationFlag here/portal_groups/getGroupWorkspacesCreationFlag" tal:condition="creationFlag | sharedFolderUrl">
63 <th i18n:translate="">Shared folder</th>
64 <td>
65 <div tal:condition="sharedFolderUrl">
66 <a href="." tal:attributes="href python:sharedFolderUrl+'/folder_contents'" i18n:translate="">Open shared folder...</a>
67 </div>
68 <div tal:condition="not:sharedFolderUrl">
69 <label><input type="checkbox" name="createSharedFolder" /><span i18n:translate="" tal:omit-tag="">Create</span></label>
70 </div>
71 </td>
72 </tr>
73 <tr>
74 <th><br />
75 </th>
76 <td>
77 <input type="submit" value="Validate" i18n:attributes="value" />
78 </td>
79 </tr>
80 </table>
81 </form>
82 <pre>assign_roles</pre>
83 <div tal:condition="python:mtool.checkPermission('Manage portal', portal_object)" tal:omit-tag="" metal:define-macro="assign_roles">
84 <table class="assign_global_roles" cellspacing="0" tal:define="groupId requestedGroup ;
85 group python:here.portal_groups.getGroupById(groupId);
86 explicitRoles python:filter(lambda x: x not in ('Authenticated', 'Shared'), group.getUserRoles());
87 implicitRoles python:[ role for role in group.getRoles() if role not in explicitRoles + ['Authenticated', 'Shared'] ];
88 assignabledRoles python:[ role for role in here.portal_membership.getPortalRoles() if role not in explicitRoles + ['Authenticated', 'Shared'] ]">
89 <tr>
90 <th i18n:translate="">Implicit roles</th>
91 <td>
92 <ul tal:condition="implicitRoles">
93 <li tal:content="role" tal:repeat="role implicitRoles" i18n:translate="">role</li>
94 </ul>
95 </td>
96 </tr>
97 <tr>
98 <th i18n:translate="">Explicit roles</th>
99 <td>
100 <form action="." method="post" tal:attributes="action here/portal_url">
101 <div tal:condition="explicitRoles" tal:omit-tag="">
102 <div tal:repeat="role explicitRoles">
103 <input type="checkbox" name="roles:list" value="role" tal:attributes="value role" /><span tal:content="role" tal:omit-tag="" i18n:translate="">role</span>
104 </div>
105 <input type="submit" name="remove_group_roles:method" value="Remove" i18n:attributes="value" /><br />
106 <br />
107 </div>
108 <input type="hidden" name="groupId" value="group" tal:attributes="value groupId"/>
109 <div tal:condition="assignabledRoles">
110 <select name="role" size="1">
111 <option tal:attributes="value role" tal:content="role" tal:repeat="role assignabledRoles" i18n:translate="">role</option>
112 </select><input type="submit" name="append_group_role:method" value="Append" i18n:attributes="value" />
113 </div>
114 </form>
115 </td>
116 </tr>
117 </table>
118 </div>
119 <hr />
120 <pre>assign_members</pre>
121 <hr />
122 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="assign_members">
123 <table class="twins_list" tal:define="
124 uNamesOfGroup python:here.portal_groups.getUserNamesOfGroup(requestedGroup) ;
125 memberMetadata python:mtool.getMembersMetadata(uNamesOfGroup);
126 insideList memberMetadata/memberList ;
127 outsideList memberMetadata/complementList">
128 <tr>
129 <th i18n:translate="">Outside group</th>
130 <td><br /></td>
131 <th i18n:translate="">Inside group</th>
132 </tr>
133 <tr>
134 <td>
135 <select name="append_members:list" size="20" multiple="multiple">
136 <option value="one" tal:attributes="value member/id" tal:content="member/fullname" tal:repeat="member outsideList">NAME Surname or login</option>
137 </select>
138 </td>
139 <td class="twins_list">
140 <input type="submit" name="append_users_in_group:method" value="&gt;&gt;&gt;" />
141 <br /><br />
142 <input type="submit" name="remove_users_in_group:method" value="&lt;&lt;&lt;" tal:condition="insideList" />
143 </td>
144 <td>
145 <select name="remove_members:list" size="20" multiple="multiple" tal:condition="insideList">
146 <option value="one" tal:attributes="value member/id" tal:content="member/fullname" tal:repeat="member insideList">NAME Surname or login</option>
147 </select>
148 <div class="info_message" tal:condition="not:insideList" i18n:translate="">None</div>
149 </td>
150 </tr>
151 </table>
152 <input type="hidden" name="groupId" value="group" tal:attributes="value requestedGroup" />
153 </form>
154 <pre>assign_groups</pre>
155 <hr/>
156 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="assign_groups">
157 <table class="twins_list"
158 tal:define="
159 gtool here/portal_groups ;
160 groupsOfGroup python:gtool.getGroupsOfGroup(requestedGroup) ;
161 insideList python:gtool.getGroups(groupsOfGroup) ;
162 outsideList python:gtool.getOtherGroups(groupsOfGroup)">
163 <tr>
164 <th i18n:translate="">Outside group</th>
165 <th><br /></th>
166 <th i18n:translate="">Inside group</th>
167 </tr>
168 <tr>
169 <td>
170 <select name="append_groups:list" size="6" multiple="multiple">
171 <option tal:attributes="value group/id" tal:content="python:group.title or group.id[prefixLength:]" tal:repeat="group outsideList">group1</option>
172 </select>
173 </td>
174 <td>
175 <input type="submit" name="append_groups_in_group:method" value="&gt;&gt;&gt;"/><br/>
176 <br/>
177 <input type="submit" name="remove_groups_in_group:method" value="&lt;&lt;&lt;" tal:condition="insideList" />
178 </td>
179 <td>
180 <select name="remove_groups:list" size="6" multiple="multiple" tal:condition="insideList">
181 <option tal:attributes="value group/id" tal:content="python:group.title or group.id[prefixLength:]" tal:repeat="group insideList">group2</option>
182 </select>
183 <div class="info_message" tal:condition="not:insideList" i18n:translate="">
184 None
185 </div>
186 </td>
187 </tr>
188 </table>
189 <input type="hidden" name="groupId" value="groupId" tal:attributes="value requestedGroup" />
190 </form>
191
192 <pre>all_members</pre>
193 <hr/>
194 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="all_members">
195 <table class="TwoColumnForm" cellspacing="0">
196 <tr>
197 <th i18n:translate="">All members</th>
198 </tr>
199 <tr>
200 <td>
201 <select name="memberIds:list" size="20" multiple="multiple"
202 tal:attributes="ondblclick string:javascript:openMemberPopup(this.value);;"
203 tal:define="membersMetadata python:mtool.getMembersMetadata([])['complementList']">
204 <option value="userid" tal:attributes="value member/id" tal:content="member/fullname" tal:repeat="member membersMetadata">NAME surname</option>
205 </select>
206 </td>
207 </tr>
208 <tr>
209 <td>
210 <input type="submit" name="member_properties_form:method" value="Edit" i18n:attributes="value" /><br/>
211 <input type="submit" name="delete_members:method" value="Remove selected" i18n:attributes="value" />
212 </td>
213 </tr>
214 </table>
215 </form>
216 <pre>all_groups</pre>
217 <hr/>
218 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="all_groups">
219 <table class="TwoColumnForm" cellspacing="0"
220 tal:define="gtool here/portal_groups ;
221 group_prefix here/acl_users/getGroupPrefix ;
222 prefixLength python:len(group_prefix)">
223 <tr>
224 <th i18n:translate="">All groups</th>
225 </tr>
226 <tr>
227 <td>
228 <select name="groups:list" size="20" multiple="multiple">
229 <option value="group1" tal:repeat="group python:gtool.getOtherGroups([])" tal:attributes="value group/id" tal:content="python:group.title or group.id[prefixLength:]" >Group 1</option>
230 </select>
231 </td>
232 </tr>
233 <tr>
234 <td>
235 <input type="submit" name="remove_groups:method" value="Remove selected" i18n:attributes="value"
236 tal:define="DeleteGroups python:modules['Products.Plinn.permissions'].DeleteGroups"
237 tal:attributes="disabled python:not mtool.checkPermission(DeleteGroups, portal_object)"/>
238 </td>
239 </tr>
240 </table>
241 </form>
242 <pre>add_member</pre>
243 <hr/>
244 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="add_member">
245 <table class="TwoColumnForm" cellspacing="0">
246 <tr>
247 <th colspan="2" nowrap="nowrap" i18n:translate="">Add new member</th>
248 </tr>
249 <tr>
250 <th nowrap="nowrap" i18n:translate="">Login</th>
251 <td>
252 <input type="text" name="username" size="40"/>
253 </td>
254 </tr>
255 <tr>
256 <th nowrap="nowrap" i18n:translate="">Name</th>
257 <td>
258 <input type="text" name="name" size="40"/>
259 </td>
260 </tr>
261 <tr>
262 <th nowrap="nowrap" i18n:translate="">Given Name</th>
263 <td>
264 <input type="text" name="given_name" size="40"/>
265 </td>
266 </tr>
267 <tr>
268 <th nowrap="nowrap" i18n:translate="">Password</th>
269 <td>
270 <input type="password" name="password" size="40"/>
271 </td>
272 </tr>
273 <tr>
274 <th nowrap="nowrap" i18n:translate="">Confirm</th>
275 <td>
276 <input type="password" name="confirm" size="40"/>
277 </td>
278 </tr>
279 <tr>
280 <th nowrap="nowrap" i18n:translate="">Email address</th>
281 <td>
282 <input type="text" name="email" size="40"/>
283 </td>
284 </tr>
285 <tr>
286 <th nowrap="nowrap" i18n:translate=""></th>
287 <td>
288 <input type="submit" name="add_member:method" value="Add" i18n:attributes="value" />
289 </td>
290 </tr>
291 </table>
292 </form>
293 <pre>add_group</pre>
294 <hr/>
295 <form action="." method="post" tal:attributes="action portal_url" metal:define-macro="add_group">
296 <table class="TwoColumnForm" cellspacing="0">
297 <tr>
298 <th colspan="2" i18n:translate="">Add new group</th>
299 </tr>
300 <tr>
301 <th i18n:translate="">Id</th>
302 <td>
303 <input type="text" name="groupname" size="45"/>
304 </td>
305 </tr>
306 <tr>
307 <th i18n:translate="">Title</th>
308 <td>
309 <input type="text" name="title" size="45"/>
310 </td>
311 </tr>
312 <tr>
313 <th i18n:translate="">Description</th>
314 <td>
315 <textarea name="description" rows="4" cols="34"></textarea>
316 </td>
317 </tr>
318 <tr tal:condition="here/portal_groups/getGroupWorkspacesCreationFlag|nothing">
319 <th i18n:translate="">Shared folder</th>
320 <td>
321 <label><input type="checkbox" name="createArea" /><span i18n:translate="" tal:omit-tag="">Create</span></label>
322 </td>
323 </tr>
324 <tr>
325 <td><br /></td>
326 <td>
327 <input type="submit" name="add_group:method" value="Add" i18n:attributes="value"
328 tal:define="AddGroups python:modules['Products.Plinn.permissions'].AddGroups"
329 tal:attributes="disabled python:not mtool.checkPermission(AddGroups, portal_object)"/>
330 </td>
331 </tr>
332 </table>
333 </form>
334 <pre>gruf_settings</pre>
335 <hr />
336 <table class="config" metal:define-macro="gruf_settings">
337 <tr>
338 <td tal:define="ai_dicts here/group_actions;
339 useQueryString python:0">
340 <div metal:use-macro="here/widgets/macros/tabs">
341 GRUF tabs
342 </div>
343 </td>
344 </tr>
345 <tr>
346 <td>
347 <div metal:define-slot="form">
348 form slot here
349 </div>
350 </td>
351 </tr>
352 </table>
353
354 <pre>member_properties_form</pre>
355 <div metal:define-macro="member_properties_form"
356 tal:define="selectedMember python:here.portal_membership.getMemberById(request.form['member_id']);
357 gtool here/portal_groups ;
358 group_prefix here/acl_users/getGroupPrefix ;
359 prefixLength python:len(group_prefix) ;
360 implExpl python:gtool.getExplAndImplGroupsByUserId(selectedMember.getId());
361 mq nocall:modules/ZTUtils/make_query">
362 <form action="." method="post" tal:attributes="action portal_url">
363 <table class="TwoColumnForm" cellspacing="0">
364 <tr>
365 <th nowrap="nowrap" i18n:translate="">Login</th>
366 <td>
367 <span tal:replace="selectedMember/getId"></span><input type="hidden" name="username" tal:attributes="value selectedMember/getId" />
368 </td>
369 </tr>
370 <tr tal:condition="implExpl/explicit|implExpl/implicit">
371 <th nowrap="nowrap" i18n:translate="">Groups</th>
372 <td>
373 <div tal:condition="implExpl/explicit"><span i18n:translate="" tal:omit-tag="">explicitly:</span> <span tal:repeat="group implExpl/explicit"><span tal:replace="python:group.title or group.id[prefixLength:]">group</span><span tal:condition="not:repeat/group/end">, </span></span></div>
374 <div tal:condition="implExpl/implicit"><span i18n:translate="" tal:omit-tag="">implicitly:</span> <span tal:repeat="group implExpl/implicit"><span tal:replace="python:group.title or group.id[prefixLength:]">group</span><span tal:condition="not:repeat/group/end">, </span></span></div>
375 </td>
376 </tr>
377 <tr>
378 <th nowrap="nowrap" i18n:translate="">Name</th>
379 <td>
380 <input type="text" name="name" size="40" tal:attributes="value python:selectedMember.getProperty('name')" />
381 </td>
382 </tr>
383 <tr>
384 <th nowrap="nowrap" i18n:translate="">Given Name</th>
385 <td>
386 <input type="text" name="given_name" size="40" tal:attributes="value python:selectedMember.getProperty('given_name')" />
387 </td>
388 </tr>
389 <tr>
390 <th nowrap="nowrap" i18n:translate="">Password</th>
391 <td>
392 <input type="password" name="password" size="40" />
393 </td>
394 </tr>
395 <tr>
396 <th nowrap="nowrap" i18n:translate="">Confirm</th>
397 <td>
398 <input type="password" name="confirm" size="40"/>
399 </td>
400 </tr>
401 <tr>
402 <th nowrap="nowrap" i18n:translate="">Email address</th>
403 <td>
404 <input type="text" name="email" size="40" tal:attributes="value python:selectedMember.getProperty('email')" />
405 </td>
406 </tr>
407 <tr>
408 <th nowrap="nowrap" i18n:translate=""></th>
409 <td>
410 <input type="submit" name="edit_member_settings:method" value="Validate" i18n:attributes="value" />
411 </td>
412 </tr>
413 </table>
414 </form>
415 <h2 i18n:translate="">Tree view by this member</h2>
416 <a href="." onclick="openMemberTreeView(event)" tal:attributes="href python:'%s/portal_members?%s' % ( portal_url, mq(member_id=selectedMember.getId(), macroName='member_tree_view') )" i18n:translate="">Click here to see the tree viewed by this member &gt;&gt;</a>
417 </div>
418
419 <pre>member_tree_view</pre>
420 <div metal:define-macro="member_tree_view"
421 class="boxes_container"
422 tal:define="selectedMember python:here.portal_membership.getMemberById(request.member_id);
423 treeRoot portal_object;
424 treeDict python:here.make_nav_tree(rootObject=treeRoot, filtered_meta_types=['Plinn Folder', 'Portfolio', 'Topic'], userid=request.member_id );
425 tree treeDict/tree;
426 rows treeDict/rows;
427 height tree/height;
428 rootNode python:rows.pop(0);
429 box_id string:tree_box_${rootNode/object/id}_${request/member_id};
430 mq nocall:modules/ZTUtils/make_query"
431 tal:omit-tag=""
432 tal:on-error="string:Path Error"
433 >
434 <table class="tree_box" cellspacing="0">
435 <tr>
436 <th>
437 <table>
438 <tr>
439 <td width="16" tal:condition="nothing">
440 <a title="collapse all" href="." tal:attributes="href string:?collapse_all=${rootNode/object/id}" i18n:attributes="title"><img src="../skins/collapse_all.gif" alt="collapse all" height="16" width="16" border="0" tal:attributes="src here/collapse_all.gif/absolute_url" i18n:attributes="alt" /></a>
441 </td>
442 <th tal:content="rootNode/object/title_or_id" style="border : none">Root Node</th>
443 </tr>
444 </table>
445 </th>
446 </tr>
447
448 <tr>
449 <td>
450 <table cellspacing="0">
451 <tbody tal:attributes="id box_id">
452 <tr tal:repeat="row rows">
453 <td tal:define="indent python: row.depth - 1" tal:attributes="colspan indent" tal:condition="indent">&nbsp;</td>
454 <td tal:define="state row/state ; rlink row/branch ; msg python:state > 0 and 'collapse' or 'expand'" width="16"
455 ><a href="#" tal:condition="state" tal:attributes="name row/id ; href python:'%s/portal_members?%s' % (portal_url, mq(member_id=selectedMember.getId(), macroName='member_tree_view') + '&' + rlink['link'][1:]) ; title msg" i18n:attributes="title"
456 ><img src="/p_/pl" alt="" tal:attributes="src python:state > 0 and '/p_/mi' or '/p_/pl' ; alt msg" i18n:attributes="alt" height="16" width="16" border="0" /></a>
457 <a href="#" tal:attributes="name row/id ; href rlink/link" tal:condition="not:state">&nbsp;&nbsp;</a>
458 </td>
459 <td colspan="1" tal:define="obj nocall: row/object"
460 tal:attributes="colspan python: height - row.depth"
461 width="99%" tal:on-error="string:erreur"
462 ><img src="." alt="" tal:define="icon python:context.restrictedTraverse(obj.getIcon())" tal:attributes="src icon/absolute_url; height icon/height; width icon/width; alt obj/getPortalTypeName" i18n:attributes="alt" border="0" />
463 <span tal:replace="obj/title_or_id">Title</span></td>
464 </tr>
465 </tbody>
466 </table>
467 </td>
468 </tr>
469 </table>
470 <div>
471 <a href="." tal:attributes="href python:'%s/portal_members?%s' % ( portal_url, mq(member_id=selectedMember.getId(), macroName='member_properties_form') )" i18n:translate="">&lt;&lt; Back to member properties</a>
472 </div>
473 </div>
474
475 </body>
476
477 </html>