mirror of
https://github.com/typecho/typecho.git
synced 2025-04-21 02:01:52 +02:00
将分类和标签分开管理,为后续支持子分类做准备
This commit is contained in:
parent
72f95bb428
commit
7ac6ca5546
@ -2,22 +2,16 @@
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
include 'menu.php';
|
||||
|
||||
Typecho_Widget::widget('Widget_Metas_Category_List')->to($categories);
|
||||
?>
|
||||
|
||||
<div class="main">
|
||||
<div class="body container">
|
||||
<?php include 'page-title.php'; ?>
|
||||
<div class="row typecho-page-main manage-metas">
|
||||
<div class="col-mb-12">
|
||||
<ul class="typecho-option-tabs clearfix">
|
||||
<li<?php if(!isset($request->type) || 'category' == $request->get('type')): ?> class="current"<?php endif; ?>><a href="<?php $options->adminUrl('manage-metas.php'); ?>"><?php _e('分类'); ?></a></li>
|
||||
<li<?php if('tag' == $request->get('type')): ?> class="current"<?php endif; ?>><a href="<?php $options->adminUrl('manage-metas.php?type=tag'); ?>"><?php _e('标签'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-mb-12 col-tb-8" role="main">
|
||||
<?php if(!isset($request->type) || 'category' == $request->get('type')): ?>
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Category_List')->to($categories); ?>
|
||||
|
||||
<form method="post" name="manage_categories" class="operate-form">
|
||||
<div class="typecho-list-operate clearfix">
|
||||
@ -85,50 +79,10 @@ include 'menu.php';
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Tag_Cloud', 'sort=mid&desc=0')->to($tags); ?>
|
||||
<form method="post" name="manage_tags" class="operate-form">
|
||||
<div class="typecho-list-operate clearfix">
|
||||
<div class="operate">
|
||||
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
|
||||
<div class="btn-group btn-drop">
|
||||
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a lang="<?php _e('你确认要删除这些标签吗?'); ?>" href="<?php $options->index('/action/metas-tag-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
|
||||
<li><a lang="<?php _e('刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?'); ?>" href="<?php $options->index('/action/metas-tag-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>
|
||||
<li class="multiline">
|
||||
<button type="button" class="btn btn-s merge" rel="<?php $options->index('/action/metas-tag-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
|
||||
<input type="text" name="merge" class="text-s" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="typecho-list-notable tag-list clearfix">
|
||||
<?php if($tags->have()): ?>
|
||||
<?php while ($tags->next()): ?>
|
||||
<li class="size-<?php $tags->split(5, 10, 20, 30); ?>" id="<?php $tags->theId(); ?>">
|
||||
<input type="checkbox" value="<?php $tags->mid(); ?>" name="mid[]"/>
|
||||
<span rel="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><?php $tags->name(); ?></span>
|
||||
<a class="tag-edit-link" href="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><i class="i-edit"></i></a>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php else: ?>
|
||||
<h6 class="typecho-list-table-title"><?php _e('没有任何标签'); ?></h6>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<input type="hidden" name="do" value="delete" />
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<div class="col-mb-12 col-tb-4" role="form">
|
||||
<?php if(!isset($request->type) || 'category' == $request->get('type')): ?>
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Category_Edit')->form()->render(); ?>
|
||||
<?php else: ?>
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Tag_Edit')->form()->render(); ?>
|
||||
<?php endif; ?>
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Category_Edit')->form()->render(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -233,3 +187,4 @@ include 'common-js.php';
|
||||
})();
|
||||
</script>
|
||||
<?php include 'footer.php'; ?>
|
||||
|
91
admin/manage-tags.php
Normal file
91
admin/manage-tags.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
include 'menu.php';
|
||||
|
||||
Typecho_Widget::widget('Widget_Metas_Tag_Cloud', 'sort=mid&desc=0')->to($tags);
|
||||
?>
|
||||
|
||||
<div class="main">
|
||||
<div class="body container">
|
||||
<?php include 'page-title.php'; ?>
|
||||
<div class="row typecho-page-main manage-metas">
|
||||
|
||||
<div class="col-mb-12 col-tb-8" role="main">
|
||||
|
||||
<form method="post" name="manage_tags" class="operate-form">
|
||||
<div class="typecho-list-operate clearfix">
|
||||
<div class="operate">
|
||||
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
|
||||
<div class="btn-group btn-drop">
|
||||
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a lang="<?php _e('你确认要删除这些标签吗?'); ?>" href="<?php $options->index('/action/metas-tag-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
|
||||
<li><a lang="<?php _e('刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?'); ?>" href="<?php $options->index('/action/metas-tag-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>
|
||||
<li class="multiline">
|
||||
<button type="button" class="btn btn-s merge" rel="<?php $options->index('/action/metas-tag-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
|
||||
<input type="text" name="merge" class="text-s" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="typecho-list-notable tag-list clearfix">
|
||||
<?php if($tags->have()): ?>
|
||||
<?php while ($tags->next()): ?>
|
||||
<li class="size-<?php $tags->split(5, 10, 20, 30); ?>" id="<?php $tags->theId(); ?>">
|
||||
<input type="checkbox" value="<?php $tags->mid(); ?>" name="mid[]"/>
|
||||
<span rel="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><?php $tags->name(); ?></span>
|
||||
<a class="tag-edit-link" href="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><i class="i-edit"></i></a>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php else: ?>
|
||||
<h6 class="typecho-list-table-title"><?php _e('没有任何标签'); ?></h6>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<input type="hidden" name="do" value="delete" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="col-mb-12 col-tb-4" role="form">
|
||||
<?php Typecho_Widget::widget('Widget_Metas_Tag_Edit')->form()->render(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include 'copyright.php';
|
||||
include 'common-js.php';
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.typecho-list-notable').tableSelectable({
|
||||
checkEl : 'input[type=checkbox]',
|
||||
rowEl : 'li',
|
||||
selectAllEl : '.typecho-table-select-all',
|
||||
actionEl : '.dropdown-menu a'
|
||||
});
|
||||
|
||||
$('.btn-drop').dropdownMenu({
|
||||
btnEl : '.dropdown-toggle',
|
||||
menuEl : '.dropdown-menu'
|
||||
});
|
||||
|
||||
$('.dropdown-menu button.merge').click(function () {
|
||||
var btn = $(this);
|
||||
btn.parents('form').attr('action', btn.attr('rel')).submit();
|
||||
});
|
||||
|
||||
<?php if (isset($request->mid)): ?>
|
||||
$('.typecho-mini-panel').effect('highlight', '#AACB36');
|
||||
<?php endif; ?>
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<?php include 'footer.php'; ?>
|
||||
|
@ -130,7 +130,8 @@ class Widget_Menu extends Typecho_Widget
|
||||
array(_t('独立页面'), _t('管理独立页面'), 'manage-pages.php', 'editor', false, 'write-page.php'),
|
||||
array(_t('评论'), _t('管理评论'), 'manage-comments.php', 'contributor'),
|
||||
array(array('Widget_Comments_Admin', 'getMenuTitle'), array('Widget_Comments_Admin', 'getMenuTitle'), 'manage-comments.php?cid=', 'contributor', true),
|
||||
array(_t('标签和分类'), _t('标签和分类'), 'manage-metas.php', 'editor'),
|
||||
array(_t('分类'), _t('管理分类'), 'manage-categories.php', 'editor'),
|
||||
array(_t('标签'), _t('管理标签'), 'manage-tags.php', 'editor'),
|
||||
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', false, 'user.php'),
|
||||
|
@ -160,7 +160,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
->where('type = ?', 'category')->limit(1));
|
||||
|
||||
if (!$meta) {
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
$name->value($meta['name']);
|
||||
@ -228,7 +228,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
$this->permalink, $this->name), 'success');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,7 +261,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
$this->permalink, $this->name), 'success');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -289,7 +289,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
$deleteCount > 0 ? 'success' : 'notice');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,7 +341,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
|
||||
if (!$this->request->isAjax()) {
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
} else {
|
||||
$this->response->throwJson(array('success' => 1, 'message' => _t('分类排序已经完成')));
|
||||
}
|
||||
@ -403,7 +403,7 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
|
||||
}
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,7 +157,7 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
|
||||
->where('type = ?', 'tag')->limit(1));
|
||||
|
||||
if (!$meta) {
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
$name->value($meta['name']);
|
||||
@ -221,7 +221,7 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
|
||||
$this->permalink, $this->name), 'success');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,7 +253,7 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
|
||||
$this->permalink, $this->name), 'success');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -281,7 +281,7 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
|
||||
$deleteCount > 0 ? 'success' : 'notice');
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,7 +315,7 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
|
||||
}
|
||||
|
||||
/** 转向原页 */
|
||||
$this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl));
|
||||
$this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user