]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/conify/global/config/marc_code_maps.html
14a569f4aff8d474959eae43e66bd4332fb94e4a
[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>Conify :: Global :: Config :: MARC Code Maps</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                         }
45                 </style>
46
47                 <!-- The OpenSRF API writ JS -->
48                 <script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
49                 <script language='javascript' src='/opac/common/js/Cookies.js' type='text/javascript'></script>
50                 <script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
51                 <script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
52
53                 <!-- Dojo goodness -->
54                 <script type="text/javascript" src="/js/dojo/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
55                 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
56
57                 <script type="text/javascript" src="marc_code_maps.js"></script>
58
59                 <script type="text/javascript">
60 <!--
61                         var grid_row_object_cache = {};
62                         var layouts = {};
63
64                         console.log('create the special layout for cam');
65
66             layouts.cam = [
67                 {   cells : [
68                         [
69                             { name : "Code", field : "code", width : "5em", editor : dojox.grid.editors.Dijit, rowSpan : "2" },
70                             { name : "Value", field : "value", width : "auto",  editor : dojox.grid.editors.Editor, style : "minHeight:1em;" },
71                             { name : "Description", field : "description", width : "auto",  editor : dojox.grid.editors.Editor, style : "minHeight:1em;" }
72                         ],
73                         [
74                             { name : "Translation",
75                               width : "10em",
76                               height : "2em",
77                               get : function (row) {
78                                 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
79                                 var r = this.grid.model.getRow(row);
80                                 if (r) {
81                                     grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
82                                     setTimeout(
83                                         'dojo.query(".cam_value_' + row + '").'+
84                                             'instantiate('+
85                                                                                                 'openils.widget.TranslatorPopup,{field:"value",'+
86                                                 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
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                                                 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
110                                                                                         ');cam_grid.rowHeightChanged('+row+');',
111                                         0
112                                     );
113                                     var oldnode = dojo.byId('description_translation_cam_' + row);
114                                     if (oldnode) dijit.byNode(oldnode).destroyRecursive();
115                                     return '<span class="cam_description_'+row+'"></span>';
116                                 }
117                                 return '';
118                               }
119                             }
120                         ]
121                     ]
122                 }
123             ];
124
125                         var codelist = ['cam','cblvl','cifm','citm','clm','clfm','cvrfm'];
126                         var hashes = {};
127                         var objects = {};
128                         var stores = {};
129
130                         console.log('about to loop over codelist: ' + codelist);
131
132                         for (var i in codelist) {
133
134                                 (function (classname) {
135
136                                         hashes[classname] = fieldmapper.standardRequest(
137                                                 [ 'open-ils.fielder', 'open-ils.fielder.' + classname + '.atomic'],
138                                                 [ { query : { code : { '!=' : null } } } ]
139                                         );
140
141                                         console.log('created hashes for ' + classname);
142
143                                         if (!hashes[classname]) return;
144
145                                         objects[classname] = dojo.map(
146                                                 hashes[classname].concat(),
147                                                 new Function('x', 'return new fieldmapper.' + classname + '().fromHash( x );')
148                                         );
149
150                                         console.log('created objects for ' + classname);
151
152                                         stores[classname] =  new dojo.data.ItemFileWriteStore(
153                                                 { data : fieldmapper[classname].toStoreData( objects[classname], 'value' ) }
154                                         );
155
156                                         console.log('create store for ' + classname);
157
158                                         if (classname != 'cam') {
159                                                 layouts[classname] = [
160                                             {   cells : [
161                                                         [
162                                                                 { name : "Code",  field : "code",  width : "5em",  editor : dojox.grid.editors.Dijit },
163                                                                     { name : "Value", field : "value", width : "auto", editor : dojox.grid.editors.Editor, style : "minHeight:1em;" },
164                                                                         { name : "Translation",
165                                                                               width : "10em",
166                                                                                   height : "2em",
167                                               get : function (row) {
168                                                     if (!grid_row_object_cache[classname]) grid_row_object_cache[classname] = [];
169                                                         var r = this.grid.model.getRow(row);
170                                                             if (r) {
171                                                                         grid_row_object_cache[classname][row] = new fieldmapper[classname]().fromHash(r);
172                                                                         setTimeout(
173                                                                                 'dojo.query(".'+classname+'_value_' + row + '").'+
174                                                                                         'instantiate('+
175                                                                                                                         'openils.widget.TranslatorPopup,{field:"value",'+
176                                                                                                         'targetObject:"grid_row_object_cache.'+classname+'['+row+']"}'+
177                                                                                                                 ');'+classname+'_grid.rowHeightChanged('+row+');',
178                                                         0
179                                                         );
180                                                                                                 var oldnode = dojo.byId('value_translation_' + classname + '_' + row);
181                                                                                                 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
182                                                                     return '<span class="'+classname+'_value_'+row+'"></span>';
183                                                                     }
184                                                                         return '';
185                                                                           }
186                                             }
187                                             ]
188                                             ]
189                                             }
190                                             ];
191                                         }
192                                 })(codelist[i])
193
194                         }
195 -->
196                 </script>
197
198         </head>
199
200         <body class="tundra" id='pagebody'>
201
202                 <div dojoType="dijit.layout.TabContainer" id="grid_container" class="grid_container" style="margin: 5px;" orientation="vertical" layoutAlign="top">
203
204                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Audience Map">
205                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
206                 
207                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
208                                                 <div>New Audience Map:</div>
209                                                 <input type="hidden" name="classname" value="cam"/>
210                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
211                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
212                                                 <label for="description">Description</label><input dojoType="dijit.form.TextBox" name="description" title="Description"/>
213                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
214                                                 <button style="margin-left:10px" layoutAlign="bottom" jsId="delete_cam_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cam',cam_grid)"></button>
215                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
216                                         </div>
217                 
218                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
219                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cam_model" store="stores.cam" query="{ code : '*' }"></div>
220                                                 <div dojoType="dojox.Grid" jsId="cam_grid">
221                                                         <script type="dojo/connect" event="startup">
222                                                                 this.setStructure(window.layouts.cam);
223                                                                 this.setModel(window.cam_model);
224                                                         </script>
225                                                 </div>
226
227                                         </div>
228                 
229                                 </div>
230
231                         </div>
232                 
233                         <div id="cblvl_pane" dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Bib Level Map">
234                                 <script type="dojo/connect" event="onShow">
235                                         if (!window.cblvl_once) setTimeout("cblvl_grid.render()",0);
236                                         window.cblvl_once = 1;
237                                 </script>
238                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
239
240                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
241                                                 <div>New Bib Level:</div>
242                                                 <input type="hidden" name="classname" value="cblvl"/>
243                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
244                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
245                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
246                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_cblvl_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cblvl',cblvl_grid)"></button>
247                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
248                                         </div>
249                 
250                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
251                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cblvl_model" store="stores.cblvl" query="{ code : '*' }"></div>
252                                                 <div dojoType="dojox.Grid"  jsId="cblvl_grid">
253                                                         <script type="dojo/connect" event="startup">
254                                                                 this.setStructure(window.layouts.cblvl);
255                                                                 this.setModel(window.cblvl_model);
256                                                         </script>
257                                                 </div>
258
259                                         </div>
260         
261                                 </div>
262
263                         </div>
264
265                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Item Form Map">
266                                 <script type="dojo/connect" event="onShow">
267                                         if (!window.cifm_once) setTimeout("cifm_grid.render()",0);
268                                         window.cifm_once = 1;
269                                 </script>
270                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
271
272                                         <div jsId="new_form_form" dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top">
273                                                 <div>New Item Form:</div>
274                                                 <input type="hidden" name="classname" value="cifm"/>
275                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
276                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
277                                                 <button dojoType="dijit.form.Button" label="Add" onclick="create_marc_code(new_form_form)"></button>
278
279                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_cifm_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cifm',cifm_grid)"></button>
280                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
281                                         </div>
282         
283                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
284                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cifm_model"store="stores.cifm" query="{ code : '*' }"></div>
285                                                 <div dojoType="dojox.Grid"  jsId="cifm_grid">
286                                                         <script type="dojo/connect" event="startup">
287                                                                 this.setStructure(window.layouts.cifm);
288                                                                 this.setModel(window.cifm_model);
289                                                         </script>
290                                                 </div>
291
292                                         </div>
293         
294                                 </div>
295
296                         </div>
297
298                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Item Type Map">
299                                 <script type="dojo/connect" event="onShow">
300                                         if (!window.citm_once) setTimeout("citm_grid.render()",0);
301                                         window.citm_once = 1;
302                                 </script>
303
304                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
305
306                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
307                                                 <div>New Item Type:</div>
308                                                 <input type="hidden" name="classname" value="citm"/>
309                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
310                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
311                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
312                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_citm_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('citm',citm_grid)"></button>
313                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
314                                         </div>
315                 
316                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
317                                                 <div dojoType="dojox.grid.data.DojoData" jsId="citm_model"store="stores.citm" query="{ code : '*' }"></div>
318                                                 <div dojoType="dojox.Grid"  jsId="citm_grid">
319                                                         <script type="dojo/connect" event="startup">
320                                                                 this.setStructure(window.layouts.citm);
321                                                                 this.setModel(window.citm_model);
322                                                         </script>
323                                                 </div>
324
325                                         </div>
326         
327                                 </div>
328
329                         </div>
330
331                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Language Map">
332                                 <script type="dojo/connect" event="onShow">
333                                         if (!window.clm_once) setTimeout("clm_grid.render()",0);
334                                         window.clm_once = 1;
335                                 </script>
336
337                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
338
339                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
340                                                 <div>New Language:</div>
341                                                 <input type="hidden" name="classname" value="clm"/>
342                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
343                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
344                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
345                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_clm_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('clm',clm_grid)"></button>
346                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
347                                         </div>
348                 
349                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
350                                                 <div dojoType="dojox.grid.data.DojoData" jsId="clm_model"store="stores.clm" query="{ code : '*' }"></div>
351                                                 <div dojoType="dojox.Grid"  jsId="clm_grid">
352                                                         <script type="dojo/connect" event="startup">
353                                                                 this.setStructure(window.layouts.clm);
354                                                                 this.setModel(window.clm_model);
355                                                         </script>
356                                                 </div>
357
358                                         </div>
359         
360                                 </div>
361
362                         </div>
363
364                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Literary Form Map">
365                                 <script type="dojo/connect" event="onShow">
366                                         if (!window.clfm_once) setTimeout("clfm_grid.render()",0);
367                                         window.clfm_once = 1;
368                                 </script>
369
370                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
371
372                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
373                                                 <div>New Literary Form:</div>
374                                                 <input type="hidden" name="classname" value="clfm"/>
375                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
376                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
377                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
378                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_clfm_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('clfm',clfm_grid)"></button>
379                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
380                                         </div>
381                 
382                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
383                                                 <div dojoType="dojox.grid.data.DojoData" jsId="clfm_model"store="stores.clfm" query="{ code : '*' }"></div>
384                                                 <div dojoType="dojox.Grid"  jsId="clfm_grid">
385                                                         <script type="dojo/connect" event="startup">
386                                                                 this.setStructure(window.layouts.clfm);
387                                                                 this.setModel(window.clfm_model);
388                                                         </script>
389                                                 </div>
390
391                                         </div>
392         
393                                 </div>
394
395                         </div>
396
397                         <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Videorecording Format Map">
398                                 <script type="dojo/connect" event="onShow">
399                                         if (!window.cvrfm_once) setTimeout("cvrfm_grid.render()",0);
400                                         window.cvrfm_once = 1;
401                                 </script>
402
403                                 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
404
405                                         <div dojoType="dijit.form.Form" orientation="horizontal" style="margin: 5px;" layoutAlign="top" onSubmit="create_marc_code">
406                                                 <div>New Video Recording Format:</div>
407                                                 <input type="hidden" name="classname" value="cvrfm"/>
408                                                 <label for="code">New Code</label><input dojoType="dijit.form.TextBox" name="code" title="New Code"/>
409                                                 <label for="value">New Value</label><input dojoType="dijit.form.TextBox" name="value" title="New Value"/>
410                                                 <button type="submit" dojoType="dijit.form.Button" label="Add"></button>
411                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="delete_cvrfm_button" dojoType="dijit.form.Button" label="Delete Selected" onclick="delete_grid_selection('cvrfm',cvrfm_grid)"></button>
412                                                 <button style="margin-left:20px" layoutAlign="bottom" jsId="save_button" dojoType="dijit.form.Button" label="Save Changes" onClick="save_them_all()"></button>
413                                         </div>
414                 
415                                         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
416                                                 <div dojoType="dojox.grid.data.DojoData" jsId="cvrfm_model"store="stores.cvrfm" query="{ code : '*' }"></div>
417                                                 <div dojoType="dojox.Grid"  jsId="cvrfm_grid">
418                                                         <script type="dojo/connect" event="startup">
419                                                                 this.setStructure(window.layouts.cvrfm);
420                                                                 this.setModel(window.cvrfm_model);
421                                                         </script>
422                                                 </div>
423
424                                         </div>
425         
426                                 </div>
427
428                 </div>
429
430                 </div>
431                 
432         </body>
433 </html>