diff --git a/module/action/config.php b/module/action/config.php index cb66e5d9eb..023a11ec16 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -92,3 +92,5 @@ $config->trash->search['params']['objectName'] = array('operator' => 'include', $config->trash->search['params']['objectID'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->trash->search['params']['actor'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->trash->search['params']['date'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); + +$config->action->newPageModule = array('repo', 'mr', 'host', 'account', 'serverroom', 'instance', 'store', 'space', 'host'); \ No newline at end of file diff --git a/module/action/control.php b/module/action/control.php index 08dc85bf7a..01339d82d4 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -347,6 +347,10 @@ class action extends control { return $this->send(array('status' => 'success', 'data' => $actionID)); } + elseif(in_array($objectType, $this->config->action->newPageModule)) + { + return $this->send(array('status' => 'success', 'closeModal' => true, 'load' => true)); + } else { echo js::reload('parent'); diff --git a/module/common/model.php b/module/common/model.php index 5455496921..1a8fe22580 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -3667,6 +3667,76 @@ EOF; return static::apiError($result); } + /** + * Post method of API. + * + * @param string $url + * @param array|object $data + * @param array $headers example: array("key1:value1", "key2:value2") + * @access public + * @return object + */ + public static function apiPost($url, $data, $headers = array()) + { + $result = json_decode(commonModel::http($url, $data, array(CURLOPT_CUSTOMREQUEST => 'POST'), $headers, 'json')); + if($result && $result->code == 200) return $result; + + return static::apiError($result); + } + + /** + * Put method of API. + * + * @param string $url + * @param array|object $data + * @param array $headers example: array("key1:value1", "key2:value2") + * @access public + * @return object + */ + public static function apiPut($url, $data, $headers = array()) + { + $result = json_decode(commonModel::http($url, $data, array(CURLOPT_CUSTOMREQUEST => 'PUT'), $headers, 'json')); + if($result && $result->code == 200) return $result; + + return static::apiError($result); + } + + /** + * Delete method of API. + * + * @param string $url + * @param array|object $data + * @param array $headers example: array("key1:value1", "key2:value2") + * @access public + * @return object + */ + public static function apiDelete($url, $data, $headers = array()) + { + $result = json_decode(commonModel::http($url, $data, array(CURLOPT_CUSTOMREQUEST => 'DELETE'), $headers, 'json')); + if($result && $result->code == 200) return $result; + + return static::apiError($result); + } + + /** + * Return error object of api server. + * + * @param object|null $result + * @access protected + * @return object + */ + protected static function apiError($result) + { + global $lang; + + if($result && $result->code) return $result; + + $error = new stdclass; + $error->code = 600; + $error->message = $lang->error->httpServerError; + return $error; + } + /** * Check object priv. * diff --git a/module/instance/ui/view.html.php b/module/instance/ui/view.html.php index ea3dad97e9..e2db61f6fc 100644 --- a/module/instance/ui/view.html.php +++ b/module/instance/ui/view.html.php @@ -198,6 +198,10 @@ div div ( setClass('basis-auto'), - history() + history + ( + set::commentBtn(true), + set::commentUrl(createLink('action', 'comment', array('objectType' => 'instance', 'objectID' => $instance->id))), + ) ) ); \ No newline at end of file diff --git a/module/search/control.php b/module/search/control.php index 37661d9a21..b7d6074d54 100644 --- a/module/search/control.php +++ b/module/search/control.php @@ -52,9 +52,11 @@ class search extends control $this->view->style = empty($style) ? 'full' : $style; $this->view->onMenuBar = empty($onMenuBar) ? 'no' : $onMenuBar; - if(!in_array($module, array('repo', 'mr', 'host', 'account', 'serverroom', 'instance', 'store', 'space', 'host'))) + $this->app->loadModuleConfig('action'); + $_GET['zin'] = 0; + if(in_array($module, $this->config->action->newPageModule)) { - $_GET['zin'] = 0; + $_GET['zin'] = 1; $this->view->formSession = $_SESSION[$module . 'Form']; } $this->display();