mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 05:28:44 +02:00
N°3786 - Fix lock removal when leaving an object details page in edition
The main problem was WebPage::$a_scripts are now printed after the DOM when the mechanism actually prints some JS to redirect to another page immediately. As there are a LOT of calls to WebPage::add_script(), we kept it to ensure the compatibility; and we add a new WebPage::add_early_script() for JS snippets that explicitly need to be execute before the DOM interpretation.
This commit is contained in:
@@ -202,8 +202,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
||||
$sParams .= $sName.'='.urlencode($value).'&'; // Always add a trailing &
|
||||
}
|
||||
$sUrl = utils::GetAbsoluteUrlAppRoot().'pages/'.$oObj->GetUIPage().'?'.$sParams.'class='.get_class($oObj).'&id='.$oObj->getKey().'&'.$oAppContext->GetForLink().'&a=1';
|
||||
$oPage->add_script(
|
||||
<<<EOF
|
||||
$oPage->add_early_script(<<<JS
|
||||
if (!sessionStorage.getItem('$sSessionStorageKey'))
|
||||
{
|
||||
sessionStorage.setItem('$sSessionStorageKey', 1);
|
||||
@@ -213,7 +212,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
||||
{
|
||||
sessionStorage.removeItem('$sSessionStorageKey');
|
||||
}
|
||||
EOF
|
||||
JS
|
||||
);
|
||||
|
||||
$oObj->Reload();
|
||||
|
||||
Reference in New Issue
Block a user