From e933770847e78b65aad5d635f74f2cd626e775c6 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 15 Dec 2005 14:55:56 +0000 Subject: [PATCH 1/1] patron.utils git-svn-id: svn://svn.open-ils.org/ILS/trunk@2398 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/patron/util.js | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Open-ILS/xul/staff_client/server/patron/util.js diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js new file mode 100644 index 0000000000..3aa7abdff5 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -0,0 +1,52 @@ +dump('entering patron/util.js\n'); + +if (typeof patron == 'undefined') var patron = {}; +patron.util = {}; + +patron.util.EXPORT_OK = [ + 'columns', 'std_map_row_to_column', 'retrieve_au_by_id' +]; +patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK }; + +patron.util.columns = function(modify) { + + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + + function getString(s) { return data.entities[s]; } + + var c = []; + for (var i = 0; i < c.length; i++) { + if (modify[ c[i].id ]) { + for (var j in modify[ c[i].id ]) { + c[i][j] = modify[ c[i].id ][j]; + } + } + } + return c; +} + +patron.util.std_map_row_to_column = function() { + return function(row,col) { + // row contains { 'my' : { 'acp' : {}, 'patron' : {}, 'mvr' : {} } } + // col contains one of the objects listed above in columns + + var obj = {}; obj.OpenILS = {}; + JSAN.use('util.error'); obj.error = new util.error(); + JSAN.use('OpenILS.data'); obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'}); + + var my = row.my; + var value; + try { + value = eval( col.render ); + } catch(E) { + obj.error.sdump('D_ERROR','map_row_to_column: ' + E); + value = '???'; + } + return value; + } +} + +patron.util.retrieve_au_by_id = function(session, id) { +} + +dump('exiting patron/util.js\n'); -- 2.43.2