]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/conify/global/config/z3950_index_field_map.tt2
LP1873286: Fix Bad End Tags
[Evergreen.git] / Open-ILS / src / templates / conify / global / config / z3950_index_field_map.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = l('Z39.50 Index Field Maps') %]
3
4 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
5
6     <div dojoType="dijit.layout.ContentPane" 
7             layoutAlign="top" class='oils-header-panel'>
8
9         <div>[% l('Z39.50 Index Field Maps') %]</div>
10         <div>
11             <button dojoType='dijit.form.Button' 
12                 onClick='zGrid.showCreateDialog()'>
13                 [% l('New') %]
14             </button>
15             <button dojoType='dijit.form.Button' 
16                 onClick='zGrid.deleteSelected()'>
17                 [% l('Delete Selected') %]
18             </button>
19         </div>
20     </div>
21
22     <br/>
23
24     <table
25         id="zGrid"
26         jsid="zGrid"
27         dojoType="openils.widget.FlattenerGrid"
28         columnPersistKey='"conify.config.z3950_index_field_map"'
29         autoHeight="true"
30         editOnEnter="true"
31         editStyle="pane"
32         showLoadFilter="true"
33         fmClass="'czifm'"
34         defaultSort="['label']"
35         query="{'id': {'!=' : null}}">
36         <thead>
37             <tr>
38                 <th field="label" fpath="label" ffilter="true"></th>
39                 <th field="metabib_field_label" fpath="metabib_field.label" 
40                     ffilter="true" name="[% l('Metabib Field') %]"></th>
41                 <th field="record_attr_label" fpath="record_attr.label" 
42                     ffilter="true" name="[% l('Record Attribute') %]"></th>
43                 <th field="z3950_attr_label" fpath="z3950_attr.label" 
44                     ffilter="true" name="[% l('Z39.50 Attribute') %]"></th>
45                 <th field="z3950_attr_type" fpath="z3950_attr_type" 
46                     ffilter="true"></th>
47             </tr>
48         </thead>
49     </table>
50
51     <p><i>
52 [% | l %]Map Metabib Fields OR Bib Record Attributes to specific Z39.50 
53 Attributes OR generic Z39.50 Attribute types (by name).[% END %]
54     </i></p>
55
56 </div>
57
58 <script>
59     dojo.require('dijit.form.Button');
60     dojo.require('dojo.data.ItemFileReadStore');
61     dojo.require('dijit.form.FilteringSelect');
62     dojo.require('openils.widget.FlattenerGrid');
63     dojo.require('openils.PermaCrud');
64     dojo.require('openils.Util');
65
66     dojo.addOnLoad(function() {
67
68         // display the z39 attr field label and source
69         zGrid.overrideWidgetArgs.z3950_attr = {
70             labelFormat : ['${0} : ${1}', 'source', 'label']
71         }
72
73         // fetch all of the z39 attrs and create an attr type
74         // selector from the distinct set of z39 attr names
75         new openils.PermaCrud().retrieveAll('cza', {
76             oncomplete : function(r) {
77                 var attrs = openils.Util.readResponse(r);
78                 var names = [];
79                 var seen = {};
80
81                 dojo.forEach(attrs, function(attr) {
82                     var name = attr.name();
83                     if (seen[name]) return;
84                     names.push({name : name});
85                     seen[name] = 1;
86                 });
87
88                 var store = new dojo.data.ItemFileReadStore({ 
89                     data : {
90                         identifier : 'name', 
91                         label : 'name', 
92                         items : names
93                     }
94                 });  
95
96                 zGrid.overrideEditWidgets.z3950_attr_type = 
97                     new dijit.form.FilteringSelect({
98                         searchAttr : 'name',
99                         valueAttr : 'name',
100                         labelAttr : 'name',
101                         store : store
102                     });
103
104                 // when the edit pane is rendered, update the value of our
105                 // custom widget to match that of the row being edited
106                 zGrid.onEditPane = function(pane) {
107                     zGrid.overrideEditWidgets.z3950_attr_type.attr(
108                         'value', pane.fmObject.z3950_attr_type() || ''
109                     );
110                 }
111             }
112         });
113     });
114
115 </script>
116
117 [% END %]
118