Better responsive design

This commit is contained in:
Laurent Destailleur 2016-10-24 11:59:19 +02:00
parent 6338b04ac0
commit 3b05d00163
6 changed files with 75 additions and 24 deletions

View File

@ -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.'">';
}
}
}

View File

@ -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;
}

View File

@ -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>';

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}
}