mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°1408 - Fix import dashboard
This commit is contained in:
@@ -846,13 +846,11 @@ EOF
|
||||
if ($this->bCustomized)
|
||||
{
|
||||
$oRevert = new JSPopupMenuItem('UI:Dashboard:RevertConfirm', Dict::S('UI:Dashboard:Revert'),
|
||||
"if (confirm('".addslashes(Dict::S('UI:Dashboard:RevertConfirm'))."')) return RevertDashboard('{$this->sId}'); else return false");
|
||||
"if (confirm('".addslashes(Dict::S('UI:Dashboard:RevertConfirm'))."')) return RevertDashboard('{$this->sId}', $sJSExtraParams); else return false");
|
||||
$aActions[$oRevert->GetUID()] = $oRevert->GetMenuItem();
|
||||
}
|
||||
utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_DASHBOARD_ACTIONS, $this, $aActions);
|
||||
$sEditMenu .= $oPage->RenderPopupMenuItems($aActions);
|
||||
|
||||
|
||||
$sEditMenu = addslashes($sEditMenu);
|
||||
|
||||
$oPage->add_ready_script(
|
||||
@@ -874,12 +872,12 @@ function EditDashboard(sId, sDashboardFile, aExtraParams)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
function RevertDashboard(sId)
|
||||
function RevertDashboard(sId, aExtraParams)
|
||||
{
|
||||
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'revert_dashboard', dashboard_id: sId},
|
||||
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'revert_dashboard', dashboard_id: sId, extra_params: aExtraParams},
|
||||
function(data)
|
||||
{
|
||||
$('body').append(data);
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
return false;
|
||||
|
||||
@@ -1079,12 +1079,7 @@ class utils
|
||||
// $param is a DBObject
|
||||
$oObj = $param;
|
||||
$sOQL = "SELECT ".get_class($oObj)." WHERE id=".$oObj->GetKey();
|
||||
$oFilter = DBObjectSearch::FromOQL($sOQL);
|
||||
$sFilter = $oFilter->serialize();
|
||||
$sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage(get_class($oObj));
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sContext = $oAppContext->GetForLink();
|
||||
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/tabularfieldsselector.js');
|
||||
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.dragtable.js');
|
||||
$oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/dragtable.css');
|
||||
|
||||
@@ -347,6 +347,7 @@ $(function()
|
||||
function UploadDashboard(oOptions)
|
||||
{
|
||||
var sFileId = 'dashboard_upload_file';
|
||||
|
||||
var oDlg = $('<div id="dashboard_upload_dlg"><form><p>'+oOptions.text+'</p><p><input type="file" id="'+sFileId+'" name="dashboard_upload_file"></p></form></div>');
|
||||
$('body').append(oDlg);
|
||||
oOptions.file_id = sFileId;
|
||||
@@ -371,6 +372,7 @@ $(function()
|
||||
{
|
||||
dashboard_id: '',
|
||||
file_id: '',
|
||||
file: '',
|
||||
text: 'Select a dashboard file to import',
|
||||
title: 'Dahsboard Import',
|
||||
close_btn: 'Close',
|
||||
@@ -388,13 +390,13 @@ $(function()
|
||||
//me.onClose();
|
||||
};
|
||||
$('#'+this.options.file_id).fileupload({
|
||||
url: me.options.submit_to+'&id='+me.options.dashboard_id,
|
||||
url: me.options.submit_to+'&id='+me.options.dashboard_id+'&file='+me.options.file,
|
||||
dataType: 'json',
|
||||
pasteZone: null, // Don't accept files via Chrome's copy/paste
|
||||
done: function (e, data) {
|
||||
if(typeof(data.result.error) != 'undefined')
|
||||
if(typeof(data.result.error) !== 'undefined')
|
||||
{
|
||||
if(data.result.error != '')
|
||||
if(data.result.error !== '')
|
||||
{
|
||||
alert(data.result.error);
|
||||
me.element.dialog('close');
|
||||
|
||||
@@ -945,7 +945,7 @@ try
|
||||
}
|
||||
else
|
||||
{
|
||||
$aResult['error'] = 'Dashboard id="'.$sMenuId.'" not found.';
|
||||
$aResult['error'] = 'Dashboard id="'.$sDashboardId.'" not found.';
|
||||
}
|
||||
$oPage->add(json_encode($aResult));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user