You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
289 lines
11 KiB
JavaScript
289 lines
11 KiB
JavaScript
var commonGridObj_message;
|
|
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function createGrid(){
|
|
//header
|
|
var headerArgs_message = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall('ck_all')\" />","消息名称","消息类型","是否阅读","阅读次数","消息接收人","消息内容","消息时间");
|
|
//width
|
|
var widthArgs_message = new Array("40","150","160","0","0","0","0","130");
|
|
//column align
|
|
var colAlignArgs_message = new Array("center","center","center","center","center","left","center","center");
|
|
//column sort
|
|
var colSortArgs_message = new Array("na","str","str","str","str","str","str","str");
|
|
//column type
|
|
var colTypeArgs_message = new Array("ch","ro","ro","ro","ro","ro","ro","ro");
|
|
|
|
|
|
commonGridObj_message = new TGridCommon("mygrid_container_message","form1",headerArgs_message,widthArgs_message,colAlignArgs_message,colSortArgs_message,colTypeArgs_message);
|
|
|
|
var searchJson = "";
|
|
//begin
|
|
searchJson +="{";
|
|
searchJson += "[";
|
|
|
|
var _checkState = $("sel_read").value;
|
|
var _btime = "";
|
|
var _etime = "";
|
|
var _content = "";
|
|
var _type = "";
|
|
|
|
searchJson += "\"btime\":\""+_btime+"\",";
|
|
searchJson += "\"etime\":\""+_etime+"\",";
|
|
searchJson += "\"content\":\""+_content+"\",";
|
|
searchJson += "\"type\":\""+_type+"\",";
|
|
searchJson += "\"read\":\""+_checkState+"\"";
|
|
searchJson += "]";
|
|
searchJson +="}";
|
|
|
|
commonGridObj_message.setResponseUrl("MessageService.aspx");
|
|
commonGridObj_message.setRequest("MessageService.aspx?handle=messagelist&show_page=15&cur_page=1&search="+escape(searchJson)+"&uid="+commonGridObj_message.newGuid());
|
|
commonGridObj_message.setSourceType("json");
|
|
commonGridObj_message.setSkin("xp");
|
|
commonGridObj_message.setImageUrl("../images/");
|
|
commonGridObj_message.initGrid();
|
|
commonGridObj_message.bind();
|
|
|
|
commonGridObj_message.setSearch(searchJson);
|
|
commonGridObj_message.initPageByHandle("messagelist");
|
|
|
|
commonGridObj_message.getGridObj().attachEvent("onSelectStateChanged", function(id){
|
|
$("h_messageid").value = id;
|
|
var messageObj = null;
|
|
var url = "MessageService.aspx?id="+id+"&handle=getmessageinfo&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var messageVal = loader.xmlDoc.responseText;
|
|
|
|
if(messageVal.trim() != ""){
|
|
messageObj = eval('(' + messageVal + ')');
|
|
|
|
$("dvTitleContent").innerHTML = messageObj.message[0].desc;
|
|
$("dvTime").innerHTML = messageObj.message[0].time;
|
|
$("dvMessageContent").innerHTML = messageObj.message[0].content+createRedirectUrl(messageObj.message[0].url);
|
|
|
|
}
|
|
|
|
//标记为已读
|
|
var readUrl = "MessageService.aspx?id="+id+"&handle=setread&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(readUrl);
|
|
var stateVal = loader.xmlDoc.responseText;
|
|
|
|
if(parseInt(stateVal) > 0){
|
|
|
|
}
|
|
});
|
|
|
|
commonGridObj_message.clickEvent = function(){
|
|
commonGridObj_message.getGridObj().attachEvent("onSelectStateChanged", function(id){
|
|
$("h_messageid").value = id;
|
|
var messageObj = null;
|
|
var url = "MessageService.aspx?id="+id+"&handle=getmessageinfo&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var messageVal = loader.xmlDoc.responseText;
|
|
|
|
if(messageVal.trim() != ""){
|
|
messageObj = eval('(' + messageVal + ')');
|
|
|
|
$("dvTitleContent").innerHTML = messageObj.message[0].desc;
|
|
$("dvTime").innerHTML = messageObj.message[0].time;
|
|
$("dvMessageContent").innerHTML = messageObj.message[0].content+createRedirectUrl(messageObj.message[0].url);
|
|
}
|
|
|
|
//标记为已读
|
|
var readUrl = "MessageService.aspx?id="+id+"&handle=setread&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(readUrl);
|
|
var stateVal = loader.xmlDoc.responseText;
|
|
|
|
if(parseInt(stateVal) > 0){
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
|
|
|
|
function markMessageRead(){
|
|
|
|
}
|
|
|
|
|
|
function checkall(id){
|
|
var checkAllState = $(id).checked;
|
|
|
|
if(checkAllState == 1){
|
|
for(var i = 0;i<commonGridObj_message.getGridObj().getRowsNum();i++){
|
|
commonGridObj_message.getGridObj().cellByIndex(i,0).setValue(1);
|
|
}
|
|
}else{
|
|
for(var i = 0;i<commonGridObj_message.getGridObj().getRowsNum();i++){
|
|
commonGridObj_message.getGridObj().cellByIndex(i,0).setValue(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function onChangeType(id){
|
|
// var selectObj = $(id);
|
|
|
|
// var selVal = selectObj.options[selectObj.selectedIndex].value;
|
|
// alert(selVal);
|
|
createGrid();
|
|
}
|
|
|
|
function deleteMsg(){
|
|
for(var i = 0;i<commonGridObj_message.getGridObj().getRowsNum();i++){
|
|
var checkState = commonGridObj_message.getGridObj().cellByIndex(i,0).getValue();
|
|
var rowId = commonGridObj_message.getGridObj().getRowId(i);
|
|
if(checkState == 1){
|
|
var readUrl = "MessageService.aspx?id="+rowId+"&handle=deletemessage&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(readUrl);
|
|
var stateVal = loader.xmlDoc.responseText;
|
|
}
|
|
}
|
|
|
|
createGrid();
|
|
}
|
|
|
|
function refreshList(){
|
|
createGrid();
|
|
}
|
|
|
|
function createRedirectUrl(url){
|
|
var tempUrl = url;
|
|
var result = "";
|
|
|
|
if(url.trim() != ""){
|
|
result += "<br/><br/>点击 <a href=\"javascript:void(0)\" onclick=\"redirect('"+tempUrl+"')\">查看</a>";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function redirect(url){
|
|
//alert(parent.document.getElementById("iFrameH").contentWindow.location);
|
|
|
|
var postType = parseInt($("h_posttype").value);
|
|
if(postType == 2){
|
|
var oldUrl = parent.document.getElementById("iFrameH").contentWindow.location.href;
|
|
var doubleUrl = 0;
|
|
if(oldUrl.indexOf("//") >= 0){
|
|
doubleUrl = oldUrl.indexOf("//")+2;
|
|
}
|
|
var tempUrl = oldUrl.substring(doubleUrl,oldUrl.substring(doubleUrl,oldUrl.length).indexOf("/")+doubleUrl);
|
|
var newUrl = oldUrl.substring(0,doubleUrl)+tempUrl+"/"+url;
|
|
parent.document.getElementById("iFrameH").contentWindow.location = newUrl;
|
|
}else if(postType == 1){
|
|
var oldUrl = window.parent.opener.document.getElementById("iFrameH").contentWindow.location.href
|
|
var doubleUrl = 0;
|
|
if(oldUrl.indexOf("//") >= 0){
|
|
doubleUrl = oldUrl.indexOf("//")+2;
|
|
}
|
|
var tempUrl = oldUrl.substring(doubleUrl,oldUrl.substring(doubleUrl,oldUrl.length).indexOf("/")+doubleUrl);
|
|
var newUrl = oldUrl.substring(0,doubleUrl)+tempUrl+"/"+url;
|
|
|
|
window.parent.opener.document.getElementById("iFrameH").contentWindow.location = newUrl;
|
|
window.close();
|
|
}
|
|
}
|
|
|
|
//上一条
|
|
function upNext(){
|
|
// var messageID = $("h_messageid").value.trim();
|
|
// var messageCount = 0;
|
|
// var checkType = $("sel_read").value;
|
|
// alert(messageID);
|
|
// if(messageID != ""){
|
|
// var readUrl = "MessageService.aspx?id="+messageID+"&checktype="+checkType+"&handle=getmessagecount&uid="+commonGridObj_message.newGuid();
|
|
// var loader = dhtmlxAjax.getSync(readUrl);
|
|
// var stateVal = loader.xmlDoc.responseText;
|
|
//
|
|
// messageCount = parseInt(stateVal);
|
|
//
|
|
// if(messageCount > 1){
|
|
// var includeNum = 1;
|
|
// var notIncludeNum = messageCount-1;
|
|
//
|
|
// var nextUrl = "MessageService.aspx?id="+messageID+"&checktype="+checkType+"&include="+includeNum+"&uninclude="+notIncludeNum+"&handle=messagepagelist&uid="+commonGridObj_message.newGuid();
|
|
// var loader = dhtmlxAjax.getSync(nextUrl);
|
|
// var nextVal = loader.xmlDoc.responseText;
|
|
// alert(includeNum);alert(notIncludeNum);
|
|
// if(nextVal.trim() != ""){
|
|
// messageObj = eval('(' + nextVal + ')');
|
|
//
|
|
// $("h_messageid").value = messageObj.message[0].id;
|
|
// $("dvTitleContent").innerHTML = messageObj.message[0].desc;
|
|
// $("dvTime").innerHTML = messageObj.message[0].time;
|
|
// $("dvMessageContent").innerHTML = messageObj.message[0].content+createRedirectUrl(messageObj.message[0].url);
|
|
//
|
|
// }
|
|
// }else if(messageCount == 1){
|
|
//
|
|
// var includeNum = 1;
|
|
// var notIncludeNum = 1;
|
|
//
|
|
// var nextUrl = "MessageService.aspx?id="+messageID+"&checktype="+checkType+"&include="+includeNum+"&uninclude="+notIncludeNum+"&handle=messagepagelist&uid="+commonGridObj_message.newGuid();
|
|
// var loader = dhtmlxAjax.getSync(nextUrl);
|
|
// var nextVal = loader.xmlDoc.responseText;
|
|
//
|
|
// if(nextVal.trim() != ""){
|
|
// messageObj = eval('(' + nextVal + ')');
|
|
//
|
|
// $("h_messageid").value = messageObj.message[0].id;
|
|
// $("dvTitleContent").innerHTML = messageObj.message[0].desc;
|
|
// $("dvTime").innerHTML = messageObj.message[0].time;
|
|
// $("dvMessageContent").innerHTML = messageObj.message[0].content+createRedirectUrl(messageObj.message[0].url);
|
|
//
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
|
|
//下一条
|
|
function downNext(){
|
|
// var messageID = $("h_messageid").value.trim();
|
|
// var messageCount = 0;
|
|
// if(messageID != ""){
|
|
// var readUrl = "MessageService.aspx?id="+messageID+"&handle=getmessagecount&uid="+commonGridObj_message.newGuid();
|
|
// var loader = dhtmlxAjax.getSync(readUrl);
|
|
// var stateVal = loader.xmlDoc.responseText;
|
|
//
|
|
// messageCount = parseInt(stateVal);
|
|
//
|
|
// if(messageCount > 1){
|
|
// var includeNum = 1;
|
|
// var notIncludeNum = messageCount-1;
|
|
//
|
|
// var readUrl = "MessageService.aspx?id="+messageID+"&include="+includeNum+"&uninclude="+notIncludeNum+"&handle=messagepagelist&uid="+commonGridObj_message.newGuid();
|
|
// var loader = dhtmlxAjax.getSync(readUrl);
|
|
// var nextVal = loader.xmlDoc.responseText;
|
|
//
|
|
//// alert(nextVal);
|
|
// }
|
|
// }
|
|
}
|
|
|
|
//个人信息设置
|
|
function msgSetting(){
|
|
var openSet = "height=170, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-170)/2 + ",Left= "+(screen.width-400)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "../message/messagesetting.aspx";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
|
|
|
|
function markRead(){
|
|
for(var i = 0;i<commonGridObj_message.getGridObj().getRowsNum();i++){
|
|
var checkState = commonGridObj_message.getGridObj().cellByIndex(i,0).getValue();
|
|
var rowId = commonGridObj_message.getGridObj().getRowId(i);
|
|
if(checkState == 1){
|
|
var readUrl = "MessageService.aspx?id="+rowId+"&handle=markread&uid="+commonGridObj_message.newGuid();
|
|
var loader = dhtmlxAjax.getSync(readUrl);
|
|
var stateVal = loader.xmlDoc.responseText;
|
|
}
|
|
}
|
|
|
|
createGrid();
|
|
} |