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
ef068c6a
Commit
ef068c6a
authored
Sep 12, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#12029
parent
f5eb32da
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
134 additions
and
13 deletions
+134
-13
core/pom.xml
core/pom.xml
+6
-1
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+64
-0
pom.xml
pom.xml
+9
-1
war/src/main/resources/lang_en_US.properties
war/src/main/resources/lang_en_US.properties
+4
-0
war/src/main/resources/lang_zh_CN.properties
war/src/main/resources/lang_zh_CN.properties
+4
-0
war/src/main/webapp/admin-preference.ftl
war/src/main/webapp/admin-preference.ftl
+4
-4
war/src/main/webapp/js/admin/latkeAdmin.js
war/src/main/webapp/js/admin/latkeAdmin.js
+21
-3
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
+21
-3
No files found.
core/pom.xml
View file @
ef068c6a
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
Description: Solo core.
Description: Solo core.
Version: 2.
3.1.7, Jun 28
, 2015
Version: 2.
4.1.7, Sep 12
, 2015
Author: Liang Ding
Author: Liang Ding
-->
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
...
@@ -82,6 +82,11 @@
...
@@ -82,6 +82,11 @@
<artifactId>
markdownpapers-core
</artifactId>
<artifactId>
markdownpapers-core
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<artifactId>
slf4j-log4j12
</artifactId>
...
...
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
ef068c6a
...
@@ -33,6 +33,7 @@ import org.b3log.solo.model.Option;
...
@@ -33,6 +33,7 @@ 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.OptionMgmtService
;
import
org.b3log.solo.service.OptionQueryService
;
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
;
...
@@ -73,6 +74,12 @@ public class PreferenceConsole {
...
@@ -73,6 +74,12 @@ public class PreferenceConsole {
@Inject
@Inject
private
OptionMgmtService
optionMgmtService
;
private
OptionMgmtService
optionMgmtService
;
/**
* Option query service.
*/
@Inject
private
OptionQueryService
optionQueryService
;
/**
/**
* User query service.
* User query service.
*/
*/
...
@@ -429,6 +436,63 @@ public class PreferenceConsole {
...
@@ -429,6 +436,63 @@ public class PreferenceConsole {
}
}
}
}
/**
* Gets Qiniu preference.
*
* <p>
* Renders the response with a json object, for example,
* <pre>
* {
* "sc": boolean,
* "qiniuAccessKey": "",
* "qiniuSecretKey": "",
* "qiniuDomain": "",
* "qiniuBucket": ""
* }
* </pre>
* </p>
*
* @param request the specified http servlet request
* @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
.
GET
)
public
void
getQiniuPreference
(
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
qiniu
=
optionQueryService
.
getOptions
(
Option
.
CATEGORY_C_QINIU
);
if
(
null
==
qiniu
)
{
renderer
.
setJSONObject
(
QueryResults
.
defaultResult
());
return
;
}
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
ret
.
put
(
Option
.
CATEGORY_C_QINIU
,
qiniu
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
renderer
.
setJSONObject
(
jsonObject
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"getFailLabel"
));
}
}
/**
/**
* Updates the Qiniu preference by the specified request.
* Updates the Qiniu preference by the specified request.
*
*
...
...
pom.xml
View file @
ef068c6a
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
Description: Solo parent POM.
Description: Solo parent POM.
Version: 2.
4.4.20, Jun 28
, 2015
Version: 2.
5.4.20, Sep 12
, 2015
Author: Liang Ding
Author: Liang Ding
-->
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
<freemarker-gae.version>
2.3.20
</freemarker-gae.version>
<freemarker-gae.version>
2.3.20
</freemarker-gae.version>
<jsoup.version>
1.5.2
</jsoup.version>
<jsoup.version>
1.5.2
</jsoup.version>
<markdownpapers-core.version>
1.3.2
</markdownpapers-core.version>
<markdownpapers-core.version>
1.3.2
</markdownpapers-core.version>
<qiniu.version>
7.0.4.1
</qiniu.version>
<!-- maven plugin -->
<!-- maven plugin -->
<maven-compiler-plugin.version>
2.3.2
</maven-compiler-plugin.version>
<maven-compiler-plugin.version>
2.3.2
</maven-compiler-plugin.version>
<maven-resources-plugin.version>
2.5
</maven-resources-plugin.version>
<maven-resources-plugin.version>
2.5
</maven-resources-plugin.version>
...
@@ -224,6 +226,12 @@
...
@@ -224,6 +226,12 @@
<version>
${markdownpapers-core.version}
</version>
<version>
${markdownpapers-core.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
${qiniu.version}
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
war/src/main/resources/lang_en_US.properties
View file @
ef068c6a
...
@@ -22,6 +22,10 @@
...
@@ -22,6 +22,10 @@
# Author: Dongxu Wang
# Author: Dongxu Wang
#
#
accessKey1Label
=
Access Key:
secretKey1Label
=
Secret Key:
domain1Label
=
\u
57df
\u
540d:
bucketKey1Label
=
Bucket:
qiniuLabel
=
Qiniu
qiniuLabel
=
Qiniu
contributorsLabel
=
Contributors
contributorsLabel
=
Contributors
developersLabel
=
Developers
developersLabel
=
Developers
...
...
war/src/main/resources/lang_zh_CN.properties
View file @
ef068c6a
...
@@ -22,6 +22,10 @@
...
@@ -22,6 +22,10 @@
# Author: Dongxu Wang
# Author: Dongxu Wang
#
#
accessKey1Label
=
Access Key
\u
ff1a
secretKey1Label
=
Secret Key
\u
ff1a
domain1Label
=
\u
57df
\u
540d
\u
ff1a
bucketKey1Label
=
Bucket
\u
ff1a
qiniuLabel
=
\u
4e03
\u
725b
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
...
...
war/src/main/webapp/admin-preference.ftl
View file @
ef068c6a
...
@@ -358,7 +358,7 @@
...
@@ -358,7 +358,7 @@
</tr>
</tr>
<tr>
<tr>
<th>
<th>
<label for="qiniuAccessKey">
AccessKey
</label>
<label for="qiniuAccessKey">
${accessKey1Label}
</label>
</th>
</th>
<td>
<td>
<input id="qiniuAccessKey" class="normalInput" type="text"/>
<input id="qiniuAccessKey" class="normalInput" type="text"/>
...
@@ -366,7 +366,7 @@
...
@@ -366,7 +366,7 @@
</tr>
</tr>
<tr>
<tr>
<th>
<th>
<label for="qiniuSecretKey">
SecretKey
</label>
<label for="qiniuSecretKey">
${secretKey1Label}
</label>
</th>
</th>
<td>
<td>
<input id="qiniuSecretKey" class="normalInput" type="text"/>
<input id="qiniuSecretKey" class="normalInput" type="text"/>
...
@@ -374,7 +374,7 @@
...
@@ -374,7 +374,7 @@
</tr>
</tr>
<tr>
<tr>
<th>
<th>
<label for="qiniuDomain">
Domain
</label>
<label for="qiniuDomain">
${domain1Label}
</label>
</th>
</th>
<td>
<td>
<input id="qiniuDomain" class="normalInput" type="text"/>
<input id="qiniuDomain" class="normalInput" type="text"/>
...
@@ -382,7 +382,7 @@
...
@@ -382,7 +382,7 @@
</tr>
</tr>
<tr>
<tr>
<th>
<th>
<label for="qiniuBucket">
Bucket
</label>
<label for="qiniuBucket">
${bucket1Label}
</label>
</th>
</th>
<td>
<td>
<input id="qiniuBucket" class="normalInput" type="text"/>
<input id="qiniuBucket" class="normalInput" type="text"/>
...
...
war/src/main/webapp/js/admin/latkeAdmin.js
View file @
ef068c6a
...
@@ -2928,6 +2928,24 @@ admin.preference = {
...
@@ -2928,6 +2928,24 @@ admin.preference = {
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/qiniu
"
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#qiniuAccessKey
"
).
val
(
result
.
qiniu
.
qiniuAccessKey
);
$
(
"
#qiniuSecretKey
"
).
val
(
result
.
qiniu
.
qiniuSecretKey
);
$
(
"
#qiniuDomain
"
).
val
(
result
.
qiniu
.
qiniuDomain
);
$
(
"
#qiniuBucket
"
).
val
(
result
.
qiniu
.
qiniuBucket
);
}
});
});
},
},
/*
/*
...
...
war/src/main/webapp/js/admin/latkeAdmin.min.js
View file @
ef068c6a
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 @
ef068c6a
...
@@ -113,6 +113,24 @@ admin.preference = {
...
@@ -113,6 +113,24 @@ admin.preference = {
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
});
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/preference/qiniu
"
,
type
:
"
GET
"
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
$
(
"
#tipMsg
"
).
text
(
result
.
msg
);
if
(
!
result
.
sc
)
{
$
(
"
#loadMsg
"
).
text
(
""
);
return
;
}
$
(
"
#qiniuAccessKey
"
).
val
(
result
.
qiniu
.
qiniuAccessKey
);
$
(
"
#qiniuSecretKey
"
).
val
(
result
.
qiniu
.
qiniuSecretKey
);
$
(
"
#qiniuDomain
"
).
val
(
result
.
qiniu
.
qiniuDomain
);
$
(
"
#qiniuBucket
"
).
val
(
result
.
qiniu
.
qiniuBucket
);
}
});
});
},
},
/*
/*
...
...
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