]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/conify/global/cat/authority/control_set.tt2
webstaff: throw a kitchen sink at double-scrollbar issues
[Evergreen.git] / Open-ILS / src / templates / conify / global / cat / authority / control_set.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = l("Configure Authority Control Sets") %]
3 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
4     <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
5         <div>[% l('Control Sets') %]</div>
6         <div>
7             <button dojoType="dijit.form.Button" onClick="acs_grid.showCreateDialog()">[% l('New Control Set') %]</button>
8             <button dojoType="dijit.form.Button" onClick="acs_grid.deleteSelected()">[% l('Delete Selected') %]</button>
9         </div>
10     </div>
11     <table  jsId="acs_grid"
12             dojoType="openils.widget.AutoGrid"
13             autoHeight="true"
14             defaultCellWidth="'auto'"
15             fieldOrder="['name','description','id']"
16             suppressEditFields="['id']"
17             query="{id: '*'}"
18             fmClass="acs"
19             editOnEnter="true">
20             <thead>
21                 <tr>
22                     <th name="Other properties"
23                         field="id" formatter="format_acs_id"></th>
24                 </tr>
25             </thead>
26     </table>
27 </div>
28
29 <script type="text/javascript">
30     dojo.require("openils.widget.AutoGrid");
31     dojo.require("openils.CGI");
32     dojo.requireLocalization("openils.authority", "authority");
33     var localeStrings =
34         dojo.i18n.getLocalization("openils.authority", "authority");
35     var acs_cache = {};
36     var cgi;
37
38     function format_acs_id(id) {
39         if (id) {
40             var tlen = acs_cache[id].thesauri() ?
41                 acs_cache[id].thesauri().length : 0;
42             var alen = acs_cache[id].authority_fields() ?
43                 acs_cache[id].authority_fields().length : 0;
44
45             return "<a href='" + oilsBasePath +
46                 "/conify/global/cat/authority/thesaurus?acs=" + id + "'>" +
47                 dojo.string.substitute(localeStrings.THESAURI, [tlen]) +
48                 "</a> &nbsp;" + " <a href='" + oilsBasePath +
49                 "/conify/global/cat/authority/control_set_authority_field?acs=" +
50                 id + "'>" +
51                 dojo.string.substitute(localeStrings.AUTHORITY_FIELDS, [alen]) +
52                 "</a>";
53         }
54     }
55
56     function acs_grid_loader() {
57         acs_cache = {};
58         acs_grid.resetStore();
59         acs_grid.showLoadProgressIndicator();
60         fieldmapper.standardRequest(
61             ["open-ils.cat", "open-ils.cat.authority.control_set.retrieve"], {
62                 "async": true,
63                 "params": [acs_grid.displayLimit, acs_grid.displayOffset, cgi.param("focus")],
64                 "onresponse": function(r) {
65                     if (r = openils.Util.readResponse(r)) {
66                         acs_cache[r.id()] = r;
67                         acs_grid.store.newItem(r.toStoreItem());
68                     }
69                 },
70                 "oncomplete": function() {
71                     acs_grid.hideLoadProgressIndicator();
72                 }
73             }
74         );
75     }
76
77     openils.Util.addOnLoad(
78         function() {
79             cgi = new openils.CGI();
80
81             acs_grid.onPostCreate = function(obj) {acs_cache[obj.id()] = obj;};
82             acs_grid.dataLoader = acs_grid_loader;
83             acs_grid_loader();
84         }
85     );
86 </script>
87 [% END %]