<tr fmclass='au' fmfield='other_phone'/>
<tr fmclass='au' fmfield='home_ou' required='required'/>
<tr fmclass='au' fmfield='profile' required='required'/>
- <tr fmclass='au' fmfield='expire_date' required='required'/>
+ <tr fmclass='au' fmfield='expire_date' required='required'>
+ <td/><td/><td/>
+ <td>
+ <button dojoType='dijit.form.Button' jsId='setExpireDate' scrollOnFocus='false'></button>
+ </td>
+ </tr>
<tr fmclass='au' fmfield='net_access_level' required='required'/>
<tr fmclass='au' fmfield='active'/>
<tr fmclass='au' fmfield='barred'/>
allCards.attr("label", localeStrings.SEE_ALL);
dojo.byId('uedit-dupe-username-warning').innerHTML = localeStrings.DUPE_USERNAME;
generatePassword.attr("label", localeStrings.RESET_PASSWORD);
+ setExpireDate.attr("label", localeStrings.UPDATE_EXPIRE_DATE);
dojo.byId('verifyPassword').innerHTML = localeStrings.VERIFY_PASSWORD;
dojo.byId('parentGuardian').innerHTML = localeStrings.PARENT_OR_GUARDIAN;
dojo.byId('userSettings').innerHTML = localeStrings.USER_SETTINGS;
dojo.connect(generatePassword, 'onClick', generatePasswordHandler);
+ dojo.connect(setExpireDate, 'onClick', setExpireDateHandler);
+
if(!patron.isnew() && !checkGrpAppPerm(patron.profile()) && patron.id() != openils.User.user.id()) {
// we are not allowed to edit this user, so disable the save option
saveButton.attr('disabled', true);
}
/**
+ * Set Expire Date field based on today and current profile group
+ */
+function setExpireDateHandler() {
+ var profileWidget, expireWidget;
+ profileWidget = findWidget('au', 'profile');
+ expireWidget = findWidget('au', 'expire_date');
+
+ // This technique is borrowed with slight modifications
+ // from the profile widget onChange handler
+ function found(items) {
+ if (items.length == 0) return;
+ var item = items[0];
+ var interval = profileWidget.widget.store.getValue(item, 'perm_interval');
+ expireWidget.widget.attr('value', dojo.date.add(new Date(),
+ 'second', openils.Util.intervalToSeconds(interval)));
+ }
+
+ profileWidget.widget.store.fetch({onComplete:found, query:{id:profileWidget.widget.attr('value')}});
+
+}
+
+/**
* Loads a staged user and turns them into something the editor can understand
*/
function uEditLoadStageUser(stageUname) {