2 # Copyright (C) 2008 Georgia Public Library Service / Equinox Software, Inc
3 # Mike Rylander <miker@esilibrary.com>
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.
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.
15 <html xmlns="http://www.w3.org/1999/xhtml">
17 <title>Confiy :: Global :: Config :: MARC Code Maps</title>
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");
30 margin: 0px 0px 0px 0px;
31 padding: 0px 0px 0px 0px;
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>
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>
57 <script type="text/javascript" src="marc_code_maps.js"></script>
59 <script type="text/javascript">
60 var grid_row_object_cache = {};
63 console.log('create the special layout for cam');
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;" }
73 { name : "Translation",
76 get : function (row) {
77 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
78 var r = this.grid.model.getRow(row);
80 grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
82 'dojo.query(".cam_value_' + row + '").'+
84 'openils.widget.TranslatorPopup,{field:"value",'+
85 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
86 ');cam_grid.rowHeightChanged('+row+');',
89 var oldnode = dojo.byId('value_translation_cam_' + row);
90 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
91 return '<span class="cam_value_'+row+'"></span>';
96 { name : "Translation",
99 get : function (row) {
100 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
101 var r = this.grid.model.getRow(row);
103 grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
105 'dojo.query(".cam_description_' + row + '").'+
107 'openils.widget.TranslatorPopup,{field:"description",'+
108 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
109 ');cam_grid.rowHeightChanged('+row+');',
112 var oldnode = dojo.byId('description_translation_cam_' + row);
113 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
114 return '<span class="cam_description_'+row+'"></span>';
124 var codelist = ['cam','cblvl','cifm','citm','clm','clfm','cvrfm'];
129 console.log('about to loop over codelist: ' + codelist);
131 for (var i in codelist) {
133 (function (classname) {
135 hashes[classname] = fieldmapper.standardRequest(
136 [ 'open-ils.fielder', 'open-ils.fielder.' + classname + '.atomic'],
137 [ { query : { code : { '!=' : null } } } ]
140 console.log('created hashes for ' + classname);
142 if (!hashes[classname]) return;
144 objects[classname] = dojo.map(
145 hashes[classname].concat(),
146 new Function('x', 'return new fieldmapper.' + classname + '().fromHash( x );')
149 console.log('created objects for ' + classname);
151 stores[classname] = new dojo.data.ItemFileWriteStore(
152 { data : fieldmapper[classname].toStoreData( objects[classname], 'value' ) }
155 console.log('create store for ' + classname);
157 if (classname != 'cam') {
158 layouts[classname] = [
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",
166 get : function (row) {
167 if (!grid_row_object_cache[classname]) grid_row_object_cache[classname] = [];
168 var r = this.grid.model.getRow(row);
170 grid_row_object_cache[classname][row] = new fieldmapper[classname]().fromHash(r);
172 'dojo.query(".'+classname+'_value_' + row + '").'+
174 'openils.widget.TranslatorPopup,{field:"value",'+
175 'targetObject:"grid_row_object_cache.'+classname+'['+row+']"}'+
176 ');'+classname+'_grid.rowHeightChanged('+row+');',
179 var oldnode = dojo.byId('value_translation_' + classname + '_' + row);
180 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
181 return '<span class="'+classname+'_value_'+row+'"></span>';
199 <body class="tundra" id='pagebody'>
201 <div dojoType="dijit.layout.TabContainer" id="grid_container" class="grid_container" style="margin: 5px;" orientation="vertical" layoutAlign="top">
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">
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>
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);
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;
237 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
269 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
302 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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);
335 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
368 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
395 <div dojoType="dijit.layout.ContentPane" class="grid_container" orientation="vertical" title="Videorecording Format Map">
396 <script type="dojo/connect" event="onShow">
397 if (!window.cvrfm_once) setTimeout("cvrfm_grid.render()",0);
398 window.cvrfm_once = 1;
401 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);