[open-ils-commits] SPAM: r9237 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq public/oils/media public/oils/media/css/skin
public/oils/media/js public/oils/media/js/openils
public/oils/media/js/openils/acq templates/oils
templates/oils/default/acq/financial
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Apr 5 09:40:59 EDT 2008
Author: erickson
Date: 2008-04-05 09:04:16 -0400 (Sat, 05 Apr 2008)
New Revision: 9237
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html
Log:
Converted the provider list page to a JS/dojo grid version to start out with something simple
Moved the Dojo CSS imports into the default skin css
Added the opensrf and ILS JS imports into base.html. As noted in the source, some/many of
those will also be dojo-ized over time.
Added the configured prefix to all JS imports in the HTML files
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-04-05 11:44:42 UTC (rev 9236)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-04-05 13:04:16 UTC (rev 9237)
@@ -50,6 +50,7 @@
return r.render('acq/financial/create_provider.html')
+ ''' Pure Python version
def list(self):
r = RequestMgr()
providers = provider_mgr.list(r)
@@ -57,4 +58,10 @@
f.owner(OrgUtil.get_org_unit(f.owner()))
r.ctx.acq.provider_list.value = providers
return r.render('acq/financial/list_providers.html')
+ '''
+
+ def list(self):
+ return RequestMgr().render('acq/financial/list_providers.html')
+
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css 2008-04-05 11:44:42 UTC (rev 9236)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css 2008-04-05 13:04:16 UTC (rev 9237)
@@ -1,7 +1,14 @@
/* import the default css for the install applications */
@import "default/acq.css";
@import "default/admin.css";
+/* import the dojo CSS */
+ at import "../../js/dojo/dojox/grid/_grid/Grid.css";
+ at import "../../js/dojo/dijit/themes/tundra/tundra.css";
+ at import "../../js/dojo/dojo/resources/dojo.css";
+
+
+
/* base default style */
/** Generic style ------------------------------ **/
@@ -39,3 +46,9 @@
.label { margin: 1px; }
+
+/* local dojo style enhancements ----------------------------------- */
+.dojoxGrid {border: 1px solid #333; height: 90%;}
+.dojoxGrid-cell {padding: 8px;}
+/* ----------------------------------------------------------------- */
+
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js 2008-04-05 13:04:16 UTC (rev 9237)
@@ -0,0 +1,58 @@
+if(!dojo._hasResource['openils.acq.Provider']) {
+dojo._hasResource['openils.acq.Provider'] = true;
+dojo.provide('openils.acq.Provider');
+
+/** Declare the Provider class with dojo */
+dojo.declare('openils.acq.Provider', null, {
+ /* add instance methods here if necessary */
+});
+
+/* define some static provider methods ------- */
+
+openils.acq.Provider.createProviderGrid = function(domId, structure) {
+ /** Fetches the list of providers and builds a grid from them */
+ openils.acq.Provider.fetchList(
+ function(providers) {
+ items = [];
+ for(var p in providers) {
+ var prov = providers[p];
+ items.push({
+ id:prov.id(),
+ name:prov.name(),
+ owner: findOrgUnit(prov.owner()).name(),
+ currency_type:prov.currency_type()
+ });
+ }
+ openils.acq.Provider.buildGrid(domId, structure, items);
+ }
+ );
+}
+
+openils.acq.Provider.fetchList = function(callback) {
+ /** Retrieves the list of provider objects that I have permission to view */
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.provider.org.retrieve', oilsAuthtoken); /* XXX make this a streaming call */
+ req.oncomplete = function(r) {
+ callback(r.recv().content());
+ };
+ req.send();
+};
+
+openils.acq.Provider.buildGrid = function(domId, structure, dataList, identifier) {
+ /** Builds a dojo grid based on the provided data.
+ * @param domId The DOM node where the grid lives
+ * @param structure The layout of the grid. i.e. colums.
+ * @param dataList List of objects (hashes) to be inserted into the grid.
+ * @paramd identifier The ID field for objects in the grid. Defaults to 'id'
+ */
+ identifier = (identifier) ? identifier : 'id';
+ var store = new dojo.data.ItemFileWriteStore({data:{identifier:identifier,items:dataList}});
+ var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true});
+ var grid = new dojox.Grid({structure: structure, model: model}, dojo.byId(domId));
+ grid.setModel(model);
+ grid.setStructure(structure);
+ grid.startup();
+ return {grid:grid, store:store, model:model};
+};
+}
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html 2008-04-05 11:44:42 UTC (rev 9236)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html 2008-04-05 13:04:16 UTC (rev 9237)
@@ -15,38 +15,55 @@
<%def name="page_title()">${_('Evergreen Acquisitions')}</%def>
<title>${self.page_title()}</title>
${self.block_css()}
- ${self.block_js()}
+ ${self.block_js()}
</head>
</%def>
<%def name='block_body()'>
-<body>${self.block_body_content()}</body>
+ <body>${self.block_body_content()}</body>
</%def>
<%def name='block_body_content()'/>
<%def name='block_css()'>
- <style type="text/css">
- @import "/js/dijit/themes/tundra/tundra.css";
- @import "/js/dojo/resources/dojo.css";
- </style>
- <link rel='stylesheet' type='text/css' href='${c.oils.core.media_prefix.value}/css/skin/${c.oils.core.skin.value}.css'/>
- <link rel='stylesheet' type='text/css' href='${c.oils.core.media_prefix.value}/css/theme/${c.oils.core.theme.value}.css'/>
+ <link rel='stylesheet' type='text/css'
+ href='${c.oils.core.media_prefix.value}/css/skin/${c.oils.core.skin.value}.css'/>
+ <link rel='stylesheet' type='text/css'
+ href='${c.oils.core.media_prefix.value}/css/theme/${c.oils.core.theme.value}.css'/>
</%def>
<%def name='block_js()'>
- <script type="text/javascript" src="/js/dojo/dojo.js"
- djConfig="parseOnLoad: true"></script>
+
+ <!-- set up some global JS variables -->
+ <script type='text/javascript'>
+ var oilsAuthtoken = '${c.oils.core.authtoken.value}';
+ </script>
+
+ <!-- some of these will dojo-ized ... -->
+ <script src='${c.oils.core.media_prefix.value}/js/opensrf/JSON_v1.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/opensrf/opensrf.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/opensrf/opensrf_xhr.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/openils/fmall.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/openils/fmgen.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/openils/OrgTree.js'> </script>
+ <script src='${c.oils.core.media_prefix.value}/js/openils/org_utils.js'> </script>
+
+ <script type="text/javascript" src="${c.oils.core.media_prefix.value}/js/dojo/dojo/dojo.js"
+ djConfig="parseOnLoad: true"></script>
+
<script type="text/javascript">
dojo.require("dojo.parser");
-
- dojo.require("dijit.layout.LayoutContainer")
- dojo.require("dijit.layout.ContentPane")
-
- dojo.require("dijit.form.Form")
- dojo.require("dijit.form.Button");
- dojo.require("dijit.form.TextBox");
- dojo.require("dijit.form.NumberTextBox");
- dojo.require("dijit.form.NumberSpinner");
- dojo.require("dijit.form.FilteringSelect");
+ dojo.require("dijit.layout.LayoutContainer")
+ dojo.require("dijit.layout.ContentPane")
+ dojo.require("dijit.form.Form")
+ dojo.require("dijit.form.Button");
+ dojo.require("dijit.form.TextBox");
+ dojo.require("dijit.form.NumberTextBox");
+ dojo.require("dijit.form.NumberSpinner");
+ dojo.require("dijit.form.FilteringSelect");
+ dojo.require("dojo.data.ItemFileWriteStore");
+ dojo.require("dojox.grid.Grid");
+ dojo.require("dojox.grid._data.model");
+ dojo.require("fieldmapper.dojoData");
</script>
</%def>
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html 2008-04-05 11:44:42 UTC (rev 9236)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html 2008-04-05 13:04:16 UTC (rev 9237)
@@ -10,24 +10,22 @@
<a href='${c.oils.acq.prefix.value}/provider/create'>${_('New Provider')}</a>
</div>
</div>
+<div id='oils-acq-provider-grid'> </div>
+<script>
+ dojo.require('openils.acq.Provider');
+ /* define the layout columns */
+ var cols = [{
+ cells : [[
+ {name: '${_("ID")}', field: 'id'},
+ {name: '${_("Name")}', field: "name"},
+ {name: '${_("Owner")}', field: "owner"},
+ {name: '${_("Currency Type")}', field: "currency_type"}
+ ]]
+ }];
-<table class='oils-admin-table'>
- <thead>
- <tr>
- <td>${_('Name')}</td>
- <td>${_('Owner')}</td>
- <td>${_('Currency Type')}</td>
- </tr>
- </thead>
- <tbody>
- % for provider in c.oils.acq.provider_list.value:
- <tr>
- <td><a href='${c.oils.acq.prefix.value}/provider/view/${provider.id()}'>${provider.name()}</a></td>
- <td>${provider.owner().name()}</td>
- <td>${provider.currency_type()}</td>
- </tr>
- %endfor
- </tbody>
-</table>
+ /* build the provider grid on page load */
+ dojo.addOnLoad(function(){
+ openils.acq.Provider.createProviderGrid('oils-acq-provider-grid', cols)});
+</script>
</%def>
More information about the open-ils-commits
mailing list