Skip to content

Commit e22c12a

Browse files
committed
增加最新更新列表
1 parent dfd912a commit e22c12a

File tree

3 files changed

+113
-3
lines changed

3 files changed

+113
-3
lines changed

server/apps/controllers/Wiki.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ function edit()
257257
'uid' => $uid,
258258
'content' => $cont->content,
259259
'title' => $cont->title,
260-
'project_id' => $node->project_id,
261260
'version' => intval($cont->version),
262261
));
263262
//增加版本号

server/apps/controllers/Wiki_admin.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,35 @@ function main()
9797
$this->display();
9898
}
9999

100+
function update_list()
101+
{
102+
$_table = table('wiki_tree');
103+
104+
$list = $_table->gets(array(
105+
'select' => ' wiki_tree.id wiki_id, text title, update_uid, wiki_content.uptime uptime, wiki_content.version version',
106+
'project_id' => $this->project_id,
107+
'page' => empty($_GET['page']) ? 1 : intval($_GET['page']),
108+
'pagesize' => 15,
109+
'order' => 'uptime desc',
110+
'leftjoin' => array('wiki_content', '`wiki_tree`.id = `wiki_content`.id'),
111+
));
112+
113+
$uid_list = array();
114+
foreach($list as $li)
115+
{
116+
if (empty($li['update_uid']))
117+
{
118+
continue;
119+
}
120+
$uid_list[] = $li['update_uid'];
121+
}
122+
$uid_list = array_unique($uid_list);
123+
$users = Model('UserInfo')->getMap(array('in' => array('id', $uid_list)), 'nickname');
124+
$this->assign('users', $users);
125+
$this->assign('list', $list);
126+
$this->display();
127+
}
128+
100129
function history()
101130
{
102131
if (empty($_GET['id']))
@@ -483,6 +512,7 @@ function create()
483512
$in2['id'] = $node_id;
484513
$in2['close_comment'] = intval($_POST['close_comment']);
485514
$in2['close_edit'] = intval($_POST['close_edit']);
515+
$in2['project_id'] = $this->project_id;
486516
$_cont->put($in2);
487517

488518
//写入历史记录
@@ -492,7 +522,6 @@ function create()
492522
'uid' => $this->uid,
493523
'content' => $_POST['content'],
494524
'title' => $in['text'],
495-
'project_id' => $this->project_id,
496525
'version' => 0,
497526
));
498527
$this->reflushPage('增加成功');
@@ -656,7 +685,6 @@ function modify()
656685
'uid' => $this->uid,
657686
'content' => $cont->content,
658687
'title' => $cont->title,
659-
'project_id' => $this->project_id,
660688
'version' => intval($cont->version),
661689
));
662690
//增加版本号
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
<link rel='stylesheet' href='/static/css/markdown.css' type='text/css' />
6+
<!-- Bootstrap core CSS -->
7+
<link href="/static/bootstrap3/dist/css/bootstrap.css" rel="stylesheet">
8+
<!-- Bootstrap theme -->
9+
<link href="/static/bootstrap3/dist/css/bootstrap-theme.min.css" rel="stylesheet">
10+
11+
<!-- Custom styles for this template -->
12+
<link href="/static/css/theme.css" rel="stylesheet">
13+
<link href="/static/css/code.css" rel="stylesheet">
14+
<link rel="StyleSheet" href="/static/js/tree/dtree.css" type="text/css" />
15+
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
16+
<!--[if lt IE 9]>
17+
<script src="/static/bootstrap3/dist/js/html5shiv.js"></script>
18+
<script src="/static/bootstrap3/dist/js/respond.min.js"></script>
19+
<![endif]-->
20+
<script src="/static/js/rainbow-custom.min.js"></script>
21+
<script src="/static/js/jquery.js"></script>
22+
<script src="/static/js/dtree.js"></script>
23+
<title>最新更新列表_Swoole文档中心</title>
24+
</head>
25+
<body>
26+
<div class="main_right" style="width: 96%;">
27+
<style type="text/css">
28+
td {
29+
vertical-align: middle !important;
30+
}
31+
</style>
32+
<div id="readme" class="blob instapaper_body">
33+
<table class="table table-bordered table-striped" style="margin-top: 20px;">
34+
<thead>
35+
<tr>
36+
<th style="width: 70px;">版本号</th>
37+
<th>标题</th>
38+
<th>修改人</th>
39+
<th>修改时间</th>
40+
<th>操作</th>
41+
</tr>
42+
</thead>
43+
<tbody>
44+
<?php foreach($list as $li): ?>
45+
<tr>
46+
<td>
47+
<span class="badge right">版本: <?=$li['version']?></span>
48+
</td>
49+
<td><a href="/wiki_admin/main/?id=<?= $li['wiki_id']?>"><?= $li['title'] ?></a></td>
50+
<td><a href="/page/user/uid-<?= $li['uid'] ?>"><?= $users[$li['update_uid']] ?></a></td>
51+
<td><?=\Swoole\Tool::howLongAgo(date('Y-m-d H:i:s', $li['uptime']))?></td>
52+
<td>
53+
<a href="/wiki_admin/revert/?id=<?= $li['wiki_id']?>&version=<?=$li['version']-1?>" class="btn btn-sm btn-warning">回滚</a>
54+
<a href="/wiki_admin/diff/?id=<?= $li['wiki_id']?>&version=<?=$li['version']-1?>&compare=current" class="btn btn-sm btn-info">对比</a>
55+
</tr>
56+
<?php endforeach; ?>
57+
</tbody>
58+
</table>
59+
</div>
60+
<hr />
61+
<!-- Duoshuo Comment BEGIN -->
62+
<div class="ds-thread" data-thread-key="wiki-<?=$wiki_page['id']?>" data-title="<?=$wiki_page['title']?>"
63+
data-url="http://wiki.swoole.com/wiki/page/<?=$wiki_page['id']?>.html"></div>
64+
<script type="text/javascript">
65+
$(document).ready(function() {
66+
$('a').each(function(e){
67+
//外链
68+
if(this.href.substring(7, location.host.length +7) != location.host) {
69+
this.target = "_blank";
70+
}
71+
});
72+
});
73+
</script>
74+
<!-- Duoshuo Comment END -->
75+
</div>
76+
<div style="display: none">
77+
<script type="text/javascript">
78+
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
79+
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F4967f2faa888a2e52742bebe7fcb5f7d' type='text/javascript'%3E%3C/script%3E"));
80+
</script>
81+
</div>
82+
</body>
83+
</html>

0 commit comments

Comments
 (0)