2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' into dolibarr_fixbugs

This commit is contained in:
NextGestion
2023-05-02 17:09:02 +01:00
committed by GitHub
6560 changed files with 361172 additions and 115343 deletions

View File

@@ -65,38 +65,83 @@ if (empty($dolibarr_nocache)) {
// Wrapper to show tooltips (html or onclick popup)
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
print "jQuery(document).ready(function () {\n";
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */
jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover)) {
print 'jQuery(".classfortooltip").tooltip({
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";
console.log("Return title for popup");
return $(this).prop("title"); /* To force to get title as is */
}
});
var opendelay = 80;
var elemtostoretooltiptimer = jQuery("#dialogforpopup");
var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
target = jQuery(".classforajaxtooltip");
target.tooltip({
tooltipClass: "mytooltip",
show: { collision: "flipfit", effect:"toggle", delay: 0, duration: 20 },
hide: { delay: 250, duration: 20 }
});
target.off("mouseover mouseout");
target.on("mouseover", function(event) {
console.log("we will create timer for ajax call");
var params = JSON.parse($(this).attr("data-params"));
params.token = currenttoken;
var elemfortooltip = $(this);
event.stopImmediatePropagation();
clearTimeout(elemtostoretooltiptimer.data("openTimeoutId"));
elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() {
target.tooltip("close");
$.ajax({
url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php",
type: "post",
async: true,
data: params,
success: function(response){
// Setting content option
console.log("ajax success");
elemfortooltip.tooltip("option","content",response);
elemfortooltip.tooltip("open");
}
});
}, opendelay));
});
target.on("mouseout", function(event) {
console.log("mouse out");
event.stopImmediatePropagation();
clearTimeout(elemtostoretooltiptimer.data("openTimeoutId"));
target.tooltip("close");
});
';
}
print '
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");
jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\')) {
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open");
return false;
}
});'."\n";
print "});\n";
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");
jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\')) {
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open");
return false;
}
});
});
';
// Wrapper to manage dropdown
@@ -111,6 +156,7 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) {
setTimeout(() => { $(\'.inputsearch_dropdownselectedfields\').focus(); }, 200);
//$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
$(".ulselectedfields").removeClass("open");
$(this).parent().parent().find(\'dd ul\').toggleClass("open");
if ($(this).parent().parent().find(\'dd ul\').hasClass("open")) {
@@ -284,11 +330,12 @@ print '
jQuery(document).ready(function() {
jQuery(".cssforclicktodial").click(function() {
event.preventDefault();
console.log("We click on a cssforclicktodial class with url="+this.href);
var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
console.log("We click on a cssforclicktodial class with href="+this.href);
$.ajax({
url: this.href,
type: \'GET\',
data: { token: \''.newToken().'\' }
data: { token: currenttoken }
}).done(function(xhr, textStatus, errorThrown) {
/* do nothing */
}).fail(function(xhr, textStatus, errorThrown) {