[open-ils-commits] SPAM: r10727 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/admin

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 29 11:29:55 EDT 2008


Author: erickson
Date: 2008-09-29 11:29:53 -0400 (Mon, 29 Sep 2008)
New Revision: 10727

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/admin/admin.css
   trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
   trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
Log:
settings are now editable.  added different widget types for the expected settings values.  started plugging in entities

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2008-09-29 15:27:57 UTC (rev 10726)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2008-09-29 15:29:53 UTC (rev 10727)
@@ -48,6 +48,9 @@
 <!ENTITY common.save_transactions.accesskey 'S'>
 <!ENTITY common.save_transactions.label 'Save these transactions'>
 
+<!ENTITY common.true "True">
+<!ENTITY common.false "False">
+
 <!ENTITY ilsevent.1000 "Login failed.  The username or password entered was incorrect.">
 <!ENTITY ilsevent.1001 "Login session has timed out or does not exist">
 <!ENTITY ilsevent.1002 "User was not found in the database">
@@ -1436,6 +1439,8 @@
 <!ENTITY staff.server.admin.index.cash_reports "Cash Reports">
 <!ENTITY staff.server.admin.index.transits "Transits">
 <!ENTITY staff.server.admin.index.transit_list "Transit List">
+
+
 <!ENTITY staff.server.admin.org_settings.title "Evergreen: Library Settings Editor">
 <!-- This will be followed by the user's name -->
 <!ENTITY staff.server.admin.org_settings.greeting "Welcome ">
@@ -1450,11 +1455,22 @@
 <!ENTITY staff.server.admin.org_settings.staff_timeout "Staff Login Inactivity Timeout (in seconds)">
 <!ENTITY staff.server.admin.org_settings.lost_fee "Lost Materials Processing Fee">
 <!ENTITY staff.server.admin.org_settings.default_price "Default Item Price">
-<!ENTITY staff.server.admin.org_settings.from_address '"FROM" email address for patron notices'>
-<!ENTITY staff.server.admin.org_settings.bounce_note "(note: delivery failures will be returned this address)">
+<!ENTITY staff.server.admin.org_settings.from_address 'Sending email address for patron notices'>
+<!ENTITY staff.server.admin.org_settings.bounce_note "Email delivery failures will be returned this address">
 <!ENTITY staff.server.admin.org_settings.apply_all.note 'I. "Apply to all Locations" will force the new setting to be applied to all locations in the location dropdown.'>
 <!ENTITY staff.server.admin.org_settings.update_success "Update succeeded.">
 <!ENTITY staff.server.admin.org_settings.apply_all.confirm "This will update the setting for all of the locations listed in the dropdown menu. Are you sure you wish to continue?">
+
+<!ENTITY staff.server.admin.org_settings.circ.hold_expire_alert_interval "Hold Expiration Alert Interval">
+<!ENTITY staff.server.admin.org_settings.circ.hold_expire_alert_interval.desc "Amount of time before a hold expires at which point the patron should be alerted">
+<!ENTITY staff.server.admin.org_settings.circ.hold_expire_interval "Default Hold Expirate Interval">
+<!ENTITY staff.server.admin.org_settings.circ.hold_expire_interval.desc 'Amount of time after a hold is placed before the hold expires\nExample "100 days"'>
+<!ENTITY staff.server.admin.org_settings.global.credit.allow "Allow Credit Card Payments">
+<!ENTITY staff.server.admin.org_settings.global.credit.allow.desc "If enabled, patrons will be able to pay fines accrued at this location via credit card">
+<!ENTITY staff.server.admin.org_settings.global.default_locale "Default Locale">
+
+
+
 <!ENTITY staff.server.admin.stat_cat.title "Evergreen: Statistical Category Editor">
 <!ENTITY staff.server.admin.stat_cat.greeting "Welcome ">
 <!ENTITY staff.server.admin.stat_cat.heading " Statistical Category Editor">

Modified: trunk/Open-ILS/xul/staff_client/server/admin/admin.css
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/admin.css	2008-09-29 15:27:57 UTC (rev 10726)
+++ trunk/Open-ILS/xul/staff_client/server/admin/admin.css	2008-09-29 15:29:53 UTC (rev 10727)
@@ -6,6 +6,9 @@
 body { font-family: Verdana, Tahoma; font-size: 10pt; background-color: white; margin: 0px; padding: 0px;}
 .welcome_box { position:absolute; top: 5px; right: 5px; }
 .title { font-weight: bold; font-size: 14pt; margin: 10px;}
+.hidden { display: none }
+.form_table td { padding: 6px; }
+.form_table thead td { border-bottom: 1px solid #808080; }
 .hide_me { visibility: hidden; display: none }
 .has_color { background: #E0F0E0; color: #000000; }
 .data_grid { font-weight: 500; border-collapse: collapse;}

Modified: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js	2008-09-29 15:27:57 UTC (rev 10726)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js	2008-09-29 15:29:53 UTC (rev 10727)
@@ -1,6 +1,7 @@
 dojo.require("dijit.layout.LayoutContainer");
 dojo.require("dijit.layout.ContentPane");
 dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.Dialog');
 dojo.require("dojox.grid.Grid");
 dojo.require("fieldmapper.Fieldmapper");
 dojo.require("fieldmapper.dojoData");
@@ -18,8 +19,8 @@
 
 function osInit(data) {
     authtoken = dojo.cookie('ses') || new openils.CGI().param('ses');
-    user = new openils.User({authtoken:authtoken}).user;
-    contextOrg = user.ws_ou();
+    user = new openils.User({authtoken:authtoken});
+    contextOrg = user.user.ws_ou();
 
     fieldmapper.standardRequest(
         [   'open-ils.actor',
@@ -80,7 +81,7 @@
     var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgNodeList)});
     osContextSelector.store = store;
     osContextSelector.startup();
-    osContextSelector.setValue(user.ws_ou());
+    osContextSelector.setValue(user.user.ws_ou());
 }
 
 function osChangeContext() {
@@ -102,6 +103,15 @@
         }
         gridData.items.push({name:key});
     }
+    gridData.items = gridData.items.sort(
+        function(a, b) {
+            var seta = osSettings[a.name];
+            var setb = osSettings[b.name];
+            if(seta.label > setb.label) return 1;
+            if(seta.label < setb.label) return -1;
+            return 0;
+        }
+    );
     gridData.identifier = 'name';
     var store = new dojo.data.ItemFileReadStore({data:gridData});
     var model = new dojox.grid.data.DojoData(
@@ -115,11 +125,18 @@
 function osGetGridData(rowIdx) {
     var data = this.grid.model.getRow(rowIdx);
     if(!data) return '';
-    var value = osSettings[data.name][this.field];
+    var setting = osSettings[data.name];
+    var value = setting[this.field];
     if(value == null) return '';
     switch(this.field) {
         case 'context':
             return fieldmapper.aou.findOrgUnit(value).shortname();
+        case 'value':
+            if(setting.type == 'bool') {
+                if(value) 
+                    return dojo.byId('os-true').innerHTML;
+                return dojo.byId('os-false').innerHTML;
+            }
         default:
             return value;
     }
@@ -132,5 +149,72 @@
 }
 
 function osLaunchEditor(name) {
+    osEditDialog._osattr = name;
+    osEditDialog.show();
+    user.buildPermOrgSelector('UPDATE_ORG_UNIT_SETTING.' + name, osEditContextSelector);
+    dojo.byId('os-edit-name').innerHTML = osSettings[name].label;
+    dojo.byId('os-edit-desc').innerHTML = osSettings[name].desc || '';
+
+    dojo.style(osEditTextBox.domNode, 'display', 'none');
+    dojo.style(osEditCurrencyTextBox.domNode, 'display', 'none');
+    dojo.style(osEditNumberTextBox.domNode, 'display', 'none');
+    dojo.style(osEditBoolSelect.domNode, 'display', 'none');
+
+    switch(osSettings[name].type) {
+        case 'number':
+            dojo.style(osEditNumberTextBox.domNode, 'display', 'block');
+            break;
+        case 'currency':
+            dojo.style(osEditCurrencyTextBox.domNode, 'display', 'block');
+            break;
+        case 'bool':
+            dojo.style(osEditBoolSelect.domNode, 'display', 'block');
+            break;
+        default:
+            dojo.style(osEditTextBox.domNode, 'display', 'block');
+    }
 }
 
+function osEditSetting(deleteMe) {
+    osEditDialog.hide();
+    var name = osEditDialog._osattr;
+
+    var obj = {};
+    if(deleteMe) {
+        obj[name] = null;
+
+    } else {
+
+        switch(osSettings[name].type) {
+            case 'number':
+                obj[name] = osEditNumberTextBox.getValue();
+                if(obj[name] == null) return;
+                break;
+            case 'currency':
+                obj[name] = osEditCurrencyTextBox.getValue();
+                if(obj[name] == null) return;
+                break;
+            case 'bool':
+                var val = osEditBoolSelect.getValue();
+                obj[name] = (val == 'true') ? 1 : null;
+                break;
+            default:
+                obj[name] = osEditTextBox.getValue();
+                if(obj[name] == null) return;
+        }
+    }
+
+    fieldmapper.standardRequest(
+        ['open-ils.actor', 'open-ils.actor.org_unit.settings.update'],
+        {   async: true,
+            params: [authtoken, osEditContextSelector.getValue(), obj],
+            oncomplete: function(r) {
+                var res = r.recv().content();
+                if(e = openils.Event.parse(res))
+                    return alert(e);
+                osDraw();
+            }
+        }
+    );
+}
+

Modified: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml	2008-09-29 15:27:57 UTC (rev 10726)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml	2008-09-29 15:29:53 UTC (rev 10727)
@@ -23,7 +23,7 @@
     <head>
         <title>Org Unit Settings</title>
         <link type='text/css' rel='stylesheet' href='admin.css'/>
-        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
+        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='org_unit_settings.js'></script>
         <script>
             var osSettings = {
@@ -45,19 +45,23 @@
                 },
                 'org.bounced_emails' : {
                     label : '&staff.server.admin.org_settings.from_address;',
+                    desc : '&staff.server.admin.org_settings.bounce_note;'
                 },
                 'circ.hold_expire_alert_interval' : {
-                    label : 'Hold Expiration Alert Interval',
+                    label : '&staff.server.admin.org_settings.circ.hold_expire_alert_interval;',
+                    desc : '&staff.server.admin.org_settings.circ.hold_expire_alert_interval.desc;',
                 },
                 'circ.hold_expire_interval' : {
-                    label : 'Default Hold Expirate Interval',
+                    label : '&staff.server.admin.org_settings.circ.hold_expire_interval;',
+                    desc : '&staff.server.admin.org_settings.circ.hold_expire_interval.desc;',
                 },
                 'global.credit.allow' : {
-                    label : 'Allow Credit Card Payments',
+                    label : '&staff.server.admin.org_settings.global.credit.allow;',
+                    desc : '&staff.server.admin.org_settings.global.credit.allow.desc;',
                     type : 'bool'
                 },
                 'global.default_locale' : {
-                    label : 'Default Locale',
+                    label : '&staff.server.admin.org_settings.global.default_locale;',
                 },
             };
         </script>
@@ -87,6 +91,48 @@
                 <div dojoType='dojox.Grid' jsId='osGrid'> </div>
             </div>
         </div>
+
+        <!-- edit dialog -->
+        <div dojoType="dijit.Dialog" jsId='osEditDialog' title="Edit Setting">
+            <table class='form_table'>
+                <thead>
+                    <tr><td colspan='2' align='center'><div id='os-edit-name'/></td></tr>
+                    <tr><td colspan='2' align='center'><div id='os-edit-desc'/></td></tr>
+                </thead>
+                <tbody>
+                    <tr>
+                        <td>Context</td>
+                        <td> 
+                            <select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='osEditContextSelector'
+                                searchAttr="shortname" autocomplete="true" labelAttr='shortname'> 
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Value</td>
+                        <td>
+                            <input dojoType='dijit.form.TextBox' jsId='osEditTextBox'/>
+                            <input dojoType='dijit.form.CurrencyTextBox' jsId='osEditCurrencyTextBox'/>
+                            <input dojoType='dijit.form.NumberTextBox' jsId='osEditNumberTextBox'/>
+                            <select dojoType='dijit.form.FilteringSelect' jsId='osEditBoolSelect'>
+                                <option value='true'>&common.true;</option>
+                                <option value='false'>&common.false;</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td> 
+                            <button dojoType='dijit.form.Button' onclick='osEditSetting();'>Update Setting</button>
+                        </td>
+                        <td> 
+                            <button dojoType='dijit.form.Button' onclick='osEditSetting(true);'>Delete Setting</button>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+        </div> <!-- edit dialog -->
+        <span id='os-true' class='hidden'>&common.true;</span>
+        <span id='os-false' class='hidden'>&common.false;</span>
     </body>
 </html>
 



More information about the open-ils-commits mailing list