Enhancement for usage on smartphone
This commit is contained in:
parent
d759296c02
commit
39c4feaef7
@ -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='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" " maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'varchar')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
{
|
||||
@ -738,26 +752,26 @@ class ExtraFields
|
||||
} else {
|
||||
$checked=' value="1" ';
|
||||
}
|
||||
$out='<input type="checkbox" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="checkbox" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'mail')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="32" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'phone')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'price')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
if (!empty($value)) {
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
$out='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
}
|
||||
elseif ($type == 'select')
|
||||
{
|
||||
@ -768,7 +782,7 @@ class ExtraFields
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<select class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val)
|
||||
{
|
||||
@ -790,7 +804,7 @@ class ExtraFields
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<select class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.' maxwidthonsmartphone" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
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.='<input class="flat" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
$out.= ($value==$keyopt?'checked':'');
|
||||
$out.='/>'.$val.'<br>';
|
||||
@ -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.='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$valuetoshow.'" >';
|
||||
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$valuetoshow.'" >';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1156,7 +1170,7 @@ class ExtraFields
|
||||
}
|
||||
elseif ($type == 'password')
|
||||
{
|
||||
$out='<input type="password" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="password" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
if (!empty($hidden)) {
|
||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
||||
|
||||
@ -598,7 +598,7 @@ class Form
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.= '<select id="select'.$htmlname.'" class="flat selectcountry'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
$out.= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@ -1444,7 +1444,7 @@ class Form
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').$nodatarole.'>';
|
||||
$out.= '<select class="flat maxwidth200onsmartphone'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').$nodatarole.'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ class FormCompany
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat minwidth300" name="'.$htmlname.'">';
|
||||
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'">';
|
||||
if ($country_codeid) $out.= '<option value="0"> </option>';
|
||||
$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.= '<input id="'.$htmlname.'" type="text"'.($moreattrib?' '.$moreattrib:'').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
|
||||
$out.= '<input id="'.$htmlname.'" class="maxwidthonsmartphone" type="text"'.($moreattrib?' '.$moreattrib:'').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -792,9 +792,8 @@ class FormCompany
|
||||
|
||||
$maxlength=$formlength;
|
||||
if (empty($formlength)) { $formlength=24; $maxlength=128; }
|
||||
$formlength=0;
|
||||
|
||||
$out = '<input type="text" '.($morecss?'class="'.$morecss.'" ':'').'name="'.$htmlname.'" id="'.$htmlname.'" size="'.($formlength+1).'" maxlength="'.$maxlength.'" value="'.$selected.'">';
|
||||
$out = '<input type="text" '.($morecss?'class="'.$morecss.'" ':'').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -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='<dl class="dropdown">
|
||||
<dt><a href="#" onClick="return false;">'.img_picto('', 'listlight').'</a></dt>
|
||||
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight').'</a></dt>
|
||||
<dd><div class="multichoicedoc"><ul class="ulselectedfields" style="display: none;">';
|
||||
$tmpout='';
|
||||
|
||||
@ -782,9 +784,11 @@ class FormFile
|
||||
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
|
||||
else $this->infofiles['extensions'][$ext]++;
|
||||
|
||||
// Preview
|
||||
$urladvanced = getAdvancedPreviewUrl($modulepart, $relativepath);
|
||||
if ($urladvanced) $tmpout.= '<li><a href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
$tmpout.= '<li><a data-ajax="false" class="pictopreview" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
if ($urladvanced) $tmpout.= '<li><a data-ajax="false" href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
// Download
|
||||
$tmpout.= '<li><a data-ajax="false" class="pictopreview" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||
$tmpout.= '>';
|
||||
|
||||
@ -1019,7 +1019,7 @@ else
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
$tmpcode=$object->code_client;
|
||||
if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0);
|
||||
print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
|
||||
print '<input type="text" name="code_client" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
|
||||
print '</td><td>';
|
||||
$s=$modCodeClient->getToolTip($langs,$object,0);
|
||||
print $form->textwithpicto('',$s,1);
|
||||
@ -1039,7 +1039,7 @@ else
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
$tmpcode=$object->code_fournisseur;
|
||||
if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
|
||||
print '<input type="text" name="code_fournisseur" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
|
||||
print '<input type="text" name="code_fournisseur" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
|
||||
print '</td><td>';
|
||||
$s=$modCodeFournisseur->getToolTip($langs,$object,1);
|
||||
print $form->textwithpicto('',$s,1);
|
||||
@ -1137,7 +1137,7 @@ else
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.fieldLabel('VATIntra','intra_vat').'</td>';
|
||||
print '<td class="nowrap">';
|
||||
$s = '<input type="text" class="flat" name="tva_intra" id="intra_vat" size="12" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
$s = '<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
@ -1220,7 +1220,7 @@ else
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
print '<tr><td>'.fieldLabel('DefaultLang','default_lang').'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
|
||||
print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1);
|
||||
print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1,0,0,'maxwidth200onsmartphone');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1510,11 +1510,11 @@ else
|
||||
|
||||
// Name
|
||||
print '<tr><td class="titlefield">'.fieldLabel('ThirdPartyName','name',1).'</td>';
|
||||
print '<td colspan="3"><input type="text" size="60" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
|
||||
|
||||
// Alias names (commercial, trademark or alias names)
|
||||
print '<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
|
||||
print '<td colspan="3"><input type="text" size="60" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag($object->name_alias).'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag($object->name_alias).'"></td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
@ -1694,7 +1694,7 @@ else
|
||||
// VAT Code
|
||||
print '<td>'.fieldLabel('VATIntra','intra_vat').'</td>';
|
||||
print '<td>';
|
||||
$s ='<input type="text" class="flat" name="tva_intra" id="intra_vat" size="12" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
$s ='<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
@ -2040,7 +2040,7 @@ else
|
||||
{
|
||||
$s='';
|
||||
$s.=$object->tva_intra;
|
||||
$s.='<input type="hidden" id="tva_intra" name="tva_intra" size="12" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
$s.='<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
|
||||
@ -3973,8 +3973,12 @@ div.dataTables_length select {
|
||||
/* Select2 */
|
||||
/* ============================================================================== */
|
||||
|
||||
.select2-container-multi .select2-choices {
|
||||
background-image: none;
|
||||
}
|
||||
.select2-container .select2-choice {
|
||||
color: #000;
|
||||
border-radius: 0;
|
||||
}
|
||||
.selectoptiondisabledwhite {
|
||||
background: #FFFFFF !important;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user