[open-ils-commits] r18717 - in branches/rel_2_0/Open-ILS: examples examples/apache src/perlmods/OpenILS/WWW web/conify/global/actor web/conify/global/config web/conify/global/permission web/js/dojo/fieldmapper web/js/ui web/opac/skin/default/xml/common web/templates xsl xul/staff_client/server/OpenILS xul/staff_client/server/admin (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Nov 12 14:51:31 EST 2010
Author: erickson
Date: 2010-11-12 14:51:26 -0500 (Fri, 12 Nov 2010)
New Revision: 18717
Added:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/IDL2js.pm
branches/rel_2_0/Open-ILS/xsl/fm_IDL2js.xsl
Modified:
branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
branches/rel_2_0/Open-ILS/examples/apache/startup.pl
branches/rel_2_0/Open-ILS/examples/opensrf.xml.example
branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit.html
branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit_type.html
branches/rel_2_0/Open-ILS/web/conify/global/config/copy_status.html
branches/rel_2_0/Open-ILS/web/conify/global/config/marc_code_maps.html
branches/rel_2_0/Open-ILS/web/conify/global/permission/grp_tree.html
branches/rel_2_0/Open-ILS/web/conify/global/permission/perm_list.html
branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/IDL.js
branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/hash.js
branches/rel_2_0/Open-ILS/web/js/ui/base.js
branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
branches/rel_2_0/Open-ILS/web/templates/base.tt2
branches/rel_2_0/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml
branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
Log:
Back-port of 18712 and related changes: Server-generated IDL JS
The goal is to reduce use of pre-onload XHR, which is known to cause
problems (dreaded white-screen-of-death) in firefox/xulrunner. Change
allows opac, staff client, and embedded browser interfaces to load
a pre-formatted JS object instead of IDL XML via XHR. In addition to
dropping the XHR, clients no longer parse the XML, which should reduce
page render time. Finally, in the staff interfaces, the full IDL is
once again loaded, so there is no need to specifiy per-page classes.
Per-page classes are still supported and used in the OPAC to reduce the
up-front load time.
Change requires an update to the Evergreen Apache config.
Part of this change included condensing fieldmapper.hash and
fielmapper.dojoData content into fieldmapper.Fieldmapper to avoid
circular dependencies, which was causing problems with IE. Will
eventually want to deprecate .hash and .dojoData, but for now they still
function as before.
Modified: branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf 2010-11-12 19:51:26 UTC (rev 18717)
@@ -565,3 +565,27 @@
CustomLog /var/log/apache2/deflate_log deflate
</IfModule>
+
+<Location /IDL2js>
+
+ SetHandler perl-script
+ PerlHandler OpenILS::WWW::IDL2js
+ Options +ExecCGI
+ PerlSendHeader On
+ allow from all
+
+ <IfModule mod_headers.c>
+ Header append Cache-Control "public"
+ </IFModule>
+
+ <IfModule mod_deflate.c>
+ SetOutputFilter DEFLATE
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+ BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+ <IfModule mod_headers.c>
+ Header append Vary User-Agent env=!dont-vary
+ </IfModule>
+ </IfModule>
+</Location>
Modified: branches/rel_2_0/Open-ILS/examples/apache/startup.pl
===================================================================
--- branches/rel_2_0/Open-ILS/examples/apache/startup.pl 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/examples/apache/startup.pl 2010-11-12 19:51:26 UTC (rev 18717)
@@ -7,6 +7,7 @@
use OpenILS::WWW::Vandelay qw( /openils/conf/opensrf_core.xml );
use OpenILS::WWW::EGWeb ('/openils/conf/oils_web.xml');
use OpenILS::WWW::PasswordReset ('/openils/conf/opensrf_core.xml');
+use OpenILS::WWW::IDL2js ('/openils/conf/opensrf_core.xml');
# - Uncoment the following 2 lines to make use of the IP redirection code
# - The IP file should to contain a map with the following format:
Modified: branches/rel_2_0/Open-ILS/examples/opensrf.xml.example
===================================================================
--- branches/rel_2_0/Open-ILS/examples/opensrf.xml.example 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/examples/opensrf.xml.example 2010-11-12 19:51:26 UTC (rev 18717)
@@ -31,7 +31,9 @@
</share>
<IDL>SYSCONFDIR/fm_IDL.xml</IDL> <!-- top level IDL file -->
+ <IDL2js>fm_IDL2js.xsl</IDL2js> <!-- IDL JS XSLT -->
+
<server_type>prefork</server_type> <!-- net::server type -->
<ils_events>LOCALSTATEDIR/data/ils_events.xml</ils_events> <!-- ILS events description file -->
Copied: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/IDL2js.pm (from rev 18700, trunk/Open-ILS/src/perlmods/OpenILS/WWW/IDL2js.pm)
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/IDL2js.pm (rev 0)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/IDL2js.pm 2010-11-12 19:51:26 UTC (rev 18717)
@@ -0,0 +1,79 @@
+package OpenILS::WWW::IDL2js;
+use strict; use warnings;
+use XML::LibXML;
+use XML::LibXSLT;
+use Apache2::Const -compile => qw(OK DECLINED HTTP_INTERNAL_SERVER_ERROR);
+use Error qw/:try/;
+use OpenSRF::System;
+use OpenSRF::Utils::SettingsClient;
+
+my $bs_config;
+my $stylesheet;
+my $idl_doc;
+
+
+# load and parse the stylesheet
+sub import {
+ my $self = shift;
+ $bs_config = shift;
+}
+
+# parse the IDL, loaded from the network
+my $__initted = 0;
+sub child_init {
+ $__initted = 1;
+
+ OpenSRF::System->bootstrap_client(config_file => $bs_config);
+ my $sclient = OpenSRF::Utils::SettingsClient->new();
+
+ my $xsl_file = $sclient->config_value('IDL2js');
+
+ unless($xsl_file) {
+ warn "XSL2js XSL file required for IDL2js Apache module\n";
+ return;
+ }
+
+ $xsl_file = $sclient->config_value(dirs => 'xsl')."/$xsl_file";
+ my $idl_file = $sclient->config_value("IDL");
+
+ my $xslt = XML::LibXSLT->new();
+
+ try {
+
+ my $style_doc = XML::LibXML->load_xml(location => $xsl_file, no_cdata=>1);
+ $stylesheet = $xslt->parse_stylesheet($style_doc);
+
+ } catch Error with {
+ my $e = shift;
+ warn "Invalid XSL File: $xsl_file: $e\n";
+ };
+
+ $idl_doc = XML::LibXML->load_xml(location => $idl_file);
+}
+
+
+sub handler {
+ my $r = shift;
+ my $args = $r->args || '';
+ child_init() unless $__initted;
+
+ return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR unless $stylesheet and $idl_doc;
+ return Apache2::Const::DECLINED if $args and $args !~ /^[a-zA-Z,]*$/;
+
+ my $output;
+ try {
+ my $results = $stylesheet->transform($idl_doc, class_list => "'$args'");
+ $output = $stylesheet->output_as_bytes($results);
+ } catch Error with {
+ my $e = shift;
+ $r->log->error("IDL XSL Error: $e");
+ };
+
+ return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR unless $output;
+
+ $r->content_type('application/x-javascript; encoding=utf8');
+ $r->print($output);
+ return Apache2::Const::OK;
+}
+
+1;
Modified: branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -47,6 +47,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
Modified: branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit_type.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit_type.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/actor/org_unit_type.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -49,6 +49,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
@@ -381,7 +382,7 @@
{ parent : current_type, attribute : 'children' }
);
},
- }).send();
+ });
if (!err) {
highlighter.editor_pane.green.play();
Modified: branches/rel_2_0/Open-ILS/web/conify/global/config/copy_status.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/config/copy_status.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/config/copy_status.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -50,6 +50,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
Modified: branches/rel_2_0/Open-ILS/web/conify/global/config/marc_code_maps.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/config/marc_code_maps.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/config/marc_code_maps.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -50,6 +50,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
Modified: branches/rel_2_0/Open-ILS/web/conify/global/permission/grp_tree.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/permission/grp_tree.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/permission/grp_tree.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -60,6 +60,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
Modified: branches/rel_2_0/Open-ILS/web/conify/global/permission/perm_list.html
===================================================================
--- branches/rel_2_0/Open-ILS/web/conify/global/permission/perm_list.html 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/conify/global/permission/perm_list.html 2010-11-12 19:51:26 UTC (rev 18717)
@@ -50,6 +50,7 @@
</style>
<!-- The OpenSRF API writ JS -->
+ <script language='javascript' src='/IDL2js?au,aou,aout,pgt,ppl,ccs' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
<script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
@@ -58,6 +59,7 @@
<script type="text/javascript" src="/js/dojo/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" src="/js/dojo/dojo/openils_dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
+ <script language='javascript'>dojo.require('fieldmapper.AutoIDL')</script>
<script type="text/javascript" src="perm_list.js"></script>
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -16,18 +16,18 @@
*/
if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
+ dojo._hasResource["fieldmapper.Fieldmapper"] = true;
+ dojo.provide("fieldmapper.Fieldmapper");
+ dojo.require("DojoSRF");
+
+
/* generate fieldmapper javascript classes. This expects a global variable
called 'fmclasses' to be fleshed with the classes we need to build */
function FMEX(message) { this.message = message; }
FMEX.toString = function() { return "FieldmapperException: " + this.message + "\n"; }
-
- dojo._hasResource["fieldmapper.Fieldmapper"] = true;
- dojo.provide("fieldmapper.Fieldmapper");
- dojo.require("DojoSRF");
-
dojo.declare( "fieldmapper.Fieldmapper", null, {
constructor : function (initArray) {
@@ -88,17 +88,10 @@
}
return;
}
-
-
-/*
- isnew : function(n) { if(arguments.length == 1) this.a[0] =n; return this.a[0]; },
- ischanged : function(n) { if(arguments.length == 1) this.a[1] =n; return this.a[1]; },
- isdeleted : function(n) { if(arguments.length == 1) this.a[2] =n; return this.a[2]; }
-*/
-
});
+
fieldmapper.vivicateClass = function (cl) {
dojo.provide( cl );
dojo.declare( cl , fieldmapper.Fieldmapper, {
@@ -128,10 +121,13 @@
}
});
+
fieldmapper[cl] = window[cl]; // alias into place
- if (fieldmapper.IDL && fieldmapper.IDL.loaded) fieldmapper[cl].Identifier = fieldmapper.IDL.fmclasses[cl].pkey;
- if (dojo._hasResource['fieldmapper.dojoData'] && dojo.filter(['aou','aout','pgt'], function(x){return x == cl}).length == 0) {
+ if (fieldmapper.IDL && fieldmapper.IDL.loaded)
+ fieldmapper[cl].Identifier = fieldmapper.IDL.fmclasses[cl].pkey;
+
+ //if (dojo.filter(['aou','aout','pgt'], function(x){return x == cl}).length == 0) {
fieldmapper[cl].prototype.fromStoreItem = _fromStoreItem;
fieldmapper[cl].toStoreData = _toStoreData;
fieldmapper[cl].toStoreItem = _toStoreItem;
@@ -139,46 +135,11 @@
fieldmapper[cl].initStoreData = _initStoreData;
fieldmapper[cl].prototype.toHash = _toHash;
fieldmapper[cl].toHash = _toHash;
- }
-
+ fieldmapper[cl].prototype.fromHash = _fromHash;
+ fieldmapper[cl].fromHash = _fromHash;
+ //}
};
- if (!window.fmclasses) dojo.require("fieldmapper.fmall", true);
- for( var cl in fmclasses ) {
- fieldmapper.vivicateClass(cl);
- }
-
- // if we were NOT called by the IDL loader ...
- // XXX This is now deprecated in preference to fieldmapper.AutoIDL
- if ( !(fieldmapper.IDL && fieldmapper.IDL.loaded) ) {
-
- fieldmapper.cmsa.Identifier = 'alias';
- fieldmapper.cmc.Identifier = 'name';
- fieldmapper.i18n_l.Identifier = 'code';
- fieldmapper.ccpbt.Identifier = 'code';
- fieldmapper.ccnbt.Identifier = 'code';
- fieldmapper.cbrebt.Identifier = 'code';
- fieldmapper.cubt.Identifier = 'code';
- fieldmapper.ccm.Identifier = 'code';
- fieldmapper.cvrfm.Identifier = 'code';
- fieldmapper.clm.Identifier = 'code';
- fieldmapper.cam.Identifier = 'code';
- fieldmapper.cifm.Identifier = 'code';
- fieldmapper.citm.Identifier = 'code';
- fieldmapper.cblvl.Identifier = 'code';
- fieldmapper.clfm.Identifier = 'code';
- fieldmapper.mous.Identifier = 'usr';
- fieldmapper.moucs.Identifier = 'usr';
- fieldmapper.mucs.Identifier = 'usr';
- fieldmapper.mus.Identifier = 'usr';
- fieldmapper.rxbt.Identifier = 'xact';
- fieldmapper.rxpt.Identifier = 'xact';
- fieldmapper.cxt.Identifier = 'name';
- fieldmapper.amtr.Identifier = 'matchpoint';
- fieldmapper.coust.Identifier = 'name';
-
- }
-
fieldmapper._request = function ( meth, staff, params ) {
var ses = OpenSRF.CachedClientSession( meth[0] );
if (!ses) return null;
@@ -246,90 +207,179 @@
have a staff counterpart and should have ".staff" appended to the method
before the method is called when in XUL mode */
fieldmapper.OpenSRF.methods = {
- SEARCH_MRS : ['open-ils.search','open-ils.search.metabib.multiclass',true],
- SEARCH_RS : ['open-ils.search','open-ils.search.biblio.multiclass',true],
- SEARCH_MRS_QUERY : ['open-ils.search','open-ils.search.metabib.multiclass.query',true],
- SEARCH_RS_QUERY : ['open-ils.search','open-ils.search.biblio.multiclass.query',true],
- FETCH_SEARCH_RIDS : ['open-ils.search','open-ils.search.biblio.record.class.search',true],
- FETCH_MRMODS : ['open-ils.search','open-ils.search.biblio.metarecord.mods_slim.retrieve'],
- FETCH_MODS_FROM_COPY : ['open-ils.search','open-ils.search.biblio.mods_from_copy'],
- FETCH_MR_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.metarecord.copy_count',true],
- FETCH_RIDS : ['open-ils.search','open-ils.search.biblio.metarecord_to_records',true],
- FETCH_RMODS : ['open-ils.search','open-ils.search.biblio.record.mods_slim.retrieve'],
- FETCH_R_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.record.copy_count',true],
- FETCH_FLESHED_USER : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve'],
- FETCH_SESSION : ['open-ils.auth','open-ils.auth.session.retrieve'],
- LOGIN_INIT : ['open-ils.auth','open-ils.auth.authenticate.init'],
- LOGIN_COMPLETE : ['open-ils.auth','open-ils.auth.authenticate.complete'],
- LOGIN_DELETE : ['open-ils.auth','open-ils.auth.session.delete'],
- FETCH_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.retrieve'],
- UPDATE_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.update'],
- FETCH_COPY_STATUSES : ['open-ils.search','open-ils.search.config.copy_status.retrieve.all'],
- FETCH_COPY_COUNTS_SUMMARY : ['open-ils.search','open-ils.search.biblio.copy_counts.summary.retrieve'],
- FETCH_MARC_HTML : ['open-ils.search','open-ils.search.biblio.record.html'],
- FETCH_CHECKED_OUT_SUM : ['open-ils.actor','open-ils.actor.user.checked_out'],
- FETCH_HOLDS : ['open-ils.circ','open-ils.circ.holds.retrieve'],
- FETCH_FINES_SUMMARY : ['open-ils.actor','open-ils.actor.user.fines.summary'],
- FETCH_TRANSACTIONS : ['open-ils.actor','open-ils.actor.user.transactions.have_charge.fleshed'],
- FETCH_MONEY_BILLING : ['open-ils.circ','open-ils.circ.money.billing.retrieve.all'],
- FETCH_CROSSREF : ['open-ils.search','open-ils.search.authority.crossref'],
- FETCH_CROSSREF_BATCH : ['open-ils.search','open-ils.search.authority.crossref.batch'],
- CREATE_HOLD : ['open-ils.circ','open-ils.circ.holds.create'],
- CREATE_HOLD_OVERRIDE : ['open-ils.circ','open-ils.circ.holds.create.override'],
- CANCEL_HOLD : ['open-ils.circ','open-ils.circ.hold.cancel'],
- UPDATE_USERNAME : ['open-ils.actor','open-ils.actor.user.username.update'],
- UPDATE_PASSWORD : ['open-ils.actor','open-ils.actor.user.password.update'],
- UPDATE_EMAIL : ['open-ils.actor','open-ils.actor.user.email.update'],
- RENEW_CIRC : ['open-ils.circ','open-ils.circ.renew'],
- CHECK_SPELL : ['open-ils.search','open-ils.search.spellcheck'],
- FETCH_REVIEWS : ['open-ils.search','open-ils.search.added_content.review.retrieve.all'],
- FETCH_TOC : ['open-ils.search','open-ils.search.added_content.toc.retrieve'],
- FETCH_ACONT_SUMMARY : ['open-ils.search','open-ils.search.added_content.summary.retrieve'],
- FETCH_USER_BYBARCODE : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve_by_barcode'],
- FETCH_ADV_MARC_MRIDS : ['open-ils.search','open-ils.search.biblio.marc',true],
- FETCH_ADV_ISBN_RIDS : ['open-ils.search','open-ils.search.biblio.isbn'],
- FETCH_ADV_ISSN_RIDS : ['open-ils.search','open-ils.search.biblio.issn'],
- FETCH_ADV_TCN_RIDS : ['open-ils.search','open-ils.search.biblio.tcn'],
- FETCH_CNBROWSE : ['open-ils.search','open-ils.search.callnumber.browse'],
- FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'],
- FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'],
- CREATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.create'],
- DELETE_CONTAINER : ['open-ils.actor','open-ils.actor.container.full_delete'],
- CREATE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.create'],
- DELETE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.delete'],
- FLESH_CONTAINER : ['open-ils.actor','open-ils.actor.container.flesh'],
- FLESH_PUBLIC_CONTAINER : ['open-ils.actor','open-ils.actor.container.public.flesh'],
- UPDATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.update'],
- FETCH_COPY : ['open-ils.search','open-ils.search.asset.copy.retrieve'],
- FETCH_FLESHED_COPY : ['open-ils.search','open-ils.search.asset.copy.fleshed2.retrieve'],
- CHECK_HOLD_POSSIBLE : ['open-ils.circ','open-ils.circ.title_hold.is_possible'],
- UPDATE_HOLD : ['open-ils.circ','open-ils.circ.hold.update'],
- FETCH_COPIES_FROM_VOLUME : ['open-ils.search','open-ils.search.asset.copy.retrieve_by_cn_label',true],
- FETCH_VOLUME_BY_INFO : ['open-ils.search','open-ils.search.call_number.retrieve_by_info'], /* XXX staff method? */
- FETCH_VOLUME : ['open-ils.search','open-ils.search.asset.call_number.retrieve'],
- FETCH_COPY_LOCATIONS : ['open-ils.circ','open-ils.circ.copy_location.retrieve.all'],
- FETCH_COPY_NOTES : ['open-ils.circ','open-ils.circ.copy_note.retrieve.all'],
- FETCH_COPY_STAT_CATS : ['open-ils.circ','open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'],
- FETCH_LIT_FORMS : ['open-ils.search','open-ils.search.biblio.lit_form_map.retrieve.all'],
- FETCH_ITEM_FORMS : ['open-ils.search','open-ils.search.biblio.item_form_map.retrieve.all'],
- FETCH_ITEM_TYPES : ['open-ils.search','open-ils.search.biblio.item_type_map.retrieve.all'],
- FETCH_AUDIENCES : ['open-ils.search','open-ils.search.biblio.audience_map.retrieve.all'],
- FETCH_HOLD_STATUS : ['open-ils.circ','open-ils.circ.hold.status.retrieve'],
- FETCH_NON_CAT_CIRCS : ['open-ils.circ','open-ils.circ.open_non_cataloged_circulation.user'],
- FETCH_NON_CAT_CIRC : ['open-ils.circ','open-ils.circ.non_cataloged_circulation.retrieve'],
- FETCH_NON_CAT_TYPES : ['open-ils.circ','open-ils.circ.non_cat_types.retrieve.all'],
- FETCH_BRE : ['open-ils.search','open-ils.search.biblio.record_entry.slim.retrieve'],
- CHECK_USERNAME : ['open-ils.actor','open-ils.actor.username.exists'],
- FETCH_CIRC_BY_ID : ['open-ils.circ','open-ils.circ.retrieve'],
- FETCH_MR_DESCRIPTORS : ['open-ils.search','open-ils.search.metabib.record_to_descriptors'],
- FETCH_HIGHEST_PERM_ORG : ['open-ils.actor','open-ils.actor.user.perm.highest_org.batch'],
- FETCH_USER_NOTES : ['open-ils.actor','open-ils.actor.note.retrieve.all'],
FETCH_ORG_BY_SHORTNAME : ['open-ils.actor','open-ils.actor.org_unit.retrieve_by_shortname'],
- FETCH_BIB_ID_BY_BARCODE : ['open-ils.search','open-ils.search.bib_id.by_barcode'],
FETCH_ORG_SETTING : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default'],
FETCH_ORG_SETTING_BATCH : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default.batch']
};
+
+
+ //** FROM HASH **/
+ function _fromHash (_hash) {
+ for ( var i=0; i < this._fields.length; i++) {
+ if (_hash[this._fields[i]] != null)
+ this[this._fields[i]]( _hash[this._fields[i]] );
+ }
+ return this;
+ }
+ function _toHash (includeNulls, virtFields) {
+ var _hash = {};
+ for ( var i=0; i < this._fields.length; i++) {
+ if (includeNulls || this[this._fields[i]]() != null) {
+ if (this[this._fields[i]]() == null)
+ _hash[this._fields[i]] = null;
+ else
+ _hash[this._fields[i]] = '' + this[this._fields[i]]();
+ }
+ }
+
+ if (virtFields && virtFields.length > 0) {
+ for (var i = 0; i < virtFields.length; i++) {
+ if (!_hash[virtFields[i]])
+ _hash[virtFields[i]] = null;
+ }
+ }
+
+ return _hash;
+ }
+ //** FROM HASH **/
+
+
+ /** FROM dojoData **/
+ function _fromStoreItem (data) {
+ this.fromHash(data);
+
+ for (var i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
+ this[this._ignore_fields[i]](null);
+
+ for (var i = 0; this._fields && i < this._fields.length; i++) {
+ if (dojo.isArray( this[this._fields[i]]() ))
+ this[this._fields[i]]( this[this._fields[i]]()[0] );
+ }
+ return this;
+ }
+
+ function _initStoreData(label, params) {
+ if (!params) params = {};
+ if (!params.identifier) params.identifier = this.Identifier;
+ if (!label) label = params.label;
+ if (!label) label = params.identifier;
+ return { label : label, identifier : params.identifier, items : [] };
+ }
+
+ function _toStoreItem(fmObj, params) {
+ if (!params) params = {};
+ return fmObj.toHash(true, params.virtualFields);
+ }
+
+ function _toStoreData (list, label, params) {
+ if (!params) params = {};
+ var data = this.initStoreData(label, params);
+
+ for (var i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
+
+ if (params.children && params.parent) {
+ var _hash_list = data.items;
+
+ var _find_root = {};
+ for (var i = 0; _hash_list && i < _hash_list.length; i++) {
+ _find_root[_hash_list[i][params.identifier]] = _hash_list[i];
+ }
+
+ var item_data = [];
+ for (var i = 0; _hash_list && i < _hash_list.length; i++) {
+ var obj = _hash_list[i]
+ obj[params.children] = [];
+
+ for (var j = 0; _hash_list && j < _hash_list.length; j++) {
+ var kid = _hash_list[j];
+ if (kid[params.parent] == obj[params.identifier]) {
+ obj[params.children].push( { _reference : kid[params.identifier] } );
+ kid._iskid = true;
+ if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]];
+ }
+ }
+
+ item_data.push( obj );
+ }
+
+ for (var j in _find_root) {
+ _find_root[j]['_top'] = 'true';
+ if (!_find_root[j][params.parent])
+ _find_root[j]['_trueRoot'] = 'true';
+ }
+
+ data.items = item_data;
+ }
+
+ return data;
+ }
+ /** FROM dojoData **/
+
+
+
+ /** ! Begin code that executes on page parse */
+
+ if (!window.fmclasses) dojo.require("fieldmapper.fmall", true);
+ for( var cl in fmclasses ) {
+ fieldmapper.vivicateClass(cl);
+ }
+
+ // if we were NOT called by the IDL loader ...
+ // XXX This is now deprecated in preference to fieldmapper.AutoIDL
+ if ( !(fieldmapper.IDL && fieldmapper.IDL.loaded) ) {
+
+ fieldmapper.cmsa.Identifier = 'alias';
+ fieldmapper.cmc.Identifier = 'name';
+ fieldmapper.i18n_l.Identifier = 'code';
+ fieldmapper.ccpbt.Identifier = 'code';
+ fieldmapper.ccnbt.Identifier = 'code';
+ fieldmapper.cbrebt.Identifier = 'code';
+ fieldmapper.cubt.Identifier = 'code';
+ fieldmapper.ccm.Identifier = 'code';
+ fieldmapper.cvrfm.Identifier = 'code';
+ fieldmapper.clm.Identifier = 'code';
+ fieldmapper.cam.Identifier = 'code';
+ fieldmapper.cifm.Identifier = 'code';
+ fieldmapper.citm.Identifier = 'code';
+ fieldmapper.cblvl.Identifier = 'code';
+ fieldmapper.clfm.Identifier = 'code';
+ fieldmapper.mous.Identifier = 'usr';
+ fieldmapper.moucs.Identifier = 'usr';
+ fieldmapper.mucs.Identifier = 'usr';
+ fieldmapper.mus.Identifier = 'usr';
+ fieldmapper.rxbt.Identifier = 'xact';
+ fieldmapper.rxpt.Identifier = 'xact';
+ fieldmapper.cxt.Identifier = 'name';
+ fieldmapper.amtr.Identifier = 'matchpoint';
+ fieldmapper.coust.Identifier = 'name';
+
+ }
+
+
+ /** FROM dojoData **/
+ /* set up some known class attributes */
+ if (fieldmapper.aou) fieldmapper.aou.prototype._ignore_fields = ['children'];
+ if (fieldmapper.aout) fieldmapper.aout.prototype._ignore_fields = ['children'];
+ if (fieldmapper.pgt) fieldmapper.pgt.prototype._ignore_fields = ['children'];
+
+ fieldmapper.aou.toStoreData = function (list, label) {
+ if (!label) label = 'shortname';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
+ }
+
+ fieldmapper.aout.toStoreData = function (list, label) {
+ if (!label) label = 'name';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+ }
+
+ fieldmapper.pgt.toStoreData = function (list, label) {
+ if (!label) label = 'name';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+ }
+ /** FROM dojoData **/
+
+
}
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/IDL.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/IDL.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/IDL.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -1,4 +1,5 @@
if(!dojo._hasResource["fieldmapper.IDL"]) {
+ dojo._hasResource['fieldmapper.IDL'] = true;
dojo.require("DojoSRF");
dojo.provide("fieldmapper.IDL");
dojo.declare('fieldmapper.IDL', null, {
@@ -11,10 +12,30 @@
constructor : function(classlist) {
+ var preload = [];
+ if (window._preload_fieldmapper_IDL) {
+ if (!fieldmapper.IDL.fmclasses) fieldmapper.IDL.fmclasses = {};
+ if (!window.fmclasses) window.fmclasses = {};
+
+ for (var c in window._preload_fieldmapper_IDL) {
+ preload.push(c);
+ fieldmapper.IDL.fmclasses[c] = window._preload_fieldmapper_IDL[c];
+
+ window.fmclasses[c] = [];
+ dojo.forEach(fieldmapper.IDL.fmclasses[c].fields, function(obj){ window.fmclasses[c].push(obj.name) });
+
+ if (classlist && classlist.length)
+ classlist = dojo.filter(classlist, function(x){return x != c;});
+ }
+
+ fieldmapper.IDL.loaded = true;
+ window._preload_fieldmapper_IDL = null;
+ }
+
if(!fieldmapper.IDL.fmclasses || (classlist && classlist.length)) {
var idl_url = this._URL_PATH;
- if (classlist.length) {
+ if (classlist.length > 1 || classlist[0] != '*') {
idl_url += '?';
for (var i = 0; i < classlist.length; i++) {
@@ -27,25 +48,32 @@
}
}
- var self = this;
- dojo.xhrGet({
- url : idl_url,
- handleAs : 'xml',
- sync : true,
- timeout : 10000,
- preventCache : true,
- load : function (response) {
- self._parse(response);
- fieldmapper.IDL.loaded = true;
- },
- error : function (response) {
- fieldmapper.IDL.loaded = false;
- dojo.require('fieldmapper.fmall', true);
- }
- });
+ if( !idl_url.match(/\?$/) ) { // make sure we have classes that need loading
+
+ console.log("Fetching classes from server at " + idl_url + ':' + classlist);
+
+ var self = this;
+ dojo.xhrGet({
+ url : idl_url,
+ handleAs : 'xml',
+ sync : true,
+ timeout : 10000,
+ load : function (response) {
+ self._parse(response);
+ fieldmapper.IDL.loaded = true;
+ },
+ error : function (response) {
+ fieldmapper.IDL.loaded = false;
+ dojo.require('fieldmapper.fmall', true);
+ }
+ });
+ }
}
dojo.require('fieldmapper.Fieldmapper');
+ if (preload.length)
+ dojo.forEach( classlist, function (c) { fieldmapper.vivicateClass(c); } );
+
if (classlist && classlist.length)
dojo.forEach( classlist, function (c) { fieldmapper.vivicateClass(c); } );
},
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -20,7 +20,6 @@
dojo._hasResource["fieldmapper.OrgUtils"] = true;
dojo.provide("fieldmapper.OrgUtils");
dojo.require("fieldmapper.Fieldmapper");
- dojo.require("fieldmapper.hash");
dojo.require("fieldmapper.OrgTree", true);
dojo.require("fieldmapper.OrgLasso", true);
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -19,112 +19,117 @@
dojo._hasResource['fieldmapper.dojoData'] = true;
dojo.provide('fieldmapper.dojoData');
- dojo.require('fieldmapper.Fieldmapper');
- dojo.require('fieldmapper.hash');
+ if(!dojo._hasResource["fieldmapper.Fieldmapper"]) {
- function _fromStoreItem (data) {
- this.fromHash(data);
+ /* XXX Content loaded in Fieldmapper */
+ /* XXX deprecate this file **/
- for (var i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
- this[this._ignore_fields[i]](null);
+ dojo.require('fieldmapper.Fieldmapper');
+ dojo.require('fieldmapper.hash');
- for (var i = 0; this._fields && i < this._fields.length; i++) {
- if (dojo.isArray( this[this._fields[i]]() ))
- this[this._fields[i]]( this[this._fields[i]]()[0] );
- }
- return this;
- }
+ function _fromStoreItem (data) {
+ this.fromHash(data);
- function _initStoreData(label, params) {
- if (!params) params = {};
- if (!params.identifier) params.identifier = this.Identifier;
- if (!label) label = params.label;
- if (!label) label = params.identifier;
- return { label : label, identifier : params.identifier, items : [] };
- }
+ for (var i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
+ this[this._ignore_fields[i]](null);
- function _toStoreItem(fmObj, params) {
- if (!params) params = {};
- return fmObj.toHash(true, params.virtualFields);
- }
+ for (var i = 0; this._fields && i < this._fields.length; i++) {
+ if (dojo.isArray( this[this._fields[i]]() ))
+ this[this._fields[i]]( this[this._fields[i]]()[0] );
+ }
+ return this;
+ }
- function _toStoreData (list, label, params) {
- if (!params) params = {};
- var data = this.initStoreData(label, params);
+ function _initStoreData(label, params) {
+ if (!params) params = {};
+ if (!params.identifier) params.identifier = this.Identifier;
+ if (!label) label = params.label;
+ if (!label) label = params.identifier;
+ return { label : label, identifier : params.identifier, items : [] };
+ }
- for (var i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
+ function _toStoreItem(fmObj, params) {
+ if (!params) params = {};
+ return fmObj.toHash(true, params.virtualFields);
+ }
- if (params.children && params.parent) {
- var _hash_list = data.items;
+ function _toStoreData (list, label, params) {
+ if (!params) params = {};
+ var data = this.initStoreData(label, params);
- var _find_root = {};
- for (var i = 0; _hash_list && i < _hash_list.length; i++) {
- _find_root[_hash_list[i][params.identifier]] = _hash_list[i];
- }
+ for (var i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
- var item_data = [];
- for (var i = 0; _hash_list && i < _hash_list.length; i++) {
- var obj = _hash_list[i]
- obj[params.children] = [];
+ if (params.children && params.parent) {
+ var _hash_list = data.items;
- for (var j = 0; _hash_list && j < _hash_list.length; j++) {
- var kid = _hash_list[j];
- if (kid[params.parent] == obj[params.identifier]) {
- obj[params.children].push( { _reference : kid[params.identifier] } );
- kid._iskid = true;
- if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]];
- }
- }
+ var _find_root = {};
+ for (var i = 0; _hash_list && i < _hash_list.length; i++) {
+ _find_root[_hash_list[i][params.identifier]] = _hash_list[i];
+ }
- item_data.push( obj );
- }
+ var item_data = [];
+ for (var i = 0; _hash_list && i < _hash_list.length; i++) {
+ var obj = _hash_list[i]
+ obj[params.children] = [];
- for (var j in _find_root) {
- _find_root[j]['_top'] = 'true';
- if (!_find_root[j][params.parent])
- _find_root[j]['_trueRoot'] = 'true';
- }
+ for (var j = 0; _hash_list && j < _hash_list.length; j++) {
+ var kid = _hash_list[j];
+ if (kid[params.parent] == obj[params.identifier]) {
+ obj[params.children].push( { _reference : kid[params.identifier] } );
+ kid._iskid = true;
+ if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]];
+ }
+ }
- data.items = item_data;
- }
+ item_data.push( obj );
+ }
- return data;
- }
+ for (var j in _find_root) {
+ _find_root[j]['_top'] = 'true';
+ if (!_find_root[j][params.parent])
+ _find_root[j]['_trueRoot'] = 'true';
+ }
- for (var i in fmclasses) {
- fieldmapper[i].prototype.fromStoreItem = _fromStoreItem;
- fieldmapper[i].prototype.fromStoreItem = _fromStoreItem;
- fieldmapper[i].toStoreData = _toStoreData;
- fieldmapper[i].toStoreItem = _toStoreItem;
- fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) };
- fieldmapper[i].initStoreData = _initStoreData;
- }
+ data.items = item_data;
+ }
- if (fieldmapper.aou) fieldmapper.aou.prototype._ignore_fields = ['children'];
- if (fieldmapper.aout) fieldmapper.aout.prototype._ignore_fields = ['children'];
- if (fieldmapper.pgt) fieldmapper.pgt.prototype._ignore_fields = ['children'];
+ return data;
+ }
- fieldmapper.aou.toStoreData = function (list, label) {
- if (!label) label = 'shortname';
- return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
- }
+ for (var i in fmclasses) {
+ fieldmapper[i].prototype.fromStoreItem = _fromStoreItem;
+ fieldmapper[i].toStoreData = _toStoreData;
+ fieldmapper[i].toStoreItem = _toStoreItem;
+ fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) };
+ fieldmapper[i].initStoreData = _initStoreData;
+ }
- fieldmapper.aout.toStoreData = function (list, label) {
- if (!label) label = 'name';
- return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
- }
+ if (fieldmapper.aou) fieldmapper.aou.prototype._ignore_fields = ['children'];
+ if (fieldmapper.aout) fieldmapper.aout.prototype._ignore_fields = ['children'];
+ if (fieldmapper.pgt) fieldmapper.pgt.prototype._ignore_fields = ['children'];
- fieldmapper.pgt.toStoreData = function (list, label) {
- if (!label) label = 'name';
- return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
- }
+ fieldmapper.aou.toStoreData = function (list, label) {
+ if (!label) label = 'shortname';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
+ }
- /*
- ppl.toStoreData = function (list, label) {
- if (!label) label = 'code';
- return _toStoreData(list, label, {});
- }
- */
+ fieldmapper.aout.toStoreData = function (list, label) {
+ if (!label) label = 'name';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+ }
+ fieldmapper.pgt.toStoreData = function (list, label) {
+ if (!label) label = 'name';
+ return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+ }
+
+ /*
+ ppl.toStoreData = function (list, label) {
+ if (!label) label = 'code';
+ return _toStoreData(list, label, {});
+ }
+ */
+
+ }
}
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/hash.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/hash.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/fieldmapper/hash.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -19,40 +19,44 @@
dojo._hasResource['fieldmapper.hash'] = true;
dojo.provide('fieldmapper.hash');
- dojo.require('fieldmapper.Fieldmapper');
- function _fromHash (_hash) {
- for ( var i=0; i < this._fields.length; i++) {
- if (_hash[this._fields[i]] != null)
- this[this._fields[i]]( _hash[this._fields[i]] );
- }
- return this;
- }
+ if(!dojo._hasResource["fieldmapper.Fieldmapper"]) {
- function _toHash (includeNulls, virtFields) {
- var _hash = {};
- for ( var i=0; i < this._fields.length; i++) {
- if (includeNulls || this[this._fields[i]]() != null) {
- if (this[this._fields[i]]() == null)
- _hash[this._fields[i]] = null;
- else
- _hash[this._fields[i]] = '' + this[this._fields[i]]();
+ /* XXX Content loaded in Fieldmapper */
+ /* XXX deprecate this file **/
+
+ function _fromHash (_hash) {
+ for ( var i=0; i < this._fields.length; i++) {
+ if (_hash[this._fields[i]] != null)
+ this[this._fields[i]]( _hash[this._fields[i]] );
}
- }
+ return this;
+ }
- if (virtFields && virtFields.length > 0) {
- for (var i = 0; i < virtFields.length; i++) {
- if (!_hash[virtFields[i]])
- _hash[virtFields[i]] = null;
- }
- }
+ function _toHash (includeNulls, virtFields) {
+ var _hash = {};
+ for ( var i=0; i < this._fields.length; i++) {
+ if (includeNulls || this[this._fields[i]]() != null) {
+ if (this[this._fields[i]]() == null)
+ _hash[this._fields[i]] = null;
+ else
+ _hash[this._fields[i]] = '' + this[this._fields[i]]();
+ }
+ }
- return _hash;
- }
+ if (virtFields && virtFields.length > 0) {
+ for (var i = 0; i < virtFields.length; i++) {
+ if (!_hash[virtFields[i]])
+ _hash[virtFields[i]] = null;
+ }
+ }
- for (var i in fmclasses) {
- window[i].prototype.fromHash = _fromHash;
- window[i].prototype.toHash = _toHash;
- }
+ return _hash;
+ }
+ for (var i in fmclasses) {
+ window[i].prototype.fromHash = _fromHash;
+ window[i].prototype.toHash = _toHash;
+ }
+ }
}
Modified: branches/rel_2_0/Open-ILS/web/js/ui/base.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/base.js 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/js/ui/base.js 2010-11-12 19:51:26 UTC (rev 18717)
@@ -1,7 +1,6 @@
dojo.require('dijit.Dialog');
dojo.require('dojo.cookie');
dojo.require('fieldmapper.AutoIDL'); // make conditional. TT variable sets JS var to enable/disable?
-dojo.require('fieldmapper.dojoData');
dojo.require('openils.User');
dojo.require('openils.CGI');
dojo.require('openils.Event');
Modified: branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2010-11-12 19:51:26 UTC (rev 18717)
@@ -1,3 +1,9 @@
+
+ <!-- Initial list of classes cover home, results, and advanced search. -->
+ <script language='javascript'
+ src='/IDL2js?mvr,bre,aou,aout,pgt,lasso,cmf,cmc,cmsa,cam,cifm,clfm,citm,cblvl'
+ type='text/javascript'></script>
+
<script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/utils.js' type='text/javascript'></script>
<script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/config.js' type='text/javascript'></script>
<script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/CGI.js' type='text/javascript'></script>
@@ -44,9 +50,8 @@
var djConfig = {
locale: locale.toLowerCase(),
- AutoIDL: ['aou','aout','pgt','lasso'],
parseOnLoad: true,
- isDebug: false
+ isDebug: false
}, lang, bidi;
</script>
Modified: branches/rel_2_0/Open-ILS/web/templates/base.tt2
===================================================================
--- branches/rel_2_0/Open-ILS/web/templates/base.tt2 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/web/templates/base.tt2 2010-11-12 19:51:26 UTC (rev 18717)
@@ -10,19 +10,8 @@
href='[% ctx.media_prefix %]/css/skin/[% ctx.skin %].css' />
<link rel='stylesheet' type='text/css'
href='[% ctx.media_prefix %]/css/theme/[% ctx.skin %].css' />
- <script type="text/javascript">
-var djConfig = {parseOnLoad:true,isDebug:false,AutoIDL:[
-'aou','aout','pgt','lasso','mvr','acp','circ','ccmcmt','asvq','asva','asv','acplo','acqf','acqdfe',
-'vmp','cbs','viiad','vqarad','vqbr','vqbrad','aoa','ac','aua','asvr','actscecm','acqim','acqct','acqexr',
-'acqpro','acqpron','acqipm','acqinv','acqie','acqii','acqpa','acqpc','acqpca','acqftr','acqfc','acqfy','acqfs',
-'acqfscred','acqofscred','acqfdeb','acqf','acqfat','acqfdt','acqfet','acqfst','acqfcb','acqafat','acqafet',
-'acqafst','acqafsb','acqafcb','acqfsrcct','acqfsrcat','acqfsrcb','acqfsb','acqfa','acqfap','acqpl','acqcr',
-'acqpo','acqpoh','acqpon','acqpoi','acqlih','acqliat','acqlin','acqlia','acqlid','acqliad','acqlimad','pgpt',
-'acqligad','acqliuad','acqlipad','acqphsm','acqlilad','acqedi','acqedim','acqdf','acqdfe','acqdfa','acqda','cnal',
-'acqclt','acqclet','acqcl','acqcle','acqscl','acqscle','acqclp','acqclpa','acqlisum','acqft','acqftm','actsce','actscecm',
-'jub','sdist','ssub','sstr','scap','bre','siss','act', 'acpl', 'ccm', 'aiit', 'atevdef', 'ath', 'atreact','atclean','atenv','atevparam','atcol','actsc','cit',
-'atval','crahp','crmf','crrf','crcd','cust','coust','cgf','czs','cbt','csp','brt','brsrc','bra','bram','brav','vaq','vbq','vqar','ccmm','ccmcmtm','citm','cifm','cvrfm','chmm','chdd','chddv']};
- </script>
+ <script language='javascript' src='/IDL2js' type='text/javascript'></script>
+ <script type="text/javascript">var djConfig = {parseOnLoad:true,isDebug:false};</script>
<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/dojo.js"></script>
<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/openils_dojo.js"></script>
<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/md5.js"></script>
Added: branches/rel_2_0/Open-ILS/xsl/fm_IDL2js.xsl
===================================================================
--- branches/rel_2_0/Open-ILS/xsl/fm_IDL2js.xsl (rev 0)
+++ branches/rel_2_0/Open-ILS/xsl/fm_IDL2js.xsl 2010-11-12 19:51:26 UTC (rev 18717)
@@ -0,0 +1,79 @@
+<xsl:stylesheet
+ version='1.0'
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ xmlns:idl="http://opensrf.org/spec/IDL/base/v1"
+ xmlns:oils_persist="http://open-ils.org/spec/opensrf/IDL/persistence/v1"
+ xmlns:oils_obj="http://open-ils.org/spec/opensrf/IDL/objects/v1"
+ xmlns:reporter="http://open-ils.org/spec/opensrf/IDL/reporter/v1"
+ xmlns:permacrud="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+>
+ <xsl:output method="text" />
+ <xsl:strip-space elements="xsl:*"/>
+ <xsl:param name="class_list"/>
+
+
+ <xsl:template match="/">
+var _preload_fieldmapper_IDL = {<xsl:apply-templates select="idl:IDL"/>};
+for (var c in _preload_fieldmapper_IDL) {
+ var x = _preload_fieldmapper_IDL[c]; x.field_map = {};
+ var p = x.fields.length;
+ for (var n in {isnew:1,ischanged:1,isdeleted:1}) x.fields[p] = {name:n,type:'field',virtual:true,array_position:p++};
+ for (var f in x.fields) x.field_map[x.fields[f].name] = x.fields[f];
+}
+ </xsl:template>
+
+ <xsl:template match="idl:IDL">
+ <xsl:choose>
+ <xsl:when test="$class_list = ''">
+ <xsl:for-each select="idl:class"><xsl:sort select="@id"/><xsl:apply-templates select="."/><xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="doc" select="."/>
+ <xsl:for-each select="str:split($class_list,',')"><xsl:sort select="./text()"/><xsl:variable name="current_class" select="./text()"/><xsl:apply-templates select="$doc/idl:class[@id=$current_class]"/><xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="idl:class"><xsl:value-of select="@id"/>:{name:"<xsl:value-of select="@id"/>",label:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:label"/><xsl:with-param name='d' select="@id"/></xsl:call-template>",restrict_primary:"<xsl:value-of select="@oils_persist:restrict_primary"/>",virtual:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_persist:virtual"/></xsl:call-template>,pkey:"<xsl:value-of select="idl:fields/@oils_persist:primary"/>",pkey_sequence:"<xsl:value-of select="idl:fields/@oils_persist:sequence"/>",<xsl:apply-templates select="idl:fields"/><xsl:apply-templates select="permacrud:permacrud"/>}</xsl:template>
+
+ <xsl:template match="idl:fields">fields:[<xsl:for-each select="idl:field"><xsl:call-template name="printField"><xsl:with-param name='pos' select="position()"/></xsl:call-template><xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>]</xsl:template>
+
+ <xsl:template match="permacrud:permacrud">,permacrud:{<xsl:for-each select="permacrud:actions/*"><xsl:if test="name() = 'delete'">"</xsl:if><xsl:value-of select="name()"/><xsl:if test="name() = 'delete'">"</xsl:if>:{<xsl:call-template name='pcrudPerms'/>}<xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>}</xsl:template>
+
+<xsl:template name='printField'><xsl:param name="pos"/>{name:"<xsl:value-of select="@name"/>",label:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:label"/><xsl:with-param name='d' select="@name"/></xsl:call-template>",datatype:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:datatype"/><xsl:with-param name='d' select="string('text')"/></xsl:call-template>",primitive:"<xsl:value-of select="@oils_persist:primitive"/>",selector:"<xsl:value-of select="@reporter:selector"/>",array_position:"<xsl:value-of select="$pos - 1"/>",<xsl:call-template name='fieldOrLink'><xsl:with-param name='f' select="."/></xsl:call-template>,virtual:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_persist:virtual"/></xsl:call-template>,required:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_obj:required"/></xsl:call-template>,i18n:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_persist:i18n"/></xsl:call-template>}</xsl:template>
+
+<xsl:template name="pcrudPerms">
+ <xsl:if test="@permission">perms:[<xsl:for-each select="str:split(@permission,' ')">'<xsl:value-of select="./text()"/>'<xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>]</xsl:if>
+</xsl:template>
+
+<xsl:template name="fieldOrLink">
+ <xsl:param name="f"/>
+ <xsl:choose>
+ <xsl:when test="$f/../../idl:links/idl:link[@field=$f/@name]">type:"link",<xsl:apply-templates select="$f/../../idl:links/idl:link[@field=$f/@name]"></xsl:apply-templates></xsl:when>
+ <xsl:otherwise>type:"field"</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="idl:link">key:"<xsl:value-of select="@key"/>","class":"<xsl:value-of select="@class"/>",reltype:"<xsl:value-of select="@reltype"/>"</xsl:template>
+
+<xsl:template name="trueFalse">
+ <xsl:param name="tf"/>
+ <xsl:choose>
+ <xsl:when test="$tf='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="defaultValue">
+ <xsl:param name="v"/>
+ <xsl:param name="d"/>
+ <xsl:choose>
+ <xsl:when test="string-length($v)=0"><xsl:value-of select="$d"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$v"/></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul 2010-11-12 19:51:26 UTC (rev 18717)
@@ -9,6 +9,7 @@
<script>dump('starting openils_util_overlay in ' + location.href + '\n');</script>
<script>var djConfig = { 'baseUrl' : '/js/dojo/dojo/',parseOnLoad: true,isDebug:false };</script>
<script type="text/javascript" src="/js/dojo/dojo/dojo.js" />
+ <script type="text/javascript" src="/IDL2js" />
<script>try { dojo.require('fieldmapper.AutoIDL'); } catch(E) { alert(E); }</script>
<script>try { dojo.require('dojo.date.locale'); } catch(E) { alert(E); }</script>
<script>try { dojo.require('dojo.date.stamp'); } catch(E) { alert(E); }</script>
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml 2010-11-12 19:51:26 UTC (rev 18717)
@@ -10,6 +10,7 @@
<head>
<title>&staff.server.admin.copy_locations.title;</title>
+ <script type="text/javascript" src='/IDL2js?aou,aout,pgt,au,acpl'></script>
<script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
<script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/openils_dojo.js"></script>
<script type="text/javascript">
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml 2010-11-12 19:49:34 UTC (rev 18716)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml 2010-11-12 19:51:26 UTC (rev 18717)
@@ -23,8 +23,9 @@
<head>
<title>&staff.server.admin.org_unit_settings.title;</title>
<link type='text/css' rel='stylesheet' href='admin.css'/>
+ <script type="text/javascript" src='/IDL2js?aou,aout,pgt,au,coust,aous'></script>
<script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
- <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/openils_dojo.js"></script>
+ <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/openils_dojo.js"></script>
<script type="text/javascript" src='org_unit_settings.js'></script>
</head>
<body class="tundra tall">
More information about the open-ils-commits
mailing list