mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-6653-Error-enlace-publico-en-Consolas-Visuales-linkadas' into 'develop'
fix public view link remove hash See merge request artica/pandorafms!3639
This commit is contained in:
commit
8d7ac33cf1
@ -88,6 +88,7 @@ final class Container extends Model
|
|||||||
'height' => (int) $data['height'],
|
'height' => (int) $data['height'],
|
||||||
'backgroundURL' => static::extractBackgroundUrl($data),
|
'backgroundURL' => static::extractBackgroundUrl($data),
|
||||||
'relationLineWidth' => (int) $data['relationLineWidth'],
|
'relationLineWidth' => (int) $data['relationLineWidth'],
|
||||||
|
'hash' => static::extractHash($data),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +199,22 @@ final class Container extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a hash.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return mixed String representing hash (not empty) or null.
|
||||||
|
*/
|
||||||
|
private static function extractHash(array $data)
|
||||||
|
{
|
||||||
|
return static::notEmptyStringOr(
|
||||||
|
static::issetInArray($data, ['hash']),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a background color value.
|
* Extract a background color value.
|
||||||
*
|
*
|
||||||
@ -279,6 +296,10 @@ final class Container extends Model
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$row['hash'] = md5(
|
||||||
|
$config['dbpass'].$row['id'].$config['id_user']
|
||||||
|
);
|
||||||
|
|
||||||
return \io_safe_output($row);
|
return \io_safe_output($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +178,22 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
var handleUpdate = function (prevProps, newProps) {
|
var handleUpdate = function (prevProps, newProps) {
|
||||||
if (!newProps) return;
|
if (!newProps) return;
|
||||||
|
|
||||||
|
//Remove spinner change VC.
|
||||||
|
document
|
||||||
|
.getElementById("visual-console-container")
|
||||||
|
.classList.remove("is-updating");
|
||||||
|
|
||||||
|
var div = document
|
||||||
|
.getElementById("visual-console-container")
|
||||||
|
.querySelector(".div-visual-console-spinner");
|
||||||
|
|
||||||
|
if (div !== null) {
|
||||||
|
var parent = div.parentElement;
|
||||||
|
if (parent !== null) {
|
||||||
|
parent.removeChild(div);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Change the background color when the fullscreen mode is enabled.
|
// Change the background color when the fullscreen mode is enabled.
|
||||||
if (prevProps
|
if (prevProps
|
||||||
&& prevProps.backgroundColor != newProps.backgroundColor
|
&& prevProps.backgroundColor != newProps.backgroundColor
|
||||||
@ -201,17 +217,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
|
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
|
||||||
var replacement = '$1' + newProps.id + '$2';
|
var replacement = '$1' + newProps.id + '$2';
|
||||||
|
|
||||||
|
var regex_hash = /(hash=)[^&]+(&?)/gi;
|
||||||
|
var replacement_hash = '$1' + newProps.hash + '$2';
|
||||||
// Tab links.
|
// Tab links.
|
||||||
var menuLinks = document.querySelectorAll("div#menu_tab a");
|
var menuLinks = document.querySelectorAll("div#menu_tab a");
|
||||||
if (menuLinks !== null) {
|
if (menuLinks !== null) {
|
||||||
menuLinks.forEach(function (menuLink) {
|
menuLinks.forEach(function (menuLink) {
|
||||||
menuLink.href = menuLink.href.replace(regex, replacement);
|
menuLink.href = menuLink.href.replace(regex, replacement);
|
||||||
|
menuLink.href = menuLink.href.replace(
|
||||||
|
regex_hash,
|
||||||
|
replacement_hash
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the URL (if the browser has support).
|
// Change the URL (if the browser has support).
|
||||||
if ("history" in window) {
|
if ("history" in window) {
|
||||||
var href = window.location.href.replace(regex, replacement);
|
var href = window.location.href.replace(regex, replacement);
|
||||||
|
href = href.replace(regex_hash, replacement_hash);
|
||||||
window.history.replaceState({}, document.title, href);
|
window.history.replaceState({}, document.title, href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,11 +470,17 @@ ui_require_css_file('form');
|
|||||||
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
|
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
|
||||||
var replacement = '$1' + newProps.id + '$2';
|
var replacement = '$1' + newProps.id + '$2';
|
||||||
|
|
||||||
|
var regex_hash = /(hash=)[^&]+(&?)/gi;
|
||||||
|
var replacement_hash = '$1' + newProps.hash + '$2';
|
||||||
// Tab links.
|
// Tab links.
|
||||||
var menuLinks = document.querySelectorAll("div#menu_tab a");
|
var menuLinks = document.querySelectorAll("div#menu_tab a");
|
||||||
if (menuLinks !== null) {
|
if (menuLinks !== null) {
|
||||||
menuLinks.forEach(function (menuLink) {
|
menuLinks.forEach(function (menuLink) {
|
||||||
menuLink.href = menuLink.href.replace(regex, replacement);
|
menuLink.href = menuLink.href.replace(regex, replacement);
|
||||||
|
menuLink.href = menuLink.href.replace(
|
||||||
|
regex_hash,
|
||||||
|
replacement_hash
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +493,7 @@ ui_require_css_file('form');
|
|||||||
// Change the URL (if the browser has support).
|
// Change the URL (if the browser has support).
|
||||||
if ("history" in window) {
|
if ("history" in window) {
|
||||||
var href = window.location.href.replace(regex, replacement);
|
var href = window.location.href.replace(regex, replacement);
|
||||||
|
href = href.replace(regex_hash, replacement_hash);
|
||||||
window.history.replaceState({}, document.title, href);
|
window.history.replaceState({}, document.title, href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user