1 LoginPage.prototype = new Page();
2 LoginPage.prototype.constructor = LoginPage;
3 LoginPage.baseClass = Page.constructor;
5 // ---------------------------------------------------------------------------------
7 // ---------------------------------------------------------------------------------
9 var globalLoginPage = null;
11 function LoginPage() {
13 if(globalLoginPage != null) {
14 globalLoginPage.init();
15 return globalLoginPage;
18 this.searchBarForm = new SearchBarFormChunk();
19 this.searchBar = new SearchBarChunk();
21 globalLoginPage = this;
24 LoginPage.prototype.init = function() {
25 this.searchBar.reset();
26 this.login_button = getById("login_button");
28 this.login_button.onclick = loginShuffle;
30 this.username = getById("login_username");
31 this.password = getById("login_password");
32 this.result_field = getById("login_result_text");
34 this.session = UserSession.instance();
40 LoginPage.prototype.draw = function() {
41 try {this.username.focus();} catch(E) {}
46 this.username.onkeyup = "window.event.cancelBubble = true";
48 this.password.onkeyup =
50 getAppWindow().event.cancelBubble = true;
51 loginOnEnter; return true;
55 this.username.onkeyup = function(){};
56 this.password.onkeyup = loginOnEnter;
59 this.login_success_msg = null;
60 this.login_failure_msg = null;
64 function loginShuffle() {
65 var obj = globalLoginPage;
66 var ses = UserSession.instance();
67 if( ses.login( obj.username.value, obj.password.value )) {
68 /* now grab the org_unit associated with this user */
70 url_redirect( [ "target", "my_opac" ] ); /* redirect to the my opac page */
72 obj.result_field.innerHTML = obj.login_success_msg;
73 obj.searchBar.reset();
76 obj.result_field.innerHTML = obj.login_failure_msg;
80 function loginOnEnter(evt) {
81 var code = grabCharCode(evt);
82 if(code==13||code==3) { loginShuffle(); }