Commit 6841594b authored by Van's avatar Van

🎨 #12724

parent 8728b9c7
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.0.1, Jan 2, 2019 * @version 1.7.0.2, Mar 29, 2019
*/ */
'use strict' 'use strict'
...@@ -79,6 +79,7 @@ function miniAdmin () { ...@@ -79,6 +79,7 @@ function miniAdmin () {
'./src/main/webapp/js/admin/others.js', './src/main/webapp/js/admin/others.js',
'./src/main/webapp/js/admin/linkList.js', './src/main/webapp/js/admin/linkList.js',
'./src/main/webapp/js/admin/preference.js', './src/main/webapp/js/admin/preference.js',
'./src/main/webapp/js/admin/theme-list.js',
'./src/main/webapp/js/admin/pluginList.js', './src/main/webapp/js/admin/pluginList.js',
'./src/main/webapp/js/admin/userList.js', './src/main/webapp/js/admin/userList.js',
'./src/main/webapp/js/admin/categoryList.js', './src/main/webapp/js/admin/categoryList.js',
......
...@@ -58,7 +58,8 @@ import javax.servlet.http.HttpSessionEvent; ...@@ -58,7 +58,8 @@ import javax.servlet.http.HttpSessionEvent;
* 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.10.0.13, Mar 26, 2019 * @author <a href="http://vanessa.b3log.org">Vanessa</a>
* @version 1.11.0.13, Mar 29, 2019
* @since 0.3.1 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
...@@ -336,6 +337,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -336,6 +337,7 @@ public final class SoloServletListener extends AbstractServletListener {
"/admin-draft-list.do", "/admin-draft-list.do",
"/admin-user-list.do", "/admin-user-list.do",
"/admin-category-list.do", "/admin-category-list.do",
"/admin-theme-list.do",
"/admin-plugin-list.do", "/admin-plugin-list.do",
"/admin-main.do", "/admin-main.do",
"/admin-about.do"}, adminConsole::showAdminFunctions); "/admin-about.do"}, adminConsole::showAdminFunctions);
......
...@@ -211,7 +211,7 @@ submitUploadLabel=Upload ...@@ -211,7 +211,7 @@ submitUploadLabel=Upload
fileNameLabel=File Name fileNameLabel=File Name
paramSettingsLabel=Parameters paramSettingsLabel=Parameters
configSettingsLabel=Configuration configSettingsLabel=Configuration
skinLabel=Skins skinLabel=Theme
signLabel=Signs signLabel=Signs
sign1Label=Signs: sign1Label=Signs:
noSignLabel=None noSignLabel=None
......
...@@ -211,7 +211,7 @@ submitUploadLabel=\u4E0A\u4F20 ...@@ -211,7 +211,7 @@ submitUploadLabel=\u4E0A\u4F20
fileNameLabel=\u6587\u4EF6\u540D fileNameLabel=\u6587\u4EF6\u540D
paramSettingsLabel=\u53C2\u6570\u8BBE\u7F6E paramSettingsLabel=\u53C2\u6570\u8BBE\u7F6E
configSettingsLabel=\u4FE1\u606F\u914D\u7F6E configSettingsLabel=\u4FE1\u606F\u914D\u7F6E
skinLabel=\u76AE\u80A4 skinLabel=\u76AE\u80A4\u7BA1\u7406
signLabel=\u7B7E\u540D\u6863 signLabel=\u7B7E\u540D\u6863
sign1Label=\u7B7E\u540D\u6863\uFF1A sign1Label=\u7B7E\u540D\u6863\uFF1A
noSignLabel=\u4E0D\u4F7F\u7528 noSignLabel=\u4E0D\u4F7F\u7528
......
...@@ -96,6 +96,11 @@ ...@@ -96,6 +96,11 @@
<a href="#tools/preference">${preferenceLabel}</a> <a href="#tools/preference">${preferenceLabel}</a>
</div> </div>
</li> </li>
<li>
<div id="tabs_preference">
<a href="#tools/theme-list">${skinLabel}</a>
</div>
</li>
<li> <li>
<div id="tabs_category-list"> <div id="tabs_category-list">
<a href="#tools/category-list">${categoryListLabel}</a> <a href="#tools/category-list">${categoryListLabel}</a>
...@@ -145,6 +150,7 @@ ...@@ -145,6 +150,7 @@
<div id="tabsPanel_draft-list" class="fn__none"></div> <div id="tabsPanel_draft-list" class="fn__none"></div>
<div id="tabsPanel_link-list" class="fn__none"></div> <div id="tabsPanel_link-list" class="fn__none"></div>
<div id="tabsPanel_preference" class="fn__none"></div> <div id="tabsPanel_preference" class="fn__none"></div>
<div id="tabsPanel_theme-list" class="fn__none"></div>
<div id="tabsPanel_category-list" class="fn__none"></div> <div id="tabsPanel_category-list" class="fn__none"></div>
<div id="tabsPanel_page-list" class="fn__none"></div> <div id="tabsPanel_page-list" class="fn__none"></div>
<div id="tabsPanel_others" class="fn__none"></div> <div id="tabsPanel_others" class="fn__none"></div>
...@@ -180,6 +186,7 @@ ...@@ -180,6 +186,7 @@
<script src="${staticServePath}/js/admin/plugin.js"></script> <script src="${staticServePath}/js/admin/plugin.js"></script>
<script src="${staticServePath}/js/admin/main.js"></script> <script src="${staticServePath}/js/admin/main.js"></script>
<script src="${staticServePath}/js/admin/about.js"></script> <script src="${staticServePath}/js/admin/about.js"></script>
<script src="${staticServePath}/js/admin/themeList.js"></script>
<#else> <#else>
<script src="${staticServePath}/js/admin/admin.min.js?${staticResourceVersion}"></script> <script src="${staticServePath}/js/admin/admin.min.js?${staticResourceVersion}"></script>
</#if> </#if>
......
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
<a class="tab-current" href="#tools/preference/config">${configSettingsLabel}</a> <a class="tab-current" href="#tools/preference/config">${configSettingsLabel}</a>
</div> </div>
</li> </li>
<li>
<div id="tabPreference_skins">
<a href="#tools/preference/skins">${skinLabel}</a>
</div>
</li>
<li> <li>
<div id="tabPreference_signs"> <div id="tabPreference_signs">
<a href="#tools/preference/signs">${signLabel}</a> <a href="#tools/preference/signs">${signLabel}</a>
...@@ -235,23 +230,6 @@ ...@@ -235,23 +230,6 @@
<button class="fn__right" onclick="admin.preference.update()">${updateLabel}</button> <button class="fn__right" onclick="admin.preference.update()">${updateLabel}</button>
<div class="fn__clear"></div> <div class="fn__clear"></div>
</div> </div>
<div id="tabPreferencePanel_skins" class="fn__none form">
<table class="form" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<a href="https://github.com/b3log/solo/issues/12449" target="_blank">新皮肤推荐</a> •
<a href="https://hacpai.com/article/1493814851007" target="_blank">皮肤开发指南</a>
</td>
</tr>
<tr>
<td>
<div id="skinMain"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="tabPreferencePanel_signs" class="fn__none form"> <div id="tabPreferencePanel_signs" class="fn__none form">
<button onclick="admin.preference.update()" class="fn__right">${updateLabel}</button> <button onclick="admin.preference.update()" class="fn__right">${updateLabel}</button>
<div class="fn__clear"></div> <div class="fn__clear"></div>
......
<#--
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-2019, b3log.org & hacpai.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<table class="form" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<a href="https://github.com/b3log/solo/issues/12449" target="_blank">新皮肤推荐</a> •
<a href="https://hacpai.com/article/1493814851007" target="_blank">皮肤开发指南</a>
</td>
</tr>
<tr>
<td>
<div id="skinMain"></div>
</td>
</tr>
</tbody>
</table>
${plugins}
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
<h2>401 Unauthorized!</h2> <h2>401 Unauthorized!</h2>
<img class="img-error" src="${staticServePath}/images/401.png" alt="401" title="401 Unauthorized!" /> <img class="img-error" src="${staticServePath}/images/401.png" alt="401" title="401 Unauthorized!" />
<div class="a-error"> <div class="a-error">
Please <a href="${loginURL}">Login</a> or return to <a href="${servePath}">Index</a>. Please <a href="${loginURL}">Star</a> or return to <a href="${servePath}">Index</a>.
</div> </div>
</@commonPage> </@commonPage>
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
<h2>404 Not Found!</h2> <h2>404 Not Found!</h2>
<img class="img-error" src="${staticServePath}/images/404.gif" title="404" alt="404 Not Found!"/> <img class="img-error" src="${staticServePath}/images/404.gif" title="404" alt="404 Not Found!"/>
<div class="a-error"> <div class="a-error">
Please <a href="${loginURL}">Login</a> or return to <a href="${servePath}">Index</a>. Please <a href="${loginURL}">Star</a> or return to <a href="${servePath}">Index</a>.
</div> </div>
</@commonPage> </@commonPage>
\ No newline at end of file
...@@ -44,11 +44,11 @@ var Admin = function () { ...@@ -44,11 +44,11 @@ var Admin = function () {
this.register = {} this.register = {}
// 工具栏下的工具 // 工具栏下的工具
this.tools = [ this.tools = [
'#page-list', '#file-list', '#link-list', '#preference', '#page-list', '#theme-list', '#link-list', '#preference',
'#user-list', '#plugin-list', '#others', '#category-list'] '#user-list', '#plugin-list', '#others', '#category-list']
// 多用户时,一般用户不能使用的功能 // 多用户时,一般用户不能使用的功能
this.adTools = [ this.adTools = [
'link-list', 'preference', 'file-list', 'page-list', 'link-list', 'preference', 'theme-list', 'page-list',
'user-list', 'plugin-list', 'others', 'category-list'] 'user-list', 'plugin-list', 'others', 'category-list']
} }
......
...@@ -77,8 +77,6 @@ admin.preference = { ...@@ -77,8 +77,6 @@ admin.preference = {
'true' === preference.commentable ? $('#commentable').attr('checked', 'checked') : $('commentable').removeAttr('checked') 'true' === preference.commentable ? $('#commentable').attr('checked', 'checked') : $('commentable').removeAttr('checked')
'true' === preference.syncGitHub ? $('#syncGitHub').attr('checked', 'checked') : $('syncGitHub').removeAttr('checked') 'true' === preference.syncGitHub ? $('#syncGitHub').attr('checked', 'checked') : $('syncGitHub').removeAttr('checked')
syncGitHub
admin.preference.locale = preference.localeString admin.preference.locale = preference.localeString
// skin // skin
......
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* preference for admin.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.1.0.0, Mar 29, 2019
*/
/* theme list 相关操作 */
admin.themeList = {
/*
* 初始化
*/
init: function () {
$.ajax({
url: Label.servePath + '/console/preference/',
type: 'GET',
cache: false,
success: function (result, textStatus) {
$('#tipMsg').text(result.msg)
if (!result.sc) {
$('#loadMsg').text('')
return
}
var preference = result.preference
// skin
$('#skinMain').data('skinDirName', preference.skinDirName)
var skins = eval('(' + preference.skins + ')')
var skinsHTML = ''
for (var i = 0; i < skins.length; i++) {
var selectedClass = ''
if (skins[i].skinName === preference.skinName
&& skins[i].skinDirName === preference.skinDirName) {
selectedClass += ' selected'
}
skinsHTML += '<div class="fn__left skinItem' + selectedClass +
'"><div class="ft__center">' +
skins[i].skinName
+ '</div><img class="skinPreview" src="'
+ Label.staticServePath + '/skins/' + skins[i].skinDirName
+ '/preview.png"/><div><button class="update small" data-name="' +
skins[i].skinDirName + '">' + Label.enableLabel +
'</button><button class="small" onclick="window.open(\'' + Label.servePath +
'?skin=' + skins[i].skinName + '\')">'
+ Label.previewLabel + '</button></div></div>'
}
$('#skinMain').append(skinsHTML + '<div class=\'fn__clear\'></div>')
$('.skinItem .update').click(function () {
$('.skinItem').removeClass('selected')
$(this).closest('.skinItem').addClass('selected')
$('#skinMain').data('skinDirName', $(this).data('name'))
admin.preference.update()
})
$('#loadMsg').text('')
},
})
},
/*
* @description 更新
*/
update: function () {
if (!admin.preference.validate()) {
return
}
$('#tipMsg').text('')
$('#loadMsg').text(Label.loadingLabel)
var requestJSONObject = {
'preference': {
'skinDirName': $('#skinMain').data('skinDirName'),
},
}
$.ajax({
url: Label.servePath + '/console/preference/',
type: 'PUT',
cache: false,
data: JSON.stringify(requestJSONObject),
success: function (result, textStatus) {
$('#tipMsg').text(result.msg)
if (!result.sc) {
$('#loadMsg').text('')
return
}
if ($('#localeString').val() !== admin.preference.locale) {
window.location.reload()
}
$('#loadMsg').text('')
},
})
},
}
/*
* 注册到 admin 进行管理
*/
admin.register['theme-list'] = {
'obj': admin.themeList,
'init': admin.themeList.init,
'refresh': admin.themeList.init,
}
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