Better support for MAIN_OPTIMIZEFORTEXTBROWSER

This commit is contained in:
Laurent Destailleur 2024-03-12 01:55:26 +01:00
parent d94d7ef700
commit 4f64c683ee
9 changed files with 47 additions and 32 deletions

View File

@ -1,4 +1,6 @@
<?php
use Stripe\OAuthErrorObject;
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
@ -41,9 +43,14 @@ class Conf extends stdClass
*/
public $db;
//! To store properties found into database
/**
* @var Object To store global setup found into database
*/
public $global;
//! To store browser info (->name, ->os, ->version, ->ua, ->layout, ...)
/**
* @var Object To store browser info (->name, ->os, ->version, ->ua, ->layout, ...)
*/
public $browser;
//! To store some setup of generic modules

View File

@ -149,7 +149,7 @@ if (!function_exists('dol_loginfunction')) {
// Title
$appli = constant('DOL_APPLICATION_TITLE');
$title = $appli.' '.constant('DOL_VERSION');
$title = $appli.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' : ' '.constant('DOL_VERSION'));
if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
$title = getDolGlobalString('MAIN_APPLICATION_TITLE');
}

View File

@ -178,7 +178,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode);
print_end_menu_entry_auguria($showmode);
print_end_menu_array_auguria();

View File

@ -590,7 +590,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry('', 'class="tmenuend"', $showmode);
print_end_menu_entry($showmode);
print_end_menu_array();

View File

@ -139,7 +139,7 @@ class MenuManager
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
}
if (empty($noout)) {

View File

@ -165,25 +165,28 @@ if (empty($reshook)) {
$searchform .= '<br>';
// Add search on URL
$ret = '';
$ret .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" class="searchform nowraponall tagtr">';
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
$ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
$ret .= '<input type="hidden" name="action" value="redirect">';
$ret .= '<div class="tagtd">';
$ret .= img_picto('', 'url', '', false, 0, 0, '', 'paddingright width20');
$ret .= '<input type="text" class="flat minwidth200"';
$ret .= ' style="background-repeat: no-repeat; background-position: 3px;"';
$ret .= ' placeholder="'.strip_tags($langs->trans("OrPasteAnURL")).'"';
$ret .= ' name="url" id="url" />';
$ret .= '<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
$ret .= '<span class="fa fa-search"></span>';
$ret .= '</button>';
$ret .= '</div>';
$ret .= "</form>\n";
$searchform .= $ret;
// Add search on URL
if ($conf->dol_use_jmobile) {
$ret = '';
$ret .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" class="searchform nowraponall tagtr">';
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
$ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
$ret .= '<input type="hidden" name="action" value="redirect">';
$ret .= '<div class="tagtd">';
$ret .= img_picto('', 'url', '', false, 0, 0, '', 'paddingright width20');
$ret .= '<input type="text" class="flat minwidth200"';
$ret .= ' style="background-repeat: no-repeat; background-position: 3px;"';
$ret .= ' placeholder="'.strip_tags($langs->trans("OrPasteAnURL")).'"';
$ret .= ' name="url" id="url" />';
$ret .= '<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
$ret .= '<span class="fa fa-search"></span>';
$ret .= '</button>';
$ret .= '</div>';
$ret .= "</form>\n";
$searchform .= $ret;
}
// Show all forms

View File

@ -402,9 +402,9 @@ if (!empty($_SESSION['dol_loginmesg'])) {
$message = $_SESSION['dol_loginmesg']; // By default this is an error message
if (preg_match('/<!-- warning -->/', $message)) { // if it contains this comment, this is a warning message
$message = str_replace('<!-- warning -->', '', $message);
print '<div class="warning">';
print '<div class="warning" role="alert">';
} else {
print '<div class="error">';
print '<div class="error" role="alert">';
}
print dol_escape_htmltag($message);
print '</div>'; ?>

View File

@ -93,14 +93,14 @@ $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (select
print load_fiche_titre('&nbsp;', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
if (getDolGlobalString('MAIN_MOTD')) {
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD'));
if (getDolGlobalString('MAIN_MOTD')) {
$substitutionarray = getCommonSubstitutionArray($langs);
complete_substitutions_array($substitutionarray, $langs);
$texttoshow = make_substitutions(getDolGlobalString('MAIN_MOTD'), $substitutionarray, $langs);
print "\n<!-- Start of welcome text -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>';
print '<table class="centpercent notopnoleftnoright"><tr><td>';
print dol_htmlentitiesbr($texttoshow);
print '</td></tr></table><br>';
print "\n<!-- End of welcome text -->\n";
@ -145,7 +145,7 @@ if (!getDolGlobalString('MAIN_REMOVE_INSTALL_WARNING')) {
}
/*
* Dashboard Dolibarr states (statistics)
* Dashboard Dolibarr statistics
* Hidden for external users
*/
@ -156,7 +156,7 @@ $boxstatFromHook = '';
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
// Dolibarr Working Board with weather
if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$showweather = (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') == 2) ? 1 : 0;
//Array that contains all WorkboardResponse classes to process them

View File

@ -467,7 +467,7 @@ if (GETPOST('theme', 'aZ09')) {
// Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part)
if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) { // If we must enable text browser
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 2;
}
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
@ -2677,6 +2677,11 @@ function top_menu_quickadd()
{
global $conf, $langs;
// Button disabled on text browser
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
return '';
}
$html = '';
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
@ -2738,7 +2743,7 @@ function top_menu_quickadd()
*/
function printDropdownQuickadd()
{
global $conf, $user, $langs, $hookmanager;
global $user, $langs, $hookmanager;
$items = array(
'items' => array(