Repository navigation
Expand file tree
/
Copy pathdraftList.js
More file actions
114 lines (106 loc) · 4.28 KB
/
Copy pathdraftList.js
File metadata and controls
114 lines (106 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* draft list for admin
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.4, Feb 23, 2013
*/
/* draft-list 相关操作 */
admin.draftList = {
tablePagination: new TablePaginate("draft"),
/*
* 初始化 table, pagination, comments dialog
*/
init: function (page) {
this.tablePagination.buildTable([{
text: Label.titleLabel,
index: "title",
minWidth: 110,
style: "padding-left: 12px;font-size:14px;"
}, {
text: Label.authorLabel,
index: "author",
width: 150,
style: "padding-left: 12px;"
}, {
text: Label.commentLabel,
index: "comments",
width: 80,
style: "padding-left: 12px;"
}, {
text: Label.viewLabel,
width: 60,
index: "articleViewCount",
style: "padding-left: 12px;"
}, {
text: Label.createDateLabel,
index: "date",
width: 90,
style: "padding-left: 12px;"
}]);
this.tablePagination.initPagination();
this.tablePagination.initCommentsDialog();
this.getList(page);
},
/*
* 根据当前页码获取列表
* @pagNum 当前页码
*/
getList: function (pageNum) {
$("#loadMsg").text(Label.loadingLabel);
var that = this;
$.ajax({
url: latkeConfig.servePath + "/console/articles/status/unpublished/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET",
cache: false,
success: function(result, textStatus){
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
var articles = result.articles,
articleData = [];
for (var i = 0; i < articles.length; i++) {
articleData[i] = {};
articleData[i].tags = articles[i].articleTags;
articleData[i].date = $.bowknot.getDate(articles[i].articleCreateTime);
articleData[i].comments = articles[i].articleCommentCount;
articleData[i].articleViewCount = articles[i].articleViewCount;
articleData[i].author = articles[i].authorName;
articleData[i].title = "<a class='no-underline' href='" + latkeConfig.servePath +
articles[i].articlePermalink + "' target='_blank'>" +
articles[i].articleTitle + "</a><span class='table-tag'>" + articles[i].articleTags + "</span>";
articleData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.article.get('" + articles[i].oId + "', false);\">" + Label.updateLabel + "</a> \
<a href='javascript:void(0)' onclick=\"admin.article.del('" + articles[i].oId + "', 'draft', '" + articles[i].articleTitle + "')\">" + Label.removeLabel + "</a> \
<a href='javascript:void(0)' onclick=\"admin.comment.open('" + articles[i].oId + "', 'draft')\">" + Label.commentLabel + "</a>";
}
that.tablePagination.updateTablePagination(articleData, pageNum, result.pagination);
$("#loadMsg").text("");
}
});
}
};
/*
* 注册到 admin 进行管理
*/
admin.register["draft-list"] = {
"obj": admin.draftList,
"init": admin.draftList.init,
"refresh": admin.draftList.getList
};