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>Conify :: 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" djConfig="parseOnLoad: true"></script>
55 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
57 <script type="text/javascript" src="marc_code_maps.js"></script>
59 <script type="text/javascript">
61 var grid_row_object_cache = {};
64 console.log('create the special layout for cam');
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;" }
74 { name : "Translation",
77 get : function (row) {
78 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
79 var r = this.grid.model.getRow(row);
81 grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
83 'dojo.query(".cam_value_' + row + '").'+
85 'openils.widget.TranslatorPopup,{field:"value",'+
86 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
87 ');cam_grid.rowHeightChanged('+row+');',
90 var oldnode = dojo.byId('value_translation_cam_' + row);
91 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
92 return '<span class="cam_value_'+row+'"></span>';
97 { name : "Translation",
100 get : function (row) {
101 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
102 var r = this.grid.model.getRow(row);
104 grid_row_object_cache.cam[row] = new fieldmapper.cam().fromHash(this.grid.model.getRow(row));
106 'dojo.query(".cam_description_' + row + '").'+
108 'openils.widget.TranslatorPopup,{field:"description",'+
109 'targetObject:"grid_row_object_cache.cam['+row+']"}'+
110 ');cam_grid.rowHeightChanged('+row+');',
113 var oldnode = dojo.byId('description_translation_cam_' + row);
114 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
115 return '<span class="cam_description_'+row+'"></span>';
125 var codelist = ['cam','cblvl','cifm','citm','clm','clfm','cvrfm'];
130 console.log('about to loop over codelist: ' + codelist);
132 for (var i in codelist) {
134 (function (classname) {
136 hashes[classname] = fieldmapper.standardRequest(
137 [ 'open-ils.fielder', 'open-ils.fielder.' + classname + '.atomic'],
138 [ { query : { code : { '!=' : null } } } ]
141 console.log('created hashes for ' + classname);
143 if (!hashes[classname]) return;
145 objects[classname] = dojo.map(
146 hashes[classname].concat(),
147 new Function('x', 'return new fieldmapper.' + classname + '().fromHash( x );')
150 console.log('created objects for ' + classname);
152 stores[classname] = new dojo.data.ItemFileWriteStore(
153 { data : fieldmapper[classname].toStoreData( objects[classname], 'value' ) }
156 console.log('create store for ' + classname);
158 if (classname != 'cam') {
159 layouts[classname] = [
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",
167 get : function (row) {
168 if (!grid_row_object_cache[classname]) grid_row_object_cache[classname] = [];
169 var r = this.grid.model.getRow(row);
171 grid_row_object_cache[classname][row] = new fieldmapper[classname]().fromHash(r);
173 'dojo.query(".'+classname+'_value_' + row + '").'+
175 'openils.widget.TranslatorPopup,{field:"value",'+
176 'targetObject:"grid_row_object_cache.'+classname+'['+row+']"}'+
177 ');'+classname+'_grid.rowHeightChanged('+row+');',
180 var oldnode = dojo.byId('value_translation_' + classname + '_' + row);
181 if (oldnode) dijit.byNode(oldnode).destroyRecursive();
182 return '<span class="'+classname+'_value_'+row+'"></span>';
200 <body class="tundra" id='pagebody'>
202 <div dojoType="dijit.layout.TabContainer" id="grid_container" class="grid_container" style="margin: 5px;" orientation="vertical" layoutAlign="top">
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">
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>
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);
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;
238 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
270 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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>
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);
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;
304 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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);
337 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
370 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);
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;
403 <div dojoType="dijit.layout.LayoutContainer" class="grid_container" orientation="vertical">
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>
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);