[open-ils-commits] r12180 - in trunk/Open-ILS/web: js/ui/default/conify/global/config templates/default/conify/global/config (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 13 17:21:38 EST 2009
Author: erickson
Date: 2009-02-13 17:21:34 -0500 (Fri, 13 Feb 2009)
New Revision: 12180
Added:
trunk/Open-ILS/web/js/ui/default/conify/global/config/idl_field_doc.js
trunk/Open-ILS/web/templates/default/conify/global/config/idl_field_doc.tt2
Log:
UI for manging idl_field_doc entries
Added: trunk/Open-ILS/web/js/ui/default/conify/global/config/idl_field_doc.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/idl_field_doc.js (rev 0)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/idl_field_doc.js 2009-02-13 22:21:34 UTC (rev 12180)
@@ -0,0 +1,49 @@
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('dojo.data.ItemFileReadStore');
+dojo.require('fieldmapper.IDL');
+dojo.require('openils.PermaCrud');
+dojo.require('openils.widget.AutoGrid');
+
+function updateFieldSelector() {
+ var cls = this.attr('value');
+ if(!cls) return;
+ var flist = fieldmapper.IDL.fmclasses[cls];
+ var fields = [];
+ for(var f in flist.fields) {
+ var field = flist.fields[f];
+ if(field.virtual) continue;
+ fields.push({name:field.label, value:field.name});
+ }
+ fdocGrid.overrideEditWidgets.field.store = new dojo.data.ItemFileReadStore(
+ {data:{identifier:'value', label:'name', items:fields}});
+}
+
+function load() {
+ var slist = fieldmapper.IDL.fmclasses;
+ var dlist = [];
+
+ fdocGrid.overrideEditWidgets.field = editFieldSelector;
+ fdocGrid.overrideEditWidgets.classname = editClassSelector;
+ dojo.connect(fdocGrid.overrideEditWidgets.classname, 'onChange', updateFieldSelector);
+
+ for(var f in slist) {
+ if(slist[f].label != slist[f].name) // only show tables that have an actual label
+ dlist.push({value:slist[f].name, name:slist[f].label});
+ }
+ dlist = dlist.sort(function(a, b){return (a.name < b.name) ? -1 : 1;});
+
+ fmClassSelector.store =
+ fdocGrid.overrideEditWidgets.classname.store =
+ new dojo.data.ItemFileReadStore({data:{identifier:'value', label:'name', items:dlist}});
+
+ fmClassSelector.startup();
+ dojo.connect(fmClassSelector, 'onChange',
+ function() {
+ fdocGrid.loadAll({order_by:{fdoc : 'field'}}, {classname: this.attr('value')});
+ }
+ );
+}
+
+
+openils.Util.addOnLoad(load);
+
Added: trunk/Open-ILS/web/templates/default/conify/global/config/idl_field_doc.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/idl_field_doc.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/idl_field_doc.tt2 2009-02-13 22:21:34 UTC (rev 12180)
@@ -0,0 +1,29 @@
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/idl_field_doc.js'> </script>
+<table style='width:100%;margin-bottom:10px;'>
+ <tr>
+ <td align='left'><h3>Field Documentation</h3></td>
+ <td align='right'>
+ <span dojoType='dijit.form.FilteringSelect' jsId='fmClassSelector'></span>
+ <button dojoType='dijit.form.Button' onClick='fdocGrid.showCreateDialog()'>New</button>
+ </td>
+ </tr>
+</table>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:90%'>
+ <table jsId="fdocGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'classname', 'field', 'owner', 'string']"
+ query="{id: '*'}"
+ fmClass='fdoc'
+ defaultCellWidth='12'
+ editOnEnter='true'>
+ <thead>
+ <tr><th field='string' width='auto'/></tr>
+ </thead>
+ </table>
+</div>
+<div class='hidden'>
+ <span dojoType='dijit.form.FilteringSelect' jsId='editClassSelector'></span>
+ <span dojoType='dijit.form.FilteringSelect' jsId='editFieldSelector'></span>
+</div>
+[% END %]
More information about the open-ils-commits
mailing list