Merge pull request #20378 from Hystepik/develop#4
Fix : website preview on closed status page
This commit is contained in:
commit
279b60dca6
@ -10118,19 +10118,19 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
* @param int $userRight user action right
|
* @param int $userRight user action right
|
||||||
* // phpcs:disable
|
* // phpcs:disable
|
||||||
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
|
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
|
||||||
* 'attr' => [ // to add or override button attributes
|
* 'attr' => [ // to add or override button attributes
|
||||||
* 'xxxxx' => '', // your xxxxx attribute you want
|
* 'xxxxx' => '', // your xxxxx attribute you want
|
||||||
* 'class' => '', // to add more css class to the button class attribute
|
* 'class' => '', // to add more css class to the button class attribute
|
||||||
* 'classOverride' => '' // to replace class attribute of the button
|
* 'classOverride' => '' // to replace class attribute of the button
|
||||||
* ],
|
* ],
|
||||||
* 'confirm' => [
|
* 'confirm' => [
|
||||||
* 'url' => 'http://', // Overide Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
|
* 'url' => 'http://', // Overide Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
|
||||||
* 'title' => '', // Overide title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
|
* 'title' => '', // Overide title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
|
||||||
* 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
|
* 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
|
||||||
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
|
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
|
||||||
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
|
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
|
||||||
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
|
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
|
||||||
* ],
|
* ],
|
||||||
* ]
|
* ]
|
||||||
* // phpcs:enable
|
* // phpcs:enable
|
||||||
* @return string html button
|
* @return string html button
|
||||||
@ -10563,7 +10563,7 @@ function isAFileWithExecutableContent($filename)
|
|||||||
*/
|
*/
|
||||||
function newToken()
|
function newToken()
|
||||||
{
|
{
|
||||||
return $_SESSION['newtoken'];
|
return empty($_SESSION['newtoken']) ? '' : $_SESSION['newtoken'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -27,6 +27,11 @@
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
|
||||||
|
$website = null;
|
||||||
|
$websitepage = null;
|
||||||
|
$weblangs = null;
|
||||||
|
$pagelangs = null;
|
||||||
|
|
||||||
// Detection browser (copy of code from main.inc.php)
|
// Detection browser (copy of code from main.inc.php)
|
||||||
if (isset($_SERVER["HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) {
|
if (isset($_SERVER["HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) {
|
||||||
$tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
|
$tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
|
||||||
@ -68,7 +73,7 @@ if ($pageid > 0) {
|
|||||||
$weblangs->setDefaultLang(GETPOSTISSET('lang') ? GETPOST('lang', 'aZ09') : (empty($_COOKIE['weblangs-shortcode']) ? 'auto' : preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['weblangs-shortcode'])));
|
$weblangs->setDefaultLang(GETPOSTISSET('lang') ? GETPOST('lang', 'aZ09') : (empty($_COOKIE['weblangs-shortcode']) ? 'auto' : preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['weblangs-shortcode'])));
|
||||||
$pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang);
|
$pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang);
|
||||||
|
|
||||||
if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status))) {
|
if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) {
|
||||||
$weblangs->load("website");
|
$weblangs->load("website");
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
print '<center><br><br>'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'</center>';
|
print '<center><br><br>'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'</center>';
|
||||||
|
|||||||
@ -2520,6 +2520,7 @@ $form = new Form($db);
|
|||||||
$formadmin = new FormAdmin($db);
|
$formadmin = new FormAdmin($db);
|
||||||
$formwebsite = new FormWebsite($db);
|
$formwebsite = new FormWebsite($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
$formconfirm = "";
|
||||||
|
|
||||||
// Confirm generation of website sitemaps
|
// Confirm generation of website sitemaps
|
||||||
if ($action == 'confirmgeneratesitemaps') {
|
if ($action == 'confirmgeneratesitemaps') {
|
||||||
@ -3040,7 +3041,7 @@ if (!GETPOST('hide_websitemenu')) {
|
|||||||
print '<!-- Code to enabled edit inline ckeditor -->'."\n";
|
print '<!-- Code to enabled edit inline ckeditor -->'."\n";
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var isEditingEnabled = '.($conf->global->WEBSITE_EDITINLINE ? 'true' : 'false').';
|
var isEditingEnabled = '.(getDolGlobalString("WEBSITE_EDITINLINE") ? 'true' : 'false').';
|
||||||
if (isEditingEnabled)
|
if (isEditingEnabled)
|
||||||
{
|
{
|
||||||
switchEditorOnline(true);
|
switchEditorOnline(true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user