]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/conify/global/vandelay/match_set.tt2
Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac...
[working/Evergreen.git] / Open-ILS / src / templates / conify / global / vandelay / match_set.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = 'Vandelay Match Sets' %]
3 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
4     <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
5         <div>[% ctx.page_title %]</div>
6         <div>
7             <button dojoType="dijit.form.Button"
8                 onClick="vms_grid.showCreateDialog()">New Match Set</button>
9             <button dojoType="dijit.form.Button"
10                 onClick="vms_grid.deleteSelected()">Delete Selected</button>
11         </div>
12     </div>
13     <div>
14         Show sets owned at or below:
15         <select dojoType="openils.widget.OrgUnitFilteringSelect"
16             jsId="context_org_selector"></select>
17     </div>
18     <table jsId="vms_grid"
19         dojoType="openils.widget.AutoGrid"
20         query="{id: '*'}"
21         defaultCellWidth="'16em'"
22         fmClass="vms"
23         fieldorder="['name', 'owner']"
24         suppressEditFields="['id']"
25         showPaginator="true"
26         editOnEnter="true">
27         <thead>
28             <tr>
29                 <th field="name" get="field_plus_id" formatter="tree_editor_link"></th>
30                 <th field="owner" get="openils.widget.AutoGrid.orgUnitGetter">
31                 </th>
32             </tr>
33         </thead>
34     </table>
35 </div>
36 <div class="hidden">
37     <select dojoType="dijit.form.FilteringSelect" jsId="mtype_selector">
38         [%# for the origin of these hard coded options, see the definition
39         of vandelay.match_set.mtype in 012.schema.vandelay.sql %]
40         <option value="biblio">biblio</option>
41         <option value="authority">authority</option>
42         <!-- XXX: nah <option value="mfhd">mfhd</option> -->
43     </select>
44 </div>
45
46 <script type="text/javascript">
47     dojo.require("dijit.form.FilteringSelect");
48     dojo.require("openils.widget.AutoGrid");
49     dojo.require("openils.widget.OrgUnitFilteringSelect");
50
51     var context_org;
52
53     function load_grid(search) {
54         if (!search) search = {"id": {"!=": null}};
55
56         vms_grid.loadAll({"order_by": {"vms": "name"}}, search);
57     }
58
59     function field_plus_id(rowIndex, item) {
60         if (!item) return null;
61         var datum = {};
62         datum[this.field] = this.grid.store.getValue(item, this.field);
63         datum.id = this.grid.store.getValue(item, "id");
64         return datum;
65     }
66
67     function tree_editor_link(datum) {
68         if (!datum) return "";
69         return '<a href="[% ctx.base_path %]/eg/conify/global/vandelay/match_set_tree?match_set=' +
70             datum.id + '">' + datum.name + '</a>';
71     }
72
73     openils.Util.addOnLoad(
74         function() {
75             new openils.User().buildPermOrgSelector(
76                 "ADMIN_IMPORT_MATCH_SET", context_org_selector,
77                 null, function() {
78                     context_org_selector.onChange = function() {
79                         context_org = this.attr("value");
80                         vms_grid.resetStore();
81                         load_grid({
82                             "owner": aou.descendantNodeList(context_org, true)
83                         });
84                     };
85                 }
86             );
87
88             vms_grid.overrideEditWidgets.mtype = mtype_selector;
89             vms_grid.overrideEditWidgets.mtype.shove = {"create": "biblio"};
90             load_grid();
91         }
92     );
93 </script>
94 [% END %]