[open-ils-commits] [GIT] Evergreen ILS branch master updated. 817a79b3c110e278b560f0f88f4fcfd30faa91a4

Evergreen Git git at git.evergreen-ils.org
Fri Aug 26 15:47:33 EDT 2011


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  817a79b3c110e278b560f0f88f4fcfd30faa91a4 (commit)
       via  6a1aa49194919a29ea77f09a2387aadd7d7790ff (commit)
       via  49224ed91e8e50171d4a80b98929a2a864d40651 (commit)
       via  d36543b93a351f805da664690658b53054636d8d (commit)
       via  a1681de689a55638154662e0e9158468456e2543 (commit)
       via  b827b4b5d31074c2ec2cfb6635b541b243add728 (commit)
      from  2ec43ab54aeea5b08205ab9f1c4c3473fa632263 (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 817a79b3c110e278b560f0f88f4fcfd30faa91a4
Merge: 6a1aa49 2ec43ab
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Fri Aug 26 16:03:15 2011 -0400

    Merge branch 'master' of git.evergreen-ils.org:Evergreen


commit 6a1aa49194919a29ea77f09a2387aadd7d7790ff
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Fri Aug 26 16:02:05 2011 -0400

    pin upgrade version number for magic macros
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 941ea93..9a80f6f 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0610', :eg_version); -- miker/berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0611', :eg_version); -- miker/berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql b/Open-ILS/src/sql/Pg/upgrade/0611.data.magic_macros.sql
similarity index 93%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql
rename to Open-ILS/src/sql/Pg/upgrade/0611.data.magic_macros.sql
index 6bfce60..402ee10 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0611.data.magic_macros.sql
@@ -1,3 +1,9 @@
+-- Evergreen DB patch 0611.data.magic_macros.sql
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0611', :eg_version);
+
 INSERT into config.org_unit_setting_type
 ( name, label, description, datatype ) VALUES
 (
@@ -80,3 +86,5 @@ INSERT into config.org_unit_setting_type
         ),
         'string'
     );
+
+COMMIT;

commit 49224ed91e8e50171d4a80b98929a2a864d40651
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Aug 23 12:06:55 2011 -0400

    Expose sort values from lists
    
    Specifically useful for things like receipt templates.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

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 85a34d0..4013eff 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/list.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js
@@ -1195,6 +1195,10 @@ util.list.prototype = {
                         debugger;
                     } else {
                         row[ obj.columns[j].id ] = treerow.childNodes[j].getAttribute('label');
+                        var sort = treerow.childNodes[j].getAttribute('sort_value');
+                        if(sort) {
+                            row[ obj.columns[j].id + '_sort_value' ] = sort;
+                        }
                     }
                 }
                 dump.push( row );

commit d36543b93a351f805da664690658b53054636d8d
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Aug 23 08:33:04 2011 -0400

    Five initial OU settings for %INCLUDE()% use
    
    header_text
    footer_text
    notice_text
    alert_text
    event_text
    
    None are really restricted to a specific purpose. Names are more of a
    hint than a requirement.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 5213ff9..8d224e8 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -2858,6 +2858,87 @@ INSERT into config.org_unit_setting_type
         ),
         'integer'
     )
+,(
+        'circ.staff_client.receipt.header_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.header_text',
+            'Receipt Template: Content of header_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.header_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(header_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.footer_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.footer_text',
+            'Receipt Template: Content of footer_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.footer_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(footer_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.notice_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.notice_text',
+            'Receipt Template: Content of notice_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.notice_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(notice_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.alert_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.alert_text',
+            'Receipt Template: Content of alert_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.alert_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(alert_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.event_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.event_text',
+            'Receipt Template: Content of event_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.event_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(event_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+
 ;
 
 UPDATE config.org_unit_setting_type
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql
new file mode 100644
index 0000000..6bfce60
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.magic_macros.sql
@@ -0,0 +1,82 @@
+INSERT into config.org_unit_setting_type
+( name, label, description, datatype ) VALUES
+(
+        'circ.staff_client.receipt.header_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.header_text',
+            'Receipt Template: Content of header_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.header_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(header_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.footer_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.footer_text',
+            'Receipt Template: Content of footer_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.footer_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(footer_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.notice_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.notice_text',
+            'Receipt Template: Content of notice_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.notice_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(notice_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.alert_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.alert_text',
+            'Receipt Template: Content of alert_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.alert_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(alert_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    )
+,(
+        'circ.staff_client.receipt.event_text',
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.event_text',
+            'Receipt Template: Content of event_text include',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'circ.staff_client.receipt.event_text',
+            'Text/HTML/Macros to be inserted into receipt templates in place of %INCLUDE(event_text)%',
+            'coust',
+            'description'
+        ),
+        'string'
+    );

commit a1681de689a55638154662e0e9158468456e2543
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Sun Aug 21 20:00:55 2011 -0400

    Receipt Macros: %INCLUDE()%
    
    Takes a single parameter: The name of the include.
    
    Each include is an OU setting: circ.staff_client.receipt.<name>
    
    The includes are done as the first substitution. This has the benefit
    of allowing other substitutions within them (including additional calls
    to %INCLUDE()%) and the downside of not allowing dynamic includes.
    
    Because an include can contain includes the code keeps track of all
    includes already done, skipping those already included. This prevents
    infinite loops when A includes B and B includes A, or longer variants
    thereof.
    
    Primary intended use would be for libraries to place frequently changed
    notices and such in their templates. Instead of having to edit every
    template on every workstation they use the %INCLUDE()% macro and edit
    the org unit settings. At the next login the updated text appears on
    every workstation.
    
    Due to the includes being processed first a library could use them to
    centrally administer templates by using an include for each piece of
    each template.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js
index 45f531f..d520776 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/print.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js
@@ -280,6 +280,23 @@ util.print.prototype = {
             JSAN.use('util.date');
             var s = msg; var b;
 
+            // Includes
+            // Note that we keep track of already included settings
+            // This ensures that we don't infinite loop through includes
+            try {
+                var match;
+                var include_patt=/%INCLUDE\(\s*([^)]*?)\s*\)%/;
+                var included = {};
+                while(match = include_patt.exec(s)) {
+                    if(match[1] == '' || included[match[1]]) {
+                        s = s.replace(match[0], '');
+                    } else {
+                        included[match[1]] = true;
+                        s = s.replace(new RegExp("%INCLUDE\\(\\s*" + match[1].replace(/([.?*+^$[\]\\(){}-])/g, "\\$1") + "\\s*\\)%","g"), obj.data.hash.aous['circ.staff_client.receipt.' + match[1]] || '');
+                    }
+                }
+            } catch(E) { dump(E+'\n'); }
+
             try{b = s; s = s.replace(/%LINE_NO%/g,Number(params.row_idx)+1);}
                 catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
@@ -369,7 +386,7 @@ util.print.prototype = {
             // Date Format
             try {
                 var match;
-                var date_format_patt=/%DATE_FORMAT\(\s*([^,]*?)\s*,\s*([^)]*?)\s*\)%/
+                var date_format_patt=/%DATE_FORMAT\(\s*([^,]*?)\s*,\s*([^)]*?)\s*\)%/;
                 while(match = date_format_patt.exec(s)) {
                     if(match[1] == '' || match[2] == '')
                         s = s.replace(match[0], '');

commit b827b4b5d31074c2ec2cfb6635b541b243add728
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Fri Aug 19 15:15:48 2011 -0400

    Receipt Macros: %SORT()%
    
    Added to line item templates.
    Takes one or more comma separated parameters:
    field AS type ASC/DESC
    
    AS type is optional
    ASC/DESC is optional
    
    Field is the field name without % signs.
    Type is DATE, INT, FLOAT, NUMBER, LOWER, or UPPER
    
    DATE will sort based on wrapping both sides in "new Date"
    INT will sort based on wrapping both sides in parseInt
    FLOAT and NUMBER will sort based on wrapping both sides in parseFloat
    LOWER will apply .toLowerCase to both sides
    UPPER will apply .toUpperCase to both sides
    
    ASC (default) will sort in ascending order.
    DESC will sort in descending order.
    
    Can be specified more than once:
    %SORT(a,b)% %SORT(c)%
    Would sort by a, then b, then c.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js
index 5c24b03..45f531f 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/print.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js
@@ -203,6 +203,60 @@ util.print.prototype = {
         var s = '';
         if (params.header) s += this.template_sub( params.header, cols, params );
         if (params.list) {
+            // Pre-templating sort
+            // %SORT(field[ AS type][ ASC|DESC][,...])%
+            var sort_blocks = params.line_item.match(/%SORT\([^)]+\)%/g);
+            if(sort_blocks) {
+                for(var i = 0; i < sort_blocks.length; i++) {
+                    sort_blocks[i] = sort_blocks[i].substring(6,sort_blocks[i].length-2);
+                }
+                sort_blocks = sort_blocks.join(',').split(/\s*,\s*/); // Supports %SORT(a,b)% and %SORT(a)% %SORT(b)% methods
+                for(var i = 0; i < sort_blocks.length; i++) {
+                    sort_blocks[i] = sort_blocks[i].match(/([^ ]+)(?:\s+AS\s+([^ ]+))?(?:\s+(ASC|DESC))?/);
+                    sort_blocks[i].shift(); // Removes the "full match" entry
+                }
+
+                function sorter(a, b) {
+                    var return_val = 0;
+                    for(var i = 0; i < sort_blocks.length && return_val == 0; i++) {
+                        var sort = sort_blocks[i];
+                        var a_test = a[sort[0]];
+                        var b_test = b[sort[0]];
+                        sort[1] = sort[1] || '';
+                        sort[2] = sort[2] || 'ASC';
+                        switch(sort[1].toUpperCase()) {
+                            case 'DATE':
+                                a_test = new Date(a_test);
+                                b_test = new Date(b_test);
+                                break;
+                            case 'INT':
+                                a_test = parseInt(a_test);
+                                b_test = parseInt(b_test);
+                                break;
+                            case 'FLOAT':
+                            case 'NUMBER':
+                                a_test = parseFloat(a_test);
+                                b_test = parseFloat(b_test);
+                                break;
+                            case 'LOWER':
+                                a_test = a_test.toLowerCase();
+                                b_test = b_test.toLowerCase();
+                                break;
+                            case 'UPPER':
+                                a_test = a_test.toUpperCase();
+                                b_test = b_test.toUpperCase();
+                                break;
+                        }
+                        if(a_test > b_test) return_val = 1;
+                        if(a_test < b_test) return_val = -1;
+                        if(sort[2] == 'DESC') return_val *= -1;
+                    }
+                    return return_val;
+                }
+                params.list.sort(sorter);
+                params.line_item = params.line_item.replace(/%SORT\([^)]*\)%/g,'');
+            }
+
             for (var i = 0; i < params.list.length; i++) {
                 params.row = params.list[i];
                 params.row_idx = i;
@@ -291,7 +345,7 @@ util.print.prototype = {
                         /* for dump_with_keys */
                         for (var i in params.row) {
                             var re = new RegExp('%'+i+'%',"g");
-                            try{b = s; s=s.replace(re, this.escape_html(params.row[i]));}
+                            try{b = s; s=s.replace(re, this.escape_html(params.row[i].toString()));}
                                 catch(E){s = b; this.error.standard_unexpected_error_alert('print.js, template_sub(): 2 string = <' + s + '>',E);}
                         }
                     }

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   81 ++++++++++++++++++
 .../src/sql/Pg/upgrade/0611.data.magic_macros.sql  |   90 ++++++++++++++++++++
 .../xul/staff_client/chrome/content/util/list.js   |    4 +
 .../xul/staff_client/chrome/content/util/print.js  |   75 ++++++++++++++++-
 5 files changed, 249 insertions(+), 3 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0611.data.magic_macros.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list