Revision: 1396
Author: magike.net
Date: Mon Mar 29 20:44:53 2010
Log: 针对中文优化分段
增加所有管理项的取消筛选链接
增加已经保存草稿文章在管理页的区分度
将创建用户链接移动到“创建”根目录下,方便用户上手
http://code.google.com/p/typecho/source/detail?r=1396
Modified:
/trunk/admin/manage-comments.php
/trunk/admin/manage-medias.php
/trunk/admin/manage-pages.php
/trunk/admin/manage-posts.php
/trunk/admin/manage-users.php
/trunk/var/Typecho/Common/Paragraph.php
/trunk/var/Widget/Contents/Post/Admin.php
/trunk/var/Widget/Menu.php
=======================================
--- /trunk/admin/manage-comments.php Fri Feb 26 22:47:34 2010
+++ /trunk/admin/manage-comments.php Mon Mar 29 20:44:53 2010
@@ -54,7 +54,13 @@
<?php endif; ?>
</p>
<p class="search">
- <input type="text" value="<?php _e('请输入关键
字'); ?>" onclick="value='';name='keywords';" />
+ <?php if ('' != $request->keywords || '' !=
$request->category): ?>
+ <a href="<?php $options->adminUrl('manage-comments.php'
+ . (isset($request->status) ||
isset($request->cid) ? '?' .
+ (isset($request->status) ? 'status=' .
htmlspecialchars($request->get('status')) : '') .
+ (isset($request->cid) ?
(isset($request->status) ? '&' : '') . 'cid=' .
htmlspecialchars($request->get('cid')) : '') : '')); ?>"><?php _e('«
取消筛选'); ?></a>
+ <?php endif; ?>
+ <input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
<?php if(isset($request->status)): ?>
<input type="hidden" value="<?php echo
htmlspecialchars($request->get('status')); ?>" name="status" />
<?php endif; ?>
=======================================
--- /trunk/admin/manage-medias.php Fri Jan 15 04:13:14 2010
+++ /trunk/admin/manage-medias.php Mon Mar 29 20:44:53 2010
@@ -22,7 +22,10 @@
<span rel="delete" lang="<?php _e('你确认要删除这些
附件吗?'); ?>" class="operate-button operate-delete
typecho-table-select-submit"><?php _e('删除'); ?></span>
</p>
<p class="search">
- <input type="text" value="<?php _e('请输入关键
字'); ?>" onclick="value='';name='keywords';" />
+ <?php if ('' != $request->keywords): ?>
+ <a href="<?php
$options->adminUrl('manage-medias.php'); ?>"><?php _e('« 取消筛
选'); ?></a>
+ <?php endif; ?>
+ <input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
<button type="submit"><?php _e('筛选'); ?></button>
</p>
</form>
=======================================
--- /trunk/admin/manage-pages.php Mon Mar 29 00:50:20 2010
+++ /trunk/admin/manage-pages.php Mon Mar 29 20:44:53 2010
@@ -22,11 +22,7 @@
<?php if ('' != $request->keywords): ?>
<a href="<?php
$options->adminUrl('manage-pages.php'); ?>"><?php _e('« 取消筛
选'); ?></a>
<?php endif; ?>
- <input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
- <?php if(isset($request->status)): ?>
- <input type="hidden" value="<?php echo
htmlspecialchars($request->get('status')); ?>" name="status" />
- <?php endif; ?>
-
+ <input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
<button type="submit"><?php _e('筛选'); ?></button>
</p>
</form>
@@ -77,7 +73,16 @@
</td>
<td><?php $pages->slug(); ?></td>
<td><?php $pages->author(); ?></td>
- <td><?php $pages->dateWord(); ?></td>
+ <td>
+ <?php if ($pages->hasSaved): ?>
+ <span class="description">
+ <?php $modifyDate = new
Typecho_Date($pages->modified); ?>
+ <?php _e('保存于 %s', $modifyDate->word()); ?>
+ </span>
+ <?php else: ?>
+ <?php $pages->dateWord(); ?>
+ <?php endif; ?>
+ </td>
</tr>
<?php endwhile; ?>
<?php else: ?>
=======================================
--- /trunk/admin/manage-posts.php Mon Mar 29 00:50:20 2010
+++ /trunk/admin/manage-posts.php Mon Mar 29 20:44:53 2010
@@ -20,7 +20,7 @@
</p>
<p class="search">
<?php if ('' != $request->keywords || '' !=
$request->category): ?>
- <a href="<?php
$options->adminUrl('manage-posts.php'); ?>"><?php _e('« 取消筛
选'); ?></a>
+ <a href="<?php $options->adminUrl('manage-posts.php' .
(isset($request->uid) ? '?uid=' .
htmlspecialchars($request->get('uid')) : '')); ?>"><?php _e('« 取消筛
选'); ?></a>
<?php endif; ?>
<input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
<select name="category">
@@ -31,9 +31,6 @@
<?php endwhile; ?>
</select>
<button type="submit"><?php _e('筛选'); ?></button>
- <?php if(isset($request->status)): ?>
- <input type="hidden" value="<?php echo
htmlspecialchars($request->get('status')); ?>" name="status" />
- <?php endif; ?>
<?php if(isset($request->uid)): ?>
<input type="hidden" value="<?php echo
htmlspecialchars($request->get('uid')); ?>" name="uid" />
<?php endif; ?>
@@ -94,7 +91,16 @@
echo '">' . $val['name'] . '</a>' . ($key
< $length - 1 ? ', ' : ''); ?>
<?php endforeach; ?>
</td>
- <td><?php $posts->dateWord(); ?></td>
+ <td>
+ <?php if ($posts->hasSaved): ?>
+ <span class="description">
+ <?php $modifyDate = new
Typecho_Date($posts->modified); ?>
+ <?php _e('保存于 %s', $modifyDate->word()); ?>
+ </span>
+ <?php else: ?>
+ <?php $posts->dateWord(); ?>
+ <?php endif; ?>
+ </td>
</tr>
<?php endwhile; ?>
<?php else: ?>
=======================================
--- /trunk/admin/manage-users.php Fri Jan 15 04:13:14 2010
+++ /trunk/admin/manage-users.php Mon Mar 29 20:44:53 2010
@@ -11,7 +11,6 @@
<div class="typecho-list-operate">
<form method="get">
<p class="operate">
- <a class="button" href="<?php
$options->adminUrl('user.php'); ?>"><?php _e('新增用户'); ?></a>
<?php _e('操作'); ?>:
<span class="operate-button
typecho-table-select-all"><?php _e('全选'); ?></span>,
<span class="operate-button
typecho-table-select-none"><?php _e('不选'); ?></span>,
@@ -19,7 +18,10 @@
<span rel="delete" lang="<?php _e('你确认要删除这些用户
吗?'); ?>" class="operate-button operate-delete
typecho-table-select-submit"><?php _e('删除'); ?></span>
</p>
<p class="search">
- <input type="text" value="<?php _e('请输入关键
字'); ?>" onclick="value='';name='keywords';" />
+ <?php if ('' != $request->keywords): ?>
+ <a href="<?php
$options->adminUrl('manage-users.php'); ?>"><?php _e('« 取消筛
选'); ?></a>
+ <?php endif; ?>
+ <input type="text" value="<?php '' !=
$request->keywords ? print(htmlspecialchars($request->keywords)) : _e('请输
入关键字'); ?>"<?php if ('' == $request->keywords): ?>
onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php
endif; ?>/>
<button type="submit"><?php _e('筛选'); ?></button>
</p>
</form>
=======================================
--- /trunk/var/Typecho/Common/Paragraph.php Mon Mar 29 00:50:20 2010
+++ /trunk/var/Typecho/Common/Paragraph.php Mon Mar 29 20:44:53 2010
@@ -58,9 +58,12 @@
*/
private static function cutByBlock($text)
{
- $text = preg_replace("/\r*\n\r*/", "\n", trim($text));
+ $space = "( | )";
+ $text = str_replace("\r", "\n", trim($text));
+ $text = preg_replace("/{$space}*\n{$space}*/is", "\n", $text);
$text = preg_replace("/\n{2,}/", "</p><p>", $text);
$text =
preg_replace("/(<p>)?\s*<p:([0-9]{4})\/>\s*(<\/p>)?/s", "<p:\\2/>", $text);
+ $text = preg_replace("/<p>{$space}*<\/p>/is", '', $text);
return $text;
}
=======================================
--- /trunk/var/Widget/Contents/Post/Admin.php Sun Feb 7 05:30:09 2010
+++ /trunk/var/Widget/Contents/Post/Admin.php Mon Mar 29 20:44:53 2010
@@ -57,17 +57,16 @@
* @access protected
* @return array
*/
- protected function ___hasDraft()
- {
- if ('draft' == $this->status) {
- return true;
- }
-
- if ($this->db->fetchRow($this->db->select('cid')
+ protected function ___hasSaved()
+ {
+ $savedPost =
$this->db->fetchRow($this->db->select('cid', 'modified')
->from('table.contents')
->where('table.contents.parent = ? AND table.contents.type = ? AND
table.contents.status = ?',
$this->cid, $this->type, 'draft')
- ->limit(1))) {
+ ->limit(1));
+
+ if ($savedPost) {
+ $this->modified = $savedPost['modified'];
return true;
}
=======================================
--- /trunk/var/Widget/Menu.php Sun Mar 7 06:52:54 2010
+++ /trunk/var/Widget/Menu.php Mon Mar 29 20:44:53 2010
@@ -125,6 +125,8 @@
array(array('Widget_Contents_Post_Edit', 'getMenuTitle'),
array('Widget_Contents_Post_Edit', 'getMenuTitle'), 'write-post.php?cid=',
'contributor',
true),
array(_t('创建页面'), _t('创建新页
面'), 'write-page.php', 'editor'),
array(array('Widget_Contents_Page_Edit', 'getMenuTitle'),
array('Widget_Contents_Page_Edit', 'getMenuTitle'), 'write-page.php?cid=',
'editor',
true),
+ array(_t('新增用户'), _t('新增用
户'), 'user.php', 'administrator'),
+ array(array('Widget_Users_Edit', 'getMenuTitle'),
array('Widget_Users_Edit', 'getMenuTitle'), 'user.php?uid=', 'administrator',
true),
// array(_t('上传相片'), _t('上传新相
片'), '/admin/edit-photo.php', 'contributor')
),
array(
@@ -138,8 +140,6 @@
array(_t('附件'), _t('管理附
件'), 'manage-medias.php', 'editor'),
array(array('Widget_Contents_Attachment_Edit', 'getMenuTitle'),
array('Widget_Contents_Attachment_Edit', 'getMenuTitle'), 'media.php?cid=',
'contributor',
true),
array(_t('用户'), _t('管理用
户'), 'manage-users.php', 'administrator'),
- array(_t('新增用户'), _t('新增用
户'), 'user.php', 'administrator', true),
- array(array('Widget_Users_Edit', 'getMenuTitle'),
array('Widget_Users_Edit', 'getMenuTitle'), 'user.php?uid=', 'administrator',
true),
// array(_t('链接'), _t('管理链
接'), '/admin/manage-links.php', 'administrator'),
// array(_t('链接分类'), _t('管理链接分
类'), '/admin/manage-link-cat.php', 'administrator'),
),
_______________________________________________
announce mailing list
[email protected]
http://lists.typecho.org/mailman/listinfo/announce