Commit 67da0283 authored by Liang Ding's avatar Liang Ding

#12029

parent bbcde74c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package org.b3log.solo.processor.console; package org.b3log.solo.processor.console;
import com.qiniu.util.Auth;
import java.util.Calendar; import java.util.Calendar;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
...@@ -43,21 +43,22 @@ import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer; ...@@ -43,21 +43,22 @@ import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer;
import org.b3log.latke.util.Strings; import org.b3log.latke.util.Strings;
import org.b3log.solo.SoloServletListener; import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference; import org.b3log.solo.model.Preference;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
import org.b3log.solo.processor.renderer.ConsoleRenderer; import org.b3log.solo.processor.renderer.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.processor.util.Filler;
import org.b3log.solo.service.OptionQueryService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.UserQueryService; import org.b3log.solo.service.UserQueryService;
import org.b3log.solo.util.Thumbnails; import org.b3log.solo.util.Thumbnails;
import org.json.JSONObject; import org.json.JSONObject;
/** /**
* Admin console render processing. * Admin console render 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.7, Jul 11, 2013 * @version 1.2.0.7, Sep 12, 2015
* @since 0.4.1 * @since 0.4.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -80,6 +81,12 @@ public class AdminConsole { ...@@ -80,6 +81,12 @@ public class AdminConsole {
@Inject @Inject
private PreferenceQueryService preferenceQueryService; private PreferenceQueryService preferenceQueryService;
/**
* Option query service.
*/
@Inject
private OptionQueryService optionQueryService;
/** /**
* User query service. * User query service.
*/ */
...@@ -100,7 +107,7 @@ public class AdminConsole { ...@@ -100,7 +107,7 @@ public class AdminConsole {
/** /**
* Shows administrator index with the specified context. * Shows administrator index with the specified context.
* *
* @param request the specified request * @param request the specified request
* @param context the specified context * @param context the specified context
*/ */
...@@ -133,6 +140,22 @@ public class AdminConsole { ...@@ -133,6 +140,22 @@ public class AdminConsole {
dataModel.put(Common.GRAVATAR, gravatar); dataModel.put(Common.GRAVATAR, gravatar);
try { try {
final JSONObject qiniu = optionQueryService.getOptions(Option.CATEGORY_C_QINIU);
dataModel.put(Option.ID_C_QINIU_ACCESS_KEY, "");
dataModel.put(Option.ID_C_QINIU_BUCKET, "");
dataModel.put(Option.ID_C_QINIU_DOMAIN, "");
dataModel.put(Option.ID_C_QINIU_SECRET_KEY, "");
if (null != qiniu) {
final Auth auth = Auth.create(qiniu.optString(Option.ID_C_QINIU_ACCESS_KEY),
qiniu.optString(Option.ID_C_QINIU_SECRET_KEY));
final String uploadToken = auth.uploadToken(qiniu.optString(Option.ID_C_QINIU_BUCKET));
dataModel.put("qiniuUploadToken", uploadToken);
dataModel.put(Option.ID_C_QINIU_DOMAIN, qiniu.optString(Option.ID_C_QINIU_DOMAIN));
}
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
dataModel.put(Preference.LOCALE_STRING, preference.getString(Preference.LOCALE_STRING)); dataModel.put(Preference.LOCALE_STRING, preference.getString(Preference.LOCALE_STRING));
...@@ -158,22 +181,22 @@ public class AdminConsole { ...@@ -158,22 +181,22 @@ public class AdminConsole {
/** /**
* Shows administrator functions with the specified context. * Shows administrator functions with the specified context.
* *
* @param request the specified request * @param request the specified request
* @param context the specified context * @param context the specified context
*/ */
@RequestProcessing(value = { "/admin-article.do", @RequestProcessing(value = {"/admin-article.do",
"/admin-article-list.do", "/admin-article-list.do",
"/admin-comment-list.do", "/admin-comment-list.do",
"/admin-link-list.do", "/admin-link-list.do",
"/admin-page-list.do", "/admin-page-list.do",
"/admin-others.do", "/admin-others.do",
"/admin-draft-list.do", "/admin-draft-list.do",
"/admin-user-list.do", "/admin-user-list.do",
"/admin-plugin-list.do", "/admin-plugin-list.do",
"/admin-main.do", "/admin-main.do",
"/admin-about.do"}, "/admin-about.do"},
method = HTTPRequestMethod.GET) method = HTTPRequestMethod.GET)
public void showAdminFunctions(final HttpServletRequest request, final HTTPRequestContext context) { public void showAdminFunctions(final HttpServletRequest request, final HTTPRequestContext context) {
final AbstractFreeMarkerRenderer renderer = new ConsoleRenderer(); final AbstractFreeMarkerRenderer renderer = new ConsoleRenderer();
...@@ -200,7 +223,7 @@ public class AdminConsole { ...@@ -200,7 +223,7 @@ public class AdminConsole {
/** /**
* Shows administrator preference function with the specified context. * Shows administrator preference function with the specified context.
* *
* @param request the specified request * @param request the specified request
* @param context the specified context * @param context the specified context
*/ */
...@@ -252,7 +275,7 @@ public class AdminConsole { ...@@ -252,7 +275,7 @@ public class AdminConsole {
/** /**
* Fires FreeMarker action event with the host template name and data model. * Fires FreeMarker action event with the host template name and data model.
* *
* @param hostTemplateName the specified host template name * @param hostTemplateName the specified host template name
* @param dataModel the specified data model * @param dataModel the specified data model
*/ */
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
accessKey1Label=Access Key: accessKey1Label=Access Key:
secretKey1Label=Secret Key: secretKey1Label=Secret Key:
domain1Label=\u57df\u540d: domain1Label=\u57df\u540d:
bucketKey1Label=Bucket: bucket1Label=Bucket:
qiniuLabel=Qiniu qiniuLabel=Qiniu
contributorsLabel=Contributors contributorsLabel=Contributors
developersLabel=Developers developersLabel=Developers
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
accessKey1Label=Access Key\uff1a accessKey1Label=Access Key\uff1a
secretKey1Label=Secret Key\uff1a secretKey1Label=Secret Key\uff1a
domain1Label=\u57df\u540d\uff1a domain1Label=\u57df\u540d\uff1a
bucketKey1Label=Bucket\uff1a bucket1Label=Bucket\uff1a
qiniuLabel=\u4e03\u725b qiniuLabel=\u4e03\u725b
contributorsLabel=\u8d21\u732e\u8005 contributorsLabel=\u8d21\u732e\u8005
developersLabel=\u5f00\u53d1\u8005 developersLabel=\u5f00\u53d1\u8005
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment