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 () {