add sortable class by default, added some class configs
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 23 Aug 2006 22:30:51 +0000 (22:30 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 23 Aug 2006 22:30:51 +0000 (22:30 +0000)
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
Open-ILS/web/opac/common/js/fm_table_conf.js

index 24455fe..794ab4f 100644 (file)
@@ -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);
+       }
 }
 
 
index 9e9773f..fcfd0d1 100644 (file)
@@ -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'
+               ]
        }
 }