From 62d1b0826443c3922a3aec0535d0c60995a6a1fa Mon Sep 17 00:00:00 2001 From: joyqi Date: Tue, 15 Oct 2013 14:10:03 +0800 Subject: [PATCH] fix edit --- admin/javascript/tokeninput.js | 10 ++++++++++ admin/manage-posts.php | 33 ++++++++++++++++--------------- admin/write-js.php | 23 +++++++++++++++++++-- admin/write-page.php | 5 ++--- admin/write-post.php | 6 ++---- var/Widget/Contents/Post/Edit.php | 8 ++++---- 6 files changed, 56 insertions(+), 29 deletions(-) diff --git a/admin/javascript/tokeninput.js b/admin/javascript/tokeninput.js index 0a4de7bd..b2a43532 100755 --- a/admin/javascript/tokeninput.js +++ b/admin/javascript/tokeninput.js @@ -272,6 +272,7 @@ $.TokenList = function (input, url_or_data, settings) { hidden_input.change(); return false; } + break; case KEY.ESCAPE: @@ -489,6 +490,15 @@ $.TokenList = function (input, url_or_data, settings) { function add_token (item) { var callback = settings.onAdd; + // fix null bug + if (!item) { + item = { + id : input_box.val() + }; + + item[settings.propertyToSearch] = input_box.val(); + } + // See if the token already exists and select it if we don't want duplicates if(token_count > 0 && settings.preventDuplicates) { var found_existing_token = null; diff --git a/admin/manage-posts.php b/admin/manage-posts.php index 89413b34..c376999b 100644 --- a/admin/manage-posts.php +++ b/admin/manage-posts.php @@ -44,22 +44,18 @@ $stat = Typecho_Widget::widget('Widget_Stat');
- + - - - + + - - - @@ -72,16 +68,21 @@ $stat = Typecho_Widget::widget('Widget_Stat'); - status && 'waiting' != $posts->status && 'private' != $posts->status && !$posts->password): ?> colspan="2"> - title(); ?> - status || 'waiting' == $posts->status || 'private' == $posts->status || $posts->password): ?> - - diff --git a/admin/write-js.php b/admin/write-js.php index c351884f..1cbae631 100644 --- a/admin/write-js.php +++ b/admin/write-js.php @@ -34,10 +34,27 @@ $(document).ready(function() { }); // tag autocomplete 提示 - $('#tags').tokenInput(next()) { $data[] = array( + 'id' => $tags->name, 'tags' => $tags->name ); } @@ -46,9 +63,11 @@ $(document).ready(function() { propertyToSearch: 'tags', tokenValue : 'tags', searchDelay : 0, + preventDuplicates : true, animateDropdown : false, hintText : '', - noResultsText : '此标签不存在, 按回车创建' + noResultsText : '此标签不存在, 按回车创建', + prePopulate : tagsPre }); // tag autocomplete 提示宽度设置 diff --git a/admin/write-page.php b/admin/write-page.php index 605fbfe8..5711a2ab 100644 --- a/admin/write-page.php +++ b/admin/write-page.php @@ -30,9 +30,8 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page); - - - + +

diff --git a/admin/write-post.php b/admin/write-post.php index 928e6829..4e345b67 100644 --- a/admin/write-post.php +++ b/admin/write-post.php @@ -49,10 +49,8 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post); - - - - + +

预览
diff --git a/var/Widget/Contents/Post/Edit.php b/var/Widget/Contents/Post/Edit.php index 8aff8d6a..114bed63 100644 --- a/var/Widget/Contents/Post/Edit.php +++ b/var/Widget/Contents/Post/Edit.php @@ -318,11 +318,11 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg /** 获取文章内容 */ if (!empty($this->request->cid) && 'delete' != $this->request->do) { $this->db->fetchRow($this->select() - ->where('table.contents.type = ?', 'post') + ->where('table.contents.type = ? OR table.contents.type = ?', 'post', 'post_draft') ->where('table.contents.cid = ?', $this->request->filter('int')->cid) ->limit(1), array($this, 'push')); - if ('draft' == $this->status && $this->parent) { + if ('post_draft' == $this->type && $this->parent) { $this->response->redirect(Typecho_Common::url('write-post.php?cid=' . $this->parent, $this->options->adminUrl)); } @@ -343,10 +343,10 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg */ public function filter(array $value) { - if ('draft' != $value['status']) { + if ('post' == $value['type']) { $draft = $this->db->fetchRow($this->widget('Widget_Abstract_Contents')->select() ->where('table.contents.parent = ? AND table.contents.type = ? AND table.contents.status = ?', - $value['cid'], $value['type'], 'draft') + $value['cid'], 'post_draft', $value['status']) ->limit(1)); if (!empty($draft)) {
commentsNum(); ?> - status ? _e('草稿') : ('waiting' == $posts->status ? _e('待审核') : ('private' == $posts->status ? _e('私密') : _e(''))); ?> password ? _e('密码') : _e(''); ?> - - status): ?> - view + title(); ?> + hasSaved() || 'post_draft' == $posts->type) { + echo '(' . _t('草稿') . ')'; + } else if ('waiting' == $posts->status) { + echo '(' . _t('待审核') . ')'; + } else if ('private' == $posts->status) { + echo '(' . _t('私密') . ')'; + } else if ($posts->password) { + echo '(' . _t('密码保护') . ')'; + } + ?> + permalink): ?> + view author(); ?>