Commit e6b0ff5d authored by Liang Ding's avatar Liang Ding

升级到 0.5.5

parent 2033033f
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo core. Description: B3log Solo core.
Version: 2.0.1.0, Aug 16, 2012 Version: 2.0.1.1, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<version>0.5.0</version> <version>0.5.5</version>
</parent> </parent>
<dependencies> <dependencies>
......
...@@ -53,7 +53,7 @@ import org.json.JSONObject; ...@@ -53,7 +53,7 @@ import org.json.JSONObject;
* B3log Solo servlet listener. * B3log Solo servlet listener.
* *
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.7.5, Aug 16, 2011 * @version 1.0.7.6, Nov 21, 2012
* @since 0.3.1 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
...@@ -61,7 +61,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -61,7 +61,7 @@ public final class SoloServletListener extends AbstractServletListener {
/** /**
* B3log Solo version. * B3log Solo version.
*/ */
public static final String VERSION = "0.5.0"; public static final String VERSION = "0.5.5";
/** /**
* Logger. * Logger.
*/ */
......
...@@ -45,7 +45,7 @@ import org.json.JSONObject; ...@@ -45,7 +45,7 @@ import org.json.JSONObject;
* *
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:dongxv.vang@gmail.com">Dongxu Wang</a> * @author <a href="mailto:dongxv.vang@gmail.com">Dongxu Wang</a>
* @version 1.1.1.3, Aug 30, 2012 * @version 1.1.1.4, Nov 21, 2012
* @since 0.3.1 * @since 0.3.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -123,10 +123,10 @@ public final class UpgradeProcessor { ...@@ -123,10 +123,10 @@ public final class UpgradeProcessor {
return; return;
} }
if ("0.4.6".equals(version)) { if ("0.5.0".equals(version)) {
v046ToV050(); v050ToV055();
} else { } else {
LOGGER.log(Level.WARNING, "Attempt to skip more than one version to upgrade. Expected: 0.4.6; Actually: {0}", version); LOGGER.log(Level.WARNING, "Attempt to skip more than one version to upgrade. Expected: 0.5.0; Actually: {0}", version);
if(!sent){ if(!sent){
notifyUserByEmail(); notifyUserByEmail();
sent = true; sent = true;
...@@ -141,12 +141,12 @@ public final class UpgradeProcessor { ...@@ -141,12 +141,12 @@ public final class UpgradeProcessor {
} }
/** /**
* Upgrades from version 046 to version 050. * Upgrades from version 050 to version 055.
* *
* @throws Exception upgrade fails * @throws Exception upgrade fails
*/ */
private void v046ToV050() throws Exception { private void v050ToV055() throws Exception {
LOGGER.info("Upgrading from version 046 to version 050...."); LOGGER.info("Upgrading from version 050 to version 055....");
articleRepository.setCacheEnabled(false); articleRepository.setCacheEnabled(false);
...@@ -157,25 +157,25 @@ public final class UpgradeProcessor { ...@@ -157,25 +157,25 @@ public final class UpgradeProcessor {
// Upgrades preference model // Upgrades preference model
final JSONObject preference = preferenceRepository.get(Preference.PREFERENCE); final JSONObject preference = preferenceRepository.get(Preference.PREFERENCE);
preference.put(Preference.VERSION, "0.5.0"); preference.put(Preference.VERSION, "0.5.5");
preferenceRepository.update(Preference.PREFERENCE, preference); preferenceRepository.update(Preference.PREFERENCE, preference);
LOGGER.log(Level.FINEST, "Updated preference");
transaction.commit(); transaction.commit();
LOGGER.log(Level.FINEST, "Updated preference");
} catch (final Exception e) { } catch (final Exception e) {
if (transaction.isActive()) { if (transaction.isActive()) {
transaction.rollback(); transaction.rollback();
} }
LOGGER.log(Level.SEVERE, "Upgrade failed.", e); LOGGER.log(Level.SEVERE, "Upgrade failed.", e);
throw new Exception("Upgrade failed from version 046 to version 050"); throw new Exception("Upgrade failed from version 050 to version 055");
} finally { } finally {
articleRepository.setCacheEnabled(true); articleRepository.setCacheEnabled(true);
} }
LOGGER.info("Upgraded from version 046 to version 050 successfully :-)"); LOGGER.info("Upgraded from version 050 to version 055 successfully :-)");
} }
/** /**
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# #
# Description: ease skin (mock for test). # Description: ease skin (mock for test).
# Version: 1.0.0.1, Aug 16, 2012 # Version: 1.0.0.2, Nov 21, 2012
# Author: Liang Ding # Author: Liang Ding
# #
name=ease name=ease
version=1.0.2 version=1.0.3
forSolo=0.5.0 forSolo=0.5.5
memo=\u56de\u5f52\u606c\u9759 memo=\u56de\u5f52\u606c\u9759
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo parent POM. Description: B3log Solo parent POM.
Version: 2.0.2.4, Sep 20, 2012 Version: 2.0.2.5, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.5.0</version> <version>0.5.5</version>
<name>B3log Solo</name> <name>B3log Solo</name>
<url>https://github.com/b3log/b3log-solo</url> <url>https://github.com/b3log/b3log-solo</url>
<description> <description>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<!-- Properties --> <!-- Properties -->
<properties> <properties>
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
<org.b3log.solo.version>0.5.0</org.b3log.solo.version> <org.b3log.solo.version>0.5.5</org.b3log.solo.version>
<org.b3log.latke.version>0.5.0-SNAPSHOT</org.b3log.latke.version> <org.b3log.latke.version>0.5.0-SNAPSHOT</org.b3log.latke.version>
<org.b3log.latke-gae.version>0.5.0-SNAPSHOT</org.b3log.latke-gae.version> <org.b3log.latke-gae.version>0.5.0-SNAPSHOT</org.b3log.latke-gae.version>
<org.b3log.latke-bae.version>0.5.0-SNAPSHOT</org.b3log.latke-bae.version> <org.b3log.latke-bae.version>0.5.0-SNAPSHOT</org.b3log.latke-bae.version>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo BAE POM. Description: B3log Solo BAE POM.
Version: 1.0.1.0, Sep 5, 2012 Version: 1.0.1.1, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.0</version> <version>0.5.5</version>
</parent> </parent>
<properties> <properties>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo GAE POM. Description: B3log Solo GAE POM.
Version: 2.0.2.0, Sep 5, 2012 Version: 2.0.2.1, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.0</version> <version>0.5.5</version>
</parent> </parent>
<properties> <properties>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo (MySQL) standard Servlet container POM. Description: B3log Solo (MySQL) standard Servlet container POM.
Version: 1.0.1.0, Sep 5, 2012 Version: 1.0.1.1, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.0</version> <version>0.5.5</version>
</parent> </parent>
<properties> <properties>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo WAR POM. Description: B3log Solo WAR POM.
Version: 2.0.1.4, Sep 4, 2012 Version: 2.0.1.5, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<version>0.5.0</version> <version>0.5.5</version>
</parent> </parent>
<modules> <modules>
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
Description: Web deployment descriptor on GAE. See Description: Web deployment descriptor on GAE. See
http://code.google.com/intl/en/appengine/docs/java/config/appconfig.html http://code.google.com/intl/en/appengine/docs/java/config/appconfig.html
for more details. for more details.
Version: 1.0.3.9, Aug 22, 2012 Version: 1.0.3.10, Nov 21, 2012
Author: Liang Ding Author: Liang Ding
--> -->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>solo-demo</application> <application>solo-demo</application>
<version>050</version> <version>055</version>
<sessions-enabled>true</sessions-enabled> <sessions-enabled>true</sessions-enabled>
......
/* /*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/** /**
* index for admin * index for admin
* *
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a> * @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.2.0, Aug 30, 2012 * @version 1.0.2.0, Aug 30, 2012
*/ */
var Admin = function () { var Admin = function () {
this.register = {}; this.register = {};
// 工具栏下的工具 // 工具栏下的工具
this.tools = ['#page-list', '#file-list', '#link-list', '#preference', this.tools = ['#page-list', '#file-list', '#link-list', '#preference',
'#user-list', '#plugin-list', '#others']; '#user-list', '#plugin-list', '#others'];
// 多用户时,一般用户不能使用的功能 // 多用户时,一般用户不能使用的功能
this.adTools = ['link-list', 'preference', 'file-list', 'page-list', this.adTools = ['link-list', 'preference', 'file-list', 'page-list',
'user-list', 'plugin-list', 'others']; 'user-list', 'plugin-list', 'others'];
}; };
$.extend(Admin.prototype, { $.extend(Admin.prototype, {
/* /*
* 登出 * 登出
*/ */
logout: function () { logout: function () {
window.location.href = latkeConfig.servePath + "/logout?goto=" + latkeConfig.servePath; window.location.href = latkeConfig.servePath + "/logout?goto=" + latkeConfig.servePath;
}, },
/* /*
* 根据当前页数设置 hash * 根据当前页数设置 hash
* @currentPage {string} 当前页 * @currentPage {string} 当前页
*/ */
setHashByPage: function (currentPage) { setHashByPage: function (currentPage) {
var hash = window.location.hash, var hash = window.location.hash,
hashList = hash.split("/"); hashList = hash.split("/");
if (/^\d*$/.test(hashList[hashList.length - 1])) { if (/^\d*$/.test(hashList[hashList.length - 1])) {
hashList[hashList.length - 1] = currentPage; hashList[hashList.length - 1] = currentPage;
} else { } else {
hashList.push(currentPage); hashList.push(currentPage);
} }
window.location.hash = hashList.join("/"); window.location.hash = hashList.join("/");
}, },
/* /*
* 设置某个 tab 被选择 * 设置某个 tab 被选择
* @id tab id * @id tab id
*/ */
selectTab: function (id) { selectTab: function (id) {
window.location.hash = "#" + id; window.location.hash = "#" + id;
}, },
/* /*
* 根据当前 hash 解析出当前页数及 hash 数组。 * 根据当前 hash 解析出当前页数及 hash 数组。
*/ */
analyseHash: function () { analyseHash: function () {
var hash = window.location.hash; var hash = window.location.hash;
var tag = hash.substr(1, hash.length - 1); var tag = hash.substr(1, hash.length - 1);
var tagList = tag.split("/"); var tagList = tag.split("/");
var tags = {}; var tags = {};
tags.page = 1, tags.page = 1,
tags.hashList = []; tags.hashList = [];
for (var i = 0; i < tagList.length; i++) { for (var i = 0; i < tagList.length; i++) {
if (i === tagList.length - 1 && (/^\d+$/.test(tagList[i]))) { if (i === tagList.length - 1 && (/^\d+$/.test(tagList[i]))) {
tags.page = tagList[i]; tags.page = tagList[i];
} else { } else {
tags.hashList.push(tagList[i]); tags.hashList.push(tagList[i]);
} }
} }
return tags; return tags;
}, },
/* /*
* 根据当前 hash 设置当前 tab * 根据当前 hash 设置当前 tab
*/ */
setCurByHash: function () { setCurByHash: function () {
var tags = admin.analyseHash(); var tags = admin.analyseHash();
var tab = tags.hashList[1], var tab = tags.hashList[1],
subTab = tags.hashList[2]; subTab = tags.hashList[2];
if (tags.hashList.length === 1) { if (tags.hashList.length === 1) {
tab = tags.hashList[0]; tab = tags.hashList[0];
} }
if (tab === "") { if (tab === "") {
return; return;
} }
// 离开编辑器时进行提示 // 离开编辑器时进行提示
try { try {
// 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。 // 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。
if (tab !== "article" && admin.article.isConfirm && if (tab !== "article" && admin.article.isConfirm &&
admin.editorArticle.getContent().replace(/\s/g, '') !== "") { admin.editorArticle.getContent().replace(/\s/g, '') !== "") {
if (!confirm(Label.editorLeaveLabel)) { if (!confirm(Label.editorLeaveLabel)) {
window.location.hash = "#article/article"; window.location.hash = "#article/article";
return; return;
} }
} }
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。 // 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if (tab === "article" && admin.article.isConfirm && if (tab === "article" && admin.article.isConfirm &&
admin.editorArticle.getContent().replace(/\s/g, '') !== "") { admin.editorArticle.getContent().replace(/\s/g, '') !== "") {
return; return;
} }
} catch (e) { } catch (e) {
var $articleContent = $('#articleContent'); var $articleContent = $('#articleContent');
if ($articleContent.length > 0) { if ($articleContent.length > 0) {
if (tab !== "article" && admin.article.isConfirm && if (tab !== "article" && admin.article.isConfirm &&
$articleContent.val().replace(/\s/g, '') !== "") { $articleContent.val().replace(/\s/g, '') !== "") {
if (!confirm(Label.editorLeaveLabel)) { if (!confirm(Label.editorLeaveLabel)) {
window.location.hash = "#article/article"; window.location.hash = "#article/article";
return; return;
} }
} }
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。 // 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if (tab === "article" && admin.article.isConfirm && if (tab === "article" && admin.article.isConfirm &&
$articleContent.val().replace(/\s/g, '') !== "") { $articleContent.val().replace(/\s/g, '') !== "") {
return; return;
} }
} }
} }
// clear article // clear article
if (tab !== "article" && admin.editorArticle.setContent) { if (tab !== "article" && admin.editorArticle.setContent) {
admin.article.clear(); admin.article.clear();
} }
admin.article.isConfirm = true; admin.article.isConfirm = true;
$("#tabs").tabs("setCurrent", tab); $("#tabs").tabs("setCurrent", tab);
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
if ($("#tabsPanel_" + tab).length === 1) { if ($("#tabsPanel_" + tab).length === 1) {
if ($("#tabsPanel_" + tab).html().replace(/\s/g, "") === "") { if ($("#tabsPanel_" + tab).html().replace(/\s/g, "") === "") {
// 还未加载 HTML // 还未加载 HTML
$("#tabsPanel_" + tab).load("admin-" + tab + ".do", function () { $("#tabsPanel_" + tab).load("admin-" + tab + ".do", function () {
// 页面加载完后,回调初始函数 // 页面加载完后,回调初始函数
if (tab === "article" && admin.article.status.id) { if (tab === "article" && admin.article.status.id) {
// 当文章页面编辑器未初始化时,调用更新文章需先初始化编辑器 // 当文章页面编辑器未初始化时,调用更新文章需先初始化编辑器
admin.register[tab].init.call(admin.register[tab].obj, admin.article.getAndSet); admin.register[tab].init.call(admin.register[tab].obj, admin.article.getAndSet);
} else { } else {
admin.register[tab].init.call(admin.register[tab].obj, tags.page); admin.register[tab].init.call(admin.register[tab].obj, tags.page);
} }
// 页面包含子 tab,需根据 hash 定位到相应的 tab // 页面包含子 tab,需根据 hash 定位到相应的 tab
if (subTab) { if (subTab) {
$("#tab" + tab.substring(0, 1).toUpperCase() + tab.substring(1)). $("#tab" + tab.substring(0, 1).toUpperCase() + tab.substring(1)).
tabs("setCurrent", subTab); tabs("setCurrent", subTab);
} }
// 根据 hash 调用现有的插件函数 // 根据 hash 调用现有的插件函数
admin.plugin.setCurByHash(tags); admin.plugin.setCurByHash(tags);
}); });
} else { } else {
if (tab === "article" && admin.article.status.id) { if (tab === "article" && admin.article.status.id) {
admin.article.getAndSet(); admin.article.getAndSet();
} }
// 已加载过 HTML,只需调用刷新函数 // 已加载过 HTML,只需调用刷新函数
if (admin.register[tab] && admin.register[tab].refresh) { if (admin.register[tab] && admin.register[tab].refresh) {
admin.register[tab].refresh.call(admin.register[tab].obj, tags.page); admin.register[tab].refresh.call(admin.register[tab].obj, tags.page);
} }
// 页面包含子 tab,需根据 hash 定位到相应的 tab // 页面包含子 tab,需根据 hash 定位到相应的 tab
if (subTab) { if (subTab) {
$("#tab" + tab.substring(0, 1).toUpperCase() + tab.substring(1)). $("#tab" + tab.substring(0, 1).toUpperCase() + tab.substring(1)).
tabs("setCurrent", subTab); tabs("setCurrent", subTab);
} }
// 根据 hash 调用现有的插件函数 // 根据 hash 调用现有的插件函数
admin.plugin.setCurByHash(tags); admin.plugin.setCurByHash(tags);
} }
} else { } else {
$("#tipMsg").text("Error: No tab! " + Label.reportIssueLabel); $("#tipMsg").text("Error: No tab! " + Label.reportIssueLabel);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}, },
/* /*
* 初始化整个后台 * 初始化整个后台
*/ */
init: function () { init: function () {
//window.onerror = Util.error; //window.onerror = Util.error;
Util.killIE(); Util.killIE();
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
// 构建 tabs // 构建 tabs
$("#tabs").tabs(); $("#tabs").tabs();
// tipMsg // tipMsg
setInterval(function () { setInterval(function () {
if($("#tipMsg").text() !== "") { if($("#tipMsg").text() !== "") {
setTimeout(function () { setTimeout(function () {
$("#tipMsg").text(""); $("#tipMsg").text("");
}, 7000); }, 7000);
} }
}, 6000); }, 6000);
$("#loadMsg").text(""); $("#loadMsg").text("");
}, },
/* /*
* @description tools and article collapse * @description tools and article collapse
* @param {bom} it 触发事件对象 * @param {bom} it 触发事件对象
*/ */
collapseNav: function (it) { collapseNav: function (it) {
var subNav = $(it).next(); var subNav = $(it).next();
subNav.slideToggle("normal", function () { subNav.slideToggle("normal", function () {
if (this.style.display !== "none") { if (this.style.display !== "none") {
$(it).find(".ico-arrow-down")[0].className = "ico-arrow-up"; $(it).find(".ico-arrow-down")[0].className = "ico-arrow-up";
} else { } else {
$(it).find(".ico-arrow-up")[0].className = "ico-arrow-down"; $(it).find(".ico-arrow-up")[0].className = "ico-arrow-down";
} }
}); });
}, },
/* /*
* 后台及当前页面所需插件初始化完后,对权限进行控制及当前页面属于 tools 时,tools 选项需展开。 * 后台及当前页面所需插件初始化完后,对权限进行控制及当前页面属于 tools 时,tools 选项需展开。
*/ */
inited: function () { inited: function () {
// Removes functions with the current user role // Removes functions with the current user role
if (Label.userRole !== "adminRole") { if (Label.userRole !== "adminRole") {
for (var i = 0; i < this.adTools.length; i++) { for (var i = 0; i < this.adTools.length; i++) {
$("#tabs").tabs("remove", this.adTools[i]); $("#tabs").tabs("remove", this.adTools[i]);
} }
} else { } else {
// 当前 tab 属于 Tools 时,设其展开 // 当前 tab 属于 Tools 时,设其展开
for (var j = 0; j < this.tools.length; j++) { for (var j = 0; j < this.tools.length; j++) {
if ("#" + window.location.hash.split("/")[1] === this.tools[j]) { if ("#" + window.location.hash.split("/")[1] === this.tools[j]) {
$("#tabToolsTitle").click(); $("#tabToolsTitle").click();
break; break;
} }
} }
} }
this.setCurByHash(); this.setCurByHash();
} }
}); });
var admin = new Admin();/* var admin = new Admin();/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
...@@ -3101,326 +3101,326 @@ admin.register["plugin-list"] = { ...@@ -3101,326 +3101,326 @@ admin.register["plugin-list"] = {
"refresh": function () { "refresh": function () {
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}/* }/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/** /**
* user list for admin * user list for admin
* *
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a> * @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.3, Aug 30, 2012 * @version 1.0.1.3, Aug 30, 2012
*/ */
/* user-list 相关操作 */ /* user-list 相关操作 */
admin.userList = { admin.userList = {
tablePagination: new TablePaginate("user"), tablePagination: new TablePaginate("user"),
pageInfo: { pageInfo: {
currentCount: 1, currentCount: 1,
pageCount: 1, pageCount: 1,
currentPage: 1 currentPage: 1
}, },
userInfo: { userInfo: {
'oId': "", 'oId': "",
"userRole": "" "userRole": ""
}, },
/* /*
* 初始化 table, pagination * 初始化 table, pagination
*/ */
init: function (page) { init: function (page) {
this.tablePagination.buildTable([{ this.tablePagination.buildTable([{
style: "padding-left: 12px;", style: "padding-left: 12px;",
text: Label.commentNameLabel, text: Label.commentNameLabel,
index: "userName", index: "userName",
width: 230 width: 230
}, { }, {
style: "padding-left: 12px;", style: "padding-left: 12px;",
text: Label.commentEmailLabel, text: Label.commentEmailLabel,
index: "userEmail", index: "userEmail",
minWidth: 180 minWidth: 180
}, { }, {
style: "padding-left: 12px;", style: "padding-left: 12px;",
text: Label.administratorLabel, text: Label.administratorLabel,
index: "isAdmin", index: "isAdmin",
width: 120 width: 120
}]); }]);
this.tablePagination.initPagination(); this.tablePagination.initPagination();
this.getList(page); this.getList(page);
$("#userUpdate").dialog({ $("#userUpdate").dialog({
width: 700, width: 700,
height: 190, height: 190,
"modal": true, "modal": true,
"hideFooter": true "hideFooter": true
}); });
}, },
/* /*
* 根据当前页码获取列表 * 根据当前页码获取列表
* @pagNum 当前页码 * @pagNum 当前页码
*/ */
getList: function (pageNum) { getList: function (pageNum) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
this.pageInfo.currentPage = pageNum; this.pageInfo.currentPage = pageNum;
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/users/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: latkeConfig.servePath + "/console/users/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
if (!result.sc) { if (!result.sc) {
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
var users = result.users; var users = result.users;
var userData = []; var userData = [];
admin.userList.pageInfo.currentCount = users.length; admin.userList.pageInfo.currentCount = users.length;
admin.userList.pageInfo.pageCount = result.pagination.paginationPageCount; admin.userList.pageInfo.pageCount = result.pagination.paginationPageCount;
if (users.length < 1) { if (users.length < 1) {
$("#tipMsg").text("No user " + Label.reportIssueLabel); $("#tipMsg").text("No user " + Label.reportIssueLabel);
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
for (var i = 0; i < users.length; i++) { for (var i = 0; i < users.length; i++) {
userData[i] = {}; userData[i] = {};
userData[i].userName = users[i].userName; userData[i].userName = users[i].userName;
userData[i].userEmail = users[i].userEmail; userData[i].userEmail = users[i].userEmail;
if ("adminRole" === users[i].userRole) { if ("adminRole" === users[i].userRole) {
userData[i].isAdmin = "&nbsp;" + Label.administratorLabel; userData[i].isAdmin = "&nbsp;" + Label.administratorLabel;
userData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.userList.get('" + userData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.userList.get('" +
users[i].oId + "', '" + users[i].userRole + "')\">" + Label.updateLabel + "</a>"; users[i].oId + "', '" + users[i].userRole + "')\">" + Label.updateLabel + "</a>";
} else { } else {
userData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.userList.get('" + userData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.userList.get('" +
users[i].oId + "', '" + users[i].userRole + "')\">" + Label.updateLabel + "</a>\ users[i].oId + "', '" + users[i].userRole + "')\">" + Label.updateLabel + "</a>\
<a href='javascript:void(0)' onclick=\"admin.userList.del('" + users[i].oId + "')\">" + Label.removeLabel + "</a>"; <a href='javascript:void(0)' onclick=\"admin.userList.del('" + users[i].oId + "')\">" + Label.removeLabel + "</a>";
userData[i].isAdmin = Label.commonUserLabel; userData[i].isAdmin = Label.commonUserLabel;
} }
} }
that.tablePagination.updateTablePagination(userData, pageNum, result.pagination); that.tablePagination.updateTablePagination(userData, pageNum, result.pagination);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
}, },
/* /*
* 添加用户 * 添加用户
*/ */
add: function () { add: function () {
if (this.validate()) { if (this.validate()) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
var requestJSONObject = { var requestJSONObject = {
"userName": $("#userName").val(), "userName": $("#userName").val(),
"userEmail": $("#userEmail").val(), "userEmail": $("#userEmail").val(),
"userPassword": $("#userPassword").val() "userPassword": $("#userPassword").val()
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/user/", url: latkeConfig.servePath + "/console/user/",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
success: function(result, textStatus){ success: function(result, textStatus){
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
if (!result.sc) { if (!result.sc) {
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
$("#userName").val(""); $("#userName").val("");
$("#userEmail").val(""); $("#userEmail").val("");
$("#userPassword").val(""); $("#userPassword").val("");
if (admin.userList.pageInfo.currentCount === Label.PAGE_SIZE && if (admin.userList.pageInfo.currentCount === Label.PAGE_SIZE &&
admin.userList.pageInfo.currentPage === admin.userList.pageInfo.pageCount) { admin.userList.pageInfo.currentPage === admin.userList.pageInfo.pageCount) {
admin.userList.pageInfo.pageCount++; admin.userList.pageInfo.pageCount++;
} }
var hashList = window.location.hash.split("/"); var hashList = window.location.hash.split("/");
if (admin.userList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) { if (admin.userList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) {
admin.setHashByPage(admin.userList.pageInfo.pageCount); admin.setHashByPage(admin.userList.pageInfo.pageCount);
} }
admin.userList.getList(admin.userList.pageInfo.pageCount); admin.userList.getList(admin.userList.pageInfo.pageCount);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
} }
}, },
/* /*
* 获取用户 * 获取用户
* @id 用户 id * @id 用户 id
*/ */
get: function (id, userRole) { get: function (id, userRole) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#userUpdate").dialog("open"); $("#userUpdate").dialog("open");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/user/" + id, url: latkeConfig.servePath + "/console/user/" + id,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
if (!result.sc) { if (!result.sc) {
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
var $userEmailUpdate = $("#userEmailUpdate"); var $userEmailUpdate = $("#userEmailUpdate");
$("#userNameUpdate").val(result.user.userName).data("userInfo", { $("#userNameUpdate").val(result.user.userName).data("userInfo", {
'oId': id, 'oId': id,
"userRole": userRole "userRole": userRole
}); });
$userEmailUpdate.val(result.user.userEmail); $userEmailUpdate.val(result.user.userEmail);
if ("adminRole" === userRole) { if ("adminRole" === userRole) {
$userEmailUpdate.attr("disabled", "disabled"); $userEmailUpdate.attr("disabled", "disabled");
} else { } else {
$userEmailUpdate.removeAttr("disabled"); $userEmailUpdate.removeAttr("disabled");
} }
$("#userPasswordUpdate").val(result.user.userPassword); $("#userPasswordUpdate").val(result.user.userPassword);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
}, },
/* /*
* 更新用户 * 更新用户
*/ */
update: function () { update: function () {
if (this.validate("Update")) { if (this.validate("Update")) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
var userInfo = $("#userNameUpdate").data("userInfo"); var userInfo = $("#userNameUpdate").data("userInfo");
var requestJSONObject = { var requestJSONObject = {
"userName": $("#userNameUpdate").val(), "userName": $("#userNameUpdate").val(),
"oId": userInfo.oId, "oId": userInfo.oId,
"userEmail": $("#userEmailUpdate").val(), "userEmail": $("#userEmailUpdate").val(),
"userRole": userInfo.userRole, "userRole": userInfo.userRole,
"userPassword": $("#userPasswordUpdate").val() "userPassword": $("#userPasswordUpdate").val()
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/user/", url: latkeConfig.servePath + "/console/user/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
success: function(result, textStatus){ success: function(result, textStatus){
$("#userUpdate").dialog("close"); $("#userUpdate").dialog("close");
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
if (!result.sc) { if (!result.sc) {
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
admin.userList.getList(admin.userList.pageInfo.currentPage); admin.userList.getList(admin.userList.pageInfo.currentPage);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
} }
}, },
/* /*
* 删除用户 * 删除用户
* @id 用户 id * @id 用户 id
*/ */
del: function (id) { del: function (id) {
var isDelete = confirm(Label.confirmRemoveLabel); var isDelete = confirm(Label.confirmRemoveLabel);
if (isDelete) { if (isDelete) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/user/" + id, url: latkeConfig.servePath + "/console/user/" + id,
type: "DELETE", type: "DELETE",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
if (!result.sc) { if (!result.sc) {
$("#loadMsg").text(""); $("#loadMsg").text("");
return; return;
} }
var pageNum = admin.userList.pageInfo.currentPage; var pageNum = admin.userList.pageInfo.currentPage;
if (admin.userList.pageInfo.currentCount === 1 && admin.userList.pageInfo.pageCount !== 1 && if (admin.userList.pageInfo.currentCount === 1 && admin.userList.pageInfo.pageCount !== 1 &&
admin.userList.pageInfo.currentPage === admin.userList.pageInfo.pageCount) { admin.userList.pageInfo.currentPage === admin.userList.pageInfo.pageCount) {
admin.userList.pageInfo.pageCount--; admin.userList.pageInfo.pageCount--;
pageNum = admin.userList.pageInfo.pageCount; pageNum = admin.userList.pageInfo.pageCount;
} }
var hashList = window.location.hash.split("/"); var hashList = window.location.hash.split("/");
if (pageNum !== parseInt(hashList[hashList.length - 1])) { if (pageNum !== parseInt(hashList[hashList.length - 1])) {
admin.setHashByPage(pageNum); admin.setHashByPage(pageNum);
} }
admin.userList.getList(pageNum); admin.userList.getList(pageNum);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
} }
}, },
/* /*
* 验证字段 * 验证字段
* @status 更新或者添加时进行验证 * @status 更新或者添加时进行验证
*/ */
validate: function (status) { validate: function (status) {
if (!status) { if (!status) {
status = ""; status = "";
} }
var userName = $("#userName" + status).val().replace(/(^\s*)|(\s*$)/g, ""); var userName = $("#userName" + status).val().replace(/(^\s*)|(\s*$)/g, "");
if (2 > userName.length || userName.length > 20) { if (2 > userName.length || userName.length > 20) {
$("#tipMsg").text(Label.nameTooLongLabel); $("#tipMsg").text(Label.nameTooLongLabel);
$("#userName" + status).focus(); $("#userName" + status).focus();
}else if ($("#userEmail" + status).val().replace(/\s/g, "") === "") { }else if ($("#userEmail" + status).val().replace(/\s/g, "") === "") {
$("#tipMsg").text(Label.mailCannotEmptyLabel); $("#tipMsg").text(Label.mailCannotEmptyLabel);
$("#userEmail" + status).focus(); $("#userEmail" + status).focus();
} else if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#userEmail" + status).val())) { } else if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#userEmail" + status).val())) {
$("#tipMsg").text(Label.mailInvalidLabel); $("#tipMsg").text(Label.mailInvalidLabel);
$("#userEmail" + status).focus(); $("#userEmail" + status).focus();
} else if ($("#userPassword" + status).val().replace(/\s/g, "") === "") { } else if ($("#userPassword" + status).val().replace(/\s/g, "") === "") {
$("#tipMsg").text(Label.passwordEmptyLabel); $("#tipMsg").text(Label.passwordEmptyLabel);
$("#userPassword" + status).focus(); $("#userPassword" + status).focus();
} else { } else {
return true; return true;
} }
return false; return false;
} }
}; };
/* /*
* 注册到 admin 进行管理 * 注册到 admin 进行管理
*/ */
admin.register["user-list"] = { admin.register["user-list"] = {
"obj": admin.userList, "obj": admin.userList,
"init": admin.userList.init, "init": admin.userList.init,
"refresh": function () { "refresh": function () {
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}/* }/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* *
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
# #
# Description: ease skin. # Description: ease skin.
# Version: 1.0.0.2, Aug 16, 2012 # Version: 1.0.0.3, Nov 21, 2012
# Author: Liyuan Li # Author: Liyuan Li
# Author: Liang Ding # Author: Liang Ding
# #
name=ease name=ease
version=1.0.2 version=1.0.3
forSolo=0.5.0 forSolo=0.5.5
memo=\u56de\u5f52\u606c\u9759 memo=\u56de\u5f52\u606c\u9759
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# #
# Description: Mobile skin. # Description: Mobile skin.
# Version: 1.0.0.4, Aug 16, 2012 # Version: 1.0.0.5, Nov 21, 2012
# Author: Liang Ding # Author: Liang Ding
# #
name=Mobile name=Mobile
version=0.1.3 version=0.1.4
forSolo=0.5.0 forSolo=0.5.5
memo=\u8bf7\u4e0d\u8981\u4ece\u90e8\u7f72\u76ee\u5f55\u4e2d\u5220\u9664\u8be5\u76ae\u80a4\uff0c\u5426\u5219\u79fb\u52a8\u8bbe\u5907\u8bbf\u95ee\u65f6\u535a\u5ba2\u5c06\u4e0d\u53ef\u7528\u3002 memo=\u8bf7\u4e0d\u8981\u4ece\u90e8\u7f72\u76ee\u5f55\u4e2d\u5220\u9664\u8be5\u76ae\u80a4\uff0c\u5426\u5219\u79fb\u52a8\u8bbe\u5907\u8bbf\u95ee\u65f6\u535a\u5ba2\u5c06\u4e0d\u53ef\u7528\u3002
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