Commit 7c1b49c2 authored by Liang Ding's avatar Liang Ding

Fix #12043

parent c6ed7f53
......@@ -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.2.0.1, Nov 8, 2015
* @version 1.3.0.1, Nov 20, 2015
* @since 0.6.0
*/
public final class Option {
......@@ -184,6 +184,11 @@ public final class Option {
* Key of allow visit draft via permalink.
*/
public static final String ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "allowVisitDraftViaPermalink";
/**
* Key of allow register.
*/
public static final String ID_C_ALLOW_REGISTER = "allowRegister";
/**
* Key of version.
......
......@@ -15,19 +15,17 @@
*/
package org.b3log.solo.model;
import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* This class defines all comment model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.0.10, Nov 8, 2015
* @version 1.3.0.10, Nov 20, 2015
* @since 0.3.1
*/
public final class Preference {
......@@ -152,6 +150,11 @@ public final class Preference {
*/
public static final String ALLOW_VISIT_DRAFT_VIA_PERMALINK = "allowVisitDraftViaPermalink";
/**
* Key of allow register.
*/
public static final String ALLOW_REGISTER = "allowRegister";
/**
* Key of version.
*/
......@@ -159,14 +162,14 @@ public final class Preference {
/**
* Key of article list display style.
*
*
* <p>
* Optional values:
* <ul>
* <li>"titleOnly"</li>
* <li>"titleAndContent"</li>
* <li>"titleAndAbstract"</li>
* </ul>
* <ul>
* <li>"titleOnly"</li>
* <li>"titleAndContent"</li>
* <li>"titleAndAbstract"</li>
* </ul>
* </p>
*/
public static final String ARTICLE_LIST_STYLE = "articleListStyle";
......@@ -183,13 +186,13 @@ public final class Preference {
/**
* Key of feed (Atom/RSS) output mode.
*
*
* <p>
* Optional values:
* <ul>
* <li>"abstract"</li>
* <li>"fullContent"</li>
* </ul>
* <ul>
* <li>"abstract"</li>
* <li>"fullContent"</li>
* </ul>
* </p>
*/
public static final String FEED_OUTPUT_MODE = "feedOutputMode";
......@@ -201,13 +204,13 @@ public final class Preference {
/**
* Key of editor type.
*
* Optional values:
*
* Optional values:
* <p>
* <ul>
* <li>"tinyMCE"</li>
* <li>"CodeMirror-Markdown"</li>
* </ul>
* <ul>
* <li>"tinyMCE"</li>
* <li>"CodeMirror-Markdown"</li>
* </ul>
* </p>
*/
public static final String EDITOR_TYPE = "editorType";
......@@ -215,7 +218,8 @@ public final class Preference {
/**
* Private default constructor.
*/
private Preference() {}
private Preference() {
}
/**
* Default preference.
......@@ -283,8 +287,8 @@ public final class Preference {
/**
* Default time zone.
*
* @see java.util.TimeZone#getAvailableIDs()
*
* @see java.util.TimeZone#getAvailableIDs()
*/
public static final String DEFAULT_TIME_ZONE = "Asia/Shanghai";
......@@ -312,7 +316,7 @@ public final class Preference {
* Default HTML head to append.
*/
public static final String DEFAULT_HTML_HEAD = "";
/**
* Default footer content.
*/
......@@ -348,6 +352,11 @@ public final class Preference {
*/
public static final String DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK = "false";
/**
* Default allow register.
*/
public static final String DEFAULT_ALLOW_REGISTER = "false";
/**
* Default allow comment article/page.
*/
......@@ -411,8 +420,8 @@ public final class Preference {
replyNotificationTemplate.put("subject", "${blogTitle}: New reply of your comment");
replyNotificationTemplate.put("body",
"Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}"
+ ": <span><a href='${replyURL}'>${replyContent}</a></span></p>");
"Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}"
+ ": <span><a href='${replyURL}'>${replyContent}</a></span></p>");
DEFAULT_REPLY_NOTIFICATION_TEMPLATE = replyNotificationTemplate.toString();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Creates sign error!", e);
......@@ -423,6 +432,7 @@ public final class Preference {
/**
* Private default constructor.
*/
private Default() {}
private Default() {
}
}
}
......@@ -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.7, Nov 7, 2015
* @version 1.2.0.7, Nov 20, 2015
* @since 0.4.0
*/
@RequestProcessor
......@@ -306,6 +306,7 @@ public class PreferenceConsole {
* "signHTML": ""
* }, ...]",
* "allowVisitDraftViaPermalink": boolean,
* "allowRegister": boolean,
* "version": "",
* "articleListStyle": "", // Optional values: "titleOnly"/"titleAndContent"/"titleAndAbstract"
* "commentable": boolean,
......@@ -395,6 +396,7 @@ public class PreferenceConsole {
* "signHTML": ""
* }, ...],
* "allowVisitDraftViaPermalink": boolean,
* "allowRegister": boolean,
* "articleListStyle": "",
* "commentable": boolean,
* "feedOutputMode: "",
......
......@@ -15,7 +15,6 @@
*/
package org.b3log.solo.processor.console;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -33,18 +32,19 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.JSONRenderer;
import org.b3log.latke.util.Requests;
import org.b3log.solo.model.Option;
import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.UserMgmtService;
import org.b3log.solo.service.UserQueryService;
import org.b3log.solo.util.QueryResults;
import org.json.JSONObject;
/**
* User console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:385321165@qq.com">DASHU</a>
* @version 1.1.0.4, Oct 17, 2015
* @version 1.2.0.4, Nov 20, 2015
* @since 0.4.0
*/
@RequestProcessor
......@@ -67,6 +67,12 @@ public class UserConsole {
@Inject
private UserMgmtService userMgmtService;
/**
* Preference query service.
*/
@Inject
private PreferenceQueryService preferenceQueryService;
/**
* Language service.
*/
......@@ -75,7 +81,7 @@ public class UserConsole {
/**
* Updates a user by the specified request.
*
*
* <p>
* Renders the response with a json object, for example,
* <pre>
......@@ -86,8 +92,7 @@ public class UserConsole {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* <pre>
* @param request the specified http servlet request, for example, <pre>
* {
* "oId": "",
* "userName": "",
......@@ -98,13 +103,14 @@ public class UserConsole {
* "userAvatar": "" // optional
* }
* </pre>
*
* @param context the specified http request context
* @param response the specified http servlet response
* @throws Exception exception
*/
@RequestProcessing(value = "/console/user/", method = HTTPRequestMethod.PUT)
public void updateUser(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
......@@ -137,7 +143,7 @@ public class UserConsole {
/**
* Adds a user with the specified request.
*
*
* <p>
* Renders the response with a json object, for example,
* <pre>
......@@ -148,31 +154,31 @@ public class UserConsole {
* }
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* <pre>
*
* @param request the specified http servlet request, for example, <pre>
* {
* "userName": "",
* "userEmail": "",
* "userPassword": "",
* "userURL": "", // optional, uses 'servePath' instead if not specified
* "userURL": "", // optional, uses 'servePath' instead if not specified
* "userRole": "", // optional, uses {@value org.b3log.latke.model.Role#DEFAULT_ROLE} instead if not specified
* "userAvatar": "" // optional
* }
* </pre>
*
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing(value = "/console/user/", method = HTTPRequestMethod.POST)
public void addUser(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
final JSONRenderer renderer = new JSONRenderer();
context.setRenderer(renderer);
final JSONObject ret = new JSONObject();
renderer.setJSONObject(ret);
try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
......@@ -180,8 +186,18 @@ public class UserConsole {
if (userQueryService.isAdminLoggedIn(request)) { // if the administrator register a new user, treats the new user as a normal user
// (defaultRole) who could post article
requestJSONObject.put(User.USER_ROLE, Role.DEFAULT_ROLE);
} else { // if a normal user or a visitor register a new user, treates the new user as a visitor (visitorRole) who couldn't
// post article
} else {
final JSONObject preference = preferenceQueryService.getPreference();
if (!preference.optBoolean(Option.ID_C_ALLOW_REGISTER)) {
ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langPropsService.get("notAllowRegisterLabel"));
return;
}
// if a normal user or a visitor register a new user, treates the new user as a visitor
// (visitorRole) who couldn't post article
requestJSONObject.put(User.USER_ROLE, Role.VISITOR_ROLE);
}
......@@ -190,8 +206,6 @@ public class UserConsole {
ret.put(Keys.OBJECT_ID, userId);
ret.put(Keys.MSG, langPropsService.get("addSuccLabel"));
ret.put(Keys.STATUS_CODE, true);
renderer.setJSONObject(ret);
} catch (final ServiceException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
......@@ -204,7 +218,7 @@ public class UserConsole {
/**
* Removes a user by the specified request.
*
*
* <p>
* Renders the response with a json object, for example,
* <pre>
......@@ -222,7 +236,7 @@ public class UserConsole {
*/
@RequestProcessing(value = "/console/user/*", method = HTTPRequestMethod.DELETE)
public void removeUser(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
......@@ -254,11 +268,10 @@ public class UserConsole {
/**
* Gets users by the specified request json object.
* <p>
* The request URI contains the pagination arguments. For example, the
* request URI is /console/users/1/10/20, means the current page is 1, the
* page size is 10, and the window size is 20.
* The request URI contains the pagination arguments. For example, the request URI is /console/users/1/10/20, means
* the current page is 1, the page size is 10, and the window size is 20.
* </p>
*
*
* <p>
* Renders the response with a json object, for example,
* <pre>
......@@ -282,11 +295,11 @@ public class UserConsole {
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
* @throws Exception exception
*/
@RequestProcessing(value = "/console/users/*/*/*"/* Requests.PAGINATION_PATH_PATTERN */, method = HTTPRequestMethod.GET)
public void getUsers(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
final JSONRenderer renderer = new JSONRenderer();
context.setRenderer(renderer);
......@@ -319,7 +332,7 @@ public class UserConsole {
/**
* Gets a user by the specified request.
*
*
* <p>
* Renders the response with a json object, for example,
* <pre>
......@@ -335,7 +348,7 @@ public class UserConsole {
* }
* </pre>
* </p>
*
*
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
......@@ -343,7 +356,7 @@ public class UserConsole {
*/
@RequestProcessing(value = "/console/user/*", method = HTTPRequestMethod.GET)
public void getUser(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
......@@ -398,7 +411,7 @@ public class UserConsole {
*/
@RequestProcessing(value = "/console/changeRole/*", method = HTTPRequestMethod.GET)
public void changeUserRole(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context)
throws Exception {
throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
......
......@@ -70,7 +70,7 @@ import org.json.JSONObject;
* Solo initialization service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.2.8, Nov 8, 2015
* @version 1.4.2.8, Nov 20, 2015
* @since 0.4.0
*/
@Service
......@@ -698,6 +698,12 @@ public class InitService {
allowVisitDraftViaPermalinkOpt.put(Option.OPTION_VALUE, Default.DEFAULT_ALLOW_VISIT_DRAFT_VIA_PERMALINK);
optionRepository.add(allowVisitDraftViaPermalinkOpt);
final JSONObject allowRegisterOpt = new JSONObject();
allowRegisterOpt.put(Keys.OBJECT_ID, Option.ID_C_ALLOW_REGISTER);
allowRegisterOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
allowRegisterOpt.put(Option.OPTION_VALUE, Default.DEFAULT_ALLOW_REGISTER);
optionRepository.add(allowRegisterOpt);
final JSONObject commentableOpt = new JSONObject();
commentableOpt.put(Keys.OBJECT_ID, Option.ID_C_COMMENTABLE);
commentableOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
......
......@@ -50,7 +50,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.1.9, Nov 8, 2015
* @version 1.3.1.9, Nov 20, 2015
* @since 0.4.0
*/
@Service
......@@ -253,6 +253,10 @@ public class PreferenceMgmtService {
allowVisitDraftViaPermalinkOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK));
optionRepository.update(Option.ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK, allowVisitDraftViaPermalinkOpt);
final JSONObject allowRegisterOpt = optionRepository.get(Option.ID_C_ALLOW_REGISTER);
allowRegisterOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_ALLOW_REGISTER));
optionRepository.update(Option.ID_C_ALLOW_REGISTER, allowRegisterOpt);
final JSONObject articleListDisplayCountOpt = optionRepository.get(Option.ID_C_ARTICLE_LIST_DISPLAY_COUNT);
articleListDisplayCountOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_ARTICLE_LIST_DISPLAY_COUNT));
optionRepository.update(Option.ID_C_ARTICLE_LIST_DISPLAY_COUNT, articleListDisplayCountOpt);
......
......@@ -26,7 +26,6 @@ import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.solo.model.Option;
import org.b3log.solo.model.Preference;
import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.repository.PreferenceRepository;
import org.json.JSONArray;
......@@ -47,12 +46,6 @@ public class PreferenceQueryService {
*/
private static final Logger LOGGER = Logger.getLogger(PreferenceQueryService.class.getName());
/**
* Preference repository.
*/
@Inject
private PreferenceRepository preferenceRepository;
/**
* Option repository.
*/
......@@ -109,13 +102,4 @@ public class PreferenceQueryService {
return null;
}
}
/**
* Sets the preference repository with the specified preference repository.
*
* @param preferenceRepository the specified preference repository
*/
public void setPreferenceRepository(final PreferenceRepository preferenceRepository) {
this.preferenceRepository = preferenceRepository;
}
}
......@@ -44,7 +44,7 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</a>
* @version 1.0.0.1, Nov 8, 2015
* @version 1.1.0.1, Nov 20, 2015
* @since 1.2.0
*/
@Service
......@@ -392,13 +392,6 @@ public class UpgradeService {
timeZoneIdOpt.put(Option.OPTION_VALUE, timeZoneId);
optionRepository.add(timeZoneIdOpt);
final String version = preference.optString(Preference.VERSION);
final JSONObject versionOpt = new JSONObject();
versionOpt.put(Keys.OBJECT_ID, Option.ID_C_VERSION);
versionOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
versionOpt.put(Option.OPTION_VALUE, TO_VER);
optionRepository.add(versionOpt);
final String editorType = preference.optString(Preference.EDITOR_TYPE);
final JSONObject editorTypeOpt = new JSONObject();
editorTypeOpt.put(Keys.OBJECT_ID, Option.ID_C_EDITOR_TYPE);
......@@ -428,6 +421,18 @@ public class UpgradeService {
subjectOpt.put(Option.OPTION_VALUE, subject);
optionRepository.add(subjectOpt);
final JSONObject versionOpt = new JSONObject();
versionOpt.put(Keys.OBJECT_ID, Option.ID_C_VERSION);
versionOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
versionOpt.put(Option.OPTION_VALUE, TO_VER);
optionRepository.add(versionOpt);
final JSONObject allowRegisterOpt = new JSONObject();
allowRegisterOpt.put(Keys.OBJECT_ID, Option.ID_C_ALLOW_REGISTER);
allowRegisterOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
allowRegisterOpt.put(Option.OPTION_VALUE, Preference.Default.DEFAULT_ALLOW_REGISTER);
optionRepository.add(allowRegisterOpt);
preference.put(Preference.VERSION, TO_VER);
preferenceRepository.update(Preference.PREFERENCE, preference);
......
......@@ -16,18 +16,20 @@
#
# Description: Solo language configurations(en_US).
# Version: 2.5.2.6, Nov 7, 2015
# Version: 2.5.2.7, Nov 20, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
notAllowRegisterLabel=Not allow register
allowRegister1Label=Allow Register:
footerContent1Label=Footer:
userAvatar1Label=Avatar:
uploadFileLabel=Upload <a href="http://hacpai.com/article/1442418791213" target="_blank">(?)</a>
accessKey1Label=Access Key:
secretKey1Label=Secret Key:
domain1Label=\u57df\u540d:
domain1Label=Domain:
bucket1Label=Bucket:
qiniuLabel=Qiniu
contributorsLabel=Contributors
......@@ -66,7 +68,7 @@ aboutContentLabel=<p><a href="https://github.com/b3log/solo" target="_blank">Sol
is an open source (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache License 2.0</a>) blogging program, which can run on <a href="http://code.google.com/appengine" target="_blank">Google App Engine</a> and a standard Servlet container.</p>\
<p><a href="http://b3log.org" target="_blank">B3log</a> advocates the rights of equality, freedom and passion, and we are trying to create a bran-new experience about individual blogging + community. Sound interesting? <a href="https://github.com/b3log/solo/wiki/Join_us" target="_blank">Join us</a>!</p>\
<a target="blank" href="http://b3log.org/donate.html">\
<div class="ico-alipay-me" alt="Alipay B3log" title="\u901a\u8fc7\u652f\u4ed8\u5b9d\u6536\u6b3e\u4e3b\u9875\u8fdb\u884c\u6350\u8d60"></div></a>
<div class="ico-alipay-me" alt="Alipay B3log" title="\u901a\u8fc7\u652f\u4ed8\u5b9d\u8fdb\u884c\u6350\u8d60"></div></a>
confirmLabel=Confirm
adminConsoleLabel=Admin
adminIndexLabel=Admin Index
......
......@@ -16,12 +16,14 @@
#
# Description: Solo default language configurations(zh_CN).
# Version: 2.5.4.14, Nov 7, 2015
# Version: 2.5.4.15, Nov 20, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
notAllowRegisterLabel=\u6682\u4e0d\u5f00\u653e\u6ce8\u518c\uff01
allowRegister1Label=\u5141\u8bb8\u6ce8\u518c\uff1a
footerContent1Label=\u9875\u811a\uff1a
userAvatar1Label=\u5934\u50cf\uff1a
uploadFileLabel=\u6587\u4ef6\u4e0a\u4f20 <a href="http://hacpai.com/article/1442418791213" target="_blank">(?)</a>
......@@ -66,7 +68,7 @@ aboutContentLabel=<p><a href="https://github.com/b3log/solo" target="_blank">Sol
\u662f\u4e00\u6b3e\u5f00\u6e90\uff08<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache License 2.0</a>\uff09\u7684\u535a\u5ba2\u7a0b\u5e8f\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u5728\u591a\u79cd\u4e91\u5e73\u53f0\u4e0a\u8fd0\u884c\uff0c\u4e5f\u53ef\u4ee5\u5728\u6807\u51c6 Servlet \u5bb9\u5668\u4e0a\u8fd0\u884c\u3002</p>\
<p><a href="http://b3log.org" target="_blank">B3log</a> \u63d0\u5021\u5e73\u7b49\u3001\u81ea\u7531\u3001\u5954\u653e\uff0c\u5e76\u6b63\u5728\u5c1d\u8bd5\u6784\u5efa\u4e2a\u4eba\u535a\u5ba2+\u8bba\u575b\u7684\u4e92\u52a8\u4f53\u9a8c\u3002\u5982\u679c\u60a8\u6709\u5174\u8da3\uff0c<a href="https://github.com/b3log/solo/wiki/Join_us" target="_blank">\u52a0\u5165\u6211\u4eec</a>\u5427\uff01\
</p><a target="blank" href="http://b3log.org/donate.html">\
<div class="ico-alipay-me" alt="Alipay B3log" title="\u901a\u8fc7\u652f\u4ed8\u5b9d\u6536\u6b3e\u4e3b\u9875\u8fdb\u884c\u6350\u8d60"></div></a>
<div class="ico-alipay-me" alt="Alipay B3log" title="\u901a\u8fc7\u652f\u4ed8\u5b9d\u8fdb\u884c\u6350\u8d60"></div></a>
confirmLabel=\u786e\u5b9a
adminConsoleLabel=\u540e\u53f0\u7ba1\u7406
adminIndexLabel=\u540e\u53f0\u9996\u9875
......
......@@ -280,6 +280,14 @@
<input id="commentable" type="checkbox" class="normalInput"/>
</td>
</tr>
<tr>
<th>
<label for="allowRegister">${allowRegister1Label}</label>
</th>
<td>
<input id="allowRegister" type="checkbox" class="normalInput"/>
</td>
</tr>
<tr>
<th>
<label for="feedOutputMode">${feedOutputModel1Label}</label>
......
......@@ -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.9, Nov 7, 2015
* @version 1.2.1.9, Nov 20, 2015
*/
/* preference 相关操作 */
......@@ -63,8 +63,11 @@ admin.preference = {
$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount);
$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount);
$("#keyOfSolo").val(preference.keyOfSolo);
preference.enableArticleUpdateHint ? $("#enableArticleUpdateHint").attr("checked", "checked") : $("#enableArticleUpdateHint").removeAttr("checked");
preference.allowVisitDraftViaPermalink ? $("#allowVisitDraftViaPermalink").attr("checked", "checked") : $("allowVisitDraftViaPermalink").removeAttr("checked");
"true" === preference.enableArticleUpdateHint ? $("#enableArticleUpdateHint").attr("checked", "checked") : $("#enableArticleUpdateHint").removeAttr("checked");
"true" === preference.allowVisitDraftViaPermalink ? $("#allowVisitDraftViaPermalink").attr("checked", "checked") : $("allowVisitDraftViaPermalink").removeAttr("checked");
"true" === preference.allowRegister ? $("#allowRegister").attr("checked", "checked") : $("#allowRegister").removeAttr("checked");
"true" === preference.commentable ? $("#commentable").attr("checked", "checked") : $("commentable").removeAttr("checked");
admin.preference.locale = preference.localeString;
admin.preference.editorType = preference.editorType;
......@@ -102,16 +105,11 @@ admin.preference = {
});
}
// Article list style
$("#articleListDisplay").val(preference.articleListStyle);
// Editor Type
$("#editorType").val(preference.editorType);
// Feed output
$("#feedOutputMode").val(preference.feedOutputMode);
$("#feedOutputCnt").val(preference.feedOutputCnt);
// Commentable
preference.commentable ? $("#commentable").attr("checked", "checked") : $("commentable").removeAttr("checked");
$("#loadMsg").text("");
}
});
......@@ -230,7 +228,8 @@ admin.preference = {
"editorType": $("#editorType").val(),
"feedOutputMode": $("#feedOutputMode").val(),
"feedOutputCnt": $("#feedOutputCnt").val(),
"commentable": $("#commentable").prop("checked")
"commentable": $("#commentable").prop("checked"),
"allowRegister": $("#allowRegister").prop("checked")
}
};
......
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