function DelBase(type, typeName, id) {
if (typeof (id) != "undefined") {
$.dialog.confirm("操作不可恢复,确定删除本条" + typeName + "吗?", function () {
$.post("/Message.Del" + type + ".data", { ID: id }, function () {
$.alert("删除" + typeName + "成功!", function () { location.reload(); });
})
}, true);
} else {
var ids = "";
$("input[type='checkbox'][name='Check" + type + "']:checked").each(function () {
(ids == "") ? ids = $(this).val() : (ids += "," + $(this).val());
});
if (ids == "") { $.alert("请先选择要删除" + typeName + "!"); return; };
$.dialog.confirm("操作不可恢复,确定删除所选" + typeName + "吗?", function () {
$.post("/Message.Del" + type + ".data", { ID: ids }, function () { $.alert("删除" + typeName + "成功!", function () { location.reload(); }); });
}, true);
}
}
function DelNoties(id) {
DelBase("Noties", "通知", id);
}
function DelMessage(id) {
DelBase("Message", "私信", id);
}
function DelGuestBook(id) {
DelBase("GuestBook", "留言", id);
}
function DelComment(id) {
DelBase("Comment", "评论", id);
}
function AddSpaceGuestBook(userNumb, text) {
if (text == "") {
$.dialog.alert("留言内容不能为空!");
return false;
}
if (text.length > 300) {
$.dialog.alert("留言内容长度不能超过300!");
return false;
}
$.post("/Message.AddGuestBook.data", { userNumb: userNumb, Content: text }, function () {
$.dialog.confirm("留言发布成功!", function () { location.reload(); });
});
}
function AddGuestBook(userNumb, userName, oldContent) {
var title = typeof (oldContent) == "undefined" ? "发送留言给“" + userName + "”" : "回复留言给“" + userName + "”";
var content = "";
if (typeof (oldContent) != "undefined")
content = "回复:“" + oldContent + "”\r\n";
$.dialog({
title: title,
content: "",
lock: true,
cancel: true,
initialize: function () {
input = this.dom.content.find('textarea')[0];
input.select();
input.focus();
},
ok: function () {
var text = this.dom.content.find('textarea').val();
if (text == "") {
$.dialog.alert("留言内容不能为空!");
return false;
}
if (text.length > 300) {
$.dialog.alert("留言内容长度不能超过300!");
return false;
}
$.post("/Message.AddGuestBook.data", { userNumb: userNumb, Content: text, RelPlay: (typeof (oldContent) != "undefined") ? 1 : 0 }, function () { $.alert(title + "成功", function () { location.reload(); }); });
}
})
}
function RelComment(userNumb, feedID, commentID) {
$.dialog({
title: "回复评论", content: "", lock: true, cancel: true, ok: function () {
$.post("/Message.AddComment.data", { userNumb: userNumb, FeedID: feedID, CommentID: commentID, Content: $("#messageContent").val() }, function () {
$.alert("回复评论成功");
});
}
})
}