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
b0d56607
Commit
b0d56607
authored
Nov 07, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12039
parent
b394027d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
17 deletions
+87
-17
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+11
-1
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+11
-2
src/main/java/org/b3log/solo/processor/util/Filler.java
src/main/java/org/b3log/solo/processor/util/Filler.java
+16
-2
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+26
-1
src/main/resources/lang_en_US.properties
src/main/resources/lang_en_US.properties
+2
-1
src/main/resources/lang_zh_CN.properties
src/main/resources/lang_zh_CN.properties
+2
-1
src/main/webapp/admin-preference.ftl
src/main/webapp/admin-preference.ftl
+10
-2
src/main/webapp/js/admin/preference.js
src/main/webapp/js/admin/preference.js
+8
-6
src/main/webapp/skins/finding/footer.ftl
src/main/webapp/skins/finding/footer.ftl
+1
-1
No files found.
src/main/java/org/b3log/solo/model/Option.java
View file @
b0d56607
...
...
@@ -19,7 +19,7 @@ package org.b3log.solo.model;
* This class defines option model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.
0, Sep 12
, 2015
* @version 1.1.0.
1, Nov 7
, 2015
* @since 0.6.0
*/
public
final
class
Option
{
...
...
@@ -69,6 +69,11 @@ public final class Option {
* Key of Qiniu bucket.
*/
public
static
final
String
ID_C_QINIU_BUCKET
=
"qiniuBucket"
;
/**
* Key of footer content.
*/
public
static
final
String
ID_C_FOOTER_CONTENT
=
"footerContent"
;
// Category constants
/**
...
...
@@ -80,6 +85,11 @@ public final class Option {
* Qiniu.
*/
public
static
final
String
CATEGORY_C_QINIU
=
"qiniu"
;
/**
* Preference.
*/
public
static
final
String
CATEGORY_C_PREFERENCE
=
"preference"
;
/**
* Private constructor.
...
...
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
b0d56607
...
...
@@ -46,7 +46,7 @@ import org.json.JSONObject;
* Preference console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.
6, Sep 12
, 2015
* @version 1.1.0.
7, Nov 7
, 2015
* @since 0.4.0
*/
@RequestProcessor
...
...
@@ -295,6 +295,7 @@ public class PreferenceConsole {
* "skinDirName": ""
* }, ....]",
* "noticeBoard": "",
* "footerContent": "",
* "htmlHead": "",
* "adminEmail": "",
* "metaKeywords": "",
...
...
@@ -341,6 +342,13 @@ public class PreferenceConsole {
return
;
}
String
footerContent
=
""
;
final
JSONObject
opt
=
optionQueryService
.
getOptionById
(
Option
.
ID_C_FOOTER_CONTENT
);
if
(
null
!=
opt
)
{
footerContent
=
opt
.
optString
(
Option
.
OPTION_VALUE
);
}
preference
.
put
(
Option
.
ID_C_FOOTER_CONTENT
,
footerContent
);
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
...
...
@@ -377,6 +385,7 @@ public class PreferenceConsole {
* "localeString": "",
* "timeZoneId": "",
* "noticeBoard": "",
* "footerContent": "",
* "htmlHead": "",
* "metaKeywords": "",
* "metaDescription": "",
...
...
@@ -422,7 +431,7 @@ public class PreferenceConsole {
if
(
isInvalid
(
preference
,
ret
))
{
return
;
}
preferenceMgmtService
.
updatePreference
(
preference
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
...
...
src/main/java/org/b3log/solo/processor/util/Filler.java
View file @
b0d56607
...
...
@@ -57,6 +57,7 @@ import org.b3log.solo.repository.PageRepository;
import
org.b3log.solo.repository.TagRepository
;
import
org.b3log.solo.repository.UserRepository
;
import
org.b3log.solo.service.ArticleQueryService
;
import
org.b3log.solo.service.OptionQueryService
;
import
org.b3log.solo.service.StatisticQueryService
;
import
org.b3log.solo.service.TagQueryService
;
import
org.b3log.solo.service.UserQueryService
;
...
...
@@ -70,7 +71,7 @@ import org.json.JSONObject;
* Filler utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
4.11.11, Nov 1
, 2015
* @version 1.
5.11.11, Nov 7
, 2015
* @since 0.3.1
*/
@Service
...
...
@@ -135,6 +136,12 @@ public class Filler {
@Inject
private
UserRepository
userRepository
;
/**
* Option query service..
*/
@Inject
private
OptionQueryService
optionQueryService
;
/**
* Article query service.
*/
...
...
@@ -567,6 +574,13 @@ public class Filler {
dataModel
.
put
(
Common
.
STATIC_RESOURCE_VERSION
,
Latkes
.
getStaticResourceVersion
());
dataModel
.
put
(
Common
.
YEAR
,
String
.
valueOf
(
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)));
String
footerContent
=
""
;
final
JSONObject
opt
=
optionQueryService
.
getOptionById
(
Option
.
ID_C_FOOTER_CONTENT
);
if
(
null
!=
opt
)
{
footerContent
=
opt
.
optString
(
Option
.
OPTION_VALUE
);
}
dataModel
.
put
(
Option
.
ID_C_FOOTER_CONTENT
,
footerContent
);
dataModel
.
put
(
Keys
.
Server
.
STATIC_SERVER
,
Latkes
.
getStaticServer
());
dataModel
.
put
(
Keys
.
Server
.
SERVER
,
Latkes
.
getServer
());
...
...
@@ -663,7 +677,7 @@ public class Filler {
final
JSONArray
users
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
final
List
<
JSONObject
>
userList
=
CollectionUtils
.
jsonArrayToList
(
users
);
dataModel
.
put
(
User
.
USERS
,
userList
);
final
JSONObject
admin
=
userRepository
.
getAdmin
();
dataModel
.
put
(
Common
.
ADMIN_USER
,
admin
);
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
b0d56607
...
...
@@ -23,6 +23,7 @@ import java.util.Locale;
import
java.util.Set
;
import
javax.inject.Inject
;
import
javax.servlet.ServletContext
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
...
...
@@ -34,6 +35,7 @@ import org.b3log.latke.util.Stopwatchs;
import
org.b3log.latke.util.Strings
;
import
org.b3log.latke.util.freemarker.Templates
;
import
org.b3log.solo.SoloServletListener
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.b3log.solo.model.Skin
;
import
org.b3log.solo.repository.PreferenceRepository
;
...
...
@@ -43,6 +45,7 @@ import static org.b3log.solo.model.Preference.*;
import
static
org
.
b3log
.
solo
.
model
.
Skin
.
SKINS
;
import
static
org
.
b3log
.
solo
.
model
.
Skin
.
SKIN_DIR_NAME
;
import
static
org
.
b3log
.
solo
.
model
.
Skin
.
SKIN_NAME
;
import
org.b3log.solo.repository.OptionRepository
;
import
static
org
.
b3log
.
solo
.
util
.
Skins
.
getSkinDirNames
;
import
static
org
.
b3log
.
solo
.
util
.
Skins
.
setDirectoryForTemplateLoading
;
...
...
@@ -50,7 +53,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.1.9, Oct 31
, 2015
* @version 1.
1.1.9, Nov 7
, 2015
* @since 0.4.0
*/
@Service
...
...
@@ -66,6 +69,12 @@ public class PreferenceMgmtService {
*/
@Inject
private
PreferenceRepository
preferenceRepository
;
/**
* Option repository.
*/
@Inject
private
OptionRepository
optionRepository
;
/**
* Language service.
...
...
@@ -238,6 +247,22 @@ public class PreferenceMgmtService {
LOGGER
.
log
(
Level
.
DEBUG
,
"Current locale[string={0}]"
,
localeString
);
Latkes
.
setLocale
(
new
Locale
(
Locales
.
getLanguage
(
localeString
),
Locales
.
getCountry
(
localeString
)));
final
String
footerContent
=
preference
.
optString
(
Option
.
ID_C_FOOTER_CONTENT
);
JSONObject
opt
=
optionRepository
.
get
(
Option
.
ID_C_FOOTER_CONTENT
);
if
(
null
==
opt
)
{
opt
=
new
JSONObject
();
opt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_FOOTER_CONTENT
);
opt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
opt
.
put
(
Option
.
OPTION_VALUE
,
footerContent
);
optionRepository
.
add
(
opt
);
}
else
{
opt
.
put
(
Option
.
OPTION_VALUE
,
footerContent
);
optionRepository
.
update
(
Option
.
ID_C_FOOTER_CONTENT
,
opt
);
}
preference
.
remove
(
Option
.
ID_C_FOOTER_CONTENT
);
preferenceRepository
.
update
(
Preference
.
PREFERENCE
,
preference
);
transaction
.
commit
();
...
...
src/main/resources/lang_en_US.properties
View file @
b0d56607
...
...
@@ -16,12 +16,13 @@
#
# Description: Solo language configurations(en_US).
# Version: 2.5.2.
5, Oct 1
7, 2015
# Version: 2.5.2.
6, Nov
7, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
footerContent1Label
=
Footer:
userAvatar1Label
=
Avatar:
uploadFileLabel
=
Upload <a href="http://hacpai.com/article/1442418791213" target="_blank">(?)</a>
accessKey1Label
=
Access Key:
...
...
src/main/resources/lang_zh_CN.properties
View file @
b0d56607
...
...
@@ -16,12 +16,13 @@
#
# Description: Solo default language configurations(zh_CN).
# Version: 2.5.4.1
3, Oct 1
7, 2015
# Version: 2.5.4.1
4, Nov
7, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
footerContent1Label
=
\u9875\u
811a
\u
ff1a
userAvatar1Label
=
\u5934\u
50cf
\u
ff1a
uploadFileLabel
=
\u6587\u
4ef6
\u
4e0a
\u
4f20 <a href="http://hacpai.com/article/1442418791213" target="_blank">(?)</a>
accessKey1Label
=
Access Key
\u
ff1a
...
...
src/main/webapp/admin-preference.ftl
View file @
b0d56607
...
...
@@ -86,7 +86,7 @@
<label for="htmlHead">${htmlhead1Label}</label>
</th>
<td>
<textarea rows="
9
" id="htmlHead"></textarea>
<textarea rows="
6
" id="htmlHead"></textarea>
</td>
</tr>
<tr>
...
...
@@ -94,7 +94,15 @@
<label for="noticeBoard">${noticeBoard1Label}</label>
</th>
<td>
<textarea rows="9" id="noticeBoard"></textarea>
<textarea rows="6" id="noticeBoard"></textarea>
</td>
</tr>
<tr>
<th valign="top">
<label for="footerContent">${footerContent1Label}</label>
</th>
<td>
<textarea rows="2" id="footerContent"></textarea>
</td>
</tr>
<tr>
...
...
src/main/webapp/js/admin/preference.js
View file @
b0d56607
...
...
@@ -18,7 +18,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.
8, Sep 12
, 2015
* @version 1.1.1.
9, Nov 7
, 2015
*/
/* preference 相关操作 */
...
...
@@ -57,6 +57,7 @@ admin.preference = {
$
(
"
#localeString
"
).
val
(
preference
.
localeString
);
$
(
"
#timeZoneId
"
).
val
(
preference
.
timeZoneId
);
$
(
"
#noticeBoard
"
).
val
(
preference
.
noticeBoard
);
$
(
"
#footerContent
"
).
val
(
preference
.
footerContent
);
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
);
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
);
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
);
...
...
@@ -77,7 +78,7 @@ admin.preference = {
if
(
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
)
{
selectedClass
+=
"
selected
"
;
}
}
skinsHTML
+=
"
<div title='
"
+
skins
[
i
].
skinDirName
+
"
' class='left skinItem
"
+
selectedClass
+
"
'><img class='skinPreview' src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
...
...
@@ -89,8 +90,8 @@ admin.preference = {
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
);
$
(
this
).
addClass
(
"
selected
"
);
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
this
.
title
);
});
});
// sign
var
signs
=
eval
(
'
(
'
+
preference
.
signs
+
'
)
'
);
for
(
var
j
=
1
;
j
<
signs
.
length
;
j
++
)
{
...
...
@@ -114,8 +115,8 @@ admin.preference = {
$
(
"
#loadMsg
"
).
text
(
""
);
}
});
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/qiniu
"
,
type
:
"
GET
"
,
cache
:
false
,
...
...
@@ -216,6 +217,7 @@ admin.preference = {
"
localeString
"
:
$
(
"
#localeString
"
).
val
(),
"
timeZoneId
"
:
$
(
"
#timeZoneId
"
).
val
(),
"
noticeBoard
"
:
$
(
"
#noticeBoard
"
).
val
(),
"
footerContent
"
:
$
(
"
#footerContent
"
).
val
(),
"
htmlHead
"
:
$
(
"
#htmlHead
"
).
val
(),
"
externalRelevantArticlesDisplayCount
"
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
"
relevantArticlesDisplayCount
"
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
...
...
src/main/webapp/skins/finding/footer.ftl
View file @
b0d56607
<footer class="site-footer fn-clear">
<a href="${servePath}">${blogTitle}</a>
© ${year}
${footerContent}
<span class="fn-right">
Powered by <a href="http://b3log.org" target="_blank">B3log 开源</a> • <a href="http://b3log.org/services/#solo" target="_blank">Solo</a> ${version}
Theme by <a rel="friend" href="http://vanessa.b3log.org" target="_blank">Vanessa</a>.
...
...
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