Remove option MAIN_HTML5_PLACEHOLDER (on by default now)

This commit is contained in:
Laurent Destailleur 2017-11-01 10:09:39 +01:00
parent 4220d02dd4
commit f26d970d58
6 changed files with 114 additions and 127 deletions

View File

@ -35,6 +35,10 @@ function printBookmarksList($aDb, $aLangs)
$db = $aDb;
$langs = $aLangs;
$ret.= '<div class="menu_top"></div>'."\n";
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
@ -74,7 +78,7 @@ function printBookmarksList($aDb, $aLangs)
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page
if ($user->rights->bookmark->creer)
if (! empty($user->rights->bookmark->creer))
{
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
@ -95,7 +99,7 @@ function printBookmarksList($aDb, $aLangs)
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">';
//$ret.='<span class="fa fa-print">aa</span>';
$ret.=img_picto('','object_bookmark').' ';
$ret.=$obj->title;
$ret.=dol_escape_htmltag($obj->title);
$ret.='</option>';
$i++;
}
@ -139,7 +143,9 @@ function printBookmarksList($aDb, $aLangs)
}
});';
$ret.='})</script>';
$ret .= '<div class="menu_end"></div>';
}
$ret.= '<div class="menu_end"></div>'."\n";
return $ret;
}

View File

@ -3702,8 +3702,7 @@ abstract class CommonObject
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
else $placeholder=' title="'.$langs->trans("Label").'"';
$placeholder=' placeholder="'.$langs->trans("Label").'"';
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');

View File

@ -1010,8 +1010,7 @@ class Form
$out.='<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
$placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
$out.= img_picto($langs->trans("Search"), 'search');
}
@ -1818,8 +1817,7 @@ class Form
}
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
$placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
print img_picto($langs->trans("Search"), 'search');
}

View File

@ -927,10 +927,10 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
{
// escape quotes and backslashes, newlines, etc.
$tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html form content
$tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
if (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>''));
if (! $keepn) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n'));
return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html form content
return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags
}

View File

@ -77,9 +77,6 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
}
else
{
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
$usedbyinclude = 1; // Used into next include
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';

View File

@ -1618,7 +1618,6 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
$selected=-1;
$usedbyinclude=1;
include_once DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$conf->global->MAIN_HTML5_PLACEHOLDER=1;
foreach($arrayresult as $key => $val)
{
@ -1818,7 +1817,8 @@ function getHelpParamFor($helppagename,$langs)
/**
* Show a search area
* Show a search area.
* Used when the javascript quick search is not used.
*
* @param string $urlaction Url post
* @param string $urlobject Url of the link under the search box
@ -1832,7 +1832,7 @@ function getHelpParamFor($helppagename,$langs)
*/
function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='',$img='')
{
global $conf,$langs;
global $conf,$langs,$user;
if (empty($htmlinputid)) {
$htmlinputid = $htmlinputname;
@ -1840,26 +1840,13 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu
$ret='';
$ret.='<form action="'.$urlaction.'" method="post" class="searchform">';
if (empty($conf->global->MAIN_HTML5_PLACEHOLDER))
{
$ret.='<div class="menu_titre menu_titre_search"';
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' style="display: inline-block"';
$ret.='>';
$ret.='<label for="'.$prefhtmlinputname.$htmlinputname.'">';
$ret.='<a class="vsmenu" href="'.$urlobject.'">';
if ($img && ! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=$img;
else if ($img || $title) $ret.=$img.' '.$title;
$ret.='</a>';
$ret.='</label>';
$ret.='</div>';
}
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$ret.='<input type="hidden" name="mode" value="search">';
$ret.='<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
$ret.='<input type="text" class="flat '.$htmlmorecss.'"';
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
$ret.=' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
$ret.=($accesskey?' accesskey="'.$accesskey.'"':'');
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).'"';
$ret.=' placeholder="'.strip_tags($title).'"';
$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.="</form>\n";