Fix compatibility with Internet Explorer

This commit is contained in:
Laurent Destailleur 2017-08-23 12:32:28 +02:00
parent aae24c26a3
commit e25a428118
4 changed files with 23 additions and 10 deletions

View File

@ -190,8 +190,9 @@ function getBrowserInfo($user_agent)
} }
// OS // OS
if (preg_match('/linux/i', $user_agent)) { $os='linux'; } if (preg_match('/linux/i', $user_agent)) { $os='linux'; }
elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; } elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; }
elseif (preg_match('/windows/i', $user_agent)) { $os='windows'; }
// Name // Name
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; } if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; }
@ -201,7 +202,8 @@ function getBrowserInfo($user_agent)
elseif (preg_match('/epiphany/i', $user_agent)) { $name='epiphany'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name='epiphany'; }
elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not. elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not.
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; }
if ($tablet) { if ($tablet) {

View File

@ -706,7 +706,7 @@ div.fiche>form>div.div-table-responsive {
} }
.flexcontainer { .flexcontainer {
display: inline-flex; <?php if (in_array($conf->browser->name, array('chrome','firefox'))) echo 'display: inline-flex;'."\n"; ?>
flex-flow: row wrap; flex-flow: row wrap;
justify-content: flex-start; justify-content: flex-start;
} }
@ -716,10 +716,11 @@ div.fiche>form>div.div-table-responsive {
.thumbstat150 { .thumbstat150 {
flex: 1 1 170px; flex: 1 1 170px;
} }
.thumbstat, thumbstat150 { .thumbstat, .thumbstat150 {
/* flex-grow: 1; */ /* flex-grow: 1; */
/* flex-shrink: 1; */ /* flex-shrink: 1; */
/* flex-basis: 140px; */ /* flex-basis: 140px; */
display: inline;
width: 100%; width: 100%;
justify-content: flex-start; justify-content: flex-start;
align-self: flex-start; align-self: flex-start;
@ -2819,7 +2820,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
width: 103px; width: 103px;
} }
.boxstats130 { .boxstats130 {
width: 160px; width: 158px;
height: 48px; height: 48px;
padding: 3px padding: 3px
} }

View File

@ -707,7 +707,7 @@ div.fiche>form>div.div-table-responsive {
} }
.flexcontainer { .flexcontainer {
display: inline-flex; <?php if (in_array($conf->browser->browsername, array('chrome','firefox'))) echo 'display: inline-flex;' ?>
flex-flow: row wrap; flex-flow: row wrap;
justify-content: flex-start; justify-content: flex-start;
} }
@ -717,10 +717,11 @@ div.fiche>form>div.div-table-responsive {
.thumbstat150 { .thumbstat150 {
flex: 1 1 150px; flex: 1 1 150px;
} }
.thumbstat, thumbstat150 { .thumbstat, .thumbstat150 {
/* flex-grow: 1; */ /* flex-grow: 1; */
/* flex-shrink: 1; */ /* flex-shrink: 1; */
/* flex-basis: 140px; */ /* flex-basis: 140px; */
display: inline;
width: 100%; width: 100%;
justify-content: flex-start; justify-content: flex-start;
align-self: flex-start; align-self: flex-start;

View File

@ -82,7 +82,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
//$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! function_exists('mb_substr')) { print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(); } if (! function_exists('mb_substr')) { print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(); }
print __METHOD__."\n"; print __METHOD__."\n";
} }
@ -278,6 +278,15 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertFalse($tmp['tablet']); $this->assertFalse($tmp['tablet']);
$this->assertEquals('classic', $tmp['layout']); $this->assertEquals('classic', $tmp['layout']);
//Internet Explorer 11 bis
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; NP06; rv:11.0) like Gecko';
$tmp=getBrowserInfo($user_agent);
$this->assertEquals('ie',$tmp['browsername']);
$this->assertEquals('11.0',$tmp['browserversion']);
$this->assertEmpty($tmp['phone']);
$this->assertFalse($tmp['tablet']);
$this->assertEquals('classic', $tmp['layout']);
//iPad //iPad
$user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'; $user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25';
$tmp=getBrowserInfo($user_agent); $tmp=getBrowserInfo($user_agent);
@ -445,11 +454,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$text='<a href="/myurl" title="<u>Afficher projet</u>">ABC</a>'; $text='<a href="/myurl" title="<u>Afficher projet</u>">ABC</a>';
$after=dol_string_nohtmltag($text,1); $after=dol_string_nohtmltag($text,1);
$this->assertEquals("ABC",$after,"test6"); $this->assertEquals("ABC",$after,"test6");
$text='<a href="/myurl" title="&lt;u&gt;Afficher projet&lt;/u&gt;">DEF</a>'; $text='<a href="/myurl" title="&lt;u&gt;Afficher projet&lt;/u&gt;">DEF</a>';
$after=dol_string_nohtmltag($text,1); $after=dol_string_nohtmltag($text,1);
$this->assertEquals("DEF",$after,"test7"); $this->assertEquals("DEF",$after,"test7");
return true; return true;
} }