Better support for accessiblity

This commit is contained in:
Laurent Destailleur 2016-05-09 14:59:59 +02:00
parent 6e2443069a
commit 1032583b02
3 changed files with 36 additions and 10 deletions

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param int $noout 1=Disable output (Initialise &$menu only).
* @return int 0
*/
function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
@ -50,6 +50,19 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
if (empty($noout)) print_start_menu_array();
// Show/Hide vertical menu
if (GETPOST('testhidemenu') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$showmode=1;
$classname = 'class="tmenu"';
$idsel='home';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("XXX"), 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', $langs->trans("XXX"), 0, $showmode, $atarget, "xxx", '');
}
// Home
$showmode=1;
$classname="";
@ -463,7 +476,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
print '</div>'."\n";
}
if (is_array($moredata) && ! empty($moredata['searchform']))
if (is_array($moredata) && ! empty($moredata['searchform']) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
print "\n";
print "<!-- Begin SearchForm -->\n";

View File

@ -144,7 +144,7 @@ class MenuManager
if ($mode == 'topnb')
{
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); // no output
return $this->menu->getNbOfVisibleMenuEntries();
}

View File

@ -563,7 +563,11 @@ if (! defined('NOLOGIN'))
$reshook=$hookmanager->executeHooks('afterLoginFailed',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
header('Location: '.DOL_URL_ROOT.'/index.php');
$paramsurl=array();
if (GETPOST('textbrowser')) $paramsurl[]='textbrowser='.GETPOST('textbrowser','int');
if (GETPOST('nojs')) $paramsurl[]='nojs='.GETPOST('nojs','int');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang','alpha');
header('Location: '.DOL_URL_ROOT.'/index.php'.($count(paramsurl)?'?'.join('&',$paramsurl):''));
exit;
}
}
@ -617,7 +621,11 @@ if (! defined('NOLOGIN'))
$reshook=$hookmanager->executeHooks('afterLoginFailed',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
header('Location: '.DOL_URL_ROOT.'/index.php');
$paramsurl=array();
if (GETPOST('textbrowser')) $paramsurl[]='textbrowser='.GETPOST('textbrowser','int');
if (GETPOST('nojs')) $paramsurl[]='nojs='.GETPOST('nojs','int');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang','alpha');
header('Location: '.DOL_URL_ROOT.'/index.php'.($count(paramsurl)?'?'.join('&',$paramsurl):''));
exit;
}
else
@ -756,6 +764,11 @@ if (! GETPOST('nojs')) // If javascript was not disabled on URL
}
}
else $conf->use_javascript_ajax=0;
// Set MAIN_OPTIMIZEFORTEXTBROWSER
if (GETPOST('textbrowser') || ! empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) // If text browser was enabled on URL
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=1;
}
// Set terminal output option according to conf->browser.
if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
@ -1006,9 +1019,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">'."\n";
// Displays title
$appli=constant('DOL_APPLICATION_TITLE');
@ -1460,7 +1473,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
else $toprightmenu.=$result; // For backward compatibility
// Link to print main content area
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->browser->phone))
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone))
{
$qs=$_SERVER["QUERY_STRING"];
$qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
@ -1471,7 +1484,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
}
// Link to Dolibarr wiki pages
if (empty($conf->global->MAIN_HELP_DISABLELINK))
if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$langs->load("help");