2
0
forked from Wavyzz/dolibarr

Prepare feature "Never show this message again"

This commit is contained in:
Laurent Destailleur
2019-08-18 18:36:18 +02:00
parent 729340420f
commit 2f46b40da2
3 changed files with 21 additions and 9 deletions

View File

@@ -6398,16 +6398,25 @@ function setEventMessage($mesgs, $style = 'mesgs')
* @param string $mesg Message string
* @param array $mesgs Message array
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @param string $messagekey A key to be used to allow the feature "Never show this message again"
* @return void
* @see dol_htmloutput_events()
*/
function setEventMessages($mesg, $mesgs, $style = 'mesgs')
function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '')
{
if (empty($mesg) && empty($mesgs))
{
dol_syslog("Try to add a message in stack with empty message", LOG_WARNING);
}
else
{
if ($messagekey)
{
// Complete message with a js link to set a cookie "DOLHIDEMESSAGE".$messagekey;
// TODO
$mesg.='';
}
if (empty($messagekey) || empty($_COOKIE["DOLHIDEMESSAGE".$messagekey]))
{
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages');
if (empty($mesgs)) setEventMessage($mesg, $style);
@@ -6417,6 +6426,7 @@ function setEventMessages($mesg, $mesgs, $style = 'mesgs')
setEventMessage($mesgs, $style);
}
}
}
}
/**

View File

@@ -415,9 +415,11 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
if (defined('USEDOLIBARREDITOR'))
{
print '<div class="margintoponly marginleftonly">';
/*print '<div class="margintoponly marginleftonly">';
print "This page contains dynamic code that make a redirect to '".$containerref."' in your current context. Redirect has been canceled as it is not supported in edition mode.";
print '</div>';
print '</div>';*/
$text = "This page contains dynamic code that make a redirect to '".$containerref."' in your current context. Redirect has been canceled as it is not supported in edition mode.";
setEventMessages($text, null, 'warnings', 'WEBSITEREDIRECTDISABLED'.$containerref);
return;
}

View File

@@ -1969,8 +1969,8 @@ if (! GETPOST('hide_websitemenu'))
}
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ExportSite")).'" name="exportsite">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'"'.($atleastonepage?' disabled="disabled"':'').'>';