Debug v23, the cancel button was lost.
This commit is contained in:
parent
3dfdd0fbee
commit
71a090388b
4 changed files with 77 additions and 38 deletions
|
|
@ -1121,6 +1121,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
} else {
|
||||
// Module qualified for activation
|
||||
$warningmessage = '';
|
||||
$disableCancel = 0;
|
||||
|
||||
if (!empty($arrayofwarnings[$modName])) {
|
||||
$codeenabledisable .= '<!-- This module is a core module and it may have a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
|
||||
|
|
@ -1129,7 +1131,12 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
$cursorwarningmessage = array($cursorwarningmessage);
|
||||
}
|
||||
foreach ($cursorwarningmessage as $messagetoshow) {
|
||||
// TODO Use replacement instead of always adding param module name and country code to the string message
|
||||
if (preg_match('/:1$/', $messagetoshow)) {
|
||||
$disableCancel = 1;
|
||||
}
|
||||
$messagetoshow = preg_replace('/:1$/', '', $messagetoshow);
|
||||
|
||||
// TODO Use a replacement instead of always adding the module name and the country code to the string message ?
|
||||
$warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($messagetoshow, $objMod->getName(), $mysoc->country_code);
|
||||
}
|
||||
}
|
||||
|
|
@ -1167,7 +1174,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
$codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n";
|
||||
$codeenabledisable .= '<a class="reposition" id="idqualified'.$objMod->numero.'" data-alreadyclicked="0" href="'.$urltogo.'"';
|
||||
if ($warningmessage) {
|
||||
$codeenabledisable .= ' onclick="return confirmDolibarr(\''.dol_escape_js($warningmessage).'\', \'idqualified'.$objMod->numero.'\', '.$popupwidth.');"';
|
||||
$codeenabledisable .= ' onclick="return confirmDolibarr(\''.dol_escape_js($warningmessage).'\', \'idqualified'.$objMod->numero.'\', '.$popupwidth.', '.$disableCancel.');"';
|
||||
}
|
||||
$codeenabledisable .= '>';
|
||||
$codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
|
|
|
|||
|
|
@ -191,24 +191,24 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['<?php echo $langs->defaultlang ?>'] = {
|
||||
closeText: '<?php echo $langs->trans("Close2") ?>',
|
||||
prevText: '<?php echo $langs->trans("Previous") ?>',
|
||||
nextText: '<?php echo $langs->trans("Next") ?>',
|
||||
currentText: '<?php echo $langs->trans("Now") ?>',
|
||||
$.datepicker.regional['<?php echo dol_escape_js($langs->defaultlang) ?>'] = {
|
||||
closeText: '<?php echo dol_escape_js($langs->trans("Close2")) ?>',
|
||||
prevText: '<?php echo dol_escape_js($langs->trans("Previous")) ?>',
|
||||
nextText: '<?php echo dol_escape_js($langs->trans("Next")) ?>',
|
||||
currentText: '<?php echo dol_escape_js($langs->trans("Now")) ?>',
|
||||
monthNames: tradMonths,
|
||||
monthNamesShort: tradMonthsShort,
|
||||
dayNames: tradDays,
|
||||
dayNamesShort: tradDaysShort,
|
||||
dayNamesMin: tradDaysMin,
|
||||
weekHeader: '<?php echo $langs->trans("Week"); ?>',
|
||||
dateFormat: '<?php echo $langs->trans("FormatDateShortJQuery"); ?>', /* Note dd/mm/yy means year on 4 digit in jquery format */
|
||||
weekHeader: '<?php echo dol_escape_js($langs->trans("Week")); ?>',
|
||||
dateFormat: '<?php echo dol_escape_js($langs->trans("FormatDateShortJQuery")); ?>', /* Note dd/mm/yy means year on 4 digit in jquery format */
|
||||
firstDay: <?php echo getDolGlobalInt('MAIN_START_WEEK', 1); ?>,
|
||||
isRTL: <?php echo($langs->trans("DIRECTION") == 'rtl' ? 'true' : 'false'); ?>,
|
||||
showMonthAfterYear: false, /* TODO add specific to country */
|
||||
yearSuffix: '' /* TODO add specific to country */
|
||||
};
|
||||
$.datepicker.setDefaults($.datepicker.regional['<?php echo $langs->defaultlang ?>']);
|
||||
$.datepicker.setDefaults($.datepicker.regional['<?php echo dol_escape_js($langs->defaultlang) ?>']);
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -566,29 +566,49 @@ function cleanSerialize(expr) {
|
|||
|
||||
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: Fonction to open a confirm popup on a clie of a link
|
||||
* Purpose: Fonction to open a confirm popup on a click of a link
|
||||
* Input: msg
|
||||
* Input: width
|
||||
* Input: id
|
||||
* Input: popupWidth
|
||||
* Input: disableCancelButton
|
||||
* Licence: GPL
|
||||
* ==================================================================
|
||||
* See also document_preview() that also maje a dialogforpopup.dialog().
|
||||
* See also newpopup that use window.open.
|
||||
*/
|
||||
function confirmDolibarr(msg, id, width = 400) {
|
||||
let alink = document.getElementById(id);
|
||||
if (alink.getAttribute("data-alreadyclicked") === "0") {
|
||||
new Promise(res => {
|
||||
$("#dialogforpopup").text(msg).dialog({
|
||||
modal: true,
|
||||
width: width,
|
||||
buttons: {
|
||||
OK() { $(this).dialog("close"); res(false); alink.setAttribute("data-alreadyclicked", "1"); alink.click(); },
|
||||
}
|
||||
function confirmDolibarr(msg, id, popupWidth = 400, disableCancelButton = 0) {
|
||||
let alink = document.getElementById(id);
|
||||
let popupHeight = 200;
|
||||
let title = '<?php echo dol_escape_js($langs->trans("Note")); ?>';
|
||||
|
||||
if (alink.getAttribute("data-alreadyclicked") === "1") {
|
||||
return true;
|
||||
}
|
||||
|
||||
console.log("Call confirmDolibarr disableCancelButton="+disableCancelButton);
|
||||
|
||||
let buttons = {};
|
||||
if (disableCancelButton === 0) {
|
||||
buttons.Cancel = function () {
|
||||
$(this).dialog("close");
|
||||
};
|
||||
}
|
||||
buttons.OK = function () {
|
||||
console.log("We click OK"); $(this).dialog("close"); alink.setAttribute("data-alreadyclicked", "1"); alink.click(); return false;
|
||||
};
|
||||
|
||||
new Promise(res => {
|
||||
$("#dialogforpopup").text(msg).dialog({
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
modal: true,
|
||||
width: popupWidth,
|
||||
height: popupHeight,
|
||||
title: title,
|
||||
buttons: buttons
|
||||
});
|
||||
});
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1015,7 +1035,7 @@ function copyToClipboard(text,text2)
|
|||
* @param url Url
|
||||
* @param title Title of popup
|
||||
* @return boolean False
|
||||
* @see document_preview()
|
||||
* @see document_preview() and confirmDolibarr()
|
||||
*/
|
||||
function newpopup(url, title) {
|
||||
var argv = newpopup.arguments;
|
||||
|
|
@ -1040,7 +1060,8 @@ function newpopup(url, title) {
|
|||
* @param type Mime file type ("image/jpeg", "application/pdf", "text/html")
|
||||
* @param title Title of popup
|
||||
* @return void
|
||||
* @see newpopup()
|
||||
* @see also confirmDolibarr() that also make a dialogforpopup.dialog()
|
||||
* @see also newpopup()that use window.open
|
||||
*/
|
||||
function document_preview(file, type, title)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2738,9 +2738,10 @@ div.fiche {
|
|||
margin-<?php print $left; ?>: <?php print(GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '24' : '6')); ?>px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.page-modulehelp div.fiche {
|
||||
width: 100%;
|
||||
margin-left: 15px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
body.onlinepaymentbody div.fiche { /* For online payment page */
|
||||
margin: 20px !important;
|
||||
|
|
@ -2748,6 +2749,7 @@ body.onlinepaymentbody div.fiche { /* For online payment page */
|
|||
div.fiche>table:first-child {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
div.fichecenter {
|
||||
width: 100%;
|
||||
clear: both; /* This is to have div fichecenter that are true rectangles */
|
||||
|
|
@ -5922,7 +5924,10 @@ div#card-errors {
|
|||
/* Form confirmation (When Ajax JQuery is used) and Dialog popups */
|
||||
/* ============================================================================== */
|
||||
|
||||
.ui-dialog-titlebar {
|
||||
button.ui-button-icon-only.ui-dialog-titlebar-close {
|
||||
padding: 12px;
|
||||
margin-top: -15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.ui-dialog-content {
|
||||
margin-bottom: 10px; /* same than .ui-widget-header */
|
||||
|
|
@ -5950,13 +5955,10 @@ div#card-errors {
|
|||
border-bottom: 1px solid #AAA;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
button.ui-button-icon-only.ui-dialog-titlebar-close {
|
||||
padding: 12px;
|
||||
margin-top: -15px;
|
||||
}
|
||||
.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons.ui-draggable {
|
||||
box-shadow: 5px 5px 20px #AAA;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-buttonpane {
|
||||
padding: .5em 1em .3em .4em;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2822,6 +2822,12 @@ body.onlinepaymentbody div.fiche { /* For online payment page */
|
|||
div.fiche>table:first-child {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
.page-modulehelp div.fiche {
|
||||
width: 100%;
|
||||
margin-left: 15px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
div.fichecenter {
|
||||
width: 100%;
|
||||
clear: both; /* This is to have div fichecenter that are true rectangles */
|
||||
|
|
@ -5843,7 +5849,10 @@ div#card-errors {
|
|||
/* Form confirmation (When Ajax JQuery is used) and Dialog popups */
|
||||
/* ============================================================================== */
|
||||
|
||||
.ui-dialog-titlebar {
|
||||
button.ui-button-icon-only.ui-dialog-titlebar-close {
|
||||
padding: 12px;
|
||||
margin-top: -15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.ui-dialog-content {
|
||||
maring-bottom: 10px; /* same than .ui-widget-header */
|
||||
|
|
|
|||
Loading…
Reference in a new issue