]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/conify/global/config/marc_code_maps.html
19180a742d8640a943c0be4476c36068f6877f55
[Evergreen.git] / Open-ILS / web / conify / global / config / marc_code_maps.html
1 <!--
2 # Copyright (C) 2008  Georgia Public Library Service / Equinox Software, Inc
3 # Mike Rylander <miker@esilibrary.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 -->
15 <html xmlns="http://www.w3.org/1999/xhtml">
16         <head>
17                 <title>Confiy :: Global :: Permission :: Permission List</title>
18
19                 <style type="text/css">
20                         @import url("/js/dojo/dojox/grid/_grid/tundraGrid.css");
21                         @import url("/js/dojo/dojo/resources/dojo.css");
22                         @import url("/js/dojo/dijit/themes/tundra/tundra.css");
23                         @import url("/js/dojo/dojox/widget/Toaster/Toaster.css");
24                 </style>
25
26                 <style>
27                         html, body {
28                                 height: 100%;
29                                 width: 100%;
30                                 margin: 0px 0px 0px 0px;
31                                 padding: 0px 0px 0px 0px;
32                                 overflow: hidden;
33                         }
34
35                         #perm_grid {
36                                 border: 0px;
37                                 width: 100%;
38                                 height: 100%;
39                         }
40
41                         .grid_container {
42                                 width: 100%;
43                                 height: 100%;
44                                 overflow: scroll;
45                         }
46                 </style>
47
48                 <!-- The OpenSRF API writ JS -->
49                 <script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
50                 <script language='javascript' src='/opac/common/js/Cookies.js' type='text/javascript'></script>
51                 <script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
52                 <script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
53
54                 <!-- Dojo goodness -->
55                 <script type="text/javascript" src="/js/dojo/dojo/dojo.js.uncompressed.js" djConfig="parseOnLoad: true"></script>
56                 <script type="text/javascript" src="/js/dojo/dijit/dijit.js.uncompressed.js"></script>
57
58                 <script type="text/javascript" src="marc_code_maps.js"></script>
59
60                 <script type="text/javascript">
61                         var grid_row_object_cache = {};
62                         var layouts = {};
63
64             layouts.cam = [
65                 {   cells : [
66                         [
67                             { name : "Code", field : "code", width : "5em", editor : dojox.grid.editors.Dijit, rowSpan : "2" },
68                             { name : "Value", field : "value", width : "auto",  editor : dojox.grid.editors.Editor, style : "minHeight:1em;" },
69                             { name : "Description", field : "description", width : "auto",  editor : dojox.grid.editors.Editor, style : "minHeight:1em;" }
70                         ],
71                         [
72                             { name : "Translation",
73                               width : "10em",
74                               height : "2em",
75                               get : function (row) {
76                                 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
77                                 var r = this.grid.model.getRow(row);
78                                 if (r) {
79                                     grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
80                                     setTimeout(
81                                         'dojo.query(".cam_value_' + row + '").'+
82                                             'instantiate('+
83                                                                                                 'openils.widget.TranslatorPopup,{field:"value",'+
84                                                                                                 'unique:"cam_'+row+'",'+
85                                                 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
86                                                                                         ');'+
87                                         'cam_grid.rowHeightChanged('+row+');',
88                                         0
89                                     );
90                                     var oldnode = dojo.byId('value_translation_cam_' + row);
91                                     if (oldnode) dijit.byNode(oldnode).destroyRecursive();
92                                     return '<span class="cam_value_'+row+'"></span>';
93                                 }
94                                 return '';
95                               }
96                             },
97                             { name : "Translation",
98                               width : "10em",
99                               height : "2em",
100                               get : function (row) {
101                                 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
102                                 var r = this.grid.model.getRow(row);
103                                 if (r) {
104                                     grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
105                                     setTimeout(
106                                         'dojo.query(".cam_description_' + row + '").'+
107                                             'instantiate('+
108                                                                                                 'openils.widget.TranslatorPopup,{field:"description",'+
109                                                                                                 'unique:"cam_'+row+'",'+
110                                                 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
111                                                                                         ');'+
112                                         'cam_grid.rowHeightChanged('+row+');',
113                                         0
114                                     );
115                                     var oldnode = dojo.byId('description_translation_cam_' + row);
116                                     if (oldnode) dijit.byNode(oldnode).destroyRecursive();
117                                     return '<span class="cam_description_'+row+'"></span>';
118                                 }
119                                 return '';
120                               }
121                             }
122                         ]
123                     ]
124                 }
125             ];
126
127                         var codelist = ['cam','cblvl','cifm','citm','clm','clfm','cvrfm'];
128                         var hashes = {};
129                         var objects = {};
130                         var models = {};
131                         for (var i in codelist) {
132                                 var classname = codelist[i];
133
134                                 hashes[classname] = fieldmapper.standardRequest(
135                                         [ 'open-ils.fielder', 'open-ils.fielder.' + classname + '.atomic'],
136                                         [ { query : { code : { '!=' : null } } } ]
137                                 );
138
139                                 if (!hashes[classname]) continue;
140
141                                 objects[classname] = dojo.map(
142                                         hashes[classname].concat(),
143                                         new Function('x', 'return new fieldmapper.' + classname + '().fromHash( x );')
144                                 );
145
146                                 stores[classname] =  new dojo.data.ItemFileWriteStore(
147                                         { data : fieldmapper[classname].toStoreData( objects[classname], 'value' ) }
148                                 );
149
150                                 if (classname != 'cam') {
151                                         layouts[classname] = [
152                         {   cells : [
153                                 [
154                                     { name : "Code",  field : "code",  width : "5em",  editor : dojox.grid.editors.Dijit,  rowSpan : "2" },
155                                     { name : "Value", field : "value", width : "auto", editor : dojox.grid.editors.Editor, style : "minHeight:1em;" }
156                                 ],
157                                 [
158                                     { name : "Translation",
159                                       width : "10em",
160                                       height : "2em",
161                                       get : function (row) {
162                                         if (!grid_row_object_cache[classname]) grid_row_object_cache[classname] = [];
163                                         var r = this.grid.model.getRow(row);
164                                         if (r) {
165                                                 grid_row_object_cache[classname][row] = new fieldmapper[classname]().fromHash(this.grid.model.getRow(row));
166                                             setTimeout(
167                                                 'dojo.query(".'+classname+'_value_' + row + '").'+
168                                                     'instantiate('+
169                                                                                                         'openils.widget.TranslatorPopup,{field:"value",'+
170                                                                                                         'unique:"'+classname+'_'+row+'",'+
171                                                         'targetObject:"grid_row_object_cache.'+classname+'['+row+']"}'+
172                                                                                                 ');'+
173                                                 classname+'_grid.rowHeightChanged('+row+');',
174                                                 0
175                                             );
176                                             var oldnode = dojo.byId('value_translation_'+classname+'_' + row);
177                                             if (oldnode) dijit.byNode(oldnode).destroyRecursive();
178                                             return '<span class="'+classname+'_value_'+row+'"></span>';
179                                         }
180                                         return '';
181                                       }
182                                     }
183                                 ]
184                             ]
185                         }
186                     ];
187                                 }
188                         }
189
190                 </script>
191
192         </head>
193
194         <body class="tundra" id='pagebody'>
195
196                 <div dojoType="dijit.layout.TabContainer" class="grid_container" orientation="vertical">
197
198                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" label="Audience Map">
199
200                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
201                 
202                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin-top: 5px;" layoutAlign="top" onSubmit="create_marc_code">
203                                                 <div>New Audience Map:</div>
204                                                 <input type="hidden" name="classname" value="cam"/>
205                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
206                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
207                                                 <label for="description">Description</label><input dojoType="dijit.form.TextBox" name="description" title="Description"/>
208                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
209                                         </div>
210                 
211                                         <div dojoType="dijit.layout.ContentPane" style="width:100%; height:100%;" layoutAlign="client">
212                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cam_model"store="stores.cam" query="{ code : '*' }"></div>
213                                                 <div dojoType="dojox.Grid" jsId="cam_grid" model="cam_model" structure="layouts.cam"></div>
214                                                 <button jsId="delete_cam_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cam',cam_grid)"></button>
215                                         </div>
216                 
217                                 </div>
218
219                         </div>
220                 
221                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical">
222
223                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
224
225                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin-top: 5px;" layoutAlign="top" onSubmit="create_marc_code">
226                                                 <div>New Bib Level:</div>
227                                                 <input type="hidden" name="classname" value="cblvl"/>
228                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
229                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
230                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
231                                         </div>
232                 
233                                         <div dojoType="dijit.layout.ContentPane" style="width:100%; height:100%;" layoutAlign="client">
234                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cblvl_model"store="stores.cblvl" query="{ code : '*' }"></div>
235                                                 <div dojoType="dojox.Grid" jsId="cblvl_grid" model="cblvl_model" structure="layouts.cblvl"></div>
236                                                 <button jsId="delete_cblvl_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cblvl',cblvl_grid)"></button>
237                                         </div>
238         
239                                 </div>
240
241                         </div>
242
243                 </div>
244
245                 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 5px;" layoutAlign="bottom">
246                         <button jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
247                 </div>
248                 
249         </body>
250 </html>