Commit 6bdfa922 authored by Liang Ding's avatar Liang Ding

Fix #12041

parent 017f9fda
...@@ -43,9 +43,10 @@ import org.b3log.solo.event.rhythm.ArticleUpdater; ...@@ -43,9 +43,10 @@ import org.b3log.solo.event.rhythm.ArticleUpdater;
import org.b3log.solo.event.symphony.CommentSender; import org.b3log.solo.event.symphony.CommentSender;
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.repository.PreferenceRepository; import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.repository.impl.PreferenceRepositoryImpl; import org.b3log.solo.repository.impl.OptionRepositoryImpl;
import org.b3log.solo.service.PreferenceMgmtService; import org.b3log.solo.service.PreferenceMgmtService;
import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.StatisticMgmtService; import org.b3log.solo.service.StatisticMgmtService;
import org.b3log.solo.service.UpgradeService; import org.b3log.solo.service.UpgradeService;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
...@@ -55,7 +56,7 @@ import org.json.JSONObject; ...@@ -55,7 +56,7 @@ import org.json.JSONObject;
* Solo Servlet listener. * Solo Servlet listener.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.6.0.9, Nov 5, 2015 * @version 1.7.0.9, Nov 8, 2015
* @since 0.3.1 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
...@@ -123,9 +124,9 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -123,9 +124,9 @@ public final class SoloServletListener extends AbstractServletListener {
// Set default skin, loads from preference later // Set default skin, loads from preference later
Skins.setDirectoryForTemplateLoading(Preference.Default.DEFAULT_SKIN_DIR_NAME); Skins.setDirectoryForTemplateLoading(Preference.Default.DEFAULT_SKIN_DIR_NAME);
final PreferenceRepository preferenceRepository = beanManager.getReference(PreferenceRepositoryImpl.class); final OptionRepository optionRepository = beanManager.getReference(OptionRepositoryImpl.class);
final Transaction transaction = preferenceRepository.beginTransaction(); final Transaction transaction = optionRepository.beginTransaction();
try { try {
loadPreference(); loadPreference();
...@@ -218,11 +219,11 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -218,11 +219,11 @@ public final class SoloServletListener extends AbstractServletListener {
LOGGER.debug("Loading preference...."); LOGGER.debug("Loading preference....");
final PreferenceRepository preferenceRepository = beanManager.getReference(PreferenceRepositoryImpl.class); final PreferenceQueryService preferenceQueryService = beanManager.getReference(PreferenceQueryService.class);
JSONObject preference; JSONObject preference;
try { try {
preference = preferenceRepository.get(Preference.PREFERENCE); preference = preferenceQueryService.getPreference();
if (null == preference) { if (null == preference) {
LOGGER.warn("Can't not init default skin, please init Solo first"); LOGGER.warn("Can't not init default skin, please init Solo first");
return; return;
...@@ -282,8 +283,8 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -282,8 +283,8 @@ public final class SoloServletListener extends AbstractServletListener {
*/ */
private void resolveSkinDir(final HttpServletRequest httpServletRequest) { private void resolveSkinDir(final HttpServletRequest httpServletRequest) {
try { try {
final PreferenceRepository preferenceRepository = beanManager.getReference(PreferenceRepositoryImpl.class); final PreferenceQueryService preferenceQueryService = beanManager.getReference(PreferenceQueryService.class);
final JSONObject preference = preferenceRepository.get(Preference.PREFERENCE); final JSONObject preference = preferenceQueryService.getPreference();
if (null == preference) { // Did not initialize yet if (null == preference) { // Did not initialize yet
return; return;
......
...@@ -19,7 +19,7 @@ package org.b3log.solo.model; ...@@ -19,7 +19,7 @@ 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.1.0.1, Nov 7, 2015 * @version 1.2.0.1, Nov 8, 2015
* @since 0.6.0 * @since 0.6.0
*/ */
public final class Option { public final class Option {
...@@ -70,6 +70,201 @@ public final class Option { ...@@ -70,6 +70,201 @@ public final class Option {
*/ */
public static final String ID_C_QINIU_BUCKET = "qiniuBucket"; public static final String ID_C_QINIU_BUCKET = "qiniuBucket";
/**
* Key of blog title.
*/
public static final String ID_C_BLOG_TITLE = "blogTitle";
/**
* Key of blog subtitle.
*/
public static final String ID_C_BLOG_SUBTITLE = "blogSubtitle";
/**
* Key of relevant articles display count.
*/
public static final String ID_C_RELEVANT_ARTICLES_DISPLAY_CNT = "relevantArticlesDisplayCount";
/**
* Key of random articles display count.
*/
public static final String ID_C_RANDOM_ARTICLES_DISPLAY_CNT = "randomArticlesDisplayCount";
/**
* Key of external relevant articles display count.
*/
public static final String ID_C_EXTERNAL_RELEVANT_ARTICLES_DISPLAY_CNT = "externalRelevantArticlesDisplayCount";
/**
* Key of recent article display count.
*/
public static final String ID_C_RECENT_ARTICLE_DISPLAY_CNT = "recentArticleDisplayCount";
/**
* Key of recent comment display count.
*/
public static final String ID_C_RECENT_COMMENT_DISPLAY_CNT = "recentCommentDisplayCount";
/**
* Key of most used tag display count.
*/
public static final String ID_C_MOST_USED_TAG_DISPLAY_CNT = "mostUsedTagDisplayCount";
/**
* Key of most comment article display count.
*/
public static final String ID_C_MOST_COMMENT_ARTICLE_DISPLAY_CNT = "mostCommentArticleDisplayCount";
/**
* Key of most view article display count.
*/
public static final String ID_C_MOST_VIEW_ARTICLE_DISPLAY_CNT = "mostViewArticleDisplayCount";
/**
* Key of article list display count.
*/
public static final String ID_C_ARTICLE_LIST_DISPLAY_COUNT = "articleListDisplayCount";
/**
* Key of article list pagination window size.
*/
public static final String ID_C_ARTICLE_LIST_PAGINATION_WINDOW_SIZE = "articleListPaginationWindowSize";
/**
* Key of administrator's email.
*/
public static final String ID_C_ADMIN_EMAIL = "adminEmail";
/**
* Key of locale string.
*/
public static final String ID_C_LOCALE_STRING = "localeString";
/**
* Key of time zone id.
*/
public static final String ID_C_TIME_ZONE_ID = "timeZoneId";
/**
* Key of notice board.
*/
public static final String ID_C_NOTICE_BOARD = "noticeBoard";
/**
* Key of HTML head.
*/
public static final String ID_C_HTML_HEAD = "htmlHead";
/**
* Key of meta keywords.
*/
public static final String ID_C_META_KEYWORDS = "metaKeywords";
/**
* Key of meta description.
*/
public static final String ID_C_META_DESCRIPTION = "metaDescription";
/**
* Key of article update hint flag.
*/
public static final String ID_C_ENABLE_ARTICLE_UPDATE_HINT = "enableArticleUpdateHint";
/**
* Key of signs.
*/
public static final String ID_C_SIGNS = "signs";
/**
* Key of key of Solo.
*/
public static final String ID_C_KEY_OF_SOLO = "keyOfSolo";
/**
* Key of allow visit draft via permalink.
*/
public static final String ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "allowVisitDraftViaPermalink";
/**
* Key of version.
*/
public static final String ID_C_VERSION = "version";
/**
* Key of article list display style.
*
* <p>
* Optional values:
* <ul>
* <li>"titleOnly"</li>
* <li>"titleAndContent"</li>
* <li>"titleAndAbstract"</li>
* </ul>
* </p>
*/
public static final String ID_C_ARTICLE_LIST_STYLE = "articleListStyle";
/**
* Key of article/page comment-able.
*/
public static final String ID_C_COMMENTABLE = "commentable";
/**
* Key of feed (Atom/RSS) output mode.
*
* <p>
* Optional values:
* <ul>
* <li>"abstract"</li>
* <li>"fullContent"</li>
* </ul>
* </p>
*/
public static final String ID_C_FEED_OUTPUT_MODE = "feedOutputMode";
/**
* Key of feed (Atom/RSS) output entry count.
*/
public static final String ID_C_FEED_OUTPUT_CNT = "feedOutputCnt";
/**
* Key of editor type.
*
* Optional values:
* <p>
* <ul>
* <li>"tinyMCE"</li>
* <li>"CodeMirror-Markdown"</li>
* </ul>
* </p>
*/
public static final String ID_C_EDITOR_TYPE = "editorType";
/**
* Key of skins.
*/
public static final String ID_C_SKINS = "skins";
/**
* Key of skin dir name.
*/
public static final String ID_C_SKIN_DIR_NAME = "skinDirName";
/**
* Key of skin name.
*/
public static final String ID_C_SKIN_NAME = "skinName";
/**
* Key of reply notification template body.
*/
public static final String ID_C_REPLY_NOTI_TPL_BODY = "replyNotiTplBody";
/**
* Key of reply notification template subject.
*/
public static final String ID_C_REPLY_NOTI_TPL_SUBJECT = "replyNotiTplSubject";
/** /**
* Key of footer content. * Key of footer content.
*/ */
......
...@@ -27,7 +27,7 @@ import org.json.JSONObject; ...@@ -27,7 +27,7 @@ import org.json.JSONObject;
* This class defines all comment model relevant keys. * This class defines all comment 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.1.0.10, Jun 18, 2015 * @version 1.2.0.10, Nov 8, 2015
* @since 0.3.1 * @since 0.3.1
*/ */
public final class Preference { public final class Preference {
...@@ -291,7 +291,7 @@ public final class Preference { ...@@ -291,7 +291,7 @@ public final class Preference {
/** /**
* Default enable article update hint. * Default enable article update hint.
*/ */
public static final boolean DEFAULT_ENABLE_ARTICLE_UPDATE_HINT = true; public static final String DEFAULT_ENABLE_ARTICLE_UPDATE_HINT = "true";
/** /**
* Default notice board. * Default notice board.
...@@ -313,6 +313,11 @@ public final class Preference { ...@@ -313,6 +313,11 @@ public final class Preference {
*/ */
public static final String DEFAULT_HTML_HEAD = ""; public static final String DEFAULT_HTML_HEAD = "";
/**
* Default footer content.
*/
public static final String DEFAULT_FOOTER_CONTENT = "";
/** /**
* Default relevant articles display count. * Default relevant articles display count.
*/ */
...@@ -341,12 +346,12 @@ public final class Preference { ...@@ -341,12 +346,12 @@ public final class Preference {
/** /**
* Default allow visit draft via permalink. * Default allow visit draft via permalink.
*/ */
public static final boolean DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK = false; public static final String DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "false";
/** /**
* Default allow comment article/page. * Default allow comment article/page.
*/ */
public static final boolean DEFAULT_COMMENTABLE = true; public static final String DEFAULT_COMMENTABLE = "true";
/** /**
* Default administrator's password. * Default administrator's password.
...@@ -404,7 +409,6 @@ public final class Preference { ...@@ -404,7 +409,6 @@ public final class Preference {
final JSONObject replyNotificationTemplate = new JSONObject(); final JSONObject replyNotificationTemplate = new JSONObject();
replyNotificationTemplate.put(Keys.OBJECT_ID, Preference.REPLY_NOTIFICATION_TEMPLATE);
replyNotificationTemplate.put("subject", "${blogTitle}: New reply of your comment"); replyNotificationTemplate.put("subject", "${blogTitle}: New reply of your comment");
replyNotificationTemplate.put("body", replyNotificationTemplate.put("body",
"Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}" "Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package org.b3log.solo.processor; package org.b3log.solo.processor;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -48,9 +47,9 @@ import org.b3log.solo.repository.impl.ArchiveDateRepositoryImpl; ...@@ -48,9 +47,9 @@ import org.b3log.solo.repository.impl.ArchiveDateRepositoryImpl;
import org.b3log.solo.repository.impl.ArticleRepositoryImpl; import org.b3log.solo.repository.impl.ArticleRepositoryImpl;
import org.b3log.solo.repository.impl.CommentRepositoryImpl; import org.b3log.solo.repository.impl.CommentRepositoryImpl;
import org.b3log.solo.repository.impl.LinkRepositoryImpl; import org.b3log.solo.repository.impl.LinkRepositoryImpl;
import org.b3log.solo.repository.impl.OptionRepositoryImpl;
import org.b3log.solo.repository.impl.PageRepositoryImpl; import org.b3log.solo.repository.impl.PageRepositoryImpl;
import org.b3log.solo.repository.impl.PluginRepositoryImpl; import org.b3log.solo.repository.impl.PluginRepositoryImpl;
import org.b3log.solo.repository.impl.PreferenceRepositoryImpl;
import org.b3log.solo.repository.impl.StatisticRepositoryImpl; import org.b3log.solo.repository.impl.StatisticRepositoryImpl;
import org.b3log.solo.repository.impl.TagArticleRepositoryImpl; import org.b3log.solo.repository.impl.TagArticleRepositoryImpl;
import org.b3log.solo.repository.impl.TagRepositoryImpl; import org.b3log.solo.repository.impl.TagRepositoryImpl;
...@@ -62,14 +61,14 @@ import org.b3log.solo.service.StatisticQueryService; ...@@ -62,14 +61,14 @@ import org.b3log.solo.service.StatisticQueryService;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
/** /**
* Provides patches on some special issues. * Provides patches on some special issues.
* *
* <p>See AuthFilter filter configurations in web.xml for authentication.</p> * <p>
* See AuthFilter filter configurations in web.xml for authentication.</p>
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.10, Oct 26, 2013 * @version 1.2.0.10, Nov 8, 2015
* @since 0.3.1 * @since 0.3.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -173,7 +172,7 @@ public class RepairProcessor { ...@@ -173,7 +172,7 @@ public class RepairProcessor {
articleRepository.update(article.getString(Keys.OBJECT_ID), article); articleRepository.update(article.getString(Keys.OBJECT_ID), article);
LOGGER.log(Level.INFO, "Found an article[id={0}] exists unused properties[{1}]", LOGGER.log(Level.INFO, "Found an article[id={0}] exists unused properties[{1}]",
new Object[] {article.getString(Keys.OBJECT_ID), nameSet}); new Object[]{article.getString(Keys.OBJECT_ID), nameSet});
} }
} }
...@@ -193,10 +192,10 @@ public class RepairProcessor { ...@@ -193,10 +192,10 @@ public class RepairProcessor {
* *
* <p> * <p>
* <ul> * <ul>
* <li>Uses the value of {@link Statistic#STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT} * <li>Uses the value of {@link Statistic#STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT} for
* for {@link Statistic#STATISTIC_BLOG_COMMENT_COUNT}</li> * {@link Statistic#STATISTIC_BLOG_COMMENT_COUNT}</li>
* <li>Uses the value of {@link Statistic#STATISTIC_PUBLISHED_ARTICLE_COUNT} * <li>Uses the value of {@link Statistic#STATISTIC_PUBLISHED_ARTICLE_COUNT} for
* for {@link Statistic#STATISTIC_BLOG_ARTICLE_COUNT}</li> * {@link Statistic#STATISTIC_BLOG_ARTICLE_COUNT}</li>
* </ul> * </ul>
* </p> * </p>
* *
...@@ -316,7 +315,7 @@ public class RepairProcessor { ...@@ -316,7 +315,7 @@ public class RepairProcessor {
tagRepository.update(tagId, tag); tagRepository.update(tagId, tag);
LOGGER.log(Level.INFO, "Repaired tag[title={0}, refCnt={1}, publishedTagRefCnt={2}]", LOGGER.log(Level.INFO, "Repaired tag[title={0}, refCnt={1}, publishedTagRefCnt={2}]",
new Object[] {tag.getString(Tag.TAG_TITLE), tagRefCnt, publishedTagRefCnt}); new Object[]{tag.getString(Tag.TAG_TITLE), tagRefCnt, publishedTagRefCnt});
} }
renderer.setContent("Repair sucessfully!"); renderer.setContent("Repair sucessfully!");
...@@ -382,13 +381,13 @@ public class RepairProcessor { ...@@ -382,13 +381,13 @@ public class RepairProcessor {
remove(beanManager.getReference(ArticleRepositoryImpl.class)); remove(beanManager.getReference(ArticleRepositoryImpl.class));
remove(beanManager.getReference(CommentRepositoryImpl.class)); remove(beanManager.getReference(CommentRepositoryImpl.class));
remove(beanManager.getReference(LinkRepositoryImpl.class)); remove(beanManager.getReference(LinkRepositoryImpl.class));
remove(beanManager.getReference(OptionRepositoryImpl.class));
remove(beanManager.getReference(PageRepositoryImpl.class)); remove(beanManager.getReference(PageRepositoryImpl.class));
remove(beanManager.getReference(PreferenceRepositoryImpl.class)); remove(beanManager.getReference(PluginRepositoryImpl.class));
remove(beanManager.getReference(StatisticRepositoryImpl.class)); remove(beanManager.getReference(StatisticRepositoryImpl.class));
remove(beanManager.getReference(TagArticleRepositoryImpl.class)); remove(beanManager.getReference(TagArticleRepositoryImpl.class));
remove(beanManager.getReference(TagRepositoryImpl.class)); remove(beanManager.getReference(TagRepositoryImpl.class));
remove(beanManager.getReference(UserRepositoryImpl.class)); remove(beanManager.getReference(UserRepositoryImpl.class));
remove(beanManager.getReference(PluginRepositoryImpl.class));
succeed = true; succeed = true;
} catch (final Exception e) { } catch (final Exception e) {
......
...@@ -25,5 +25,7 @@ import org.b3log.latke.repository.Repository; ...@@ -25,5 +25,7 @@ import org.b3log.latke.repository.Repository;
* @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, Aug 14, 2010 * @version 1.0.0.0, Aug 14, 2010
* @since 0.3.1 * @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
*/ */
public interface PreferenceRepository extends Repository {} public interface PreferenceRepository extends Repository {}
...@@ -30,6 +30,8 @@ import org.json.JSONObject; ...@@ -30,6 +30,8 @@ import org.json.JSONObject;
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.3, Feb 28, 2012 * @version 1.0.0.3, Feb 28, 2012
* @since 0.3.1 * @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
*/ */
@Repository @Repository
public class PreferenceRepositoryImpl extends AbstractRepository implements PreferenceRepository { public class PreferenceRepositoryImpl extends AbstractRepository implements PreferenceRepository {
......
...@@ -15,23 +15,28 @@ ...@@ -15,23 +15,28 @@
*/ */
package org.b3log.solo.service; package org.b3log.solo.service;
import javax.inject.Inject; import javax.inject.Inject;
import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level; import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger; import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.RepositoryException; import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.ServiceException; import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service; import org.b3log.latke.service.annotation.Service;
import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference; import org.b3log.solo.model.Preference;
import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.repository.PreferenceRepository; import org.b3log.solo.repository.PreferenceRepository;
import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
/** /**
* Preference query service. * Preference query service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.1, Oct 31, 2011 * @version 1.1.0.1, Nov 8, 2015
* @since 0.4.0 * @since 0.4.0
*/ */
@Service @Service
...@@ -48,6 +53,12 @@ public class PreferenceQueryService { ...@@ -48,6 +53,12 @@ public class PreferenceQueryService {
@Inject @Inject
private PreferenceRepository preferenceRepository; private PreferenceRepository preferenceRepository;
/**
* Option repository.
*/
@Inject
private OptionRepository optionRepository;
/** /**
* Gets the reply notification template. * Gets the reply notification template.
* *
...@@ -56,7 +67,13 @@ public class PreferenceQueryService { ...@@ -56,7 +67,13 @@ public class PreferenceQueryService {
*/ */
public JSONObject getReplyNotificationTemplate() throws ServiceException { public JSONObject getReplyNotificationTemplate() throws ServiceException {
try { try {
return preferenceRepository.get(Preference.REPLY_NOTIFICATION_TEMPLATE); final JSONObject ret = new JSONObject();
final JSONObject preference = getPreference();
ret.put("subject", preference.optString(Option.ID_C_REPLY_NOTI_TPL_SUBJECT));
ret.put("body", preference.optString(Option.ID_C_REPLY_NOTI_TPL_BODY));
return ret;
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates reply notification template failed", e); LOGGER.log(Level.ERROR, "Updates reply notification template failed", e);
throw new ServiceException(e); throw new ServiceException(e);
...@@ -66,26 +83,30 @@ public class PreferenceQueryService { ...@@ -66,26 +83,30 @@ public class PreferenceQueryService {
/** /**
* Gets the user preference. * Gets the user preference.
* *
* <p>
* <b>Note</b>: Invoking the method will not load skin.
* </p>
*
* @return user preference, returns {@code null} if not found * @return user preference, returns {@code null} if not found
* @throws ServiceException if repository exception * @throws ServiceException if repository exception
*/ */
public JSONObject getPreference() throws ServiceException { public JSONObject getPreference() throws ServiceException {
try { try {
final JSONObject ret = preferenceRepository.get(Preference.PREFERENCE); final JSONObject checkInit = optionRepository.get(Option.ID_C_ADMIN_EMAIL);
if (null == checkInit) {
if (null == ret) {
LOGGER.log(Level.WARN, "Can not load preference from datastore");
return null; return null;
} }
final Query query = new Query();
query.setFilter(new PropertyFilter(Option.OPTION_CATEGORY, FilterOperator.EQUAL, Option.CATEGORY_C_PREFERENCE));
final JSONArray opts = optionRepository.get(query).optJSONArray(Keys.RESULTS);
final JSONObject ret = new JSONObject();
for (int i = 0; i < opts.length(); i++) {
final JSONObject opt = opts.optJSONObject(i);
ret.put(opt.optString(Keys.OBJECT_ID), opt.opt(Option.OPTION_VALUE));
}
return ret; return ret;
} catch (final RepositoryException e) { } catch (final RepositoryException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); return null;
throw new IllegalStateException(e);
} }
} }
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
return; return;
} }
window.location.href = "${servePath}/admin-index.do#tools/user-list"; window.location.href = "${servePath}/admin-index.do#main";
} }
}); });
} }
......
...@@ -58,10 +58,8 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -58,10 +58,8 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
*/ */
@Test(dependsOnMethods = "init") @Test(dependsOnMethods = "init")
public void updatePreference() throws Exception { public void updatePreference() throws Exception {
final PreferenceMgmtService preferenceMgmtService = final PreferenceMgmtService preferenceMgmtService = getPreferenceMgmtService();
getPreferenceMgmtService(); final PreferenceQueryService preferenceQueryService = getPreferenceQueryService();
final PreferenceQueryService preferenceQueryService =
getPreferenceQueryService();
JSONObject preference = preferenceQueryService.getPreference(); JSONObject preference = preferenceQueryService.getPreference();
Assert.assertEquals(preference.getString(Preference.BLOG_TITLE), Assert.assertEquals(preference.getString(Preference.BLOG_TITLE),
...@@ -71,8 +69,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -71,8 +69,7 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
preferenceMgmtService.updatePreference(preference); preferenceMgmtService.updatePreference(preference);
preference = preferenceQueryService.getPreference(); preference = preferenceQueryService.getPreference();
Assert.assertEquals(preference.getString(Preference.BLOG_TITLE), Assert.assertEquals(preference.getString(Preference.BLOG_TITLE), "updated blog title");
"updated blog title");
} }
/** /**
...@@ -82,12 +79,12 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -82,12 +79,12 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
*/ */
@Test(dependsOnMethods = "init") @Test(dependsOnMethods = "init")
public void updateReplyNotificationTemplate() throws Exception { public void updateReplyNotificationTemplate() throws Exception {
final PreferenceMgmtService preferenceMgmtService = final PreferenceMgmtService preferenceMgmtService
getPreferenceMgmtService(); = getPreferenceMgmtService();
final PreferenceQueryService preferenceQueryService = final PreferenceQueryService preferenceQueryService
getPreferenceQueryService(); = getPreferenceQueryService();
JSONObject replyNotificationTemplate = JSONObject replyNotificationTemplate
preferenceQueryService.getReplyNotificationTemplate(); = preferenceQueryService.getReplyNotificationTemplate();
Assert.assertEquals(replyNotificationTemplate.toString(), Assert.assertEquals(replyNotificationTemplate.toString(),
Preference.Default.DEFAULT_REPLY_NOTIFICATION_TEMPLATE); Preference.Default.DEFAULT_REPLY_NOTIFICATION_TEMPLATE);
...@@ -96,8 +93,8 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase { ...@@ -96,8 +93,8 @@ public class PreferenceMgmtServiceTestCase extends AbstractTestCase {
preferenceMgmtService.updateReplyNotificationTemplate( preferenceMgmtService.updateReplyNotificationTemplate(
replyNotificationTemplate); replyNotificationTemplate);
replyNotificationTemplate = replyNotificationTemplate
preferenceQueryService.getReplyNotificationTemplate(); = preferenceQueryService.getReplyNotificationTemplate();
Assert.assertEquals(replyNotificationTemplate.getString( Assert.assertEquals(replyNotificationTemplate.getString(
"subject"), "updated subject"); "subject"), "updated subject");
} }
......
...@@ -31,3 +31,5 @@ helloWorld.content=\u6b22\u8fce\u4f7f\u7528 \ ...@@ -31,3 +31,5 @@ helloWorld.content=\u6b22\u8fce\u4f7f\u7528 \
<span style="color: orangered; font-weight: bold;">Solo</span></a>\ <span style="color: orangered; font-weight: bold;">Solo</span></a>\
\u3002\u8fd9\u662f\u7cfb\u7edf\u81ea\u52a8\u751f\u6210\u7684\u6f14\u793a\u6587\u7ae0\u3002\u7f16\u8f91\u6216\u8005\u5220\u9664\u5b83\uff0c\u7136\u540e\u5f00\u59cb\u60a8\u7684\u535a\u5ba2\uff01 \u3002\u8fd9\u662f\u7cfb\u7edf\u81ea\u52a8\u751f\u6210\u7684\u6f14\u793a\u6587\u7ae0\u3002\u7f16\u8f91\u6216\u8005\u5220\u9664\u5b83\uff0c\u7136\u540e\u5f00\u59cb\u60a8\u7684\u535a\u5ba2\uff01
helloWorld.comment.content=\u60a8\u597d\uff0c\u8fd9\u662f\u4e00\u6761\u8bc4\u8bba\u3002_esc_enter_88250_\u8981\u5220\u9664\u8bc4\u8bba\uff0c\u8bf7\u5148\u767b\u5f55\uff0c\u7136\u540e\u518d\u67e5\u770b\u8fd9\u7bc7\u6587\u7ae0\u7684\u8bc4\u8bba\u3002\u5728\u90a3\u91cc\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u7f16\u8f91\u6216\u8005\u5220\u9664\u8bc4\u8bba\u7684\u9009\u9879\u3002 helloWorld.comment.content=\u60a8\u597d\uff0c\u8fd9\u662f\u4e00\u6761\u8bc4\u8bba\u3002_esc_enter_88250_\u8981\u5220\u9664\u8bc4\u8bba\uff0c\u8bf7\u5148\u767b\u5f55\uff0c\u7136\u540e\u518d\u67e5\u770b\u8fd9\u7bc7\u6587\u7ae0\u7684\u8bc4\u8bba\u3002\u5728\u90a3\u91cc\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u7f16\u8f91\u6216\u8005\u5220\u9664\u8bc4\u8bba\u7684\u9009\u9879\u3002
updateFailLabel=\u66f4\u65b0\u5931\u8d25
\ No newline at end of file
#
# Copyright (c) 2010-2015, b3log.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: Finding skin.
# Version: 1.1.0.0, Sep 16, 2015
# Author: Liyuan Li
#
name=Finding
version=1.0.1
forSolo=1.1.0
memo=http://demo.ghost.io
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