// JScript 文件


var tools=new toolsClass();
var tree=new  treeMode1Class();
var m=new myWebClass();
var objAjax=new JAjax();
var menuid=0;
var asTab="";
var rm=new rManageClass();
 
function loadPage(){
	tools.add("","删除","rm.del()","删除此评论")
	tools.add("","通过审核","rm.Examine()","通过此评论的审核状态")
	tools.add("","全选","rm.allSelect()","全部选择")
	tools.add("","已审","rm.loadData(1,'1')","已审的评论")
	tools.add("","未审","rm.loadData(1,'0')","未审的评论")

	tools.create(toolsDiv)
   
    
    tree.rootId=menuid;
	tree.rootObj=document.getElementById("leftDiv");
	tree.rootName="根栏目";
	addOption(menuid);
	
	var t=new outTitle();
	t.add("所属文章","","150");
	t.add("内容概要","","250");
	t.add("发布日期","","100");
	t.add("发布人","","80");
	t.add("是否审核","","80");
	t.obj=document.getElementById("rTitle");
	t.create();	
	
	setWH();
		loadBodyclick();
}


function setWH(){ 
	var w=Element.getWidth(winDiv)
	var h=Element.getHeight(winDiv)

	var h1=Element.getHeight(document.getElementById("toolsDiv"))
	var h2=Element.getHeight(document.getElementById("rTitle"))
	var h3=Element.getHeight(document.getElementById("rPage"))

	var w1=Element.getWidth(document.getElementById("leftDiv"))

	var r=document.getElementById("rightDiv");
	var l=document.getElementById("leftDiv");
	var b=document.getElementById("rBody");
	
	r.style.height=(h-h1)+"px";
	l.style.height=(h-h1)+"px";
	r.style.width=(w-w1)+"px";
	b.style.width=(w-w1)+"px";
	b.style.height=(h-h1-h2-h3)+"px";
	
	
	
}

 function addOption(menuid){
			var objResponse=new JHttpResponse();
			objResponse.write("menuid",menuid);
			objResponse.write("order"," mid ");
			var out=objAjax.getText("post","mywebServer.aspx?type=read",objResponse,null);
			out= comminute(out,c1,c2)
			tree.add(out,"openDownmenu(this)");
}

 function openDownmenu(thisObj){
		 
		  addOption(thisObj.menuid)
		//  menuPath.innerText=m.readPath(thisObj.idList);
		//selectPath=menuPath.innerText;
		  rm.menuid=thisObj.menuid;
		  rm.asTab=thisObj.asTab;
		  rm.loadData();
}



function rManageClass(){
	
	this.menuid=null;
	this.type="";
	var tempObj;
	var selectObj=null;
	var sList="";
	var p=1;
	var isE="0";
	
	this.loadData=function(page,eType){
		if (page==null){
			page=1;
		}
		p=page;
		if (eType==null){
			eType=isE;
		}else{
			isE=eType;	
		}
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("loadType",this.type);
		objResponse.write("asTab",this.asTab);
		objResponse.write("page",page);
		objResponse.write("eType",eType);
		
		var out=objAjax.getText("post","reviewManage.aspx?type=loadData",objResponse,null);
		
		if (out=="noPop"){
			$("rBody").innerText="你对此栏目没有管理权限";
			return;
		}
		if (out==""){
			$("rBody").innerText="无数据";
			$("rPage").innerHTML="";
			return;
		}
		  out= comminute(out,c1,c2);  //分割数据
		  var page=out[0];
		  this.mPage=page[2];
//  zydn_review.ID,"+asTab+".title AS fileTitle,zydn_review.IsExamine,zydn_review.ATab,zydn_review.AID,zydn_review.good,zydn_review.bad,zydn_review.Comment,zydn_review.SaveDate
//       0                1                              2                    3               4                5             6             7		              8
// zydn_review.SaveUser
//   9
		  //显示内容
		 //alert(out[1])
		  if (out[1]==""){
		     $("rBody").innerText="无数据";
			 $("rPage").innerHTML="";
		  }
		  var wData=new tabList();
		  wData.obj=document.getElementById("rBody");
		  wData.rowid="rRow_";                          //行的ID
		  wData.rowClass="tabListBodyRow";                 //行的样式
		  wData.mode=1;                                    //数据显示的格式
		  wData.isCheckbox=true;                          //加上复选框
		  wData.checkBoxID="rBox";                      //复选框名
		  wData.onmouseroverRun="rm.rowonmouseover";           //鼠标移上
		  wData.onmouseroutRun="rm.rowonmouseout";             //鼠标移走
		  wData.onclickRun="rm.rowonclick";                    //鼠标单击
		  wData.ondblclickRun="";                   //鼠标双击
		  wData.add(raadArray(out,1),"rRowCss","150");    //添加一列数据 文章名
		  wData.add(raadArray(out,7),"rRowCss","250");    //添加一列数据 内容概要
		  wData.add(raadArray(out,8),"rRowCss","100");     //添加一列数据 发布日期
		  wData.add(raadArray(out,9),"rRowCss","80");     //添加一列数据  发布人
		  wData.add(raadArray(out,2),"rRowCss","80");         //添加一列数据  是否审核
		  wData.addid(raadArray(out,0));                         //添加行标识 TID
		  wData.create();		  
		  //内容显示完成
		  
		  //显示分页
		  var wPage=new outPage();
		  wPage.obj=document.getElementById("rPage");
		  wPage.pageArray=page;
		  wPage.run="rm.loadData";
		  wPage.create();
		  
		   var cObj=document.getElementsByName("rRow__4"); //字符处理第五列, 是否审核
		  for (var i=0;i<cObj.length;i++){
			  if (cObj[i].innerText=="0"){
				  cObj[i].innerText="否";
				  cObj[i].title="未审核";
			  }else{
				  cObj[i].innerHTML="<B>是</B>";
				  cObj[i].title="已审核";
			  }
		  }
		  
	}
	
	this.rowonmouseover=function(obj){
		tempObj=obj;
		obj.className="tabListBodyRow_1";
	}
	
	
	this.rowonmouseout=function(obj){
		//	alert(obj.tid)
		tempObj=null;
		if (obj !=selectObj){
			obj.className="tabListBodyRow";
		}
		
	}
	
	this.rowonclick=function(obj){
		try{
			form1.rBox[tempObj.i].click();
			if (selectObj!=null & selectObj!=obj){
				selectObj.className="tabListBodyRow";
			}
		}catch(e) {}
		selectObj=obj;
		
	}
	
	this.readSelect=function(){
		var objs=document.getElementsByName("rBox");
		sList="";
		for (var i=0;i<objs.length;i++){
			if (objs[i].checked){
				sList=sList+objs[i].value+",";
			}
		}
		if (sList!="") {
			sList=sList.substring(0,sList.length-1);
		}
	}
	
	this.del=function(){
		this.readSelect();
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("idList",sList);
		//alert(sList);
		var out=objAjax.getText("post","reviewManage.aspx?type=del",objResponse,null);
		if (out=="noPop"){
			alert("您不具有此操作权限");
			return;
		}
		if (out=="1"){
			this.loadData(p);
		}else{
			alert(erStr(out));
		}
	}
	
	this.allSelect=function(){
		var objs=document.getElementsByName("rBox");
		for (var i=0;i<objs.length;i++){
			objs[i].checked=true;
		}
		
		
	}
	
	this.Examine=function(){
		this.readSelect();
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("idList",sList);
		//alert(sList);
		var out=objAjax.getText("post","reviewManage.aspx?type=Examine",objResponse,null);
		if (out=="noPop"){
			alert("您不具有此操作权限");
			return;
		}
		if (out=="1"){
			this.loadData(p);
		}else{
			alert(erStr(out));
		}
	}
	
	
}





