LWWidget.Login = LWWidget.Page.inherits({ constructor: function () { this.base(); this.addEvent('Login'); this.error = ""; }, draw: function () { var cc = '"return Base.Comp.get(' + this._cid + ').login()"', st = ' style="color:white;font-size:13px;background-color:#3f7fff;width:100%" ', st2 = ' style="color:white;font-size:13px;background-color:#3f7fff" ', str = '
' + '' + '' + '' + '' + '' + '' + '
' + '
' + '
' + '
 
 
 
'; this.writeContents(str); this.fillForm(); }, fillForm: function () { var l = LWWidget.main.getPreference('lwLogin'), p = LWWidget.main.getPreference('lwPassword'), r = LWWidget.main.getPreference('lwRemAuth'); if (!document.getElementById('lname')) { return; } document.getElementById('lname').value = l; document.getElementById('lpass').value = p; document.getElementById('lrem').checked = (r == '1'); document.getElementById("lerror").innerHTML = (this.error == "") ? ' ' : this.error; }, setError: function (error) { this.error = error; var e = document.getElementById("lerror"); if (e) { e.innerHTML = (error == "") ? ' ' : error; } }, login: function () { if (!document.getElementById('lname')) { return false; } var l = document.getElementById('lname').value, p = document.getElementById('lpass').value, r = document.getElementById('lrem').checked ? '1' : '0'; if (l == '') { this.setError("Please type in your username"); } else if (p == '') { this.setError("Please type in your password"); } else { // Save the login as a preference and store the rest until we're sure LWWidget.main.setPreference('lwLogin', l); LWWidget.main.setPreference('lwRemAuth', r); LWWidget.main.password = p; this.onLogin(); } return false; } });