c5ec30942d352cd8bc308fa6156e05797b8b5033
[Plinn.git] / skins / content / folder_factories.pt
1 <html metal:use-macro="here/main_template/macros/master">
2 <head>
3 <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
4 <title>folder_factories</title>
5 <link href="zpt_stylesheet.css" rel="stylesheet" media="screen"/>
6 <link href="../content/plinn_style.css" rel="stylesheet" media="screen"/>
7 </head>
8 <body>
9 <div metal:fill-slot="main" i18n:domain="plinn">
10 <div tal:condition="python: not(here.portal_membership.checkPermission('Access contents information', here))">
11 <span tal:define="dummy here/unauthRedirect"/>
12 </div>
13 <form tal:attributes="action string:${here/absolute_url}/add_content" method="post" id="factories_form">
14 <table cellspacing="0" tal:define="ucn here/getUntitledContentName" class="FolderFactories">
15 <tr>
16 <th><br/></th>
17 <th i18n:translate="">Type</th>
18 <th i18n:translate="">Name</th>
19 <th><br/></th>
20 </tr>
21 <div tal:repeat="item here/allowedContentTypes" tal:omit-tag="">
22 <tr tal:define="icon python:here.restrictedTraverse(item.getIcon())">
23 <td class="ListName">
24 <img tal:attributes="src icon/absolute_url ; alt item/Title ; height icon/height ; width icon/width" i18n:attributes="alt"/>
25 </td>
26 <td tal:content="item/Title" i18n:translate="" class="ListName">Content name</td>
27 <td tal:condition="python:not item.listActionInfos('object/create', check_visibility=0)">
28 <input type="text" name="id" size="24" tal:attributes="name string:${item/id}.id:record; value ucn"/>
29 </td>
30 <td tal:condition="python:item.listActionInfos('object/create', check_visibility=0)">
31 <input type="hidden" value="1" tal:attributes="name string:${item/id}.create_form:record"/>
32 </td>
33 <td>
34 <input type="submit" value="Add" tal:attributes="name string:${item/id}.type:record" i18n:attributes="value"/>
35 </td>
36 </tr>
37 <tr>
38 <td colspan="4" class="spacing"></td>
39 </tr>
40 </div>
41 </table>
42 </form>
43 <script type="text/javascript" charset="utf-8">
44 (function(){
45 var fform = document.getElementById('factories_form');
46 var fm = new FormManager(fform);
47 var submitButton;
48 fm.onBeforeSubmit = function(self, evt) {
49 if (submitButton)
50 self.submitButton = submitButton;
51 };
52 var id2type = /(^[^\.]+)\.id:record$/;
53 function trackFocus(evt) {
54 var input = getTargetedObject(evt);
55 var matches = id2type.exec(input.name);
56 if (matches && matches.length == 2)
57 submitButton = fform.elements[matches[1] + '.type:record'];
58 }
59 var e;
60 for (var i = 0 ; i < fform.elements.length ; i++) {
61 e = fform.elements[i];
62 if (e.type==='text')
63 addListener(e, 'focus', trackFocus);
64 }
65 }());
66 </script>
67 </div>
68 </body>
69 </html>