Commit f5eb32da authored by Liang Ding's avatar Liang Ding

#12029

parent 5bce628f
......@@ -33,6 +33,7 @@ Without this configuration present, some functionality in the IDE may be limited
<word>Pluginable</word>
<word>Plugins</word>
<word>plugins</word>
<word>Qiniu</word>
<word>servlet</word>
<word>servlets</word>
<word>sitemap</word>
......
......@@ -15,12 +15,11 @@
*/
package org.b3log.solo.model;
/**
* This class defines option model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Apr 15, 2013
* @version 1.1.0.0, Sep 12, 2015
* @since 0.6.0
*/
public final class Option {
......@@ -44,19 +43,47 @@ public final class Option {
* Key of option category.
*/
public static final String OPTION_CATEGORY = "optionCategory";
// oId constants
/**
* Key of broadcast chance expiration time.
*/
public static final String ID_C_BROADCAST_CHANCE_EXPIRATION_TIME = "broadcastChanceExpirationTime";
/**
* Key of Qiniu access key.
*/
public static final String ID_C_QINIU_ACCESS_KEY = "qiniuAccessKey";
/**
* Key of Qiniu secret key.
*/
public static final String ID_C_QINIU_SECRET_KEY = "qiniuSecretKey";
/**
* Key of Qiniu domain.
*/
public static final String ID_C_QINIU_DOMAIN = "qiniuDomain";
/**
* Key of Qiniu bucket.
*/
public static final String ID_C_QINIU_BUCKET = "qiniuBucket";
// Category constants
/**
* Broadcast.
*/
public static final String CATEGORY_C_BROADCAST = "broadcast";
/**
* Qiniu.
*/
public static final String CATEGORY_C_QINIU = "qiniu";
/**
* Private constructor.
*/
private Option() {}
private Option() {
}
}
......@@ -16,12 +16,13 @@
#
# Description: Solo language configurations(en_US).
# Version: 2.3.2.3, Aug 8, 2015
# Version: 2.4.2.3, Sep 12, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
qiniuLabel=Qiniu
contributorsLabel=Contributors
developersLabel=Developers
staticErrorLabel=<h1>staticServePath Error</h1><a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
......
......@@ -16,12 +16,13 @@
#
# Description: Solo default language configurations(zh_CN).
# Version: 2.3.4.11, Aug 8, 2015
# Version: 2.4.4.11, Sep 12, 2015
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
#
qiniuLabel=\u4e03\u725b
contributorsLabel=\u8d21\u732e\u8005
developersLabel=\u5f00\u53d1\u8005
staticErrorLabel=<h1>staticServePath \u914d\u7f6e\u9519\u8bef</h1>\u8bf7\u67e5\u770b <a target='_blank' href='https://github.com/b3log/solo/wiki/usr_faq#1-init'>https://github.com/b3log/solo/wiki/usr_faq</a>
......
......@@ -20,6 +20,11 @@
<a href="#tools/preference/setting">${paramSettingsLabel}</a>
</div>
</li>
<li>
<div id="tabPreference_qiniu">
<a href="#toos/preference/qiniu">${qiniuLabel}</a>
</div>
</li>
<li>
<div id="tabPreference_solo">
<a href="#tools/preference/solo">B3log</a>
......@@ -111,8 +116,8 @@
<input id="keyOfSolo" class="normalInput" type="text" readonly="readonly"/>
</td>
<td>
<!-- <button onclick="admin.preference.update()">${updateLabel}</button>-->
<label></label>
<!-- <button onclick="admin.preference.update()">${updateLabel}</button>-->
<label></label>
</td>
</tr>
</tbody>
......@@ -343,5 +348,48 @@
</tbody>
</table>
</div>
<div id="tabPreferencePanel_qiniu" class="none">
<table class="form" width="98%" cellpadding="0" cellspacing="9px">
<tbody>
<tr>
<th colspan="2">
<button onclick="admin.preference.updateQiniu()">${updateLabel}</button>
</th>
</tr>
<tr>
<th>
<label for="qiniuAccessKey">AccessKey</label>
</th>
<td>
<input id="qiniuAccessKey" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuSecretKey">SecretKey</label>
</th>
<td>
<input id="qiniuSecretKey" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuDomain">Domain</label>
</th>
<td>
<input id="qiniuDomain" class="normalInput" type="text"/>
</td>
</tr>
<tr>
<th>
<label for="qiniuBucket">Bucket</label>
</th>
<td>
<input id="qiniuBucket" class="normalInput" type="text"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
${plugins}
\ No newline at end of file
......@@ -2833,40 +2833,39 @@ admin.register["link-list"] = {
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.8, May 28, 2013
* @version 1.1.1.8, Sep 12, 2015
*/
/* preference 相关操作 */
admin.preference = {
locale: "",
editorType: "",
/*
* 初始化
*/
init: function () {
$("#tabPreference").tabs();
$.ajax({
url: latkeConfig.servePath + "/console/preference/",
type: "GET",
cache: false,
success: function(result, textStatus){
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
var preference = result.preference;
$("#metaKeywords").val(preference.metaKeywords),
$("#metaDescription").val(preference.metaDescription),
$("#blogTitle").val(preference.blogTitle),
$("#blogSubtitle").val(preference.blogSubtitle),
$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);
$("#metaDescription").val(preference.metaDescription),
$("#blogTitle").val(preference.blogTitle),
$("#blogSubtitle").val(preference.blogSubtitle),
$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);
$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),
$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);
$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);
$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount);
$("#articleListDisplayCount").val(preference.articleListDisplayCount);
$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize);
......@@ -2891,13 +2890,13 @@ admin.preference = {
for (var i = 0; i < skins.length; i++) {
var selectedClass = "";
if (skins[i].skinName === preference.skinName
&& skins[i].skinDirName === preference.skinDirName ) {
&& skins[i].skinDirName === preference.skinDirName) {
selectedClass += " selected";
}
}
skinsHTML += "<div title='" + skins[i].skinDirName
+ "' class='left skinItem" + selectedClass + "'><img class='skinPreview' src='"
+ latkeConfig.staticServePath + "/skins/" + skins[i].skinDirName
+ "/preview.png'/><div>" + skins[i].skinName + "</div></div>";
+ "' class='left skinItem" + selectedClass + "'><img class='skinPreview' src='"
+ latkeConfig.staticServePath + "/skins/" + skins[i].skinDirName
+ "/preview.png'/><div>" + skins[i].skinName + "</div></div>";
}
$("#skinMain").append(skinsHTML + "<div class='clear'></div>");
......@@ -2916,7 +2915,7 @@ admin.preference = {
position: "bottom"
});
}
// Article list style
$("#articleListDisplay").val(preference.articleListStyle);
// Editor Type
......@@ -2926,12 +2925,11 @@ admin.preference = {
$("#feedOutputCnt").val(preference.feedOutputCnt);
// Commentable
preference.commentable ? $("#commentable").attr("checked", "checked") : $("commentable").removeAttr("checked");
$("#loadMsg").text("");
}
});
},
/*
* @description 参数校验
*/
......@@ -2975,7 +2973,6 @@ admin.preference = {
}
return true;
},
/*
* @description 更新
*/
......@@ -2987,19 +2984,19 @@ admin.preference = {
$("#tipMsg").text("");
$("#loadMsg").text(Label.loadingLabel);
var signs = [{
"oId": 0,
"signHTML": ""
}, {
"oId": 1,
"signHTML": $("#preferenceSign1").val()
}, {
"oId": 2,
"signHTML": $("#preferenceSign2").val()
}, {
"oId": 3,
"signHTML": $("#preferenceSign3").val()
}];
"oId": 0,
"signHTML": ""
}, {
"oId": 1,
"signHTML": $("#preferenceSign1").val()
}, {
"oId": 2,
"signHTML": $("#preferenceSign2").val()
}, {
"oId": 3,
"signHTML": $("#preferenceSign3").val()
}];
var requestJSONObject = {
"preference": {
"metaKeywords": $("#metaKeywords").val(),
......@@ -3031,34 +3028,60 @@ admin.preference = {
"commentable": $("#commentable").prop("checked")
}
};
$.ajax({
url: latkeConfig.servePath + "/console/preference/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function(result, textStatus){
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
if ($("#localeString").val() !== admin.preference.locale ||
$("#editorType").val() !== admin.preference.editorType) {
$("#editorType").val() !== admin.preference.editorType) {
window.location.reload();
}
// update article and preferences signs
for (var i = 1; i < signs.length; i++) {
if ($("#articleSign" + signs[i].oId).length === 1) {
$("#articleSign" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
$("#articleSign" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
}
$("#preferenceSignButton" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
$("#preferenceSignButton" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
}
$("#loadMsg").text("");
}
});
},
/*
* @description 更新 Qiniu 参数
*/
updateQiniu: function () {
$("#tipMsg").text("");
$("#loadMsg").text(Label.loadingLabel);
var requestJSONObject = {
"qiniuAccessKey": $("#qiniuAccessKey").val(),
"qiniuSecretKey": $("#qiniuSecretKey").val(),
"qiniuDomain": $("#qiniuDomain").val(),
"qiniuBucket": $("#qiniuBucket").val()
};
$.ajax({
url: latkeConfig.servePath + "/console/preference/qiniu",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
$("#loadMsg").text("");
}
});
......@@ -3068,7 +3091,7 @@ admin.preference = {
/*
* 注册到 admin 进行管理
*/
admin.register["preference"] = {
admin.register["preference"] = {
"obj": admin.preference,
"init": admin.preference.init,
"refresh": function () {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -18,40 +18,39 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.8, May 28, 2013
* @version 1.1.1.8, Sep 12, 2015
*/
/* preference 相关操作 */
admin.preference = {
locale: "",
editorType: "",
/*
* 初始化
*/
init: function () {
$("#tabPreference").tabs();
$.ajax({
url: latkeConfig.servePath + "/console/preference/",
type: "GET",
cache: false,
success: function(result, textStatus){
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
var preference = result.preference;
$("#metaKeywords").val(preference.metaKeywords),
$("#metaDescription").val(preference.metaDescription),
$("#blogTitle").val(preference.blogTitle),
$("#blogSubtitle").val(preference.blogSubtitle),
$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);
$("#metaDescription").val(preference.metaDescription),
$("#blogTitle").val(preference.blogTitle),
$("#blogSubtitle").val(preference.blogSubtitle),
$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);
$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),
$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);
$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);
$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount);
$("#articleListDisplayCount").val(preference.articleListDisplayCount);
$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize);
......@@ -76,13 +75,13 @@ admin.preference = {
for (var i = 0; i < skins.length; i++) {
var selectedClass = "";
if (skins[i].skinName === preference.skinName
&& skins[i].skinDirName === preference.skinDirName ) {
&& skins[i].skinDirName === preference.skinDirName) {
selectedClass += " selected";
}
}
skinsHTML += "<div title='" + skins[i].skinDirName
+ "' class='left skinItem" + selectedClass + "'><img class='skinPreview' src='"
+ latkeConfig.staticServePath + "/skins/" + skins[i].skinDirName
+ "/preview.png'/><div>" + skins[i].skinName + "</div></div>";
+ "' class='left skinItem" + selectedClass + "'><img class='skinPreview' src='"
+ latkeConfig.staticServePath + "/skins/" + skins[i].skinDirName
+ "/preview.png'/><div>" + skins[i].skinName + "</div></div>";
}
$("#skinMain").append(skinsHTML + "<div class='clear'></div>");
......@@ -101,7 +100,7 @@ admin.preference = {
position: "bottom"
});
}
// Article list style
$("#articleListDisplay").val(preference.articleListStyle);
// Editor Type
......@@ -111,12 +110,11 @@ admin.preference = {
$("#feedOutputCnt").val(preference.feedOutputCnt);
// Commentable
preference.commentable ? $("#commentable").attr("checked", "checked") : $("commentable").removeAttr("checked");
$("#loadMsg").text("");
}
});
},
/*
* @description 参数校验
*/
......@@ -160,7 +158,6 @@ admin.preference = {
}
return true;
},
/*
* @description 更新
*/
......@@ -172,19 +169,19 @@ admin.preference = {
$("#tipMsg").text("");
$("#loadMsg").text(Label.loadingLabel);
var signs = [{
"oId": 0,
"signHTML": ""
}, {
"oId": 1,
"signHTML": $("#preferenceSign1").val()
}, {
"oId": 2,
"signHTML": $("#preferenceSign2").val()
}, {
"oId": 3,
"signHTML": $("#preferenceSign3").val()
}];
"oId": 0,
"signHTML": ""
}, {
"oId": 1,
"signHTML": $("#preferenceSign1").val()
}, {
"oId": 2,
"signHTML": $("#preferenceSign2").val()
}, {
"oId": 3,
"signHTML": $("#preferenceSign3").val()
}];
var requestJSONObject = {
"preference": {
"metaKeywords": $("#metaKeywords").val(),
......@@ -216,34 +213,60 @@ admin.preference = {
"commentable": $("#commentable").prop("checked")
}
};
$.ajax({
url: latkeConfig.servePath + "/console/preference/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function(result, textStatus){
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
if ($("#localeString").val() !== admin.preference.locale ||
$("#editorType").val() !== admin.preference.editorType) {
$("#editorType").val() !== admin.preference.editorType) {
window.location.reload();
}
// update article and preferences signs
for (var i = 1; i < signs.length; i++) {
if ($("#articleSign" + signs[i].oId).length === 1) {
$("#articleSign" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
$("#articleSign" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
}
$("#preferenceSignButton" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
$("#preferenceSignButton" + signs[i].oId).tip("option", "content",
signs[i].signHTML === "" ? Label.signIsNullLabel : signs[i].signHTML.replace(/\n/g, "").replace(/<script.*<\/script>/ig, ""));
}
$("#loadMsg").text("");
}
});
},
/*
* @description 更新 Qiniu 参数
*/
updateQiniu: function () {
$("#tipMsg").text("");
$("#loadMsg").text(Label.loadingLabel);
var requestJSONObject = {
"qiniuAccessKey": $("#qiniuAccessKey").val(),
"qiniuSecretKey": $("#qiniuSecretKey").val(),
"qiniuDomain": $("#qiniuDomain").val(),
"qiniuBucket": $("#qiniuBucket").val()
};
$.ajax({
url: latkeConfig.servePath + "/console/preference/qiniu",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
$("#loadMsg").text("");
}
});
......@@ -253,7 +276,7 @@ admin.preference = {
/*
* 注册到 admin 进行管理
*/
admin.register["preference"] = {
admin.register["preference"] = {
"obj": admin.preference,
"init": admin.preference.init,
"refresh": function () {
......
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