From acd417f59824c4add002edf2c24b7a8a32e5791a Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 4 Aug 2006 21:30:59 +0000 Subject: [PATCH] list clipboard, and added it to copy status git-svn-id: svn://svn.open-ils.org/ILS/trunk@5312 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/main/constants.js | 1 + .../xul/staff_client/chrome/content/util/list.js | 42 ++++++++ .../chrome/content/util/list_clipboard.xul | 108 +++++++++++++++++++++ Open-ILS/xul/staff_client/external/template.xul | 5 +- .../xul/staff_client/server/circ/copy_status.js | 6 ++ .../xul/staff_client/server/circ/copy_status.xul | 1 + .../server/circ/copy_status_overlay.xul | 6 +- Open-ILS/xul/staff_client/server/skin/global.css | 1 + 8 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index d50b631aab..664237ef95 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -172,6 +172,7 @@ const urls = { 'XUL_HOLDS_BROWSER' : '/xul/server/patron/holds.xul', 'XUL_HOLD_NOTICES' : '/xul/server/patron/hold_notices.xul', 'XUL_IN_HOUSE_USE' : '/xul/server/circ/in_house_use.xul', + 'XUL_LIST_CLIPBOARD' : '/xul/server/util/list_clipboard.xul', 'XUL_LOCAL_ADMIN' : '/xul/server/admin/index.xhtml', 'XUL_MARC_NEW' : '/xul/server/cat/marc_new.xul', 'XUL_MARC_EDIT_LEGACY' : 'chrome://open_ils_staff_client/content/legacy/_marc.xul', diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index 1607429c11..488ed3466b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -661,6 +661,48 @@ util.list.prototype = { return dump; }, + 'dump_selected_with_keys' : function(params) { + var obj = this; + switch(this.node.nodeName) { + case 'tree' : return this._dump_tree_selection_with_keys(params); break; + default: throw('NYI: Need .dump_selection_with_keys() for ' + this.node.nodeName); break; + } + + }, + + '_dump_tree_selection_with_keys' : function(params) { + var obj = this; + var dump = []; + var list = obj._retrieve_selection_from_tree(); + for (var i = 0; i < list.length; i++) { + var row = {}; + var treeitem = list[i]; + var treerow = treeitem.firstChild; + for (var j = 0; j < treerow.childNodes.length; j++) { + var value = treerow.childNodes[j].getAttribute('label'); + //FIXME + //if (params.skip_hidden_columns) if (obj.node.firstChild.childNodes[j].getAttribute('hidden')) continue; + var id = obj.columns[j].id; if (params.labels_instead_of_ids) id = obj.columns[j].label; + row[ id ] = value; + } + dump.push( row ); + } + return dump; + }, + + 'clipboard' : function() { + try { + var obj = this; + var dump = obj.dump_selected_with_keys({'skip_hidden_columns':true,'labels_instead_of_ids':true}); + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); + data.list_clipboard = dump; data.stash('list_clipboard'); + JSAN.use('util.window'); var win = new util.window(); + win.open(urls.XUL_LIST_CLIPBOARD,'list_clipboard','chrome,resizable,modal'); + } catch(E) { + this.error.standard_unexpected_error_alert('clipboard',E); + } + }, + 'dump_retrieve_ids' : function(params) { var obj = this; switch(this.node.nodeName) { diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul b/Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul new file mode 100644 index 0000000000..695fa67d19 --- /dev/null +++ b/Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul @@ -0,0 +1,108 @@ + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + Choose the data to copy into the clipboard: + + + + +