Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
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-1
Commits
f5eb32da
Commit
f5eb32da
authored
Sep 12, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#12029
parent
5bce628f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
333 additions
and
129 deletions
+333
-129
core/nb-configuration.xml
core/nb-configuration.xml
+1
-0
core/src/main/java/org/b3log/solo/model/Option.java
core/src/main/java/org/b3log/solo/model/Option.java
+30
-3
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+113
-33
war/src/main/resources/lang_en_US.properties
war/src/main/resources/lang_en_US.properties
+2
-1
war/src/main/resources/lang_zh_CN.properties
war/src/main/resources/lang_zh_CN.properties
+2
-1
war/src/main/webapp/admin-preference.ftl
war/src/main/webapp/admin-preference.ftl
+50
-2
war/src/main/webapp/js/admin/latkeAdmin.js
war/src/main/webapp/js/admin/latkeAdmin.js
+67
-44
war/src/main/webapp/js/admin/latkeAdmin.min.js
war/src/main/webapp/js/admin/latkeAdmin.min.js
+1
-1
war/src/main/webapp/js/admin/preference.js
war/src/main/webapp/js/admin/preference.js
+67
-44
No files found.
core/nb-configuration.xml
View file @
f5eb32da
...
@@ -33,6 +33,7 @@ Without this configuration present, some functionality in the IDE may be limited
...
@@ -33,6 +33,7 @@ Without this configuration present, some functionality in the IDE may be limited
<word>
Pluginable
</word>
<word>
Pluginable
</word>
<word>
Plugins
</word>
<word>
Plugins
</word>
<word>
plugins
</word>
<word>
plugins
</word>
<word>
Qiniu
</word>
<word>
servlet
</word>
<word>
servlet
</word>
<word>
servlets
</word>
<word>
servlets
</word>
<word>
sitemap
</word>
<word>
sitemap
</word>
...
...
core/src/main/java/org/b3log/solo/model/Option.java
View file @
f5eb32da
...
@@ -15,12 +15,11 @@
...
@@ -15,12 +15,11 @@
*/
*/
package
org
.
b3log
.
solo
.
model
;
package
org
.
b3log
.
solo
.
model
;
/**
/**
* This class defines option model relevant keys.
* This class defines option model relevant keys.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.0.0, Apr 15, 2013
* @version 1.
1.0.0, Sep 12, 2015
* @since 0.6.0
* @since 0.6.0
*/
*/
public
final
class
Option
{
public
final
class
Option
{
...
@@ -44,19 +43,47 @@ public final class Option {
...
@@ -44,19 +43,47 @@ public final class Option {
* Key of option category.
* Key of option category.
*/
*/
public
static
final
String
OPTION_CATEGORY
=
"optionCategory"
;
public
static
final
String
OPTION_CATEGORY
=
"optionCategory"
;
// oId constants
// oId constants
/**
/**
* Key of broadcast chance expiration time.
* Key of broadcast chance expiration time.
*/
*/
public
static
final
String
ID_C_BROADCAST_CHANCE_EXPIRATION_TIME
=
"broadcastChanceExpirationTime"
;
public
static
final
String
ID_C_BROADCAST_CHANCE_EXPIRATION_TIME
=
"broadcastChanceExpirationTime"
;
/**
* Key of Qiniu access key.
*/
public
static
final
String
ID_C_QINIU_ACCESS_KEY
=
"qiniuAccessKey"
;
/**
* Key of Qiniu secret key.
*/
public
static
final
String
ID_C_QINIU_SECRET_KEY
=
"qiniuSecretKey"
;
/**
* Key of Qiniu domain.
*/
public
static
final
String
ID_C_QINIU_DOMAIN
=
"qiniuDomain"
;
/**
* Key of Qiniu bucket.
*/
public
static
final
String
ID_C_QINIU_BUCKET
=
"qiniuBucket"
;
// Category constants
// Category constants
/**
/**
* Broadcast.
* Broadcast.
*/
*/
public
static
final
String
CATEGORY_C_BROADCAST
=
"broadcast"
;
public
static
final
String
CATEGORY_C_BROADCAST
=
"broadcast"
;
/**
* Qiniu.
*/
public
static
final
String
CATEGORY_C_QINIU
=
"qiniu"
;
/**
/**
* Private constructor.
* Private constructor.
*/
*/
private
Option
()
{}
private
Option
()
{
}
}
}
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
f5eb32da
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
org
.
b3log
.
solo
.
processor
.
console
;
package
org
.
b3log
.
solo
.
processor
.
console
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -30,8 +29,10 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
...
@@ -30,8 +29,10 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
import
org.b3log.latke.servlet.annotation.RequestProcessor
;
import
org.b3log.latke.servlet.annotation.RequestProcessor
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.b3log.solo.model.Preference
;
import
org.b3log.solo.model.Sign
;
import
org.b3log.solo.model.Sign
;
import
org.b3log.solo.service.OptionMgmtService
;
import
org.b3log.solo.service.PreferenceMgmtService
;
import
org.b3log.solo.service.PreferenceMgmtService
;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.b3log.solo.service.UserQueryService
;
import
org.b3log.solo.service.UserQueryService
;
...
@@ -39,12 +40,11 @@ import org.b3log.solo.util.QueryResults;
...
@@ -39,12 +40,11 @@ import org.b3log.solo.util.QueryResults;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
/**
/**
* Preference console request processing.
* Preference console request processing.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.0.6, May 17, 2013
* @version 1.
1.0.6, Sep 12, 2015
* @since 0.4.0
* @since 0.4.0
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -67,6 +67,12 @@ public class PreferenceConsole {
...
@@ -67,6 +67,12 @@ public class PreferenceConsole {
@Inject
@Inject
private
PreferenceMgmtService
preferenceMgmtService
;
private
PreferenceMgmtService
preferenceMgmtService
;
/**
* Option management service.
*/
@Inject
private
OptionMgmtService
optionMgmtService
;
/**
/**
* User query service.
* User query service.
*/
*/
...
@@ -86,7 +92,7 @@ public class PreferenceConsole {
...
@@ -86,7 +92,7 @@ public class PreferenceConsole {
/**
/**
* Gets reply template.
* Gets reply template.
*
*
* <p>
* <p>
* Renders the response with a json object, for example,
* Renders the response with a json object, for example,
* <pre>
* <pre>
...
@@ -107,9 +113,9 @@ public class PreferenceConsole {
...
@@ -107,9 +113,9 @@ public class PreferenceConsole {
*/
*/
@RequestProcessing
(
value
=
"/console/reply/notification/template"
,
method
=
HTTPRequestMethod
.
GET
)
@RequestProcessing
(
value
=
"/console/reply/notification/template"
,
method
=
HTTPRequestMethod
.
GET
)
public
void
getReplyNotificationTemplate
(
final
HttpServletRequest
request
,
public
void
getReplyNotificationTemplate
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
return
;
...
@@ -140,9 +146,8 @@ public class PreferenceConsole {
...
@@ -140,9 +146,8 @@ public class PreferenceConsole {
/**
/**
* Updates reply template.
* Updates reply template.
*
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request, for example, <pre>
* <pre>
* {
* {
* "replyNotificationTemplate": {
* "replyNotificationTemplate": {
* "subject": "",
* "subject": "",
...
@@ -150,15 +155,16 @@ public class PreferenceConsole {
...
@@ -150,15 +155,16 @@ public class PreferenceConsole {
* }
* }
* }
* }
* </pre>
* </pre>
*
* @param response the specified http servlet response
* @param response the specified http servlet response
* @param context the specified http request context
* @param context the specified http request context
* @throws Exception exception
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/reply/notification/template"
,
method
=
HTTPRequestMethod
.
PUT
)
@RequestProcessing
(
value
=
"/console/reply/notification/template"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updateReplyNotificationTemplate
(
final
HttpServletRequest
request
,
public
void
updateReplyNotificationTemplate
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
return
;
...
@@ -193,7 +199,7 @@ public class PreferenceConsole {
...
@@ -193,7 +199,7 @@ public class PreferenceConsole {
/**
/**
* Gets signs.
* Gets signs.
*
*
* <p>
* <p>
* Renders the response with a json object, for example,
* Renders the response with a json object, for example,
* <pre>
* <pre>
...
@@ -214,7 +220,7 @@ public class PreferenceConsole {
...
@@ -214,7 +220,7 @@ public class PreferenceConsole {
*/
*/
@RequestProcessing
(
value
=
"/console/signs/"
,
method
=
HTTPRequestMethod
.
GET
)
@RequestProcessing
(
value
=
"/console/signs/"
,
method
=
HTTPRequestMethod
.
GET
)
public
void
getSigns
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
public
void
getSigns
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
if
(!
userQueryService
.
isLoggedIn
(
request
,
response
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
return
;
...
@@ -230,7 +236,7 @@ public class PreferenceConsole {
...
@@ -230,7 +236,7 @@ public class PreferenceConsole {
final
JSONArray
signs
=
new
JSONArray
();
final
JSONArray
signs
=
new
JSONArray
();
final
JSONArray
allSigns
=
// includes the empty sign(id=0)
final
JSONArray
allSigns
=
// includes the empty sign(id=0)
new
JSONArray
(
preference
.
getString
(
Preference
.
SIGNS
));
new
JSONArray
(
preference
.
getString
(
Preference
.
SIGNS
));
for
(
int
i
=
1
;
i
<
allSigns
.
length
();
i
++)
{
// excludes the empty sign
for
(
int
i
=
1
;
i
<
allSigns
.
length
();
i
++)
{
// excludes the empty sign
signs
.
put
(
allSigns
.
getJSONObject
(
i
));
signs
.
put
(
allSigns
.
getJSONObject
(
i
));
...
@@ -254,7 +260,7 @@ public class PreferenceConsole {
...
@@ -254,7 +260,7 @@ public class PreferenceConsole {
/**
/**
* Gets preference.
* Gets preference.
*
*
* <p>
* <p>
* Renders the response with a json object, for example,
* Renders the response with a json object, for example,
* <pre>
* <pre>
...
@@ -308,7 +314,7 @@ public class PreferenceConsole {
...
@@ -308,7 +314,7 @@ public class PreferenceConsole {
*/
*/
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
,
method
=
HTTPRequestMethod
.
GET
)
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
,
method
=
HTTPRequestMethod
.
GET
)
public
void
getPreference
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
public
void
getPreference
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
return
;
...
@@ -345,8 +351,7 @@ public class PreferenceConsole {
...
@@ -345,8 +351,7 @@ public class PreferenceConsole {
/**
/**
* Updates the preference by the specified request.
* Updates the preference by the specified request.
*
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request, for example, <pre>
* <pre>
* {
* {
* "preference": {
* "preference": {
* "mostViewArticleDisplayCount": int,
* "mostViewArticleDisplayCount": int,
...
@@ -380,13 +385,14 @@ public class PreferenceConsole {
...
@@ -380,13 +385,14 @@ public class PreferenceConsole {
* }
* }
* }, see {@link org.b3log.solo.model.Preference} for more details
* }, see {@link org.b3log.solo.model.Preference} for more details
* </pre>
* </pre>
*
* @param response the specified http servlet response
* @param response the specified http servlet response
* @param context the specified http request context
* @param context the specified http request context
* @throws Exception exception
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
,
method
=
HTTPRequestMethod
.
PUT
)
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updatePreference
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
public
void
updatePreference
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
return
;
...
@@ -423,9 +429,83 @@ public class PreferenceConsole {
...
@@ -423,9 +429,83 @@ public class PreferenceConsole {
}
}
}
}
/**
* Updates the Qiniu preference by the specified request.
*
* @param request the specified http servlet request, for example, <pre>
* {
* "qiniuAccessKey": "",
* "qiniuSecretKey": "",
* "qiniuDomain": "",
* "qiniuBucket": ""
* }, see {@link org.b3log.solo.model.Option} for more details
* </pre>
*
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
+
"qiniu"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updateQiniu
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
}
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
String
accessKey
=
requestJSONObject
.
optString
(
Option
.
ID_C_QINIU_ACCESS_KEY
);
final
String
secretKey
=
requestJSONObject
.
optString
(
Option
.
ID_C_QINIU_SECRET_KEY
);
final
String
domain
=
requestJSONObject
.
optString
(
Option
.
ID_C_QINIU_DOMAIN
);
final
String
bucket
=
requestJSONObject
.
optString
(
Option
.
ID_C_QINIU_BUCKET
);
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
final
JSONObject
accessKeyOpt
=
new
JSONObject
();
accessKeyOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_QINIU_ACCESS_KEY
);
accessKeyOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_QINIU
);
accessKeyOpt
.
put
(
Option
.
OPTION_VALUE
,
accessKey
);
final
JSONObject
secretKeyOpt
=
new
JSONObject
();
secretKeyOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_QINIU_SECRET_KEY
);
secretKeyOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_QINIU
);
secretKeyOpt
.
put
(
Option
.
OPTION_VALUE
,
secretKey
);
final
JSONObject
domainOpt
=
new
JSONObject
();
domainOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_QINIU_DOMAIN
);
domainOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_QINIU
);
domainOpt
.
put
(
Option
.
OPTION_VALUE
,
domain
);
final
JSONObject
bucketOpt
=
new
JSONObject
();
bucketOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_QINIU_BUCKET
);
bucketOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_QINIU
);
bucketOpt
.
put
(
Option
.
OPTION_VALUE
,
bucket
);
optionMgmtService
.
addOrUpdateOption
(
accessKeyOpt
);
optionMgmtService
.
addOrUpdateOption
(
secretKeyOpt
);
optionMgmtService
.
addOrUpdateOption
(
domainOpt
);
optionMgmtService
.
addOrUpdateOption
(
bucketOpt
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateSuccLabel"
));
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
renderer
.
setJSONObject
(
jsonObject
);
jsonObject
.
put
(
Keys
.
MSG
,
e
.
getMessage
());
}
}
/**
/**
* Checks whether the specified preference is invalid and sets the specified response object.
* Checks whether the specified preference is invalid and sets the specified response object.
*
*
* @param preference the specified preference
* @param preference the specified preference
* @param responseObject the specified response object
* @param responseObject the specified response object
* @return {@code true} if the specified preference is invalid, returns {@code false} otherwise
* @return {@code true} if the specified preference is invalid, returns {@code false} otherwise
...
@@ -441,7 +521,7 @@ public class PreferenceConsole {
...
@@ -441,7 +521,7 @@ public class PreferenceConsole {
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"externalRelevantArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"externalRelevantArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -449,7 +529,7 @@ public class PreferenceConsole {
...
@@ -449,7 +529,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
RELEVANT_ARTICLES_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
RELEVANT_ARTICLES_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"relevantArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"relevantArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -457,7 +537,7 @@ public class PreferenceConsole {
...
@@ -457,7 +537,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
RANDOM_ARTICLES_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
RANDOM_ARTICLES_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"randomArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"randomArticlesDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -465,7 +545,7 @@ public class PreferenceConsole {
...
@@ -465,7 +545,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
MOST_COMMENT_ARTICLE_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
MOST_COMMENT_ARTICLE_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexMostCommentArticleDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexMostCommentArticleDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -473,7 +553,7 @@ public class PreferenceConsole {
...
@@ -473,7 +553,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
MOST_VIEW_ARTICLE_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
MOST_VIEW_ARTICLE_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexMostViewArticleDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexMostViewArticleDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -481,7 +561,7 @@ public class PreferenceConsole {
...
@@ -481,7 +561,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
RECENT_COMMENT_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
RECENT_COMMENT_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexRecentCommentDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexRecentCommentDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -489,7 +569,7 @@ public class PreferenceConsole {
...
@@ -489,7 +569,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
MOST_USED_TAG_DISPLAY_CNT
);
input
=
preference
.
optString
(
Preference
.
MOST_USED_TAG_DISPLAY_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexTagDisplayCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"indexTagDisplayCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -497,7 +577,7 @@ public class PreferenceConsole {
...
@@ -497,7 +577,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
ARTICLE_LIST_DISPLAY_COUNT
);
input
=
preference
.
optString
(
Preference
.
ARTICLE_LIST_DISPLAY_COUNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"pageSizeLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"pageSizeLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -505,7 +585,7 @@ public class PreferenceConsole {
...
@@ -505,7 +585,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
ARTICLE_LIST_PAGINATION_WINDOW_SIZE
);
input
=
preference
.
optString
(
Preference
.
ARTICLE_LIST_PAGINATION_WINDOW_SIZE
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"windowSizeLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"windowSizeLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -513,7 +593,7 @@ public class PreferenceConsole {
...
@@ -513,7 +593,7 @@ public class PreferenceConsole {
input
=
preference
.
optString
(
Preference
.
FEED_OUTPUT_CNT
);
input
=
preference
.
optString
(
Preference
.
FEED_OUTPUT_CNT
);
if
(!
isNonNegativeInteger
(
input
))
{
if
(!
isNonNegativeInteger
(
input
))
{
errMsgBuilder
.
append
(
langPropsService
.
get
(
"feedOutputCntLabel"
)).
append
(
"] "
).
append
(
errMsgBuilder
.
append
(
langPropsService
.
get
(
"feedOutputCntLabel"
)).
append
(
"] "
).
append
(
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
langPropsService
.
get
(
"nonNegativeIntegerOnlyLabel"
));
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
responseObject
.
put
(
Keys
.
MSG
,
errMsgBuilder
.
toString
());
return
true
;
return
true
;
}
}
...
@@ -523,7 +603,7 @@ public class PreferenceConsole {
...
@@ -523,7 +603,7 @@ public class PreferenceConsole {
/**
/**
* Checks whether the specified input is a non-negative integer.
* Checks whether the specified input is a non-negative integer.
*
*
* @param input the specified input
* @param input the specified input
* @return {@code true} if it is, returns {@code false} otherwise
* @return {@code true} if it is, returns {@code false} otherwise
*/
*/
...
...
war/src/main/resources/lang_en_US.properties
View file @
f5eb32da
...
@@ -16,12 +16,13 @@
...
@@ -16,12 +16,13 @@
#
#
# Description: Solo language configurations(en_US).
# Description: Solo language configurations(en_US).
# Version: 2.
3.2.3, Aug 8
, 2015
# Version: 2.
4.2.3, Sep 12
, 2015
# Author: Liang Ding
# Author: Liang Ding
# Author: Liyuan Li
# Author: Liyuan Li
# Author: Dongxu Wang
# Author: Dongxu Wang
#
#
qiniuLabel
=
Qiniu
contributorsLabel
=
Contributors
contributorsLabel
=
Contributors
developersLabel
=
Developers
developersLabel
=
Developers
staticErrorLabel
=
<h1>staticServePath Error</h1><a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
staticErrorLabel
=
<h1>staticServePath Error</h1><a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
...
...
war/src/main/resources/lang_zh_CN.properties
View file @
f5eb32da
...
@@ -16,12 +16,13 @@
...
@@ -16,12 +16,13 @@
#
#
# Description: Solo default language configurations(zh_CN).
# Description: Solo default language configurations(zh_CN).
# Version: 2.
3.4.11, Aug 8
, 2015
# Version: 2.
4.4.11, Sep 12
, 2015
# Author: Liang Ding
# Author: Liang Ding
# Author: Liyuan Li
# Author: Liyuan Li
# Author: Dongxu Wang
# Author: Dongxu Wang
#
#
qiniuLabel
=
\u
4e03
\u
725b
contributorsLabel
=
\u
8d21
\u
732e
\u8005
contributorsLabel
=
\u
8d21
\u
732e
\u8005
developersLabel
=
\u
5f00
\u
53d1
\u8005
developersLabel
=
\u
5f00
\u
53d1
\u8005
staticErrorLabel
=
<h1>staticServePath
\u
914d
\u
7f6e
\u9519\u
8bef</h1>
\u
8bf7
\u
67e5
\u
770b <a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
staticErrorLabel
=
<h1>staticServePath
\u
914d
\u
7f6e
\u9519\u
8bef</h1>
\u
8bf7
\u
67e5
\u
770b <a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
...
...
war/src/main/webapp/admin-preference.ftl
View file @
f5eb32da
...
@@ -20,6 +20,11 @@
...
@@ -20,6 +20,11 @@
<a href="#tools/preference/setting">${paramSettingsLabel}</a>
<a href="#tools/preference/setting">${paramSettingsLabel}</a>
</div>
</div>
</li>
</li>
<li>
<div id="tabPreference_qiniu">
<a href="#toos/preference/qiniu">${qiniuLabel}</a>
</div>
</li>
<li>
<li>
<div id="tabPreference_solo">
<div id="tabPreference_solo">
<a href="#tools/preference/solo">B3log</a>
<a href="#tools/preference/solo">B3log</a>
...
@@ -111,8 +116,8 @@
...
@@ -111,8 +116,8 @@
<input id="keyOfSolo" class="normalInput" type="text" readonly="readonly"/>
<input id="keyOfSolo" class="normalInput" type="text" readonly="readonly"/>
</td>
</td>
<td>
<td>
<!-- <button onclick="admin.preference.update()">${updateLabel}</button>-->
<!-- <button onclick="admin.preference.update()">${updateLabel}</button>-->
<label></label>
<label></label>
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
...
@@ -343,5 +348,48 @@
...
@@ -343,5 +348,48 @@
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<div id="tabPreferencePanel_qiniu" class="none">
<table class="form" width="98%" cellpadding="0" cellspacing="9px">
<tbody>
<tr>
<th colspan="2">
<button onclick="admin.preference.updateQiniu()">${updateLabel}</button>
</th>
</tr>
<tr>
<th>
<label for="qiniuAccessKey">AccessKey</label>
</th>
<td>
<input id="qiniuAccessKey" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuSecretKey">SecretKey</label>
</th>
<td>
<input id="qiniuSecretKey" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuDomain">Domain</label>
</th>
<td>
<input id="qiniuDomain" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuBucket">Bucket</label>
</th>
<td>
<input id="qiniuBucket" class="normalInput" type="text"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
${plugins}
${plugins}
\ No newline at end of file
war/src/main/webapp/js/admin/latkeAdmin.js
View file @
f5eb32da
...
@@ -2833,40 +2833,39 @@ admin.register["link-list"] = {
...
@@ -2833,40 +2833,39 @@ admin.register["link-list"] = {
*
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.1.8, May 28, 2013
* @version 1.
1.1.8, Sep 12, 2015
*/
*/
/* preference 相关操作 */
/* preference 相关操作 */
admin
.
preference
=
{
admin
.
preference
=
{
locale
:
""
,
locale
:
""
,
editorType
:
""
,
editorType
:
""
,
/*
/*
* 初始化
* 初始化
*/
*/
init
:
function
()
{
init
:
function
()
{
$
(
"
#tabPreference
"
).
tabs
();
$
(
"
#tabPreference
"
).
tabs
();
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
type
:
"
GET
"
,
cache
:
false
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
return
;
}
}
var
preference
=
result
.
preference
;
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
);
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
);
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
);
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
);
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
);
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
);
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
);
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
);
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
);
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
);
...
@@ -2891,13 +2890,13 @@ admin.preference = {
...
@@ -2891,13 +2890,13 @@ admin.preference = {
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
var
selectedClass
=
""
;
var
selectedClass
=
""
;
if
(
skins
[
i
].
skinName
===
preference
.
skinName
if
(
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
selectedClass
+=
"
selected
"
;
selectedClass
+=
"
selected
"
;
}
}
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
}
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
...
@@ -2916,7 +2915,7 @@ admin.preference = {
...
@@ -2916,7 +2915,7 @@ admin.preference = {
position
:
"
bottom
"
position
:
"
bottom
"
});
});
}
}
// Article list style
// Article list style
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
// Editor Type
// Editor Type
...
@@ -2926,12 +2925,11 @@ admin.preference = {
...
@@ -2926,12 +2925,11 @@ admin.preference = {
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
// Commentable
// Commentable
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
});
},
},
/*
/*
* @description 参数校验
* @description 参数校验
*/
*/
...
@@ -2975,7 +2973,6 @@ admin.preference = {
...
@@ -2975,7 +2973,6 @@ admin.preference = {
}
}
return
true
;
return
true
;
},
},
/*
/*
* @description 更新
* @description 更新
*/
*/
...
@@ -2987,19 +2984,19 @@ admin.preference = {
...
@@ -2987,19 +2984,19 @@ admin.preference = {
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
signs
=
[{
var
signs
=
[{
"
oId
"
:
0
,
"
oId
"
:
0
,
"
signHTML
"
:
""
"
signHTML
"
:
""
},
{
},
{
"
oId
"
:
1
,
"
oId
"
:
1
,
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
},
{
},
{
"
oId
"
:
2
,
"
oId
"
:
2
,
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
},
{
},
{
"
oId
"
:
3
,
"
oId
"
:
3
,
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
}];
}];
var
requestJSONObject
=
{
var
requestJSONObject
=
{
"
preference
"
:
{
"
preference
"
:
{
"
metaKeywords
"
:
$
(
"
#metaKeywords
"
).
val
(),
"
metaKeywords
"
:
$
(
"
#metaKeywords
"
).
val
(),
...
@@ -3031,34 +3028,60 @@ admin.preference = {
...
@@ -3031,34 +3028,60 @@ admin.preference = {
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
}
}
};
};
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
type
:
"
PUT
"
,
cache
:
false
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
return
;
}
}
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
window
.
location
.
reload
();
window
.
location
.
reload
();
}
}
// update article and preferences signs
// update article and preferences signs
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
}
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
}
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* @description 更新 Qiniu 参数
*/
updateQiniu
:
function
()
{
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
requestJSONObject
=
{
"
qiniuAccessKey
"
:
$
(
"
#qiniuAccessKey
"
).
val
(),
"
qiniuSecretKey
"
:
$
(
"
#qiniuSecretKey
"
).
val
(),
"
qiniuDomain
"
:
$
(
"
#qiniuDomain
"
).
val
(),
"
qiniuBucket
"
:
$
(
"
#qiniuBucket
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/qiniu
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
});
...
@@ -3068,7 +3091,7 @@ admin.preference = {
...
@@ -3068,7 +3091,7 @@ admin.preference = {
/*
/*
* 注册到 admin 进行管理
* 注册到 admin 进行管理
*/
*/
admin
.
register
[
"
preference
"
]
=
{
admin
.
register
[
"
preference
"
]
=
{
"
obj
"
:
admin
.
preference
,
"
obj
"
:
admin
.
preference
,
"
init
"
:
admin
.
preference
.
init
,
"
init
"
:
admin
.
preference
.
init
,
"
refresh
"
:
function
()
{
"
refresh
"
:
function
()
{
...
...
war/src/main/webapp/js/admin/latkeAdmin.min.js
View file @
f5eb32da
This source diff could not be displayed because it is too large. You can
view the blob
instead.
war/src/main/webapp/js/admin/preference.js
View file @
f5eb32da
...
@@ -18,40 +18,39 @@
...
@@ -18,40 +18,39 @@
*
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.1.8, May 28, 2013
* @version 1.
1.1.8, Sep 12, 2015
*/
*/
/* preference 相关操作 */
/* preference 相关操作 */
admin
.
preference
=
{
admin
.
preference
=
{
locale
:
""
,
locale
:
""
,
editorType
:
""
,
editorType
:
""
,
/*
/*
* 初始化
* 初始化
*/
*/
init
:
function
()
{
init
:
function
()
{
$
(
"
#tabPreference
"
).
tabs
();
$
(
"
#tabPreference
"
).
tabs
();
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
type
:
"
GET
"
,
cache
:
false
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
return
;
}
}
var
preference
=
result
.
preference
;
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
);
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
);
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
);
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
);
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
);
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
);
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
);
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
);
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
);
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
);
...
@@ -76,13 +75,13 @@ admin.preference = {
...
@@ -76,13 +75,13 @@ admin.preference = {
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
var
selectedClass
=
""
;
var
selectedClass
=
""
;
if
(
skins
[
i
].
skinName
===
preference
.
skinName
if
(
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
selectedClass
+=
"
selected
"
;
selectedClass
+=
"
selected
"
;
}
}
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
+
"
/preview.png'/><div>
"
+
skins
[
i
].
skinName
+
"
</div></div>
"
;
}
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='clear'></div>
"
);
...
@@ -101,7 +100,7 @@ admin.preference = {
...
@@ -101,7 +100,7 @@ admin.preference = {
position
:
"
bottom
"
position
:
"
bottom
"
});
});
}
}
// Article list style
// Article list style
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
);
// Editor Type
// Editor Type
...
@@ -111,12 +110,11 @@ admin.preference = {
...
@@ -111,12 +110,11 @@ admin.preference = {
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
);
// Commentable
// Commentable
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
)
:
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
});
},
},
/*
/*
* @description 参数校验
* @description 参数校验
*/
*/
...
@@ -160,7 +158,6 @@ admin.preference = {
...
@@ -160,7 +158,6 @@ admin.preference = {
}
}
return
true
;
return
true
;
},
},
/*
/*
* @description 更新
* @description 更新
*/
*/
...
@@ -172,19 +169,19 @@ admin.preference = {
...
@@ -172,19 +169,19 @@ admin.preference = {
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
signs
=
[{
var
signs
=
[{
"
oId
"
:
0
,
"
oId
"
:
0
,
"
signHTML
"
:
""
"
signHTML
"
:
""
},
{
},
{
"
oId
"
:
1
,
"
oId
"
:
1
,
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign1
"
).
val
()
},
{
},
{
"
oId
"
:
2
,
"
oId
"
:
2
,
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign2
"
).
val
()
},
{
},
{
"
oId
"
:
3
,
"
oId
"
:
3
,
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
"
signHTML
"
:
$
(
"
#preferenceSign3
"
).
val
()
}];
}];
var
requestJSONObject
=
{
var
requestJSONObject
=
{
"
preference
"
:
{
"
preference
"
:
{
"
metaKeywords
"
:
$
(
"
#metaKeywords
"
).
val
(),
"
metaKeywords
"
:
$
(
"
#metaKeywords
"
).
val
(),
...
@@ -216,34 +213,60 @@ admin.preference = {
...
@@ -216,34 +213,60 @@ admin.preference = {
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
"
commentable
"
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
)
}
}
};
};
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
url
:
latkeConfig
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
type
:
"
PUT
"
,
cache
:
false
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
return
;
}
}
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
if
(
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
||
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
$
(
"
#editorType
"
).
val
()
!==
admin
.
preference
.
editorType
)
{
window
.
location
.
reload
();
window
.
location
.
reload
();
}
}
// update article and preferences signs
// update article and preferences signs
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
for
(
var
i
=
1
;
i
<
signs
.
length
;
i
++
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
if
(
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
length
===
1
)
{
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
$
(
"
#articleSign
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
}
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
$
(
"
#preferenceSignButton
"
+
signs
[
i
].
oId
).
tip
(
"
option
"
,
"
content
"
,
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
signs
[
i
].
signHTML
===
""
?
Label
.
signIsNullLabel
:
signs
[
i
].
signHTML
.
replace
(
/
\n
/g
,
""
).
replace
(
/<script.*<
\/
script>/ig
,
""
));
}
}
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
},
/*
* @description 更新 Qiniu 参数
*/
updateQiniu
:
function
()
{
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
requestJSONObject
=
{
"
qiniuAccessKey
"
:
$
(
"
#qiniuAccessKey
"
).
val
(),
"
qiniuSecretKey
"
:
$
(
"
#qiniuSecretKey
"
).
val
(),
"
qiniuDomain
"
:
$
(
"
#qiniuDomain
"
).
val
(),
"
qiniuBucket
"
:
$
(
"
#qiniuBucket
"
).
val
()
};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/qiniu
"
,
type
:
"
PUT
"
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
});
...
@@ -253,7 +276,7 @@ admin.preference = {
...
@@ -253,7 +276,7 @@ admin.preference = {
/*
/*
* 注册到 admin 进行管理
* 注册到 admin 进行管理
*/
*/
admin
.
register
[
"
preference
"
]
=
{
admin
.
register
[
"
preference
"
]
=
{
"
obj
"
:
admin
.
preference
,
"
obj
"
:
admin
.
preference
,
"
init
"
:
admin
.
preference
.
init
,
"
init
"
:
admin
.
preference
.
init
,
"
refresh
"
:
function
()
{
"
refresh
"
:
function
()
{
...
...
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