Example #1
0
 protected function process_config()
 {
     //init here
     $this->_disp->InitConf();
     $this->loadConfig();
     $confdata = $this->getConfData($this->_disp);
     $needTrim = 0;
     $tblDef = DTblDef::GetInstance();
     $disp_act = $this->_disp->Get(DInfo::FLD_ACT);
     if ($disp_act == 's') {
         $validator = new ConfValidation();
         $extracted = $validator->ExtractPost($this->_disp);
         if ($extracted->HasErr()) {
             $this->_disp->Set(DInfo::FLD_ACT, 'S');
             $this->_disp->Set(DInfo::FLD_TopMsg, $extracted->Get(CNode::FLD_ERR));
             return $extracted;
         } else {
             $confdata->SavePost($extracted, $this->_disp);
             $this->setChanged(true);
             $needTrim = 2;
         }
     } elseif ($disp_act == 'a') {
         $added = new CNode(CNode::K_EXTRACTED, '');
         return $added;
     } elseif ($disp_act == 'c' || $disp_act == 'n') {
         // 'c': change, 'n': next
         $validator = new ConfValidation();
         $extracted = $validator->ExtractPost($this->_disp);
         if ($disp_act == 'n') {
             $this->_disp->SwitchToSubTid($extracted);
         }
         return $extracted;
     } elseif ($disp_act == 'D') {
         $confdata->DeleteEntry($this->_disp);
         $needTrim = 1;
     } elseif ($disp_act == 'I') {
         if ($this->instantiateTemplate()) {
             $needTrim = 1;
         }
     } elseif ($disp_act == 'd' || $disp_act == 'i') {
         if ($disp_act == 'd') {
             $actions = 'DC';
             $mesg = DMsg::UIStr('note_confirm_delete');
         } else {
             $actions = 'IC';
             $mesg = DMsg::UIStr('note_confirm_instantiate');
         }
         $adata = $this->_disp->GetActionData($actions);
         $mesg = '<p>' . $mesg . '</p>' . UI::GetActionButtons($adata, 'text');
         $this->_disp->Set(DInfo::FLD_TopMsg, $mesg);
     }
     $ctxseq = UIBase::GrabGoodInputWithReset('ANY', 'ctxseq', 'int');
     if ($ctxseq != 0) {
         if ($this->_curOne->ChangeContextSeq($ctxseq)) {
             $needTrim = 1;
         }
     }
     if ($needTrim) {
         $this->_disp->TrimLastId();
         // need reload
         $this->loadConfig();
         $confdata = $this->getConfData($this->_disp);
     }
     return $confdata;
 }
Example #2
0
 public function InitConf()
 {
     $has_pid = FALSE;
     $mid = UIBase::GrabGoodInput("request", 'm');
     if ($mid != NULL) {
         $this->_mid = $mid;
         $pid = UIBase::GrabGoodInput("request", 'p');
         if ($pid != NULL) {
             $this->_pid = $pid;
             $has_pid = TRUE;
         }
     }
     if (($pos = strpos($this->_mid, '_')) > 0) {
         $this->_view = substr($this->_mid, 0, $pos + 1);
         $this->_viewName = substr($this->_mid, $pos + 1);
         if ($this->_pid == '' || $this->_view == 'sl' || $this->_view == 'sl_' || $this->_view == 'al' || $this->_view == 'al_' || $this->_pid == 'base' || $this->_pid == 'mbr') {
             $this->_ref = $this->_viewName;
         }
         // still in serv conf
     } else {
         $this->_view = $this->_mid;
     }
     $this->_confType = $this->_mid[0] == 'a' ? self::CT_ADMIN : self::CT_SERV;
     $this->_tabs = DPageDef::GetInstance()->GetTabDef($this->_view);
     if ($has_pid) {
         if (!array_key_exists($this->_pid, $this->_tabs)) {
             die("Invalid pid - {$this->_pid} \n");
         }
     } else {
         $this->_pid = key($this->_tabs);
         // default
     }
     if ($has_pid && !isset($_REQUEST['t0']) && isset($_REQUEST['t'])) {
         $t = UIBase::GrabGoodInput('request', 't');
         if ($t != NULL) {
             $this->_tid = $t;
             $t1 = UIBase::GrabGoodInputWithReset('request', 't1');
             if ($t1 != NULL && $this->GetLast(self::FLD_TID) != $t1) {
                 $this->_tid .= '`' . $t1;
             }
             if (($r = UIBase::GrabGoodInputWithReset('request', 'r')) != NULL) {
                 $this->_ref = $r;
             }
             if (($r1 = UIBase::GrabGoodInputWithReset('request', 'r1')) != NULL) {
                 $this->_ref .= '`' . $r1;
             }
         }
     }
     $this->_act = UIBase::GrabGoodInput("request", 'a');
     if ($this->_act == NULL) {
         $this->_act = 'v';
     }
     $tokenInput = UIBase::GrabGoodInput("request", 'tk');
     $this->_token = $_SESSION['token'];
     if ($this->_act != 'v' && $this->_token != $tokenInput) {
         die('Illegal entry point!');
     }
     if ($this->_act == 'B') {
         $this->TrimLastId();
         $this->_act = 'v';
     }
     $this->_sort = UIBase::GrabGoodInput("request", 'sort');
     $this->_allActions = array('a' => array(DMsg::UIStr('btn_add'), 'fa-indent'), 'v' => array(DMsg::UIStr('btn_view'), 'fa-search-plus'), 'E' => array(DMsg::UIStr('btn_edit'), 'fa-edit'), 's' => array(DMsg::UIStr('btn_save'), 'fa-save'), 'B' => array(DMsg::UIStr('btn_back'), 'fa-reply'), 'n' => array(DMsg::UIStr('btn_next'), 'fa-step-forward'), 'd' => array(DMsg::UIStr('btn_delete'), 'fa-trash-o'), 'D' => array(DMsg::UIStr('btn_delete'), 'fa-trash-o'), 'C' => array(DMsg::UIStr('btn_cancel'), 'fa-angle-double-left'), 'i' => array(DMsg::UIStr('btn_instantiate'), 'fa-cube'), 'I' => array(DMsg::UIStr('btn_instantiate'), 'fa-cube'), 'X' => array(DMsg::UIStr('btn_view'), 'fa-search-plus'));
 }