From 2c8345db71d35f29c8cbdc29d7af54fa1856c201 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 23 Aug 2006 22:30:51 +0000 Subject: [PATCH] add sortable class by default, added some class configs git-svn-id: svn://svn.open-ils.org/ILS/trunk@5648 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/fm_table.js | 21 +++++++++++++---- Open-ILS/web/opac/common/js/fm_table_conf.js | 35 ++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/opac/common/js/fm_table.js b/Open-ILS/web/opac/common/js/fm_table.js index 24455fe8ab..794ab4fe99 100644 --- a/Open-ILS/web/opac/common/js/fm_table.js +++ b/Open-ILS/web/opac/common/js/fm_table.js @@ -2,6 +2,8 @@ Fieldmapper object table */ +var ID_GEN = 1; + function drawFMObjectTable( args ) { @@ -34,6 +36,8 @@ function FMObjectBuilder( obj, display, styleToggle ) { this.thead.appendChild(this.thead_tr) addCSSClass(this.table, 'fm_table'); + addCSSClass(this.table, 'sortable'); + this.table.id = 'fm_table_' + (ID_GEN++); } @@ -61,16 +65,19 @@ FMObjectBuilder.prototype.build = function() { /* */ FMObjectBuilder.prototype.setKeys = function(o) { + var sortme = false; if( this.display[o.classname] ) this.keys = this.display[o.classname].fields; if(!this.keys && FM_TABLE_DISPLAY[o.classname]) this.keys = FM_TABLE_DISPLAY[o.classname].fields; - if(!this.keys) + if(!this.keys) { this.keys = fmclasses[o.classname]; + sortme = true; + } - this.keys = this.keys.sort(); + if(sortme) this.keys = this.keys.sort(); } /* Inserts one row into the table to represent a single object */ @@ -176,10 +183,14 @@ FMObjectBuilder.prototype.buildSubTable = function(td, obj, key) { builder.table.setAttribute('style', 'width: auto;'); addCSSClass(builder.table, 'fm_selected'); - var style = subtd.getAttribute('style'); var newleft = left - (builder.table.clientWidth / 2) + (td.clientWidth / 2); - style = style.replace(new RegExp(left), newleft); - subtd.setAttribute('style', style); + + if( newleft < left ) { + _debug("left = "+left+" : newleft = "+newleft); + var style = subtd.getAttribute('style'); + style = style.replace(new RegExp(left), newleft); + subtd.setAttribute('style', style); + } } diff --git a/Open-ILS/web/opac/common/js/fm_table_conf.js b/Open-ILS/web/opac/common/js/fm_table_conf.js index 9e9773f564..fcfd0d126e 100644 --- a/Open-ILS/web/opac/common/js/fm_table_conf.js +++ b/Open-ILS/web/opac/common/js/fm_table_conf.js @@ -45,5 +45,40 @@ var FM_TABLE_DISPLAY = { 'owning_lib', 'opac_visible' ] + }, + au : { + name : 'usrname', + fields : [ + 'card', + 'email', + 'prefix', + 'first_given_name', + 'second_given_name', + 'family_name', + 'suffix', + 'day_phone', + 'home_ou', + 'dob' + ] + }, + aws : { + name : 'name' + }, + mwps : { + fields : [ + 'workstation', + 'cash_payment', + 'check_payment', + 'credit_card_payment' + ] + }, + + mups : { + fields : [ + 'usr', + 'credit_payment', + 'forgive_payment', + 'work_payment' + ] } } -- 2.11.0