[open-ils-commits] r16369 - in trunk/Open-ILS: src/sql/Pg src/sql/Pg/upgrade xul/staff_client/chrome/content/util xul/staff_client/chrome/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat May 1 05:57:52 EDT 2010


Author: phasefx
Date: 2010-05-01 05:57:46 -0400 (Sat, 01 May 2010)
New Revision: 16369

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0250.data.org-setting-url.remote_column_settings.sql
Modified:
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
Org unit settings gui.disable_local_save_columns and url.remote_column_settings.  Respectively, these allow us to prevent the local saving and use of column settings, and allows us to specify column settings remotely.  If local settings are allowed and remote settings are also configured, then local settings will trump remote settings.  Currently these only work with xul lists, not dojo.  There is no UI for saving settings remotely; for now the notion is that an admin sets columns up locally, and then transfers the setting files to the remote server.

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-01 08:33:51 UTC (rev 16368)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-01 09:57:46 UTC (rev 16369)
@@ -65,7 +65,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0249'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0250'); -- phasefx
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-05-01 08:33:51 UTC (rev 16368)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-05-01 09:57:46 UTC (rev 16369)
@@ -2017,6 +2017,36 @@
         'bool'
 );
 
+-- 0250.data.org-setting-url.remote_column_settings.sql
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+        'url.remote_column_settings',
+        oils_i18n_gettext(
+            'url.remote_column_settings',
+            'GUI: URL for remote directory containing list column settings.', 
+            'coust', 
+            'label'),
+        oils_i18n_gettext(
+            'url.remote_column_settings',
+            'GUI: URL for remote directory containing list column settings.  The format and naming convention for the files found in this directory match those in the local settings directory for a given workstation.  An administrator could create the desired settings locally and then copy all the tree_columns_for_* files to the remote directory.', 
+            'coust', 
+            'description'),
+        'string'
+);
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+        'gui.disable_local_save_columns',
+        oils_i18n_gettext(
+            'gui.disable_local_save_columns',
+            'GUI: Disable the ability to save list column configurations locally.', 
+            'coust', 
+            'label'),
+        oils_i18n_gettext(
+            'gui.disable_local_save_columns',
+            'GUI: Disable the ability to save list column configurations locally.  If set, columns may still be manipulated, however, the changes do not persist.  Also, existing local configurations are ignored if this setting is true.', 
+            'coust', 
+            'description'),
+        'bool'
+);
+
 -- Org_unit_setting_type(s) that need an fm_class:
 INSERT into config.org_unit_setting_type
 ( name, label, description, datatype, fm_class ) VALUES

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0250.data.org-setting-url.remote_column_settings.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0250.data.org-setting-url.remote_column_settings.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0250.data.org-setting-url.remote_column_settings.sql	2010-05-01 09:57:46 UTC (rev 16369)
@@ -0,0 +1,36 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0250'); -- phasefx
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+        'url.remote_column_settings',
+        oils_i18n_gettext(
+            'url.remote_column_settings',
+            'GUI: URL for remote directory containing list column settings.', 
+            'coust', 
+            'label'),
+        oils_i18n_gettext(
+            'url.remote_column_settings',
+            'GUI: URL for remote directory containing list column settings.  The format and naming convention for the files found in this directory match those in the local settings directory for a given workstation.  An administrator could create the desired settings locally and then copy all the tree_columns_for_* files to the remote directory.', 
+            'coust', 
+            'description'),
+        'string'
+);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+        'gui.disable_local_save_columns',
+        oils_i18n_gettext(
+            'gui.disable_local_save_columns',
+            'GUI: Disable the ability to save list column configurations locally.', 
+            'coust', 
+            'label'),
+        oils_i18n_gettext(
+            'gui.disable_local_save_columns',
+            'GUI: Disable the ability to save list column configurations locally.  If set, columns may still be manipulated, however, the changes do not persist.  Also, existing local configurations are ignored if this setting is true.', 
+            'coust', 
+            'description'),
+        'bool'
+);
+
+
+COMMIT;

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js	2010-05-01 08:33:51 UTC (rev 16368)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js	2010-05-01 09:57:46 UTC (rev 16369)
@@ -20,6 +20,8 @@
 
     JSAN.use('util.error'); this.error = new util.error();
 
+    JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.stash_retrieve();
+
     return this;
 };
 
@@ -218,9 +220,13 @@
 
     'save_columns' : function (params) {
         var obj = this;
-        switch (this.node.nodeName) {
-            case 'tree' : this._save_columns_tree(params); break;
-            default: throw('NYI: Need .save_columns() for ' + this.node.nodeName); break;
+        if (obj.data.hash.aous['gui.disable_local_save_columns']) {
+            alert(document.getElementById('offlineStrings').getString('list.column_save_disabled'));
+        } else {
+            switch (this.node.nodeName) {
+                case 'tree' : this._save_columns_tree(params); break;
+                default: throw('NYI: Need .save_columns() for ' + this.node.nodeName); break;
+            }
         }
     },
 
@@ -271,10 +277,26 @@
                 return;
             }
 
-            netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-            JSAN.use('util.file'); var file = new util.file('tree_columns_for_'+window.escape(id));
-            if (file._file.exists()) {
-                var my_cols = file.get_object(); file.close();
+            var my_cols;
+            if (! obj.data.hash.aous['gui.disable_local_save_columns']) {
+                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+                JSAN.use('util.file'); var file = new util.file('tree_columns_for_'+window.escape(id));
+                if (file._file.exists()) {
+                    my_cols = file.get_object(); file.close();
+                }
+            }
+            /* local file will trump remote file if allowed, so save ourselves an http request if this is the case */
+            if (obj.data.hash.aous['url.remote_column_settings'] && ! my_cols ) {
+                var x = new XMLHttpRequest();
+                var url = obj.data.hash.aous['url.remote_column_settings'] + '/tree_columns_for_' + window.escape(id);
+                x.open("GET", url, false);
+                x.send(null);
+                if (x.status == 200) {
+                    my_cols = JSON2js( x.responseText );
+                }
+            }
+
+            if (my_cols) {
                 var nl = obj.node.getElementsByTagName('treecol');
                 for (var i = 0; i < nl.length; i++) {
                     var col = nl[i];
@@ -1285,7 +1307,7 @@
     '_print_tree' : function(params) {
         var obj = this;
         try {
-            JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+            var data = obj.data; data.stash_retrieve();
             if (!params.staff && data.list.au && data.list.au[0]) {
                 params.staff = data.list.au[0];
             }
@@ -1347,8 +1369,8 @@
         try {
             var obj = this;
             var dump = obj.dump_selected_with_keys({'skip_hidden_columns':true,'labels_instead_of_ids':true});
-            JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
-            data.list_clipboard = dump; data.stash('list_clipboard');
+            obj.data.stash_retrieve();
+            obj.data.list_clipboard = dump; obj.data.stash('list_clipboard');
             JSAN.use('util.window'); var win = new util.window();
             win.open(urls.XUL_LIST_CLIPBOARD,'list_clipboard','chrome,resizable,modal');
             window.focus(); // sometimes the main window will lower after a clipboard action
@@ -1527,6 +1549,9 @@
             mi.setAttribute('id',obj.node.id + '_save_columns');
             mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.save_column_configuration.label'));
             mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.save_column_configuration.accesskey'));
+            if (obj.data.hash.aous['gui.disable_local_save_columns']) {
+                mi.setAttribute('disabled','true');
+            }
             mp.appendChild(mi);
             return btn;
         } catch(E) {
@@ -1642,7 +1667,7 @@
             if (typeof fieldmapper.IDL.fmclasses == 'undefined') { throw 'fieldmapper.IDL.fmclasses undefined'; }
             if (typeof fieldmapper.IDL.fmclasses[hint] == 'undefined') { throw 'fieldmapper.IDL.fmclasses.' + hint + ' undefined'; }
             var my_class = fieldmapper.IDL.fmclasses[hint]; 
-            JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+            var data = obj.data; data.stash_retrieve();
 
             function col_def(my_field) {
                 var col_id = hint + '_' + my_field.name;

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-01 08:33:51 UTC (rev 16368)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-01 09:57:46 UTC (rev 16369)
@@ -194,6 +194,7 @@
 openils.global_util.font_size.error=Error adjusting the font size: %1$s
 list.row_fetch_warning=WARNING: Only %1$s out of %2$s rows in this list have been retrieved for immediate viewing.  Sorting this list requires that all these rows be retrieved, and this may take some time and lag the staff client.  Would you like to proceed?
 list.columns_saved=Column configuration saved.
+list.column_save_disabled=Column configuration save disabled by server policy.
 list.row_retrieving=Retrieving...
 list.save_csv_as=Save List CSV As...
 list.actions.menu.label=List Actions



More information about the open-ils-commits mailing list