]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/serial/subscription.tt2
Undo holding lib to SRE linkage (alt dist editor)
[Evergreen.git] / Open-ILS / src / templates / serial / subscription.tt2
1 [% USE CGI; %]
2 [% WRAPPER "base.tt2" %]
3 <script>
4     [%- IF CGI.param('context') == 'scv' %]
5     xulG = parent.xulG;
6     [%- END %]
7     [%- IF CGI.param('id') != 'new' %]
8     sub_id = [% CGI.param('id') %];
9     [%- END %]
10     var cap_editor;
11     var cap_importer;
12 </script>
13 <script src="[% ctx.media_prefix %]/js/ui/default/serial/common.js">
14 </script>
15 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription.js">
16 </script>
17 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/distribution.js"></script>
18 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/caption_and_pattern.js">
19 </script>
20 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/issuance.js">
21 </script>
22
23 <div dojoType="dijit.layout.ContentPane" layout="top" class="oils-header-panel">
24     <div>[% l('Subscription Details') %]</div>
25     <div>
26         <span dojoType="dijit.form.Button" onClick="clone_dialog.show();">
27             [% l('Clone Subscription') %]
28         </span>
29         <span dojoType="dijit.form.Button" onClick="open_batch_receive();">
30             [% l('Batch Item Receive') %]
31         </span>
32     </div>
33 </div>
34
35 <div dojoType="dijit.layout.TabContainer" jsId="tab_container"
36     class="oils-serial-tab-container">
37
38     <!-- Subscription Summary -->
39     [%- IF CGI.param('context') == 'scv' -%]
40     <div dojoType="dijit.layout.ContentPane" title="[% l('View/Edit') %]" selected="true">
41         <div dojoType="dijit.layout.ContentPane" layout="top"
42             class="oils-header-panel lesser">
43             <div>[% l('Subscriptions') %]</div>
44             <div style="margin-right: 16px;">
45                 <span dojoType="dijit.form.Button"
46                     onClick="open_notes('sub', ssub_grid);">[% l('View/Edit Notes') %]</span>
47             </div>
48         </div>
49
50         <script type="dojo/connect" event="onShow">
51             if(ssub_grid.store && !ssub_grid._fresh) { // onShow fires twice on initial page load; we only want to run the second time (and subsequent times)
52                 ssub_grid.resetStore();
53                 if (sub_id) {
54                     ssub_grid.loadAll(
55                         {"order_by": {"ssub": "start_date DESC"}},
56                         {"id": sub_id}
57                     );
58                 }
59                 ssub_grid._fresh = true;
60             }
61         </script>
62         <table jsId="ssub_grid"
63             dojoType="openils.widget.AutoGrid"
64             query="{id: '*'}"
65             fieldOrder="['id','owning_lib','start_date','end_date']"
66             suppressFields="['record_entry']"
67             fmClass="ssub"
68             showPaginator="true"
69             onPostSubmit="attempt_reload_opac"
70             showSequenceFields="true"
71             editOnEnter="true">
72         </table>
73     </div>
74     [%- ELSE -%]
75     <div dojoType="dijit.layout.ContentPane" title="[% l('Summary') %]" selected="true">
76         <script type="dojo/connect" event="onShow">
77             load_sub_grid(sub_id);
78         </script>
79         <table jsId="sub_grid"
80             dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector="20px">
81             <thead>
82                 <tr>
83                     <th field="id">[% l('ID') %]</th>
84                     <th field="owning_lib" formatter="format_org_unit">
85                         [% l('Owning Library') %]
86                     </th>
87                     <th field="start_date" formatter="format_date">
88                         [% l('Start Date') %]
89                     </th>
90                     <th field="end_date" formatter="format_date">
91                         [% l('End Date') %]
92                     </th>
93                     <th field="record_entry" width="20em"
94                         formatter="format_bib">
95                         [% l('Bibliographic Record') %]
96                     </th>
97                     <th field="expected_date_offset">[% l('Expected Date Offset') %]</th>
98                     <th field="num_dist">[% l('Number of Distributions') %]</th>
99                 </tr>
100             </thead>
101         </table>
102     </div>
103     [%- END -%]
104
105     <!-- Distributions -->
106     <div dojoType="dijit.layout.ContentPane" jsId="distributions_tab"
107         title="[% l('Distributions') %]" layoutAlign="client">
108         <script type="dojo/connect" event="onShow">
109             if (!dist_grid._fresh) {
110                 dist_grid.resetStore();
111                 dist_grid.loadAll(
112                     {"order_by": {"sdist": "holding_lib"}},
113                     {"subscription": sub_id}
114                 );
115                 dist_grid._fresh = true;
116             }
117
118             if (!dist_grid.overrideEditWidgets.subscription) {
119                 dist_grid.overrideEditWidgets.subscription =
120                     new dijit.form.TextBox({
121                         "disabled": true, "value": sub_id
122                     });
123
124                 [%- IF CGI.param('context') == 'scv' -%]
125                 // attach the holding_lib selector to the record_entry selector
126                 dist_grid.overrideWidgetArgs.holding_lib = {'dijitArgs' : {'onChange' : function(value) { populate_sre_selector(dist_grid, value); } }};
127
128                 [%- END -%]
129                 var _display_grouping_store = new dojo.data.ItemFileReadStore({
130                     "data": {
131                         "identifier": "display_grouping",
132                         "label": "label",
133                         "items": [
134                             {"display_grouping": "chron",
135                                 "label": "[% l('Chronology') %]"},
136                             {"display_grouping": "enum",
137                                 "label": "[% l('Enumeration') %]"}
138                         ]
139                     }
140                 });
141
142                 var settings = fieldmapper.aou.fetchOrgSettingBatch(
143                     openils.User.user.ws_ou(),
144                     ["serial.default_display_grouping"]
145                 );
146                 var default_display_grouping = "chron";
147
148                 if (settings && settings["serial.default_display_grouping"]) {
149                     default_display_grouping =
150                         settings["serial.default_display_grouping"].value;
151                 }
152
153                 dist_grid.overrideEditWidgets.display_grouping =
154                     new dijit.form.FilteringSelect({
155                         "store": _display_grouping_store,
156                         "searchAttr": "label",
157                         "name": "display_grouping"
158                     });
159                     dist_grid.overrideEditWidgets.display_grouping.shove = {
160                         "create": default_display_grouping
161                     };
162
163                 var _summary_method_store = new dojo.data.ItemFileReadStore({
164                     "data": {
165                         "identifier": "summary_method",
166                         "label": "label",
167                         "items": [
168                             {"summary_method": "add_to_sre",
169                                 "label": "[% l('Add to record entry') %]"},
170                             {"summary_method": "merge_with_sre",
171                                 "label": "[% l('Merge with record entry') %]"},
172                             {"summary_method": "use_sre_only",
173                                 "label": "[% l('Use record entry only') %]"},
174                             {"summary_method": "use_sdist_only",
175                                 "label": "[% l('Do not use record entry') %]"}
176                         ]
177                     }
178                 });
179
180                 dist_grid.overrideEditWidgets.summary_method =
181                     new dijit.form.FilteringSelect({
182                         "store": _summary_method_store,
183                         "searchAttr": "label",
184                         "name": "summary_method"
185                     });
186                     // TODO: add setting for default selection?
187                     dist_grid.overrideEditWidgets.summary_method.shove = {
188                         "create": "add_to_sre"
189                     };
190
191             }
192         </script>
193         [% INCLUDE "serial/subscription/distribution.tt2" %]
194     </div>
195
196     <!-- Caption/Pattern -->
197     <div dojoType="dijit.layout.ContentPane"
198         title="[% l('Captions and Patterns') %]" layoutAlign="client">
199         <script type="dojo/connect" event="onShow">
200             if (!cap_editor) {
201                 cap_editor = new SCAPEditor(sub_id);
202                 cap_importer = new SCAPImporter(sub);
203             }
204         </script>
205         [% INCLUDE "serial/subscription/caption_and_pattern.tt2" %]
206     </div>
207
208     <!-- Issuances -->
209     <div dojoType="dijit.layout.ContentPane" jsId="issuances_tab"
210         title="[% l('Issuances') %]" layoutAlign="client">
211         <script type="dojo/connect" event="onShow">
212             if (!iss_grid._fresh) {
213                 iss_grid.resetStore();
214                 iss_grid.loadAll(
215                     {"order_by": {"siss": "date_published"}},
216                     {"subscription": sub_id}
217                 );
218                 iss_grid._fresh = true;
219             }
220
221             if (!iss_grid.overrideEditWidgets.subscription) {
222                 iss_grid.overrideEditWidgets.subscription =
223                     new dijit.form.TextBox({
224                         "disabled": true, "value": sub_id
225                     });
226
227                 iss_grid.overrideEditWidgets.creator =
228                     new dijit.form.TextBox({"disabled": true});
229                 iss_grid.overrideEditWidgets.creator.shove = {
230                     "create": openils.User.user.id()
231                 };
232
233                 iss_grid.overrideEditWidgets.editor =
234                     new dijit.form.TextBox({
235                         "disabled": true, "value": openils.User.user.id()
236                     });
237
238                 iss_grid.overrideEditWidgets.holding_type =
239                     new dijit.form.TextBox({"disabled": true});
240                 iss_grid.overrideEditWidgets.holding_type.shove = {"create":""};
241
242                 iss_grid.overrideEditWidgets.holding_type =
243                     new dijit.form.TextBox;
244             }
245             fresh_scap_selector(iss_grid);
246         </script>
247         [% INCLUDE "serial/subscription/issuance.tt2" %]
248     </div>
249 </div>
250 <div class="hidden">
251     <div dojoType="openils.widget.ProgressDialog" jsId="progress_dialog"></div>
252     <div dojoType="dijit.Dialog" jsId="clone_dialog" title="[% l('Clone Subscription') %]"
253         style="width: 460px;" execute="clone_subscription(arguments[0]);">
254         <div style="margin-bottom: 0.5em;">
255             [% |l %]This feature will clone a subscription and all of its subscription
256             notes, distributions, distribution notes, captions and patterns,
257             streams, and routing list users.[% END %]</div>
258         <div style="margin-bottom: 0.5em;">
259             [% |l %]Holdings-related objects, like issuances, items, units, and
260             summaries will <em>not</em> be cloned.[% END %]
261         </div>
262         <div style="margin-bottom: 0.5em;">
263             [% |l %]To what bibliographic record should the new subscription be
264             attached?[% END %]
265         </div>
266         <table width="100%">
267             <tr>
268                 <td style="padding-right: 0.5em; vertical-align: top;">
269                     <input dojoType="dijit.form.RadioButton"
270                         id="use_ident_no" name="use_ident" value="no"
271                         checked="checked" />
272                 </td>
273                 <td>
274                     <label for="use_ident_no">
275                         [% l('Same record as the existing subscription') %]
276                     </label>
277                 </td>
278             </tr>
279             <tr>
280                 <td style="padding-right: 0.5em; vertical-align: top;">
281                     <input dojoType="dijit.form.RadioButton"
282                         onChange="toggle_clone_ident_field(this);"
283                         id="use_ident_yes" name="use_ident" value="yes" />
284                 </td>
285                 <td>
286                     <label for="use_ident_yes">
287                         [% l('Record specified by this unique identifier:') %]
288                     </label>
289                     <input dojoType="dijit.form.TextBox" name="ident"
290                         jsId="clone_ident" disabled="true"
291                         style="margin-left: 0.5em; width: 10em;" />
292                 </td>
293             </tr>
294             <tr>
295                 <td colspan="2" align="center">
296                     <span dojoType="dijit.form.Button" type="submit">
297                         [% l('Clone!') %]
298                     </span>
299                 </td>
300             </tr>
301         </table>
302     </div>
303 </div>
304 [% END %]