]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/conify/global/cat/authority/thesaurus.tt2
LP 2061136 follow-up: ng lint --fix
[working/Evergreen.git] / Open-ILS / src / templates / conify / global / cat / authority / thesaurus.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = l("Configure Authority Thesauri") %]
3 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
4     <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
5         <div>[% l('Thesauri') %]</div>
6         <div>
7             <button dojoType="dijit.form.Button" onClick="at_grid.showCreateDialog()">[% l('New Thesaurus') %]</button>
8             <button dojoType="dijit.form.Button" onClick="at_grid.deleteSelected()">[% l('Delete Selected') %]</button>
9         </div>
10     </div>
11     <div id="control-set-metadata-holder" class="hidden">
12         [% l('Showing only thesauri linked to control set:') %]
13         <a id="control-set-metadata"></a>
14     </div>
15         <table  jsId="at_grid"
16                 dojoType="openils.widget.AutoGrid"
17                 autoHeight="true"
18                 defaultCellWidth="'auto'"
19                 fieldOrder="['code','control_set','name','description']"
20                 suppressEditFields="['id']"
21                 query="{id: '*'}"
22                 fmClass="at"
23                 editOnEnter="true">
24             <thead>
25                 <tr>
26                     <th field="control_set" get="get_control_set"
27                         formatter="format_control_set"></th>
28                 </tr>
29             </thead>
30         </table>
31 </div>
32 <script type="text/javascript"
33     src="[% ctx.media_prefix %]/js/ui/default/conify/global/cat/authority/common.js"></script>
34 <script type="text/javascript">
35     dojo.require("openils.widget.AutoGrid");
36     dojo.require("openils.CGI");
37     dojo.require("openils.PermaCrud");
38
39     dojo.requireLocalization("openils.authority", "authority");
40     var localeStrings =
41         dojo.i18n.getLocalization("openils.authority", "authority");
42
43     var cgi, pcrud;
44     var control_set;
45
46     function get_control_set(rowidx, item) {
47         if (item) {
48             /* I'm /sure/ there's a better way to do the following */
49             this._tmp = openils.widget.AutoGrid.defaultGetter;
50             var ordinary = this._tmp(rowidx, item); 
51             delete this._tmp;
52
53             if (control_set) {
54                 return ordinary;
55             } else {
56                 var id = this.grid.store.getValue(item, "control_set");
57                 return {
58                     "id": id, "text": ordinary
59                 };
60             }
61         }
62     }
63
64     function format_control_set(f) {
65         if (typeof f == "object") {
66             return '<a href="' + oilsBasePath +
67                 '/conify/global/cat/authority/control_set?focus=' + f.id +
68                 '">' + f.text + "</a>";
69         } else {
70             return f;
71         }
72
73     }
74
75     function my_init() {
76         var where = {"code": {"!=": null}};
77
78         cgi = new openils.CGI();
79         pcrud = new openils.PermaCrud();
80
81         control_set = cgi.param("acs");
82         if (control_set) {
83             control_set = pcrud.retrieve("acs", control_set);
84             where.control_set = control_set.id();
85             render_control_set_metadata(control_set);
86
87             at_grid.overrideEditWidgets.control_set =
88                 new dijit.form.TextBox({"disabled": true});
89             at_grid.overrideEditWidgets.control_set.shove =
90                 {"create": control_set.id()};
91         }
92
93         at_grid.loadAll({"order_by": {"at": "code"}}, where);
94     }
95
96     openils.Util.addOnLoad(my_init);
97 </script>
98 [% END %]