Enhance look for left menu seach form when HTML5 is on

This commit is contained in:
Laurent Destailleur 2015-06-16 13:09:46 +02:00
parent fb1a3f3ea3
commit a52be15722
2 changed files with 18 additions and 11 deletions

View File

@ -1526,33 +1526,33 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{ {
$langs->load("companies"); $langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt'); $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company'));
} }
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{ {
$langs->load("companies"); $langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc'); $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc', img_object('','contact'));
} }
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{ {
$langs->load("products"); $langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp'); $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
} }
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled) if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled)
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER)) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER))
{ {
$langs->load("products"); $langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts'); $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', $langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts', img_object('','product'));
} }
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{ {
$langs->load("members"); $langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm'); $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
} }
// Execute hook printSearchForm // Execute hook printSearchForm
@ -1797,9 +1797,10 @@ function getHelpParamFor($helppagename,$langs)
* @param string $htmlinputname Field Name input form * @param string $htmlinputname Field Name input form
* @param string $accesskey Accesskey * @param string $accesskey Accesskey
* @param string $idname Complement for id to avoid multiple same id in the page * @param string $idname Complement for id to avoid multiple same id in the page
* @param string $img Image to use
* @return string * @return string
*/ */
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='') function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='',$img='')
{ {
global $conf,$langs; global $conf,$langs;
@ -1809,10 +1810,13 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput
$ret=''; $ret='';
$ret.='<form action="'.$urlaction.'" method="post">'; $ret.='<form action="'.$urlaction.'" method="post">';
$ret.='<div class="menu_titre menu_titre_search">'; $ret.='<div class="menu_titre menu_titre_search"';
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' style="display: inline-block"';
$ret.='>';
$ret.='<label for="'.$idname.$htmlinputname.'">'; $ret.='<label for="'.$idname.$htmlinputname.'">';
$ret.='<a class="vsmenu" href="'.$urlobject.'">'; $ret.='<a class="vsmenu" href="'.$urlobject.'">';
$ret.=$title; if ($img && ! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=$img;
else $ret.=$img.' '.$title;
$ret.='</a>'; $ret.='</a>';
$ret.='</label>'; $ret.='</label>';
$ret.='</div>'; $ret.='</div>';
@ -1821,7 +1825,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput
$ret.='<input type="hidden" name="mode_search" value="'.$htmlmodesearch.'">'; $ret.='<input type="hidden" name="mode_search" value="'.$htmlmodesearch.'">';
$ret.='<input type="text" class="flat"'; $ret.='<input type="text" class="flat"';
$ret.=($accesskey?' accesskey="'.$accesskey.'"':''); $ret.=($accesskey?' accesskey="'.$accesskey.'"':'');
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' placeholder="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' placeholder="'.strip_tags($title).'"'; // Will work only if MAIN_HTML5_PLACEHOLDER is set to 1
else $ret.=' title="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; else $ret.=' title="'.$langs->trans("SearchOf").''.strip_tags($title).'"';
$ret.=' name="'.$htmlinputname.'" id="'.$idname.$htmlinputname.'" size="10" />'; $ret.=' name="'.$htmlinputname.'" id="'.$idname.$htmlinputname.'" size="10" />';
$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">'; $ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">';

View File

@ -1096,7 +1096,7 @@ div.blockvmenusearch
color: #000000; color: #000000;
text-align: <?php print $left; ?>; text-align: <?php print $left; ?>;
text-decoration: none; text-decoration: none;
padding-left: 5px; padding-left: 0px;
padding-right: 1px; padding-right: 1px;
padding-top: 3px; padding-top: 3px;
padding-bottom: 3px; padding-bottom: 3px;
@ -1115,9 +1115,12 @@ div.blockvmenusearch
} }
div.blockvmenusearch > form > div { div.blockvmenusearch > form > div {
/* min-height: 40px; */ /* min-height: 40px; */
padding-top: 3px; padding-top: 3px;
} }
div.blockvmenusearch > form > div > label {
padding-right: 2px;
}
div.blockvmenuhelp div.blockvmenuhelp
{ {