New: First change to test how to optimize for smartphone.

This commit is contained in:
Laurent Destailleur 2009-09-15 01:22:19 +00:00
parent f0e9746de8
commit 7036c67414
4 changed files with 23 additions and 5 deletions

View File

@ -87,7 +87,7 @@ For developers:
- If module numberwords is installed, code can use langs->getLabelFromNumber
to get value of an amount in text.
- A module can add subsitution keys in makesubsitutions() functions.
- Add $conf->browser->phone defined to optimise code for smartphone browsers.
***** Changelog for 2.6 compared to 2.5 *****

View File

@ -163,7 +163,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '" tabindex="1" /></td>';
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$title='';
$width=0;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
@ -179,9 +178,14 @@ function dol_loginfunction($langs,$conf,$mysoc)
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
}
print '<td rowspan="2" align="center"><img alt="Logo" title="'.$title.'" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '></td>';
print '<td rowspan="2" align="center">';
if (empty($conf->browser->phone))
{
print '<img alt="Logo" title="" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '>';
}
print '</td>';
print '</tr>'."\n";
// Password field

View File

@ -894,6 +894,9 @@ function top_menu($head, $title='', $target='')
$htmltext.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$_SESSION["dol_authmode"];
$htmltext.='<br><b>'.$langs->trans("CurrentTheme").'</b>: '.$conf->theme;
$htmltext.='<br><b>'.$langs->trans("CurrentUserLanguage").'</b>: '.$langs->getDefaultLang();
$htmltext.='<br><b>'.$langs->trans("Browser").'</b>: '.$conf->browser->name.' ('.$_SERVER['HTTP_USER_AGENT'].')';
if (! empty($conf->browser->phone)) $htmltext.='<br><b>'.$langs->trans("Phone").'</b>: '.$conf->browser->phone;
if (! empty($_SESSION["disablemodules"])) $htmltext.='<br><b>'.$langs->trans("DisabledModules").'</b>: <br>'.join('<br>',split(',',$_SESSION["disablemodules"]));
// print '<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';

View File

@ -171,6 +171,7 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
// Detection browser
if (isset($_SERVER["HTTP_USER_AGENT"]))
{
// Name
if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='firefox';
elseif (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='iceweasel';
elseif (eregi('safari',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='safari';
@ -178,6 +179,16 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
elseif (eregi('opera',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='opera';
elseif (eregi('msie',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='ie';
else $conf->browser->name='unknown';
// If phone/smartphone, we set osname.
if (eregi('android',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='android';
elseif (eregi('blackberry',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='blackberry';
elseif (eregi('iphone',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
elseif (eregi('palm',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='palm';
elseif (eregi('symbian',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='symbian';
elseif (eregi('webos',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='webos';
elseif (eregi('iemobile',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
elseif (eregi('windows ce',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
// Other
if (in_array($conf->browser->name,array('firefox','iceweasel'))) $conf->browser->firefox=1;
}