-
Notifications
You must be signed in to change notification settings - Fork 156
/
jquery.html
402 lines (372 loc) · 16.7 KB
/
jquery.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
{# Copyright (C) 2006-2014 Edgewall Software
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution. The terms
are also available at http://trac.edgewall.com/license.html.
This software consists of voluntary contributions made by many
individuals. For the exact contribution history, see the revision
history and logs, available at http://trac.edgewall.org/.
#}
## Query view
# extends "jlayout.html"
<!DOCTYPE html>
<html>
<head>
<title>
# block title
${title} ${ super() }
# endblock title
</title>
## FIXME: find a way to make that the default...
# block head
${ super() }
<script type="text/javascript"
src="${chrome.htdocs_location}js/folding.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
initializeFilters();
$("#group").change(function() {
$("#groupdesc").enable(this.selectedIndex != 0)
}).change();
$("fieldset legend.foldable").enableFolding(false);
/*<![CDATA[*/
/* Hide the filters for saved queries. */
if (window.location.href.search(/[?&]report=[0-9]+/) != -1)
$("#filters").toggleClass("collapsed");
/*]]>*/
/* Hide the columns by default. */
$("#columns").toggleClass("collapsed");
});
</script>
# endblock head
</head>
<body>
# block content
<div id="content" class="query">
<h1>${title} <span class="numrows">(${
ngettext('%(num)s match', '%(num)s matches', query.num_items)
})</span></h1>
# if description:
<div id="description">
${wiki_to_html(context.child(report_resource), description)}
</div>
# endif
<form id="query" method="post" action="${href.query()}">
${jmacros.form_token_input()}
<fieldset id="filters">
<legend class="foldable">${_("Filters")}</legend>
<table summary="${_("Query filters")}">
# for constraints in (clauses or [{}]):
# set clause_num = loop.index0
<tbody>
# set clause_pre = '%d_' % loop.index0
<tr${{'style': {'display': 'none' if loop.first}}|htmlattr}>
<td>
<div class="trac-clause-lsep"> <hr /></div>
<div class="trac-clause-msep">${_("Or")}</div>
<div class="trac-clause-rsep"> <hr /></div>
</td>
</tr>
<tr>
<td class="trac-clause">
<table class="trac-clause">
# for field_name in field_names if field_name in constraints:
# set field = fields[field_name]
# set n_field_name = clause_pre + field_name
# set constraint = constraints[field_name]
# set multiline = field.type in ('select', 'text', 'textarea', 'time')
<tbody>
# for constraint_value in constraint['values']:
# if multiline or loop.first:
<tr class="${field_name}">
<td>
<div class="inlinebuttons">
<input type="submit"
name="rm_filter_${n_field_name}_${loop.index0}"
value="–"/>
</div>
</td>
# if loop.first:
<th scope="row"><label id="label_${n_field_name}">${
fields[field_name].label
}</label></th>
# if field.type not in ('radio', 'checkbox', 'time'):
<td class="mode">
<select name="${n_field_name}_mode">
# for mode in modes[field.type]:
<option${
{'value': mode.value,
'selected': mode.value == constraint.mode
}|htmlattr}>${mode.name}</option>
# endfor
</select>
</td>
# endif
# else:
## not the first line of a multiline constraint
<th colspan="${1 if field.type == 'time' else 2
}"><label>${_("or")}</label></th>
# endif
<td class="filter"${
{'colspan':
2 if field.type in ('radio', 'checkbox', 'time')
}|htmlattr}>
# if field.type == 'select':
<select name="${n_field_name}">
# macro render_options(field_name, options)
# for option in options:
# if field_name == 'owner':
# set opt_name = option.name
# set opt_value = option.value
# else:
# set opt_name = option
# set opt_value = option
# endif
<option${{'value': opt_value,
'selected': opt_value == constraint_value
}|htmlattr}>${opt_name}
</option>
# endfor
# endmacro
<option></option>
${render_options(field.name, field.options)}
# for ogroup in field.optgroups if ogroup.options:
<optgroup label="${ogroup.label}">
${render_options(field.name, ogroup.options)}
</optgroup>{# jinjacheck: "()" OK #}
# endfor
</select>
# elif field.type == 'radio':
# for option in field.options:
<input type="checkbox"
id="_${n_field_name}_${option}"${
{'name': n_field_name,
'value': option,
'checked':
(constraint['mode'] == '') is equalto
(option in constraint['values'])
}|htmlattr}/>
<label for="_${n_field_name}_${option}"
class="control">${option or _('none')}</label>
# endfor
# elif field.type == 'checkbox':
<input type="radio" id="_${n_field_name}_on"
value="1"${
{'name': n_field_name,
'checked': constraint.mode != '!' or
constraint_value == '1'
}|htmlattr}/>
<label for="_${n_field_name}_on" class="control">${
_("yes")}</label>
<input type="radio" id="_${n_field_name}_off"
value="0"${
{'name': n_field_name,
'checked': constraint.mode == '!' or
constraint_value != '1'
}|htmlattr}/>
<label for="_${n_field_name}_off" class="control">${
_("no")}</label>
# elif field.type in ('text', 'textarea', 'id'):
<input type="text" name="${n_field_name}"
value="${constraint_value}" size="42"/>
# elif field.type == 'time':
# set start, end = '..' in constraint_value and constraint_value.split('..', 1) or (constraint_value, '')
# set format = field.get('format', 'datetime')
# set date_or_datetime = 'date' if format == 'relative' else format
# set start_picker
<input type="text" name="${n_field_name}"
value="${start}" size="14"
class="trac-${date_or_datetime}picker" />
# endset
# set end_picker
<input type="text" name="${n_field_name}_end"
value="${end}" size="14"
class="trac-${date_or_datetime}picker" />
# endset
# trans start_picker = start_picker, end_picker = end_picker
<label>between</label> ${start_picker}
<label>and</label> ${end_picker}
# endtrans
# endif
</td>
</tr>
# endif
# endfor
</tbody>
# endfor
# if loop.last:
<tbody>
<tr class="actions">
<td class="and" colspan="2">
<label for="add_filter_${clause_num}">${
_("And")
}</label>
<select name="add_filter_${clause_num}"
id="add_filter_${clause_num}">
<option></option>
# for field_name in field_names:
# set field = fields[field_name]
<option${
{'value': field_name,
'disabled':
(field.type in ('radio', 'checkbox', 'id') and
field_name in constraints and
len(constraints[field_name]))
}|htmlattr}>${field.label}</option>
# endfor
</select>
<div class="inlinebuttons">
<input type="submit" name="add_${clause_num}"
value="+"/>
</div>
</td>
# if loop.last:
<td class="or" colspan="2">
<label for="add_clause">Or</label>
<select name="add_clause_${clause_num + 1}"
id="add_clause">
<option></option>
# for field_name in field_names:
<option value="${field_name}">${
fields[field_name].label
}</option>
# endfor
</select>
<div class="inlinebuttons">
<input type="submit" name="add_${clause_num + 1}"
value="+" />
</div>
</td>
# endif
</tr>
</tbody>
# endif
</table>
</td>
</tr>
</tbody>
# endfor
</table>
</fieldset>
## Allow the user to decide what columns to include in the
## output of the query
<fieldset id="columns">
<legend class="foldable">${_("Columns")}</legend>
<div>
# for column in all_columns:
<label>
<input type="checkbox" name="col"${
{'value': column,
'checked': col|select('equalto', column)|list|length
}|htmlattr}/>
${fields.get(column, {'label': column or 'none'}).label}
</label>
# endfor
</div>
</fieldset>
<p class="option">
<label for="group">${_("Group results by")}</label>
<select name="group" id="group">
<option></option>
# for field_name in field_names:
# set field = fields[field_name]
# if field.type in ('select', 'radio') or field_name in ('owner', 'reporter'):
<option${{'selected': field_name == query.group,
'value': field_name
}|htmlattr}>${field.label}</option>
# endif
# endfor
</select>
<input type="checkbox" name="groupdesc" id="groupdesc"${
{'checked': query.groupdesc}|htmlattr}/>
<label for="groupdesc">descending</label>
</p>
<p class="option">
## Allow the user to decide what rows to include in the
## output of the query
${_("Show under each result:")}
# for column in all_textareas:
<label><input type="checkbox" name="row"${
{'value': column,
'checked': row|select('equalto', column)|list|length
}|htmlattr}/>
${fields.get(column, {'label': column or 'none'}).label}</label>
# endfor
</p>
<p class="option">
<label for="max">Max items per page</label>
<input type="text" name="max" id="max" size="10"
value="${query.max}"/>
</p>
<div class="buttons">
# if report_resource:
<input type="hidden" name="report" value="${report_resource.id}" />
# endif
<input type="hidden" name="order" value="${query.order}" />
# if query.desc:
<input type="hidden" name="desc" value="1" />
# endif
<input type="submit" name="update" value="${_('Update')}" />
</div>
<hr />
</form>
# include "jquery_results.html"
# include "jbatch_modify.html" if tickets and batch_modify ignore missing
<div id="trac-report-buttons" class="buttons">
# set edit = report_resource and 'REPORT_MODIFY' in perm(report_resource)
# set new = 'REPORT_CREATE' in perm('report')
# set delete = report_resource and 'REPORT_DELETE' in perm(report_resource)
# if edit:
<form method="get" id="trac-report-edit"
action="${url_of(report_resource)}">
<div>
<input type="hidden" name="action" value="edit" />
<input type="submit"
title="${
_("Edit report {%(id)s} corresponding to this query",
id=report_resource.id)
}"
value="${_("Edit query")}" />
</div>
</form>
# endif
# if new or edit:
<form method="get" id="trac-report-save"
action="${url_of(report_resource) if edit else href.report()}">
<div>
<input type="hidden" name="action"
value="${'edit' if edit else 'new'}" />
<input type="hidden" name="query" value="${query.to_string()}" />
<input type="submit" value="${_("Save query")}"
title="${
_('Save updated query in report {%(id)s}',
id=report_resource.id) if edit
else _('Create new report from current query')
}" />
</div>
</form>
# endif
# if delete:
<form method="get" id="trac-report-delete"
action="${url_of(report_resource)}">
<div>
<input type="hidden" name="action" value="delete" />
<input type="submit"
title="${
_("Delete report {%(id)s} corresponding to this query",
id=report_resource.id)}"
value="${_("Delete query")}" />
</div>
</form>
# endif
</div>
<div id="help">
# trans hhref = href.wiki('TracQuery')
<strong>Note:</strong> See <a href="${hhref}">TracQuery</a>
for help on using queries.
# endtrans
</div>
</div>
${ super() }
# endblock content
</body>
</html>