]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/conify/global/config/metabib_field_virtual_map.tt2
LP#1744385: Search and Result Display improvements
[working/Evergreen.git] / Open-ILS / src / templates / conify / global / config / metabib_field_virtual_map.tt2
1 [% WRAPPER base.tt2 %]
2 <h1>[% l('Virtual Field Data Providers') %]</h1> <br/>
3
4 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
5     <div>[% l('Virtual Field Data Providers') %]</div>
6     <div>
7         <button dojoType='dijit.form.Button' onClick='cmfvmGrid.showCreateDialog()'>[% l('New Map') %]</button>
8         <button dojoType='dijit.form.Button' onClick='cmfvmGrid.deleteSelected()'>[% l('Delete Selected') %]</button>
9         <button dojoType='dijit.form.Button' onClick='cmfvmGrid.showClonePane()'>[% l('Clone Selected') %]</button>
10     </div>
11 </div>
12
13 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
14     <span>[% l('Record Attribute Type: ') %]</span><div id='attr-def-div'></div>
15 </div>
16
17 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
18     <table  jsId="cmfvmGrid"
19             autoHeight='true'
20             dojoType="openils.widget.AutoGrid"
21             fieldOrder="['id', 'real', 'virtual', 'weight']"
22             query="{id: '*'}"
23             defaultCellWidth='"25%"'
24             fmClass='cmfvm'
25             showPaginator='true'
26             editOnEnter='true'>
27     </table>
28  </div>
29
30 <script type ="text/javascript">
31
32     dojo.require('dijit.form.FilteringSelect');
33     dojo.require('openils.widget.AutoGrid');
34     dojo.require('openils.widget.AutoFieldWidget');
35     dojo.require('openils.PermaCrud');
36
37     var cmfId = '[% ctx.page_args.0 %]';
38
39     openils.Util.addOnLoad(
40         function() {
41
42             var selector = new openils.widget.AutoFieldWidget({
43                 fmClass : 'cmfvm',
44                 fmField : 'virtual',
45                 parentNode : dojo.byId('attr-def-div')
46             });
47
48             selector.build(
49                 function(w, ww) {
50                     dojo.connect(w, 'onChange', 
51                         function(newVal) {
52
53                             // see if this attr def supports composite entries
54                             w.store.fetch({
55                               query : {virtual : ''+newVal}
56                             });
57                             
58                             cmfvmGrid.resetStore();
59                             cmfvmGrid.loadAll({order_by : {cmfvm : 'id'}}, {virtual : newVal});
60                             cmfvmGrid.overrideWidgetArgs.vritual = {dijitArgs : {value : newVal}};
61                             // ^-- why is this not working?
62                         }
63                     );
64
65                     // if a cmf is already selected via URL, fetch the cmfvm's
66                     if (cmfId) w.attr('value', cmfId);
67                 }
68             );
69
70             // hide the progress indicator since we're not loading any data up front
71             dojo.style(cmfvmGrid.loadProgressIndicator, 'visibility', 'hidden');
72         }
73     );
74
75 </script>
76
77 [% END %]