Look and feel v14 - Use placeholder on combolists

This commit is contained in:
Laurent Destailleur 2021-02-06 00:05:24 +01:00
parent 67df1e1b94
commit f0e1c02caa
7 changed files with 54 additions and 47 deletions

View File

@ -263,7 +263,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Category

View File

@ -271,7 +271,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Category

View File

@ -264,7 +264,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';

View File

@ -6431,7 +6431,7 @@ class Form
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))
* @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is the text if it is a placeholder string), <0 to add an empty value with key that is this value.
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or '&nbsp;', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 to show key into label with format "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container

View File

@ -332,13 +332,13 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
* @param int $showempty Add also an empty line
* @param string $morecss More CSS
* @return string Html combo list code
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
* @param int|string $showempty Add also an empty line
* @param string $morecss More CSS
* @return string Html combo list code
* @see select_all_categories()
*/
public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
@ -368,7 +368,13 @@ class FormOther
// Print a select with each of them
$moreforfilter .= '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $moreforfilter .= '<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
if ($showempty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
if (!is_numeric($showempty)) $textforempty = $showempty;
$moreforfilter .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
//$moreforfilter .= '<option value="0" '.($moreparamonempty ? $moreparamonempty.' ' : '').' class="optiongrey">'.(is_numeric($showempty) ? '&nbsp;' : $showempty).'</option>'; // Should use -1 to say nothing
}
if (is_array($tab_categs))
{
@ -394,14 +400,14 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int $showempty 1=show also an empty value
* @param string $morecss More CSS
* @param int $norepresentative Show also an entry "Not categorized"
* @return string Html combo list code
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int|string $showempty 1=show also an empty value
* @param string $morecss More CSS
* @param int $norepresentative Show also an entry "Not categorized"
* @return string Html combo list code
*/
public function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0)
{
@ -427,7 +433,12 @@ class FormOther
// Select each sales and print them in a select input
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $out .= '<option value="0">&nbsp;</option>';
if ($showempty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
if (!is_numeric($showempty)) $textforempty = $showempty;
$out .= '<option class="optiongrey" value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
}
// Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut as status, u.login, u.photo, u.gender, u.entity, u.admin";
@ -499,11 +510,7 @@ class FormOther
$out .= '<option value="'.$obj_usr->rowid.'"';
if ($obj_usr->rowid == $selected) $out .= ' selected';
$out .= ' data-html="';
$outhtml = '';
if (!empty($obj_usr->photo))
{
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
}
$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '<strike class="opacitymediumxxx">';
$outhtml .= $labeltoshow;
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '</strike>';

View File

@ -65,29 +65,29 @@ print "jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover)) {
print 'jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
return $(this).prop("title"); /* To force to get title as is */
}
});'."\n";
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
return $(this).prop("title"); /* To force to get title as is */
}
});'."\n";
}
print '
jQuery(".classfortooltiponclicktext").dialog(
{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
jQuery(".classfortooltiponclicktext").dialog({
closeOnEscape: true, classes: { "ui-dialog": "highlight" },
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).',
modal: true,
autoOpen: false }).css("z-index: 5000");
autoOpen: false
}).css("z-index: 5000");
jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\'))
{
if ($(this).attr(\'dolid\')) {
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open");
return false;
return false;
}
});'."\n";

View File

@ -78,7 +78,7 @@ $search_zip = trim(GETPOST("search_zip", 'alpha'));
$search_state = trim(GETPOST("search_state", 'alpha'));
$search_region = trim(GETPOST("search_region", 'alpha'));
$search_email = trim(GETPOST('search_email', 'alpha'));
$search_phone = trim(GETPOST('search_phone', 'alpha'));
$search_phone = trim(GETPOST('search_phone', 'ahttps://wiki.dolibarr.org/index.php?title=Migrer_mon_Dolibarr_vers_une_offre_Cloudlpha'));
$search_fax = trim(GETPOST('search_fax', 'alpha'));
$search_url = trim(GETPOST('search_url', 'alpha'));
$search_idprof1 = trim(GETPOST('search_idprof1', 'alpha'));
@ -444,7 +444,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) $sql .= " AND s.rowi
if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
if ($search_sale == -2) $sql .= " AND sc.fk_user IS NULL";
elseif ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
elseif ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup);
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
@ -682,7 +682,7 @@ if (empty($type) || $type == 'c' || $type == 'p')
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= img_picto('', 'category', 'class="pictofixedwidth"');
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort'));
$moreforfilter .= '</div>';
}
@ -693,8 +693,8 @@ if (empty($type) || $type == 'f')
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('SuppliersCategoriesShort').': ';
$moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1);
$moreforfilter .= img_picto('', 'category', 'class="pictofixedwidth"');
$moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1, $langs->trans('SuppliersCategoriesShort'));
$moreforfilter .= '</div>';
}
}
@ -703,8 +703,8 @@ if (empty($type) || $type == 'f')
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('SalesRepresentatives').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300', 1);
$moreforfilter .= img_picto('', 'user', 'class="pictofixedwidth"');
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $langs->trans('SalesRepresentatives'), 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if ($moreforfilter)