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