[open-ils-commits] [GIT] Evergreen ILS branch master updated. 296b76a937a52093db298bf86f8125ed41d9db4b

Evergreen Git git at git.evergreen-ils.org
Thu Oct 18 18:24:25 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  296b76a937a52093db298bf86f8125ed41d9db4b (commit)
      from  cd8b69e427b5a85085e2082ee198c2a0e2cdf50c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 296b76a937a52093db298bf86f8125ed41d9db4b
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Wed Oct 3 15:25:38 2012 -0400

    Sort Templates/Reports/Output
    
    By name for Templates/Reports, by Run Time for Output.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/web/opac/common/js/fm_table.js b/Open-ILS/web/opac/common/js/fm_table.js
index 95c5bc9..a0608eb 100644
--- a/Open-ILS/web/opac/common/js/fm_table.js
+++ b/Open-ILS/web/opac/common/js/fm_table.js
@@ -106,6 +106,19 @@ FMObjectBuilder.prototype.build = function() {
 
 		for( var i = 0; i < this.keys.length; i++ ) 
 			this.thead_tr.appendChild(elem('td',null,this.keys[i]));
+
+		if ( this.sortdata ) {
+			var sortdata = this.sortdata;
+			this.obj.sort(function(a, b){
+				var ret = 1;
+				var left = a[sortdata[0]]().toLowerCase();
+				var right = b[sortdata[0]]().toLowerCase();
+				if (left == right) return 0;
+				if (left < right)
+					ret = -1;
+				return ret * sortdata[1];
+			});
+		}
 	
 		for( var i = 0; i < this.obj.length; i++ ) 
 			this.buildObjectRow(this.obj[i]);
@@ -137,6 +150,7 @@ FMObjectBuilder.prototype.setKeys = function(o) {
 		this.keys = this.display[o.classname].fields;
 		this.bold = this.display[o.classname].bold;
 		this.money = this.display[o.classname].money;
+		this.sortdata = this.display[o.classname].sortdata;
 	}
 
 	if(!this.keys && FM_TABLE_DISPLAY[o.classname])
@@ -148,6 +162,9 @@ FMObjectBuilder.prototype.setKeys = function(o) {
 	if(!this.money && FM_TABLE_DISPLAY[o.classname])
 		this.money = FM_TABLE_DISPLAY[o.classname].money;
 
+	if(!this.sortdata && FM_TABLE_DISPLAY[o.classname])
+		this.sortdata = FM_TABLE_DISPLAY[o.classname].sortdata;
+
 	if(!this.keys) {
 		this.keys = fmclasses[o.classname];
 		sortme = true;
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 646d485..e5db887 100644
--- a/Open-ILS/web/opac/common/js/fm_table_conf.js
+++ b/Open-ILS/web/opac/common/js/fm_table_conf.js
@@ -98,7 +98,8 @@ var FM_TABLE_DISPLAY = {
 			'recur',
 			'recurrence',
 			'owner',
-		]
+		],
+		sortdata : [ 'name', 1 ]
 	},
 	'rt' : {
 		name : 'name',
@@ -107,7 +108,8 @@ var FM_TABLE_DISPLAY = {
 			'description',
 			'create_time',
 			'owner',
-		]
+		],
+		sortdata : [ 'name', 1 ]
 	},
 	'rs' : {
 		fields : [
@@ -124,6 +126,7 @@ var FM_TABLE_DISPLAY = {
 		],
 		bold : [
 			'error_text',
-		]
+		],
+		sortdata : [ 'run_time', -1 ]
 	}
 }

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/web/opac/common/js/fm_table.js      |   17 +++++++++++++++++
 Open-ILS/web/opac/common/js/fm_table_conf.js |    9 ++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list