From 2764d19f5c33254f916802fb5256d28261f93228 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Tue, 22 Dec 2009 10:32:14 +0000 Subject: [PATCH] Misc tweaks to billing interface and list infrastructure. Fix mislabeled column for title in payments history interface. Support preservation of treecell properties, and style specific columns in the bills interface instead of whole rows. Support immediate fleshing of rows in lists, and do such in the bills interface since the various tallies in that interface depend on the data being fully retrieved. TODO: Revisit the preservation of treecell properties. May be some unintended consequences to not blowing away and re-creating the treecell elements when refreshing rows in a list. Hrmm, perhaps a field being unset but its previous value still being rendered. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15218 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/chrome/content/util/list.js | 77 ++++++++++++---------- .../server/locale/en-US/patron.properties | 2 +- Open-ILS/xul/staff_client/server/patron/bill2.js | 8 ++- Open-ILS/xul/staff_client/server/skin/circ.css | 14 +++- 4 files changed, 62 insertions(+), 39 deletions(-) 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 7283e26b44..5ce3092daf 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -494,13 +494,15 @@ util.list.prototype = { }, false ); - /* - setTimeout( - function() { - util.widgets.dispatch('flesh',treerow); - }, 0 - ); - */ + if (typeof params.flesh_immediately != 'undefined') { + if (params.flesh_immediately) { + setTimeout( + function() { + util.widgets.dispatch('flesh',treerow); + }, 0 + ); + } + } } else { obj.put_retrieving_label(treerow); treerow.addEventListener( @@ -518,13 +520,15 @@ util.list.prototype = { }, false ); - /* - setTimeout( - function() { - util.widgets.dispatch('flesh',treerow); - }, 0 - ); - */ + if (typeof params.flesh_immediately != 'undefined') { + if (params.flesh_immediately) { + setTimeout( + function() { + util.widgets.dispatch('flesh',treerow); + }, 0 + ); + } + } } this.error.sdump('D_LIST',s); @@ -646,13 +650,16 @@ util.list.prototype = { }, false ); - /* - setTimeout( - function() { - util.widgets.dispatch('flesh',treerow); - }, 0 - ); - */ + if (typeof params.flesh_immediately != 'undefined') { + if (params.flesh_immediately) { + setTimeout( + function() { + util.widgets.dispatch('flesh',treerow); + }, 0 + ); + } + } + } else { s += 'did not find a retrieve_row function\n'; @@ -673,13 +680,16 @@ util.list.prototype = { }, false ); - /* - setTimeout( - function() { - util.widgets.dispatch('flesh',treerow); - }, 0 - ); - */ + if (typeof params.flesh_immediately != 'undefined') { + if (params.flesh_immediately) { + setTimeout( + function() { + util.widgets.dispatch('flesh',treerow); + }, 0 + ); + } + } + } try { @@ -933,12 +943,13 @@ util.list.prototype = { '_map_row_to_treecell' : function(params,treerow) { var obj = this; var s = ''; - util.widgets.remove_children(treerow); + //util.widgets.remove_children(treerow); + var create_treecells = treerow.childNodes.length == 0; if (typeof params.map_row_to_column == 'function' || typeof this.map_row_to_column == 'function') { for (var i = 0; i < this.columns.length; i++) { - var treecell = document.createElement('treecell'); + var treecell = create_treecells ? document.createElement('treecell') : treerow.childNodes[i]; if ( this.columns[i].editable == false ) { treecell.setAttribute('editable','false'); } var label = ''; if (params.skip_columns && (params.skip_columns.indexOf(i) != -1)) { @@ -964,7 +975,7 @@ util.list.prototype = { } if (this.columns[i].type == 'checkbox') { treecell.setAttribute('value',label); } else { treecell.setAttribute('label',label ? label : ''); } - treerow.appendChild( treecell ); + if (create_treecells) { treerow.appendChild( treecell ); } s += ('treecell = ' + treecell + ' with label = ' + label + '\n'); } } else if (typeof params.map_row_to_columns == 'function' || typeof this.map_row_to_columns == 'function') { @@ -981,14 +992,14 @@ util.list.prototype = { } for (var i = 0; i < labels.length; i++) { - var treecell = document.createElement('treecell'); + var treecell = create_treecells ? document.createElement('treecell') : treerow.childNodes[i]; if ( this.columns[i].editable == false ) { treecell.setAttribute('editable','false'); } if ( this.columns[i].type == 'checkbox') { treecell.setAttribute('value', labels[i]); } else { treecell.setAttribute('label',typeof labels[i] == 'string' || typeof labels[i] == 'number' ? labels[i] : ''); } - treerow.appendChild( treecell ); + if (create_treecells) { treerow.appendChild( treecell ); } s += ('treecell = ' + treecell + ' with label = ' + labels[i] + '\n'); } diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 583e98599b..cf6cf825c4 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -45,7 +45,7 @@ staff.patron.bill_history.handle_void.confirm_message=Check here to confirm this staff.patron.bill_history.print_bills.print_error=printing bills staff.patron.bill_history.column.xact_type.label=Transaction Type staff.patron.bill_history.column.last_billing_type.label=Last Billing Type -staff.patron.bill_history.column.title.label=Last Billing Type +staff.patron.bill_history.column.title.label=Title staff.patron.bills.init_controller.money_summary_label=Money Summary staff.patron.bills.bill_payment_amount.credit_amount=Patron only has %1$s in credit. diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index b572db6f10..1b73e3683a 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -367,8 +367,8 @@ function check_all_refunds() { function gen_list_append_func(r) { return function() { - if (typeof r == 'object') { g.row_map[ r.id() ] = g.bill_list.append( { 'retrieve_id' : r.id(), 'row' : { 'my' : { 'checked' : true, 'mbts' : r } } } ); - } else { g.row_map[r] = g.bill_list.append( { 'retrieve_id' : r, 'row' : { 'my' : { 'checked' : true } } } ); } + if (typeof r == 'object') { g.row_map[ r.id() ] = g.bill_list.append( { 'retrieve_id' : r.id(), 'flesh_immediately' : true, 'row' : { 'my' : { 'checked' : true, 'mbts' : r } } } ); + } else { g.row_map[r] = g.bill_list.append( { 'retrieve_id' : r, 'flesh_immediately' : true, 'row' : { 'my' : { 'checked' : true } } } ); } } } @@ -476,10 +476,12 @@ function init_lists() { try { if ( row && row.my && row.my.mbts && Number( row.my.mbts.balance_owed() ) < 0 ) { util.widgets.addProperty(params.row_node.firstChild,'refundable'); + util.widgets.addProperty(params.row_node.firstChild.childNodes[ g.payment_pending_column_idx ],'refundable'); } if ( row && row.my && row.my.circ && ! row.my.circ.checkin_time() ) { $('circulating_hint').hidden = false; util.widgets.addProperty(params.row_node.firstChild,'circulating'); + util.widgets.addProperty(params.row_node.firstChild.childNodes[ g.title_column_idx ],'circulating'); } } catch(E) { g.error.sdump('D_WARN','Error setting list properties in bill2.js: ' + E); @@ -526,6 +528,8 @@ function init_lists() { } } ); + g.title_column_idx = util.functional.map_list( g.bill_list.columns, function(o) { return o.id; } ).indexOf( 'title' ); + g.payment_pending_column_idx = util.functional.map_list( g.bill_list.columns, function(o) { return o.id; } ).indexOf( 'payment_pending' ); $('bill_list_actions').appendChild( g.bill_list.render_list_actions() ); g.bill_list.set_list_actions(); } diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css index 3b268749b2..7369275e50 100644 --- a/Open-ILS/xul/staff_client/server/skin/circ.css +++ b/Open-ILS/xul/staff_client/server/skin/circ.css @@ -3,12 +3,20 @@ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace html url("http://www.w3.org/TR/REC-html40"); -treechildren::-moz-tree-row(refundable) { +treechildren::-moz-tree-cell(refundable) { background-color: pink; } -treechildren::-moz-tree-row(circulating) { - background-color: red; color: white; +treechildren::-moz-tree-cell-text(refundable) { + color: black; +} + +treechildren::-moz-tree-cell(circulating) { + background-color: red; +} + +treechildren::-moz-tree-cell-text(circulating) { + color: white; } treechildren::-moz-tree-row(backdate_failed) { -- 2.11.0