From 39c4feaef70b5798906e21b642b039f1b56083e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2016 03:54:54 +0200 Subject: [PATCH] Enhancement for usage on smartphone --- htdocs/core/class/extrafields.class.php | 52 +++++++++++++------- htdocs/core/class/html.form.class.php | 4 +- htdocs/core/class/html.formcompany.class.php | 7 ++- htdocs/core/class/html.formfile.class.php | 12 +++-- htdocs/societe/soc.php | 16 +++--- htdocs/theme/eldy/style.css.php | 4 ++ 6 files changed, 58 insertions(+), 37 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5b1b935d24d..88f6d317952 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -657,7 +657,7 @@ class ExtraFields * @param string $moreparam To add more parametes on html input tag * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @param int $showsize Value for size attributed + * @param mixed $showsize Value for css to define size. May also be a numeric. * @param int $objectid Current object id * @return string */ @@ -680,23 +680,37 @@ class ExtraFields { if ($type == 'date') { - $showsize=10; + //$showsize=10; + $showsize = 'minwidth100imp'; } elseif ($type == 'datetime') { - $showsize=19; + //$showsize=19; + $showsize = 'minwidth200imp'; } elseif (in_array($type,array('int','double'))) { - $showsize=10; + //$showsize=10; + $showsize = 'minwidth100imp'; } else { - $showsize=round($size); - if ($showsize > 48) $showsize=48; + if (round($size) < 12) + { + $showsize = 'minwidth100imp'; + } + else if (round($size) <= 48) + { + $showsize = 'minwidth200imp'; + } + else + { + //$showsize=48; + $showsize = 'minwidth400imp'; + } } } - + if (in_array($type,array('date','datetime'))) { $tmp=explode(',',$size); @@ -718,11 +732,11 @@ class ExtraFields { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -738,26 +752,26 @@ class ExtraFields } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'mail') { - $out=''; + $out=''; } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { if (!empty($value)) { $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { @@ -768,7 +782,7 @@ class ExtraFields $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); } - $out.=''; $out.=''; foreach ($param['options'] as $key => $val) { @@ -790,7 +804,7 @@ class ExtraFields $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); } - $out.=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); @@ -971,7 +985,7 @@ class ExtraFields $out=''; foreach ($param['options'] as $keyopt=>$val ) { - $out.=''; @@ -1146,7 +1160,7 @@ class ExtraFields if (!empty($value)) $object->fetch($value); $valuetoshow=$object->ref; if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique - $out.=''; + $out.=''; } else { @@ -1156,7 +1170,7 @@ class ExtraFields } elseif ($type == 'password') { - $out=''; + $out=''; } if (!empty($hidden)) { $out=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b035095b1a7..910afcdfd96 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -598,7 +598,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -1444,7 +1444,7 @@ class Form $nodatarole=($comboenhancement?' data-role="none"':''); } - $out.= ''; if ($show_empty) $out.= ''."\n"; if ($show_every) $out.= ''."\n"; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 05bbbd941d9..70dc0e253c4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -232,7 +232,7 @@ class FormCompany $result=$this->db->query($sql); if ($result) { - if (!empty($htmlname)) $out.= ''; if ($country_codeid) $out.= ''; $num = $this->db->num_rows($result); $i = 0; @@ -743,7 +743,7 @@ class FormCompany $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; $moreattrib.=' autocomplete="off"'; } - $out.= ''."\n"; + $out.= ''."\n"; return $out; } @@ -792,9 +792,8 @@ class FormCompany $maxlength=$formlength; if (empty($formlength)) { $formlength=24; $maxlength=128; } - $formlength=0; - $out = ''; + $out = ''; return $out; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e52818305b5..b8fab63f906 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -731,7 +731,7 @@ class FormFile } /** - * Show only Document icon with link + * Show a Document icon with link(s) * * @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. @@ -748,6 +748,8 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); + if (! empty($conf->dol_use_jmobile)) return ''; + $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment @@ -755,7 +757,7 @@ class FormFile if (! empty($file_list)) { $out='