add_css_class is now addCSSClass
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Aug 2005 19:06:22 +0000 (19:06 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Aug 2005 19:06:22 +0000 (19:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1740 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/cat/marc_validate.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_edit_legacy.js
Evergreen/staff_client/chrome/content/evergreen/stat_cat/stat_cat.js

index 25d8ec4..86b442b 100644 (file)
@@ -45,58 +45,107 @@ function legend_marc() {
 
 function handle_tag_change(ev) {
        mw.sdump('D_CAT','Entering handle_tag_change: ' + timer_elapsed('cat') + '\n');
+       try {
+dump('1\n');
        rule_warnings = []; disable_widgets('explain_marc');
+dump('2\n');
        tag_seen = {};
+dump('3\n');
        var rows = document.getElementById('ctrl_rows').childNodes;
+dump('4\n');
        for (var r in rows) {
+dump('5\n');
                if ((typeof(rows[r]) == 'object')&&(rows[r].tagName == 'row')) {
+dump('6\n');
                        test_tagnumber_rule(rows[r]);
+dump('7\n');
                }
+dump('8\n');
        }
+dump('9\n');
        rows = document.getElementById('data_rows').childNodes;
+dump('10\n');
        for (var r in rows) {
+dump('11\n');
                if (    (typeof(rows[r]) == 'object') &&
                        (rows[r].tagName == 'row') &&
                        (rows[r].getAttribute('hidden') != 'true')
                ) {
+dump('12\n');
                        test_tagnumber_rule(rows[r]);
+dump('13\n');
                        test_ind1_rule(rows[r]);
+dump('14\n');
                        test_ind2_rule(rows[r]);
+dump('15\n');
                        test_subfield_rule(rows[r]);
+dump('16\n');
                }
+dump('17\n');
+       }
+dump('18\n');
+       if (rule_warnings.length > 0) { 
+dump('19\n');
+               enable_widgets('explain_marc'); }
+       } catch(E) {
+dump('20\n');
+               handle_error(E);
        }
-       if (rule_warnings.length > 0) { enable_widgets('explain_marc'); }
+dump('21\n');
        mw.sdump('D_CAT','Exiting handle_tag_change: ' + timer_elapsed('cat') + '\n');
 }
 
 function test_tagnumber_rule(r) {
        // rows (rows) -> row (r) -> wrapper (w) -> textbox (t)
+dump('t1\n');
        try {
+dump('t2\n');
        var t = r.firstChild.firstChild;
+dump('t3\n');
        if (t.value.length > 3) { 
+dump('t4\n');
                t.value = t.value.substr(0,3); 
+dump('t5\n');
        } else if (t.value.length < 3) {
+dump('t6\n');
                switch(t.value.length) {
                        case 2: t.value = '0' + t.value; break;
                        case 1: t.value = '00' + t.value; break;
                        case 0: t.value = '000'; break;
                }
+dump('t7\n');
        }
+dump('t8\n');
        removeCSSClass(t,'invalid');
+dump('t9\n');
        if (marc_rules[t.value]) {
+dump('t10\n');
                var rule = marc_rules[t.value];
+dump('t11\n');
                if (tag_seen[t.value]) { tag_seen[t.value]++; } else { tag_seen[t.value] = 1; }
+dump('t12\n');
                if ( (rule.repeat == 'NR') && (tag_seen[t.value] > 1) ) {
-                       add_css_class(t,'invalid');
+dump('t13\n');
+                       addCSSClass(t,'invalid');
+dump('t14\n');
                        var s = 'Tag ' + t.value + ' should be Non-Repeating\n';
+dump('t15\n');
                        rule_warnings.push(s); mw.sdump('D_CAT',s);
+dump('t16\n');
                }
+dump('t17\n');
        } else if (t.value != 'LDR') {
-               add_css_class(t,'invalid');
+dump('t18\n');
+               addCSSClass(t,'invalid');
+dump('t19\n');
                var s = 'Tag ' + t.value + ' is unknown.\n';
+dump('t20\n');
                rule_warnings.push(s); mw.sdump('D_CAT',s);
+dump('t21\n');
        }
+dump('t22\n');
        } catch(E) {
+               dump('t23\n');
                handle_error();
        }
 }
@@ -109,7 +158,7 @@ function test_ind1_rule(r) {
        if ((marc_rules[tagnumber]) && (marc_rules[tagnumber].ind1)) {
                var regex = '/^[' + marc_rules[tagnumber].ind1.allowed + ']$/';
                if (! ind1.value.match(eval(regex)) ) {
-                       add_css_class(ind1,'invalid');
+                       addCSSClass(ind1,'invalid');
                        var s = 'Tag ' + tagnumber + ' Indicator 1 should be one of these characters: "' + marc_rules[tagnumber].ind1.allowed + '"\n';
                        rule_warnings.push(s); mw.sdump('D_CAT',s);
                }
@@ -124,7 +173,7 @@ function test_ind2_rule(r) {
        if ((marc_rules[tagnumber]) && (marc_rules[tagnumber].ind2)) {
                var regex = '/^[' + marc_rules[tagnumber].ind2.allowed + ']$/';
                if (! ind2.value.match(eval(regex)) ) {
-                       add_css_class(ind2,'invalid');
+                       addCSSClass(ind2,'invalid');
                        var s = 'Tag ' + tagnumber + ' Indicator 2 should be one of these characters: "' + marc_rules[tagnumber].ind2.allowed + '"\n';
                        rule_warnings.push(s); mw.sdump('D_CAT',s);
                }
@@ -142,7 +191,7 @@ function test_subfield_rule(r) {
                if ( (subf_array[0] == '')||(subf_array[0] == null) ) {
                        subf_array.shift();
                } else {
-                       add_css_class(data,'invalid');
+                       addCSSClass(data,'invalid');
                        var s = 'DEBUG: Need to add code to make an implicit subfield-a\n';
                        rule_warnings.push(s); mw.sdump('D_CAT',s);
                        subf_array.shift();
@@ -150,7 +199,7 @@ function test_subfield_rule(r) {
                var subf_seen = {};
                for (var i in subf_array) {
                        if ((subf_array[i]=='')||(subf_array==null)) { 
-                               add_css_class(data,'invalid');
+                               addCSSClass(data,'invalid');
                                var s = 'You have incomplete subfield delimiters.\n';
                                rule_warnings.push(s); mw.sdump('D_CAT',s);
                                continue;
@@ -160,12 +209,12 @@ function test_subfield_rule(r) {
                        var rule = marc_rules[tagnumber][s_ind];
                        if (rule) {
                                if ( (rule.repeat == 'NR') && (subf_seen[s_ind]>1) ) {
-                                       add_css_class(data,'invalid');
+                                       addCSSClass(data,'invalid');
                                        var s = 'Tag ' + tagnumber + ' subfield-' + s_ind + ' should be Non-Repeating\n';
                                        rule_warnings.push(s); mw.sdump('D_CAT',s);
                                }
                        } else {
-                               add_css_class(data,'invalid');
+                               addCSSClass(data,'invalid');
                                var s = 'Tag ' + tagnumber + ' does not have a subfield-' + s_ind + '\n';
                                rule_warnings.push(s); mw.sdump('D_CAT',s);
                        }
index a45b872..24fae24 100644 (file)
@@ -912,7 +912,7 @@ function patron_summary_refresh(ev) {
                mw.sdump('D_LEGACY','standing = ' + js2JSON(standing) + '\n');
                standing_e.setAttribute( 'value', standing.value() );
                if (standing.value() == 'Good') {
-                       add_css_class(standing_e,'good');
+                       addCSSClass(standing_e,'good');
                } else {
                        removeCSSClass(standing_e,'good');      
                }
@@ -1314,7 +1314,7 @@ function toggle_address(e,id) {
        if (toggle == '0') {
                button.setAttribute('toggle','1');
                mw.sdump('D_LEGACY','original node = ' + js2JSON(address) + '\n');
-               add_css_class(groupbox,'deleted_address');
+               addCSSClass(groupbox,'deleted_address');
                address.isdeleted('1');
                mw.sdump('D_LEGACY','updated  node = ' + js2JSON(address) + '\n');
                mw.sdump('D_LEGACY','PATRON.au.mailing_address() = ' + PATRON.au.mailing_address() + ' address.id() = ' + address.id() + '\n');
index 19697ec..fc88f03 100644 (file)
@@ -93,7 +93,7 @@ function populate_local_copy_stat_cats_grid(grid) {
                rows.appendChild(row1);
                row1.setAttribute('asc_id',copy_stat_cat.id());
                row1.setAttribute('object_type','asc');
-               add_css_class(row1,'row' + i % 2);
+               addCSSClass(row1,'row' + i % 2);
 
                        var label1 = document.createElement('label'); 
                        row1.appendChild(label1);
@@ -134,7 +134,7 @@ function populate_local_copy_stat_cats_grid(grid) {
                rows.appendChild(row2);
                row2.setAttribute('asc_id',copy_stat_cat.id());
                row2.setAttribute('object_type','asc');
-               add_css_class(row2,'row' + i % 2);
+               addCSSClass(row2,'row' + i % 2);
 
                        var label2 = document.createElement('label');
                        row2.appendChild(label2);
@@ -161,7 +161,7 @@ function populate_local_copy_stat_cats_grid(grid) {
                        row.setAttribute('asc_id',copy_stat_cat.id());
                        row.setAttribute('asce_id',stat_entry.id());
                        row.setAttribute('object_type','asce');
-                       add_css_class(row,'row' + i % 2);
+                       addCSSClass(row,'row' + i % 2);
 
                                var label = document.createElement('label');
                                row.appendChild(label);
@@ -204,7 +204,7 @@ function populate_local_copy_stat_cats_grid(grid) {
                row3.setAttribute('asc_id',copy_stat_cat.id());
                row3.setAttribute('object_type','asce');
                row3.setAttribute('new','true');
-               add_css_class(row3,'row' + i % 2);
+               addCSSClass(row3,'row' + i % 2);
 
                        var label3 = document.createElement('label');
                        row3.appendChild(label3);
@@ -234,7 +234,7 @@ function populate_local_copy_stat_cats_grid(grid) {
 
                var row4 = document.createElement('row');
                rows.appendChild(row4);
-               add_css_class(row4,'row' + i % 2);
+               addCSSClass(row4,'row' + i % 2);
 
                        var label4 = document.createElement('label');
                        row4.appendChild(label4);
@@ -541,7 +541,7 @@ function populate_local_patron_stat_cats_grid(grid) {
                rows.appendChild(row1);
                row1.setAttribute('actsc_id',patron_stat_cat.id());
                row1.setAttribute('object_type','actsc');
-               add_css_class(row1,'row' + i % 2);
+               addCSSClass(row1,'row' + i % 2);
 
                        var label1 = document.createElement('label'); 
                        row1.appendChild(label1);
@@ -582,7 +582,7 @@ function populate_local_patron_stat_cats_grid(grid) {
                rows.appendChild(row2);
                row2.setAttribute('actsc_id',patron_stat_cat.id());
                row2.setAttribute('object_type','actsc');
-               add_css_class(row2,'row' + i % 2);
+               addCSSClass(row2,'row' + i % 2);
 
                        var label2 = document.createElement('label');
                        row2.appendChild(label2);
@@ -609,7 +609,7 @@ function populate_local_patron_stat_cats_grid(grid) {
                        row.setAttribute('actsc_id',patron_stat_cat.id());
                        row.setAttribute('actsce_id',stat_entry.id());
                        row.setAttribute('object_type','actsce');
-                       add_css_class(row,'row' + i % 2);
+                       addCSSClass(row,'row' + i % 2);
 
                                var label = document.createElement('label');
                                row.appendChild(label);
@@ -652,7 +652,7 @@ function populate_local_patron_stat_cats_grid(grid) {
                row3.setAttribute('actsc_id',patron_stat_cat.id());
                row3.setAttribute('object_type','actsce');
                row3.setAttribute('new','true');
-               add_css_class(row3,'row' + i % 2);
+               addCSSClass(row3,'row' + i % 2);
 
                        var label3 = document.createElement('label');
                        row3.appendChild(label3);
@@ -682,7 +682,7 @@ function populate_local_patron_stat_cats_grid(grid) {
 
                var row4 = document.createElement('row');
                rows.appendChild(row4);
-               add_css_class(row4,'row' + i % 2);
+               addCSSClass(row4,'row' + i % 2);
 
                        var label4 = document.createElement('label');
                        row4.appendChild(label4);