示例#1
0
     $oShortcut->StartRenameDialog($oPage);
     break;
 case 'shortcut_rename_go':
     $iShortcut = utils::ReadParam('id', 0);
     $oShortcut = MetaModel::GetObject('Shortcut', $iShortcut);
     $sName = utils::ReadParam('attr_name', '', false, 'raw_data');
     if (strlen($sName) > 0) {
         $oShortcut->Set('name', $sName);
         $oShortcut->DBUpdate();
         $oPage->add_ready_script('window.location.reload();');
     }
     break;
 case 'shortcut_delete_go':
     $oSearch = new DBObjectSearch('Shortcut');
     $oSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
     $aShortcuts = utils::ReadMultipleSelection($oSearch);
     foreach ($aShortcuts as $iShortcut) {
         $oShortcut = MetaModel::GetObject('Shortcut', $iShortcut);
         $oShortcut->DBDelete();
         $oPage->add_ready_script('window.location.reload();');
     }
     break;
 case 'export_dashboard':
     $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');
示例#2
0
     $oP->add('<h1>' . MetaModel::GetClassIcon($sClass) . '&nbsp;' . $sActionLabel . '</h1>');
     $oP->add('</div>');
     $oChecker = new StimulusChecker($oFilter, $sState, $sStimulus);
     $aExtraFormParams = array('stimulus' => $sStimulus, 'state' => $sState);
     DisplayMultipleSelectionForm($oP, $oFilter, 'bulk_stimulus', $oChecker, $aExtraFormParams);
     break;
 case 'bulk_stimulus':
     $sFilter = utils::ReadParam('filter', '', false, 'raw_data');
     $sStimulus = utils::ReadParam('stimulus', '');
     $sState = utils::ReadParam('state', '');
     if (empty($sFilter) || empty($sStimulus) || empty($sState)) {
         throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state'));
     }
     $oFilter = DBObjectSearch::unserialize($sFilter);
     $sClass = $oFilter->GetClass();
     $aSelectObject = utils::ReadMultipleSelection($oFilter);
     if (count($aSelectObject) == 0) {
         // Nothing to do, no object was selected !
         throw new ApplicationException(Dict::S('UI:BulkAction:NoObjectSelected'));
     } else {
         $aTransitions = MetaModel::EnumTransitions($sClass, $sState);
         $aStimuli = MetaModel::EnumStimuli($sClass);
         $sActionLabel = $aStimuli[$sStimulus]->GetLabel();
         $sActionDetails = $aStimuli[$sStimulus]->GetDescription();
         $aTransition = $aTransitions[$sStimulus];
         $sTargetState = $aTransition['target_state'];
         $aStates = MetaModel::EnumStates($sClass);
         $aTargetStateDef = $aStates[$sTargetState];
         $oP->set_title(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass));
         $oP->add('<div class="page_header">');
         $oP->add('<h1>' . MetaModel::GetClassIcon($sClass) . '&nbsp;' . Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass) . '</h1>');
 public function DoAddObjects(WebPage $oP, $oFullSetFilter)
 {
     $aLinkedObjectIds = utils::ReadMultipleSelection($oFullSetFilter);
     foreach ($aLinkedObjectIds as $iObjectId) {
         $oLinkObj = MetaModel::GetObject($this->sLinkedClass, $iObjectId);
         $oP->add($this->GetObjectRow($oP, $oLinkObj, $oLinkObj->GetKey()));
     }
 }
 public function DoAddObjects(WebPage $oP, $oFullSetFilter, $oCurrentObj)
 {
     $aLinkedObjectIds = utils::ReadMultipleSelection($oFullSetFilter);
     foreach ($aLinkedObjectIds as $iObjectId) {
         $oLinkedObj = MetaModel::GetObject($this->m_sRemoteClass, $iObjectId);
         if (is_object($oLinkedObj)) {
             $aRow = $this->GetFormRow($oP, $oLinkedObj, -$iObjectId, array(), $oCurrentObj);
             // Not yet created link get negative Ids
             $oP->add($this->DisplayFormRow($oP, $this->m_aTableConfig, $aRow, -$iObjectId));
         } else {
             $oP->p(Dict::Format('UI:Error:Object_Class_Id_NotFound', $this->m_sLinkedClass, $iObjectId));
         }
     }
 }
示例#5
0
// Check user rights and prompt if needed
$iStep = utils::ReadParam('step', 1);
$oPage = new iTopWebPage(Dict::S('UI:Preferences'));
$sOperation = utils::ReadParam('operation', '');
try {
    switch ($sOperation) {
        case 'apply':
            $oFilter = DBObjectSearch::FromOQL('SELECT Organization');
            $sSelectionMode = utils::ReadParam('selectionMode', '');
            $aExceptions = utils::ReadParam('storedSelection', array());
            if ($sSelectionMode == 'negative' && count($aExceptions) == 0) {
                // All Orgs selected
                appUserPreferences::SetPref('favorite_orgs', null);
            } else {
                // Some organizations selected... store them
                $aSelectOrgs = utils::ReadMultipleSelection($oFilter);
                appUserPreferences::SetPref('favorite_orgs', $aSelectOrgs);
            }
            DisplayPreferences($oPage);
            break;
        case 'apply_language':
            $sLangCode = utils::ReadParam('language', 'EN US');
            $oUser = UserRights::GetUserObject();
            $oUser->Set('language', $sLangCode);
            $oUser->DBUpdate();
            // Redirect to force a reload/display of the page with the new language
            $oAppContext = new ApplicationContext();
            $sURL = utils::GetAbsoluteUrlAppRoot() . 'pages/preferences.php?' . $oAppContext->GetForLink();
            $oPage->add_header('Location: ' . $sURL);
            break;
        case 'apply_others':