// JScript 文件

var tools=new toolsClass();
var tree=new  treeMode1Class();
var m=new myWebClass();
var objAjax=new JAjax();
var menuid=0;
var asTab="";
var Ec=new ExamineClass();
 
function loadPage(){
	loadBodyclick();
	writeFettleLeft(" 提示:系统可以设置四级内容审核制度");
	
	
	tools.add("","删除","Ec.del()","删除此评论")
	tools.add("","通过审核","Ec.Examine()","通过此评论的审核状态")
	tools.add("","退回重审","Ec.noExamine()","将此审核状态改为未审")

	tools.create(toolsDiv)
   
    
    tree.rootId=menuid;
	tree.rootObj=document.getElementById("leftDiv");
	tree.rootName="根栏目";
	addOption(menuid);
	
	var t=new outTitle();
	t.add("标题","","250");
	t.add("发布日期","","80");
	t.add("发布人","","80");
	t.add("审核状态","","80");
	t.obj=document.getElementById("rTitle");
	t.create();	
	
	setWH();
}


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;
		  Ec.menuid=thisObj.menuid;
		  Ec.asTab=thisObj.asTab;
		  Ec.loadData();
}



function ExamineClass(){
	
	this.menuid=null;
	this.type="";
	var tempObj;
	var selectObj=null;
	var sList="";
	var p=1;
	
	this.loadData=function(page){
		if (page==null){
			page=1;
		}
		p=page;
		
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("asTab",this.asTab);
		objResponse.write("page",page);
		
		var out=objAjax.getText("post","Examine.aspx?type=readList",objResponse,null);
		//alert(out)
		if (out=="noPop"){
			$("rBody").innerText="你对此栏目没有管理权限";
			writeFettleLeft(" 请选择您有管理权限的栏目的栏目");
			return;
		}
		
		//return;
		out= comminute(out,c1,c2);  //分割数据
		if (out[1]==""){
			$("rBody").innerText="无数据";
			writeFettleLeft(" 请选择有数据的栏目");
			$("rPage").innerHTML="";
			return;
			
		}
		  var page=out[0];
		  this.mPage=page[2];
//tab_News.ID AS id, tab_News.title AS title, tab_News.SaveUser AS saveUser, 
//     0                  1                               2 
//      tab_News.Examine AS Examine, tab_News.SaveDate AS saveDate
//         3                                     4
//显示内容
		  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="Ec.rowonmouseover";           //鼠标移上
		  wData.onmouseroutRun="Ec.rowonmouseout";             //鼠标移走
		  wData.onclickRun="Ec.rowonclick";                    //鼠标单击
		  wData.ondblclickRun="Ec.eDisplay";                   //鼠标双击
		  wData.add(raadArray(out,1),"rRowCss","250");    //添加一列数据 文章名
		  wData.add(raadArray(out,4),"rRowCss","80");    //添加一列数据 内容概要
		  wData.add(raadArray(out,2),"rRowCss","80");     //添加一列数据 发布日期
		  wData.add(raadArray(out,3),"rRowCss","80");     //添加一列数据  发布人
		  wData.addid(raadArray(out,0));                         //添加行标识 TID
		  wData.create();		  
		  //内容显示完成
		  
		  //显示分页
		  var wPage=new outPage();
		  wPage.obj=document.getElementById("rPage");
		  wPage.pageArray=page;
		  wPage.run="Ec.loadData";
		  wPage.create();
		  
		  var eStr=out[out.length-1][0];
		  switch (eStr){
			case "4":
				writeFettleLeft(" 您有初审权, 经审核后, 此栏目下的文件将处于初审状态");
				break;
			case "3":
				writeFettleLeft(" 您有复审权, 经审核后, 此栏目下的文件将处于复审状态");
				break;
			case "2":
				writeFettleLeft(" 您有三审权, 经审核后, 此栏目下的文件将处于三审状态");
				break;
			case "1":
				writeFettleLeft(" 您有终审权, 经审核后, 此栏目下的文件将处于发表状态");
				break;
			
		  }
		  //alert(eStr)
		  
		   var cObj=document.getElementsByName("rRow__3"); //字符处理第五列, 是否审核
		  for (var i=0;i<cObj.length;i++){
			  switch (cObj[i].innerText){
				  case "0":
					  cObj[i].innerText="未审核";
					  cObj[i].title="未审核";
					  break;
				  case "4":
					  cObj[i].innerText="通过初审";
					  cObj[i].title="通过初审";
					  break;
				  case "2":
					  cObj[i].innerText="通过三审";
					  cObj[i].title="通过三审";
					  break;
				  case "3":
					  cObj[i].innerText="通过复审";
					  cObj[i].title="通过复审";
					  break;
			  }
		  }
		  
	}
	
	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{
			if (form1.rBox[tempObj.i].checked==true){
				form1.rBox[tempObj.i].checked=false;
			}else{
				form1.rBox[tempObj.i].checked=true;
			}
			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);
		objResponse.write("asTab",this.asTab);
		//alert(sList);
		if (sList==null | sList==""){
			alert("请选择你可以审核的信息");
			return;	
		}

		var out=objAjax.getText("post","Examine.aspx?type=del",objResponse,null);
		if (out=="noPop"){
			alert("您不具有此操作权限");
			return;
		}
		if (out=="1"){
			this.loadData(p);
		}else{
			alert(erStr(out));
		}
	}
	
	this.Examine=function(){
		this.readSelect();
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("idList",sList);
		objResponse.write("asTab",this.asTab);
		//alert(sList);
		if (sList==null | sList==""){
			alert("请选择你可以审核的信息");
			return;	
		}
		var out=objAjax.getText("post","Examine.aspx?type=Examine",objResponse,null);
		if (out=="noPop"){
			alert("您不具有此操作权限");
			return;
		}
		if (out=="1"){
			this.loadData(p);
		}else{
			alert(erStr(out));
		}
	}
	
	
	this.noExamine=function(){
		this.readSelect();
		var objResponse=new JHttpResponse();
		objResponse.write("menuid",this.menuid);
		objResponse.write("idList",sList);
		objResponse.write("asTab",this.asTab);
		//alert(sList);
 	if (sList==null | sList==""){
			alert("请选择你可以审核的信息");
			return;	
		}

		var out=objAjax.getText("post","Examine.aspx?type=noExamine",objResponse,null);
		if (out=="noPop"){
			alert("您不具有此操作权限");
			return;
		}
		if (out=="1"){
			this.loadData(p);
		}else{
			alert(erStr(out));
		}
	}
	
	this.eDisplay=function(obj){
		//alert(obj.i);
		var objnum=parent.win.objNum;
		var objs=document.getElementsByName("rBox");
		par="wNum="+objnum+"&menuid="+this.menuid+"&tab="+this.asTab+"&tabid="+objs[obj.i].value;
		parent.win.pCreate("p-eDisplay",par);
		
	}
	
	
}





