Commit e70f4bde authored by Vanessa's avatar Vanessa

多语言

parent cf54a811
...@@ -15,8 +15,16 @@ ...@@ -15,8 +15,16 @@
# #
# #
# Description: Language configurations(en_US) of plugin symphony-news-getter. # Description: Language configurations(zh_CN) of plugin b3log broadcast.
# Version: 1.0.0.1, Aug 9, 2011 # Version: 1.0.0.1, Apr 24, 2013
# Author: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# #
userBroadcastLabel=User Broadcast
titleLabel1=Title:
linkLabel1=Link:
contentLabel1=Content:
noEmptyLabel=No Empty
submitLabel=Submit
submitErrorLabel=Error
chanceBroadcastLabel=Second Chance
...@@ -15,9 +15,16 @@ ...@@ -15,9 +15,16 @@
# #
# #
# Description: Language configurations(zh_CN) of plugin symphony-news-getter. # Description: Language configurations(zh_CN) of plugin b3log broadcast.
# Version: 1.0.0.2, Aug 10, 2011 # Version: 1.0.0.1, Apr 24, 2013
# Author: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# #
userBroadcastLabel=\u7528\u6237\u5e7f\u64ad
titleLabel1=\u6807\u9898\uff1a
linkLabel1=\u94fe\u63a5\uff1a
contentLabel1=\u5185\u5bb9\uff1a
noEmptyLabel=\u4e0d\u80fd\u4e3a\u7a7a
submitLabel=\u63d0\u4ea4
submitErrorLabel=\u63d0\u4ea4\u5f02\u5e38
chanceBroadcastLabel=\u79d2\u673a\u4f1a\u8fdb\u884c\u5e7f\u64ad
\ No newline at end of file
<link type="text/css" rel="stylesheet" href="${staticServePath}/plugins/b3log-broadcast/style.css"/> <link type="text/css" rel="stylesheet" href="${staticServePath}/plugins/b3log-broadcast/style.css"/>
<div id="b3logBroadcastPanel"> <div id="b3logBroadcastPanel">
<div id="b3logBroadcast"> <div id="b3logBroadcast">
<div class="module-panel"> <div class="module-panel">
<div class="module-header"> <div class="module-header">
<h2 class="left"> <h2 class="left">
<a target="_blank" href="http://symphony.b3log.org/tags/B3log%20Broadcast"> <a target="_blank" href="http://symphony.b3log.org/tags/B3log%20Broadcast">
用户广播 ${userBroadcastLabel}
</a> </a>
</h2> </h2>
<button class="none right msg"></button> <button class="none right msg"></button>
<span class="clear"></span> <span class="clear"></span>
</div> </div>
<div class="module-body padding12"> <div class="module-body padding12">
<div id="b3logBroadcastList"> <div id="b3logBroadcastList">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div id="b3logBroadcastDialog" class="form"> <div id="b3logBroadcastDialog" class="form">
<label>标题:</label> <label>${titleLabel1}</label>
<span class="none msg">不本能为空</span> <span class="none msg">${noEmptyLabel}</span>
<input type="text" id="b3logBroadcastTitle"> <input type="text" id="b3logBroadcastTitle">
<label>链接:</label> <label>${linkLabel1}</label>
<input type="text" id="b3logBroadcastLink"> <input type="text" id="b3logBroadcastLink">
<label>内容:</label> <label>${contentLabel1}</label>
<span class="none msg">不本能为空</span> <span class="none msg">${noEmptyLabel}</span>
<textarea id="b3logBroadcastContent"></textarea> <textarea id="b3logBroadcastContent"></textarea>
<button class="marginTop12">提交</button><span class="none msg">提交异常</span> <button class="marginTop12">${submitLabel}</button><span class="none msg">${submitErrorLabel}</span>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
plugins.b3logBroadcast = { plugins.b3logBroadcast = {
init: function() { init: function() {
$("#loadMsg").text("${loadingLabel}");
$("#loadMsg").text("${loadingLabel}");
// dialog
// dialog $("#b3logBroadcastDialog").dialog({
$("#b3logBroadcastDialog").dialog({ width: 700,
width: 700, height: 245,
height: 245, "modal": true,
"modal": true, "hideFooter": true
"hideFooter": true });
});
// 打开广播窗口
// 打开广播窗口 $("#b3logBroadcast .module-header > button").click(function() {
$("#b3logBroadcast .module-header > button").click(function() { $("#b3logBroadcastDialog").dialog("open");
$("#b3logBroadcastDialog").dialog("open"); });
});
// 广播提交
// 广播提交 $("#b3logBroadcastDialog button").click(function() {
$("#b3logBroadcastDialog button").click(function() { var data = {
var data = { "broadcast": {
"broadcast": { "title": $("#b3logBroadcastTitle").val().replace(/(^\s*)|(\s*$)/g, ""),
"title": $("#b3logBroadcastTitle").val().replace(/(^\s*)|(\s*$)/g, ""), "content": $("#b3logBroadcastContent").val().replace(/(^\s*)|(\s*$)/g, ""),
"content": $("#b3logBroadcastContent").val().replace(/(^\s*)|(\s*$)/g, ""), "link": $("#b3logBroadcastLink").val()
"link": $("#b3logBroadcastLink").val() }
} };
};
if (data.broadcast.title === "") {
console.log(data); $("#b3logBroadcastTitle").prev().show();
}
if (data.broadcast.title === "") {
$("#b3logBroadcastTitle").prev().show(); if (data.broadcast.content === "") {
} $("#b3logBroadcastContent").prev().show();
}
if (data.broadcast.content === "") {
$("#b3logBroadcastContent").prev().show(); if (data.broadcast.title === "" || data.broadcast.content === "") {
} return;
}
if (data.broadcast.title === "" || data.broadcast.content === "") {
return; $.ajax({
} type: "POST",
url: latkeConfig.servePath + "/console/plugins/b3log-broadcast",
$.ajax({ data: JSON.stringify(data),
type: "POST", success: function(result) {
url: latkeConfig.servePath + "/console/plugins/b3log-broadcast", if (result.sc) {
data: JSON.stringify(data), $("#b3logBroadcastTitle").val("");
success: function(result) { $("#b3logBroadcastLink").val("");
if (result.sc) { $("#b3logBroadcastContent").val("");
$("#b3logBroadcastTitle").val(""); $("#b3logBroadcastDialog").dialog("close");
$("#b3logBroadcastLink").val(""); $("#b3logBroadcastDialog > button").next().hide();
$("#b3logBroadcastContent").val(""); $("#b3logBroadcast .module-header > button").hide();
$("#b3logBroadcastDialog").dialog("close"); $("#b3logBroadcastTitle").prev().hide();
$("#b3logBroadcastDialog > button").next().hide(); $("#b3logBroadcastContent").prev().hide();
$("#b3logBroadcast .module-header > button").hide(); } else {
$("#b3logBroadcastTitle").prev().hide(); $("#b3logBroadcastDialog > button").next().show();
$("#b3logBroadcastContent").prev().hide(); }
} else { }
$("#b3logBroadcastDialog > button").next().show(); });
} });
}
}); // 获取广播
}); $.ajax({
type: "GET",
// 获取广播 url: "http://symphony.b3log.org/apis/broadcasts",
$.ajax({ dataType: "jsonp",
type: "GET", jsonp: "callback",
url: "http://symphony.b3log.org/apis/broadcasts", beforeSend: function () {
dataType: "jsonp", $("#b3logBroadcastList").css("background",
jsonp: "callback", "url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
before: function () { },
$("#b3logBroadcastList").css("background", error: function() {
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent"); $("#b3logBroadcastList").html("Loading Symphony broadcasts failed :-(").css("background", "none");
}, },
error: function() { success: function(result) {
$("#b3logBroadcastList").html("Loading B3log Announcement failed :-(").css("background", "none"); if (result.sc) {
}, var articles = result.articles;
success: function(result) { if (0 === articles.length) {
if (result.sc) { return;
var articles = result.articles; }
if (0 === articles.length) {
return; var listHTML = "<ul>";
} for (var i = 0; i < articles.length; i++) {
var article = articles[i];
var listHTML = "<ul>"; var articleLiHtml = "<li>"
for (var i = 0; i < articles.length; i++) { + "<a target='_blank' href='" + article.articlePermalink + "'>"
var article = articles[i]; + article.articleTitle + "</a>&nbsp; <span class='date'>" + $.bowknot.getDate(article.articleCreateTime, 1);
var articleLiHtml = "<li>" +"</span></li>"
+ "<a target='_blank' href='" + article.articlePermalink + "'>" listHTML += articleLiHtml
+ article.articleTitle + "</a>&nbsp; <span class='date'>" + $.bowknot.getDate(article.articleCreateTime, 1); }
+"</span></li>" listHTML += "</ul>";
listHTML += articleLiHtml
} $("#b3logBroadcastList").html(listHTML).css("background", "none");
listHTML += "</ul>"; }
},
$("#b3logBroadcastList").html(listHTML).css("background", "none"); complete: function(XMLHttpRequest, textStatus) {
} $("#loadMsg").text("");
}, }
complete: function(XMLHttpRequest, textStatus) { });
$("#loadMsg").text("");
}
}); // 广播机会
setInterval(function() {
$.ajax({
// 广播机会 type: "GET",
setInterval(function() { url: latkeConfig.servePath + "/console/plugins/b3log-broadcast/chance",
$.ajax({ success: function(result) {
type: "GET", if (result.sc) {
url: latkeConfig.servePath + "/console/plugins/b3log-broadcast/chance", $("#b3logBroadcast .module-header > button").text(result.broadcastChanceExpirationTime + "${chanceBroadcastLabel}").show();
success: function(result) { } else {
if (!result.sc) { $("#b3logBroadcast .module-header > button").hide();
$("#b3logBroadcast .module-header > button").text("您有" + result.broadcastChanceExpirationTime + "秒机会进行广播").show(); }
} else { }
$("#b3logBroadcast .module-header > button").hide(); });
} }, 10000);
} }
}); };
}, 10000); /*
} * 添加插件
}; */
/* admin.plugin.add({
* 添加插件 "id": "b3logBroadcast",
*/ "path": "/main/panel2",
admin.plugin.add({ "content": $("#b3logBroadcastPanel").html()
"id": "b3logBroadcast", });
"path": "/main/panel2",
"content": $("#b3logBroadcastPanel").html() // 移除现有内容
}); $("#b3logBroadcastPanel").remove();
// 移除现有内容
$("#b3logBroadcastPanel").remove();
</script> </script>
\ No newline at end of file
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
width: 98%; width: 98%;
} }
#b3logBroadcast .module-header > button {
height: 22px;
}
#b3logBroadcastDialog label { #b3logBroadcastDialog label {
line-height: 30px; line-height: 30px;
} }
...@@ -16,4 +20,15 @@ ...@@ -16,4 +20,15 @@
#b3logBroadcast .msg, #b3logBroadcast .msg,
#b3logBroadcastDialog .msg { #b3logBroadcastDialog .msg {
color: #D54121; color: #D54121;
}
#b3logBroadcastList ul {
list-style: none;
}
#b3logBroadcastList a {
text-decoration: none;
}
#b3logBroadcastList .date {
color: #686868;
font-size: 12px;
} }
\ No newline at end of file
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