generic way for initial focus
This commit is contained in:
parent
985acfb5f2
commit
a1bee10fd1
|
@ -80,19 +80,7 @@ $tabindex = 1;
|
|||
<body class="admin">
|
||||
<?php
|
||||
printJsIncludes('../..');
|
||||
// set focus on password field
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
window.onload = function() {
|
||||
loginField = document.getElementsByName('passwd')[0];
|
||||
loginField.focus();
|
||||
}
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#submitButton').button();
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
<table border=0 width="100%" class="lamHeader ui-corner-all">
|
||||
<tr>
|
||||
<td align="left" height="30">
|
||||
|
@ -131,6 +119,7 @@ $tabindex = 1;
|
|||
$box->add(new htmlResponsiveSelect('filename', $profiles, $selectedProfile, _('Profile name')), 12);
|
||||
$passwordInput = new htmlResponsiveInputField(_('Password'), 'passwd', '', '200');
|
||||
$passwordInput->setIsPassword(true);
|
||||
$passwordInput->setCSSClasses(array('lam-initial-focus'));
|
||||
$box->add($passwordInput, 12);
|
||||
$box->addVerticalSpacer('1rem');
|
||||
$button = new htmlButton('submit', _("Ok"));
|
||||
|
|
|
@ -9,7 +9,6 @@ use \htmlButton;
|
|||
use \htmlGroup;
|
||||
use \htmlResponsiveInputCheckbox;
|
||||
use \LAMConfig;
|
||||
use \htmlTableExtendedInputCheckbox;
|
||||
use \htmlResponsiveRow;
|
||||
use \htmlResponsiveInputField;
|
||||
/*
|
||||
|
|
|
@ -72,15 +72,6 @@ printHeaderContents(_("Login"), '../..');
|
|||
</head>
|
||||
<body class="admin">
|
||||
<?php
|
||||
// set focus on password field
|
||||
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
|
||||
echo "<!--\n";
|
||||
echo "window.onload = function() {\n";
|
||||
echo "loginField = document.getElementsByName('passwd')[0];\n";
|
||||
echo "loginField.focus();\n";
|
||||
echo "}\n";
|
||||
echo "//-->\n";
|
||||
echo "</script>\n";
|
||||
// include all JavaScript files
|
||||
$jsDirName = dirname(__FILE__) . '/../lib';
|
||||
$jsDir = dir($jsDirName);
|
||||
|
@ -142,6 +133,7 @@ printHeaderContents(_("Login"), '../..');
|
|||
$passwordField = new htmlInputField('passwd');
|
||||
$passwordField->setFieldSize(15);
|
||||
$passwordField->setIsPassword(true);
|
||||
$passwordField->setCSSClasses(array('lam-initial-focus'));
|
||||
$passwordGroup->addElement($passwordField);
|
||||
$passwordGroup->addElement(new htmlHelpLink('236'));
|
||||
$passwordDiv = new htmlDiv(null, $passwordGroup);
|
||||
|
|
|
@ -866,10 +866,18 @@ window.lam.tools.activateTab = function() {
|
|||
jQuery('.lam-active-tab').addClass('ui-tabs-active ui-state-active user-bright');
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the focus on the initial field.
|
||||
*/
|
||||
window.lam.tools.setInitialFocus = function() {
|
||||
jQuery('.lam-initial-focus').focus();
|
||||
};
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
window.lam.gui.equalHeight();
|
||||
window.lam.form.autoTrim();
|
||||
window.lam.account.addDefaultProfileListener();
|
||||
window.lam.tools.addSavedSelectListener();
|
||||
window.lam.tools.activateTab();
|
||||
window.lam.tools.setInitialFocus();
|
||||
});
|
||||
|
|
|
@ -194,7 +194,7 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
|
|||
printHeaderContents('LDAP Account Manager', '..');
|
||||
?>
|
||||
</head>
|
||||
<body class="admin" onload="focusLogin()">
|
||||
<body class="admin">
|
||||
<?php
|
||||
// include all JavaScript files
|
||||
printJsIncludes('..');
|
||||
|
@ -214,24 +214,6 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
|
|||
if (isLAMProVersion() && $licenseValidator->isEvaluationLicense()) {
|
||||
StatusMessage('INFO', _('Evaluation Licence'));
|
||||
}
|
||||
|
||||
// set focus on password field
|
||||
if (!empty($config_object)) {
|
||||
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
|
||||
echo "<!--\n";
|
||||
echo "function focusLogin() {\n";
|
||||
if (($config_object->getLoginMethod() == LAMConfig::LOGIN_LIST) || isset($_COOKIE['lam_login_name'])) {
|
||||
echo "myElement = document.getElementsByName('passwd')[0];\n";
|
||||
echo "myElement.focus();\n";
|
||||
}
|
||||
else {
|
||||
echo "myElement = document.getElementsByName('username')[0];\n";
|
||||
echo "myElement.focus();\n";
|
||||
}
|
||||
echo "}\n";
|
||||
echo "//-->\n";
|
||||
echo "</script>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
<table border=0 width="100%" class="lamHeader ui-corner-all">
|
||||
|
@ -351,6 +333,9 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
|
|||
$userSelect = new htmlSelect('username', $adminList, $selectedAdmin);
|
||||
$userSelect->setHasDescriptiveElements(true);
|
||||
$userSelect->setTransformSingleSelect(false);
|
||||
if (empty($_COOKIE['lam_login_name'])) {
|
||||
$userSelect->setCSSClasses(array('lam-initial-focus'));
|
||||
}
|
||||
$row->addField(new htmlDiv(null, $userSelect));
|
||||
}
|
||||
else {
|
||||
|
@ -364,7 +349,11 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
|
|||
if (isset($_COOKIE["lam_login_name"])) {
|
||||
$user = $_COOKIE["lam_login_name"];
|
||||
}
|
||||
$userInput = new htmlDiv(null, new htmlInputField('username', $user));
|
||||
$userNameInput = new htmlInputField('username', $user);
|
||||
if (empty($_COOKIE['lam_login_name'])) {
|
||||
$userNameInput->setCSSClasses(array('lam-initial-focus'));
|
||||
}
|
||||
$userInput = new htmlDiv(null, $userNameInput);
|
||||
$row->addField($userInput);
|
||||
}
|
||||
}
|
||||
|
@ -378,6 +367,9 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
|
|||
else {
|
||||
$passwordInput = new htmlInputField('passwd');
|
||||
$passwordInput->setIsPassword(true);
|
||||
if (($config_object->getLoginMethod() == LAMConfig::LOGIN_SEARCH) && !empty($_COOKIE['lam_login_name'])) {
|
||||
$passwordInput->setCSSClasses(array('lam-initial-focus'));
|
||||
}
|
||||
$row->addField($passwordInput);
|
||||
}
|
||||
// language
|
||||
|
|
Loading…
Reference in New Issue