1 <tal:block metal:use-macro="templates/page/macros/frame">
2 <title metal:fill-slot="head_title" i18n:translate=""
3 >"Your Queries" Editing - <span tal:replace="config/TRACKER_NAME"
4 i18n:name="tracker" /></title>
5 <span metal:fill-slot="body_title" tal:omit-tag="python:1"
6 i18n:translate="">"Your Queries" Editing</span>
8 <td class="content" metal:fill-slot="content">
10 <span tal:condition="not:context/is_edit_ok"
11 i18n:translate="">You are not allowed to edit queries.</span>
13 <script language="javascript">
14 // This exists solely because I can't figure how to get the & into an
15 // attributes TALES expression, and so it keeps getting quoted.
16 function retire(qid) {
17 window.location = 'query'+qid+'?@action=retire&@template=edit';
18 }
19 </script>
21 <form method="POST" onSubmit="return submit_once()" action="query"
22 enctype="multipart/form-data" tal:condition="context/is_edit_ok">
24 <table class="list" width="100%"
25 tal:define="uid request/user/id; mine request/user/queries">
27 <tr><th i18n:translate="">Query</th>
28 <th i18n:translate="">Include in "Your Queries"</th>
29 <th i18n:translate="">Edit</th>
30 <th i18n:translate="">Private to you?</th>
31 <th> </th>
32 </tr>
34 <tr tal:repeat="query mine">
35 <tal:block condition="query/is_retired">
37 <td><a tal:attributes="href string:${query/klass}?${query/url}"
38 tal:content="query/name">query</a></td>
40 <td metal:define-macro="include">
41 <select tal:condition="python:query.id not in mine"
42 tal:attributes="name string:user${uid}@add@queries">
43 <option value="" i18n:translate="">leave out</option>
44 <option tal:attributes="value query/id" i18n:translate="">include</option>
45 </select>
46 <select tal:condition="python:query.id in mine"
47 tal:attributes="name string:user${uid}@remove@queries">
48 <option value="" i18n:translate="">leave in</option>
49 <option tal:attributes="value query/id" i18n:translate="">remove</option>
50 </select>
51 </td>
53 <td colspan="3" i18n:translate="">[query is retired]</td>
55 <!-- <td> maybe offer "restore" some day </td> -->
56 </tal:block>
57 </tr>
59 <tr tal:define="queries python:db.query.filter(filterspec={'private_for':uid})"
60 tal:repeat="query queries">
61 <td><a tal:attributes="href string:${query/klass}?${query/url}"
62 tal:content="query/name">query</a></td>
64 <td metal:use-macro="template/macros/include" />
66 <td><a tal:attributes="href string:query${query/id}" i18n:translate="">edit</a></td>
68 <td>
69 <select tal:attributes="name string:query${query/id}@private_for">
70 <option tal:attributes="selected python:query.private_for == uid;
71 value uid" i18n:translate="">yes</option>
72 <option tal:attributes="selected python:query.private_for == None"
73 value="-1" i18n:translate="">no</option>
74 </select>
75 </td>
77 <td>
78 <input type="button" value="Delete" i18n:attributes="value"
79 tal:attributes="onClick python:'''retire('%s')'''%query.id">
80 </td>
81 </tr>
83 <tr tal:define="queries python:db.query.filter(filterspec={'private_for':None})"
84 tal:repeat="query queries">
85 <td><a tal:attributes="href string:${query/klass}?${query/url}"
86 tal:content="query/name">query</a></td>
88 <td metal:use-macro="template/macros/include" />
90 <td colspan="3" tal:condition="query/is_edit_ok">
91 <a tal:attributes="href string:query${query/id}" i18n:translate="">edit</a>
92 </td>
93 <td tal:condition="not:query/is_edit_ok" colspan="3"
94 i18n:translate="">[not yours to edit]</td>
96 </tr>
98 <tr><td colspan="5">
99 <input type="hidden" name="@action" value="edit">
100 <input type="hidden" name="@template" value="edit">
101 <input type="submit" value="Save Selection" i18n:attributes="value">
102 </td></tr>
104 </table>
106 </form>
107 </td>
108 </tal:block>