Commit 8fe513b6 authored by Liyuan Li's avatar Liyuan Li

Merge remote-tracking branch 'origin/master'

parents 31b5d4d4 012d0c46
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</scm> </scm>
<properties> <properties>
<org.b3log.latke.version>3.3.6</org.b3log.latke.version> <org.b3log.latke.version>3.4.0</org.b3log.latke.version>
<jsoup.version>1.12.1</jsoup.version> <jsoup.version>1.12.1</jsoup.version>
<flexmark.version>0.50.40</flexmark.version> <flexmark.version>0.50.40</flexmark.version>
......
...@@ -588,7 +588,7 @@ public class ArticleProcessor { ...@@ -588,7 +588,7 @@ public class ArticleProcessor {
dataModelService.fillCommon(context, dataModel, preference); dataModelService.fillCommon(context, dataModel, preference);
dataModelService.fillFaviconURL(dataModel, preference); dataModelService.fillFaviconURL(dataModel, preference);
dataModelService.fillUsite(dataModel); dataModelService.fillUsite(dataModel);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -634,7 +634,7 @@ public class ArticleProcessor { ...@@ -634,7 +634,7 @@ public class ArticleProcessor {
dataModelService.setArticlesExProperties(context, articles, preference); dataModelService.setArticlesExProperties(context, articles, preference);
final Map<String, Object> dataModel = renderer.getDataModel(); final Map<String, Object> dataModel = renderer.getDataModel();
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
prepareShowArchiveArticles(preference, dataModel, articles, currentPageNum, pageCount, archiveDateString, archiveDate); prepareShowArchiveArticles(preference, dataModel, articles, currentPageNum, pageCount, archiveDateString, archiveDate);
final Response response = context.getResponse(); final Response response = context.getResponse();
dataModelService.fillCommon(context, dataModel, preference); dataModelService.fillCommon(context, dataModel, preference);
...@@ -697,7 +697,7 @@ public class ArticleProcessor { ...@@ -697,7 +697,7 @@ public class ArticleProcessor {
dataModelService.fillCommon(context, dataModel, preference); dataModelService.fillCommon(context, dataModel, preference);
dataModelService.fillFaviconURL(dataModel, preference); dataModelService.fillFaviconURL(dataModel, preference);
dataModelService.fillUsite(dataModel); dataModelService.fillUsite(dataModel);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
// Fire [Before Render Article] event // Fire [Before Render Article] event
final JSONObject eventData = new JSONObject(); final JSONObject eventData = new JSONObject();
......
...@@ -172,7 +172,7 @@ public class CategoryProcessor { ...@@ -172,7 +172,7 @@ public class CategoryProcessor {
return; return;
} }
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
dataModelService.setArticlesExProperties(context, articles, preference); dataModelService.setArticlesExProperties(context, articles, preference);
final List<Integer> pageNums = (List) result.optJSONObject(Pagination.PAGINATION).opt(Pagination.PAGINATION_PAGE_NUMS); final List<Integer> pageNums = (List) result.optJSONObject(Pagination.PAGINATION).opt(Pagination.PAGINATION_PAGE_NUMS);
......
...@@ -151,7 +151,7 @@ public class CommentProcessor { ...@@ -151,7 +151,7 @@ public class CommentProcessor {
// 添加评论优化 https://github.com/b3log/solo/issues/12246 // 添加评论优化 https://github.com/b3log/solo/issues/12246
try { try {
final String skinDirName = (String) context.attr(Keys.TEMAPLTE_DIR_NAME); final String skinDirName = (String) context.attr(Keys.TEMPLATE_DIR_NAME);
final Template template = Skins.getSkinTemplate(context, "common-comment.ftl"); final Template template = Skins.getSkinTemplate(context, "common-comment.ftl");
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), skinDirName, dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), skinDirName, dataModel);
......
...@@ -96,7 +96,7 @@ public class IndexProcessor { ...@@ -96,7 +96,7 @@ public class IndexProcessor {
final int currentPageNum = Paginator.getPage(request); final int currentPageNum = Paginator.getPage(request);
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
dataModelService.fillIndexArticles(context, dataModel, currentPageNum, preference); dataModelService.fillIndexArticles(context, dataModel, currentPageNum, preference);
dataModelService.fillCommon(context, dataModel, preference); dataModelService.fillCommon(context, dataModel, preference);
......
...@@ -86,7 +86,7 @@ public class SkinHandler implements Handler { ...@@ -86,7 +86,7 @@ public class SkinHandler implements Handler {
} }
} }
} }
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, skin); request.setAttribute(Keys.TEMPLATE_DIR_NAME, skin);
} }
private static void fillBotAttrs(final Request request) { private static void fillBotAttrs(final Request request) {
......
...@@ -108,7 +108,7 @@ public class TagProcessor { ...@@ -108,7 +108,7 @@ public class TagProcessor {
final String tagId = tag.getString(Keys.OBJECT_ID); final String tagId = tag.getString(Keys.OBJECT_ID);
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
final int pageSize = preference.getInt(Option.ID_C_ARTICLE_LIST_DISPLAY_COUNT); final int pageSize = preference.getInt(Option.ID_C_ARTICLE_LIST_DISPLAY_COUNT);
final int windowSize = preference.getInt(Option.ID_C_ARTICLE_LIST_PAGINATION_WINDOW_SIZE); final int windowSize = preference.getInt(Option.ID_C_ARTICLE_LIST_PAGINATION_WINDOW_SIZE);
......
...@@ -117,7 +117,7 @@ public class UserTemplateProcessor { ...@@ -117,7 +117,7 @@ public class UserTemplateProcessor {
dataModelService.fillFaviconURL(dataModel, preference); dataModelService.fillFaviconURL(dataModel, preference);
dataModelService.fillUsite(dataModel); dataModelService.fillUsite(dataModel);
dataModelService.fillUserTemplate(context, template, dataModel, preference); dataModelService.fillUserTemplate(context, template, dataModel, preference);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) context.attr(Keys.TEMPLATE_DIR_NAME), dataModel);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -629,7 +629,7 @@ public class DataModelService { ...@@ -629,7 +629,7 @@ public class DataModelService {
dataModel.put(User.USERS, userList); dataModel.put(User.USERS, userList);
final JSONObject admin = userRepository.getAdmin(); final JSONObject admin = userRepository.getAdmin();
dataModel.put(Common.ADMIN_USER, admin); dataModel.put(Common.ADMIN_USER, admin);
final String skinDirName = (String) context.attr(Keys.TEMAPLTE_DIR_NAME); final String skinDirName = (String) context.attr(Keys.TEMPLATE_DIR_NAME);
dataModel.put(Option.ID_C_SKIN_DIR_NAME, skinDirName); dataModel.put(Option.ID_C_SKIN_DIR_NAME, skinDirName);
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
fillPageNavigations(dataModel); fillPageNavigations(dataModel);
......
...@@ -111,7 +111,7 @@ public final class Skins { ...@@ -111,7 +111,7 @@ public final class Skins {
* @return template, returns {@code null} if not found * @return template, returns {@code null} if not found
*/ */
public static Template getSkinTemplate(final RequestContext context, final String templateName) { public static Template getSkinTemplate(final RequestContext context, final String templateName) {
String templateDirName = (String) context.attr(Keys.TEMAPLTE_DIR_NAME); String templateDirName = (String) context.attr(Keys.TEMPLATE_DIR_NAME);
if (StringUtils.isBlank(templateDirName)) { if (StringUtils.isBlank(templateDirName)) {
templateDirName = Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME; templateDirName = Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME;
} }
......
...@@ -136,7 +136,7 @@ public abstract class AbstractTestCase { ...@@ -136,7 +136,7 @@ public abstract class AbstractTestCase {
cookieJSONObject.put(Keys.TOKEN, "pass:" + random); cookieJSONObject.put(Keys.TOKEN, "pass:" + random);
final String cookieValue = Crypts.encryptByAES(cookieJSONObject.toString(), Solos.COOKIE_SECRET); final String cookieValue = Crypts.encryptByAES(cookieJSONObject.toString(), Solos.COOKIE_SECRET);
request.addCookie(Solos.COOKIE_NAME, cookieValue); request.addCookie(Solos.COOKIE_NAME, cookieValue);
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
} }
/** /**
......
...@@ -161,7 +161,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase { ...@@ -161,7 +161,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/archives/" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy/MM")); request.setRequestURI("/archives/" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy/MM"));
request.setParameter("p", "1"); request.setParameter("p", "1");
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final MockResponse response = mockResponse(); final MockResponse response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
...@@ -181,7 +181,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase { ...@@ -181,7 +181,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/article"); request.setRequestURI("/article");
request.setAttribute(Article.ARTICLE, article); request.setAttribute(Article.ARTICLE, article);
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final MockResponse response = mockResponse(); final MockResponse response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
...@@ -202,7 +202,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase { ...@@ -202,7 +202,7 @@ public class ArticleProcessorTestCase extends AbstractTestCase {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/console/article-pwd"); request.setRequestURI("/console/article-pwd");
request.setParameter("articleId", articleId); request.setParameter("articleId", articleId);
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final MockResponse response = mockResponse(); final MockResponse response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
......
...@@ -54,7 +54,7 @@ public class CategoryProcessorTestCase extends AbstractTestCase { ...@@ -54,7 +54,7 @@ public class CategoryProcessorTestCase extends AbstractTestCase {
request = mockRequest(); request = mockRequest();
request.setRequestURI("/category/cate1"); request.setRequestURI("/category/cate1");
request.setMethod("GET"); request.setMethod("GET");
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
response = mockResponse(); response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
......
...@@ -47,7 +47,7 @@ public class CommentProcessorTestCase extends AbstractTestCase { ...@@ -47,7 +47,7 @@ public class CommentProcessorTestCase extends AbstractTestCase {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/article/comments"); request.setRequestURI("/article/comments");
request.setMethod("POST"); request.setMethod("POST");
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final JSONObject requestJSON = new JSONObject(); final JSONObject requestJSON = new JSONObject();
requestJSON.put("oId", addArticle()); requestJSON.put("oId", addArticle());
......
...@@ -36,7 +36,7 @@ public class TagProcessorTestCase extends AbstractTestCase { ...@@ -36,7 +36,7 @@ public class TagProcessorTestCase extends AbstractTestCase {
public void showTagArticles() { public void showTagArticles() {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/tags/Solo"); request.setRequestURI("/tags/Solo");
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final MockResponse response = mockResponse(); final MockResponse response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
......
...@@ -36,7 +36,7 @@ public class UserTemplateProcessorTestCase extends AbstractTestCase { ...@@ -36,7 +36,7 @@ public class UserTemplateProcessorTestCase extends AbstractTestCase {
public void showCategoryArticles() { public void showCategoryArticles() {
final MockRequest request = mockRequest(); final MockRequest request = mockRequest();
request.setRequestURI("/links.html"); request.setRequestURI("/links.html");
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME); request.setAttribute(Keys.TEMPLATE_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final MockResponse response = mockResponse(); final MockResponse response = mockResponse();
mockDispatcher(request, response); mockDispatcher(request, response);
......
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