From 2e5634e60f813eb04eb8fc784d055f7348ff16d7 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 27 Nov 2016 14:21:23 +0100
Subject: [PATCH] Fix responsive design

---
 htdocs/admin/modules.php                      | 52 +++++++++----------
 .../core/tpl/admin_extrafields_view.tpl.php   |  5 +-
 htdocs/theme/eldy/style.css.php               |  6 ++-
 htdocs/theme/md/style.css.php                 |  8 ++-
 4 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 93dd8ea8969..a7b3065658d 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -286,23 +286,10 @@ if ($mode==='expdev')      print $langs->trans("ModuleFamilyExperimental")."<br>
 $h = 0;
 
 $categidx='common';    // Main
-//if (! empty($categ[$categidx]))
-//{
-	$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
-	$head[$h][1] = $langs->trans("AvailableModules");
-	$head[$h][2] = 'common';
-	$h++;
-//}
-
-/*$categidx='expdev';
-if (! empty($categ[$categidx]))
-{
-	$categidx='expdev';
-    $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
-    $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3);
-    $head[$h][2] = 'expdev';
-    $h++;
-}*/
+$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
+$head[$h][1] = $langs->trans("AvailableModules");
+$head[$h][2] = 'common';
+$h++;
 
 $categidx='marketplace';
 $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
@@ -314,18 +301,19 @@ $h++;
 print "<br>\n";
 
 
-dol_fiche_head($head, $mode, '');
-
 $var=true;
 
 if ($mode != 'marketplace')
 {
+    
     print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
     if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
     print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
     print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
     print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
 
+    dol_fiche_head($head, $mode, '');
+    
     $moreforfilter = '';
     $moreforfilter.='<div class="divsearchfield">';
     $moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
@@ -362,12 +350,17 @@ if ($mode != 'marketplace')
         print $hookmanager->resPrint;
         //print '</div>';
     }
-
-    print '<br><br><br><br>';
-
+    
+    //dol_fiche_end();
+    
+    print '<div class="clearboth"></div><br>';
+    //print '<br><br><br><br>';
+
+    $moreforfilter='';
+    
     // Show list of modules
-
-    print '<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">'."\n";
+    print '<div class="div-table-responsive">';
+    print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" summary="list_of_modules" id="list_of_modules" >'."\n";
 
     $oldfamily='';
 
@@ -766,9 +759,12 @@ if ($mode != 'marketplace')
 
     }
     print "</table>\n";
+    print '</div>';
 }
 else
 {
+    dol_fiche_head($head, $mode, '');
+    
     // Marketplace
     print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
     print "<tr class=\"liste_titre\">\n";
@@ -780,7 +776,7 @@ else
     $var=!$var;
     print "<tr ".$bc[$var].">\n";
     $url='https://www.dolistore.com';
-    print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
+    print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
     print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
     print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
     print '</tr>';
@@ -788,18 +784,18 @@ else
     $var=!$var;
     print "<tr ".$bc[$var].">\n";
     $url='https://partners.dolibarr.org';
-    print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
+    print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
     print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
     print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
     print '</tr>';
 
     print "</table>\n";
-}
 
+    //dol_fiche_end();
+}
 
 dol_fiche_end();
 
-
 // Show warning about external users
 if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n";
 
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index 6acc81f009f..d20184c70b4 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2010-2012	Laurent Destailleur	<eldy@users.sourceforge.net>
+/* Copyright (C) 2010-2016	Laurent Destailleur	<eldy@users.sourceforge.net>
  * Copyright (C) 2012		Regis Houssin		<regis.houssin@capnetworks.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@ print '<br>';
 // Load attribute_label
 $extrafields->fetch_name_optionals_label($elementtype);
 
+print '<div class="div-table-responsive">';
 print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
 
 print '<tr class="liste_titre">';
@@ -68,6 +69,6 @@ foreach($extrafields->attribute_type as $key => $value)
 }
 
 print "</table>";
-
+print '</div>';
 ?>
 <!-- END PHP TEMPLATE admin_extrafields_view.tpl.php -->
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 117f6718f42..6685b0cc745 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -631,6 +631,7 @@ div.myavailability {
 .titlefieldcreate { width: 20%; }
 .titlefield       { width: 25%; }
 .titlefieldmiddle { width: 50%; }
+.imgmaxwidth180 { max-width: 180px; }
 
 /* Force values for small screen 1400 */
 @media only screen and (max-width: 1400px)
@@ -990,6 +991,9 @@ img.photoref, div.photoref {
 	width: 80px;
     object-fit: contain;
 }
+img.fitcontain {
+    object-fit: contain;
+}
 div.photoref {
 	display:table-cell;
 	vertical-align:middle;
@@ -4514,7 +4518,7 @@ img.demothumb {
 }
 @media only screen and (max-width: 767px)
 {
-	.imgopensurveywizard { width:95%; height: auto; }
+	.imgopensurveywizard, .imgautosize { width:95%; height: auto; }
 
 	#tooltip {
 		position: absolute;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 21ff3a03442..43e5398b13e 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -636,6 +636,8 @@ div.myavailability {
 .titlefieldcreate { width: 20%; }
 .titlefield       { width: 25%; }
 .titlefieldmiddle { width: 50%; }
+.imgmaxwidth180 { max-width: 180px; }
+	
 
 /* Force values for small screen 1400 */
 @media only screen and (max-width: 1400px)
@@ -1038,6 +1040,9 @@ img.photoref, div.photoref {
 	width: 80px;
     object-fit: contain;
 }
+img.fitcontain {
+    object-fit: contain;
+}
 div.photoref {
 	display:table-cell;
 	vertical-align:middle;
@@ -1051,6 +1056,7 @@ img.photorefnoborder {
     object-fit: contain;
     border: 1px solid #CCC;
 }
+
 .underrefbanner {
 }
 .underbanner {
@@ -4441,7 +4447,7 @@ img.demothumb {
 }
 @media only screen and (max-width: 767px)
 {
-	.imgopensurveywizard { width:95%; height: auto; }
+	.imgopensurveywizard, .imgautosize { width:95%; height: auto; }
 	
 	#tooltip {
 		position: absolute;
-- 
GitLab