[open-ils-commits] SPAM: r10724 - trunk/Open-ILS/xul/staff_client/server/admin

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 29 09:24:05 EDT 2008


Author: erickson
Date: 2008-09-29 09:24:03 -0400 (Mon, 29 Sep 2008)
New Revision: 10724

Added:
   trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
Removed:
   trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml
Modified:
   trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
Log:
changed file type to xhtml to match other admin files.  added support for choosing the context org

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 04:51:39 UTC (rev 10723)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js	2008-09-29 13:24:03 UTC (rev 10724)
@@ -9,18 +9,38 @@
 dojo.require('openils.CGI');
 dojo.require('openils.User');
 dojo.require('openils.Event');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
 
 var authtoken;
 var contextOrg;
 var user;
-var contextSelector;
+var workOrgs;
 
 function osInit(data) {
     authtoken = dojo.cookie('ses') || new openils.CGI().param('ses');
     user = new openils.User({authtoken:authtoken}).user;
     contextOrg = user.ws_ou();
-    contextSelector = dojo.byId('os-context-selector');
 
+    fieldmapper.standardRequest(
+        [   'open-ils.actor',
+            'open-ils.actor.user.get_work_ous.ids'],
+        {   async: true,
+            params: [authtoken],
+            oncomplete: function(r) {
+                var list = r.recv().content();
+                if(e = openils.Event.parse(list))
+                    return alert(e);
+                workOrgs = list;
+                buildMergedOrgSelector(list);
+            }
+        }
+    );
+
+    osDraw();
+}
+dojo.addOnLoad(osInit);
+
+function osDraw() {
     var names = [];
     for(var key in osSettings)
         names.push(key);
@@ -38,21 +58,47 @@
             }
         }
     );
-    buildMergedOrgSel(contextSelector, user.ws_ou(), 0);
-    // open-ils.actor.user.get_work_ous.ids
 }
-dojo.addOnLoad(osInit);
 
-function osChangeContect() {
-    contextOrg = getSelectorVal(contextSelector);
+function buildMergedOrgSelector(orgList) {
+    var orgNodeList = [];
+    for(var i = 0; i < orgList.length; i++) {
+        // add the work org parents
+        var parents = [];
+        var node = fieldmapper.aou.findOrgUnit(orgList[i]);
+        while(node.parent_ou() != null) {
+            node = fieldmapper.aou.findOrgUnit(node.parent_ou());
+            parents.push(node);
+        }
+        orgNodeList = orgNodeList.concat(parents.reverse());
+
+        // add the work org children
+        orgNodeList = orgNodeList.concat(
+            fieldmapper.aou.descendantNodeList(orgList[i]));
+    }
+
+    var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgNodeList)});
+    osContextSelector.store = store;
+    osContextSelector.startup();
+    osContextSelector.setValue(user.ws_ou());
 }
 
+function osChangeContext() {
+    if(contextOrg == osContextSelector.getValue())
+        return;
+    contextOrg = osContextSelector.getValue();
+    osDraw();
+}
+
 function osLoadGrid(data) {
     var gridData = {items:[]}
     for(var key in data) {
+        var setting = osSettings[key];
+        setting.context = null;
+        setting.value = null;
         if(data[key]) {
-            osSettings[key].context = data[key].org;
-            osSettings[key].value = data[key].value;
+            setting.context = data[key].org;
+            setting.value = data[key].value;
         }
         gridData.items.push({name:key});
     }

Copied: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml (from rev 10723, trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml)
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml	2008-09-29 13:24:03 UTC (rev 10724)
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!-- 
+# Copyright (C) 2008  Georgia Public Library Service
+# Bill Erickson <erickson at esilibrary.com>
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+-->
+
+<!DOCTYPE html PUBLIC 
+	"-//W3C//DTD XHTML 1.0 Transitional//EN" 
+	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
+	<!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<html xmlns='http://www.w3.org/1999/xhtml'>
+    <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" src='org_unit_settings.js'></script>
+        <script>
+            var osSettings = {
+                'circ.lost_materials_processing_fee' : {
+                    label : '&staff.server.admin.org_settings.lost_fee;',
+                    type : 'currency',
+                },
+                'cat.default_item_price' : {
+                    label : '&staff.server.admin.org_settings.default_price;',
+                    type : 'currency',
+                },
+                'auth.opac_timeout' : {
+                    label : '&staff.server.admin.org_settings.opac_timeout;',
+                    type : 'number',
+                },
+                'auth.staff_timeout' : {
+                    label : '&staff.server.admin.org_settings.staff_timeout;',
+                    type : 'number',
+                },
+                'org.bounced_emails' : {
+                    label : '&staff.server.admin.org_settings.from_address;',
+                },
+                'circ.hold_expire_alert_interval' : {
+                    label : 'Hold Expiration Alert Interval',
+                },
+                'circ.hold_expire_interval' : {
+                    label : 'Default Hold Expirate Interval',
+                },
+                'global.credit.allow' : {
+                    label : 'Allow Credit Card Payments',
+                    type : 'bool'
+                },
+                'global.default_locale' : {
+                    label : 'Default Locale',
+                },
+            };
+        </script>
+    </head>
+    <body class="tundra tall">
+        <div dojoType="dijit.layout.LayoutContainer" orientation="vertical" class="tall">
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='top'>
+                <h1>Org Unit Settings</h1><br/>
+                Context Location 
+                <select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='osContextSelector'
+                    searchAttr="shortname" autocomplete="true" labelAttr='shortname' onchange='osChangeContext();'> 
+                </select>
+            </div>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' class='tall'>
+                <script>
+                    var osGridLayout = [{
+                        defaultCell: {styles: 'text-align: center;'},
+                        cells : [[
+                            {name: 'Edit', get: osGetEditLink, 
+                                value: '&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;osLaunchEditor(\'SETTING\');&quot;>Edit&lt;/a>'},
+                            {name: 'Setting', get: osGetGridData, field:'label', width:'auto'},
+                            {name: 'Context', get: osGetGridData, field:'context', width:'auto'},
+                            {name: 'Value', get: osGetGridData, field:'value', width:'auto'},
+                        ]]
+                    }];
+                </script>
+                <div dojoType='dojox.Grid' jsId='osGrid'> </div>
+            </div>
+        </div>
+    </body>
+</html>
+

Deleted: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml	2008-09-29 04:51:39 UTC (rev 10723)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml	2008-09-29 13:24:03 UTC (rev 10724)
@@ -1,88 +0,0 @@
-<!-- 
-# Copyright (C) 2008  Georgia Public Library Service
-# Bill Erickson <erickson at esilibrary.com>
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
--->
-
-<!--
-XXX load DTD
--->
-
-<html xmlns='http://www.w3.org/1999/xhtml'>
-    <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" src='org_unit_settings.js'></script>
-        <script>
-            var osSettings = {
-                'circ.lost_materials_processing_fee' : {
-                    label : '&staff.server.admin.org_settings.lost_fee;',
-                    type : 'currency',
-                },
-                'cat.default_item_price' : {
-                    label : '&staff.server.admin.org_settings.default_price;',
-                    type : 'currency',
-                },
-                'auth.opac_timeout' : {
-                    label : '&staff.server.admin.org_settings.opac_timeout;',
-                    type : 'number',
-                },
-                'auth.staff_timeout' : {
-                    label : '&staff.server.admin.org_settings.staff_timeout;',
-                    type : 'number',
-                },
-                'org.bounced_emails' : {
-                    label : '&staff.server.admin.org_settings.from_address;',
-                },
-                'circ.hold_expire_alert_interval' : {
-                    label : 'Hold Expiration Alert Interval',
-                },
-                'circ.hold_expire_interval' : {
-                    label : 'Default Hold Expirate Interval',
-                },
-                'global.credit.allow' : {
-                    label : 'Allow Credit Card Payments',
-                    type : 'bool'
-                },
-                'global.default_locale' : {
-                    label : 'Default Locale',
-                },
-            };
-        </script>
-    </head>
-    <body class="tundra tall">
-        <div dojoType="dijit.layout.LayoutContainer" orientation="vertical" class="tall">
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='top'>
-                <h1>Org Unit Settings</h1><br/>
-                Context Location 
-                <select id='os-context-selector' onchange='osChangeContext();'> 
-                </select>
-            </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' class='tall'>
-                <script>
-                    var osGridLayout = [{
-                        defaultCell: {styles: 'text-align: center;'},
-                        cells : [[
-                            {name: 'Edit', get: osGetEditLink, 
-                                value: '<a href="javascript:void(0);" onclick="osLaunchEditor(\'SETTING\');">Edit</a>'},
-                            {name: 'Setting', get: osGetGridData, field:'label', width:'auto'},
-                            {name: 'Context', get: osGetGridData, field:'context', width:'auto'},
-                            {name: 'Value', get: osGetGridData, field:'value', width:'auto'},
-                        ]]
-                    }];
-                </script>
-                <div dojoType='dojox.Grid' jsId='osGrid'> </div>
-            </div>
-        </div>
-    </body>
-</html>
-



More information about the open-ils-commits mailing list