From 3b05d00163fbc4cd22254957b2480dd761c22101 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 24 Oct 2016 11:59:19 +0200 Subject: [PATCH] Better responsive design --- htdocs/core/class/html.form.class.php | 16 +++++++--- htdocs/core/class/html.formfile.class.php | 15 +++++---- htdocs/core/lib/functions.lib.php | 39 +++++++++++++++-------- htdocs/societe/soc.php | 2 +- htdocs/theme/eldy/style.css.php | 13 ++++++++ htdocs/theme/md/style.css.php | 14 ++++++++ 6 files changed, 75 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b5d9ead05e3..69d8adc7352 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3274,7 +3274,7 @@ class Form * @param string $selectedchoice "" or "no" or "yes" * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box - * @param int $width Force width of bow + * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=200, $width=500) @@ -3289,7 +3289,8 @@ class Form // Clean parameters $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; - + if ($conf->browser->layout == 'phone') $width='95%'; + if (is_array($formquestion) && ! empty($formquestion)) { // First add hidden fields and value @@ -5523,7 +5524,11 @@ class Form //print "xx".$previous_ref."x".$next_ref; $ret.='<div style="vertical-align: middle">'; - if ($morehtmlleft) $ret.='<div class="inline-block floatleft">'.$morehtmlleft.'</div>'; + if ($morehtmlleft) + { + if ($conf->browser->layout == 'phone') $ret.='<div class="center">'.$morehtmlleft.'</div>'; + else $ret.='<div class="inline-block floatleft">'.$morehtmlleft.'</div>'; + } $ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">'; @@ -5727,7 +5732,10 @@ class Form } else { - $ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'">'; + if ($conf->browser->layout != 'phone') + { + $ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'">'; + } } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 61f4f459091..3ad02cf60c2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1454,13 +1454,16 @@ class FormFile global $langs, $conf; $out=''; - $urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath); - if ($urladvancedpreview) + if ($conf->browser->layout != 'phone') { - $out.= '<a data-ajax="false" class="pictopreview" href="'.$urladvancedpreview.'">'; - if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); - else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']); - $out.= '</a>'; + $urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath); // Return if a file is qualified for preview + if ($urladvancedpreview) + { + $out.= '<a data-ajax="false" class="pictopreview" href="'.$urladvancedpreview.'">'; + if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); + else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']); + $out.= '</a>'; + } } return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 892c6c1fc2b..921571a478c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -944,7 +944,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($object->element == 'user') $modulepart='userphoto'; if ($object->element == 'product') $modulepart='product'; - print '<div class="'.($onlybanner?'':'arearef ').'heightref valignmiddle" width="100%">'; if ($object->element == 'product') { $width=80; $cssclass='photoref'; @@ -958,7 +957,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $nophoto=''; $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"></div>'; } - else { + elseif ($conf->browser->layout != 'phone') { // Show no photo link $nophoto='/public/theme/common/nophoto.png'; $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>'; } @@ -969,21 +968,33 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { if ($showimage) { - $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'; - if ($modulepart != 'unknown') $morehtmlleft.=$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); - else if ($object->element == 'action') + if ($modulepart != 'unknown') { - $cssclass='photorefcenter'; - $nophoto=img_picto('', 'title_agenda', '', false, 1); - $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.$nophoto.'"></div></div>'; + $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + if ($phototoshow) + { + $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'; + $morehtmlleft.=$phototoshow; + $morehtmlleft.='</div>'; + } } - else + elseif ($conf->browser->layout != 'phone') // Show no photo link { - $width=14; $cssclass='photorefcenter'; - $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); - $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.$nophoto.'"></div></div>'; + $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'; + if ($object->element == 'action') + { + $cssclass='photorefcenter'; + $nophoto=img_picto('', 'title_agenda', '', false, 1); + $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.$nophoto.'"></div></div>'; + } + else + { + $width=14; $cssclass='photorefcenter'; + $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); + $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.$nophoto.'"></div></div>'; + } + $morehtmlleft.='</div>'; } - $morehtmlleft.='</div>'; } } if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>'; @@ -1035,6 +1046,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlref.=$langs->trans("TechnicalID").': '.$object->id; $morehtmlref.='</div>'; } + + print '<div class="'.($onlybanner?'':'arearef ').'heightref valignmiddle" width="100%">'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlright); print '</div>'; print '<div class="underrefbanner clearboth"></div>'; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 9709b4ecbac..e9896fc61af 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1931,7 +1931,7 @@ else ) ); - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 190); + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 200); } dol_htmloutput_errors($error,$errors); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e176ebcaaee..6da9077d5d2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4637,6 +4637,19 @@ img.demothumb { max-width: 100px; min-width: 0 !important; } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ef751d882f7..016cb4f05c3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4445,6 +4445,20 @@ img.demothumb { position: absolute; width: <?php print dol_size(300,'width'); ?>px; } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } + } -- GitLab