Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo
Commits
dbc30c2e
Commit
dbc30c2e
authored
Nov 20, 2012
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from b3log/0.5.5
0.5.5 同步到主干
parents
ab9a3dfd
80f32731
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
761 additions
and
661 deletions
+761
-661
CHANGE_LOGS.html
CHANGE_LOGS.html
+23
-0
core/pom.xml
core/pom.xml
+2
-2
core/src/main/java/org/b3log/solo/SoloServletListener.java
core/src/main/java/org/b3log/solo/SoloServletListener.java
+2
-2
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+6
-2
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+8
-4
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
.../main/java/org/b3log/solo/event/rhythm/ArticleSender.java
+6
-6
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
...ain/java/org/b3log/solo/event/symphony/CommentSender.java
+8
-8
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
...src/main/java/org/b3log/solo/processor/FeedProcessor.java
+20
-9
core/src/main/java/org/b3log/solo/processor/UpgradeProcessor.java
.../main/java/org/b3log/solo/processor/UpgradeProcessor.java
+12
-12
core/src/main/java/org/b3log/solo/service/CommentMgmtService.java
.../main/java/org/b3log/solo/service/CommentMgmtService.java
+2
-0
core/src/test/resources/skins/ease/skin.properties
core/src/test/resources/skins/ease/skin.properties
+3
-3
pom.xml
pom.xml
+3
-3
war/bae/pom.xml
war/bae/pom.xml
+2
-2
war/bae/src/main/resources/mail.properties
war/bae/src/main/resources/mail.properties
+0
-0
war/gae/pom.xml
war/gae/pom.xml
+2
-2
war/mysql/pom.xml
war/mysql/pom.xml
+2
-2
war/mysql/src/main/resources/mail.properties
war/mysql/src/main/resources/mail.properties
+29
-0
war/pom.xml
war/pom.xml
+2
-2
war/src/main/resources/lang_en_US.properties
war/src/main/resources/lang_en_US.properties
+2
-2
war/src/main/resources/lang_zh_CN.properties
war/src/main/resources/lang_zh_CN.properties
+2
-2
war/src/main/webapp/CHANGE_LOGS.html
war/src/main/webapp/CHANGE_LOGS.html
+23
-0
war/src/main/webapp/WEB-INF/appengine-web.xml
war/src/main/webapp/WEB-INF/appengine-web.xml
+2
-2
war/src/main/webapp/admin-preference.ftl
war/src/main/webapp/admin-preference.ftl
+3
-3
war/src/main/webapp/js/admin/latkeAdmin.js
war/src/main/webapp/js/admin/latkeAdmin.js
+567
-567
war/src/main/webapp/js/common.js
war/src/main/webapp/js/common.js
+22
-18
war/src/main/webapp/js/common.min.js
war/src/main/webapp/js/common.min.js
+1
-1
war/src/main/webapp/plugins/symphony-news-getter/plugin.ftl
war/src/main/webapp/plugins/symphony-news-getter/plugin.ftl
+1
-1
war/src/main/webapp/skins/ease/skin.properties
war/src/main/webapp/skins/ease/skin.properties
+3
-3
war/src/main/webapp/skins/mobile/skin.properties
war/src/main/webapp/skins/mobile/skin.properties
+3
-3
No files found.
CHANGE_LOGS.html
View file @
dbc30c2e
...
...
@@ -5,6 +5,29 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
</head>
<body>
<h2>
Release 0.5.5 - Nov 24, 2012
</h2>
<ul>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/72"
>
72 非管理员登录后 TopBar 无后台入口
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/73"
>
73 支持 BAE 部署
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/74"
>
74 跨版本升级提示
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/75"
>
75 加入页面类型变量
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/78"
>
78 MetaWeblog API 获取文章日期问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/80"
>
80 MetaWeblog API 发布文章摘要问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/82"
>
82 登录、初始化问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/85"
>
85 配置文件按项目分离
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/86"
>
86 Hello World 文章多语言
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/87"
>
87 加入运行信息公共模版变量
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/88"
>
88 登录页体验改进
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/99"
>
99 404 页面加入登录入口
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/101"
>
101 验证码改造
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/103"
>
103 本地版数据库表前缀支持
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/104"
>
104 升级到 GAE SDK 1.7.2
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/106"
>
106 摘要编辑器改进
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/111"
>
111 与社区同步
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/113"
>
113 无文章首页不返回 404
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/125"
>
125 Feed 输出加密文章
</a></li>
</ul>
<h2>
Release 0.5.0 - Aug 25, 2012
</h2>
<ul>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/16"
>
16 浏览数统计写配额优化
</a></li>
...
...
core/pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo core.
Version: 2.0.1.
0, Aug 16
, 2012
Version: 2.0.1.
1, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -17,7 +17,7 @@
<parent>
<groupId>
org.b3log
</groupId>
<artifactId>
solo
</artifactId>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
</parent>
<dependencies>
...
...
core/src/main/java/org/b3log/solo/SoloServletListener.java
View file @
dbc30c2e
...
...
@@ -53,7 +53,7 @@ import org.json.JSONObject;
* B3log Solo servlet listener.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.7.
5, Aug 16, 2011
* @version 1.0.7.
6, Nov 21, 2012
* @since 0.3.1
*/
public
final
class
SoloServletListener
extends
AbstractServletListener
{
...
...
@@ -61,7 +61,7 @@ public final class SoloServletListener extends AbstractServletListener {
/**
* B3log Solo version.
*/
public
static
final
String
VERSION
=
"0.5.
0
"
;
public
static
final
String
VERSION
=
"0.5.
5
"
;
/**
* Logger.
*/
...
...
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
dbc30c2e
...
...
@@ -42,7 +42,7 @@ import org.jsoup.Jsoup;
* Article receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 12
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -131,8 +131,12 @@ public final class ArticleReceiver {
article
.
put
(
Common
.
POST_TO_COMMUNITY
,
false
);
article
.
put
(
Article
.
ARTICLE_COMMENTABLE
,
true
);
article
.
put
(
Article
.
ARTICLE_VIEW_PWD
,
""
);
String
content
=
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
final
String
articleId
=
article
.
getString
(
Keys
.
OBJECT_ID
);
content
+=
"<br/><p><i>该文章同步自 <a href='http://symphony.b3log.org/article/"
+
articleId
+
"'>B3log 社区</a></i></p>"
;
article
.
put
(
Article
.
ARTICLE_CONTENT
,
content
);
final
String
articleId
=
articleMgmtService
.
addArticle
(
requestJSONObject
);
articleMgmtService
.
addArticle
(
requestJSONObject
);
ret
.
put
(
Keys
.
OBJECT_ID
,
articleId
);
ret
.
put
(
Keys
.
MSG
,
"add article succ"
);
...
...
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
dbc30c2e
...
...
@@ -65,7 +65,7 @@ import org.json.JSONObject;
* Comment receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 17
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -130,6 +130,7 @@ public final class CommentReceiver {
* "comment": {
* "userB3Key": "",
* "oId": "",
* "commentSymphonyArticleId": "",
* "commentOnArticleId": "",
* "commentAuthorName": "",
* "commentAuthorEmail": "",
...
...
@@ -177,12 +178,15 @@ public final class CommentReceiver {
final
String
commentName
=
symphonyCmt
.
getString
(
"commentAuthorName"
);
final
String
commentEmail
=
symphonyCmt
.
getString
(
"commentAuthorEmail"
).
trim
().
toLowerCase
();
final
String
commentURL
=
"http://"
+
symphonyCmt
.
optString
(
"commentAuthorURL"
);
final
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
commentContent
+=
"<br/><p><i>该评论同步自 <a href='http://symphony.b3log.org/article/"
+
symphonyCmt
.
optString
(
"commentSymphonyArticleId"
)
+
"#"
+
commentId
+
"'>B3log 社区</a></i></p>"
;
final
String
originalCommentId
=
symphonyCmt
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
// Step 1: Add comment
final
JSONObject
comment
=
new
JSONObject
();
JSONObject
originalComment
=
null
;
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
comment
.
put
(
Keys
.
OBJECT_ID
,
commentId
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
commentName
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
commentEmail
);
...
...
@@ -209,7 +213,7 @@ public final class CommentReceiver {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
}
setCommentThumbnailURL
(
comment
);
ret
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
comment
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
// Sets comment on article....
...
...
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
View file @
dbc30c2e
...
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
* This listener is responsible for sending article to B3log Rhythm.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.
2, Nov 2
, 2012
* @version 1.0.2.
3, Nov 19
, 2012
* @since 0.3.1
*/
public
final
class
ArticleSender
extends
AbstractEventListener
<
JSONObject
>
{
...
...
@@ -95,11 +95,11 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm",
//
new Object[]{originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm"
,
new
Object
[]{
originalArticle
.
getString
(
Keys
.
OBJECT_ID
),
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_ARTICLE_URL
);
...
...
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
View file @
dbc30c2e
...
...
@@ -40,7 +40,7 @@ import org.json.JSONObject;
* This listener is responsible for sending comment to B3log Symphony.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
0, Oct 18
, 2012
* @version 1.0.0.
2, Nov 20
, 2012
* @since 0.5.5
*/
public
final
class
CommentSender
extends
AbstractEventListener
<
JSONObject
>
{
...
...
@@ -60,7 +60,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
/**
* B3log Symphony address.
*/
public
static
final
String
B3LOG_SYMPHONY_ADDRESS
=
"http://symphony.b3log.org:80
80
"
;
public
static
final
String
B3LOG_SYMPHONY_ADDRESS
=
"http://symphony.b3log.org:80"
;
/**
* URL of adding comment to Symphony.
*/
...
...
@@ -89,11 +89,11 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony",
// new Object[]{or
ginalComment.getString(Keys.OBJECT_ID)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony"
,
new
Object
[]{
ori
ginalComment
.
getString
(
Keys
.
OBJECT_ID
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_COMMENT_URL
);
...
...
@@ -109,7 +109,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
requestJSONObject
.
put
(
Comment
.
COMMENT
,
comment
);
requestJSONObject
.
put
(
"clientVersion"
,
SoloServletListener
.
VERSION
);
requestJSONObject
.
put
(
"clientRuntimeEnv"
,
Latkes
.
getRuntimeEnv
().
name
());
requestJSONObject
.
put
(
"client
n
Name"
,
"B3log Solo"
);
requestJSONObject
.
put
(
"clientName"
,
"B3log Solo"
);
requestJSONObject
.
put
(
"clientHost"
,
blogHost
);
requestJSONObject
.
put
(
"clientAdminEmail"
,
preference
.
optString
(
Preference
.
ADMIN_EMAIL
));
requestJSONObject
.
put
(
"userB3Key"
,
preference
.
optString
(
Preference
.
KEY_OF_SOLO
));
...
...
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
View file @
dbc30c2e
...
...
@@ -26,6 +26,9 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.CompositeFilter
;
import
org.b3log.latke.repository.CompositeFilterOperator
;
import
org.b3log.latke.repository.Filter
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.PropertyFilter
;
import
org.b3log.latke.repository.Query
;
...
...
@@ -64,7 +67,7 @@ import org.json.JSONObject;
* Feed (Atom/RSS) processor.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.1.0.
1, Aug 2
, 2012
* @version 1.1.0.
2, Nov 15
, 2012
* @since 0.3.1
*/
@RequestProcessor
...
...
@@ -124,9 +127,12 @@ public final class FeedProcessor {
feed
.
setLink
(
"http://"
+
blogHost
+
"/blog-articles-feed.do"
);
feed
.
setId
(
"http://"
+
blogHost
+
"/"
);
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setPageSize
(
ENTRY_OUTPUT_CNT
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
addSort
(
Article
.
ARTICLE_UPDATE_DATE
,
SortDirection
.
DESCENDING
).
setPageCount
(
1
);
...
...
@@ -149,7 +155,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
entry
.
setTitle
(
title
);
final
String
summary
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
entry
.
setSummary
(
summary
);
final
Date
updated
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
entry
.
setUpdated
(
updated
);
...
...
@@ -249,7 +255,8 @@ public final class FeedProcessor {
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
getJSONObject
(
i
);
final
String
articleId
=
tagArticleRelation
.
getString
(
Article
.
ARTICLE
+
"_"
+
Keys
.
OBJECT_ID
);
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
// Skips the unpublished article
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
)
// Skips the unpublished article
&&
Strings
.
isEmptyOrNull
(
article
.
optString
(
Article
.
ARTICLE_VIEW_PWD
)))
{
// Skips article with password
articles
.
add
(
article
);
}
}
...
...
@@ -270,7 +277,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
entry
.
setTitle
(
title
);
final
String
summary
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
entry
.
setSummary
(
summary
);
final
Date
updated
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
entry
.
setUpdated
(
updated
);
...
...
@@ -339,9 +346,12 @@ public final class FeedProcessor {
channel
.
setLanguage
(
language
+
'-'
+
country
);
channel
.
setDescription
(
blogSubtitle
);
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setPageSize
(
ENTRY_OUTPUT_CNT
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
addSort
(
Article
.
ARTICLE_UPDATE_DATE
,
SortDirection
.
DESCENDING
).
setPageCount
(
1
);
...
...
@@ -364,7 +374,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
item
.
setTitle
(
title
);
final
String
description
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
item
.
setDescription
(
description
);
final
Date
pubDate
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
item
.
setPubDate
(
pubDate
);
...
...
@@ -467,7 +477,8 @@ public final class FeedProcessor {
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
getJSONObject
(
i
);
final
String
articleId
=
tagArticleRelation
.
getString
(
Article
.
ARTICLE
+
"_"
+
Keys
.
OBJECT_ID
);
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
// Skips the unpublished article
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
)
// Skips the unpublished article
&&
Strings
.
isEmptyOrNull
(
article
.
optString
(
Article
.
ARTICLE_VIEW_PWD
)))
{
// Skips article with password
articles
.
add
(
article
);
}
}
...
...
@@ -488,7 +499,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
item
.
setTitle
(
title
);
final
String
description
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
item
.
setDescription
(
description
);
final
Date
pubDate
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
item
.
setPubDate
(
pubDate
);
...
...
core/src/main/java/org/b3log/solo/processor/UpgradeProcessor.java
View file @
dbc30c2e
...
...
@@ -45,7 +45,7 @@ import org.json.JSONObject;
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:dongxv.vang@gmail.com">Dongxu Wang</a>
* @version 1.1.1.
3, Aug 30
, 2012
* @version 1.1.1.
4, Nov 21
, 2012
* @since 0.3.1
*/
@RequestProcessor
...
...
@@ -123,10 +123,10 @@ public final class UpgradeProcessor {
return
;
}
if
(
"0.
4.6
"
.
equals
(
version
))
{
v0
46ToV050
();
if
(
"0.
5.0
"
.
equals
(
version
))
{
v0
50ToV055
();
}
else
{
LOGGER
.
log
(
Level
.
WARNING
,
"Attempt to skip more than one version to upgrade. Expected: 0.
4.6
; Actually: {0}"
,
version
);
LOGGER
.
log
(
Level
.
WARNING
,
"Attempt to skip more than one version to upgrade. Expected: 0.
5.0
; Actually: {0}"
,
version
);
if
(!
sent
){
notifyUserByEmail
();
sent
=
true
;
...
...
@@ -141,12 +141,12 @@ public final class UpgradeProcessor {
}
/**
* Upgrades from version 0
46 to version 050
.
* Upgrades from version 0
50 to version 055
.
*
* @throws Exception upgrade fails
*/
private
void
v0
46ToV050
()
throws
Exception
{
LOGGER
.
info
(
"Upgrading from version 0
46 to version 050
...."
);
private
void
v0
50ToV055
()
throws
Exception
{
LOGGER
.
info
(
"Upgrading from version 0
50 to version 055
...."
);
articleRepository
.
setCacheEnabled
(
false
);
...
...
@@ -157,25 +157,25 @@ public final class UpgradeProcessor {
// Upgrades preference model
final
JSONObject
preference
=
preferenceRepository
.
get
(
Preference
.
PREFERENCE
);
preference
.
put
(
Preference
.
VERSION
,
"0.5.
0
"
);
preference
.
put
(
Preference
.
VERSION
,
"0.5.
5
"
);
preferenceRepository
.
update
(
Preference
.
PREFERENCE
,
preference
);
LOGGER
.
log
(
Level
.
FINEST
,
"Updated preference"
);
transaction
.
commit
();
LOGGER
.
log
(
Level
.
FINEST
,
"Updated preference"
);
}
catch
(
final
Exception
e
)
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Upgrade failed."
,
e
);
throw
new
Exception
(
"Upgrade failed from version 0
46 to version 050
"
);
throw
new
Exception
(
"Upgrade failed from version 0
50 to version 055
"
);
}
finally
{
articleRepository
.
setCacheEnabled
(
true
);
}
LOGGER
.
info
(
"Upgraded from version 0
46 to version 050
successfully :-)"
);
LOGGER
.
info
(
"Upgraded from version 0
50 to version 055
successfully :-)"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/service/CommentMgmtService.java
View file @
dbc30c2e
...
...
@@ -246,6 +246,7 @@ public final class CommentMgmtService {
final
String
commentEmail
=
requestJSONObject
.
getString
(
Comment
.
COMMENT_EMAIL
).
trim
().
toLowerCase
();
final
String
commentURL
=
requestJSONObject
.
optString
(
Comment
.
COMMENT_URL
);
String
commentContent
=
requestJSONObject
.
getString
(
Comment
.
COMMENT_CONTENT
).
replaceAll
(
"\\n"
,
SoloServletListener
.
ENTER_ESC
);
final
String
contentNoEsc
=
commentContent
;
commentContent
=
StringEscapeUtils
.
escapeHtml
(
commentContent
);
final
String
originalCommentId
=
requestJSONObject
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
// Step 1: Add comment
...
...
@@ -305,6 +306,7 @@ public final class CommentMgmtService {
// Step 5: Fire add comment event
final
JSONObject
eventData
=
new
JSONObject
();
eventData
.
put
(
Comment
.
COMMENT
,
comment
);
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
contentNoEsc
);
eventData
.
put
(
Article
.
ARTICLE
,
article
);
eventManager
.
fireEventSynchronously
(
new
Event
<
JSONObject
>(
EventTypes
.
ADD_COMMENT_TO_ARTICLE
,
eventData
));
...
...
core/src/test/resources/skins/ease/skin.properties
View file @
dbc30c2e
...
...
@@ -16,11 +16,11 @@
#
# Description: ease skin (mock for test).
# Version: 1.0.0.
1, Aug 16
, 2012
# Version: 1.0.0.
2, Nov 21
, 2012
# Author: Liang Ding
#
name
=
ease
version
=
1.0.
2
forSolo
=
0.5.
0
version
=
1.0.
3
forSolo
=
0.5.
5
memo
=
\u
56de
\u
5f52
\u
606c
\u9759
pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo parent POM.
Version: 2.0.2.
4, Sep 20
, 2012
Version: 2.0.2.
5, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -11,7 +11,7 @@
<groupId>
org.b3log
</groupId>
<artifactId>
solo
</artifactId>
<packaging>
pom
</packaging>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
<name>
B3log Solo
</name>
<url>
https://github.com/b3log/b3log-solo
</url>
<description>
...
...
@@ -28,7 +28,7 @@
<!-- Properties -->
<properties>
<servlet.version>
2.5
</servlet.version>
<org.b3log.solo.version>
0.5.
0
</org.b3log.solo.version>
<org.b3log.solo.version>
0.5.
5
</org.b3log.solo.version>
<org.b3log.latke.version>
0.5.0-SNAPSHOT
</org.b3log.latke.version>
<org.b3log.latke-gae.version>
0.5.0-SNAPSHOT
</org.b3log.latke-gae.version>
<org.b3log.latke-bae.version>
0.5.0-SNAPSHOT
</org.b3log.latke-bae.version>
...
...
war/bae/pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo BAE POM.
Version: 1.0.1.
0, Sep 5
, 2012
Version: 1.0.1.
1, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -19,7 +19,7 @@
<parent>
<groupId>
org.b3log
</groupId>
<artifactId>
solo-war
</artifactId>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
</parent>
<properties>
...
...
war/src/main/resources/mail.properties
→
war/
bae/
src/main/resources/mail.properties
View file @
dbc30c2e
File moved
war/gae/pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo GAE POM.
Version: 2.0.2.
0, Sep 5
, 2012
Version: 2.0.2.
1, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -19,7 +19,7 @@
<parent>
<groupId>
org.b3log
</groupId>
<artifactId>
solo-war
</artifactId>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
</parent>
<properties>
...
...
war/mysql/pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo (MySQL) standard Servlet container POM.
Version: 1.0.1.
0, Sep 5
, 2012
Version: 1.0.1.
1, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -19,7 +19,7 @@
<parent>
<groupId>
org.b3log
</groupId>
<artifactId>
solo-war
</artifactId>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
</parent>
<properties>
...
...
war/mysql/src/main/resources/mail.properties
0 → 100644
View file @
dbc30c2e
#
# Copyright (c) 2009, 2010, 2011, 2012, B3log Team
#
# 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.
#
#
# Description: B3log Solo mail configurations. Configures this file if B3log Solo
# runs on standard Servlet container, it is unnecessary to change
# this file if B3log Solo runs on Google App Engine.
# Version: 1.0.0.2, Sep 29, 2011
# Author: Liang Ding
#
mail.user
=
b3log.solo@gmail.com
mail.password
=
b3logsolo
mail.debug
=
false
mail.smtp.host
=
smtp.gmail.com
mail.smtp.port
=
587
war/pom.xml
View file @
dbc30c2e
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo WAR POM.
Version: 2.0.1.
4, Sep 4
, 2012
Version: 2.0.1.
5, Nov 21
, 2012
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -19,7 +19,7 @@
<parent>
<groupId>
org.b3log
</groupId>
<artifactId>
solo
</artifactId>
<version>
0.5.
0
</version>
<version>
0.5.
5
</version>
</parent>
<modules>
...
...
war/src/main/resources/lang_en_US.properties
View file @
dbc30c2e
...
...
@@ -16,7 +16,7 @@
#
# Description: B3log Solo language configurations(en_US).
# Version: 2.1.0.
0, Sep 19
, 2012
# Version: 2.1.0.
1, Nov 14
, 2012
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
...
...
@@ -257,7 +257,7 @@ abstractLabel=Abstract
fullContentLabel
=
Full Content
author1Label
=
Author:
authorLabel
=
Author
keyOfSolo1Label
=
Solo
Key:
keyOfSolo1Label
=
B3log
Key:
articleLabel
=
Article
tagArticlesLabel
=
Tag Articles
dateArticlesLabel
=
Archive Date Articles
...
...
war/src/main/resources/lang_zh_CN.properties
View file @
dbc30c2e
...
...
@@ -16,7 +16,7 @@
#
# Description: B3log Solo default language configurations(zh_CN).
# Version: 2.1.0.
6, Sep 7
, 2012
# Version: 2.1.0.
7, Nov 14
, 2012
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
...
...
@@ -257,7 +257,7 @@ abstractLabel=\u6458\u8981
fullContentLabel=
\u5168\u6587
author1Label=
\u
4f5c
\u8005\u
ff1a
authorLabel
=
\u
4f5c
\u8005
keyOfSolo1Label=
Solo
Key
\u
ff1a
keyOfSolo1Label=
B3log
Key
\u
ff1a
articleLabel
=
\u6587\u
7ae0
tagArticlesLabel
=
\u6807\u
7b7e
\u6587\u
7ae0
\u5217\u8868
dateArticlesLabel=
\u
5b58
\u6863\u6587\u
7ae0
\u5217\u8868
...
...
war/src/main/webapp/CHANGE_LOGS.html
View file @
dbc30c2e
...
...
@@ -5,6 +5,29 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
</head>
<body>
<h2>
Release 0.5.5 - Nov 24, 2012
</h2>
<ul>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/72"
>
72 非管理员登录后 TopBar 无后台入口
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/73"
>
73 支持 BAE 部署
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/74"
>
74 跨版本升级提示
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/75"
>
75 加入页面类型变量
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/78"
>
78 MetaWeblog API 获取文章日期问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/80"
>
80 MetaWeblog API 发布文章摘要问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/82"
>
82 登录、初始化问题
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/85"
>
85 配置文件按项目分离
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/86"
>
86 Hello World 文章多语言
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/87"
>
87 加入运行信息公共模版变量
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/88"
>
88 登录页体验改进
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/99"
>
99 404 页面加入登录入口
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/101"
>
101 验证码改造
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/103"
>
103 本地版数据库表前缀支持
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/104"
>
104 升级到 GAE SDK 1.7.2
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/106"
>
106 摘要编辑器改进
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/111"
>
111 与社区同步
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/113"
>
113 无文章首页不返回 404
</a></li>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/125"
>
125 Feed 输出加密文章
</a></li>
</ul>
<h2>
Release 0.5.0 - Aug 25, 2012
</h2>
<ul>
<li><a
href=
"https://github.com/b3log/b3log-solo/issues/16"
>
16 浏览数统计写配额优化
</a></li>
...
...
war/src/main/webapp/WEB-INF/appengine-web.xml
View file @
dbc30c2e
...
...
@@ -20,12 +20,12 @@
Description: Web deployment descriptor on GAE. See
http://code.google.com/intl/en/appengine/docs/java/config/appconfig.html
for more details.
Version: 1.0.3.
9, Aug 22
, 2012
Version: 1.0.3.
10, Nov 21
, 2012
Author: Liang Ding
-->
<appengine-web-app
xmlns=
"http://appengine.google.com/ns/1.0"
>
<application>
solo-demo
</application>
<version>
05
0
</version>
<version>
05
5
</version>
<sessions-enabled>
true
</sessions-enabled>
...
...
war/src/main/webapp/admin-preference.ftl
View file @
dbc30c2e
...
...
@@ -20,11 +20,11 @@
<a href="#tools/preference/setting">${paramSettingsLabel}</a>
</div>
</li>
<
!--
li>
<li>
<div id="tabPreference_solo">
<a href="#tools/preference/solo">
Solo
</a>
<a href="#tools/preference/solo">
B3log
</a>
</div>
</li
--
>
</li>
</ul>
</div>
<div id="tabPreferencePanel" class="sub-tabs-main">
...
...
war/src/main/webapp/js/admin/latkeAdmin.js
View file @
dbc30c2e
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*/
/**
* index for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.2.0, Aug 30, 2012
*/
var
Admin
=
function
()
{
this
.
register
=
{};
// 工具栏下的工具
this
.
tools
=
[
'
#page-list
'
,
'
#file-list
'
,
'
#link-list
'
,
'
#preference
'
,
'
#user-list
'
,
'
#plugin-list
'
,
'
#others
'
];
// 多用户时,一般用户不能使用的功能
this
.
adTools
=
[
'
link-list
'
,
'
preference
'
,
'
file-list
'
,
'
page-list
'
,
'
user-list
'
,
'
plugin-list
'
,
'
others
'
];
};
$
.
extend
(
Admin
.
prototype
,
{
/*
* 登出
*/
logout
:
function
()
{
window
.
location
.
href
=
latkeConfig
.
servePath
+
"
/logout?goto=
"
+
latkeConfig
.
servePath
;
},
/*
* 根据当前页数设置 hash
* @currentPage {string} 当前页
*/
setHashByPage
:
function
(
currentPage
)
{
var
hash
=
window
.
location
.
hash
,
hashList
=
hash
.
split
(
"
/
"
);
if
(
/^
\d
*$/
.
test
(
hashList
[
hashList
.
length
-
1
]))
{
hashList
[
hashList
.
length
-
1
]
=
currentPage
;
}
else
{
hashList
.
push
(
currentPage
);
}
window
.
location
.
hash
=
hashList
.
join
(
"
/
"
);
},
/*
* 设置某个 tab 被选择
* @id tab id
*/
selectTab
:
function
(
id
)
{
window
.
location
.
hash
=
"
#
"
+
id
;
},
/*
* 根据当前 hash 解析出当前页数及 hash 数组。
*/
analyseHash
:
function
()
{
var
hash
=
window
.
location
.
hash
;
var
tag
=
hash
.
substr
(
1
,
hash
.
length
-
1
);
var
tagList
=
tag
.
split
(
"
/
"
);
var
tags
=
{};
tags
.
page
=
1
,
tags
.
hashList
=
[];
for
(
var
i
=
0
;
i
<
tagList
.
length
;
i
++
)
{
if
(
i
===
tagList
.
length
-
1
&&
(
/^
\d
+$/
.
test
(
tagList
[
i
])))
{
tags
.
page
=
tagList
[
i
];
}
else
{
tags
.
hashList
.
push
(
tagList
[
i
]);
}
}
return
tags
;
},
/*
* 根据当前 hash 设置当前 tab
*/
setCurByHash
:
function
()
{
var
tags
=
admin
.
analyseHash
();
var
tab
=
tags
.
hashList
[
1
],
subTab
=
tags
.
hashList
[
2
];
if
(
tags
.
hashList
.
length
===
1
)
{
tab
=
tags
.
hashList
[
0
];
}
if
(
tab
===
""
)
{
return
;
}
// 离开编辑器时进行提示
try
{
// 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。
if
(
tab
!==
"
article
"
&&
admin
.
article
.
isConfirm
&&
admin
.
editorArticle
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
"
#article/article
"
;
return
;
}
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
"
article
"
&&
admin
.
article
.
isConfirm
&&
admin
.
editorArticle
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
return
;
}
}
catch
(
e
)
{
var
$articleContent
=
$
(
'
#articleContent
'
);
if
(
$articleContent
.
length
>
0
)
{
if
(
tab
!==
"
article
"
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
"
#article/article
"
;
return
;
}
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
"
article
"
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
return
;
}
}
}
// clear article
if
(
tab
!==
"
article
"
&&
admin
.
editorArticle
.
setContent
)
{
admin
.
article
.
clear
();
}
admin
.
article
.
isConfirm
=
true
;
$
(
"
#tabs
"
).
tabs
(
"
setCurrent
"
,
tab
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
if
(
$
(
"
#tabsPanel_
"
+
tab
).
length
===
1
)
{
if
(
$
(
"
#tabsPanel_
"
+
tab
).
html
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
// 还未加载 HTML
$
(
"
#tabsPanel_
"
+
tab
).
load
(
"
admin-
"
+
tab
+
"
.do
"
,
function
()
{
// 页面加载完后,回调初始函数
if
(
tab
===
"
article
"
&&
admin
.
article
.
status
.
id
)
{
// 当文章页面编辑器未初始化时,调用更新文章需先初始化编辑器
admin
.
register
[
tab
].
init
.
call
(
admin
.
register
[
tab
].
obj
,
admin
.
article
.
getAndSet
);
}
else
{
admin
.
register
[
tab
].
init
.
call
(
admin
.
register
[
tab
].
obj
,
tags
.
page
);
}
// 页面包含子 tab,需根据 hash 定位到相应的 tab
if
(
subTab
)
{
$
(
"
#tab
"
+
tab
.
substring
(
0
,
1
).
toUpperCase
()
+
tab
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
subTab
);
}
// 根据 hash 调用现有的插件函数
admin
.
plugin
.
setCurByHash
(
tags
);
});
}
else
{
if
(
tab
===
"
article
"
&&
admin
.
article
.
status
.
id
)
{
admin
.
article
.
getAndSet
();
}
// 已加载过 HTML,只需调用刷新函数
if
(
admin
.
register
[
tab
]
&&
admin
.
register
[
tab
].
refresh
)
{
admin
.
register
[
tab
].
refresh
.
call
(
admin
.
register
[
tab
].
obj
,
tags
.
page
);
}
// 页面包含子 tab,需根据 hash 定位到相应的 tab
if
(
subTab
)
{
$
(
"
#tab
"
+
tab
.
substring
(
0
,
1
).
toUpperCase
()
+
tab
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
subTab
);
}
// 根据 hash 调用现有的插件函数
admin
.
plugin
.
setCurByHash
(
tags
);
}
}
else
{
$
(
"
#tipMsg
"
).
text
(
"
Error: No tab!
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
},
/*
* 初始化整个后台
*/
init
:
function
()
{
//window.onerror = Util.error;
Util
.
killIE
();
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
// 构建 tabs
$
(
"
#tabs
"
).
tabs
();
// tipMsg
setInterval
(
function
()
{
if
(
$
(
"
#tipMsg
"
).
text
()
!==
""
)
{
setTimeout
(
function
()
{
$
(
"
#tipMsg
"
).
text
(
""
);
},
7000
);
}
},
6000
);
$
(
"
#loadMsg
"
).
text
(
""
);
},
/*
* @description tools and article collapse
* @param {bom} it 触发事件对象
*/
collapseNav
:
function
(
it
)
{
var
subNav
=
$
(
it
).
next
();
subNav
.
slideToggle
(
"
normal
"
,
function
()
{
if
(
this
.
style
.
display
!==
"
none
"
)
{
$
(
it
).
find
(
"
.ico-arrow-down
"
)[
0
].
className
=
"
ico-arrow-up
"
;
}
else
{
$
(
it
).
find
(
"
.ico-arrow-up
"
)[
0
].
className
=
"
ico-arrow-down
"
;
}
});
},
/*
* 后台及当前页面所需插件初始化完后,对权限进行控制及当前页面属于 tools 时,tools 选项需展开。
*/
inited
:
function
()
{
// Removes functions with the current user role
if
(
Label
.
userRole
!==
"
adminRole
"
)
{
for
(
var
i
=
0
;
i
<
this
.
adTools
.
length
;
i
++
)
{
$
(
"
#tabs
"
).
tabs
(
"
remove
"
,
this
.
adTools
[
i
]);
}
}
else
{
// 当前 tab 属于 Tools 时,设其展开
for
(
var
j
=
0
;
j
<
this
.
tools
.
length
;
j
++
)
{
if
(
"
#
"
+
window
.
location
.
hash
.
split
(
"
/
"
)[
1
]
===
this
.
tools
[
j
])
{
$
(
"
#tabToolsTitle
"
).
click
();
break
;
}
}
}
this
.
setCurByHash
();
}
});
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*/
/**
* index for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.2.0, Aug 30, 2012
*/
var
Admin
=
function
()
{
this
.
register
=
{};
// 工具栏下的工具
this
.
tools
=
[
'
#page-list
'
,
'
#file-list
'
,
'
#link-list
'
,
'
#preference
'
,
'
#user-list
'
,
'
#plugin-list
'
,
'
#others
'
];
// 多用户时,一般用户不能使用的功能
this
.
adTools
=
[
'
link-list
'
,
'
preference
'
,
'
file-list
'
,
'
page-list
'
,
'
user-list
'
,
'
plugin-list
'
,
'
others
'
];
};
$
.
extend
(
Admin
.
prototype
,
{
/*
* 登出
*/
logout
:
function
()
{
window
.
location
.
href
=
latkeConfig
.
servePath
+
"
/logout?goto=
"
+
latkeConfig
.
servePath
;
},
/*
* 根据当前页数设置 hash
* @currentPage {string} 当前页
*/
setHashByPage
:
function
(
currentPage
)
{
var
hash
=
window
.
location
.
hash
,
hashList
=
hash
.
split
(
"
/
"
);
if
(
/^
\d
*$/
.
test
(
hashList
[
hashList
.
length
-
1
]))
{
hashList
[
hashList
.
length
-
1
]
=
currentPage
;
}
else
{
hashList
.
push
(
currentPage
);
}
window
.
location
.
hash
=
hashList
.
join
(
"
/
"
);
},
/*
* 设置某个 tab 被选择
* @id tab id
*/
selectTab
:
function
(
id
)
{
window
.
location
.
hash
=
"
#
"
+
id
;
},
/*
* 根据当前 hash 解析出当前页数及 hash 数组。
*/
analyseHash
:
function
()
{
var
hash
=
window
.
location
.
hash
;
var
tag
=
hash
.
substr
(
1
,
hash
.
length
-
1
);
var
tagList
=
tag
.
split
(
"
/
"
);
var
tags
=
{};
tags
.
page
=
1
,
tags
.
hashList
=
[];
for
(
var
i
=
0
;
i
<
tagList
.
length
;
i
++
)
{
if
(
i
===
tagList
.
length
-
1
&&
(
/^
\d
+$/
.
test
(
tagList
[
i
])))
{
tags
.
page
=
tagList
[
i
];
}
else
{
tags
.
hashList
.
push
(
tagList
[
i
]);
}
}
return
tags
;
},
/*
* 根据当前 hash 设置当前 tab
*/
setCurByHash
:
function
()
{
var
tags
=
admin
.
analyseHash
();
var
tab
=
tags
.
hashList
[
1
],
subTab
=
tags
.
hashList
[
2
];
if
(
tags
.
hashList
.
length
===
1
)
{
tab
=
tags
.
hashList
[
0
];
}
if
(
tab
===
""
)
{
return
;
}
// 离开编辑器时进行提示
try
{
// 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。
if
(
tab
!==
"
article
"
&&
admin
.
article
.
isConfirm
&&
admin
.
editorArticle
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
"
#article/article
"
;
return
;
}
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
"
article
"
&&
admin
.
article
.
isConfirm
&&
admin
.
editorArticle
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
return
;
}
}
catch
(
e
)
{
var
$articleContent
=
$
(
'
#articleContent
'
);
if
(
$articleContent
.
length
>
0
)
{
if
(
tab
!==
"
article
"
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
"
#article/article
"
;
return
;
}
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
"
article
"
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
""
)
{
return
;
}
}
}
// clear article
if
(
tab
!==
"
article
"
&&
admin
.
editorArticle
.
setContent
)
{
admin
.
article
.
clear
();
}
admin
.
article
.
isConfirm
=
true
;
$
(
"
#tabs
"
).
tabs
(
"
setCurrent
"
,
tab
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
if
(
$
(
"
#tabsPanel_
"
+
tab
).
length
===
1
)
{
if
(
$
(
"
#tabsPanel_
"
+
tab
).
html
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
// 还未加载 HTML
$
(
"
#tabsPanel_
"
+
tab
).
load
(
"
admin-
"
+
tab
+
"
.do
"
,
function
()
{
// 页面加载完后,回调初始函数
if
(
tab
===
"
article
"
&&
admin
.
article
.
status
.
id
)
{
// 当文章页面编辑器未初始化时,调用更新文章需先初始化编辑器
admin
.
register
[
tab
].
init
.
call
(
admin
.
register
[
tab
].
obj
,
admin
.
article
.
getAndSet
);
}
else
{
admin
.
register
[
tab
].
init
.
call
(
admin
.
register
[
tab
].
obj
,
tags
.
page
);
}
// 页面包含子 tab,需根据 hash 定位到相应的 tab
if
(
subTab
)
{
$
(
"
#tab
"
+
tab
.
substring
(
0
,
1
).
toUpperCase
()
+
tab
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
subTab
);
}
// 根据 hash 调用现有的插件函数
admin
.
plugin
.
setCurByHash
(
tags
);
});
}
else
{
if
(
tab
===
"
article
"
&&
admin
.
article
.
status
.
id
)
{
admin
.
article
.
getAndSet
();
}
// 已加载过 HTML,只需调用刷新函数
if
(
admin
.
register
[
tab
]
&&
admin
.
register
[
tab
].
refresh
)
{
admin
.
register
[
tab
].
refresh
.
call
(
admin
.
register
[
tab
].
obj
,
tags
.
page
);
}
// 页面包含子 tab,需根据 hash 定位到相应的 tab
if
(
subTab
)
{
$
(
"
#tab
"
+
tab
.
substring
(
0
,
1
).
toUpperCase
()
+
tab
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
subTab
);
}
// 根据 hash 调用现有的插件函数
admin
.
plugin
.
setCurByHash
(
tags
);
}
}
else
{
$
(
"
#tipMsg
"
).
text
(
"
Error: No tab!
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
},
/*
* 初始化整个后台
*/
init
:
function
()
{
//window.onerror = Util.error;
Util
.
killIE
();
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
// 构建 tabs
$
(
"
#tabs
"
).
tabs
();
// tipMsg
setInterval
(
function
()
{
if
(
$
(
"
#tipMsg
"
).
text
()
!==
""
)
{
setTimeout
(
function
()
{
$
(
"
#tipMsg
"
).
text
(
""
);
},
7000
);
}
},
6000
);
$
(
"
#loadMsg
"
).
text
(
""
);
},
/*
* @description tools and article collapse
* @param {bom} it 触发事件对象
*/
collapseNav
:
function
(
it
)
{
var
subNav
=
$
(
it
).
next
();
subNav
.
slideToggle
(
"
normal
"
,
function
()
{
if
(
this
.
style
.
display
!==
"
none
"
)
{
$
(
it
).
find
(
"
.ico-arrow-down
"
)[
0
].
className
=
"
ico-arrow-up
"
;
}
else
{
$
(
it
).
find
(
"
.ico-arrow-up
"
)[
0
].
className
=
"
ico-arrow-down
"
;
}
});
},
/*
* 后台及当前页面所需插件初始化完后,对权限进行控制及当前页面属于 tools 时,tools 选项需展开。
*/
inited
:
function
()
{
// Removes functions with the current user role
if
(
Label
.
userRole
!==
"
adminRole
"
)
{
for
(
var
i
=
0
;
i
<
this
.
adTools
.
length
;
i
++
)
{
$
(
"
#tabs
"
).
tabs
(
"
remove
"
,
this
.
adTools
[
i
]);
}
}
else
{
// 当前 tab 属于 Tools 时,设其展开
for
(
var
j
=
0
;
j
<
this
.
tools
.
length
;
j
++
)
{
if
(
"
#
"
+
window
.
location
.
hash
.
split
(
"
/
"
)[
1
]
===
this
.
tools
[
j
])
{
$
(
"
#tabToolsTitle
"
).
click
();
break
;
}
}
}
this
.
setCurByHash
();
}
});
var
admin
=
new
Admin
();
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
...
...
@@ -3101,326 +3101,326 @@ admin.register["plugin-list"] = {
"
refresh
"
:
function
()
{
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*/
/**
* user list for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.3, Aug 30, 2012
*/
/* user-list 相关操作 */
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:
{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:
{
'
oId
'
:
""
,
"
userRole
"
:
""
},
/*
* 初始化 table, pagination
*/
init
:
function
(
page
)
{
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentNameLabel
,
index
:
"
userName
"
,
width
:
230
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentEmailLabel
,
index
:
"
userEmail
"
,
minWidth
:
180
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
administratorLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]);
this
.
tablePagination
.
initPagination
();
this
.
getList
(
page
);
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
190
,
"
modal
"
:
true
,
"
hideFooter
"
:
true
});
},
/*
* 根据当前页码获取列表
* @pagNum 当前页码
*/
getList
:
function
(
pageNum
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
this
.
pageInfo
.
currentPage
=
pageNum
;
var
that
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
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
users
=
result
.
users
;
var
userData
=
[];
admin
.
userList
.
pageInfo
.
currentCount
=
users
.
length
;
admin
.
userList
.
pageInfo
.
pageCount
=
result
.
pagination
.
paginationPageCount
;
if
(
users
.
length
<
1
)
{
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
for
(
var
i
=
0
;
i
<
users
.
length
;
i
++
)
{
userData
[
i
]
=
{};
userData
[
i
].
userName
=
users
[
i
].
userName
;
userData
[
i
].
userEmail
=
users
[
i
].
userEmail
;
if
(
"
adminRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
;
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
;
}
else
{
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
\
<a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
users
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
userData
[
i
].
isAdmin
=
Label
.
commonUserLabel
;
}
}
that
.
tablePagination
.
updateTablePagination
(
userData
,
pageNum
,
result
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 添加用户
*/
add
:
function
()
{
if
(
this
.
validate
())
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userName
"
).
val
(),
"
userEmail
"
:
$
(
"
#userEmail
"
).
val
(),
"
userPassword
"
:
$
(
"
#userPassword
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
POST
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#userName
"
).
val
(
""
);
$
(
"
#userEmail
"
).
val
(
""
);
$
(
"
#userPassword
"
).
val
(
""
);
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
++
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
admin
.
userList
.
pageInfo
.
pageCount
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
admin
.
userList
.
pageInfo
.
pageCount
);
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
pageCount
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 获取用户
* @id 用户 id
*/
get
:
function
(
id
,
userRole
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
$userEmailUpdate
=
$
(
"
#userEmailUpdate
"
);
$
(
"
#userNameUpdate
"
).
val
(
result
.
user
.
userName
).
data
(
"
userInfo
"
,
{
'
oId
'
:
id
,
"
userRole
"
:
userRole
});
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
if
(
"
adminRole
"
===
userRole
)
{
$userEmailUpdate
.
attr
(
"
disabled
"
,
"
disabled
"
);
}
else
{
$userEmailUpdate
.
removeAttr
(
"
disabled
"
);
}
$
(
"
#userPasswordUpdate
"
).
val
(
result
.
user
.
userPassword
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 更新用户
*/
update
:
function
()
{
if
(
this
.
validate
(
"
Update
"
))
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
userInfo
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userNameUpdate
"
).
val
(),
"
oId
"
:
userInfo
.
oId
,
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userRole
"
:
userInfo
.
userRole
,
"
userPassword
"
:
$
(
"
#userPasswordUpdate
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 删除用户
* @id 用户 id
*/
del
:
function
(
id
)
{
var
isDelete
=
confirm
(
Label
.
confirmRemoveLabel
);
if
(
isDelete
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
DELETE
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 验证字段
* @status 更新或者添加时进行验证
*/
validate
:
function
(
status
)
{
if
(
!
status
)
{
status
=
""
;
}
var
userName
=
$
(
"
#userName
"
+
status
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
userName
.
length
||
userName
.
length
>
20
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
);
$
(
"
#userName
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userEmail
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailCannotEmptyLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#userEmail
"
+
status
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailInvalidLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userPassword
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
passwordEmptyLabel
);
$
(
"
#userPassword
"
+
status
).
focus
();
}
else
{
return
true
;
}
return
false
;
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
user-list
"
]
=
{
"
obj
"
:
admin
.
userList
,
"
init
"
:
admin
.
userList
.
init
,
"
refresh
"
:
function
()
{
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*/
/**
* user list for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.3, Aug 30, 2012
*/
/* user-list 相关操作 */
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:
{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:
{
'
oId
'
:
""
,
"
userRole
"
:
""
},
/*
* 初始化 table, pagination
*/
init
:
function
(
page
)
{
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentNameLabel
,
index
:
"
userName
"
,
width
:
230
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
commentEmailLabel
,
index
:
"
userEmail
"
,
minWidth
:
180
},
{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
administratorLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]);
this
.
tablePagination
.
initPagination
();
this
.
getList
(
page
);
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
190
,
"
modal
"
:
true
,
"
hideFooter
"
:
true
});
},
/*
* 根据当前页码获取列表
* @pagNum 当前页码
*/
getList
:
function
(
pageNum
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
this
.
pageInfo
.
currentPage
=
pageNum
;
var
that
=
this
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/users/
"
+
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
users
=
result
.
users
;
var
userData
=
[];
admin
.
userList
.
pageInfo
.
currentCount
=
users
.
length
;
admin
.
userList
.
pageInfo
.
pageCount
=
result
.
pagination
.
paginationPageCount
;
if
(
users
.
length
<
1
)
{
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
for
(
var
i
=
0
;
i
<
users
.
length
;
i
++
)
{
userData
[
i
]
=
{};
userData
[
i
].
userName
=
users
[
i
].
userName
;
userData
[
i
].
userEmail
=
users
[
i
].
userEmail
;
if
(
"
adminRole
"
===
users
[
i
].
userRole
)
{
userData
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
;
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
;
}
else
{
userData
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
users
[
i
].
oId
+
"
', '
"
+
users
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
\
<a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
users
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
userData
[
i
].
isAdmin
=
Label
.
commonUserLabel
;
}
}
that
.
tablePagination
.
updateTablePagination
(
userData
,
pageNum
,
result
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 添加用户
*/
add
:
function
()
{
if
(
this
.
validate
())
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userName
"
).
val
(),
"
userEmail
"
:
$
(
"
#userEmail
"
).
val
(),
"
userPassword
"
:
$
(
"
#userPassword
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
POST
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#userName
"
).
val
(
""
);
$
(
"
#userEmail
"
).
val
(
""
);
$
(
"
#userPassword
"
).
val
(
""
);
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
++
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
admin
.
userList
.
pageInfo
.
pageCount
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
admin
.
userList
.
pageInfo
.
pageCount
);
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
pageCount
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 获取用户
* @id 用户 id
*/
get
:
function
(
id
,
userRole
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
$userEmailUpdate
=
$
(
"
#userEmailUpdate
"
);
$
(
"
#userNameUpdate
"
).
val
(
result
.
user
.
userName
).
data
(
"
userInfo
"
,
{
'
oId
'
:
id
,
"
userRole
"
:
userRole
});
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
if
(
"
adminRole
"
===
userRole
)
{
$userEmailUpdate
.
attr
(
"
disabled
"
,
"
disabled
"
);
}
else
{
$userEmailUpdate
.
removeAttr
(
"
disabled
"
);
}
$
(
"
#userPasswordUpdate
"
).
val
(
result
.
user
.
userPassword
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* 更新用户
*/
update
:
function
()
{
if
(
this
.
validate
(
"
Update
"
))
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
var
userInfo
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
);
var
requestJSONObject
=
{
"
userName
"
:
$
(
"
#userNameUpdate
"
).
val
(),
"
oId
"
:
userInfo
.
oId
,
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userRole
"
:
userInfo
.
userRole
,
"
userPassword
"
:
$
(
"
#userPasswordUpdate
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 删除用户
* @id 用户 id
*/
del
:
function
(
id
)
{
var
isDelete
=
confirm
(
Label
.
confirmRemoveLabel
);
if
(
isDelete
)
{
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/user/
"
+
id
,
type
:
"
DELETE
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
){
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
var
pageNum
=
admin
.
userList
.
pageInfo
.
currentPage
;
if
(
admin
.
userList
.
pageInfo
.
currentCount
===
1
&&
admin
.
userList
.
pageInfo
.
pageCount
!==
1
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
)
{
admin
.
userList
.
pageInfo
.
pageCount
--
;
pageNum
=
admin
.
userList
.
pageInfo
.
pageCount
;
}
var
hashList
=
window
.
location
.
hash
.
split
(
"
/
"
);
if
(
pageNum
!==
parseInt
(
hashList
[
hashList
.
length
-
1
]))
{
admin
.
setHashByPage
(
pageNum
);
}
admin
.
userList
.
getList
(
pageNum
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
}
},
/*
* 验证字段
* @status 更新或者添加时进行验证
*/
validate
:
function
(
status
)
{
if
(
!
status
)
{
status
=
""
;
}
var
userName
=
$
(
"
#userName
"
+
status
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
userName
.
length
||
userName
.
length
>
20
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
);
$
(
"
#userName
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userEmail
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailCannotEmptyLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#userEmail
"
+
status
).
val
()))
{
$
(
"
#tipMsg
"
).
text
(
Label
.
mailInvalidLabel
);
$
(
"
#userEmail
"
+
status
).
focus
();
}
else
if
(
$
(
"
#userPassword
"
+
status
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
)
{
$
(
"
#tipMsg
"
).
text
(
Label
.
passwordEmptyLabel
);
$
(
"
#userPassword
"
+
status
).
focus
();
}
else
{
return
true
;
}
return
false
;
}
};
/*
* 注册到 admin 进行管理
*/
admin
.
register
[
"
user-list
"
]
=
{
"
obj
"
:
admin
.
userList
,
"
init
"
:
admin
.
userList
.
init
,
"
refresh
"
:
function
()
{
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
...
...
war/src/main/webapp/js/common.js
View file @
dbc30c2e
...
...
@@ -19,7 +19,7 @@
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.
3, Aug 24
, 2012
* @version 1.0.2.
4, Nov 13
, 2012
*/
/**
...
...
@@ -234,23 +234,27 @@ var Util = {
* @returns {String} 格式化后的时间
*/
toDate
:
function
(
time
,
format
)
{
var
dateTime
=
new
Date
(
time
),
formatDate
;
var
year
=
dateTime
.
getFullYear
(),
month
=
dateTime
.
getMonth
()
+
1
,
date
=
dateTime
.
getDate
(),
hour
=
dateTime
.
getHours
()
+
1
,
minute
=
dateTime
.
getMinutes
()
+
1
;
switch
(
format
)
{
case
"
yy-MM-dd HH:mm
"
:
formatDate
=
year
.
toString
().
substr
(
2
)
+
"
-
"
+
month
+
"
-
"
+
date
+
"
"
+
hour
+
"
:
"
+
minute
;
break
;
default
:
break
;
}
return
formatDate
;
var
dateTime
=
new
Date
(
time
);
var
o
=
{
"
M+
"
:
dateTime
.
getMonth
()
+
1
,
//month
"
d+
"
:
dateTime
.
getDate
(),
//day
"
H+
"
:
dateTime
.
getHours
(),
//hour
"
m+
"
:
dateTime
.
getMinutes
(),
//minute
"
s+
"
:
dateTime
.
getSeconds
(),
//second
"
q+
"
:
Math
.
floor
((
dateTime
.
getMonth
()
+
3
)
/
3
),
//quarter
"
S
"
:
dateTime
.
getMilliseconds
()
//millisecond
}
if
(
/
(
y+
)
/
.
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
(
dateTime
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
}
for
(
var
k
in
o
)
{
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]
:
(
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
));
}
}
return
format
;
}
};
...
...
war/src/main/webapp/js/common.min.js
View file @
dbc30c2e
...
...
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Util
=
{
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/b3log-solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
return
}
if
(
window
.
external
&&
window
.
external
.
twGetRunPath
){
var
path
=
external
.
twGetRunPath
();
if
(
path
&&
path
.
toLowerCase
().
indexOf
(
"
360se
"
)
>-
1
&&
window
.
location
.
href
.
indexOf
(
"
admin-index
"
)
>-
1
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
return
}}}},
replaceEmString
:
function
(
str
){
var
commentSplited
=
str
.
split
(
"
[em
"
);
if
(
commentSplited
.
length
===
1
){
return
str
}
str
=
commentSplited
[
0
];
for
(
var
j
=
1
;
j
<
commentSplited
.
length
;
j
++
){
var
key
=
commentSplited
[
j
].
substr
(
0
,
2
);
str
+=
"
<img src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
Label
.
skinDirName
+
"
/images/emotions/em
"
+
key
+
"
.png' alt='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
'/>
"
+
commentSplited
[
j
].
substr
(
3
)}
return
str
},
proessURL
:
function
(
url
){
if
(
!
/^
\w
+:
\/\/
/
.
test
(
url
)){
url
=
"
http://
"
+
url
}
return
url
},
switchMobile
:
function
(
skin
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
skin
,
365
);
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
setTopBar
:
function
(){
var
$top
=
$
(
"
#top
"
);
if
(
$top
.
length
===
1
){
var
$showTop
=
$
(
"
#showTop
"
);
$showTop
.
click
(
function
(){
$top
.
slideDown
();
$showTop
.
hide
()});
$
(
"
#hideTop
"
).
click
(
function
(){
$top
.
slideUp
();
$showTop
.
show
()})}},
goTop
:
function
(){
var
acceleration
=
acceleration
||
0.1
;
var
y
=
$
(
window
).
scrollTop
();
var
speed
=
1
+
acceleration
;
window
.
scrollTo
(
0
,
Math
.
floor
(
y
/
speed
));
if
(
y
>
0
){
var
invokeFunction
=
"
Util.goTop(
"
+
acceleration
+
"
)
"
;
window
.
setTimeout
(
invokeFunction
,
16
)}},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
window
.
scrollTo
(
0
,
$
(
"
body
"
).
height
()
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
()},
clearCache
:
function
(
all
){
var
data
=
""
;
if
(
all
===
"
all
"
){
data
=
'
{"all": "all", "URI": ""}
'
}
else
{
data
=
'
{"all": "all", "URI": "
'
+
window
.
location
.
pathname
+
'
"}
'
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/clear-cache.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
data
,
success
:
function
(
result
){
window
.
location
.
reload
()}})},
replaceSideEm
:
function
(
comments
){
for
(
var
i
=
0
;
i
<
comments
.
length
;
i
++
){
var
$comment
=
$
(
comments
[
i
]);
$comment
.
html
(
Util
.
replaceEmString
(
$comment
.
html
()))}},
buildTags
:
function
(
id
){
id
=
id
||
"
tags
"
;
var
classes
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
bList
=
$
(
"
#
"
+
id
+
"
b
"
).
get
();
var
max
=
parseInt
(
$
(
"
#
"
+
id
+
"
b
"
).
last
().
text
());
var
distance
=
Math
.
ceil
(
max
/
classes
.
length
);
for
(
var
i
=
0
;
i
<
bList
.
length
;
i
++
){
var
num
=
parseInt
(
bList
[
i
].
innerHTML
);
for
(
var
j
=
0
;
j
<
classes
.
length
;
j
++
){
if
(
num
>
j
*
distance
&&
num
<=
(
j
+
1
)
*
distance
){
bList
[
i
].
parentNode
.
className
=
classes
[
j
];
break
}}}
$
(
"
#
"
+
id
).
html
(
$
(
"
#
"
+
id
+
"
li
"
).
get
().
sort
(
function
(
a
,
b
){
var
valA
=
$
(
a
).
find
(
"
span
"
).
text
().
toLowerCase
();
var
valB
=
$
(
b
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
valA
.
localeCompare
(
valB
)}))},
toDate
:
function
(
time
,
format
){
var
dateTime
=
new
Date
(
time
),
formatDate
;
var
year
=
dateTime
.
getFullYear
(),
month
=
dateTime
.
getMonth
()
+
1
,
date
=
dateTime
.
getDate
(),
hour
=
dateTime
.
getHours
()
+
1
,
minute
=
dateTime
.
getMinutes
()
+
1
;
switch
(
format
){
case
"
yy-MM-dd HH:mm
"
:
formatDate
=
year
.
toString
().
substr
(
2
)
+
"
-
"
+
month
+
"
-
"
+
date
+
"
"
+
hour
+
"
:
"
+
minute
;
break
;
default
:
break
}
return
formatDate
}};
if
(
!
Cookie
){
var
Cookie
=
{
readCookie
:
function
(
name
){
var
nameEQ
=
name
+
"
=
"
;
var
ca
=
document
.
cookie
.
split
(
"
;
"
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
){
var
c
=
ca
[
i
];
while
(
c
.
charAt
(
0
)
==
"
"
){
c
=
c
.
substring
(
1
,
c
.
length
)}
if
(
c
.
indexOf
(
nameEQ
)
==
0
){
return
decodeURIComponent
(
c
.
substring
(
nameEQ
.
length
,
c
.
length
))}}
return
""
},
eraseCookie
:
function
(
name
){
this
.
createCookie
(
name
,
""
,
-
1
)},
createCookie
:
function
(
name
,
value
,
days
){
var
expires
=
""
;
if
(
days
){
var
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
(
days
*
24
*
60
*
60
*
1000
));
expires
=
"
; expires=
"
+
date
.
toGMTString
()}
document
.
cookie
=
name
+
"
=
"
+
encodeURIComponent
(
value
)
+
expires
+
"
; path=/
"
}}};
\ No newline at end of file
var
Util
=
{
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/b3log-solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
return
}
if
(
window
.
external
&&
window
.
external
.
twGetRunPath
){
var
path
=
external
.
twGetRunPath
();
if
(
path
&&
path
.
toLowerCase
().
indexOf
(
"
360se
"
)
>-
1
&&
window
.
location
.
href
.
indexOf
(
"
admin-index
"
)
>-
1
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
return
}}}},
replaceEmString
:
function
(
str
){
var
commentSplited
=
str
.
split
(
"
[em
"
);
if
(
commentSplited
.
length
===
1
){
return
str
}
str
=
commentSplited
[
0
];
for
(
var
j
=
1
;
j
<
commentSplited
.
length
;
j
++
){
var
key
=
commentSplited
[
j
].
substr
(
0
,
2
);
str
+=
"
<img src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
Label
.
skinDirName
+
"
/images/emotions/em
"
+
key
+
"
.png' alt='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
'/>
"
+
commentSplited
[
j
].
substr
(
3
)}
return
str
},
proessURL
:
function
(
url
){
if
(
!
/^
\w
+:
\/\/
/
.
test
(
url
)){
url
=
"
http://
"
+
url
}
return
url
},
switchMobile
:
function
(
skin
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
skin
,
365
);
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
setTopBar
:
function
(){
var
$top
=
$
(
"
#top
"
);
if
(
$top
.
length
===
1
){
var
$showTop
=
$
(
"
#showTop
"
);
$showTop
.
click
(
function
(){
$top
.
slideDown
();
$showTop
.
hide
()});
$
(
"
#hideTop
"
).
click
(
function
(){
$top
.
slideUp
();
$showTop
.
show
()})}},
goTop
:
function
(){
var
acceleration
=
acceleration
||
0.1
;
var
y
=
$
(
window
).
scrollTop
();
var
speed
=
1
+
acceleration
;
window
.
scrollTo
(
0
,
Math
.
floor
(
y
/
speed
));
if
(
y
>
0
){
var
invokeFunction
=
"
Util.goTop(
"
+
acceleration
+
"
)
"
;
window
.
setTimeout
(
invokeFunction
,
16
)}},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
window
.
scrollTo
(
0
,
$
(
"
body
"
).
height
()
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
()},
clearCache
:
function
(
all
){
var
data
=
""
;
if
(
all
===
"
all
"
){
data
=
'
{"all": "all", "URI": ""}
'
}
else
{
data
=
'
{"all": "all", "URI": "
'
+
window
.
location
.
pathname
+
'
"}
'
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/clear-cache.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
data
,
success
:
function
(
result
){
window
.
location
.
reload
()}})},
replaceSideEm
:
function
(
comments
){
for
(
var
i
=
0
;
i
<
comments
.
length
;
i
++
){
var
$comment
=
$
(
comments
[
i
]);
$comment
.
html
(
Util
.
replaceEmString
(
$comment
.
html
()))}},
buildTags
:
function
(
id
){
id
=
id
||
"
tags
"
;
var
classes
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
bList
=
$
(
"
#
"
+
id
+
"
b
"
).
get
();
var
max
=
parseInt
(
$
(
"
#
"
+
id
+
"
b
"
).
last
().
text
());
var
distance
=
Math
.
ceil
(
max
/
classes
.
length
);
for
(
var
i
=
0
;
i
<
bList
.
length
;
i
++
){
var
num
=
parseInt
(
bList
[
i
].
innerHTML
);
for
(
var
j
=
0
;
j
<
classes
.
length
;
j
++
){
if
(
num
>
j
*
distance
&&
num
<=
(
j
+
1
)
*
distance
){
bList
[
i
].
parentNode
.
className
=
classes
[
j
];
break
}}}
$
(
"
#
"
+
id
).
html
(
$
(
"
#
"
+
id
+
"
li
"
).
get
().
sort
(
function
(
a
,
b
){
var
valA
=
$
(
a
).
find
(
"
span
"
).
text
().
toLowerCase
();
var
valB
=
$
(
b
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
valA
.
localeCompare
(
valB
)}))},
toDate
:
function
(
time
,
format
){
var
dateTime
=
new
Date
(
time
);
var
o
=
{
"
M+
"
:
dateTime
.
getMonth
()
+
1
,
"
d+
"
:
dateTime
.
getDate
(),
"
H+
"
:
dateTime
.
getHours
(),
"
m+
"
:
dateTime
.
getMinutes
(),
"
s+
"
:
dateTime
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
dateTime
.
getMonth
()
+
3
)
/
3
),
S
:
dateTime
.
getMilliseconds
()};
if
(
/
(
y+
)
/
.
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,(
dateTime
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))}
for
(
var
k
in
o
){
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]:(
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
))}}
return
format
}};
if
(
!
Cookie
){
var
Cookie
=
{
readCookie
:
function
(
name
){
var
nameEQ
=
name
+
"
=
"
;
var
ca
=
document
.
cookie
.
split
(
"
;
"
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
){
var
c
=
ca
[
i
];
while
(
c
.
charAt
(
0
)
==
"
"
){
c
=
c
.
substring
(
1
,
c
.
length
)}
if
(
c
.
indexOf
(
nameEQ
)
==
0
){
return
decodeURIComponent
(
c
.
substring
(
nameEQ
.
length
,
c
.
length
))}}
return
""
},
eraseCookie
:
function
(
name
){
this
.
createCookie
(
name
,
""
,
-
1
)},
createCookie
:
function
(
name
,
value
,
days
){
var
expires
=
""
;
if
(
days
){
var
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
(
days
*
24
*
60
*
60
*
1000
));
expires
=
"
; expires=
"
+
date
.
toGMTString
()}
document
.
cookie
=
name
+
"
=
"
+
encodeURIComponent
(
value
)
+
expires
+
"
; path=/
"
}}};
\ No newline at end of file
war/src/main/webapp/plugins/symphony-news-getter/plugin.ftl
View file @
dbc30c2e
...
...
@@ -19,7 +19,7 @@
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
$.ajax({
url: "http://
localhost:8080
/apis/news",
url: "http://
symphony.b3log.org
/apis/news",
type: "GET",
dataType:"jsonp",
jsonp: "callback",
...
...
war/src/main/webapp/skins/ease/skin.properties
View file @
dbc30c2e
...
...
@@ -16,12 +16,12 @@
#
# Description: ease skin.
# Version: 1.0.0.
2, Aug 16
, 2012
# Version: 1.0.0.
3, Nov 21
, 2012
# Author: Liyuan Li
# Author: Liang Ding
#
name
=
ease
version
=
1.0.
2
forSolo
=
0.5.
0
version
=
1.0.
3
forSolo
=
0.5.
5
memo
=
\u
56de
\u
5f52
\u
606c
\u9759
war/src/main/webapp/skins/mobile/skin.properties
View file @
dbc30c2e
...
...
@@ -16,11 +16,11 @@
#
# Description: Mobile skin.
# Version: 1.0.0.
4, Aug 16
, 2012
# Version: 1.0.0.
5, Nov 21
, 2012
# Author: Liang Ding
#
name
=
Mobile
version
=
0.1.
3
forSolo
=
0.5.
0
version
=
0.1.
4
forSolo
=
0.5.
5
memo
=
\u
8bf7
\u
4e0d
\u8981\u
4ece
\u
90e8
\u
7f72
\u
76ee
\u
5f55
\u
4e2d
\u5220\u9664\u
8be5
\u
76ae
\u
80a4
\u
ff0c
\u5426\u5219\u
79fb
\u
52a8
\u
8bbe
\u5907\u
8bbf
\u
95ee
\u
65f6
\u
535a
\u
5ba2
\u
5c06
\u
4e0d
\u
53ef
\u7528\u3002
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment