From 34c741bf0d086193fdf282828f04806c1b82a55e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 17 Jun 2016 16:28:16 +0200
Subject: [PATCH] FIX CSS and responsive behaviour (feature with a menu hider
 is on on smarpthone)

---
 htdocs/core/class/html.formfile.class.php     |  2 +-
 htdocs/core/menus/standard/empty.php          |  4 +--
 .../tpl/document_actions_post_headers.tpl.php |  2 +-
 htdocs/ecm/index.php                          |  2 +-
 htdocs/ecm/index_auto.php                     |  2 +-
 htdocs/main.inc.php                           |  9 ++---
 htdocs/theme/eldy/style.css.php               | 33 ++++++++++++-------
 7 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 40275c5c794..00790ebc9fd 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1267,7 +1267,7 @@ class FormFile
                 print '<input type="hidden" name="id" value="' . $object->id . '">';
                 print '<input type="hidden" name="linkid" value="' . $link->id . '">';
                 print '<input type="hidden" name="action" value="confirm_updateline">';
-                print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">';
+                print $langs->trans('Link') . ': <input type="text" name="link" value="' . $link->url . '">';
                 print '</td>';
                 print '<td>';
                 print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php
index 0002aabaf21..633f0cae238 100644
--- a/htdocs/core/menus/standard/empty.php
+++ b/htdocs/core/menus/standard/empty.php
@@ -170,11 +170,11 @@ class MenuManager
         				$lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
 						if (($alt%2==0))
 						{
-							print '<div class="blockvmenuimpair'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
+							print '<div class="blockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
 						}
 						else
 						{
-							print '<div class="blockvmenupair'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
+							print '<div class="blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
 						}
 					}
 
diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php
index a983bf7f36e..35d1299fd8f 100644
--- a/htdocs/core/tpl/document_actions_post_headers.tpl.php
+++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php
@@ -65,7 +65,7 @@ $formfile->form_attach_new_file(
     0,
     0,
     $permission,
-    50,
+    $conf->browser->layout == 'phone' ? 40 : 60,
     $object,
 	'',
 	1,
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 797e759fb13..896db6f0b85 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -371,7 +371,7 @@ $moreheadjs=empty($conf->use_javascript_ajax)?"":"
         ,   north__paneSelector:    \"#ecm-layout-north\"
         ,   west__paneSelector:     \"#ecm-layout-west\"
         ,   resizable: true
-        ,   north__size:        32
+        ,   north__size:        36
         ,   north__resizable:   false
         ,   north__closable:    false
         ,   west__size:         340
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index 76ce04235e4..c6944065b3a 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -373,7 +373,7 @@ $moreheadjs=empty($conf->use_javascript_ajax)?"":"
         ,   north__paneSelector:    \"#ecm-layout-north\"
         ,   west__paneSelector:     \"#ecm-layout-west\"
         ,   resizable: true
-        ,   north__size:        32
+        ,   north__size:        36
         ,   north__resizable:   false
         ,   north__closable:    false
         ,   west__size:         340
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 839c4fdd3b0..5e919498a9b 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -207,7 +207,7 @@ if (ini_get('register_globals'))    // To solve bug in using $_SESSION
 }
 
 // Init the 5 global objects
-// This include will set: $conf, $db, $langs, $user, $mysoc objects
+// This include will make the new and set properties for: $conf, $db, $langs, $user, $mysoc objects
 require_once 'master.inc.php';
 
 // Activate end of page function
@@ -221,11 +221,12 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
     $conf->browser->os=$tmp['browseros'];
     $conf->browser->version=$tmp['browserversion'];
     $conf->browser->layout=$tmp['layout'];     // 'classic', 'phone', 'tablet'
-    $conf->browser->phone=$tmp['phone'];	   // deprecated, use layout
-    $conf->browser->tablet=$tmp['tablet'];	   // deprecated, use layout
+    $conf->browser->phone=$tmp['phone'];	   // TODO deprecated, use ->layout
+    $conf->browser->tablet=$tmp['tablet'];	   // TODO deprecated, use ->layout
     //var_dump($conf->browser);
-}
 
+    if ($conf->browser->layout == 'phone') $conf->global->MAIN_TESTMENUHIDER=1;
+}
 
 // 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'
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index b10bc03e49b..4a24f2d3dad 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -958,7 +958,6 @@ a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
     font-weight: normal;
 	padding: 0px 5px 0px 3px;
 	white-space: nowrap;
-	/*	text-shadow: 1px 1px 1px #000000; */
 	color: #<?php echo $colortextbackhmenu; ?>;
     text-decoration: none;
 }
@@ -1002,13 +1001,16 @@ li.tmenu, li.tmenusel {
 	margin: 0 0 0 0;
 	font-weight: normal;
 }
+li.menuhider:hover {
+	background-image: none !important;
+}
 li.tmenusel, li.tmenu:hover {
-    background-image: -o-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important;
-    background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%) !important;
-    background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%) !important;
-    background-image: -ms-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important;
-    background-image: linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important;
-	background: rgb(<?php echo $colorbackhmenu1 ?>);
+    background-image: -o-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%);
+    background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%);
+    background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%);
+    background-image: -ms-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%);
+    background-image: linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%);
+	/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
 }
 .tmenuend .tmenuleft { width: 0px; }
 .tmenuend { display: none; }
@@ -1038,6 +1040,13 @@ div.tmenucenter
     height: <?php print $heightmenu; ?>px;
 	<?php } ?>
     width: 100%;
+	/*
+    max-width: <?php echo round($fontsize * 8); ?>px;
+   	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	color: #<?php echo $colortextbackhmenu; ?>;
+	*/
 }
 #menu_titre_logo {
 	padding-top: 0;
@@ -4310,7 +4319,7 @@ img.demothumb {
 
 /* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo $fontsize ?> */
 /* rule to reduce top menu - 1st reduction */
-@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 6.7, 0) + 8; ?>px)
+@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 7, 0) + 20; ?>px)
 {
 	div.tmenucenter {
 	    max-width: <?php echo round($fontsize * 4); ?>px;	/* size of viewport */
@@ -4329,7 +4338,7 @@ img.demothumb {
 	}
 
     li.tmenu, li.tmenusel {
-    	min-width: 32px;
+    	min-width: 36px;
     }
     div.mainmenu {
     	min-width: auto;
@@ -4339,7 +4348,7 @@ img.demothumb {
 	}
 }
 /* rule to reduce top menu - 2nd reduction */
-@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 4.7, 0) + 8; ?>px)
+@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 4.5, 0) + 8; ?>px)
 {
 	div.mainmenu {
 		height: 23px;
@@ -4358,7 +4367,7 @@ img.demothumb {
 	}
 }
 /* rule to reduce top menu - 3rd reduction */
-@media only screen and (max-width: 605px)
+@media only screen and (max-width: 660px)
 {
 	/* Reduce login top right info */
 	.usertextatoplogin {
@@ -4385,7 +4394,7 @@ img.demothumb {
 		<?php } ?>
 	}
     li.tmenu, li.tmenusel {
-        min-width: 30px;
+        min-width: 32px;
     }
 	div.mainmenu {
 		height: 23px;
-- 
GitLab