[open-ils-commits] SPAM: r10723 -
trunk/Open-ILS/xul/staff_client/server/admin
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Sep 29 00:51:42 EDT 2008
Author: erickson
Date: 2008-09-29 00:51:39 -0400 (Mon, 29 Sep 2008)
New Revision: 10723
Added:
trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml
Modified:
trunk/Open-ILS/xul/staff_client/server/admin/admin.css
Log:
org unit setting editor that is more context-specific, which honors parent settings. read-only for now. later this will replace the existing org settings 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 02:02:42 UTC (rev 10722)
+++ trunk/Open-ILS/xul/staff_client/server/admin/admin.css 2008-09-29 04:51:39 UTC (rev 10723)
@@ -1,4 +1,9 @@
-body { font-family: Verdana, Tahoma; font-size: 10pt; background-color: white;}
+ at import "/js/dojo/dojo/resources/dojo.css";
+ at import "/js/dojo/dijit/themes/tundra/tundra.css";
+ at import "/js/dojo/dijit/tests/css/dijitTests.css";
+ at import "/js/dojo/dojox/grid/_grid/Grid.css";
+.container:after {content: ""; display: block; height: 0; clear: both; }
+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;}
.hide_me { visibility: hidden; display: none }
@@ -18,6 +23,7 @@
select { width: 12em; }
select:disabled { color: #555555; }
input[type="text"]:disabled { color: #555555; }
+.tall { height:100%; }
button {
color:#050;
Added: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js 2008-09-29 04:51:39 UTC (rev 10723)
@@ -0,0 +1,90 @@
+dojo.require("dijit.layout.LayoutContainer");
+dojo.require("dijit.layout.ContentPane");
+dojo.require('dijit.form.FilteringSelect');
+dojo.require("dojox.grid.Grid");
+dojo.require("fieldmapper.Fieldmapper");
+dojo.require("fieldmapper.dojoData");
+dojo.require("fieldmapper.OrgUtils");
+dojo.require('dojo.cookie');
+dojo.require('openils.CGI');
+dojo.require('openils.User');
+dojo.require('openils.Event');
+
+var authtoken;
+var contextOrg;
+var user;
+var contextSelector;
+
+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');
+
+ var names = [];
+ for(var key in osSettings)
+ names.push(key);
+
+ fieldmapper.standardRequest(
+ [ 'open-ils.actor',
+ 'open-ils.actor.ou_setting.ancestor_default.batch'],
+ { async: true,
+ params: [contextOrg, names],
+ oncomplete: function(r) {
+ var data = r.recv().content();
+ if(e = openils.Event.parse(data))
+ return alert(e);
+ osLoadGrid(data);
+ }
+ }
+ );
+ buildMergedOrgSel(contextSelector, user.ws_ou(), 0);
+ // open-ils.actor.user.get_work_ous.ids
+}
+dojo.addOnLoad(osInit);
+
+function osChangeContect() {
+ contextOrg = getSelectorVal(contextSelector);
+}
+
+function osLoadGrid(data) {
+ var gridData = {items:[]}
+ for(var key in data) {
+ if(data[key]) {
+ osSettings[key].context = data[key].org;
+ osSettings[key].value = data[key].value;
+ }
+ gridData.items.push({name:key});
+ }
+ gridData.identifier = 'name';
+ var store = new dojo.data.ItemFileReadStore({data:gridData});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 100, clientSort: true, query:{name:'*'}});
+
+ osGrid.setModel(model);
+ osGrid.setStructure(osGridLayout);
+ osGrid.update();
+}
+
+function osGetGridData(rowIdx) {
+ var data = this.grid.model.getRow(rowIdx);
+ if(!data) return '';
+ var value = osSettings[data.name][this.field];
+ if(value == null) return '';
+ switch(this.field) {
+ case 'context':
+ return fieldmapper.aou.findOrgUnit(value).shortname();
+ default:
+ return value;
+ }
+}
+
+function osGetEditLink(rowIdx) {
+ var data = this.grid.model.getRow(rowIdx);
+ if(!data) return '';
+ return this.value.replace(/SETTING/, data.name);
+}
+
+function osLaunchEditor(name) {
+}
+
Added: trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xml 2008-09-29 04:51:39 UTC (rev 10723)
@@ -0,0 +1,88 @@
+<!--
+# 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