mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Remove option MAIN_HTML5_PLACEHOLDER (on by default now)
This commit is contained in:
parent
4220d02dd4
commit
f26d970d58
|
|
@ -35,111 +35,117 @@ function printBookmarksList($aDb, $aLangs)
|
|||
$db = $aDb;
|
||||
$langs = $aLangs;
|
||||
|
||||
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;
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
|
||||
// Menu bookmark
|
||||
$ret.= '<div class="menu_top"></div>'."\n";
|
||||
|
||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||
$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)
|
||||
{
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
||||
$sql.= " ORDER BY position";
|
||||
if ($resql = $db->query($sql) )
|
||||
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;
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$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.='</option>';
|
||||
$i++;
|
||||
}
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
|
||||
// Menu bookmark
|
||||
$ret.= '<div class="menu_top"></div>'."\n";
|
||||
|
||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||
$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 (! empty($user->rights->bookmark->creer))
|
||||
{
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
||||
$sql.= " ORDER BY position";
|
||||
if ($resql = $db->query($sql) )
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$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.=dol_escape_htmltag($obj->title);
|
||||
$ret.='</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$ret.= '</select>';
|
||||
$ret.= '</form>';
|
||||
|
||||
$ret.=ajax_combobox('boxbookmark');
|
||||
|
||||
$ret.='<script type="text/javascript">
|
||||
$(document).ready(function () {';
|
||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
||||
|
||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
||||
|
||||
// Method is POST for internal link, GET for external
|
||||
if (urlselected.startsWith(\'http\'))
|
||||
{
|
||||
var newmethod=\'GET\';
|
||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
||||
console.log("We change method to newmethod="+newmethod);
|
||||
jQuery("#actionbookmark").submit();
|
||||
console.log("We restore method to POST");
|
||||
jQuery("form#actionbookmark").attr("method", \'POST\');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#actionbookmark").submit();
|
||||
}
|
||||
});';
|
||||
$ret.='})</script>';
|
||||
}
|
||||
|
||||
$ret.= '</select>';
|
||||
$ret.= '</form>';
|
||||
|
||||
$ret.=ajax_combobox('boxbookmark');
|
||||
|
||||
$ret.='<script type="text/javascript">
|
||||
$(document).ready(function () {';
|
||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
||||
|
||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
||||
|
||||
// Method is POST for internal link, GET for external
|
||||
if (urlselected.startsWith(\'http\'))
|
||||
{
|
||||
var newmethod=\'GET\';
|
||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
||||
console.log("We change method to newmethod="+newmethod);
|
||||
jQuery("#actionbookmark").submit();
|
||||
console.log("We restore method to POST");
|
||||
jQuery("form#actionbookmark").attr("method", \'POST\');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#actionbookmark").submit();
|
||||
}
|
||||
});';
|
||||
$ret.='})</script>';
|
||||
$ret .= '<div class="menu_end"></div>';
|
||||
$ret.= '<div class="menu_end"></div>'."\n";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4952,7 +4952,7 @@ function picto_required()
|
|||
*/
|
||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
$pattern = "/<[^<>]+>/";
|
||||
$stringtoclean = preg_replace('/<br[^>]*>/', "\n", $stringtoclean);
|
||||
$temp = dol_html_entity_decode($stringtoclean,ENT_COMPAT,$pagecodeto);
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user