moved vandelay into the new TT infrastructure. still using dtd for now.
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 8 May 2009 20:43:22 +0000 (20:43 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 8 May 2009 20:43:22 +0000 (20:43 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13109 dcc99617-32d9-48b4-a31d-7c20da2025e4

24 files changed:
Open-ILS/web/css/skin/default/vandelay.css [new file with mode: 0644]
Open-ILS/web/js/ui/default/vandelay/vandelay.js [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/attrs.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/export.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/marchtml.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/matches.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/progress.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/queue.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/queueselect.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/toolbar.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/inc/upload.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/vandelay.tt2 [new file with mode: 0644]
Open-ILS/web/vandelay/inc/attrs.xml [deleted file]
Open-ILS/web/vandelay/inc/export.xml [deleted file]
Open-ILS/web/vandelay/inc/marchtml.xml [deleted file]
Open-ILS/web/vandelay/inc/matches.xml [deleted file]
Open-ILS/web/vandelay/inc/progress.xml [deleted file]
Open-ILS/web/vandelay/inc/queue.xml [deleted file]
Open-ILS/web/vandelay/inc/queueselect.xml [deleted file]
Open-ILS/web/vandelay/inc/toolbar.xml [deleted file]
Open-ILS/web/vandelay/inc/upload.xml [deleted file]
Open-ILS/web/vandelay/vandelay.css [deleted file]
Open-ILS/web/vandelay/vandelay.js [deleted file]
Open-ILS/web/vandelay/vandelay.xml [deleted file]

diff --git a/Open-ILS/web/css/skin/default/vandelay.css b/Open-ILS/web/css/skin/default/vandelay.css
new file mode 100644 (file)
index 0000000..40cae55
--- /dev/null
@@ -0,0 +1,38 @@
+@import "/js/dojo/dojo/resources/dojo.css";
+@import "/js/dojo/dijit/themes/tundra/tundra.css";
+@import "/js/dojo/dojox/grid/_grid/Grid.css";
+@import "/js/dojo/dojox/grid/resources/tundraGrid.css";
+
+.container:after {content: ""; display: block; height: 0; clear: both; }
+html,body { width:100%; height:100%; border:0; margin:0; padding:0; background-color:white; }
+table { border-collapse: collapse; }
+table.dijitTooltipTable { border-collapse: separate; }
+.content { padding: 5px; }
+.form_table td { padding: 6px; }
+.small_form_table td { padding: 1px; }
+.match_div {
+    height: 95%;
+    width: 95%;
+}
+.match_div a {
+    color: red;
+    font-weight:bold;
+}
+.match_div a:visited {
+    color: red;
+    font-weight:bold;
+}
+.tall { height:600px; }
+.wide { width:100%; }
+.hidden { display: none; }
+#toolbar { margin-top: 0px; }
+.progress {margin: 20px;}
+.overlay_selected { 
+    padding: 2px; 
+    background: #d9e8f9;
+    border: 1px solid red; 
+}
+
+.export_tr_border td { border-top: 1px solid #808080; }
+.nav_row_div {padding:1px; text-align:center; }
+.toolbar_selected { border: 2px dashed #808080; text-decoration:underline; font-weight:bold;}
diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js
new file mode 100644 (file)
index 0000000..5a8ed06
--- /dev/null
@@ -0,0 +1,1131 @@
+/* ---------------------------------------------------------------------------
+# Copyright (C) 2008  Georgia Public Library Service
+# Bill Erickson <erickson@esilibrary.com>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# --------------------------------------------------------------------------- */
+dojo.require("dojo.parser");
+dojo.require("dojo.io.iframe"); 
+dojo.require("dijit.ProgressBar"); 
+dojo.require("dijit.form.FilteringSelect"); 
+dojo.require("dijit.layout.ContentPane");
+dojo.require("dijit.layout.TabContainer");
+dojo.require("dijit.layout.LayoutContainer");
+dojo.require('dijit.form.Button');
+dojo.require('dijit.form.CheckBox');
+dojo.require('dijit.Toolbar');
+dojo.require('dijit.Tooltip');
+dojo.require('dijit.Menu');
+dojo.require("dijit.Dialog");
+dojo.require("dojo.cookie");
+dojo.require('dojox.grid.DataGrid');
+dojo.require("dojo.data.ItemFileReadStore");
+dojo.require('dojo.date.locale');
+dojo.require('dojo.date.stamp');
+dojo.require("fieldmapper.Fieldmapper");
+dojo.require("fieldmapper.dojoData");
+dojo.require('openils.CGI');
+dojo.require('openils.User');
+dojo.require('openils.Event');
+dojo.require('openils.Util');
+dojo.require('openils.MarcXPathParser');
+dojo.require('openils.widget.GridColumnPicker');
+
+
+var globalDivs = [
+    'vl-generic-progress',
+    'vl-generic-progress-with-total',
+    'vl-marc-upload-div',
+    'vl-queue-div',
+    'vl-match-div',
+    'vl-marc-html-div',
+    'vl-queue-select-div',
+    'vl-marc-upload-status-div',
+    'vl-attr-editor-div',
+    'vl-marc-export-div'
+];
+
+var authtoken;
+var VANDELAY_URL = '/vandelay-upload';
+var bibAttrDefs = [];
+var authAttrDefs = [];
+var queuedRecords = [];
+var queuedRecordsMap = {};
+var bibAttrsFetched = false;
+var authAttrsFetched = false;
+var attrDefMap = {}; // maps attr def code names to attr def ids
+var currentType;
+var currentQueueId = null;
+var userCache = {};
+var currentMatchedRecords; // set of loaded matched bib records
+var currentOverlayRecordsMap; // map of import record to overlay record
+var currentOverlayRecordsMapGid; // map of import record to overlay record grid id
+var currentImportRecId; // when analyzing matches, this is the current import record
+var userBibQueues = []; // only non-complete queues
+var userAuthQueues = []; // only non-complete queues
+var allUserBibQueues;
+var allUserAuthQueues;
+var selectableGridRecords;
+var cgi = new openils.CGI();
+var vlQueueGridColumePicker = {};
+var vlBibSources = [];
+
+/**
+  * Grab initial data
+  */
+function vlInit() {
+    authtoken = openils.User.authtoken;
+    var initNeeded = 5; // how many async responses do we need before we're init'd 
+    var initCount = 0; // how many async reponses we've received
+
+    openils.Util.registerEnterHandler(
+        vlQueueDisplayPage.domNode, function(){retrieveQueuedRecords();});
+    openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
+
+    function checkInitDone() {
+        initCount++;
+        if(initCount == initNeeded)
+            runStartupCommands();
+    }
+
+    // Fetch the bib and authority attribute definitions 
+    vlFetchBibAttrDefs(function () { checkInitDone(); });
+    vlFetchAuthAttrDefs(function () { checkInitDone(); });
+
+    vlRetrieveQueueList('bib', null, 
+        function(list) {
+            allUserBibQueues = list;
+            for(var i = 0; i < allUserBibQueues.length; i++) {
+                if(allUserBibQueues[i].complete() == 'f')
+                    userBibQueues.push(allUserBibQueues[i]);
+            }
+            checkInitDone();
+        }
+    );
+
+    vlRetrieveQueueList('auth', null, 
+        function(list) {
+            allUserAuthQueues = list;
+            for(var i = 0; i < allUserAuthQueues.length; i++) {
+                if(allUserAuthQueues[i].complete() == 'f')
+                    userAuthQueues.push(allUserAuthQueues[i]);
+            }
+            checkInitDone();
+        }
+    );
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.cbs.atomic'],
+        {   async: true,
+            params: [authtoken, {id:{"!=":null}}, {order_by:{cbs:'id'}}],
+            oncomplete : function(r) {
+                vlBibSources = openils.Util.readResponse(r, false, true);
+                checkInitDone();
+            }
+        }
+    );
+
+    vlAttrEditorInit();
+}
+
+
+openils.Util.addOnLoad(vlInit);
+
+
+// fetch the bib and authority attribute definitions
+
+function vlFetchBibAttrDefs(postcomplete) {
+    bibAttrDefs = [];
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
+        {   async: true,
+            params: [authtoken, {id:{'!=':null}}],
+            onresponse: function(r) {
+                var def = r.recv().content(); 
+                if(e = openils.Event.parse(def[0])) 
+                    return alert(e);
+                bibAttrDefs.push(def);
+            },
+            oncomplete: function() {
+                bibAttrDefs = bibAttrDefs.sort(
+                    function(a, b) {
+                        if(a.id() > b.id()) return 1;
+                        if(a.id() < b.id()) return -1;
+                        return 0;
+                    }
+                );
+                postcomplete();
+            }
+        }
+    );
+}
+
+function vlFetchAuthAttrDefs(postcomplete) {
+    authAttrDefs = [];
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.vqarad'],
+        {   async: true,
+            params: [authtoken, {id:{'!=':null}}],
+            onresponse: function(r) {
+                var def = r.recv().content(); 
+                if(e = openils.Event.parse(def[0])) 
+                    return alert(e);
+                authAttrDefs.push(def);
+            },
+            oncomplete: function() {
+                authAttrDefs = authAttrDefs.sort(
+                    function(a, b) {
+                        if(a.id() > b.id()) return 1;
+                        if(a.id() < b.id()) return -1;
+                        return 0;
+                    }
+                );
+                postcomplete();
+            }
+        }
+    );
+}
+
+function vlRetrieveQueueList(type, filter, onload) {
+    type = (type == 'bib') ? type : 'authority';
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.owner.retrieve.atomic'],
+        {   async: true,
+            params: [authtoken, null, filter],
+            oncomplete: function(r) {
+                var list = r.recv().content();
+                if(e = openils.Event.parse(list[0]))
+                    return alert(e);
+                onload(list);
+            }
+        }
+    );
+
+}
+
+function displayGlobalDiv(id) {
+    for(var i = 0; i < globalDivs.length; i++) {
+        try {
+            dojo.style(dojo.byId(globalDivs[i]), 'display', 'none');
+        } catch(e) {
+            alert('please define div ' + globalDivs[i]);
+        }
+    }
+    dojo.style(dojo.byId(id),'display','block');
+
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
+
+    switch(id) {
+        case 'vl-marc-export-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
+            break;
+        case 'vl-marc-upload-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
+            break;
+        case 'vl-queue-select-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
+            break;
+        case 'vl-attr-editor-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
+            break;
+    }
+}
+
+function runStartupCommands() {
+    currentQueueId = cgi.param('qid');
+    currentType = cgi.param('qtype');
+    dojo.style('vl-nav-bar', 'visibility', 'visible');
+    if(currentQueueId)
+        return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+    vlShowUploadForm();
+}
+
+/**
+  * asynchronously upload a file of MARC records
+  */
+function uploadMARC(onload){
+    dojo.byId('vl-upload-status-count').innerHTML = '0';
+    dojo.byId('vl-ses-input').value = authtoken;
+    displayGlobalDiv('vl-marc-upload-status-div');
+    dojo.io.iframe.send({
+        url: VANDELAY_URL,
+        method: "post",
+        handleAs: "html",
+        form: dojo.byId('vl-marc-upload-form'),
+        handle: function(data,ioArgs){
+            var content = data.documentElement.textContent;
+            onload(content);
+        }
+    });
+}      
+
+/**
+  * Creates a new vandelay queue
+  */
+function createQueue(queueName, type, onload) {
+    var name = (type=='bib') ? 'bib' : 'authority';
+    var method = 'open-ils.vandelay.'+ name +'_queue.create'
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', method],
+        {   async: true,
+            params: [authtoken, queueName, null, name],
+            oncomplete : function(r) {
+                var queue = r.recv().content();
+                if(e = openils.Event.parse(queue)) 
+                    return alert(e);
+                onload(queue);
+            }
+        }
+    );
+}
+
+/**
+  * Tells vandelay to pull a batch of records from the cache and explode them
+  * out into the vandelay tables
+  */
+function processSpool(key, queueId, type, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'.process_spool'],
+        {   async: true,
+            params: [authtoken, key, queueId],
+            onresponse : function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp)) 
+                    return alert(e);
+                dojo.byId('vl-upload-status-count').innerHTML = resp;
+            },
+            oncomplete : function(r) {onload();}
+        }
+    );
+}
+
+function retrieveQueuedRecords(type, queueId, onload) {
+    displayGlobalDiv('vl-generic-progress');
+    queuedRecords = [];
+    queuedRecordsMap = {};
+    currentOverlayRecordsMap = {};
+    currentOverlayRecordsMapGid = {};
+    selectableGridRecords = {};
+    //resetVlQueueGridLayout();
+
+    if(!type) type = currentType;
+    if(!queueId) queueId = currentQueueId;
+    if(!onload) onload = handleRetrieveRecords;
+
+    var method = 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic';
+    if(vlQueueGridShowMatches.checked)
+        method = method.replace('records', 'records.matches');
+
+    var sel = dojo.byId('vl-queue-display-limit-selector');
+    var limit = parseInt(sel.options[sel.selectedIndex].value);
+    var offset = limit * parseInt(vlQueueDisplayPage.attr('value')-1);
+
+    var params =  [authtoken, queueId, {clear_marc: 1, offset: offset, limit: limit}];
+    if(vlQueueGridShowNonImport.checked)
+        params[2].non_imported = 1;
+
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', method],
+        {   async: true,
+            params: params,
+            /*
+            onresponse: function(r) {
+                console.log("ONREPONSE");
+                var rec = r.recv().content();
+                if(e = openils.Event.parse(rec))
+                    return alert(e);
+                console.log("got record " + rec.id());
+                queuedRecords.push(rec);
+                queuedRecordsMap[rec.id()] = rec;
+            },
+            */
+            oncomplete: function(r){
+                var recs = r.recv().content();
+                if(e = openils.Event.parse(recs[0]))
+                    return alert(e);
+                for(var i = 0; i < recs.length; i++) {
+                    var rec = recs[i];
+                    queuedRecords.push(rec);
+                    queuedRecordsMap[rec.id()] = rec;
+                }
+                onload();
+            }
+        }
+    );
+}
+
+function vlLoadMatchUI(recId) {
+    displayGlobalDiv('vl-generic-progress');
+    var matches = queuedRecordsMap[recId].matches();
+    var records = [];
+    currentImportRecId = recId;
+    for(var i = 0; i < matches.length; i++)
+        records.push(matches[i].eg_record());
+
+    var retrieve = ['open-ils.search', 'open-ils.search.biblio.record_entry.slim.retrieve'];
+    var params = [records];
+    if(currentType == 'auth') {
+        retrieve = ['open-ils.cat', 'open-ils.cat.authority.record.retrieve'];
+        parmas = [authtoken, records, {clear_marc:1}];
+    }
+
+    fieldmapper.standardRequest(
+        retrieve,
+        {   async: true,
+            params:params,
+            oncomplete: function(r) {
+                var recs = r.recv().content();
+                if(e = openils.Event.parse(recs))
+                    return alert(e);
+
+                /* ui mangling */
+                displayGlobalDiv('vl-match-div');
+                resetVlMatchGridLayout();
+                currentMatchedRecords = recs;
+                vlMatchGrid.setStructure(vlMatchGridLayout);
+
+                // build the data store of records with match information
+                var dataStore = bre.toStoreData(recs, null, 
+                    {virtualFields:['dest_matchpoint', 'src_matchpoint', '_id']});
+                dataStore.identifier = '_id';
+
+                var matchSeenMap = {};
+
+                for(var i = 0; i < dataStore.items.length; i++) {
+                    var item = dataStore.items[i];
+                    item._id = i; // just need something unique
+                    for(var j = 0; j < matches.length; j++) {
+                        var match = matches[j];
+                        if(match.eg_record() == item.id && !matchSeenMap[match.id()]) {
+                            item.dest_matchpoint = match.field_type();
+                            var attr = getRecAttrFromMatch(queuedRecordsMap[recId], match);
+                            item.src_matchpoint = getRecAttrDefFromAttr(attr, currentType).code();
+                            matchSeenMap[match.id()] = 1;
+                            break;
+                        }
+                    }
+                }
+
+                // now populate the grid
+                vlPopulateMatchGrid(vlMatchGrid, dataStore);
+            }
+        }
+    );
+}
+
+function vlPopulateMatchGrid(grid, data) {
+    var store = new dojo.data.ItemFileReadStore({data:data});
+    grid.setStore(store);
+    grid.update();
+}
+
+function showMe(id) {
+    dojo.style(dojo.byId(id), 'display', 'block');
+}
+function hideMe(id) {
+    dojo.style(dojo.byId(id), 'display', 'none');
+}
+
+
+function vlLoadMARCHtml(recId, inCat, oncomplete) {
+    dijit.byId('vl-marc-html-done-button').onClick = oncomplete;
+    displayGlobalDiv('vl-generic-progress');
+    var api;
+    var params = [recId, 1];
+
+    if(inCat) {
+        hideMe('vl-marc-html-edit-button'); // don't show marc editor button
+        dijit.byId('vl-marc-html-edit-button').onClick = function(){}
+        api = ['open-ils.search', 'open-ils.search.biblio.record.html'];
+        if(currentType == 'auth')
+            api = ['open-ils.search', 'open-ils.search.authority.to_html'];
+    } else {
+        showMe('vl-marc-html-edit-button'); // plug in the marc editor button
+        dijit.byId('vl-marc-html-edit-button').onClick = 
+            function() {vlLoadMarcEditor(currentType, recId, oncomplete);};
+        params = [authtoken, recId];
+        api = ['open-ils.vandelay', 'open-ils.vandelay.queued_bib_record.html'];
+        if(currentType == 'auth')
+            api = ['open-ils.vandelay', 'open-ils.vandelay.queued_authority_record.html'];
+    }
+
+    fieldmapper.standardRequest(
+        api, 
+        {   async: true,
+            params: params,
+            oncomplete: function(r) {
+            displayGlobalDiv('vl-marc-html-div');
+                var html = r.recv().content();
+                dojo.byId('vl-marc-record-html').innerHTML = html;
+            }
+        }
+    );
+}
+
+
+/*
+function getRecMatchesFromAttrCode(rec, attrCode) {
+    var matches = [];
+    var attr = getRecAttrFromCode(rec, attrCode);
+    for(var j = 0; j < rec.matches().length; j++) {
+        var match = rec.matches()[j];
+        if(match.matched_attr() == attr.id()) 
+            matches.push(match);
+    }
+    return matches;
+}
+*/
+
+function getRecAttrFromMatch(rec, match) {
+    for(var i = 0; i < rec.attributes().length; i++) {
+        var attr = rec.attributes()[i];
+        if(attr.id() == match.matched_attr())
+            return attr;
+    }
+}
+
+function getRecAttrDefFromAttr(attr, type) {
+    var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
+    for(var i = 0; i < defs.length; i++) {
+        var def = defs[i];
+        if(def.id() == attr.field())
+            return def;
+    }
+}
+
+function getRecAttrFromCode(rec, attrCode) {
+    var defId = attrDefMap[currentType][attrCode];
+    var attrs = rec.attributes();
+    for(var i = 0; i < attrs.length; i++) {
+        var attr = attrs[i];
+        if(attr.field() == defId) 
+            return attr;
+    }
+    return null;
+}
+
+function vlGetViewMatches(rowIdx, item) {
+    if(!item) return '';
+    var id = this.grid.store.getValue(item, 'id');
+    var rec = queuedRecordsMap[id];
+    if(rec.matches().length > 0)
+        return this.value.replace('RECID', id);
+    return '';
+}
+
+function getAttrValue(rowIdx, item) {
+    if(!item) return '';
+    var attrCode = this.field.split('.')[1];
+    var rec = queuedRecordsMap[this.grid.store.getValue(item, 'id')];
+    var attr = getRecAttrFromCode(rec, attrCode);
+    return (attr) ? attr.attr_value() : '';
+}
+
+function vlGetDateTimeField(rowIdx, item) {
+    if(!item) return '';
+    var value = this.grid.store.getValue(item, this.field);
+    if(!value) return '';
+    var date = dojo.date.stamp.fromISOString(value);
+    return dojo.date.locale.format(date, {selector:'date'});
+}
+
+function vlGetCreator(rowIdx, item) {
+    if(!item) return '';
+    var id = this.grid.store.getValue(item, 'creator');
+    if(userCache[id])
+        return userCache[id].usrname();
+    var user = fieldmapper.standardRequest(
+        ['open-ils.actor', 'open-ils.actor.user.retrieve'], [authtoken, id]);
+    if(e = openils.Event.parse(user))
+        return alert(e);
+    userCache[id] = user;
+    return user.usrname();
+}
+
+function vlGetViewMARC(rowIdx, item) {
+    if(!item) return '';
+    return this.value.replace('RECID', this.grid.store.getValue(item, 'id'));
+}
+
+function vlGetOverlayTargetSelector(rowIdx, item) {
+    if(!item) return '';
+    var _id = this.grid.store.getValue(item, '_id');
+    var id = this.grid.store.getValue(item, 'id');
+    var value = this.value.replace(/GRIDID/g, _id);
+    value = value.replace(/RECID/g, currentImportRecId);
+    value = value.replace(/ID/g, id);
+    if(_id == currentOverlayRecordsMapGid[currentImportRecId])
+        return value.replace('/>', 'checked="checked"/>');
+    return value;
+}
+
+/**
+  * see if the user has enabled overlays for the current match set and, 
+  * if so, map the current import record to the overlay target.
+  */
+function vlHandleOverlayTargetSelected(recId, gridId) {
+    var noneSelected = true;
+    var checkboxes = dojo.query('[name=vl-overlay-target-'+currentImportRecId+']');
+    for(var i = 0; i < checkboxes.length; i++) {
+        var checkbox = checkboxes[i];
+        var matchRecId = checkbox.getAttribute('match');
+        var gid = checkbox.getAttribute('gridid');
+        if(checkbox.checked) {
+            if(matchRecId == recId && gid == gridId) {
+                noneSelected = false;
+                currentOverlayRecordsMap[currentImportRecId] = matchRecId;
+                currentOverlayRecordsMapGid[currentImportRecId] = gid;
+                dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = true;
+                dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = 'overlay_selected';
+            } else {
+                checkbox.checked = false;
+            }
+        }
+    }
+
+    if(noneSelected) {
+        delete currentOverlayRecordsMap[currentImportRecId];
+        delete currentOverlayRecordsMapGid[currentImportRecId];
+        dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = false;
+        dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = '';
+    }
+}
+
+var valLastQueueType = null;
+function buildRecordGrid(type) {
+    displayGlobalDiv('vl-queue-div');
+
+    if(type == 'bib') {
+        openils.Util.show('vl-bib-queue-grid-wrapper');
+        openils.Util.hide('vl-auth-queue-grid-wrapper');
+        vlQueueGrid = vlBibQueueGrid;
+        vlQueueGridMenu = vlBibQueueGridMenu;
+    } else {
+        openils.Util.show('vl-auth-queue-grid-wrapper');
+        openils.Util.hide('vl-bib-queue-grid-wrapper');
+        vlQueueGrid = vlAuthQueueGrid;
+        vlQueueGridMenu = vlAuthQueueGridMenu;
+    }
+
+    if(valLastQueueType != type) {
+        valLastQueueType = type;
+        resetVlQueueGridLayout();
+        var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
+        attrDefMap[type] = {};
+        for(var i = 0; i < defs.length; i++) {
+            var def = defs[i]
+            attrDefMap[type][def.code()] = def.id();
+            var col = {
+                name:def.description(), 
+                field:'attr.' + def.code(),
+                get: getAttrValue,
+                selectableColumn:true
+            };
+            vlQueueGridLayout[0].cells[0].push(col);
+        }
+    }
+
+    var storeData;
+    if(type == 'bib')
+        storeData = vqbr.toStoreData(queuedRecords);
+    else
+        storeData = vqar.toStoreData(queuedRecords);
+
+    var store = new dojo.data.ItemFileReadStore({data:storeData});
+    vlQueueGrid.setStore(store);
+
+    if(vlQueueGridColumePicker[type]) {
+        vlQueueGrid.update();
+    } else {
+        vlQueueGrid.attr('structure', vlQueueGridLayout);
+        vlQueueGridMenu.init({
+            grid : vlQueueGrid, 
+            authtoken : authtoken, 
+            prefix : 'vandelay.queue.'+type
+        });
+        vlQueueGridMenu.load();
+        vlQueueGridColumePicker[type] = vlQueueGridMenu;
+    }
+}
+
+function vlQueueGridPrevPage() {
+    var page = parseInt(vlQueueDisplayPage.getValue());
+    if(page < 2) return;
+    vlQueueDisplayPage.setValue(page - 1);
+    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+}
+
+function vlQueueGridNextPage() {
+    vlQueueDisplayPage.setValue(parseInt(vlQueueDisplayPage.getValue())+1);
+    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+}
+
+function vlDeleteQueue(type, queueId, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.delete'],
+        {   async: true,
+            params: [authtoken, queueId],
+            oncomplete: function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp))
+                    return alert(e);
+                onload();
+            }
+        }
+    );
+}
+
+
+function vlQueueGridDrawSelectBox(rowIdx, item) {
+    if(!item) return '';
+    var id = this.grid.store.getValue(item, 'id');
+    var domId = 'vl-record-list-selected-' + id;
+    selectableGridRecords[domId] = id;
+    return "<div><input type='checkbox' id='"+domId+"'/></div>";
+}
+
+function vlSelectAllQueueGridRecords() {
+    for(var id in selectableGridRecords) 
+        dojo.byId(id).checked = true;
+}
+function vlSelectNoQueueGridRecords() {
+    for(var id in selectableGridRecords) 
+        dojo.byId(id).checked = false;
+}
+function vlToggleQueueGridSelect() {
+    if(dojo.byId('vl-queue-grid-row-selector').checked)
+        vlSelectAllQueueGridRecords();
+    else
+        vlSelectNoQueueGridRecords();
+}
+
+var handleRetrieveRecords = function() {
+    buildRecordGrid(currentType);
+    vlFetchQueueSummary(currentQueueId, currentType, 
+        function(summary) {
+            dojo.byId('vl-queue-summary-name').innerHTML = summary.queue.name();
+            dojo.byId('vl-queue-summary-total-count').innerHTML = summary.total +'';
+            dojo.byId('vl-queue-summary-import-count').innerHTML = summary.imported + '';
+        }
+    );
+}
+
+function vlFetchQueueSummary(qId, type, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.summary.retrieve'],
+        {   async: true,
+            params: [authtoken, qId],
+            oncomplete : function(r) {
+                var summary = r.recv().content();
+                if(e = openils.Event.parse(summary))
+                    return alert(e);
+                return onload(summary);
+            }
+        }
+    );
+}
+    
+
+function vlImportSelectedRecords() {
+    displayGlobalDiv('vl-generic-progress-with-total');
+    var records = [];
+
+    for(var id in selectableGridRecords) {
+        if(dojo.byId(id).checked) {
+            var recId = selectableGridRecords[id];
+            var rec = queuedRecordsMap[recId];
+            if(!rec.import_time()) 
+                records.push(recId);
+        }
+    }
+
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+currentType+'_record.list.import'],
+        {   async: true,
+            params: [authtoken, records, {overlay_map:currentOverlayRecordsMap}],
+            onresponse: function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp))
+                    return alert(e);
+                if(resp.complete) {
+                    return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+                } else {
+                    vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+                }
+            }, 
+        }
+    );
+}
+
+function vlImportAllRecords() {
+    vlImportRecordQueue(currentType, currentQueueId, false,
+        function(){displayGlobalDiv('vl-queue-div');});
+}
+
+function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
+    displayGlobalDiv('vl-generic-progress-with-total');
+    var method = 'open-ils.vandelay.bib_queue.import';
+    if(noMatchOnly)
+        method = method.replace('import', 'nomatch.import');
+    if(type == 'auth')
+        method = method.replace('bib', 'auth');
+
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', method],
+        {   async: true,
+            params: [authtoken, queueId],
+            onresponse: function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp))
+                    return alert(e);
+                vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+            },
+            oncomplete: function() {onload();}
+        }
+    );
+}
+
+
+/**
+  * Create queue, upload MARC, process spool, load the newly created queue 
+  */
+function batchUpload() {
+    var queueName = dijit.byId('vl-queue-name').getValue();
+    currentType = dijit.byId('vl-record-type').getValue();
+
+    var handleProcessSpool = function() {
+        if(vlUploadQueueAutoImport.checked) {
+            vlImportRecordQueue(currentType, currentQueueId, true,  
+                function() {
+                    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+                }
+            );
+        } else {
+            retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+        }
+    }
+
+    var handleUploadMARC = function(key) {
+        dojo.style(dojo.byId('vl-upload-status-processing'), 'display', 'block');
+        processSpool(key, currentQueueId, currentType, handleProcessSpool);
+    };
+
+    var handleCreateQueue = function(queue) {
+        currentQueueId = queue.id();
+        uploadMARC(handleUploadMARC);
+    };
+    
+    if(vlUploadQueueSelector.getValue() && !queueName) {
+        currentQueueId = vlUploadQueueSelector.getValue();
+        uploadMARC(handleUploadMARC);
+    } else {
+        createQueue(queueName, currentType, handleCreateQueue);
+    }
+}
+
+
+function vlFleshQueueSelect(selector, type) {
+    var data = (type == 'bib') ? vbq.toStoreData(allUserBibQueues) : vaq.toStoreData(allUserAuthQueues);
+    selector.store = new dojo.data.ItemFileReadStore({data:data});
+    selector.setValue(null);
+    selector.setDisplayedValue('');
+    if(data[0])
+        selector.setValue(data[0].id());
+}
+
+function vlShowUploadForm() {
+    displayGlobalDiv('vl-marc-upload-div');
+    vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue());
+    vlUploadSourceSelector.store = 
+        new dojo.data.ItemFileReadStore({data:cbs.toStoreData(vlBibSources, 'source')});
+    vlUploadSourceSelector.setValue(vlBibSources[0].id());
+}
+
+function vlShowQueueSelect() {
+    displayGlobalDiv('vl-queue-select-div');
+    vlFleshQueueSelect(vlQueueSelectQueueList, vlQueueSelectType.getValue());
+}
+
+function vlFetchQueueFromForm() {
+    currentType = vlQueueSelectType.getValue();
+    currentQueueId = vlQueueSelectQueueList.getValue();
+    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+}
+
+function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) {
+    /*
+        To run in Firefox directly, must set signed.applets.codebase_principal_support
+        to true in about:config
+    */
+    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+
+    function onsave(r) {
+        // after the record is saved, reload the HTML display
+        var stat = r.recv().content();
+        if(e = openils.Event.parse(stat))
+            return alert(e);
+        alert(dojo.byId('vl-marc-edit-complete-label').innerHTML);
+        win.close();
+        vlLoadMARCHtml(rec.id(), false, postReloadHTMLHandler);
+    }
+
+    win.xulG = {
+        record : {marc : rec.marc()},
+        save : {
+            label: dojo.byId('vl-marc-edit-save-label').innerHTML,
+            func: function(xmlString) {
+                var method = 'open-ils.permacrud.update.' + rec.classname;
+                rec.marc(xmlString);
+                fieldmapper.standardRequest(
+                    ['open-ils.permacrud', method],
+                    {   async: true,
+                        params: [authtoken, rec],
+                        oncomplete: onsave
+                    }
+                );
+            },
+        }
+    };
+}
+
+function vlLoadMarcEditor(type, recId, postReloadHTMLHandler) {
+    var method = 'open-ils.permacrud.search.vqbr';
+    if(currentType != 'bib')
+        method = method.replace(/vqbr/,'vqar');
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', method],
+        {   async: true, 
+            params: [authtoken, {id : recId}],
+            oncomplete: function(r) {
+                var rec = r.recv().content();
+                if(e = openils.Event.parse(rec))
+                    return alert(e);
+                vlOpenMarcEditWindow(rec, postReloadHTMLHandler);
+            }
+        }
+    );
+}
+
+
+
+//------------------------------------------------------------
+// attribute editors
+
+// attribute-editor global variables
+
+var ATTR_EDITOR_IN_UPDATE_MODE = false;        // true on 'edit', false on 'create'
+var ATTR_EDIT_ID = null;               // id of current 'edit' attribute
+var ATTR_EDIT_GROUP = 'bib';           // bib-attrs or auth-attrs
+
+function vlAttrEditorInit() {
+    // set up tooltips on the edit form
+    connectTooltip('attr-editor-tags'); 
+    connectTooltip('attr-editor-subfields'); 
+}
+
+function vlShowAttrEditor() {
+    displayGlobalDiv('vl-attr-editor-div');
+    loadAttrEditorGrid();
+    idHide('vl-generic-progress');
+}
+
+function setAttrEditorGroup(groupName) {
+    // put us into 'bib'-attr or 'auth'-attr mode.
+    if (ATTR_EDIT_GROUP != groupName) {
+       ATTR_EDIT_GROUP = groupName;
+       loadAttrEditorGrid();
+    }
+}
+
+function onAttrEditorOpen() {
+    // the "bars" have the create/update/cancel/etc. buttons.
+    var create_bar = document.getElementById('attr-editor-create-bar');
+    var update_bar = document.getElementById('attr-editor-update-bar');
+    if (ATTR_EDITOR_IN_UPDATE_MODE) {
+       update_bar.style.display='table-row';
+       create_bar.style.display='none';
+       // hide the dropdown-button
+       idStyle('vl-create-attr-editor-button', 'visibility', 'hidden');
+    } else {
+       dijit.byId('attr-editor-dialog').reset();
+       create_bar.style.display='table-row';
+       update_bar.style.display='none';
+    }
+}
+
+function onAttrEditorClose() {
+    // reset the form to a "create" form. (We may have borrowed it for editing.)
+    ATTR_EDITOR_IN_UPDATE_MODE = false;
+    // show the dropdown-button
+    idStyle('vl-create-attr-editor-button', 'visibility', 'visible');
+}
+
+function loadAttrEditorGrid() {
+    var _data = (ATTR_EDIT_GROUP == 'auth') ? 
+       vqarad.toStoreData(authAttrDefs) : vqbrad.toStoreData(bibAttrDefs) ;
+
+    var store = new dojo.data.ItemFileReadStore({data:_data});
+    attrEditorGrid.setStore(store);
+    dojo.connect(attrEditorGrid, 'onRowDblClick', onAttrEditorClick);
+    attrEditorGrid.update();
+}
+
+function attrGridGetTag(n, item) {
+    // grid helper: return the tags from the row's xpath column.
+    return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).tags;
+}
+
+function attrGridGetSubfield(n, item) {
+    // grid helper: return the subfields from the row's xpath column.
+    return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).subfields;
+}
+
+function onAttrEditorClick() {
+    var row = this.getItem(this.focus.rowIndex);
+    ATTR_EDIT_ID = this.store.getValue(row, 'id');
+    ATTR_EDITOR_IN_UPDATE_MODE = true;
+
+    // populate the popup editor.
+    dijit.byId('attr-editor-code').attr('value', this.store.getValue(row, 'code'));
+    dijit.byId('attr-editor-description').attr('value', this.store.getValue(row, 'description'));
+    var parsed_xpath = xpathParser.parse(this.store.getValue(row, 'xpath'));
+    dijit.byId('attr-editor-tags').attr('value', parsed_xpath.tags);
+    dijit.byId('attr-editor-subfields').attr('value', parsed_xpath.subfields);
+    dijit.byId('attr-editor-identifier').attr('value', this.store.getValue(row, 'ident'));
+    dijit.byId('attr-editor-xpath').attr('value', this.store.getValue(row, 'xpath'));
+    dijit.byId('attr-editor-remove').attr('value', this.store.getValue(row, 'remove'));
+
+    // set up UI for editing
+    dojo.byId('vl-create-attr-editor-button').click();
+}
+
+function vlSaveAttrDefinition(data) {
+    idHide('vl-attr-editor-div');
+    idShow('vl-generic-progress');
+
+    data.id = ATTR_EDIT_ID;
+
+    // this ought to honour custom xpaths, but overwrite xpaths
+    // derived from tags/subfields.
+    if (data.xpath == '' || looksLikeDerivedXpath(data.xpath)) {
+       var _xpath = tagAndSubFieldsToXpath(data.tag, data.subfield);
+       data.xpath = _xpath;
+    }
+
+    // build up our permacrud params. Key variables here are
+    // "create or update" and "bib or auth".
+
+    var isAuth   = (ATTR_EDIT_GROUP == 'auth');
+    var isCreate = (ATTR_EDIT_ID == null);
+    var rad      = isAuth ? new vqarad() : new vqbrad() ;
+    var method   = 'open-ils.permacrud' + (isCreate ? '.create.' : '.update.') 
+       + (isAuth ? 'vqarad' : 'vqbrad');
+    var _data    = rad.fromStoreItem(data);
+
+    _data.ischanged(1);
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', method],
+        {   async: true,
+            params: [authtoken, _data ],
+           onresponse: function(r) { },
+            oncomplete: function(r) {
+               attrEditorFetchAttrDefs(vlShowAttrEditor);
+               ATTR_EDIT_ID = null;
+           },
+           onerror: function(r) {
+               alert('vlSaveAttrDefinition comms error: ' + r);
+           }
+        }
+    );
+}
+
+function attrEditorFetchAttrDefs(callback) {
+    var fn = (ATTR_EDIT_GROUP == 'auth') ? vlFetchAuthAttrDefs : vlFetchBibAttrDefs;
+    return fn(callback);
+}
+
+function vlAttrDelete() {
+    idHide('vl-attr-editor-div');
+    idShow('vl-generic-progress');
+
+    var isAuth = (ATTR_EDIT_GROUP == 'auth');
+    var method = 'open-ils.permacrud.delete.' + (isAuth ? 'vqarad' : 'vqbrad');
+    var rad    = isAuth ? new vqarad() : new vqbrad() ;
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', method],
+        {   async: true,
+           params: [authtoken, rad.fromHash({ id : ATTR_EDIT_ID }), ],
+           oncomplete: function() {
+               dijit.byId('attr-editor-dialog').onCancel(); // close the dialog
+               attrEditorFetchAttrDefs(vlShowAttrEditor);
+               ATTR_EDIT_ID = null;
+           },
+           onerror: function(r) {
+               alert('vlAttrDelete comms error: ' + r);
+           }
+        }
+    );
+}
+
+// ------------------------------------------------------------
+// utilities for attribute editors
+
+// dom utilities (maybe dojo does these, and these should be replaced)
+
+function idStyle(obId, k, v)   { document.getElementById(obId).style[k] = v;   }
+function idShow(obId)          { idStyle(obId, 'display', 'block');            }
+function idHide(obId)          { idStyle(obId, 'display' , 'none');            }
+
+function connectTooltip(fieldId) {
+    // Given an element id, look up a tooltip element in the doc (same
+    // id with a '-tip' suffix) and associate the two. Maybe dojo has
+    // a better way to do this?
+    var fld = dojo.byId(fieldId);
+    var tip = dojo.byId(fieldId + '-tip');
+    dojo.connect(fld, 'onfocus', function(evt) {
+                    dijit.showTooltip(tip.innerHTML, fld, ['below', 'after']); });
+    dojo.connect(fld, 'onblur', function(evt) { dijit.hideTooltip(fld); });
+}
+
+// xpath utilities
+
+var xpathParser = new openils.MarcXPathParser();
+
+function tagAndSubFieldsToXpath(tags, subfields) {
+    // given tags, and subfields, build up an XPath.
+    try {
+       var parts = {
+           'tags':tags.match(/[\d]+/g), 
+           'subfields':subfields.match(/[a-zA-z]/g) };
+       return xpathParser.compile(parts);
+    } catch (err) {
+       return {'parts':null, 'tags':null, 'error':err};
+    }
+}
+
+function looksLikeDerivedXpath(path) {
+    // Does this path look like it was derived from tags and subfields?
+    var parsed = xpathParser.parse(path);
+    if (parsed.tags == null) 
+       return false;
+    var compiled = xpathParser.compile(parsed);
+    return (path == compiled);
+}
+
+// amazing xpath-util unit-tests
+if (!looksLikeDerivedXpath('//*[@tag="901"]/*[@code="c"]'))    alert('vandelay xpath-utility error');
+if ( looksLikeDerivedXpath('ba-boo-ba-boo!'))                  alert('vandelay xpath-utility error');
diff --git a/Open-ILS/web/templates/default/vandelay/inc/attrs.tt2 b/Open-ILS/web/templates/default/vandelay/inc/attrs.tt2
new file mode 100644 (file)
index 0000000..03a49f9
--- /dev/null
@@ -0,0 +1,101 @@
+<div style='float: left; margin-top: 8px;'>
+    <input dojoType="dijit.form.RadioButton" name="attrEditorGroup" value="bib" 
+        id="aegB" onclick="setAttrEditorGroup('bib');" checked="checked"/>
+    <label for="aegB" style="margin-right: 1em;">&vandelay.bib.attrs;</label>
+    <input dojoType="dijit.form.RadioButton" name="attrEditorGroup" value="auth" 
+        id="aegA" onclick="setAttrEditorGroup('auth');"/>
+    <label for="aegA" style="margin-right: 1em;">&vandelay.auth.attrs;</label>
+</div>
+<div dojoType="dijit.form.DropDownButton" id="vl-create-attr-editor-button">
+    <span name="create">&vandelay.create.attr.def;</span>
+    <div dojoType="dijit.TooltipDialog" execute="vlSaveAttrDefinition(arguments[0]);" id="attr-editor-dialog">
+        <script type='dojo/connect' event='onOpen'>onAttrEditorOpen();</script>
+        <script type='dojo/connect' event='onClose'>onAttrEditorClose();</script>
+        <table class='dijitTooltipTable'>
+            <tr>
+                <td><label for="code">&vandelay.code;:</label></td>
+                <td><input id='attr-editor-code' name="code" dojoType="dijit.form.TextBox"/></td>
+            </tr>
+            <tr>
+                <td><label for="description">&vandelay.descrip;:</label></td>
+                <td><input id='attr-editor-description' dojoType="dijit.form.TextBox" name="description"> </input></td>
+            </tr>
+            <tr>
+                <td><label for="amount">&vandelay.tags;:</label></td>
+                <td><input id="attr-editor-tags" dojoType="dijit.form.TextBox" name="tag"></input>
+                <div class="hidden" id="attr-editor-tags-tip">
+                <p>&vandelay.tooltip.tags;</p>
+                <p>&vandelay.for.example;:<code>120, 220, 300</code> or <code>120 220 330</code></p></div>
+                </td>
+            </tr>
+
+            <tr>
+                <td><label for="amount">&vandelay.subfields;:</label></td>
+                <td><input dojoType="dijit.form.TextBox" name="subfield" id="attr-editor-subfields"></input>
+                    <div class="hidden" id="attr-editor-subfields-tip">
+                    <p>&vandelay.tooltip.subfields;</p>
+                    <p>&vandelay.for.example;: <code>a, b, j, x</code> or <code>a b j x</code></p></div>
+                </td>
+            </tr>
+            <tr>
+                <td><label for="ident">&vandelay.id.field;: </label></td>
+                <td>
+                    <select dojoType="dijit.form.FilteringSelect" name="ident" id="attr-editor-identifier">
+                        <option value='f' selected='selected'>&vandelay.false;</option>
+                        <option value='t'>&vandelay.true;</option>
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td><label for="attr-editor-xpath">&vandelay.xpath.advanced;: </label></td>
+
+                <td><input dojoType="dijit.form.TextBox" id="attr-editor-xpath" name="xpath"></input></td>
+            </tr>
+            <tr>
+                <td><label for="attr-editor-remove">&vandelay.remove.advanced;: </label></td>
+
+                <td><input dojoType="dijit.form.TextBox" id="attr-editor-remove" name="remove"></input></td>
+            </tr>
+            <tr id="attr-editor-create-bar">
+                <td colspan='2' align='center'>
+                    <button dojoType="dijit.form.Button" type="submit" 
+                        id="attr-editor-create-button">&vandelay.create;</button>
+                    <button type="button" dojoType="dijit.form.Button"
+                        onclick="dijit.byId('attr-editor-dialog').onCancel();">&vandelay.cancel;</button>
+                </td>
+            </tr>
+            <tr id="attr-editor-update-bar">
+                <td colspan='2' align='center'>
+                    <button dojoType="dijit.form.Button" type="submit" 
+                        id="attr-editor-update-button">&vandelay.update;</button>
+                    <button type="button" dojoType="dijit.form.Button"
+                        onclick="dijit.byId('attr-editor-dialog').onCancel();">&vandelay.cancel;</button>
+                    <button dojoType="dijit.form.Button" 
+                        type="button" 
+                        id="attr-editor-delete-button"
+                        style="padding-left: 2em;"
+                        onclick="if(confirm('&vandelay.sure.to.delete;')) { vlAttrDelete(); }">
+                            &vandelay.delete.record;</button>
+                </td>
+            </tr>
+        </table>
+    </div>
+</div>
+<div style='height:600px;'>
+    <table dojoType='dojox.grid.DataGrid' jsId='attrEditorGrid' query="{id: '*'}"> 
+        <thead>
+            <tr>
+                <th field='id'>&vandelay.id;</th>
+                <th field='code' width='auto'>&vandelay.code;</th>
+                <th field='description' width='auto'>&vandelay.descrip;</th>
+                <th field='tag' get='attrGridGetTag'>&vandelay.tag;</th>
+                <th field='subfield' get='attrGridGetSubfield'>&vandelay.subfield;</th>
+                <th field='ident'>&vandelay.identifier;</th>
+                <th field='xpath' width='auto'>&vandelay.xpath;</th>
+                <th field='remove' width='auto'>&vandelay.remove;</th>
+            </tr>
+        </thead>
+    </table>
+</div>
+
+
diff --git a/Open-ILS/web/templates/default/vandelay/inc/export.tt2 b/Open-ILS/web/templates/default/vandelay/inc/export.tt2
new file mode 100644 (file)
index 0000000..292f13b
--- /dev/null
@@ -0,0 +1,64 @@
+<h1>&vandelay.export.records;</h1><br/>
+<form method="POST" enctype="multipart/form-data" action='/exporter'>
+    <table class='form_table'>
+        <tr class='export_tr_border'>
+            <td>&vandelay.export.use_field_no;</td>
+            <td>
+                <input dojoType='dijit.form.TextBox' type="text" size="2" maxlength="2" name="idcolumn" value="0"/>
+                &vandelay.export.field_no_hint;
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.export.from_csv;</td>
+            <td><input type="file" name="idfile"/></td>
+        </tr>
+        <tr><td colspan='2'><b>&vandelay.export.or;</b></td></tr>
+        <tr class='export_tr_border'>
+            <td>&vandelay.export.record_id;</td>
+            <td><input dojoType='dijit.form.TextBox' type="text" size="12" maxlength="12" name="id"/></td>
+        </tr>
+        <tr><td colspan='2'><b>&vandelay.export.or;</b></td></tr>
+        <tr class='export_tr_border'>
+            <td>&vandelay.export.bucket;</td>
+            <td><input dojoType='dijit.form.TextBox' type='text' name='containerid'/></td>
+        </tr>
+        <tr class='export_tr_border'>
+            <td>&vandelay.record.type;</td>
+            <td>
+                <select name="rectype" dojoType='dijit.form.FilteringSelect'>
+                    <option value="biblio">&vandelay.bib.records;</option>
+                    <option value="authority">&vandelay.auth.records;</option>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.export.format;</td>
+            <td>
+                <select name="format" dojoType='dijit.form.FilteringSelect'>
+                    <option value="USMARC">&vandelay.export.format.marc21;</option>
+                    <option value="UNIMARC">&vandelay.export.format.unimarc;</option>
+                    <option value="XML">&vandelay.export.format.xml;</option>
+                    <option value="BRE">&vandelay.export.format.bre;</option>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.export.encoding;</td>
+            <td>
+                <select name="encoding" dojoType='dijit.form.FilteringSelect'>
+                    <option value="UTF-8">&vandelay.export.utf8;</option>
+                    <option value="MARC8">&vandelay.export.marc8;</option>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.export.holdings;</td>
+            <td><input dojoType='dijit.form.CheckBox' type="checkbox" name="holdings" value="1"/></td>
+        </tr>
+        <tr>
+            <td colspan='2'>
+                <button dojoType='dijit.form.Button' type="submit" value="Retrieve Records">&vandelay.export.retrieve;</button>
+            </td>
+        </tr>
+    </table>
+</form>
diff --git a/Open-ILS/web/templates/default/vandelay/inc/marchtml.tt2 b/Open-ILS/web/templates/default/vandelay/inc/marchtml.tt2
new file mode 100644 (file)
index 0000000..7a08d75
--- /dev/null
@@ -0,0 +1,13 @@
+<!-- MARC as HTML -->
+<h1>&vandelay.marc.record;</h1><br/>
+<span class='hidden' id='vl-marc-edit-save-label'>&vandelay.save;</span>
+<span class='hidden' id='vl-marc-edit-complete-label'>&vandelay.record_saved;</span>
+<div>
+    <button id='vl-marc-html-done-button' dojoType='dijit.form.Button'>&#x2196; &vandelay.return;</button>
+    <button id='vl-marc-html-edit-button' dojoType='dijit.form.Button'>&vandelay.edit;</button>
+</div>
+<div>
+    <style>#vl-marc-record-html td {padding:0px;}</style>
+    <div id='vl-marc-record-html'> </div>
+</div>
+
diff --git a/Open-ILS/web/templates/default/vandelay/inc/matches.tt2 b/Open-ILS/web/templates/default/vandelay/inc/matches.tt2
new file mode 100644 (file)
index 0000000..cead655
--- /dev/null
@@ -0,0 +1,40 @@
+<script>
+    var vlMatchGridLayout;
+    function resetVlMatchGridLayout() {
+        vlMatchGridLayout = [{
+            defaultCell: {styles: 'text-align: center;'},
+            cells : [[
+                {
+                    name: '&vandelay.overlay.target;', 
+                    get: vlGetOverlayTargetSelector,
+                    value: '&lt;input type="checkbox" name="vl-overlay-target-RECID" '+
+                        'onclick="vlHandleOverlayTargetSelected(ID, GRIDID);" gridid="GRIDID" match="ID"/>'
+                },
+                {name:'&vandelay.source.match.point;', field:'src_matchpoint'},
+                {name:'&vandelay.dest.match.point;', field:'dest_matchpoint'},
+                {name: '&vandelay.id;', field:'id'},
+                {   name: '&vandelay.view.marc;', 
+                    get: vlGetViewMARC, 
+                    value:'&lt;a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, '+
+                        'true, function(){displayGlobalDiv(\'vl-match-div\');});">&vandelay.view.marc;&lt;/a>'
+                },
+                {name: '&vandelay.creator;', get: vlGetCreator},
+                {name: '&vandelay.create.date;', field:'create_date', get: vlGetDateTimeField},
+                {name: '&vandelay.last.edit.date;', field:'edit_date', get: vlGetDateTimeField},
+                {name: '&vandelay.source;', field:'source'},
+                {name: '&vandelay.tcn.source;', field:'tcn_source'},
+                {name: '&vandelay.tcn.value;', field:'tcn_value'}
+            ]]
+        }];
+    }
+</script>
+<h1>&vandelay.import.matches;</h1><br/>
+<div>
+    <button dojoType='dijit.form.Button' 
+        onclick="displayGlobalDiv('vl-queue-div');">&#x2196; &vandelay.back.to.import.queue;</button>
+</div>
+<div class='tall'>
+    <table dojoType='dojox.grid.DataGrid' jsId='vlMatchGrid' query='{id:"*"}'> 
+    </table>
+</div>
+
diff --git a/Open-ILS/web/templates/default/vandelay/inc/progress.tt2 b/Open-ILS/web/templates/default/vandelay/inc/progress.tt2
new file mode 100644 (file)
index 0000000..e5e1833
--- /dev/null
@@ -0,0 +1,16 @@
+<div id="vl-generic-progress" class='progress'>
+    <div dojoType="dijit.ProgressBar" style="width:300px" indeterminate="true"></div>
+</div>
+<div id="vl-generic-progress-with-total" class='hidden progress'>
+    <div dojoType="dijit.ProgressBar" jsId='vlControlledProgressBar' style="width:300px"></div>
+</div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-status-div' class='hidden'>
+    <h1>&vandelay.upload.status;</h1><br/>
+    <div id='vl-upload-status-uploading'>
+        <h3>&vandelay.uploading;</h3>
+    </div>
+    <div id='vl-upload-status-processing' class='hidden'>
+        <h3>&vandelay.processing;<span id='vl-upload-status-count'/></h3>
+    </div>
+</div>
+
diff --git a/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 b/Open-ILS/web/templates/default/vandelay/inc/queue.tt2
new file mode 100644 (file)
index 0000000..49568fb
--- /dev/null
@@ -0,0 +1,132 @@
+<table class='wide'>
+    <tr>
+        <td align='left'>
+            <h1>&vandelay.record.queue; <span style='font-style:italic;' id='vl-queue-summary-name'/></h1><br/>
+        </td>
+        <td align='right'>
+            &vandelay.queue.total; <span style='font-weight:bold;' id='vl-queue-summary-total-count'/>
+            &vandelay.queue.imported; <span style='font-weight:bold;' id='vl-queue-summary-import-count'/>
+        </td>
+    </tr>
+</table>
+<script>
+    var vlQueueGridLayout;
+    function resetVlQueueGridLayout() {
+        vlQueueGridLayout = [{
+            cells : [[
+                {
+                    name: '&lt;input id="vl-queue-grid-row-selector" type="checkbox" onclick="vlToggleQueueGridSelect();"/>', 
+                    get: vlQueueGridDrawSelectBox, 
+                    styles : 'text-align: center;',
+                    nonSelectable : true
+                }, {   
+                    name: '&vandelay.view.marc;', 
+                    get: vlGetViewMARC, styles : 'text-align: center;',
+                    value: '&lt;a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, false, '+
+                        'function(){displayGlobalDiv(\'vl-queue-div\');});">&vandelay.view.marc;&lt;/a>',
+                    nonSelectable : true
+                }, {   
+                    name: '&vandelay.matches;', 
+                    get: vlGetViewMatches, styles : 'text-align: center;',
+                    value:'&lt;a href="javascript:void(0);" onclick="vlLoadMatchUI(RECID);">&vandelay.matches;&lt;/a>',
+                    nonSelectable : true
+                }, {
+                    name: '&vandelay.import.time;', field:'import_time',  styles : 'text-align: center;',
+                    get:vlGetDateTimeField, 
+                }
+            ]]
+        }];
+    }
+</script>
+<div id='vl-queue-div-grid' class='tall' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+
+    <!-- queue grid navigation row -->
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+        <table width='100%' style='margin-bottom:0px;'>
+            <tr>
+                <td align='left' valign='bottom'>
+                    <select id='vl-queue-actions-selector'>
+                        <option selected='selected' disabled='disabled' value='select-actions'>&vandelay.select_actions;</option>
+                        <option value='import'>&vandelay.import.selected;</option>
+                        <option value='import_all'>&vandelay.import.all;</option>
+                        <option value='delete_queue'>&vandelay.delete.queue;</option>
+                    </select>
+                    <script>
+                        var sel = dojo.byId('vl-queue-actions-selector');
+                        sel.onchange = function(evt) {
+                            switch(openils.Util.selectorValue(evt.target)) {
+                                case 'import': vlImportSelectedRecords(); break;;
+                                case 'import_all': vlImportAllRecords(); break;;
+                                case 'delete_queue': 
+                                    if(confirm('&vandelay.sure.to.delete.queue;')) {
+                                        vlDeleteQueue(currentType, currentQueueId, 
+                                            function() { displayGlobalDiv('vl-marc-upload-div'); });
+                                    }
+                            }
+                            evt.target.selectedIndex = 0;
+                        }
+                    </script>
+                </td>
+                <td align='middle' valign='bottom'>
+                    <style>.filter_span { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
+                    <table><tr>
+                        <td>
+                            <span>&vandelay.limit.to.collision.matches;</span>
+                            <span class='filter_span'>
+                                <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' onchange='retrieveQueuedRecords();'/>
+                            </span>
+
+                            <span>&vandelay.limit.to.non.imported;</span>
+                            <span class='filter_span'>
+                                <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked' onchange='retrieveQueuedRecords();'/>
+                            </span>
+
+                            <span>&vandelay.results.per.page;</span>
+                            <span class='filter_span'>
+                                <select jsId='vlQueueDisplayLimit' id='vl-queue-display-limit-selector'
+                                    value='10' onchange='retrieveQueuedRecords();'>
+                                    <option value='10'>10</option>
+                                    <option value='20'>20</option>
+                                    <option value='50'>50</option>
+                                    <option value='100'>100</option>
+                                </select>
+                            </span>
+
+                            <span style='padding-left:5px;'>&vandelay.page;</span>
+                            <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+                        </td>
+                    </tr></table>
+                </td>
+                <td align='right' valign='bottom'>
+                    <span style='padding-right:4px;'>
+                        <a href='javascript:void(0);' onclick='vlQueueGridPrevPage();'>&#171; &vandelay.prev.page;</a>
+                    </span>
+                    <span style='padding-right:10px;'>
+                        <a href='javascript:void(0);' onclick='vlQueueGridNextPage();'>&vandelay.next.page; &#187;</a>
+                    </span>
+                </td>
+            </tr>
+        </table>
+    </div>
+
+    <!-- Queue Grid -->
+    <div class='hidden' id='vl-bib-queue-grid-wrapper'>
+        <div dojoType="openils.widget.GridColumnPicker" jsid="vlBibQueueGridMenu" style="display: none;" grid='vlBibQueueGrid'>
+            <div dojoType="dojox.widget.PlaceholderMenuItem" label="GridColumns"></div>
+        </div>
+        <div style='height:600px' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+            <table dojoType='dojox.grid.DataGrid' jsId='vlBibQueueGrid' query="{id:'*'}" headerMenu='vlBibQueueGridMenu'> 
+            </table>
+        </div>
+    </div>
+    <div class='hidden' id='vl-auth-queue-grid-wrapper'>
+        <div dojoType="openils.widget.GridColumnPicker" jsid="vlAuthQueueGridMenu" style="display: none;" grid='vlAuthQueueGrid'>
+            <div dojoType="dojox.widget.PlaceholderMenuItem" label="GridColumns"></div>
+        </div>
+        <div style='height:600px' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+            <table dojoType='dojox.grid.DataGrid' jsId='vlAuthQueueGrid' query="{id:'*'}" headerMenu='vlAuthQueueGridMenu'> 
+            </table>
+        </div>
+    </div>
+</div>
+
diff --git a/Open-ILS/web/templates/default/vandelay/inc/queueselect.tt2 b/Open-ILS/web/templates/default/vandelay/inc/queueselect.tt2
new file mode 100644 (file)
index 0000000..2149dfa
--- /dev/null
@@ -0,0 +1,25 @@
+<!-- Form for choosing which queue to view -->
+<h1>&vandelay.select.queue;</h1><br/>
+<table class='form_table'>
+    <tr>
+        <td>&vandelay.queue.type;</td>
+        <td>
+            <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='vlShowQueueSelect();'>
+                <option value='bib' selected='selected'>&vandelay.bib.records;</option>
+                <option value='auth'>&vandelay.auth.records;</option>
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td>&vandelay.queue;</td>
+        <td>
+            <select jsId='vlQueueSelectQueueList' dojoType='dijit.form.FilteringSelect'>
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td colspan='2'>
+            <button dojoType='dijit.form.Button' onclick='vlFetchQueueFromForm();'>&vandelay.retrieve.queue;</button>
+        </td>
+    </tr>
+</table>
diff --git a/Open-ILS/web/templates/default/vandelay/inc/toolbar.tt2 b/Open-ILS/web/templates/default/vandelay/inc/toolbar.tt2
new file mode 100644 (file)
index 0000000..6bf3b39
--- /dev/null
@@ -0,0 +1,10 @@
+<div dojoType="dijit.Toolbar" id='toolbar'>
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" id='vl-menu-marc-export'
+        onclick="displayGlobalDiv('vl-marc-export-div');" showLabel="true">&vandelay.export.records;</div>
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-marc-upload'
+        onclick="displayGlobalDiv('vl-marc-upload-div');" showLabel="true">&vandelay.import.records;</div>
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-queue-select'
+        onclick="vlShowQueueSelect();" showLabel="true">&vandelay.inspect.queue;</div>
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-attr-editor'
+        onclick="vlShowAttrEditor();" showLabel="true">&vandelay.edit.attributes;</div>
+</div>
diff --git a/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 b/Open-ILS/web/templates/default/vandelay/inc/upload.tt2
new file mode 100644 (file)
index 0000000..9c71353
--- /dev/null
@@ -0,0 +1,54 @@
+<h1>&vandelay.marc.file.upload;</h1><br/>
+<form id="vl-marc-upload-form" enctype="multipart/form-data">
+    <input type='hidden' name='ses' id='vl-ses-input'/>
+    <table class='form_table'>
+        <tr>
+            <td>&vandelay.record.type;</td>
+            <td colspan='4'>
+                <select id='vl-record-type' dojoType='dijit.form.FilteringSelect' 
+                        jsId='vlUploadRecordType' onchange='vlShowUploadForm();'>
+                    <option value='bib' selected='selected'>&vandelay.bib.records;</option>
+                    <option value='auth'>&vandelay.auth.records;</option>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.create.upload.queue;</td>
+            <td>
+                <input type='text' dojoType='dijit.form.TextBox' id='vl-queue-name' size='32'></input>
+            </td>
+            <td>&vandelay.add.existing.queue;</td>
+            <td>
+                <select jsId='vlUploadQueueSelector' dojoType='dijit.form.FilteringSelect'>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.auto.import.noncolliding;</td>
+            <td colspan='4'>
+                <input jsId='vlUploadQueueAutoImport' dojoType='dijit.form.CheckBox'/>
+            </td>
+        </tr>
+        <tr>
+            <td>&vandelay.import.bib_sources;</td>
+            <td>
+                <select name='bib_source' jsId='vlUploadSourceSelector' dojoType='dijit.form.FilteringSelect' labelAttr='source' searchAttr='source'>
+                </select>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <span id="vl-file-label">&vandelay.file.to.upload;</span>
+            </td>
+            <td id='vl-input-td' colspan='4'>
+                <input size='48' type="file" name="marc_upload"/>
+            </td>
+        </tr>
+        <tr>
+            <td align='center' colspan='4'>
+                <button dojoType="dijit.form.Button" onclick="batchUpload()">&vandelay.upload;</button>
+            </td>
+        </tr>
+    </table>
+</form>
+
diff --git a/Open-ILS/web/templates/default/vandelay/vandelay.tt2 b/Open-ILS/web/templates/default/vandelay/vandelay.tt2
new file mode 100644 (file)
index 0000000..e0d2f04
--- /dev/null
@@ -0,0 +1,41 @@
+[% WRAPPER 'default/base.tt2' %]
+[% ctx.page_title = 'MARC Import/Export' %]
+[% ctx.dtd = '<!DOCTYPE html SYSTEM "'_ ctx.web_dir _'/opac/locale/' _ ctx.locale _ '/vandelay.dtd">' %]
+
+<script src='[% ctx.media_prefix %]/js/ui/default/vandelay/vandelay.js'> </script>
+<link rel='stylesheet' type='text/css' href='[% ctx.media_prefix %]/css/skin/[% ctx.skin %]/vandelay.css'></link>
+<link rel='stylesheet' type='text/css' href='[% ctx.media_prefix %]/css/theme/[% ctx.skin %]/vandelay.css'></link>
+
+
+<div dojoType="dijit.layout.LayoutContainer" orientation="vertical" class="tall">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='top' id="vl-nav-bar" style="visibility: hidden;">
+        [% INCLUDE 'default/vandelay/inc/toolbar.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+        [% INCLUDE 'default/vandelay/inc/progress.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-export-div' class='hidden content'>
+        [% INCLUDE 'default/vandelay/inc/export.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-div' class='hidden content'>
+        [% INCLUDE 'default/vandelay/inc/upload.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-div' class='tall hidden content'>
+        [% INCLUDE 'default/vandelay/inc/queue.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-match-div' class='tall hidden content'>
+        [% INCLUDE 'default/vandelay/inc/matches.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-html-div' class='tall hidden content'>
+        [% INCLUDE 'default/vandelay/inc/marchtml.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-select-div' class='tall hidden content'>
+        [% INCLUDE 'default/vandelay/inc/queueselect.tt2' %]
+    </div>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="client"  id="vl-attr-editor-div" 
+            class='hidden attr-editor-detail-content-pane content' title='&vandelay.edit.attrs;'>
+        [% INCLUDE 'default/vandelay/inc/attrs.tt2' %]
+    </div>
+</div>
+
+[% END %]
diff --git a/Open-ILS/web/vandelay/inc/attrs.xml b/Open-ILS/web/vandelay/inc/attrs.xml
deleted file mode 100644 (file)
index 03a49f9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<div style='float: left; margin-top: 8px;'>
-    <input dojoType="dijit.form.RadioButton" name="attrEditorGroup" value="bib" 
-        id="aegB" onclick="setAttrEditorGroup('bib');" checked="checked"/>
-    <label for="aegB" style="margin-right: 1em;">&vandelay.bib.attrs;</label>
-    <input dojoType="dijit.form.RadioButton" name="attrEditorGroup" value="auth" 
-        id="aegA" onclick="setAttrEditorGroup('auth');"/>
-    <label for="aegA" style="margin-right: 1em;">&vandelay.auth.attrs;</label>
-</div>
-<div dojoType="dijit.form.DropDownButton" id="vl-create-attr-editor-button">
-    <span name="create">&vandelay.create.attr.def;</span>
-    <div dojoType="dijit.TooltipDialog" execute="vlSaveAttrDefinition(arguments[0]);" id="attr-editor-dialog">
-        <script type='dojo/connect' event='onOpen'>onAttrEditorOpen();</script>
-        <script type='dojo/connect' event='onClose'>onAttrEditorClose();</script>
-        <table class='dijitTooltipTable'>
-            <tr>
-                <td><label for="code">&vandelay.code;:</label></td>
-                <td><input id='attr-editor-code' name="code" dojoType="dijit.form.TextBox"/></td>
-            </tr>
-            <tr>
-                <td><label for="description">&vandelay.descrip;:</label></td>
-                <td><input id='attr-editor-description' dojoType="dijit.form.TextBox" name="description"> </input></td>
-            </tr>
-            <tr>
-                <td><label for="amount">&vandelay.tags;:</label></td>
-                <td><input id="attr-editor-tags" dojoType="dijit.form.TextBox" name="tag"></input>
-                <div class="hidden" id="attr-editor-tags-tip">
-                <p>&vandelay.tooltip.tags;</p>
-                <p>&vandelay.for.example;:<code>120, 220, 300</code> or <code>120 220 330</code></p></div>
-                </td>
-            </tr>
-
-            <tr>
-                <td><label for="amount">&vandelay.subfields;:</label></td>
-                <td><input dojoType="dijit.form.TextBox" name="subfield" id="attr-editor-subfields"></input>
-                    <div class="hidden" id="attr-editor-subfields-tip">
-                    <p>&vandelay.tooltip.subfields;</p>
-                    <p>&vandelay.for.example;: <code>a, b, j, x</code> or <code>a b j x</code></p></div>
-                </td>
-            </tr>
-            <tr>
-                <td><label for="ident">&vandelay.id.field;: </label></td>
-                <td>
-                    <select dojoType="dijit.form.FilteringSelect" name="ident" id="attr-editor-identifier">
-                        <option value='f' selected='selected'>&vandelay.false;</option>
-                        <option value='t'>&vandelay.true;</option>
-                    </select>
-                </td>
-            </tr>
-            <tr>
-                <td><label for="attr-editor-xpath">&vandelay.xpath.advanced;: </label></td>
-
-                <td><input dojoType="dijit.form.TextBox" id="attr-editor-xpath" name="xpath"></input></td>
-            </tr>
-            <tr>
-                <td><label for="attr-editor-remove">&vandelay.remove.advanced;: </label></td>
-
-                <td><input dojoType="dijit.form.TextBox" id="attr-editor-remove" name="remove"></input></td>
-            </tr>
-            <tr id="attr-editor-create-bar">
-                <td colspan='2' align='center'>
-                    <button dojoType="dijit.form.Button" type="submit" 
-                        id="attr-editor-create-button">&vandelay.create;</button>
-                    <button type="button" dojoType="dijit.form.Button"
-                        onclick="dijit.byId('attr-editor-dialog').onCancel();">&vandelay.cancel;</button>
-                </td>
-            </tr>
-            <tr id="attr-editor-update-bar">
-                <td colspan='2' align='center'>
-                    <button dojoType="dijit.form.Button" type="submit" 
-                        id="attr-editor-update-button">&vandelay.update;</button>
-                    <button type="button" dojoType="dijit.form.Button"
-                        onclick="dijit.byId('attr-editor-dialog').onCancel();">&vandelay.cancel;</button>
-                    <button dojoType="dijit.form.Button" 
-                        type="button" 
-                        id="attr-editor-delete-button"
-                        style="padding-left: 2em;"
-                        onclick="if(confirm('&vandelay.sure.to.delete;')) { vlAttrDelete(); }">
-                            &vandelay.delete.record;</button>
-                </td>
-            </tr>
-        </table>
-    </div>
-</div>
-<div style='height:600px;'>
-    <table dojoType='dojox.grid.DataGrid' jsId='attrEditorGrid' query="{id: '*'}"> 
-        <thead>
-            <tr>
-                <th field='id'>&vandelay.id;</th>
-                <th field='code' width='auto'>&vandelay.code;</th>
-                <th field='description' width='auto'>&vandelay.descrip;</th>
-                <th field='tag' get='attrGridGetTag'>&vandelay.tag;</th>
-                <th field='subfield' get='attrGridGetSubfield'>&vandelay.subfield;</th>
-                <th field='ident'>&vandelay.identifier;</th>
-                <th field='xpath' width='auto'>&vandelay.xpath;</th>
-                <th field='remove' width='auto'>&vandelay.remove;</th>
-            </tr>
-        </thead>
-    </table>
-</div>
-
-
diff --git a/Open-ILS/web/vandelay/inc/export.xml b/Open-ILS/web/vandelay/inc/export.xml
deleted file mode 100644 (file)
index 292f13b..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<h1>&vandelay.export.records;</h1><br/>
-<form method="POST" enctype="multipart/form-data" action='/exporter'>
-    <table class='form_table'>
-        <tr class='export_tr_border'>
-            <td>&vandelay.export.use_field_no;</td>
-            <td>
-                <input dojoType='dijit.form.TextBox' type="text" size="2" maxlength="2" name="idcolumn" value="0"/>
-                &vandelay.export.field_no_hint;
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.export.from_csv;</td>
-            <td><input type="file" name="idfile"/></td>
-        </tr>
-        <tr><td colspan='2'><b>&vandelay.export.or;</b></td></tr>
-        <tr class='export_tr_border'>
-            <td>&vandelay.export.record_id;</td>
-            <td><input dojoType='dijit.form.TextBox' type="text" size="12" maxlength="12" name="id"/></td>
-        </tr>
-        <tr><td colspan='2'><b>&vandelay.export.or;</b></td></tr>
-        <tr class='export_tr_border'>
-            <td>&vandelay.export.bucket;</td>
-            <td><input dojoType='dijit.form.TextBox' type='text' name='containerid'/></td>
-        </tr>
-        <tr class='export_tr_border'>
-            <td>&vandelay.record.type;</td>
-            <td>
-                <select name="rectype" dojoType='dijit.form.FilteringSelect'>
-                    <option value="biblio">&vandelay.bib.records;</option>
-                    <option value="authority">&vandelay.auth.records;</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.export.format;</td>
-            <td>
-                <select name="format" dojoType='dijit.form.FilteringSelect'>
-                    <option value="USMARC">&vandelay.export.format.marc21;</option>
-                    <option value="UNIMARC">&vandelay.export.format.unimarc;</option>
-                    <option value="XML">&vandelay.export.format.xml;</option>
-                    <option value="BRE">&vandelay.export.format.bre;</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.export.encoding;</td>
-            <td>
-                <select name="encoding" dojoType='dijit.form.FilteringSelect'>
-                    <option value="UTF-8">&vandelay.export.utf8;</option>
-                    <option value="MARC8">&vandelay.export.marc8;</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.export.holdings;</td>
-            <td><input dojoType='dijit.form.CheckBox' type="checkbox" name="holdings" value="1"/></td>
-        </tr>
-        <tr>
-            <td colspan='2'>
-                <button dojoType='dijit.form.Button' type="submit" value="Retrieve Records">&vandelay.export.retrieve;</button>
-            </td>
-        </tr>
-    </table>
-</form>
diff --git a/Open-ILS/web/vandelay/inc/marchtml.xml b/Open-ILS/web/vandelay/inc/marchtml.xml
deleted file mode 100644 (file)
index 7a08d75..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!-- MARC as HTML -->
-<h1>&vandelay.marc.record;</h1><br/>
-<span class='hidden' id='vl-marc-edit-save-label'>&vandelay.save;</span>
-<span class='hidden' id='vl-marc-edit-complete-label'>&vandelay.record_saved;</span>
-<div>
-    <button id='vl-marc-html-done-button' dojoType='dijit.form.Button'>&#x2196; &vandelay.return;</button>
-    <button id='vl-marc-html-edit-button' dojoType='dijit.form.Button'>&vandelay.edit;</button>
-</div>
-<div>
-    <style>#vl-marc-record-html td {padding:0px;}</style>
-    <div id='vl-marc-record-html'> </div>
-</div>
-
diff --git a/Open-ILS/web/vandelay/inc/matches.xml b/Open-ILS/web/vandelay/inc/matches.xml
deleted file mode 100644 (file)
index cead655..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<script>
-    var vlMatchGridLayout;
-    function resetVlMatchGridLayout() {
-        vlMatchGridLayout = [{
-            defaultCell: {styles: 'text-align: center;'},
-            cells : [[
-                {
-                    name: '&vandelay.overlay.target;', 
-                    get: vlGetOverlayTargetSelector,
-                    value: '&lt;input type="checkbox" name="vl-overlay-target-RECID" '+
-                        'onclick="vlHandleOverlayTargetSelected(ID, GRIDID);" gridid="GRIDID" match="ID"/>'
-                },
-                {name:'&vandelay.source.match.point;', field:'src_matchpoint'},
-                {name:'&vandelay.dest.match.point;', field:'dest_matchpoint'},
-                {name: '&vandelay.id;', field:'id'},
-                {   name: '&vandelay.view.marc;', 
-                    get: vlGetViewMARC, 
-                    value:'&lt;a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, '+
-                        'true, function(){displayGlobalDiv(\'vl-match-div\');});">&vandelay.view.marc;&lt;/a>'
-                },
-                {name: '&vandelay.creator;', get: vlGetCreator},
-                {name: '&vandelay.create.date;', field:'create_date', get: vlGetDateTimeField},
-                {name: '&vandelay.last.edit.date;', field:'edit_date', get: vlGetDateTimeField},
-                {name: '&vandelay.source;', field:'source'},
-                {name: '&vandelay.tcn.source;', field:'tcn_source'},
-                {name: '&vandelay.tcn.value;', field:'tcn_value'}
-            ]]
-        }];
-    }
-</script>
-<h1>&vandelay.import.matches;</h1><br/>
-<div>
-    <button dojoType='dijit.form.Button' 
-        onclick="displayGlobalDiv('vl-queue-div');">&#x2196; &vandelay.back.to.import.queue;</button>
-</div>
-<div class='tall'>
-    <table dojoType='dojox.grid.DataGrid' jsId='vlMatchGrid' query='{id:"*"}'> 
-    </table>
-</div>
-
diff --git a/Open-ILS/web/vandelay/inc/progress.xml b/Open-ILS/web/vandelay/inc/progress.xml
deleted file mode 100644 (file)
index e5e1833..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<div id="vl-generic-progress" class='progress'>
-    <div dojoType="dijit.ProgressBar" style="width:300px" indeterminate="true"></div>
-</div>
-<div id="vl-generic-progress-with-total" class='hidden progress'>
-    <div dojoType="dijit.ProgressBar" jsId='vlControlledProgressBar' style="width:300px"></div>
-</div>
-<div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-status-div' class='hidden'>
-    <h1>&vandelay.upload.status;</h1><br/>
-    <div id='vl-upload-status-uploading'>
-        <h3>&vandelay.uploading;</h3>
-    </div>
-    <div id='vl-upload-status-processing' class='hidden'>
-        <h3>&vandelay.processing;<span id='vl-upload-status-count'/></h3>
-    </div>
-</div>
-
diff --git a/Open-ILS/web/vandelay/inc/queue.xml b/Open-ILS/web/vandelay/inc/queue.xml
deleted file mode 100644 (file)
index 49568fb..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<table class='wide'>
-    <tr>
-        <td align='left'>
-            <h1>&vandelay.record.queue; <span style='font-style:italic;' id='vl-queue-summary-name'/></h1><br/>
-        </td>
-        <td align='right'>
-            &vandelay.queue.total; <span style='font-weight:bold;' id='vl-queue-summary-total-count'/>
-            &vandelay.queue.imported; <span style='font-weight:bold;' id='vl-queue-summary-import-count'/>
-        </td>
-    </tr>
-</table>
-<script>
-    var vlQueueGridLayout;
-    function resetVlQueueGridLayout() {
-        vlQueueGridLayout = [{
-            cells : [[
-                {
-                    name: '&lt;input id="vl-queue-grid-row-selector" type="checkbox" onclick="vlToggleQueueGridSelect();"/>', 
-                    get: vlQueueGridDrawSelectBox, 
-                    styles : 'text-align: center;',
-                    nonSelectable : true
-                }, {   
-                    name: '&vandelay.view.marc;', 
-                    get: vlGetViewMARC, styles : 'text-align: center;',
-                    value: '&lt;a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, false, '+
-                        'function(){displayGlobalDiv(\'vl-queue-div\');});">&vandelay.view.marc;&lt;/a>',
-                    nonSelectable : true
-                }, {   
-                    name: '&vandelay.matches;', 
-                    get: vlGetViewMatches, styles : 'text-align: center;',
-                    value:'&lt;a href="javascript:void(0);" onclick="vlLoadMatchUI(RECID);">&vandelay.matches;&lt;/a>',
-                    nonSelectable : true
-                }, {
-                    name: '&vandelay.import.time;', field:'import_time',  styles : 'text-align: center;',
-                    get:vlGetDateTimeField, 
-                }
-            ]]
-        }];
-    }
-</script>
-<div id='vl-queue-div-grid' class='tall' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-
-    <!-- queue grid navigation row -->
-    <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-        <table width='100%' style='margin-bottom:0px;'>
-            <tr>
-                <td align='left' valign='bottom'>
-                    <select id='vl-queue-actions-selector'>
-                        <option selected='selected' disabled='disabled' value='select-actions'>&vandelay.select_actions;</option>
-                        <option value='import'>&vandelay.import.selected;</option>
-                        <option value='import_all'>&vandelay.import.all;</option>
-                        <option value='delete_queue'>&vandelay.delete.queue;</option>
-                    </select>
-                    <script>
-                        var sel = dojo.byId('vl-queue-actions-selector');
-                        sel.onchange = function(evt) {
-                            switch(openils.Util.selectorValue(evt.target)) {
-                                case 'import': vlImportSelectedRecords(); break;;
-                                case 'import_all': vlImportAllRecords(); break;;
-                                case 'delete_queue': 
-                                    if(confirm('&vandelay.sure.to.delete.queue;')) {
-                                        vlDeleteQueue(currentType, currentQueueId, 
-                                            function() { displayGlobalDiv('vl-marc-upload-div'); });
-                                    }
-                            }
-                            evt.target.selectedIndex = 0;
-                        }
-                    </script>
-                </td>
-                <td align='middle' valign='bottom'>
-                    <style>.filter_span { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
-                    <table><tr>
-                        <td>
-                            <span>&vandelay.limit.to.collision.matches;</span>
-                            <span class='filter_span'>
-                                <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' onchange='retrieveQueuedRecords();'/>
-                            </span>
-
-                            <span>&vandelay.limit.to.non.imported;</span>
-                            <span class='filter_span'>
-                                <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked' onchange='retrieveQueuedRecords();'/>
-                            </span>
-
-                            <span>&vandelay.results.per.page;</span>
-                            <span class='filter_span'>
-                                <select jsId='vlQueueDisplayLimit' id='vl-queue-display-limit-selector'
-                                    value='10' onchange='retrieveQueuedRecords();'>
-                                    <option value='10'>10</option>
-                                    <option value='20'>20</option>
-                                    <option value='50'>50</option>
-                                    <option value='100'>100</option>
-                                </select>
-                            </span>
-
-                            <span style='padding-left:5px;'>&vandelay.page;</span>
-                            <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
-                        </td>
-                    </tr></table>
-                </td>
-                <td align='right' valign='bottom'>
-                    <span style='padding-right:4px;'>
-                        <a href='javascript:void(0);' onclick='vlQueueGridPrevPage();'>&#171; &vandelay.prev.page;</a>
-                    </span>
-                    <span style='padding-right:10px;'>
-                        <a href='javascript:void(0);' onclick='vlQueueGridNextPage();'>&vandelay.next.page; &#187;</a>
-                    </span>
-                </td>
-            </tr>
-        </table>
-    </div>
-
-    <!-- Queue Grid -->
-    <div class='hidden' id='vl-bib-queue-grid-wrapper'>
-        <div dojoType="openils.widget.GridColumnPicker" jsid="vlBibQueueGridMenu" style="display: none;" grid='vlBibQueueGrid'>
-            <div dojoType="dojox.widget.PlaceholderMenuItem" label="GridColumns"></div>
-        </div>
-        <div style='height:600px' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-            <table dojoType='dojox.grid.DataGrid' jsId='vlBibQueueGrid' query="{id:'*'}" headerMenu='vlBibQueueGridMenu'> 
-            </table>
-        </div>
-    </div>
-    <div class='hidden' id='vl-auth-queue-grid-wrapper'>
-        <div dojoType="openils.widget.GridColumnPicker" jsid="vlAuthQueueGridMenu" style="display: none;" grid='vlAuthQueueGrid'>
-            <div dojoType="dojox.widget.PlaceholderMenuItem" label="GridColumns"></div>
-        </div>
-        <div style='height:600px' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-            <table dojoType='dojox.grid.DataGrid' jsId='vlAuthQueueGrid' query="{id:'*'}" headerMenu='vlAuthQueueGridMenu'> 
-            </table>
-        </div>
-    </div>
-</div>
-
diff --git a/Open-ILS/web/vandelay/inc/queueselect.xml b/Open-ILS/web/vandelay/inc/queueselect.xml
deleted file mode 100644 (file)
index 2149dfa..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!-- Form for choosing which queue to view -->
-<h1>&vandelay.select.queue;</h1><br/>
-<table class='form_table'>
-    <tr>
-        <td>&vandelay.queue.type;</td>
-        <td>
-            <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='vlShowQueueSelect();'>
-                <option value='bib' selected='selected'>&vandelay.bib.records;</option>
-                <option value='auth'>&vandelay.auth.records;</option>
-            </select>
-        </td>
-    </tr>
-    <tr>
-        <td>&vandelay.queue;</td>
-        <td>
-            <select jsId='vlQueueSelectQueueList' dojoType='dijit.form.FilteringSelect'>
-            </select>
-        </td>
-    </tr>
-    <tr>
-        <td colspan='2'>
-            <button dojoType='dijit.form.Button' onclick='vlFetchQueueFromForm();'>&vandelay.retrieve.queue;</button>
-        </td>
-    </tr>
-</table>
diff --git a/Open-ILS/web/vandelay/inc/toolbar.xml b/Open-ILS/web/vandelay/inc/toolbar.xml
deleted file mode 100644 (file)
index 6bf3b39..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<div dojoType="dijit.Toolbar" id='toolbar'>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" id='vl-menu-marc-export'
-        onclick="displayGlobalDiv('vl-marc-export-div');" showLabel="true">&vandelay.export.records;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-marc-upload'
-        onclick="displayGlobalDiv('vl-marc-upload-div');" showLabel="true">&vandelay.import.records;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-queue-select'
-        onclick="vlShowQueueSelect();" showLabel="true">&vandelay.inspect.queue;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-attr-editor'
-        onclick="vlShowAttrEditor();" showLabel="true">&vandelay.edit.attributes;</div>
-</div>
diff --git a/Open-ILS/web/vandelay/inc/upload.xml b/Open-ILS/web/vandelay/inc/upload.xml
deleted file mode 100644 (file)
index 9c71353..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<h1>&vandelay.marc.file.upload;</h1><br/>
-<form id="vl-marc-upload-form" enctype="multipart/form-data">
-    <input type='hidden' name='ses' id='vl-ses-input'/>
-    <table class='form_table'>
-        <tr>
-            <td>&vandelay.record.type;</td>
-            <td colspan='4'>
-                <select id='vl-record-type' dojoType='dijit.form.FilteringSelect' 
-                        jsId='vlUploadRecordType' onchange='vlShowUploadForm();'>
-                    <option value='bib' selected='selected'>&vandelay.bib.records;</option>
-                    <option value='auth'>&vandelay.auth.records;</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.create.upload.queue;</td>
-            <td>
-                <input type='text' dojoType='dijit.form.TextBox' id='vl-queue-name' size='32'></input>
-            </td>
-            <td>&vandelay.add.existing.queue;</td>
-            <td>
-                <select jsId='vlUploadQueueSelector' dojoType='dijit.form.FilteringSelect'>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.auto.import.noncolliding;</td>
-            <td colspan='4'>
-                <input jsId='vlUploadQueueAutoImport' dojoType='dijit.form.CheckBox'/>
-            </td>
-        </tr>
-        <tr>
-            <td>&vandelay.import.bib_sources;</td>
-            <td>
-                <select name='bib_source' jsId='vlUploadSourceSelector' dojoType='dijit.form.FilteringSelect' labelAttr='source' searchAttr='source'>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td>
-                <span id="vl-file-label">&vandelay.file.to.upload;</span>
-            </td>
-            <td id='vl-input-td' colspan='4'>
-                <input size='48' type="file" name="marc_upload"/>
-            </td>
-        </tr>
-        <tr>
-            <td align='center' colspan='4'>
-                <button dojoType="dijit.form.Button" onclick="batchUpload()">&vandelay.upload;</button>
-            </td>
-        </tr>
-    </table>
-</form>
-
diff --git a/Open-ILS/web/vandelay/vandelay.css b/Open-ILS/web/vandelay/vandelay.css
deleted file mode 100644 (file)
index 8296037..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-@import "/js/dojo/dojo/resources/dojo.css";
-@import "/js/dojo/dijit/themes/tundra/tundra.css";
-@import "/js/dojo/dojox/grid/_grid/Grid.css";
-@import "/js/dojo/dojox/grid/resources/tundraGrid.css";
-
-.container:after {content: ""; display: block; height: 0; clear: both; }
-html,body { width:100%; height:100%; border:0; margin:0; padding:0; background-color:white; }
-table { border-collapse: collapse; }
-table.dijitTooltipTable { border-collapse: separate; }
-.content { padding: 5px; }
-.form_table td { padding: 6px; }
-.small_form_table td { padding: 1px; }
-.match_div {
-    height: 95%;
-    width: 95%;
-}
-.match_div a {
-    color: red;
-    font-weight:bold;
-}
-.match_div a:visited {
-    color: red;
-    font-weight:bold;
-}
-.tall { height:100%; }
-.wide { width:100%; }
-.hidden { display: none; }
-#toolbar { margin-top: 0px; }
-.progress {margin: 20px;}
-.overlay_selected { 
-    padding: 2px; 
-    background: #d9e8f9;
-    border: 1px solid red; 
-}
-
-.export_tr_border td { border-top: 1px solid #808080; }
-.nav_row_div {padding:1px; text-align:center; }
-.toolbar_selected { border: 2px dashed #808080; text-decoration:underline; font-weight:bold;}
diff --git a/Open-ILS/web/vandelay/vandelay.js b/Open-ILS/web/vandelay/vandelay.js
deleted file mode 100644 (file)
index ef249b6..0000000
+++ /dev/null
@@ -1,1131 +0,0 @@
-/* ---------------------------------------------------------------------------
-# Copyright (C) 2008  Georgia Public Library Service
-# Bill Erickson <erickson@esilibrary.com>
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# --------------------------------------------------------------------------- */
-dojo.require("dojo.parser");
-dojo.require("dojo.io.iframe"); 
-dojo.require("dijit.ProgressBar"); 
-dojo.require("dijit.form.FilteringSelect"); 
-dojo.require("dijit.layout.ContentPane");
-dojo.require("dijit.layout.TabContainer");
-dojo.require("dijit.layout.LayoutContainer");
-dojo.require('dijit.form.Button');
-dojo.require('dijit.form.CheckBox');
-dojo.require('dijit.Toolbar');
-dojo.require('dijit.Tooltip');
-dojo.require('dijit.Menu');
-dojo.require("dijit.Dialog");
-dojo.require("dojo.cookie");
-dojo.require('dojox.grid.DataGrid');
-dojo.require("dojo.data.ItemFileReadStore");
-dojo.require('dojo.date.locale');
-dojo.require('dojo.date.stamp');
-dojo.require("fieldmapper.Fieldmapper");
-dojo.require("fieldmapper.dojoData");
-dojo.require('openils.CGI');
-dojo.require('openils.User');
-dojo.require('openils.Event');
-dojo.require('openils.Util');
-dojo.require('openils.MarcXPathParser');
-dojo.require('openils.widget.GridColumnPicker');
-
-
-var globalDivs = [
-    'vl-generic-progress',
-    'vl-generic-progress-with-total',
-    'vl-marc-upload-div',
-    'vl-queue-div',
-    'vl-match-div',
-    'vl-marc-html-div',
-    'vl-queue-select-div',
-    'vl-marc-upload-status-div',
-    'vl-attr-editor-div',
-    'vl-marc-export-div'
-];
-
-var authtoken;
-var VANDELAY_URL = '/vandelay-upload';
-var bibAttrDefs = [];
-var authAttrDefs = [];
-var queuedRecords = [];
-var queuedRecordsMap = {};
-var bibAttrsFetched = false;
-var authAttrsFetched = false;
-var attrDefMap = {}; // maps attr def code names to attr def ids
-var currentType;
-var currentQueueId = null;
-var userCache = {};
-var currentMatchedRecords; // set of loaded matched bib records
-var currentOverlayRecordsMap; // map of import record to overlay record
-var currentOverlayRecordsMapGid; // map of import record to overlay record grid id
-var currentImportRecId; // when analyzing matches, this is the current import record
-var userBibQueues = []; // only non-complete queues
-var userAuthQueues = []; // only non-complete queues
-var allUserBibQueues;
-var allUserAuthQueues;
-var selectableGridRecords;
-var cgi = new openils.CGI();
-var vlQueueGridColumePicker = {};
-var vlBibSources = [];
-
-/**
-  * Grab initial data
-  */
-function vlInit() {
-    authtoken = dojo.cookie('ses') || cgi.param('ses');
-    var initNeeded = 5; // how many async responses do we need before we're init'd 
-    var initCount = 0; // how many async reponses we've received
-
-    openils.Util.registerEnterHandler(
-        vlQueueDisplayPage.domNode, function(){retrieveQueuedRecords();});
-    openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
-
-    function checkInitDone() {
-        initCount++;
-        if(initCount == initNeeded)
-            runStartupCommands();
-    }
-
-    // Fetch the bib and authority attribute definitions 
-    vlFetchBibAttrDefs(function () { checkInitDone(); });
-    vlFetchAuthAttrDefs(function () { checkInitDone(); });
-
-    vlRetrieveQueueList('bib', null, 
-        function(list) {
-            allUserBibQueues = list;
-            for(var i = 0; i < allUserBibQueues.length; i++) {
-                if(allUserBibQueues[i].complete() == 'f')
-                    userBibQueues.push(allUserBibQueues[i]);
-            }
-            checkInitDone();
-        }
-    );
-
-    vlRetrieveQueueList('auth', null, 
-        function(list) {
-            allUserAuthQueues = list;
-            for(var i = 0; i < allUserAuthQueues.length; i++) {
-                if(allUserAuthQueues[i].complete() == 'f')
-                    userAuthQueues.push(allUserAuthQueues[i]);
-            }
-            checkInitDone();
-        }
-    );
-
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', 'open-ils.permacrud.search.cbs.atomic'],
-        {   async: true,
-            params: [authtoken, {id:{"!=":null}}, {order_by:{cbs:'id'}}],
-            oncomplete : function(r) {
-                vlBibSources = openils.Util.readResponse(r, false, true);
-                checkInitDone();
-            }
-        }
-    );
-
-    vlAttrEditorInit();
-}
-
-
-dojo.addOnLoad(vlInit);
-
-
-// fetch the bib and authority attribute definitions
-
-function vlFetchBibAttrDefs(postcomplete) {
-    bibAttrDefs = [];
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
-        {   async: true,
-            params: [authtoken, {id:{'!=':null}}],
-            onresponse: function(r) {
-                var def = r.recv().content(); 
-                if(e = openils.Event.parse(def[0])) 
-                    return alert(e);
-                bibAttrDefs.push(def);
-            },
-            oncomplete: function() {
-                bibAttrDefs = bibAttrDefs.sort(
-                    function(a, b) {
-                        if(a.id() > b.id()) return 1;
-                        if(a.id() < b.id()) return -1;
-                        return 0;
-                    }
-                );
-                postcomplete();
-            }
-        }
-    );
-}
-
-function vlFetchAuthAttrDefs(postcomplete) {
-    authAttrDefs = [];
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', 'open-ils.permacrud.search.vqarad'],
-        {   async: true,
-            params: [authtoken, {id:{'!=':null}}],
-            onresponse: function(r) {
-                var def = r.recv().content(); 
-                if(e = openils.Event.parse(def[0])) 
-                    return alert(e);
-                authAttrDefs.push(def);
-            },
-            oncomplete: function() {
-                authAttrDefs = authAttrDefs.sort(
-                    function(a, b) {
-                        if(a.id() > b.id()) return 1;
-                        if(a.id() < b.id()) return -1;
-                        return 0;
-                    }
-                );
-                postcomplete();
-            }
-        }
-    );
-}
-
-function vlRetrieveQueueList(type, filter, onload) {
-    type = (type == 'bib') ? type : 'authority';
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.owner.retrieve.atomic'],
-        {   async: true,
-            params: [authtoken, null, filter],
-            oncomplete: function(r) {
-                var list = r.recv().content();
-                if(e = openils.Event.parse(list[0]))
-                    return alert(e);
-                onload(list);
-            }
-        }
-    );
-
-}
-
-function displayGlobalDiv(id) {
-    for(var i = 0; i < globalDivs.length; i++) {
-        try {
-            dojo.style(dojo.byId(globalDivs[i]), 'display', 'none');
-        } catch(e) {
-            alert('please define div ' + globalDivs[i]);
-        }
-    }
-    dojo.style(dojo.byId(id),'display','block');
-
-    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
-    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
-    openils.Util.removeCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
-    openils.Util.removeCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
-
-    switch(id) {
-        case 'vl-marc-export-div':
-            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
-            break;
-        case 'vl-marc-upload-div':
-            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
-            break;
-        case 'vl-queue-select-div':
-            openils.Util.addCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
-            break;
-        case 'vl-attr-editor-div':
-            openils.Util.addCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
-            break;
-    }
-}
-
-function runStartupCommands() {
-    currentQueueId = cgi.param('qid');
-    currentType = cgi.param('qtype');
-    dojo.style('vl-nav-bar', 'visibility', 'visible');
-    if(currentQueueId)
-        return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-    vlShowUploadForm();
-}
-
-/**
-  * asynchronously upload a file of MARC records
-  */
-function uploadMARC(onload){
-    dojo.byId('vl-upload-status-count').innerHTML = '0';
-    dojo.byId('vl-ses-input').value = authtoken;
-    displayGlobalDiv('vl-marc-upload-status-div');
-    dojo.io.iframe.send({
-        url: VANDELAY_URL,
-        method: "post",
-        handleAs: "html",
-        form: dojo.byId('vl-marc-upload-form'),
-        handle: function(data,ioArgs){
-            var content = data.documentElement.textContent;
-            onload(content);
-        }
-    });
-}      
-
-/**
-  * Creates a new vandelay queue
-  */
-function createQueue(queueName, type, onload) {
-    var name = (type=='bib') ? 'bib' : 'authority';
-    var method = 'open-ils.vandelay.'+ name +'_queue.create'
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', method],
-        {   async: true,
-            params: [authtoken, queueName, null, name],
-            oncomplete : function(r) {
-                var queue = r.recv().content();
-                if(e = openils.Event.parse(queue)) 
-                    return alert(e);
-                onload(queue);
-            }
-        }
-    );
-}
-
-/**
-  * Tells vandelay to pull a batch of records from the cache and explode them
-  * out into the vandelay tables
-  */
-function processSpool(key, queueId, type, onload) {
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'.process_spool'],
-        {   async: true,
-            params: [authtoken, key, queueId],
-            onresponse : function(r) {
-                var resp = r.recv().content();
-                if(e = openils.Event.parse(resp)) 
-                    return alert(e);
-                dojo.byId('vl-upload-status-count').innerHTML = resp;
-            },
-            oncomplete : function(r) {onload();}
-        }
-    );
-}
-
-function retrieveQueuedRecords(type, queueId, onload) {
-    displayGlobalDiv('vl-generic-progress');
-    queuedRecords = [];
-    queuedRecordsMap = {};
-    currentOverlayRecordsMap = {};
-    currentOverlayRecordsMapGid = {};
-    selectableGridRecords = {};
-    //resetVlQueueGridLayout();
-
-    if(!type) type = currentType;
-    if(!queueId) queueId = currentQueueId;
-    if(!onload) onload = handleRetrieveRecords;
-
-    var method = 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic';
-    if(vlQueueGridShowMatches.checked)
-        method = method.replace('records', 'records.matches');
-
-    var sel = dojo.byId('vl-queue-display-limit-selector');
-    var limit = parseInt(sel.options[sel.selectedIndex].value);
-    var offset = limit * parseInt(vlQueueDisplayPage.attr('value')-1);
-
-    var params =  [authtoken, queueId, {clear_marc: 1, offset: offset, limit: limit}];
-    if(vlQueueGridShowNonImport.checked)
-        params[2].non_imported = 1;
-
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', method],
-        {   async: true,
-            params: params,
-            /*
-            onresponse: function(r) {
-                console.log("ONREPONSE");
-                var rec = r.recv().content();
-                if(e = openils.Event.parse(rec))
-                    return alert(e);
-                console.log("got record " + rec.id());
-                queuedRecords.push(rec);
-                queuedRecordsMap[rec.id()] = rec;
-            },
-            */
-            oncomplete: function(r){
-                var recs = r.recv().content();
-                if(e = openils.Event.parse(recs[0]))
-                    return alert(e);
-                for(var i = 0; i < recs.length; i++) {
-                    var rec = recs[i];
-                    queuedRecords.push(rec);
-                    queuedRecordsMap[rec.id()] = rec;
-                }
-                onload();
-            }
-        }
-    );
-}
-
-function vlLoadMatchUI(recId) {
-    displayGlobalDiv('vl-generic-progress');
-    var matches = queuedRecordsMap[recId].matches();
-    var records = [];
-    currentImportRecId = recId;
-    for(var i = 0; i < matches.length; i++)
-        records.push(matches[i].eg_record());
-
-    var retrieve = ['open-ils.search', 'open-ils.search.biblio.record_entry.slim.retrieve'];
-    var params = [records];
-    if(currentType == 'auth') {
-        retrieve = ['open-ils.cat', 'open-ils.cat.authority.record.retrieve'];
-        parmas = [authtoken, records, {clear_marc:1}];
-    }
-
-    fieldmapper.standardRequest(
-        retrieve,
-        {   async: true,
-            params:params,
-            oncomplete: function(r) {
-                var recs = r.recv().content();
-                if(e = openils.Event.parse(recs))
-                    return alert(e);
-
-                /* ui mangling */
-                displayGlobalDiv('vl-match-div');
-                resetVlMatchGridLayout();
-                currentMatchedRecords = recs;
-                vlMatchGrid.setStructure(vlMatchGridLayout);
-
-                // build the data store of records with match information
-                var dataStore = bre.toStoreData(recs, null, 
-                    {virtualFields:['dest_matchpoint', 'src_matchpoint', '_id']});
-                dataStore.identifier = '_id';
-
-                var matchSeenMap = {};
-
-                for(var i = 0; i < dataStore.items.length; i++) {
-                    var item = dataStore.items[i];
-                    item._id = i; // just need something unique
-                    for(var j = 0; j < matches.length; j++) {
-                        var match = matches[j];
-                        if(match.eg_record() == item.id && !matchSeenMap[match.id()]) {
-                            item.dest_matchpoint = match.field_type();
-                            var attr = getRecAttrFromMatch(queuedRecordsMap[recId], match);
-                            item.src_matchpoint = getRecAttrDefFromAttr(attr, currentType).code();
-                            matchSeenMap[match.id()] = 1;
-                            break;
-                        }
-                    }
-                }
-
-                // now populate the grid
-                vlPopulateMatchGrid(vlMatchGrid, dataStore);
-            }
-        }
-    );
-}
-
-function vlPopulateMatchGrid(grid, data) {
-    var store = new dojo.data.ItemFileReadStore({data:data});
-    grid.setStore(store);
-    grid.update();
-}
-
-function showMe(id) {
-    dojo.style(dojo.byId(id), 'display', 'block');
-}
-function hideMe(id) {
-    dojo.style(dojo.byId(id), 'display', 'none');
-}
-
-
-function vlLoadMARCHtml(recId, inCat, oncomplete) {
-    dijit.byId('vl-marc-html-done-button').onClick = oncomplete;
-    displayGlobalDiv('vl-generic-progress');
-    var api;
-    var params = [recId, 1];
-
-    if(inCat) {
-        hideMe('vl-marc-html-edit-button'); // don't show marc editor button
-        dijit.byId('vl-marc-html-edit-button').onClick = function(){}
-        api = ['open-ils.search', 'open-ils.search.biblio.record.html'];
-        if(currentType == 'auth')
-            api = ['open-ils.search', 'open-ils.search.authority.to_html'];
-    } else {
-        showMe('vl-marc-html-edit-button'); // plug in the marc editor button
-        dijit.byId('vl-marc-html-edit-button').onClick = 
-            function() {vlLoadMarcEditor(currentType, recId, oncomplete);};
-        params = [authtoken, recId];
-        api = ['open-ils.vandelay', 'open-ils.vandelay.queued_bib_record.html'];
-        if(currentType == 'auth')
-            api = ['open-ils.vandelay', 'open-ils.vandelay.queued_authority_record.html'];
-    }
-
-    fieldmapper.standardRequest(
-        api, 
-        {   async: true,
-            params: params,
-            oncomplete: function(r) {
-            displayGlobalDiv('vl-marc-html-div');
-                var html = r.recv().content();
-                dojo.byId('vl-marc-record-html').innerHTML = html;
-            }
-        }
-    );
-}
-
-
-/*
-function getRecMatchesFromAttrCode(rec, attrCode) {
-    var matches = [];
-    var attr = getRecAttrFromCode(rec, attrCode);
-    for(var j = 0; j < rec.matches().length; j++) {
-        var match = rec.matches()[j];
-        if(match.matched_attr() == attr.id()) 
-            matches.push(match);
-    }
-    return matches;
-}
-*/
-
-function getRecAttrFromMatch(rec, match) {
-    for(var i = 0; i < rec.attributes().length; i++) {
-        var attr = rec.attributes()[i];
-        if(attr.id() == match.matched_attr())
-            return attr;
-    }
-}
-
-function getRecAttrDefFromAttr(attr, type) {
-    var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
-    for(var i = 0; i < defs.length; i++) {
-        var def = defs[i];
-        if(def.id() == attr.field())
-            return def;
-    }
-}
-
-function getRecAttrFromCode(rec, attrCode) {
-    var defId = attrDefMap[currentType][attrCode];
-    var attrs = rec.attributes();
-    for(var i = 0; i < attrs.length; i++) {
-        var attr = attrs[i];
-        if(attr.field() == defId) 
-            return attr;
-    }
-    return null;
-}
-
-function vlGetViewMatches(rowIdx, item) {
-    if(!item) return '';
-    var id = this.grid.store.getValue(item, 'id');
-    var rec = queuedRecordsMap[id];
-    if(rec.matches().length > 0)
-        return this.value.replace('RECID', id);
-    return '';
-}
-
-function getAttrValue(rowIdx, item) {
-    if(!item) return '';
-    var attrCode = this.field.split('.')[1];
-    var rec = queuedRecordsMap[this.grid.store.getValue(item, 'id')];
-    var attr = getRecAttrFromCode(rec, attrCode);
-    return (attr) ? attr.attr_value() : '';
-}
-
-function vlGetDateTimeField(rowIdx, item) {
-    if(!item) return '';
-    var value = this.grid.store.getValue(item, this.field);
-    if(!value) return '';
-    var date = dojo.date.stamp.fromISOString(value);
-    return dojo.date.locale.format(date, {selector:'date'});
-}
-
-function vlGetCreator(rowIdx, item) {
-    if(!item) return '';
-    var id = this.grid.store.getValue(item, 'creator');
-    if(userCache[id])
-        return userCache[id].usrname();
-    var user = fieldmapper.standardRequest(
-        ['open-ils.actor', 'open-ils.actor.user.retrieve'], [authtoken, id]);
-    if(e = openils.Event.parse(user))
-        return alert(e);
-    userCache[id] = user;
-    return user.usrname();
-}
-
-function vlGetViewMARC(rowIdx, item) {
-    if(!item) return '';
-    return this.value.replace('RECID', this.grid.store.getValue(item, 'id'));
-}
-
-function vlGetOverlayTargetSelector(rowIdx, item) {
-    if(!item) return '';
-    var _id = this.grid.store.getValue(item, '_id');
-    var id = this.grid.store.getValue(item, 'id');
-    var value = this.value.replace(/GRIDID/g, _id);
-    value = value.replace(/RECID/g, currentImportRecId);
-    value = value.replace(/ID/g, id);
-    if(_id == currentOverlayRecordsMapGid[currentImportRecId])
-        return value.replace('/>', 'checked="checked"/>');
-    return value;
-}
-
-/**
-  * see if the user has enabled overlays for the current match set and, 
-  * if so, map the current import record to the overlay target.
-  */
-function vlHandleOverlayTargetSelected(recId, gridId) {
-    var noneSelected = true;
-    var checkboxes = dojo.query('[name=vl-overlay-target-'+currentImportRecId+']');
-    for(var i = 0; i < checkboxes.length; i++) {
-        var checkbox = checkboxes[i];
-        var matchRecId = checkbox.getAttribute('match');
-        var gid = checkbox.getAttribute('gridid');
-        if(checkbox.checked) {
-            if(matchRecId == recId && gid == gridId) {
-                noneSelected = false;
-                currentOverlayRecordsMap[currentImportRecId] = matchRecId;
-                currentOverlayRecordsMapGid[currentImportRecId] = gid;
-                dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = true;
-                dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = 'overlay_selected';
-            } else {
-                checkbox.checked = false;
-            }
-        }
-    }
-
-    if(noneSelected) {
-        delete currentOverlayRecordsMap[currentImportRecId];
-        delete currentOverlayRecordsMapGid[currentImportRecId];
-        dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = false;
-        dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = '';
-    }
-}
-
-var valLastQueueType = null;
-function buildRecordGrid(type) {
-    displayGlobalDiv('vl-queue-div');
-
-    if(type == 'bib') {
-        openils.Util.show('vl-bib-queue-grid-wrapper');
-        openils.Util.hide('vl-auth-queue-grid-wrapper');
-        vlQueueGrid = vlBibQueueGrid;
-        vlQueueGridMenu = vlBibQueueGridMenu;
-    } else {
-        openils.Util.show('vl-auth-queue-grid-wrapper');
-        openils.Util.hide('vl-bib-queue-grid-wrapper');
-        vlQueueGrid = vlAuthQueueGrid;
-        vlQueueGridMenu = vlAuthQueueGridMenu;
-    }
-
-    if(valLastQueueType != type) {
-        valLastQueueType = type;
-        resetVlQueueGridLayout();
-        var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
-        attrDefMap[type] = {};
-        for(var i = 0; i < defs.length; i++) {
-            var def = defs[i]
-            attrDefMap[type][def.code()] = def.id();
-            var col = {
-                name:def.description(), 
-                field:'attr.' + def.code(),
-                get: getAttrValue,
-                selectableColumn:true
-            };
-            vlQueueGridLayout[0].cells[0].push(col);
-        }
-    }
-
-    var storeData;
-    if(type == 'bib')
-        storeData = vqbr.toStoreData(queuedRecords);
-    else
-        storeData = vqar.toStoreData(queuedRecords);
-
-    var store = new dojo.data.ItemFileReadStore({data:storeData});
-    vlQueueGrid.setStore(store);
-
-    if(vlQueueGridColumePicker[type]) {
-        vlQueueGrid.update();
-    } else {
-        vlQueueGrid.attr('structure', vlQueueGridLayout);
-        vlQueueGridMenu.init({
-            grid : vlQueueGrid, 
-            authtoken : authtoken, 
-            prefix : 'vandelay.queue.'+type
-        });
-        vlQueueGridMenu.load();
-        vlQueueGridColumePicker[type] = vlQueueGridMenu;
-    }
-}
-
-function vlQueueGridPrevPage() {
-    var page = parseInt(vlQueueDisplayPage.getValue());
-    if(page < 2) return;
-    vlQueueDisplayPage.setValue(page - 1);
-    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-}
-
-function vlQueueGridNextPage() {
-    vlQueueDisplayPage.setValue(parseInt(vlQueueDisplayPage.getValue())+1);
-    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-}
-
-function vlDeleteQueue(type, queueId, onload) {
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.delete'],
-        {   async: true,
-            params: [authtoken, queueId],
-            oncomplete: function(r) {
-                var resp = r.recv().content();
-                if(e = openils.Event.parse(resp))
-                    return alert(e);
-                onload();
-            }
-        }
-    );
-}
-
-
-function vlQueueGridDrawSelectBox(rowIdx, item) {
-    if(!item) return '';
-    var id = this.grid.store.getValue(item, 'id');
-    var domId = 'vl-record-list-selected-' + id;
-    selectableGridRecords[domId] = id;
-    return "<div><input type='checkbox' id='"+domId+"'/></div>";
-}
-
-function vlSelectAllQueueGridRecords() {
-    for(var id in selectableGridRecords) 
-        dojo.byId(id).checked = true;
-}
-function vlSelectNoQueueGridRecords() {
-    for(var id in selectableGridRecords) 
-        dojo.byId(id).checked = false;
-}
-function vlToggleQueueGridSelect() {
-    if(dojo.byId('vl-queue-grid-row-selector').checked)
-        vlSelectAllQueueGridRecords();
-    else
-        vlSelectNoQueueGridRecords();
-}
-
-var handleRetrieveRecords = function() {
-    buildRecordGrid(currentType);
-    vlFetchQueueSummary(currentQueueId, currentType, 
-        function(summary) {
-            dojo.byId('vl-queue-summary-name').innerHTML = summary.queue.name();
-            dojo.byId('vl-queue-summary-total-count').innerHTML = summary.total +'';
-            dojo.byId('vl-queue-summary-import-count').innerHTML = summary.imported + '';
-        }
-    );
-}
-
-function vlFetchQueueSummary(qId, type, onload) {
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.summary.retrieve'],
-        {   async: true,
-            params: [authtoken, qId],
-            oncomplete : function(r) {
-                var summary = r.recv().content();
-                if(e = openils.Event.parse(summary))
-                    return alert(e);
-                return onload(summary);
-            }
-        }
-    );
-}
-    
-
-function vlImportSelectedRecords() {
-    displayGlobalDiv('vl-generic-progress-with-total');
-    var records = [];
-
-    for(var id in selectableGridRecords) {
-        if(dojo.byId(id).checked) {
-            var recId = selectableGridRecords[id];
-            var rec = queuedRecordsMap[recId];
-            if(!rec.import_time()) 
-                records.push(recId);
-        }
-    }
-
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+currentType+'_record.list.import'],
-        {   async: true,
-            params: [authtoken, records, {overlay_map:currentOverlayRecordsMap}],
-            onresponse: function(r) {
-                var resp = r.recv().content();
-                if(e = openils.Event.parse(resp))
-                    return alert(e);
-                if(resp.complete) {
-                    return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-                } else {
-                    vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
-                }
-            }, 
-        }
-    );
-}
-
-function vlImportAllRecords() {
-    vlImportRecordQueue(currentType, currentQueueId, false,
-        function(){displayGlobalDiv('vl-queue-div');});
-}
-
-function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
-    displayGlobalDiv('vl-generic-progress-with-total');
-    var method = 'open-ils.vandelay.bib_queue.import';
-    if(noMatchOnly)
-        method = method.replace('import', 'nomatch.import');
-    if(type == 'auth')
-        method = method.replace('bib', 'auth');
-
-    fieldmapper.standardRequest(
-        ['open-ils.vandelay', method],
-        {   async: true,
-            params: [authtoken, queueId],
-            onresponse: function(r) {
-                var resp = r.recv().content();
-                if(e = openils.Event.parse(resp))
-                    return alert(e);
-                vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
-            },
-            oncomplete: function() {onload();}
-        }
-    );
-}
-
-
-/**
-  * Create queue, upload MARC, process spool, load the newly created queue 
-  */
-function batchUpload() {
-    var queueName = dijit.byId('vl-queue-name').getValue();
-    currentType = dijit.byId('vl-record-type').getValue();
-
-    var handleProcessSpool = function() {
-        if(vlUploadQueueAutoImport.checked) {
-            vlImportRecordQueue(currentType, currentQueueId, true,  
-                function() {
-                    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-                }
-            );
-        } else {
-            retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-        }
-    }
-
-    var handleUploadMARC = function(key) {
-        dojo.style(dojo.byId('vl-upload-status-processing'), 'display', 'block');
-        processSpool(key, currentQueueId, currentType, handleProcessSpool);
-    };
-
-    var handleCreateQueue = function(queue) {
-        currentQueueId = queue.id();
-        uploadMARC(handleUploadMARC);
-    };
-    
-    if(vlUploadQueueSelector.getValue() && !queueName) {
-        currentQueueId = vlUploadQueueSelector.getValue();
-        uploadMARC(handleUploadMARC);
-    } else {
-        createQueue(queueName, currentType, handleCreateQueue);
-    }
-}
-
-
-function vlFleshQueueSelect(selector, type) {
-    var data = (type == 'bib') ? vbq.toStoreData(allUserBibQueues) : vaq.toStoreData(allUserAuthQueues);
-    selector.store = new dojo.data.ItemFileReadStore({data:data});
-    selector.setValue(null);
-    selector.setDisplayedValue('');
-    if(data[0])
-        selector.setValue(data[0].id());
-}
-
-function vlShowUploadForm() {
-    displayGlobalDiv('vl-marc-upload-div');
-    vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue());
-    vlUploadSourceSelector.store = 
-        new dojo.data.ItemFileReadStore({data:cbs.toStoreData(vlBibSources, 'source')});
-    vlUploadSourceSelector.setValue(vlBibSources[0].id());
-}
-
-function vlShowQueueSelect() {
-    displayGlobalDiv('vl-queue-select-div');
-    vlFleshQueueSelect(vlQueueSelectQueueList, vlQueueSelectType.getValue());
-}
-
-function vlFetchQueueFromForm() {
-    currentType = vlQueueSelectType.getValue();
-    currentQueueId = vlQueueSelectQueueList.getValue();
-    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-}
-
-function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) {
-    /*
-        To run in Firefox directly, must set signed.applets.codebase_principal_support
-        to true in about:config
-    */
-    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
-
-    function onsave(r) {
-        // after the record is saved, reload the HTML display
-        var stat = r.recv().content();
-        if(e = openils.Event.parse(stat))
-            return alert(e);
-        alert(dojo.byId('vl-marc-edit-complete-label').innerHTML);
-        win.close();
-        vlLoadMARCHtml(rec.id(), false, postReloadHTMLHandler);
-    }
-
-    win.xulG = {
-        record : {marc : rec.marc()},
-        save : {
-            label: dojo.byId('vl-marc-edit-save-label').innerHTML,
-            func: function(xmlString) {
-                var method = 'open-ils.permacrud.update.' + rec.classname;
-                rec.marc(xmlString);
-                fieldmapper.standardRequest(
-                    ['open-ils.permacrud', method],
-                    {   async: true,
-                        params: [authtoken, rec],
-                        oncomplete: onsave
-                    }
-                );
-            },
-        }
-    };
-}
-
-function vlLoadMarcEditor(type, recId, postReloadHTMLHandler) {
-    var method = 'open-ils.permacrud.search.vqbr';
-    if(currentType != 'bib')
-        method = method.replace(/vqbr/,'vqar');
-
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', method],
-        {   async: true, 
-            params: [authtoken, {id : recId}],
-            oncomplete: function(r) {
-                var rec = r.recv().content();
-                if(e = openils.Event.parse(rec))
-                    return alert(e);
-                vlOpenMarcEditWindow(rec, postReloadHTMLHandler);
-            }
-        }
-    );
-}
-
-
-
-//------------------------------------------------------------
-// attribute editors
-
-// attribute-editor global variables
-
-var ATTR_EDITOR_IN_UPDATE_MODE = false;        // true on 'edit', false on 'create'
-var ATTR_EDIT_ID = null;               // id of current 'edit' attribute
-var ATTR_EDIT_GROUP = 'bib';           // bib-attrs or auth-attrs
-
-function vlAttrEditorInit() {
-    // set up tooltips on the edit form
-    connectTooltip('attr-editor-tags'); 
-    connectTooltip('attr-editor-subfields'); 
-}
-
-function vlShowAttrEditor() {
-    displayGlobalDiv('vl-attr-editor-div');
-    loadAttrEditorGrid();
-    idHide('vl-generic-progress');
-}
-
-function setAttrEditorGroup(groupName) {
-    // put us into 'bib'-attr or 'auth'-attr mode.
-    if (ATTR_EDIT_GROUP != groupName) {
-       ATTR_EDIT_GROUP = groupName;
-       loadAttrEditorGrid();
-    }
-}
-
-function onAttrEditorOpen() {
-    // the "bars" have the create/update/cancel/etc. buttons.
-    var create_bar = document.getElementById('attr-editor-create-bar');
-    var update_bar = document.getElementById('attr-editor-update-bar');
-    if (ATTR_EDITOR_IN_UPDATE_MODE) {
-       update_bar.style.display='table-row';
-       create_bar.style.display='none';
-       // hide the dropdown-button
-       idStyle('vl-create-attr-editor-button', 'visibility', 'hidden');
-    } else {
-       dijit.byId('attr-editor-dialog').reset();
-       create_bar.style.display='table-row';
-       update_bar.style.display='none';
-    }
-}
-
-function onAttrEditorClose() {
-    // reset the form to a "create" form. (We may have borrowed it for editing.)
-    ATTR_EDITOR_IN_UPDATE_MODE = false;
-    // show the dropdown-button
-    idStyle('vl-create-attr-editor-button', 'visibility', 'visible');
-}
-
-function loadAttrEditorGrid() {
-    var _data = (ATTR_EDIT_GROUP == 'auth') ? 
-       vqarad.toStoreData(authAttrDefs) : vqbrad.toStoreData(bibAttrDefs) ;
-
-    var store = new dojo.data.ItemFileReadStore({data:_data});
-    attrEditorGrid.setStore(store);
-    dojo.connect(attrEditorGrid, 'onRowDblClick', onAttrEditorClick);
-    attrEditorGrid.update();
-}
-
-function attrGridGetTag(n, item) {
-    // grid helper: return the tags from the row's xpath column.
-    return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).tags;
-}
-
-function attrGridGetSubfield(n, item) {
-    // grid helper: return the subfields from the row's xpath column.
-    return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).subfields;
-}
-
-function onAttrEditorClick() {
-    var row = this.getItem(this.focus.rowIndex);
-    ATTR_EDIT_ID = this.store.getValue(row, 'id');
-    ATTR_EDITOR_IN_UPDATE_MODE = true;
-
-    // populate the popup editor.
-    dijit.byId('attr-editor-code').attr('value', this.store.getValue(row, 'code'));
-    dijit.byId('attr-editor-description').attr('value', this.store.getValue(row, 'description'));
-    var parsed_xpath = xpathParser.parse(this.store.getValue(row, 'xpath'));
-    dijit.byId('attr-editor-tags').attr('value', parsed_xpath.tags);
-    dijit.byId('attr-editor-subfields').attr('value', parsed_xpath.subfields);
-    dijit.byId('attr-editor-identifier').attr('value', this.store.getValue(row, 'ident'));
-    dijit.byId('attr-editor-xpath').attr('value', this.store.getValue(row, 'xpath'));
-    dijit.byId('attr-editor-remove').attr('value', this.store.getValue(row, 'remove'));
-
-    // set up UI for editing
-    dojo.byId('vl-create-attr-editor-button').click();
-}
-
-function vlSaveAttrDefinition(data) {
-    idHide('vl-attr-editor-div');
-    idShow('vl-generic-progress');
-
-    data.id = ATTR_EDIT_ID;
-
-    // this ought to honour custom xpaths, but overwrite xpaths
-    // derived from tags/subfields.
-    if (data.xpath == '' || looksLikeDerivedXpath(data.xpath)) {
-       var _xpath = tagAndSubFieldsToXpath(data.tag, data.subfield);
-       data.xpath = _xpath;
-    }
-
-    // build up our permacrud params. Key variables here are
-    // "create or update" and "bib or auth".
-
-    var isAuth   = (ATTR_EDIT_GROUP == 'auth');
-    var isCreate = (ATTR_EDIT_ID == null);
-    var rad      = isAuth ? new vqarad() : new vqbrad() ;
-    var method   = 'open-ils.permacrud' + (isCreate ? '.create.' : '.update.') 
-       + (isAuth ? 'vqarad' : 'vqbrad');
-    var _data    = rad.fromStoreItem(data);
-
-    _data.ischanged(1);
-
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', method],
-        {   async: true,
-            params: [authtoken, _data ],
-           onresponse: function(r) { },
-            oncomplete: function(r) {
-               attrEditorFetchAttrDefs(vlShowAttrEditor);
-               ATTR_EDIT_ID = null;
-           },
-           onerror: function(r) {
-               alert('vlSaveAttrDefinition comms error: ' + r);
-           }
-        }
-    );
-}
-
-function attrEditorFetchAttrDefs(callback) {
-    var fn = (ATTR_EDIT_GROUP == 'auth') ? vlFetchAuthAttrDefs : vlFetchBibAttrDefs;
-    return fn(callback);
-}
-
-function vlAttrDelete() {
-    idHide('vl-attr-editor-div');
-    idShow('vl-generic-progress');
-
-    var isAuth = (ATTR_EDIT_GROUP == 'auth');
-    var method = 'open-ils.permacrud.delete.' + (isAuth ? 'vqarad' : 'vqbrad');
-    var rad    = isAuth ? new vqarad() : new vqbrad() ;
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', method],
-        {   async: true,
-           params: [authtoken, rad.fromHash({ id : ATTR_EDIT_ID }), ],
-           oncomplete: function() {
-               dijit.byId('attr-editor-dialog').onCancel(); // close the dialog
-               attrEditorFetchAttrDefs(vlShowAttrEditor);
-               ATTR_EDIT_ID = null;
-           },
-           onerror: function(r) {
-               alert('vlAttrDelete comms error: ' + r);
-           }
-        }
-    );
-}
-
-// ------------------------------------------------------------
-// utilities for attribute editors
-
-// dom utilities (maybe dojo does these, and these should be replaced)
-
-function idStyle(obId, k, v)   { document.getElementById(obId).style[k] = v;   }
-function idShow(obId)          { idStyle(obId, 'display', 'block');            }
-function idHide(obId)          { idStyle(obId, 'display' , 'none');            }
-
-function connectTooltip(fieldId) {
-    // Given an element id, look up a tooltip element in the doc (same
-    // id with a '-tip' suffix) and associate the two. Maybe dojo has
-    // a better way to do this?
-    var fld = dojo.byId(fieldId);
-    var tip = dojo.byId(fieldId + '-tip');
-    dojo.connect(fld, 'onfocus', function(evt) {
-                    dijit.showTooltip(tip.innerHTML, fld, ['below', 'after']); });
-    dojo.connect(fld, 'onblur', function(evt) { dijit.hideTooltip(fld); });
-}
-
-// xpath utilities
-
-var xpathParser = new openils.MarcXPathParser();
-
-function tagAndSubFieldsToXpath(tags, subfields) {
-    // given tags, and subfields, build up an XPath.
-    try {
-       var parts = {
-           'tags':tags.match(/[\d]+/g), 
-           'subfields':subfields.match(/[a-zA-z]/g) };
-       return xpathParser.compile(parts);
-    } catch (err) {
-       return {'parts':null, 'tags':null, 'error':err};
-    }
-}
-
-function looksLikeDerivedXpath(path) {
-    // Does this path look like it was derived from tags and subfields?
-    var parsed = xpathParser.parse(path);
-    if (parsed.tags == null) 
-       return false;
-    var compiled = xpathParser.compile(parsed);
-    return (path == compiled);
-}
-
-// amazing xpath-util unit-tests
-if (!looksLikeDerivedXpath('//*[@tag="901"]/*[@code="c"]'))    alert('vandelay xpath-utility error');
-if ( looksLikeDerivedXpath('ba-boo-ba-boo!'))                  alert('vandelay xpath-utility error');
diff --git a/Open-ILS/web/vandelay/vandelay.xml b/Open-ILS/web/vandelay/vandelay.xml
deleted file mode 100644 (file)
index 1530749..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<!-- 
-# Copyright (C) 2008  Georgia Public Library Service
-# Bill Erickson <erickson@esilibrary.com>
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
--->
-
-<!DOCTYPE html PUBLIC 
-       "-//W3C//DTD XHTML 1.0 Transitional//EN" 
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
-       <!--#include virtual="/opac/locale/${locale}/vandelay.dtd"-->
-]>
-
-<html xmlns='http://www.w3.org/1999/xhtml'>
-    <head>
-        <title>&vandelay.vandelay;</title>
-        <link type='text/css' rel='stylesheet' href="/vandelay/vandelay.css"/>
-        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
-        <script type="text/javascript" src='/js/dojo/openils/MarcXPathParser.js'></script>
-        <script type="text/javascript" src='/vandelay/vandelay.js'></script>
-    </head>
-    <body class="tundra">
-        <div dojoType="dijit.layout.LayoutContainer" orientation="vertical" class="tall">
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='top' id="vl-nav-bar" style="visibility: hidden;">
-                <!--#include virtual="inc/toolbar.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-                <!--#include virtual="inc/progress.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-export-div' class='hidden content'>
-                <!--#include virtual="inc/export.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-div' class='hidden content'>
-                <!--#include virtual="inc/upload.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-div' class='tall hidden content'>
-                <!--#include virtual="inc/queue.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-match-div' class='tall hidden content'>
-                <!--#include virtual="inc/matches.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-html-div' class='tall hidden content'>
-                <!--#include virtual="inc/marchtml.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-select-div' class='tall hidden content'>
-                <!--#include virtual="inc/queueselect.xml"-->
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign="client"  id="vl-attr-editor-div" 
-                    class='hidden attr-editor-detail-content-pane content' title='&vandelay.edit.attrs;'>
-                <!--#include virtual="inc/attrs.xml"-->
-            </div>
-        </div>
-    </body>
-</html>