Skip to content

Commit

Permalink
Merge pull request #253 from LDAPAccountManager/feature/tabindexRemoval
Browse files Browse the repository at this point in the history
Feature/tabindex removal
  • Loading branch information
gruberroland authored Oct 9, 2023
2 parents 20bcda2 + f77af88 commit 956de6c
Show file tree
Hide file tree
Showing 49 changed files with 211 additions and 346 deletions.
5 changes: 2 additions & 3 deletions lam/lib/adminHeader.inc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function printHeader(string $headerPrefix): void {
$accountTypesDiv = new htmlDiv('lam-navigation-types', $accountTypeEntriesDiv, array('lam-navigation-layer zeroHeight'));
$accountTypesGroup->addElement($accountTypesDiv);

parseHtml(null, $accountTypesGroup, array(), false, $tabIndex, null);
parseHtml(null, $accountTypesGroup, array(), false, null);
}
if (sizeof($tools) > 0) {
$toolGroup = new htmlGroup();
Expand All @@ -179,8 +179,7 @@ function printHeader(string $headerPrefix): void {
$toolDiv = new htmlDiv('lam-navigation-tools', $toolEntriesDiv, array('lam-navigation-layer zeroHeight'));
$toolGroup->addElement($toolDiv);

$tabIndex = 0;
parseHtml(null, $toolGroup, array(), false, $tabIndex, null);
parseHtml(null, $toolGroup, array(), false, null);
}
if (is_dir(dirname(__FILE__) . '/../docs/manual')) {
?>
Expand Down
3 changes: 1 addition & 2 deletions lam/lib/export.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ class Exporter {
*/
public static function formatMessage($type, $title, $message) {
$msg = new htmlStatusMessage($type, $title, $message);
$tabindex = 0;
ob_start();
$msg->generateHTML(null, array($msg), array(), true, $tabindex, 'user');
$msg->generateHTML(null, array($msg), array(), true, 'user');
$data = ob_get_contents();
ob_clean();
return $data;
Expand Down
186 changes: 77 additions & 109 deletions lam/lib/html.inc

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lam/lib/import.inc
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,8 @@ class Importer {
*/
public static function formatMessage($type, $title, $message) {
$msg = new htmlStatusMessage($type, $title, $message);
$tabindex = 0;
ob_start();
$msg->generateHTML(null, array($msg), array(), true, $tabindex, 'user');
$msg->generateHTML(null, array($msg), array(), true, 'user');
$data = ob_get_contents();
ob_clean();
return $data;
Expand Down
19 changes: 7 additions & 12 deletions lam/lib/lists.inc
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ class lamList {
/** configuration options */
private $configOptions;

/** tabindex for GUI elements */
protected $tabindex = 1;

/** defines if the server side filter changed */
protected $serverSideFilterChanged;

Expand Down Expand Up @@ -193,7 +190,6 @@ class lamList {
* Prints the HTML code to display the list view.
*/
public function showPage() {
$this->tabindex = 1;
// do POST actions
$postFragment = $this->listDoPost();
// update filter
Expand All @@ -216,7 +212,7 @@ class lamList {
}
// insert HTML fragment from listDoPost
if ($postFragment !== null) {
parseHtml('', $postFragment, array(), true, $this->tabindex, $this->type->getScope());
parseHtml('', $postFragment, array(), true, $this->type->getScope());
}
// config dialog
$this->listPrintConfigurationPage();
Expand Down Expand Up @@ -398,7 +394,7 @@ class lamList {
}
}
$row->add($navGroup, 12, 6, 6, 'responsiveLabel');
parseHtml(null, $row, array(), false, $this->tabindex, $this->type->getScope());
parseHtml(null, $row, array(), false, $this->type->getScope());
}

/**
Expand Down Expand Up @@ -435,7 +431,7 @@ class lamList {
$table->setOnClickEvents($onClickEvents);
$table->setOnDoubleClickEvents($onDoubleClickEvents);

parseHtml(null, $table, array(), false, $this->tabindex, $scope);
parseHtml(null, $table, array(), false, $scope);
}

/**
Expand Down Expand Up @@ -967,7 +963,7 @@ class lamList {
$container->add(new htmlHiddenInput('clickedAccount', $id), 0);
addSecurityTokenToMetaHTML($container);

parseHtml(null, $container, array(), false, $this->tabindex, $this->type->getScope());
parseHtml(null, $container, array(), false, $this->type->getScope());

$this->printFooter();
}
Expand Down Expand Up @@ -999,7 +995,6 @@ class lamList {
* Prints the create and delete buttons.
*
* @param boolean $createOnly true if only the create button should be displayed
* @param int $tabindex HTML tabindex counter
*/
protected function listPrintButtons($createOnly) {
$row = new htmlResponsiveRow();
Expand Down Expand Up @@ -1044,7 +1039,7 @@ class lamList {
$this->addExtraInputElementsToTopArea($left, $right);
$row->add($left, 12, 6, 6, 'text-left');
$row->add($right, 12, 6, 6, 'text-right');
parseHtml(null, $row, array(), false, $this->tabindex, $this->type->getScope());
parseHtml(null, $row, array(), false, $this->type->getScope());
}

/**
Expand All @@ -1065,7 +1060,7 @@ class lamList {
$row = new htmlResponsiveRow();
$row->setCSSClasses(array('maxrow'));
$row->add(new htmlTitle($this->type->getAlias()));
parseHtml(null, $row, array(), true, $this->tabindex, null);
parseHtml(null, $row, array(), true, null);
$this->printHeaderContent();
}

Expand Down Expand Up @@ -1425,7 +1420,7 @@ class lamList {
$configContainer->add(new htmlHiddenInput('saveConfigOptions', 'ok'), 12);
addSecurityTokenToMetaHTML($configContainer);

parseHtml('', $configContainer, array(), false, $this->tabindex, $this->type->getScope());
parseHtml('', $configContainer, array(), false, $this->type->getScope());

echo '</form>';
echo "</div>\n";
Expand Down
27 changes: 10 additions & 17 deletions lam/lib/modules.inc
Original file line number Diff line number Diff line change
Expand Up @@ -677,18 +677,17 @@ function getRequiredExtensions() {
* @param mixed $input htmlElement or array of htmlElement elements
* @param array $values List of values which override the defaults in $input (name => value)
* @param boolean $restricted If true then no buttons will be displayed
* @param integer $tabindex Start value of tabulator index for input fields
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function parseHtml($module, $input, $values, $restricted, &$tabindex, $scope) {
function parseHtml($module, $input, $values, $restricted, $scope) {
if ($input instanceof htmlElement) {
return $input->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
return $input->generateHTML($module, $input, $values, $restricted, $scope);
}
if (is_array($input) && (sizeof($input) > 0)) {
$return = array();
for ($i = 0; $i < sizeof($input); $i++) {
$return = array_merge($return, $input[$i]->generateHTML($module, $input, $values, $restricted, $tabindex, $scope));
$return = array_merge($return, $input[$i]->generateHTML($module, $input, $values, $restricted, $scope));
}
return $return;
}
Expand Down Expand Up @@ -1059,7 +1058,6 @@ class accountContainer {
* @param array $result list of messages
*/
private function printModuleContent($result) {
$tabindex = 1;
$this->printPageHeader();
$this->printPasswordPromt();
// display error messages
Expand All @@ -1071,7 +1069,7 @@ class accountContainer {
echo '<div id="passwordMessageArea"></div>';
echo "<table border=0 width=\"100%\" style=\"border-collapse: collapse;\">\n";
echo "<tr><td style=\"padding: 5px 0px 0px 0px;\">\n";
$this->printCommonControls($tabindex);
$this->printCommonControls();
echo "</td></tr>\n";
echo "<tr valign=\"top\"><td style=\"padding: 15px;\">";
// print title bar
Expand Down Expand Up @@ -1112,7 +1110,7 @@ class accountContainer {
$titleBarContainer->add($titleBarSuffixRdn);

$titleBarDiv = new htmlDiv(null, $titleBarContainer, array('titleBar'));
parseHtml(null, $titleBarDiv, array(), false, $tabindex, $this->type->getScope());
parseHtml(null, $titleBarDiv, array(), false, $this->type->getScope());

echo '<div id="lamVerticalTabs" class="lam-vertical-tab-container">';
echo '<table class="lam-vertical-tabs fullwidth">';
Expand All @@ -1129,8 +1127,7 @@ class accountContainer {
catch (LAMException $e) {
$return = new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage());
}
$y = 5000;
parseHtml($this->order[$this->current_page], $return, array(), false, $y, $this->type->getScope());
parseHtml($this->order[$this->current_page], $return, array(), false, $this->type->getScope());
echo "</div>\n";
echo '</td>';
echo '</tr>';
Expand Down Expand Up @@ -1236,9 +1233,8 @@ class accountContainer {
$buttonGroup->addElement($cancelButton);
$container->add($buttonGroup);
// generate HTML
$tabindex = 2000;
if ($printContainer) {
parseHtml(null, $container, array(), false, $tabindex, $this->type->getScope());
parseHtml(null, $container, array(), false, $this->type->getScope());
}
echo "</div>\n";
echo "</div>\n";
Expand Down Expand Up @@ -1354,10 +1350,8 @@ class accountContainer {

/**
* Prints common controls like the save button and the ou selection.
*
* @param int $tabindex tabindex for GUI elements
*/
private function printCommonControls(&$tabindex) {
private function printCommonControls(): void {
$row = new htmlResponsiveRow();
$row->setCSSClasses(array('maxrow'));
$leftButtonGroup = new htmlGroup();
Expand Down Expand Up @@ -1419,7 +1413,7 @@ class accountContainer {
}
$row->add($rightGroup, 12, 3, 3, 'text-right');

parseHtml(null, $row, array(), false, $tabindex, $this->type->getScope());
parseHtml(null, $row, array(), false, $this->type->getScope());
}

/**
Expand Down Expand Up @@ -1514,8 +1508,7 @@ class accountContainer {
$buttonGroup->addElement($backToEditButton);
$container->add($buttonGroup);

$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, $this->type->getScope());
parseHtml(null, $container, array(), false, $this->type->getScope());

echo "</div>\n";
$this->printPageFooter();
Expand Down
12 changes: 4 additions & 8 deletions lam/lib/modules/inetOrgPerson.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3386,8 +3386,7 @@ class inetOrgPerson extends baseModule implements passwordService,AccountStatusP
$contentElement = $this->getSelfServiceUserCertificates();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
$result['html'] = $content;
Expand Down Expand Up @@ -3428,8 +3427,7 @@ class inetOrgPerson extends baseModule implements passwordService,AccountStatusP
$contentElement = $this->getSelfServicePhoto(false, true);
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
$result['html'] = $content;
Expand All @@ -3448,8 +3446,7 @@ class inetOrgPerson extends baseModule implements passwordService,AccountStatusP
$contentElement = $this->getSelfServicePhoto(false, false);
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
return array(
Expand All @@ -3476,8 +3473,7 @@ class inetOrgPerson extends baseModule implements passwordService,AccountStatusP
$contentElement = $this->getSelfServiceUserCertificates();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
return array(
Expand Down
11 changes: 4 additions & 7 deletions lam/lib/modules/ldapPublicKey.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use LAM\TYPES\ConfiguredType;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2022 Roland Gruber
Copyright (C) 2005 - 2023 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -579,8 +579,7 @@ class ldapPublicKey extends baseModule {
$contentElement = $this->getSelfServiceKeys();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
$jsonReturn = array(
Expand Down Expand Up @@ -639,8 +638,7 @@ class ldapPublicKey extends baseModule {
$contentElement = $this->getSelfServiceKeys();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
$result['html'] = $content;
Expand Down Expand Up @@ -671,8 +669,7 @@ class ldapPublicKey extends baseModule {
$contentElement = $this->getSelfServiceKeys();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
return array(
Expand Down
6 changes: 2 additions & 4 deletions lam/lib/modules/yubiKeyUser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,7 @@ class yubiKeyUser extends baseModule {
$contentElement = $this->getSelfServiceKeys();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
$jsonReturn = array(
Expand Down Expand Up @@ -523,8 +522,7 @@ class yubiKeyUser extends baseModule {
$contentElement = $this->getSelfServiceKeys();
ob_end_clean();
ob_start();
$tabindex = 999;
parseHtml(null, $contentElement, array(), true, $tabindex, $this->get_scope());
parseHtml(null, $contentElement, array(), true, $this->get_scope());
$content = ob_get_contents();
ob_end_clean();
return array(
Expand Down
5 changes: 2 additions & 3 deletions lam/lib/plugins/captcha/FriendlyCaptcha.inc
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ class htmlFriendlyCaptcha extends htmlElement {
* @param array $input List of meta-HTML elements
* @param array $values List of values which override the defaults in $input (name => value)
* @param boolean $restricted If true then no buttons will be displayed
* @param integer $tabindex Start value of tabulator index for input fields
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
function generateHTML($module, $input, $values, $restricted, $scope) {
$script = new htmlScript('../lib/extra/friendlyCaptcha/friendlyCaptcha-0.9.13.js');
$script->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
$script->generateHTML($module, $input, $values, $restricted, $scope);
echo '<div class="frc-captcha" data-sitekey="' . $this->key . '"></div>';
return array();
}
Expand Down
5 changes: 2 additions & 3 deletions lam/lib/plugins/captcha/GoogleReCaptcha.inc
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,12 @@ class htmlReCAPTCHA extends htmlElement {
* @param array $input List of meta-HTML elements
* @param array $values List of values which override the defaults in $input (name => value)
* @param boolean $restricted If true then no buttons will be displayed
* @param integer $tabindex Start value of tabulator index for input fields
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
function generateHTML($module, $input, $values, $restricted, $scope) {
$script = new htmlScript('https://www.google.com/recaptcha/api.js');
$script->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
$script->generateHTML($module, $input, $values, $restricted, $scope);
echo '<div class="g-recaptcha" data-sitekey="' . $this->key . '"></div>';
return array();
}
Expand Down
5 changes: 2 additions & 3 deletions lam/lib/plugins/captcha/HCaptcha.inc
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ class htmlHCaptcha extends htmlElement {
* @param array $input List of meta-HTML elements
* @param array $values List of values which override the defaults in $input (name => value)
* @param boolean $restricted If true then no buttons will be displayed
* @param integer $tabindex Start value of tabulator index for input fields
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
function generateHTML($module, $input, $values, $restricted, $scope) {
$script = new htmlScript('https://js.hcaptcha.com/1/api.js');
$script->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
$script->generateHTML($module, $input, $values, $restricted, $scope);
echo '<div class="h-captcha" data-sitekey="' . $this->key . '"></div>';
return array();
}
Expand Down
Loading

0 comments on commit 956de6c

Please sign in to comment.