$sMenuId = utils::ReadParam('id', '', false, 'raw_data'); ApplicationMenu::LoadAdditionalMenus(); $index = ApplicationMenu::GetMenuIndexById($sMenuId); $oMenu = ApplicationMenu::GetMenuNode($index); if ($oMenu instanceof DashboardMenuNode) { $oDashboard = $oMenu->GetDashboard(); $oPage->TrashUnexpectedOutput(); $oPage->SetContentType('text/xml'); $oPage->SetContentDisposition('attachment', $oMenu->GetLabel() . '.xml'); $oPage->add($oDashboard->ToXml()); } break; case 'import_dashboard': $sMenuId = utils::ReadParam('id', '', false, 'raw_data'); ApplicationMenu::LoadAdditionalMenus(); $index = ApplicationMenu::GetMenuIndexById($sMenuId); $oMenu = ApplicationMenu::GetMenuNode($index); $aResult = array('error' => ''); try { if ($oMenu instanceof DashboardMenuNode) { $oDoc = utils::ReadPostedDocument('dashboard_upload_file'); $oDashboard = $oMenu->GetDashboard(); $oDashboard->FromXml($oDoc->GetData()); $oDashboard->Save(); } else { $aResult['error'] = 'Dashboard id="' . $sMenuId . '" not found.'; } } catch (DOMException $e) { $aResult = array('error' => Dict::S('UI:Error:InvalidDashboardFile')); } catch (Exception $e) { $aResult = array('error' => $e->getMessage());
} $oP->SetCurrentTab(''); break; /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// case 'cancel': // An action was cancelled $oP->set_title(Dict::S('UI:OperationCancelled')); $oP->add('<h1>' . Dict::S('UI:OperationCancelled') . '</h1>'); break; /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// default: // Menu node rendering (templates) ApplicationMenu::LoadAdditionalMenus(); $oMenuNode = ApplicationMenu::GetMenuNode(ApplicationMenu::GetMenuIndexById(ApplicationMenu::GetActiveNodeId())); if (is_object($oMenuNode)) { $oMenuNode->RenderContent($oP, $oAppContext->GetAsHash()); $oP->set_title($oMenuNode->GetLabel()); } /////////////////////////////////////////////////////////////////////////////////////////// } DisplayWelcomePopup($oP); $oP->output(); } catch (CoreException $e) { require_once APPROOT . '/setup/setuppage.class.inc.php'; $oP = new SetupPage(Dict::S('UI:PageTitle:FatalError')); if ($e instanceof SecurityException) { $oP->add("<h1>" . Dict::S('UI:SystemIntrusion') . "</h1>\n"); } else { $oP->add("<h1>" . Dict::S('UI:FatalErrorMessage') . "</h1>\n");