Fix look and feel v9 (autofocus)

This commit is contained in:
Laurent Destailleur 2018-12-28 00:41:05 +01:00
parent 9842f50942
commit 3cd91d7c66
2 changed files with 8 additions and 3 deletions

View File

@ -81,6 +81,7 @@ else
$showtitlebefore = GETPOST('showtitlebefore','int');
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$i=0;
$accesskeyalreadyassigned=array();
foreach($arrayresult as $key => $val)
{
@ -94,7 +95,9 @@ else
$accesskey=$val['label'][0];
$accesskeyalreadyassigned[$accesskey]=$accesskey;
}
$searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore);
$searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore, ($i>0?0:1));
$i++;
}
}

View File

@ -1740,7 +1740,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax))
{
$urltosearch=DOL_URL_ROOT.'/core/search_page.php?showtitlebefore=1';
$searchform='<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
$searchform='<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" accesskey="s" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
}
elseif ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_USE_OLD_SEARCH_FORM))
{
@ -1935,9 +1935,10 @@ function getHelpParamFor($helppagename,$langs)
* @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page
* @param string $img Image to use
* @param string $showtitlebefore Show title before input text instead of into placeholder. This can be set when output is dedicated for text browsers.
* @param string $autofocus Set autofocus on field
* @return string
*/
function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='',$img='', $showtitlebefore=0)
function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='',$img='', $showtitlebefore=0, $autofocus=0)
{
global $conf,$langs,$user;
@ -1951,6 +1952,7 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu
$ret.=' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
$ret.=($accesskey?' accesskey="'.$accesskey.'"':'');
$ret.=' placeholder="'.strip_tags($title).'"';
$ret.=($autofocus?' autofocus':'');
$ret.=' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
//$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">';
$ret.='<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';