mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°4938 - Fix background calls broken by lazy JS dictionaries loads
This commit is contained in:
@@ -65,6 +65,9 @@ try
|
||||
switch ($sOperation)
|
||||
{
|
||||
case 'add':
|
||||
$oPage = new JsonPage();
|
||||
$oPage->SetOutputDataOnly(true);
|
||||
|
||||
$aResult = array(
|
||||
'error' => '',
|
||||
'att_id' => 0,
|
||||
@@ -111,7 +114,7 @@ try
|
||||
$aResult['error'] = $e->GetMessage();
|
||||
}
|
||||
}
|
||||
$oPage->add(json_encode($aResult));
|
||||
$oPage->SetData($aResult);
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
|
||||
@@ -2060,10 +2060,14 @@ EOF
|
||||
break;
|
||||
|
||||
case 'export_build':
|
||||
$oPage = new JsonPage();
|
||||
$oPage->SetOutputDataOnly(true);
|
||||
$oAjaxRenderController->ExportBuild($oPage, false);
|
||||
break;
|
||||
|
||||
case 'export_build_portal':
|
||||
$oPage = new JsonPage();
|
||||
$oPage->SetOutputDataOnly(true);
|
||||
$oAjaxRenderController->ExportBuild($oPage, true);
|
||||
break;
|
||||
|
||||
@@ -2652,7 +2656,8 @@ EOF
|
||||
// Navigation menu
|
||||
//--------------------------------
|
||||
case 'get_menus_count':
|
||||
|
||||
$oPage = new JsonPage();
|
||||
$oPage->SetOutputDataOnly(true);
|
||||
$oAjaxRenderController->GetMenusCount($oPage);
|
||||
break;
|
||||
|
||||
|
||||
@@ -123,12 +123,12 @@ class AjaxRenderController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \AjaxPage $oPage
|
||||
* @param \JsonPage $oPage
|
||||
* @param bool $bTokenOnly
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function ExportBuild(AjaxPage $oPage, $bTokenOnly)
|
||||
public static function ExportBuild(JsonPage $oPage, $bTokenOnly)
|
||||
{
|
||||
register_shutdown_function(function () {
|
||||
$aErr = error_get_last();
|
||||
@@ -208,13 +208,13 @@ class AjaxRenderController
|
||||
$aResult['message'] = Dict::Format('Core:BulkExport:ClickHereToDownload_FileName', $oExporter->GetDownloadFileName());
|
||||
}
|
||||
}
|
||||
$oPage->add(json_encode($aResult));
|
||||
$oPage->SetData($aResult);
|
||||
} catch (BulkExportException $e) {
|
||||
$aResult = array('code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->GetLocalizedMessage()));
|
||||
$oPage->add(json_encode($aResult));
|
||||
$oPage->SetData($aResult);
|
||||
} catch (Exception $e) {
|
||||
$aResult = array('code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->getMessage()));
|
||||
$oPage->add(json_encode($aResult));
|
||||
$oPage->SetData($aResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,13 +224,13 @@ class AjaxRenderController
|
||||
* The resulting JSON is added to the page with the format:
|
||||
* {"code": "done or error", "counts": {"menu_id_1": count1, "menu_id_2": count2...}}
|
||||
*
|
||||
* @param \AjaxPage $oPage
|
||||
* @param \JsonPage $oPage
|
||||
*/
|
||||
public function GetMenusCount(AjaxPage $oPage)
|
||||
public function GetMenusCount(JsonPage $oPage)
|
||||
{
|
||||
$aCounts = ApplicationMenu::GetMenusCount();
|
||||
$aResult = ['code' => 'done', 'counts' => $aCounts];
|
||||
$oPage->add(json_encode($aResult));
|
||||
$oPage->SetData($aResult);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user