public function newArticlePost($request, $response)
 {
     /*{{{*/
     DBC::requireTrue(XString::cntrim($request->getRequest('article_title')), "文章标题不能为空");
     $todayHasArticleNumber = DAL::get()->queryCntOfSpace('Article', $this->space->id, XDateTime::today()->toString(), XDateTime::tomorrow()->addSecond(-1)->toString());
     DBC::requireTrue(Article::MAX_CAN_ARTICLE_ONE_DAY_ADD_TWO > $todayHasArticleNumber, "您今天已经发表了" . Article::MAX_CAN_ARTICLE_ONE_DAY_ADD_TWO . "篇文章,请您明天再发表");
     $categoryId = intval($request->getRequest('category_id', 0));
     $data = array();
     $data['tags'] = $request->article_tags;
     $data['tags'] = str_replace("选择合适的关键词使文章更容易被搜索到(请用空格或逗号分隔)", '', $data['tags']);
     $data['topLevel'] = $request->top_level;
     $data['docAttachmentId'] = $request->getRequest('docAttachmentId', 0);
     $articleSource = intval($request->article_source);
     DBC::requireTrue($articleSource, "文章来源不能为空");
     $articleContent = htmlspecialchars($request->getUnSafeData('article_content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
     $articleContent = preg_replace("'<script>.*?</script>'", "", $articleContent);
     $article = ArticleClient::getInstance()->addArticle($this->space, $categoryId, $request->article_title, $articleContent, $articleSource, $data);
     if ($article->isNull()) {
         $this->message('系统繁忙,请稍后再试', $response, array('text' => '返回文章列表', 'url' => $response->router->urlfor('article/index')));
         return false;
     }
     $articleModelId = $request->articleModelId;
     if (false == empty($articleModelId) && $articleModelId != 0) {
         ArticleModelClient::getInstance()->addArticleId($articleModelId, $article->id);
     }
     $response->setRedirect($this->space->getUrl() . 'adminarticle/newpostcomplete?id=' . $article->id);
 }
 public function downSort($request, $response)
 {
     /*{{{*/
     $model = DAL::get()->find('ArticleModel', $request->articleModelId);
     DBC::requireTrue($model instanceof ArticleModel, "不存在该文章模板");
     $nowPage = (int) $request->getRequest('p', 1);
     ArticleModelClient::getInstance()->downSort($model->id);
     $response->setRedirect($response->router->urlfor('articlemodel/all', array('p' => $nowPage, 'preMsg' => $preMsg)));
 }