[open-ils-commits] r10318 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq public/oils/media/ui_js/oils/default/acq
public/oils/media/ui_js/oils/default/acq/settings
templates/oils/default/acq templates/oils/default/acq/settings
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Aug 8 17:22:43 EDT 2008
Author: erickson
Date: 2008-08-08 17:22:39 -0400 (Fri, 08 Aug 2008)
New Revision: 10318
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/settings.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/settings/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/settings/li_attr.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/settings/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/settings/li_attr.html
Log:
initial page for defining marc attrs
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/settings.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/settings.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/settings.py 2008-08-08 21:22:39 UTC (rev 10318)
@@ -0,0 +1,12 @@
+from oilsweb.lib.base import *
+from oilsweb.lib.request import RequestMgr
+import oilsweb.lib.user
+import osrf.net_obj
+import oils.const
+from osrf.ses import ClientSession
+from oils.event import Event
+from oils.org import OrgUtil
+
+class SettingsController(BaseController):
+ def li_attr(self, **kwargs):
+ return RequestMgr().render('acq/settings/li_attr.html')
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/settings/li_attr.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/settings/li_attr.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/settings/li_attr.js 2008-08-08 21:22:39 UTC (rev 10318)
@@ -0,0 +1,105 @@
+dojo.require("dijit.Dialog");
+dojo.require('dijit.layout.TabContainer');
+dojo.require('dijit.layout.ContentPane');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.form.TextBox');
+dojo.require('dojox.grid.Grid');
+dojo.require("fieldmapper.OrgUtils");
+dojo.require('openils.Event');
+dojo.require('openils.User');
+dojo.require('openils.acq.LineitemAttr');
+
+var provider = null;
+var marcRegex = /^\/\/\*\[@tag="(\d+)"]\/\*\[@code="(\w)"]$/;
+var attrDefStores;
+
+
+function getOrgInfo(rowIndex) {
+ data = providerGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+}
+
+function getTag(rowIdx) {
+ data = this.grid.model.getRow(rowIdx);
+ if(!data) return;
+ return data.xpath.replace(marcRegex, '$1');
+}
+
+function getSubfield(rowIdx) {
+ data = this.grid.model.getRow(rowIdx);
+ if(!data) return;
+ return data.xpath.replace(marcRegex, '$2');
+}
+
+
+function loadStores(onload) {
+ if(attrDefStores)
+ return onload();
+ openils.acq.LineitemAttr.createAttrDefStores(
+ function(stores) {
+ attrDefStores = stores;
+ onload();
+ }
+ )
+}
+
+
+function loadMarcAttrGrid() {
+ loadStores(
+ function() {
+ var store = new dojo.data.ItemFileReadStore({data:attrDefStores.marc});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ liMarcAttrGrid.setModel(model);
+ liMarcAttrGrid.update();
+ }
+ );
+}
+
+function loadGeneratedAttrGrid() {
+ loadStores(
+ function() {
+ var store = new dojo.data.ItemFileReadStore({data:attrDefStores.generated});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ liGeneratedAttrGrid.setModel(model);
+ liGeneratedAttrGrid.update();
+ }
+ );
+}
+
+/*
+function createOrderRecordField(fields) {
+ fields.provider = providerId;
+ if(!fields.xpath)
+ fields.xpath = '//*[@tag="'+fields.tag+'"]/*[@code="'+fields.subfield+'"]';
+ delete fields.tag;
+ delete fields.subfield;
+ openils.acq.Provider.createLineitemProviderAttrDef(fields,
+ function(id) {
+ loadPADGrid();
+ }
+ );
+}
+
+function setORDesc() {
+ var code = dijit.byId('oils-acq-provider-or-code');
+ var desc = dijit.byId('oils-acq-provider-or-desc');
+ desc.setValue(code.getDisplayedValue());
+}
+
+function deleteORDataFields() {
+ var list = []
+ var selected = padGrid.selection.getSelected();
+ for(var idx = 0; idx < selected.length; idx++)
+ list.push(padGrid.model.getRow(selected[idx]).id);
+ openils.acq.Provider.lineitemProviderAttrDefDeleteList(
+ list, function(){loadPADGrid();});
+}
+*/
+
+
+//dojo.addOnLoad(loadLIAttrGrid);
+
+
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/settings/li_attr.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/settings/li_attr.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/settings/li_attr.html 2008-08-08 21:22:39 UTC (rev 10318)
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%def name="page_title()">${_('Lineitem Attribute Definitions')}</%def>
+<%def name="block_content()">
+<!-- load the page-specific JS -->
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/settings/li_attr.js'> </script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.form.DropDownButton">
+ <span>${('Lineitem Attribute Attribute')}</span>
+ <div dojoType="dijit.TooltipDialog" execute="createOrderRecordField(arguments[0]);">
+ <script type='dojo/connect' event='onOpen'>//setORDesc();</script>
+ <table class='dijitTooltipTable'>
+ <tr>
+ <td><label for="code">${_('Code:')}</label></td>
+ <td><input dojoType='dijit.form.TextBox' name='code'/></td>
+ </tr>
+ <tr>
+ <td><label for="description">${_('Description:')} </label></td>
+ <td><input id='oils-acq-provider-or-desc' dojoType="dijit.form.TextBox" name="description"> </input></td>
+ </tr>
+ <tr>
+ <td><label for="amount">${_('Tag:')} </label></td>
+ <td><input dojoType="dijit.form.TextBox" name="tag"></input></td>
+ </tr>
+ <tr>
+ <td><label for="amount">${_('Subfield:')} </label></td>
+ <td><input dojoType="dijit.form.TextBox" name="subfield"></input></td>
+ </tr>
+ <tr>
+ <td><label for="ident">${_('Identifer Field?:')} </label></td>
+ <td>
+ <select dojoType="dijit.form.FilteringSelect" name="ident">
+ <option value='f' selected='selected'>${_('False')}</option>
+ <option value='t'>${_('True')}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="amount">${_('XPath (advanced):')} </label></td>
+ <td><input dojoType="dijit.form.TextBox" name="xpath"></input></td>
+ </tr>
+ <tr>
+ <td colspan='2' align='center'>
+ <button dojoType=dijit.form.Button type="submit">${_('Apply')}</button>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <script>
+ var liAttrGridLayout = [{
+ cells : [[
+ {name: '${_("ID")}', field: 'id'},
+ {name: '${_("Code")}', field:'code', width:'auto'},
+ {name: '${_("Description")}', field: "description", width:'auto'},
+ {name: '${_("Tag")}', get:getTag},
+ {name: '${_("Subfield")}', get:getSubfield},
+ {name: '${_("Identifier")}', field:'ident'},
+ {name: '${_("XPath")}', field:'xpath', width:'auto'}
+ ]]
+ }];
+ </script>
+ <div dojoType="dijit.layout.TabContainer">
+ <div dojoType="dijit.layout.ContentPane"
+ class='oils-acq-detail-content-pane' title="${_('MARC Attributes')}" style='height:600px;'>
+ <script type='dojo/connect' event='onShow'>loadMarcAttrGrid();</script>
+ <div jsId='liMarcAttrGrid' dojoType="dojox.Grid" structure='liAttrGridLayout'> </div>
+ </div>
+ <div dojoType="dijit.layout.ContentPane"
+ class='oils-acq-detail-content-pane' title="${_('Generated Attributes')}" style='height:600px;'>
+ <script type='dojo/connect' event='onShow'>loadGeneratedAttrGrid();</script>
+ <div jsId='liGeneratedAttrGrid' dojoType="dojox.Grid" structure='liAttrGridLayout'> </div>
+ </div>
+ </div>
+</div>
+</%def>
More information about the open-ils-commits
mailing list