Bug 16161: Confirm message when deleting definition
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / dictionary.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Reports &rsaquo; Guided reports &rsaquo; Dictionary</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 <style type="text/css">fieldset.rows table { clear: none; margin: 0;}</style>
6 <script type="text/javascript">
7 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this dictionary definition? This cannot be undone.");
8 </script>
9 </head>
10 <body id="rep_dictionary" class="rep">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'circ-search.inc' %]
13
14 [%- BLOCK area_name -%]
15     [%- SWITCH area -%]
16         [%- CASE 'CIRC' -%]Circulation
17         [%- CASE 'CAT'  -%]Catalog
18         [%- CASE 'PAT'  -%]Patrons
19         [%- CASE 'ACQ'  -%]Acquisitions
20         [%- CASE 'ACC'  -%]Accounts
21     [%- END -%]
22 [%- END -%]
23
24 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
25 [% IF ( new_dictionary ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Name the new definition</strong>
26 [% ELSIF ( step_2 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 2: Choose the area </strong> 
27 [% ELSIF ( step_3 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 3: Choose a column </strong>
28 [% ELSIF ( step_4 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 4: Specify a value </strong> 
29 [% ELSIF ( step_5 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 5: Confirm definition</strong> 
30 [% ELSE %] &rsaquo; <strong> Dictionary </strong>[% END %]</div>
31
32 <div id="doc3" class="yui-t2">
33
34 <div id="bd">
35 <div id="yui-main">
36 <div class="yui-b">
37 [% IF ( start_dictionary ) %]
38     <div id="toolbar">
39         <ul class="toolbar">
40             <li><a id="newdictionary" class="btn btn-small" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition"><i class="fa fa-plus"></i> New definition</a></li>
41         </ul>
42     </div>
43 [% END %]
44 <h1>Dictionary</h1>
45 [% IF ( start_dictionary ) %]
46         <p>Use the dictionary to define custom criteria for reporting.</p>
47
48                 [% IF ( definitions ) %]
49         <h2>Current terms</h2>
50                 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
51         <input type="hidden" name="phase" value="View Dictionary" />
52   [% IF ( areas ) %]
53         Filter by area
54         <select name="area">
55           <option value="">All</option>
56         [% FOREACH area IN areas %]
57           [%- IF ( area.selected ) -%]
58           <option value="[% area.id %]" selected="selected">[%- PROCESS area_name area=area.id -%]</option>
59           [%- ELSE -%]
60           <option value="[% area.id %]">[%- PROCESS area_name area=area.id -%]</option>
61           [%- END -%]
62         [% END %]
63         </select>
64       <input name="submit" value="Go" type="submit" />
65   [% END %]
66       </form>
67       <br />
68                 <table border="1" cellspacing="0" cellpadding="5">
69                 <tr>
70                 <th>Name</th>
71                 <th>Description</th>
72                 <th>Area</th>
73                 <th>Definition</th>
74                 <th>&nbsp;</th>
75                 </tr>
76                 [% FOREACH definition IN definitions %]
77         <tr>
78                         <td>[% definition.name %]</td>
79                         <td>[% definition.description %]</td>
80                         <td>[% definition.areaname %]</td>
81                         <td>[% definition.saved_sql %]</td>
82                         <td><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
83                         <input type="hidden" name="id" value="[% definition.id %]" />
84                         <input type="hidden" name="phase" value="Delete Definition" />
85                         <input type="submit" name="submit" value="Delete Definition" onclick="return confirm(MSG_CONFIRM_DELETE);" />
86                         </form></td>
87                         </tr>
88                 [% END %]
89                 </table>
90                 [% ELSE %]
91                 <div class="dialog message">There are no saved definitions. <a id="newdictionary" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition">Add a definition to the dictionary.</a></div>
92                 [% END %]
93 [% END %]
94
95 [% IF ( new_dictionary ) %]
96 <h3>Add new definition</h3>
97 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
98 <fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
99 <li>
100 <label for="definition_name">Definition name:</label>
101 <input type="text" id="definition_name" name="definition_name" />
102 </li>
103 <li>
104 <label for="definition_description">Definition description:</label>
105 <textarea name="definition_description" id="definition_description" rows="3" cols="20"></textarea>
106 </li>
107 </ol></fieldset>
108
109 <fieldset class="action"><input type="hidden" name="phase" value="New Term step 2" />
110 <input name="submit" value="Next" type="submit" /></fieldset>
111 </form>
112 [% END %]
113
114 [%- IF ( step_2 ) -%]
115 <h3>Add new definition</h3>
116 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
117   <fieldset class="rows">
118     <legend>Step 2 of 5: Choose the area</legend>
119     <ol>
120       <li>
121         <input type="hidden" name="phase" value="New Term step 3" />
122         <input type="hidden" name="definition_name" value="[% definition_name %]" />
123         <input type="hidden" name="definition_description" value="[% definition_description %]" />
124         <label for="area">Select table:</label><select name="area" id="area">
125       [%- FOREACH area IN areas -%]
126         <option value="[%- area.id -%]">[%- PROCESS area_name area=area.id -%]</option>
127       [%- END -%]
128         </select>
129       </li>
130     </ol>
131   </fieldset>
132   <fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
133 </form>
134 [%- END -%]
135
136 [% IF ( step_3 ) %]
137 <h3>Add new definition</h3>
138 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
139 <fieldset class="rows">
140 <legend>Step 3 of 5: Choose a column</legend>
141 <input type="hidden" name="area" value="[% area %]" />
142 <input type="hidden" name="definition_name" value="[% definition_name %]" />
143 <input type="hidden" name="definition_description" value="[% definition_description %]" />
144
145 <select id="availableColumns" name="columns" size="25" style="width:200px;height:300px;margin:1em;">
146 [% FOREACH column IN columns %]
147 [% IF ( column.table ) %]
148 [% IF ( loop.first ) %]                              
149 [% ELSE %]               
150 </optgroup>        
151 [% END %]                                                         
152
153 <optgroup label="[% column.table %]">              
154 [% ELSE %]               
155 <option value="[% column.name %]">          
156 [% IF ( column.description ) %][% column.description %]    
157 [% ELSE %]               
158 [% column.name %]                          
159 [% END %]              
160 </option>      
161 [% END %]              
162 [% END %]                
163 </optgroup>
164 </select>
165
166 <input type="hidden" name="phase" value="New Term step 4" />
167 </fieldset>
168 <fieldset class="action"><input type="submit" name="submit" value="Next" /></fieldset>
169 </form>
170 [% END %]
171
172 [% IF ( step_4 ) %]
173 <h3>Add new definition</h3>
174 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
175 <fieldset class="rows">
176 <legend>Step 4 of 5: Specify a value</legend>
177 <input type="hidden" name="area" value="[% area %]" />
178 <input type="hidden" name="definition_name" value="[% definition_name %]" />
179 <input type="hidden" name="definition_description" value="[% definition_description %]" />
180 <input type="hidden" name="columnstring" value="[% columnstring %]" />
181
182 [% FOREACH column IN columns %]
183 <input type="hidden" name="criteria_column" value="[% column.name %]" />
184 <ol><li><span class="label">Column: </span> [% column.name %]</li>
185 [% IF ( column.distinct ) %]
186         <li><label for="[% column.name %]_value">Choose: </label> <select id="[% column.name %]_value" name="[% column.name %]_value"> 
187                 [% FOREACH value IN column.values %]
188                         <option value="[% value.availablevalues %]">[% value.availablevalues %]</option>
189                 [% END %]
190         </select></li>
191 [% END %]
192 [% IF ( column.date ) %]
193     <li class="radio">
194         <label for="all_dates">All dates</label>
195         <input type="radio" id="all_dates" name="[% column.name %]_date_type_value" value="all" checked="checked" />
196         <label for="date_range">Date range</label>
197         <input type="radio" id="date_range" name="[% column.name %]_date_type_value" value="range" />
198     </li>
199     <li class="radio">
200         Start of date range
201         <input type="text" size="10" id="from" name="[% column.name %]_start_value" value="" class="datepickerfrom" />
202         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
203         End of date range
204         <input type="text" size="10" id="to" name="[% column.name %]_end_value" value="" class="datepickerto" />
205         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
206     </li>
207 [% END %]
208 [% IF ( column.text ) %]
209         <li><label for="[% column.name %]_value">Search string matches: </label> <input type="text" size="13" name="[% column.name %]_value" /></li>
210 [% END %]
211
212 [% END %]
213 </ol>
214 <input type="hidden" name="phase" value="New Term step 5" />
215 </fieldset>
216 <fieldset class="action">
217 <input type="submit" name="submit" value="Next" />
218 </fieldset>
219 </form>
220 [% END %]
221
222 [% IF ( step_5 ) %]
223 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
224 <input type="hidden" name="area" value="[% area %]" />    
225 <input type="hidden" name="definition_name" value="[% definition_name %]" />           
226 <input type="hidden" name="definition_description" value="[% definition_description %]" />
227 <input type="hidden" name="columnstring" value="[% columnstring %]" />
228
229 <h3>Add new definition</h3>
230
231 <fieldset class="rows">
232   <legend>Step 5 of 5: Confirm details</legend>
233   <ol>
234     <li>
235       <span class="label">Name:</span>[%- definition_name -%]
236     </li>
237     <li>
238       <span class="label">Description:</span>[%- definition_description -%]
239     </li>
240     <li>
241       <span class="label">Area:</span>[%- PROCESS area_name area=area -%]
242     </li>
243     <li>
244       <span class="label">Data:</span>
245       <table>
246         <tr>
247           <th>Columns</th>
248           <th>Values</th>
249         </tr>
250       [%- FOREACH criteria_loo IN criteria_loop -%]
251         <tr>
252           <td>[%- criteria_loo.name -%]</td>
253           <td>[%- criteria_loo.value -%]</td>
254         </tr>
255       [%- END -%]
256       </table>
257     </li>
258   </ol>
259 </fieldset>
260
261 <fieldset class="action"><input type="hidden" name="sql" value="[% query %]" />
262 <input type="hidden" name="phase" value="New Term step 6" />
263 <input type="submit" name="submit" value="Save" />         </fieldset>
264
265 </form>
266 [% END %]
267 </div>
268 </div>
269 <div class="yui-b">
270 [% INCLUDE 'guided-reports-view.inc' %]
271 </div>
272 </div>
273 [% INCLUDE 'intranet-bottom.inc' %]