-function setFocus(){if(!$F("imapuser")){$("imapuser").focus()}else{$("pass").focus()}}function imp_reload(){window.top.document.location=autologin_url+$F("server_key")}function submit_login(){if(show_list&&$F("server_key").startsWith("_")){return false}if(!$F("imapuser")){alert(IMP.text.login_username);$("imapuser").focus();return false}else{if(!$F("pass")){alert(IMP.text.login_password);$("pass").focus();return false}else{$("loginButton").disable();if(ie_clientcaps){try{$("ie_version").setValue(objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid"))}catch(a){}}$("imp_login").submit();return true}}}function selectLang(){if(!$F("imapuser")&&!$F("pass")){var a={new_lang:$F("new_lang")};if(lang_url!==null){a.url=lang_url}self.location="login.php?"+Object.toQueryString(a)}}function removeHash(a){return(Object.isString(a)&&a.startsWith("#"))?a.substring(1):a}document.observe("dom:loaded",function(){if(imp_auth){if(parent.frames.horde_main){if(nomenu){parent.location=self.location}else{document.imp_login.target="_parent"}}}if(location.hash){$("anchor_string").setValue(removeHash(location.hash))}});
\ No newline at end of file
+var ImpLogin={_reload:function(){window.top.document.location=this.autologin_url+$F("server_key")},submit:function(){if(this.show_list&&$F("server_key").startsWith("_")){return}if(!$F("imapuser")){alert(IMP.text.login_username);$("imapuser").focus()}else{if(!$F("pass")){alert(IMP.text.login_password);$("pass").focus()}else{$("loginButton").disable();if(this.ie_clientcaps){try{$("ie_version").setValue(objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid"))}catch(a){}}$("imp_login").submit()}}},_selectLang:function(){if(!$F("imapuser")&&!$F("pass")){var a={new_lang:$F("new_lang")};if(this.lang_url){a.url=this.lang_url}self.location="login.php?"+Object.toQueryString(a)}},_removeHash:function(a){return(Object.isString(a)&&a.startsWith("#"))?a.substring(1):a},onDomLoad:function(){if(this.imp_auth){if(parent.frames.horde_main){if(this.nomenu){parent.location=self.location}else{document.imp_login.target="_parent"}}}document.observe("change",this._changeHandler.bindAsEventListner(this));document.observe("click",this._clickHandler.bindAsEventListner(this));if(location.hash){$("anchor_string").setValue(this._removeHash(location.hash))}if(!$F("imapuser")){$("imapuser").focus()}else{$("pass").focus()}if(this.reloadmenu&&window.parent.frames.horde_menu){window.parent.frames.horde_menu.location.reload()}},_changeHandler:function(a){switch(a.element().readAttribute("id")){case"new_lang":this._selectLang();break;case"server_key":this._reload();break}},_clickHandler:function(a){switch(a.element().readAttribute("id")){case"btn_login":this._reload();break;case"loginButton":this._submit();break}}};document.observe("dom:loaded",ImpLogin.onDomLoad.bin(ImpLogin));
\ No newline at end of file
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-function setFocus()
-{
- if (!$F('imapuser')) {
- $('imapuser').focus();
- } else {
- $('pass').focus();
- }
-}
+var ImpLogin = {
+ // The following variables are defined in login.php:
+ // autologin_url, imp_auth, lang_url, show_list
-function imp_reload()
-{
- window.top.document.location = autologin_url + $F('server_key');
-}
+ _reload: function()
+ {
+ window.top.document.location = this.autologin_url + $F('server_key');
+ },
-function submit_login()
-{
- if (show_list && $F('server_key').startsWith('_')) {
- return false;
- }
- if (!$F('imapuser')) {
- alert(IMP.text.login_username);
- $('imapuser').focus();
- return false;
- } else if (!$F('pass')) {
- alert(IMP.text.login_password);
- $('pass').focus();
- return false;
- } else {
- $('loginButton').disable();
- if (ie_clientcaps) {
- try {
- $('ie_version').setValue(objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid"));
- } catch (e) { }
+ submit: function()
+ {
+ if (this.show_list && $F('server_key').startsWith('_')) {
+ return;
}
- $('imp_login').submit();
- return true;
- }
-}
-
-function selectLang()
-{
- // We need to reload the login page here, but only if the user hasn't
- // already entered a username and password.
- if (!$F('imapuser') && !$F('pass')) {
- var params = { new_lang: $F('new_lang') };
- if (lang_url !== null) {
- params.url = lang_url;
+
+ if (!$F('imapuser')) {
+ alert(IMP.text.login_username);
+ $('imapuser').focus();
+ } else if (!$F('pass')) {
+ alert(IMP.text.login_password);
+ $('pass').focus();
+ } else {
+ $('loginButton').disable();
+ if (this.ie_clientcaps) {
+ try {
+ $('ie_version').setValue(objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid"));
+ } catch (e) { }
+ }
+ $('imp_login').submit();
}
- self.location = 'login.php?' + Object.toQueryString(params);
- }
-}
-
-/* Removes any leading hash that might be on a location string. */
-function removeHash(h)
-{
- return (Object.isString(h) && h.startsWith("#")) ? h.substring(1) : h;
-}
-
-document.observe('dom:loaded', function() {
- if (imp_auth) {
- if (parent.frames.horde_main) {
- if (nomenu) {
- parent.location = self.location;
- } else {
- document.imp_login.target = '_parent';
+ },
+
+ _selectLang: function()
+ {
+ // We need to reload the login page here, but only if the user hasn't
+ // already entered a username and password.
+ if (!$F('imapuser') && !$F('pass')) {
+ var params = { new_lang: $F('new_lang') };
+ if (this.lang_url) {
+ params.url = this.lang_url;
}
+ self.location = 'login.php?' + Object.toQueryString(params);
}
- }
+ },
+
+ /* Removes any leading hash that might be on a location string. */
+ _removeHash: function(h)
+ {
+ return (Object.isString(h) && h.startsWith("#")) ? h.substring(1) : h;
+ },
+
+ onDomLoad: function()
+ {
+ if (this.imp_auth) {
+ if (parent.frames.horde_main) {
+ if (this.nomenu) {
+ parent.location = self.location;
+ } else {
+ document.imp_login.target = '_parent';
+ }
+ }
+ }
+
+ document.observe('change', this._changeHandler.bindAsEventListner(this));
+ document.observe('click', this._clickHandler.bindAsEventListner(this));
- // Need to capture hash information if it exists in URL
- if (location.hash) {
- $('anchor_string').setValue(removeHash(location.hash));
+ // Need to capture hash information if it exists in URL
+ if (location.hash) {
+ $('anchor_string').setValue(this._removeHash(location.hash));
+ }
+
+ if (!$F('imapuser')) {
+ $('imapuser').focus();
+ } else {
+ $('pass').focus();
+ }
+
+ if (this.reloadmenu && window.parent.frames.horde_menu) {
+ window.parent.frames.horde_menu.location.reload();
+ }
+ },
+
+ _changeHandler: function(e)
+ {
+ switch (e.element().readAttribute('id')) {
+ case 'new_lang':
+ this._selectLang();
+ break;
+
+ case 'server_key':
+ this._reload();
+ break;
+ }
+ },
+
+ _clickHandler: function(e)
+ {
+ switch (e.element().readAttribute('id')) {
+ case 'btn_login':
+ this._reload();
+ break;
+
+ case 'loginButton':
+ this._submit();
+ break;
+ }
}
-});
+
+};
+
+document.observe('dom:loaded', ImpLogin.onDomLoad.bin(ImpLogin));
exit;
}
-if ($logout_reason && $imp_auth && $conf['menu']['always']) {
- $notification->push('setFocus();if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();', 'javascript');
-} else {
- $notification->push('setFocus()', 'javascript');
-}
-
$reason = $auth->getLogoutReasonString();
$title = sprintf(_("Welcome to %s"), $registry->get('name', ($imp_auth) ? 'horde' : null));
Horde::addScriptFile('prototype.js', 'horde', true);
Horde::addScriptFile('login.js', 'imp', true);
require IMP_TEMPLATES . '/common-header.inc';
+
+$charset = NLS::getCharset();
IMP::addInlineScript(array(
- 'var autologin_url = \'' . Util::addParameter(Horde::selfUrl(), array('autologin' => $autologin, 'server_key' => '')) . '\'',
- 'var show_list = ' . intval($show_list),
- 'var ie_clientcaps = ' . intval($t->get('ie_clientcaps')),
- 'var lang_url = ' . ((is_null($lang_url)) ? 'null' : '\'' . $lang_url . '\''),
- 'var imp_auth = ' . intval($imp_auth),
- 'var nomenu = ' . intval(empty($conf['menu']['always'])),
+ 'ImpLogin.autologin_url = ' . Horde_Serialize::serialize(Util::addParameter(Horde::selfUrl(), array('autologin' => $autologin, 'server_key' => '')), SERIALIZE_JSON, $charset),
+ 'ImpLogin.ie_clientcaps = ' . intval($t->get('ie_clientcaps')),
+ 'ImpLogin.imp_auth = ' . intval($imp_auth),
+ 'ImpLogin.lang_url = ' . Horde_Serialize::serialize($lang_url, SERIALIZE_JSON, $charset),
+ 'ImpLogin.nomenu = ' . intval(empty($conf['menu']['always'])),
+ 'ImpLogin.reloadmenu = ' . (boolean) ($logout_reason && $imp_auth && $conf['menu']['always']),
+ 'ImpLogin.show_list = ' . intval($show_list),
));
+
echo $t->fetch(IMP_TEMPLATES . '/login/login.html');
Horde::loadConfiguration('motd.php', null, null, true);
<tr>
<td class="light rightAlign"><label for="server_key"><strong><gettext>Server</gettext></strong></label></td>
<td class="light leftAlign">
- <select tabindex="<tag:hsl_skey_tabindex />" id="server_key" name="server_key" onchange="imp_reload();">
+ <select tabindex="<tag:hsl_skey_tabindex />" id="server_key" name="server_key">
<loop:hsl>
<option value="<tag:hsl.val />"<if:hsl.sel> selected="selected"</if:hsl.sel>><tag:hsl.name /></option>
</loop:hsl>
</select>
- <input tabindex="<tag:hsl_tabindex />" type="button" class="button" onclick="imp_reload();" value="<tag:login />" />
+ <input id="btn_login" tabindex="<tag:hsl_tabindex />" type="button" class="button" value="<tag:login />" />
</td>
</tr>
</if:display_list>
<tr>
<td class="light rightAlign"><label for="new_lang"><strong><gettext>Language</gettext></strong></label></td>
<td class="light leftAlign">
- <select tabindex="<tag:langs_tabindex />" id="new_lang" name="new_lang" onchange="selectLang()">
+ <select tabindex="<tag:langs_tabindex />" id="new_lang" name="new_lang">
<loop:langs>
<option value="<tag:langs.val />" <if:langs.sel>selected="selected"</if:langs.sel>><tag:langs.name /></option>
</loop:langs>
<tr>
<td> </td>
<td class="light leftAlign">
- <input type="submit" class="button" name="loginButton" id="loginButton" tabindex="<tag:login_tabindex />" value="<tag:login />" onclick="return submit_login();" />
+ <input type="submit" class="button" name="loginButton" id="loginButton" tabindex="<tag:login_tabindex />" value="<tag:login />" />
</td>
</tr>