2
0
forked from Wavyzz/dolibarr

Fix for use with text browser

Conflicts:
	htdocs/main.inc.php
This commit is contained in:
Laurent Destailleur
2020-06-10 12:35:39 +02:00
parent 760fb4b0e3
commit 5794b1abea
12 changed files with 30 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ function blockedlogadmin_prepare_head()
$b = new BlockedLog($db); $b = new BlockedLog($db);
if ($b->alreadyUsed()) if ($b->alreadyUsed())
{ {
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>'; $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">...</span>' : '');
} }
$head[$h][2] = 'fingerprints'; $head[$h][2] = 'fingerprints';
$h++; $h++;

View File

@@ -90,7 +90,7 @@ function bomPrepareHead($object)
if (!empty($object->note_public)) $nbNote++; if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>'; if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
} }
@@ -102,7 +102,7 @@ function bomPrepareHead($object)
$nbLinks = Link::count($db, $object->element, $object->id); $nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
$head[$h][2] = 'document'; $head[$h][2] = 'document';
$h++; $h++;

View File

@@ -663,7 +663,7 @@ function security_prepare_head()
$head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; $head[$h][0] = DOL_URL_ROOT."/admin/perms.php";
$head[$h][1] = $langs->trans("DefaultRights"); $head[$h][1] = $langs->trans("DefaultRights");
if ($nbPerms > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbPerms.'</span>'; if ($nbPerms > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbPerms.'</span>' : '');
$head[$h][2] = 'default'; $head[$h][2] = 'default';
$h++; $h++;

View File

@@ -481,7 +481,7 @@ function actions_prepare_head($object)
$listofresourcelinked = $resource->getElementResources($object->element, $object->id); $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
$nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0); $nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0);
$head[$h][1] = $langs->trans("Resources"); $head[$h][1] = $langs->trans("Resources");
if ($nbResources > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbResources).'</span>'; if ($nbResources > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbResources).'</span>' : '');
$head[$h][2] = 'resources'; $head[$h][2] = 'resources';
$h++; $h++;
} }
@@ -494,7 +494,7 @@ function actions_prepare_head($object)
$nbLinks = Link::count($db, $object->element, $object->id); $nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
$head[$h][1] = $langs->trans("Documents"); $head[$h][1] = $langs->trans("Documents");
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;

View File

@@ -1216,7 +1216,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{ {
$limittitle = 30; $limittitle = 30;
$out .= '<a class="tabTitle">'; $out .= '<a class="tabTitle">';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' '; if ($picto && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
$out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>'; $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
$out .= '</a>'; $out .= '</a>';
} }
@@ -2246,6 +2246,8 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail = $email; $newemail = $email;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto = 0;
if (empty($email)) return '&nbsp;'; if (empty($email)) return '&nbsp;';
if (!empty($addlink)) if (!empty($addlink))
@@ -2279,7 +2281,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
} }
//$rep = '<div class="nospan" style="margin-right: 10px">'; //$rep = '<div class="nospan" style="margin-right: 10px">';
$rep = ($withpicto ?img_picto($langs->trans("EMail").' : '.$email, 'object_email.png').' ' : '').$newemail; $rep = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, 'object_email.png').' ' : '').$newemail;
//$rep .= '</div>'; //$rep .= '</div>';
if ($hookmanager) { if ($hookmanager) {
$parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto); $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);

View File

@@ -64,7 +64,7 @@ function user_prepare_head($object)
if ($canreadperms) if ($canreadperms)
{ {
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("Rights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>'; $head[$h][1] = $langs->trans("Rights").(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
$head[$h][2] = 'rights'; $head[$h][2] = 'rights';
$h++; $h++;
} }

View File

@@ -54,6 +54,7 @@ $titleofloginpage = $langs->trans('Login').' @ '.$titletruedolibarrversion; // $
$disablenofollow = 1; $disablenofollow = 1;
if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0; if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $disablenofollow = 0;
print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow); print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);

View File

@@ -257,6 +257,12 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover = 1; if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover = 1;
} }
// Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part)
if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) // If we must enable text browser
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
}
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url') // Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off' // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on')) if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on'))
@@ -343,7 +349,6 @@ if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VE
} }
} }
// Creation of a token against CSRF vulnerabilities // Creation of a token against CSRF vulnerabilities
if (!defined('NOTOKENRENEWAL')) if (!defined('NOTOKENRENEWAL'))
{ {
@@ -868,7 +873,6 @@ if (GETPOST('theme', 'alpha'))
$conf->css = "/theme/".$conf->theme."/style.css.php"; $conf->css = "/theme/".$conf->theme."/style.css.php";
} }
// Set javascript option // Set javascript option
if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL
{ {
@@ -876,19 +880,14 @@ if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL
{ {
$conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT; $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
} }
} } else $conf->use_javascript_ajax = 0;
else $conf->use_javascript_ajax = 0;
// Set MAIN_OPTIMIZEFORTEXTBROWSER // Set MAIN_OPTIMIZEFORTEXTBROWSER for user (must be after login part)
if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) // If we must enable text browser if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
}
elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
} }
// set MAIN_OPTIMIZEFORCOLORBLIND // set MAIN_OPTIMIZEFORCOLORBLIND for user
$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; $conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
// Set terminal output option according to conf->browser. // Set terminal output option according to conf->browser.

View File

@@ -48,7 +48,7 @@ function myobjectPrepareHead($object)
if (!empty($object->note_public)) $nbNote++; if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id; $head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>'; if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
} }

View File

@@ -714,6 +714,8 @@ class Entrepot extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto = 0;
$result = ''; $result = '';
$label = '<u>'.$langs->trans("Warehouse").'</u>'; $label = '<u>'.$langs->trans("Warehouse").'</u>';

View File

@@ -1,5 +1,6 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet');
?>
/* Badge style is based on boostrap framework */ /* Badge style is based on boostrap framework */
.badge { .badge {

View File

@@ -46,7 +46,7 @@ function websiteaccountPrepareHead($object)
if(!empty($object->fields['note_public'])) $nbNote++; if(!empty($object->fields['note_public'])) $nbNote++;
$head[$h][0] = dol_buildpath('/monmodule/websiteaccount_note.php', 1).'?id='.$object->id; $head[$h][0] = dol_buildpath('/monmodule/websiteaccount_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>'; if ($nbNote > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
}*/ }*/
@@ -59,7 +59,7 @@ function websiteaccountPrepareHead($object)
$nbLinks=Link::count($db, $object->element, $object->id); $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/monmodule/websiteaccount_document.php", 1).'?id='.$object->id; $head[$h][0] = dol_buildpath("/monmodule/websiteaccount_document.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>'; if (($nbFiles+$nbLinks) > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>' : '');
$head[$h][2] = 'document'; $head[$h][2] = 'document';
$h++; $h++;