[open-ils-commits] r8172 - in branches/rel_1_2/Open-ILS/web/opac:
common/js locale/en-US skin/default/js
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Dec 8 15:27:33 EST 2007
Author: erickson
Date: 2007-12-08 15:07:28 -0500 (Sat, 08 Dec 2007)
New Revision: 8172
Modified:
branches/rel_1_2/Open-ILS/web/opac/common/js/config.js
branches/rel_1_2/Open-ILS/web/opac/common/js/opac_utils.js
branches/rel_1_2/Open-ILS/web/opac/common/js/org_utils.js
branches/rel_1_2/Open-ILS/web/opac/locale/en-US/opac.dtd
branches/rel_1_2/Open-ILS/web/opac/skin/default/js/myopac.js
Log:
implemented org setting for barcode regex to assist the opac in determing if a user is logging in with their username or barcode
Modified: branches/rel_1_2/Open-ILS/web/opac/common/js/config.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/opac/common/js/config.js 2007-12-08 00:46:21 UTC (rev 8171)
+++ branches/rel_1_2/Open-ILS/web/opac/common/js/config.js 2007-12-08 20:07:28 UTC (rev 8172)
@@ -351,6 +351,7 @@
var FETCH_USER_NOTES = 'open-ils.actor:open-ils.actor.note.retrieve.all';
var FETCH_ORG_BY_SHORTNAME = 'open-ils.actor:open-ils.actor.org_unit.retrieve_by_shorname';
var FETCH_BIB_ID_BY_BARCODE = 'open-ils.search:open-ils.search.bib_id.by_barcode';
+var FETCH_ORG_SETTING = 'open-ils.actor:open-ils.actor.ou_setting.ancestor_default';
/* ---------------------------------------------------------------------------- */
Modified: branches/rel_1_2/Open-ILS/web/opac/common/js/opac_utils.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/opac/common/js/opac_utils.js 2007-12-08 00:46:21 UTC (rev 8171)
+++ branches/rel_1_2/Open-ILS/web/opac/common/js/opac_utils.js 2007-12-08 20:07:28 UTC (rev 8172)
@@ -648,7 +648,10 @@
org : getOrigLocation()
};
- if( uname.match(REGEX_BARCODE) ) args.barcode = uname; /* make this better */
+ r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex');
+ if(r) REGEX_BARCODE = new RegExp(r);
+
+ if( uname.match(REGEX_BARCODE) ) args.barcode = uname;
else args.username = uname;
var auth_request = new Request( LOGIN_COMPLETE, args );
Modified: branches/rel_1_2/Open-ILS/web/opac/common/js/org_utils.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/opac/common/js/org_utils.js 2007-12-08 00:46:21 UTC (rev 8171)
+++ branches/rel_1_2/Open-ILS/web/opac/common/js/org_utils.js 2007-12-08 20:07:28 UTC (rev 8172)
@@ -2,6 +2,13 @@
/* org tree utilities */
/* ------------------------------------------------------------------------------------------------------ */
+function fetchOrgSettingDefault(orgId, name) {
+ var req = new Request(FETCH_ORG_SETTING, orgId, name);
+ req.send(true);
+ var res = req.result();
+ return res.value;
+}
+
/* takes an org unit or id and return the numeric depth */
function findOrgDepth(org_id_or_node) {
var org = findOrgUnit(org_id_or_node);
Modified: branches/rel_1_2/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- branches/rel_1_2/Open-ILS/web/opac/locale/en-US/opac.dtd 2007-12-08 00:46:21 UTC (rev 8171)
+++ branches/rel_1_2/Open-ILS/web/opac/locale/en-US/opac.dtd 2007-12-08 20:07:28 UTC (rev 8172)
@@ -284,7 +284,7 @@
<!ENTITY myopac.summary.username.dup "The requested username is not available. Please choose a different username.">
<!ENTITY myopac.summary.username.success "Username successfully updated">
<!ENTITY myopac.summary.username.failure "Username update failed">
-<!ENTITY myopac.summary.username.invalid "Username cannot contain spaces">
+<!ENTITY myopac.summary.username.invalid "Username cannot contain spaces or have the same format as a barcode">
<!ENTITY myopac.summary.email.error "Please enter a valid email address">
<!ENTITY myopac.summary.email.success "Email address successfully updated">
<!ENTITY myopac.summary.email.failed "Email address update failed">
Modified: branches/rel_1_2/Open-ILS/web/opac/skin/default/js/myopac.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/opac/skin/default/js/myopac.js 2007-12-08 00:46:21 UTC (rev 8171)
+++ branches/rel_1_2/Open-ILS/web/opac/skin/default/js/myopac.js 2007-12-08 20:07:28 UTC (rev 8172)
@@ -847,6 +847,15 @@
return;
}
+ r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex');
+ if(r) REGEX_BARCODE = new RegExp(r);
+
+ if(username.match(REGEX_BARCODE)) {
+ alert($('myopac_invalid_username').innerHTML);
+ return;
+ }
+
+
/* first see if the requested username is taken */
var req = new Request(CHECK_USERNAME, G.user.session, username);
req.send(true);
More information about the open-ils-commits
mailing list