1+ <?php
2+ require ('../../global.php ' );
3+
4+ //验证是否登入
5+ if (!checkLogin ()){
6+ redirect ('../error.php?code= ' .$ errorcode ['noLogin ' ]);
7+ }
8+ //验证是否为管理员
9+ else if (!checkAdmin ()){
10+ redirect ('../error.php?code= ' .$ errorcode ['noAdmin ' ]);
11+ }
12+ //验证是否有权限
13+ else if (!checkPermissions (5 )){
14+ redirect ('../error.php?code= ' .$ errorcode ['noPermissions ' ]);
15+ }
16+ ?>
17+ <!doctype html>
18+ <html>
19+ <head>
20+ <meta charset="utf-8">
21+ <title>类目管理</title>
22+ <?php include ('sysapp/global_css.php ' ); ?>
23+ <link rel="stylesheet" href="../../img/ui/sys.css">
24+ <style>
25+ body{margin:10px 10px 0}
26+ </style>
27+ </head>
28+
29+ <body>
30+ <div class="well well-small" style="margin-bottom:10px">
31+ <div class="form-inline">
32+ <label>类目名称:</label>
33+ <input type="text" name="search_1" id="search_1" class="span2">
34+ <a class="btn" menu="search" href="javascript:;" style="margin-left:10px"><i class="icon-search"></i> 搜索</a>
35+ <a class="btn btn-primary fr" href="javascript:openDetailIframe('detail.php');"><i class="icon-white icon-plus"></i> 创建新类目</a>
36+ </div>
37+ </div>
38+ <table class="list-table">
39+ <thead>
40+ <tr class="col-name">
41+ <th>类目名称</th>
42+ <th style="width:150px">操作</th>
43+ </tr>
44+ <tr class="sep-row"><td colspan="100"></td></tr>
45+ <tr class="toolbar">
46+ <td colspan="100">
47+ <b style="margin:0 10px">符合条件的记录</b>有<font class="list-count">0</font>条
48+ </td>
49+ </tr>
50+ <tr class="sep-row"><td colspan="100"></td></tr>
51+ </thead>
52+ <tbody class="list-con"></tbody>
53+ <tfoot><tr><td colspan="100">
54+ <div class="pagination pagination-centered" id="pagination"></div>
55+ <?php $ categorycount = $ db ->select (0 , 2 , 'tb_app_category ' , 'tbid ' ); ?>
56+ <input id="pagination_setting" type="hidden" count="<?php echo $ categorycount ; ?> " per="15">
57+ </td></tr></tfoot>
58+ </table>
59+ <?php include ('sysapp/global_module_detailIframe.php ' ); ?>
60+ <?php include ('sysapp/global_js.php ' ); ?>
61+ <script>
62+ $(function(){
63+ //加载列表
64+ getPageList(0);
65+ //删除
66+ $('.list-con').on('click', '.do-del', function(){
67+ var categoryid = $(this).attr('categoryid');
68+ var name = $(this).parent().prev().text();
69+ $.dialog({
70+ id : 'ajaxedit',
71+ content : '删除 “' + name + '” 类目时,会将该类目下的所有应用归类到「未分类」类目下,是否继续?',
72+ ok : function(){
73+ $.ajax({
74+ type : 'POST',
75+ url : 'index.ajax.php',
76+ data : 'ac=del&categoryid=' + categoryid,
77+ success : function(msg){
78+ getPageList(0);
79+ }
80+ });
81+ },
82+ cancel: true
83+ });
84+ });
85+ //搜索
86+ $('a[menu=search]').click(function(){
87+ getPageList(0);
88+ });
89+ });
90+ function initPagination(current_page){
91+ $('#pagination').pagination(parseInt($('#pagination_setting').attr('count')), {
92+ current_page : current_page,
93+ items_per_page : parseInt($('#pagination_setting').attr('per')),
94+ num_display_entries : 9,
95+ num_edge_entries : 2,
96+ callback : getPageList,
97+ prev_text : '上一页',
98+ next_text : '下一页'
99+ });
100+ }
101+ function getPageList(current_page){
102+ ZENG.msgbox.show('正在加载中,请稍后...', 6, 100000);
103+ var from = current_page * parseInt($('#pagination_setting').attr('per')), to = parseInt($('#pagination_setting').attr('per'));
104+ $.ajax({
105+ type : 'POST',
106+ url : 'index.ajax.php',
107+ data : 'ac=getList&from=' + from + '&to=' + to + '&search_1=' + $('#search_1').val(),
108+ success : function(msg){
109+ var arr = msg.split('<{|*|}>');
110+ $('#pagination_setting').attr('count', arr[0]);
111+ $('.list-count').text(arr[0]);
112+ $('.list-con').html(arr[1]);
113+ initPagination(current_page);
114+ ZENG.msgbox._hide();
115+ }
116+ });
117+ }
118+ </script>
119+ </body>
120+ </html>
0 commit comments