| 1 |
<?cs include:"header.cs" ?> |
|---|
| 2 |
<?cs include:"macros.cs" ?> |
|---|
| 3 |
|
|---|
| 4 |
<div id="ctxtnav" class="nav"><?cs |
|---|
| 5 |
if:query.report_href ?><ul> |
|---|
| 6 |
<li class="first"><a href="<?cs |
|---|
| 7 |
var:query.report_href ?>">レポート一覧</a></li> |
|---|
| 8 |
<li class="last">カスタムクエリ</li></ul><?cs |
|---|
| 9 |
/if ?> |
|---|
| 10 |
</div> |
|---|
| 11 |
|
|---|
| 12 |
<?cs def:num_matches(v) ?><span class="numrows">(<?cs |
|---|
| 13 |
alt:v ?>0<?cs /alt ?> 件のマッチ)</span><?cs |
|---|
| 14 |
/def ?> |
|---|
| 15 |
|
|---|
| 16 |
<div id="content" class="query"> |
|---|
| 17 |
<h1><?cs var:title ?> <?cs call:num_matches(query.num_matches) ?></h1> |
|---|
| 18 |
|
|---|
| 19 |
<form id="query" method="post" action="<?cs var:trac.href.query ?>"> |
|---|
| 20 |
<fieldset id="filters"> |
|---|
| 21 |
<legend>検索条件</legend> |
|---|
| 22 |
<?cs def:checkbox_checked(constraint, option) ?><?cs |
|---|
| 23 |
set:checked = 0 ?><?cs |
|---|
| 24 |
each:value = constraint.values ?><?cs |
|---|
| 25 |
if:(value == option) == (constraint.mode == '') ?><?cs |
|---|
| 26 |
set:checked = 1 ?><?cs |
|---|
| 27 |
/if ?><?cs |
|---|
| 28 |
/each ?><?cs |
|---|
| 29 |
if:checked ?> checked="checked"<?cs /if ?><?cs |
|---|
| 30 |
/def ?> |
|---|
| 31 |
<table summary="クエリの検索条件"> |
|---|
| 32 |
<tbody><tr style="height: 1px"><td colspan="4"></td></tr></tbody><?cs |
|---|
| 33 |
each:field = query.fields ?><?cs |
|---|
| 34 |
each:constraint = query.constraints ?><?cs |
|---|
| 35 |
if:name(field) == name(constraint) ?> |
|---|
| 36 |
<tbody><tr class="<?cs var:name(field) ?>"> |
|---|
| 37 |
<th scope="row"><label><?cs var:field.label ?></label></th><?cs |
|---|
| 38 |
if:field.type != "radio" && field.type != "checkbox" ?> |
|---|
| 39 |
<td class="mode"> |
|---|
| 40 |
<select name="<?cs var:name(field) ?>_mode"><?cs |
|---|
| 41 |
each:mode = query.modes[field.type] ?> |
|---|
| 42 |
<option value="<?cs var:mode.value ?>"<?cs |
|---|
| 43 |
if:mode.value == constraint.mode ?> selected="selected"<?cs |
|---|
| 44 |
/if ?>><?cs var:mode.name ?></option><?cs |
|---|
| 45 |
/each ?> |
|---|
| 46 |
</select> |
|---|
| 47 |
</td><?cs |
|---|
| 48 |
/if ?> |
|---|
| 49 |
<td class="filter"<?cs |
|---|
| 50 |
if:field.type == "radio" || field.type == "checkbox" ?> colspan="2"<?cs |
|---|
| 51 |
/if ?>><?cs |
|---|
| 52 |
if:field.type == "select" ?><?cs |
|---|
| 53 |
each:value = constraint.values ?> |
|---|
| 54 |
<select name="<?cs var:name(constraint) ?>"><option></option><?cs |
|---|
| 55 |
each:option = field.options ?> |
|---|
| 56 |
<option<?cs if:option == value ?> selected="selected"<?cs /if ?>><?cs |
|---|
| 57 |
var:option ?></option><?cs |
|---|
| 58 |
/each ?></select><?cs |
|---|
| 59 |
if:name(value) != len(constraint.values) - 1 ?> |
|---|
| 60 |
</td> |
|---|
| 61 |
<td class="actions"><input type="submit" name="rm_filter_<?cs |
|---|
| 62 |
var:name(field) ?>_<?cs var:name(value) ?>" value="-" /></td> |
|---|
| 63 |
</tr><tr class="<?cs var:name(field) ?>"> |
|---|
| 64 |
<th colspan="2"><label>or</label></th> |
|---|
| 65 |
<td class="filter"><?cs |
|---|
| 66 |
/if ?><?cs |
|---|
| 67 |
/each ?><?cs |
|---|
| 68 |
elif:field.type == "radio" ?><?cs |
|---|
| 69 |
each:option = field.options ?> |
|---|
| 70 |
<input type="checkbox" id="<?cs var:name(field) ?>_<?cs |
|---|
| 71 |
var:option ?>" name="<?cs var:name(field) ?>" value="<?cs |
|---|
| 72 |
var:option ?>"<?cs call:checkbox_checked(constraint, option) ?> /> |
|---|
| 73 |
<label for="<?cs var:name(field) ?>_<?cs var:option ?>"><?cs |
|---|
| 74 |
alt:option ?>none<?cs /alt ?></label><?cs |
|---|
| 75 |
/each ?><?cs |
|---|
| 76 |
elif:field.type == "checkbox" ?> |
|---|
| 77 |
<input type="radio" id="<?cs var:name(field) ?>_on" name="<?cs |
|---|
| 78 |
var:name(field) ?>" value="1"<?cs |
|---|
| 79 |
if:constraint.mode != '!' ?> checked="checked"<?cs /if ?> /> |
|---|
| 80 |
<label for="<?cs var:name(field) ?>_on">yes</label> |
|---|
| 81 |
<input type="radio" id="<?cs var:name(field) ?>_off" name="<?cs |
|---|
| 82 |
var:name(field) ?>" value="!1"<?cs |
|---|
| 83 |
if:constraint.mode == '!' ?> checked="checked"<?cs /if ?> /> |
|---|
| 84 |
<label for="<?cs var:name(field) ?>_off">no</label><?cs |
|---|
| 85 |
elif:field.type == "text" ?><?cs |
|---|
| 86 |
each:value = constraint.values ?> |
|---|
| 87 |
<input type="text" name="<?cs var:name(field) ?>" value="<?cs |
|---|
| 88 |
var:value ?>" size="42" /><?cs |
|---|
| 89 |
if:name(value) != len(constraint.values) - 1 ?> |
|---|
| 90 |
</td> |
|---|
| 91 |
<td class="actions"><input type="submit" name="rm_filter_<?cs |
|---|
| 92 |
var:name(field) ?>_<?cs var:name(value) ?>" value="-" /></td> |
|---|
| 93 |
</tr><tr class="<?cs var:name(field) ?>"> |
|---|
| 94 |
<th colspan="2"><label>もしくは</label></th> |
|---|
| 95 |
<td class="filter"><?cs |
|---|
| 96 |
/if ?><?cs |
|---|
| 97 |
/each ?><?cs |
|---|
| 98 |
/if ?> |
|---|
| 99 |
</td> |
|---|
| 100 |
<td class="actions"><input type="submit" name="rm_filter_<?cs |
|---|
| 101 |
var:name(field) ?><?cs |
|---|
| 102 |
if:field.type != 'radio' ?>_<?cs |
|---|
| 103 |
var:len(constraint.values) - 1 ?><?cs |
|---|
| 104 |
/if ?>" value="-" /></td> |
|---|
| 105 |
</tr></tbody><?cs /if ?><?cs |
|---|
| 106 |
/each ?><?cs |
|---|
| 107 |
/each ?> |
|---|
| 108 |
<tbody><tr class="actions"> |
|---|
| 109 |
<td class="actions" colspan="4" style="text-align: right"> |
|---|
| 110 |
<label for="add_filter">検索条件の追加</label> |
|---|
| 111 |
<select name="add_filter" id="add_filter"> |
|---|
| 112 |
<option></option><?cs |
|---|
| 113 |
each:field = query.fields ?> |
|---|
| 114 |
<option value="<?cs var:name(field) ?>"<?cs |
|---|
| 115 |
if:field.type == "radio" ?><?cs |
|---|
| 116 |
if:len(query.constraints[name(field)]) != 0 ?> disabled="disabled"<?cs |
|---|
| 117 |
/if ?><?cs |
|---|
| 118 |
/if ?>><?cs var:field.label ?></option><?cs |
|---|
| 119 |
/each ?> |
|---|
| 120 |
</select> |
|---|
| 121 |
<input type="submit" name="add" value="+" /> |
|---|
| 122 |
</td> |
|---|
| 123 |
</tr></tbody> |
|---|
| 124 |
</table> |
|---|
| 125 |
</fieldset> |
|---|
| 126 |
<p class="option"> |
|---|
| 127 |
<label for="group">グループ化するチケット属性:</label> |
|---|
| 128 |
<select name="group" id="group"> |
|---|
| 129 |
<option></option><?cs |
|---|
| 130 |
each:field = query.fields ?><?cs |
|---|
| 131 |
if:field.type == 'select' || field.type == 'radio' || |
|---|
| 132 |
name(field) == 'owner' ?> |
|---|
| 133 |
<option value="<?cs var:name(field) ?>"<?cs |
|---|
| 134 |
if:name(field) == query.group ?> selected="selected"<?cs /if ?>><?cs |
|---|
| 135 |
var:field.label ?></option><?cs |
|---|
| 136 |
/if ?><?cs |
|---|
| 137 |
/each ?> |
|---|
| 138 |
</select> |
|---|
| 139 |
<input type="checkbox" name="groupdesc" id="groupdesc"<?cs |
|---|
| 140 |
if:query.groupdesc ?> checked="checked"<?cs /if ?> /> |
|---|
| 141 |
<label for="groupdesc">降順</label> |
|---|
| 142 |
<script type="text/javascript"> |
|---|
| 143 |
var group = document.getElementById("group"); |
|---|
| 144 |
var updateGroupDesc = function() { |
|---|
| 145 |
enableControl('groupdesc', group.selectedIndex > 0); |
|---|
| 146 |
} |
|---|
| 147 |
addEvent(window, 'load', updateGroupDesc); |
|---|
| 148 |
addEvent(group, 'change', updateGroupDesc); |
|---|
| 149 |
</script> |
|---|
| 150 |
</p> |
|---|
| 151 |
<p class="option"> |
|---|
| 152 |
<input type="checkbox" name="verbose" id="verbose"<?cs |
|---|
| 153 |
if:query.verbose ?> checked="checked"<?cs /if ?> /> |
|---|
| 154 |
<label for="verbose">検索結果各行の下に詳細を省略せずに表示する</label> |
|---|
| 155 |
</p> |
|---|
| 156 |
<div class="buttons"> |
|---|
| 157 |
<input type="hidden" name="order" value="<?cs var:query.order ?>" /> |
|---|
| 158 |
<?cs if:query.desc ?><input type="hidden" name="desc" value="1" /><?cs /if ?> |
|---|
| 159 |
<input type="submit" name="update" value="更新" /> |
|---|
| 160 |
</div> |
|---|
| 161 |
<hr /> |
|---|
| 162 |
</form> |
|---|
| 163 |
<script type="text/javascript"><?cs set:idx = 0 ?> |
|---|
| 164 |
var properties={<?cs each:field = query.fields ?><?cs |
|---|
| 165 |
var:name(field) ?>:{type:"<?cs var:field.type ?>",label:"<?cs |
|---|
| 166 |
var:field.label ?>",options:[<?cs |
|---|
| 167 |
each:option = field.options ?>"<?cs var:option ?>"<?cs |
|---|
| 168 |
if:name(option) < len(field.options) -1 ?>,<?cs /if ?><?cs |
|---|
| 169 |
/each ?>]}<?cs |
|---|
| 170 |
set:idx = idx + 1 ?><?cs if:idx < len(query.fields) ?>,<?cs /if ?><?cs |
|---|
| 171 |
/each ?>};<?cs set:idx = 0 ?> |
|---|
| 172 |
var modes = {<?cs each:type = query.modes ?><?cs var:name(type) ?>:[<?cs |
|---|
| 173 |
each:mode = type ?>{text:"<?cs var:mode.name ?>",value:"<?cs var:mode.value ?>"}<?cs |
|---|
| 174 |
if:name(mode) < len(type) -1 ?>,<?cs /if ?><?cs |
|---|
| 175 |
/each ?>]<?cs |
|---|
| 176 |
set:idx = idx + 1 ?><?cs if:idx < len(query.modes) ?>,<?cs /if ?><?cs |
|---|
| 177 |
/each ?>}; |
|---|
| 178 |
initializeFilters(); |
|---|
| 179 |
</script> |
|---|
| 180 |
|
|---|
| 181 |
<?cs def:thead() ?> |
|---|
| 182 |
<thead><tr><?cs each:header = query.headers ?> |
|---|
| 183 |
<th class="<?cs var:header.name ?><?cs if:query.order == header.name ?> <?cs |
|---|
| 184 |
if:query.desc ?>desc<?cs else ?>asc<?cs /if ?><?cs /if ?>"> |
|---|
| 185 |
<a title="<?cs var:header.label ?> でソート<?cs |
|---|
| 186 |
if:query.order == header.name && !query.desc ?> (降順)<?cs |
|---|
| 187 |
/if ?>" href="<?cs var:header.href ?>"><?cs var:header.label ?></a> |
|---|
| 188 |
</th><?cs |
|---|
| 189 |
/each ?></tr></thead> |
|---|
| 190 |
<?cs /def ?> |
|---|
| 191 |
|
|---|
| 192 |
<?cs if:len(query.results) ?><?cs |
|---|
| 193 |
if:!query.group ?> |
|---|
| 194 |
<table class="listing tickets"> |
|---|
| 195 |
<?cs call:thead() ?><tbody><?cs |
|---|
| 196 |
/if ?><?cs |
|---|
| 197 |
each:result = query.results ?><?cs |
|---|
| 198 |
if:result[query.group] != prev_group ?> |
|---|
| 199 |
<?cs if:prev_group ?></tbody></table><?cs /if ?> |
|---|
| 200 |
<h2><?cs |
|---|
| 201 |
each:field = query.fields ?><?cs |
|---|
| 202 |
if:name(field) == query.group ?><?cs |
|---|
| 203 |
var:field.label ?><?cs |
|---|
| 204 |
/if ?><?cs |
|---|
| 205 |
/each ?>: <?cs var:result[query.group] ?> <?cs call:num_matches(query.num_matches_group[result[query.group]]) ?></h2> |
|---|
| 206 |
<table class="listing tickets"> |
|---|
| 207 |
<?cs call:thead() ?><tbody><?cs |
|---|
| 208 |
/if ?> |
|---|
| 209 |
<tr class="<?cs |
|---|
| 210 |
if:name(result) % 2 ?>odd<?cs else ?>even<?cs /if ?> prio<?cs |
|---|
| 211 |
var:result.priority_value ?><?cs |
|---|
| 212 |
if:result.added ?> added<?cs /if ?><?cs |
|---|
| 213 |
if:result.changed ?> changed<?cs /if ?><?cs |
|---|
| 214 |
if:result.removed ?> removed<?cs /if ?>"><?cs |
|---|
| 215 |
each:header = query.headers ?><?cs |
|---|
| 216 |
if:name(header) == 0 ?><td class="id"><a href="<?cs |
|---|
| 217 |
var:result.href ?>" title="チケットを閲覧する"><?cs var:result.id ?></a></td><?cs |
|---|
| 218 |
else ?><td class="<?cs var:header.name ?>"><?cs |
|---|
| 219 |
if:header.name == 'summary' ?><a href="<?cs |
|---|
| 220 |
var:result.href ?>" title="チケットを閲覧する"><?cs |
|---|
| 221 |
var:result.summary ?></a><?cs |
|---|
| 222 |
else ?><span><?cs var:result[header.name] ?></span><?cs |
|---|
| 223 |
/if ?></td><?cs |
|---|
| 224 |
/if ?><?cs |
|---|
| 225 |
/each ?> |
|---|
| 226 |
<?cs if:query.verbose ?> |
|---|
| 227 |
</tr><tr class="fullrow"><td colspan="<?cs var:len(query.headers) ?>"> |
|---|
| 228 |
<p class="meta">報告者: <strong><?cs var:result.reporter ?></strong>, |
|---|
| 229 |
登録日時: <?cs var:result.time ?><?cs if:result.description ?>:<?cs /if ?></p> |
|---|
| 230 |
<?cs if:result.description ?><p><?cs var:result.description ?></p><?cs /if ?> |
|---|
| 231 |
</td> |
|---|
| 232 |
<?cs /if ?><?cs set:prev_group = result[query.group] ?> |
|---|
| 233 |
</tr><?cs /each ?> |
|---|
| 234 |
</tbody></table><?cs |
|---|
| 235 |
/if ?> |
|---|
| 236 |
|
|---|
| 237 |
<div id="help"> |
|---|
| 238 |
<strong>Note:</strong> カスタムクエリ使用についてのヘルプは <a href="<?cs var:trac.href.wiki ?>/TracQuery">TracQuery</a> |
|---|
| 239 |
を参照してください。 |
|---|
| 240 |
</div> |
|---|
| 241 |
|
|---|
| 242 |
</div> |
|---|
| 243 |
<?cs include:"footer.cs" ?> |
|---|