Change behavior of stat cat display in horizontal patron summary. Stat Cat tab shows...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Sep 2010 17:31:51 +0000 (17:31 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Sep 2010 17:31:51 +0000 (17:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17838 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/summary.js
Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul

index 36e62fe..55ad634 100644 (file)
@@ -126,6 +126,7 @@ patron.summary.prototype = {
                         ['command'],
                         function() {
                             try {
+                                var rows = $('patron_info_rows');
                                 obj.stat_cat_list.clear();
                                 var entries = obj.patron.stat_cat_entries();
                                 for (var i = 0; i < entries.length; i++) {
@@ -134,15 +135,35 @@ patron.summary.prototype = {
                                         stat_cat = obj.OpenILS.data.lookup('actsc',entries[i].stat_cat());
                                     }
                                     if (!stat_cat) { continue; }
-                                    if (get_bool( stat_cat.usr_summary() )) {
-                                        obj.stat_cat_list.append( {
-                                            'row' : {
-                                                'my' : {
-                                                    'actsc' : stat_cat,
-                                                    'actscecm' : entries[i],
-                                                }
+                                    // Every stat cat gets rendered in the Stat Cats tab
+                                    obj.stat_cat_list.append( {
+                                        'row' : {
+                                            'my' : {
+                                                'actsc' : stat_cat,
+                                                'actscecm' : entries[i],
                                             }
-                                        } );
+                                        }
+                                    } );
+                                    // But only a proud few share the Patron Info pane
+                                    if (rows && get_bool( stat_cat.usr_summary() )) {
+                                        var row_id = 'stat_cat_id_' + stat_cat.id();
+                                        var row; var label1; var label2;
+                                        if ($(row_id)) {
+                                            row = $(row_id);
+                                            label1 = row.firstChild;
+                                            label2 = row.lastChild;
+                                        } else {
+                                            row = document.createElement('row');
+                                            row.setAttribute('id',row_id);
+                                            label1 = document.createElement('label');
+                                            label2 = document.createElement('label');
+                                            row.appendChild(label1);
+                                            row.appendChild(label2);
+                                            rows.appendChild(row);
+                                        }
+                                        label1.setAttribute('value',stat_cat.name());
+                                        label1.setAttribute('tooltiptext','stat cat id ' + stat_cat.id());
+                                        label2.setAttribute('value',entries[i].stat_cat_entry());
                                     }
                                 }
                             } catch(E) {
@@ -943,7 +964,12 @@ patron.summary.prototype = {
             */
 
             // Update the screen
-            chain.push( function() { obj.controller.render(); } );
+            chain.push( function() {
+                obj.controller.render();
+                if ($('stat_cat_tab')) {
+                    util.widgets.dispatch('command','stat_cat_tab'); 
+                }
+            } );
 
             // On Complete
 
index 1e30b78..5b2e9c2 100644 (file)
                 <column/>
                 <column/>
             </columns>
-            <rows>
+            <rows id="patron_info_rows">
                 <row>
                     <label id="PatronSummaryContact_date_of_birth_label" click_to_hide_dob="true" class="copyable text_left dob label click_link" value="&staff.patron_display.date_of_birth.label;"/>
                     <description id="patron_date_of_birth" class="copyable dob value" hide_value="true" oils_persist="hide_value"/>