From 756e8e6f1e180ce916961dc6291b541d9736aef4 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 3 Oct 2015 11:33:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B8=D1=85=20=D1=81=D1=82=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=20=D1=81=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=D0=B8.=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20-=20=D1=83=D0=B6=D0=B5=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=83=D0=B1=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=83=D1=8E=20=D1=81=D1=82=D0=B0=D1=82=D1=8C=D1=8E=20=D0=BD?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=B7=D1=8F=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=B2=20=D1=87=D0=B5=D1=80=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D0=BA=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/ArticleController.php | 8 +++++--- ground/views/articles/edit.php | 6 ++++-- ground/views/user/index.php | 12 ++++++++++-- public/js/articleEdit.js | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ground/controllers/ArticleController.php b/ground/controllers/ArticleController.php index c6f240b..7df73b9 100644 --- a/ground/controllers/ArticleController.php +++ b/ground/controllers/ArticleController.php @@ -92,6 +92,10 @@ class ArticleController extends Controller App::error404(); } + if (!$article->id) { + $article->status = 'draft'; + } + App::setConfig('title', 'Редактирование статьи – ' . $article->title . ' – wikipoints.ru'); self::render('articles/edit.php', array( @@ -129,6 +133,7 @@ class ArticleController extends Controller if ($id == 0) { $article->author = App::$user->id; + $article->status = 'draft'; } if (isset($_POST['save']) && $_POST['save'] == 'published') { @@ -136,14 +141,11 @@ class ArticleController extends Controller $article->pubDate = time(); } $article->status = 'published'; - } else { - $article->status = 'draft'; } $article->title = $title ? $title : 'Без названия'; $article->text = $text; $article->html = $html; - $article->status = (isset($_POST['save']) && $_POST['save'] == 'published') ? 'published' : 'draft'; $article->photoId = Helper::getFirstImg($text); $article->allowComments = $allowComments; $article->save(); diff --git a/ground/views/articles/edit.php b/ground/views/articles/edit.php index af21bff..7f749ee 100644 --- a/ground/views/articles/edit.php +++ b/ground/views/articles/edit.php @@ -22,8 +22,10 @@ выйти не сохраняя
- - + status == 'draft') : ?> + + +
diff --git a/ground/views/user/index.php b/ground/views/user/index.php index c43f33b..f4ed2bc 100644 --- a/ground/views/user/index.php +++ b/ground/views/user/index.php @@ -1,4 +1,12 @@ -
+ 'Черновик', + 'published' => 'Опублована', + 'system' => 'Системная', + 'moderation' => 'На модерации', + 'del' => 'Удалена', +); +?>
Персональный блог пользователя @@ -32,7 +40,7 @@
pubDate) ?>
- title ?> + title ?>status != 'published' ? ' - ['.$statuses[$article->status].']' : '' ?> text)), 0, 250, 'UTF-8') ?>…
diff --git a/public/js/articleEdit.js b/public/js/articleEdit.js index 4afaa69..609e77b 100644 --- a/public/js/articleEdit.js +++ b/public/js/articleEdit.js @@ -100,7 +100,7 @@ function markdown() $('#articleText').keyup(function () { clearTimeout(monitorTimeout); monitorTimeout = setTimeout(function () { - $('#submitButton').addClass('btn-info'); + $('#submitButton').removeClass('btn-default').addClass('btn-info'); markdown(); }, 200); }).keydown(function () {