コード例 #1
0
ファイル: class.php プロジェクト: mrdeadmouse/u136006
 protected function processActionSaveAjax()
 {
     $this->request->addFilter(new PostDecodeFilter());
     if ($this->request->getQuery('saveuserparams') == 'Y') {
         $serializeValue = serialize($this->request->getPost('USER_PARAMS'));
         if (strlen($serializeValue) > 64000) {
             $response = "\n\t\t\t\t\t<script>\n\t\t\t\t\t\talert('" . Loc::getMessage('BIZPROC_USER_PARAMS_SAVE_ERROR') . "');\n\t\t\t\t\t</script>\n\t\t\t\t";
             $this->sendResponse($response);
         }
         CUserOptions::setOption('~bizprocdesigner', 'activity_settings', $serializeValue);
         $this->getApplication()->restartBuffer();
         $this->end();
     }
     $fields = array('DOCUMENT_TYPE' => $this->arResult['DOCUMENT_COMPLEX_TYPE'], 'AUTO_EXECUTE' => $this->request->getPost('workflowTemplateAutostart'), 'NAME' => $this->request->getPost('workflowTemplateName'), 'DESCRIPTION' => $this->request->getPost('workflowTemplateDescription'), 'TEMPLATE' => $this->request->getPost('arWorkflowTemplate'), 'PARAMETERS' => $this->request->getPost('arWorkflowParameters'), 'VARIABLES' => $this->request->getPost('arWorkflowVariables'), 'CONSTANTS' => $this->request->getPost('arWorkflowConstants'), 'USER_ID' => intval($this->getUser()->getID()), 'MODIFIER_USER' => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (!is_array($fields["VARIABLES"])) {
         $fields['VARIABLES'] = array();
     }
     if (!is_array($fields["CONSTANTS"])) {
         $fields['CONSTANTS'] = array();
     }
     if ($this->arResult['TEMPLATE'] != $fields['TEMPLATE']) {
         $fields['SYSTEM_CODE'] = '';
     }
     try {
         if ($this->arResult['ID'] > 0) {
             CBPWorkflowTemplateLoader::update($this->arResult['ID'], $fields);
         } else {
             $this->arResult['ID'] = CBPWorkflowTemplateLoader::add($fields);
         }
     } catch (Exception $e) {
         $response = "\n\t\t\t\t<script>\n\t\t\t\t\talert('" . Loc::getMessage('BIZPROC_WFEDIT_SAVE_ERROR') . "\\n " . preg_replace("#\\.\\W?#", ".\\n", AddSlashes(htmlspecialcharsbx($e->getMessage()))) . "');\n\t\t\t\t</script>\n\t\t\t";
         $this->sendResponse($response);
     }
     $response = "\n\t\t\t<script>\n\t\t\t\twindow.location = '" . ($this->request->getQuery('apply') == 'Y' ? str_replace('#ID#', $this->arResult['ID'], $this->arResult['EDIT_PAGE_TEMPLATE']) : CUtil::JSEscape($this->arResult['LIST_PAGE_URL'])) . "';\n\t\t\t</script>\n\t\t";
     $this->sendResponse($response);
 }
コード例 #2
0
ファイル: class.php プロジェクト: mrdeadmouse/u136006
 protected function processActionAutoload()
 {
     $this->checkRequiredInputParams($_GET, array('action'));
     if ($this->errorCollection->hasErrors()) {
         $error = array_shift($this->getErrors());
         throw new SystemException($error->getMessage());
     }
     $requestAction = $this->request->getQuery('action');
     $requestBackUrl = $this->request->getQuery('back_url');
     foreach ($this->arParams['DOCUMENT_DATA'] as $nameModule => $data) {
         $result = CBPWorkflowTemplateLoader::getList(array('name' => 'asc'), array('DOCUMENT_TYPE' => $data['DOCUMENT_TYPE'], 'ID' => $this->request->getQuery('ID')), false, false, array('ID', 'NAME', 'AUTO_EXECUTE'));
         if ($result && ($res = $result->fetch())) {
             $fields = array('AUTO_EXECUTE' => $res['AUTO_EXECUTE']);
             $temporary = false;
             if (strpos($requestAction, 'create') !== false) {
                 $temporary = CBPDocumentEventType::Create;
             } elseif (strpos($requestAction, 'edit') !== false) {
                 $temporary = CBPDocumentEventType::Edit;
             } elseif (strpos($requestAction, 'delete') !== false) {
                 $temporary = CBPDocumentEventType::Delete;
             }
             if ($temporary != false) {
                 if (strpos($requestAction, 'present') !== false) {
                     $fields['AUTO_EXECUTE'] = ($fields['AUTO_EXECUTE'] & $temporary) != 0 ? $fields['AUTO_EXECUTE'] ^ $temporary : $fields['AUTO_EXECUTE'];
                 } else {
                     $fields['AUTO_EXECUTE'] = ($fields['AUTO_EXECUTE'] & $temporary) == 0 ? $fields['AUTO_EXECUTE'] ^ $temporary : $fields['AUTO_EXECUTE'];
                 }
             }
             if ($fields['AUTO_EXECUTE'] != $res['AUTO_EXECUTE']) {
                 CBPWorkflowTemplateLoader::update($this->request->getQuery('ID'), $fields);
             }
         }
     }
     $url = !empty($requestBackUrl) ? $requestBackUrl : $this->getApplication()->getCurPageParam('', array('action', 'sessid', 'ID'));
     LocalRedirect($url);
 }