[open-ils-commits] r12214 - trunk/Open-ILS/web/js/ui/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 17 23:49:23 EST 2009
Author: erickson
Date: 2009-02-17 23:49:20 -0500 (Tue, 17 Feb 2009)
New Revision: 12214
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
Log:
added onchange to set expire date based on profile group selected
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-02-18 04:48:34 UTC (rev 12213)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-02-18 04:49:20 UTC (rev 12214)
@@ -8,6 +8,7 @@
dojo.require('openils.widget.AutoFieldWidget');
dojo.require('dijit.form.CheckBox');
dojo.require('dijit.form.Button');
+dojo.require('dojo.date');
var pcrud;
var fmClasses = ['au', 'ac', 'aua', 'actsc', 'asv', 'asvq', 'asva'];
@@ -179,9 +180,36 @@
widget._fmfield = fmfield;
widget._addr = args.addr;
widgetPile.push(widget);
+ attachEvents(fmcls, fmfield, widget);
return widget;
}
+function attachEvents(fmcls, fmfield, widget) {
+ if(fmcls == 'au') {
+ switch(fmfield) {
+
+ case 'profile': // when the profile changes, update the expire date
+ dojo.connect(widget.widget, 'onChange',
+ function() {
+
+ var expireWidget = widgetPile.filter(
+ function(i){return (i._fmfield == 'expire_date')})[0];
+ var self = this;
+
+ function found(items) {
+ if(items.length == 0) return;
+ var item = items[0];
+ var interval = self.store.getValue(item, 'perm_interval');
+ expireWidget.widget.attr('value',
+ dojo.date.add(new Date(), 'second', openils.Util.intervalToSeconds(interval)));
+ }
+ this.store.fetch({onComplete:found, query:{id:this.attr('value')}});
+ }
+ );
+ }
+ }
+}
+
function getByName(node, name) {
return dojo.query('[name='+name+']', node)[0];
}
More information about the open-ils-commits
mailing list