Commit 5e0a9b69 authored by Liang Ding's avatar Liang Ding

#12059

Fix 1, 2, 3
parent 88547b93
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
* 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.
*/ */
/** /**
* @fileoverview article for admin * @fileoverview article for admin
* *
* @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.2.3.3, Sep 16, 2015 * @version 1.2.4.3, Dec 24, 2015
*/ */
admin.article = { admin.article = {
currentEditorType: '', currentEditorType: '',
...@@ -292,6 +293,33 @@ admin.article = { ...@@ -292,6 +293,33 @@ admin.article = {
* @description 发布文章页面设置文章按钮、发布到社区等状态的显示 * @description 发布文章页面设置文章按钮、发布到社区等状态的显示
*/ */
setStatus: function () { setStatus: function () {
$.ajax({// Gets all tags
url: latkeConfig.servePath + "/console/tags",
type: "GET",
cache: false,
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
if (0 >= result.tags.length) {
return;
}
$("#tagCheckboxPanel>span").remove("");
var spans = "";
for (var i = 0; i < result.tags.length; i++) {
spans += "<span>" + result.tags[i].tagTitle + "</span>";
}
$("#tagCheckboxPanel").html(spans + '<div class="clear"></div>');
$("#loadMsg").text("");
}
});
// set button status // set button status
if (this.status) { if (this.status) {
if (this.status.isArticle) { if (this.status.isArticle) {
...@@ -304,12 +332,14 @@ admin.article = { ...@@ -304,12 +332,14 @@ admin.article = {
if (this.status.articleHadBeenPublished) { if (this.status.articleHadBeenPublished) {
$("#postToCommunityPanel").hide(); $("#postToCommunityPanel").hide();
} else { } else {
$("#postToCommunityPanel").show(); // 1.0.0 开始默认会发布到社区
// $("#postToCommunityPanel").show();
} }
} else { } else {
$("#submitArticle").show(); $("#submitArticle").show();
$("#unSubmitArticle").hide(); $("#unSubmitArticle").hide();
$("#postToCommunityPanel").show(); // 1.0.0 开始默认会发布到社区
// $("#postToCommunityPanel").show();
} }
$("#postToCommunity").attr("checked", "checked"); $("#postToCommunity").attr("checked", "checked");
...@@ -346,6 +376,7 @@ admin.article = { ...@@ -346,6 +376,7 @@ admin.article = {
}); });
$(".markdown-preview-main").html(""); $(".markdown-preview-main").html("");
$("#uploadContent").remove();
}, },
/** /**
* @description 初始化发布文章页面 * @description 初始化发布文章页面
...@@ -443,24 +474,24 @@ admin.article = { ...@@ -443,24 +474,24 @@ admin.article = {
var qiniu = window.qiniu; var qiniu = window.qiniu;
$('#articleUpload').fileupload({ $('#articleUpload').fileupload({
multipart: true, multipart: true,
url: "http://upload.qiniu.com/", url: "http://upload.qiniu.com/",
formData: function (form) { formData: function (form) {
var data = form.serializeArray(); var data = form.serializeArray();
data.push({name: 'token', value: qiniu.qiniuUploadToken}); data.push({name: 'token', value: qiniu.qiniuUploadToken});
return data; return data;
}, },
done: function (e, data) { done: function (e, data) {
var qiniuKey = data.result.key; var qiniuKey = data.result.key;
if (!qiniuKey) { if (!qiniuKey) {
alert("Upload error"); alert("Upload error");
return; return;
} }
var t = new Date().getTime(); var t = new Date().getTime();
$('#articleUpload').after('<div><a target="_blank" href="http://' + qiniu.qiniuDomain + qiniuKey + '?' + t $('#articleUpload').after('<div id="uploadContent"><a target="_blank" href="http://' + qiniu.qiniuDomain + qiniuKey + '?' + t
+ '">[' + data.files[0].name + ']</a> http://' + '">[' + data.files[0].name + ']</a> http://'
+ qiniu.qiniuDomain + qiniuKey + '?' + t + '</div>'); + qiniu.qiniuDomain + qiniuKey + '?' + t + '</div>');
}, },
fail: function (e, data) { fail: function (e, data) {
alert("Upload error: " + data.errorThrown); alert("Upload error: " + data.errorThrown);
...@@ -471,7 +502,7 @@ admin.article = { ...@@ -471,7 +502,7 @@ admin.article = {
alert(currentFile.error); alert(currentFile.error);
} }
}); });
// editor // editor
admin.editors.articleEditor = new Editor({ admin.editors.articleEditor = new Editor({
id: "articleContent", id: "articleContent",
......
...@@ -893,12 +893,13 @@ $.extend(TablePaginate.prototype, { ...@@ -893,12 +893,13 @@ $.extend(TablePaginate.prototype, {
* 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.
*/ */
/** /**
* @fileoverview article for admin * @fileoverview article for admin
* *
* @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.2.3.3, Sep 16, 2015 * @version 1.2.4.3, Dec 24, 2015
*/ */
admin.article = { admin.article = {
currentEditorType: '', currentEditorType: '',
...@@ -1172,6 +1173,33 @@ admin.article = { ...@@ -1172,6 +1173,33 @@ admin.article = {
* @description 发布文章页面设置文章按钮、发布到社区等状态的显示 * @description 发布文章页面设置文章按钮、发布到社区等状态的显示
*/ */
setStatus: function () { setStatus: function () {
$.ajax({// Gets all tags
url: latkeConfig.servePath + "/console/tags",
type: "GET",
cache: false,
success: function (result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
if (0 >= result.tags.length) {
return;
}
$("#tagCheckboxPanel>span").remove("");
var spans = "";
for (var i = 0; i < result.tags.length; i++) {
spans += "<span>" + result.tags[i].tagTitle + "</span>";
}
$("#tagCheckboxPanel").html(spans + '<div class="clear"></div>');
$("#loadMsg").text("");
}
});
// set button status // set button status
if (this.status) { if (this.status) {
if (this.status.isArticle) { if (this.status.isArticle) {
...@@ -1184,12 +1212,14 @@ admin.article = { ...@@ -1184,12 +1212,14 @@ admin.article = {
if (this.status.articleHadBeenPublished) { if (this.status.articleHadBeenPublished) {
$("#postToCommunityPanel").hide(); $("#postToCommunityPanel").hide();
} else { } else {
$("#postToCommunityPanel").show(); // 1.0.0 开始默认会发布到社区
// $("#postToCommunityPanel").show();
} }
} else { } else {
$("#submitArticle").show(); $("#submitArticle").show();
$("#unSubmitArticle").hide(); $("#unSubmitArticle").hide();
$("#postToCommunityPanel").show(); // 1.0.0 开始默认会发布到社区
// $("#postToCommunityPanel").show();
} }
$("#postToCommunity").attr("checked", "checked"); $("#postToCommunity").attr("checked", "checked");
...@@ -1226,6 +1256,7 @@ admin.article = { ...@@ -1226,6 +1256,7 @@ admin.article = {
}); });
$(".markdown-preview-main").html(""); $(".markdown-preview-main").html("");
$("#uploadContent").remove();
}, },
/** /**
* @description 初始化发布文章页面 * @description 初始化发布文章页面
...@@ -1323,24 +1354,24 @@ admin.article = { ...@@ -1323,24 +1354,24 @@ admin.article = {
var qiniu = window.qiniu; var qiniu = window.qiniu;
$('#articleUpload').fileupload({ $('#articleUpload').fileupload({
multipart: true, multipart: true,
url: "http://upload.qiniu.com/", url: "http://upload.qiniu.com/",
formData: function (form) { formData: function (form) {
var data = form.serializeArray(); var data = form.serializeArray();
data.push({name: 'token', value: qiniu.qiniuUploadToken}); data.push({name: 'token', value: qiniu.qiniuUploadToken});
return data; return data;
}, },
done: function (e, data) { done: function (e, data) {
var qiniuKey = data.result.key; var qiniuKey = data.result.key;
if (!qiniuKey) { if (!qiniuKey) {
alert("Upload error"); alert("Upload error");
return; return;
} }
var t = new Date().getTime(); var t = new Date().getTime();
$('#articleUpload').after('<div><a target="_blank" href="http://' + qiniu.qiniuDomain + qiniuKey + '?' + t $('#articleUpload').after('<div id="uploadContent"><a target="_blank" href="http://' + qiniu.qiniuDomain + qiniuKey + '?' + t
+ '">[' + data.files[0].name + ']</a> http://' + '">[' + data.files[0].name + ']</a> http://'
+ qiniu.qiniuDomain + qiniuKey + '?' + t + '</div>'); + qiniu.qiniuDomain + qiniuKey + '?' + t + '</div>');
}, },
fail: function (e, data) { fail: function (e, data) {
alert("Upload error: " + data.errorThrown); alert("Upload error: " + data.errorThrown);
...@@ -1351,7 +1382,7 @@ admin.article = { ...@@ -1351,7 +1382,7 @@ admin.article = {
alert(currentFile.error); alert(currentFile.error);
} }
}); });
// editor // editor
admin.editors.articleEditor = new Editor({ admin.editors.articleEditor = new Editor({
id: "articleContent", id: "articleContent",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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