var objAjax=new JAjax();

function showArticle(){
	var nowPage=1;
	var pageSize=13;
	var pageCount=0;
	var userLst=new Array();
	var userJoin="";
}

showArticle.prototype.selDate=function(thisObj){//选择时间,查看信息
	var d=openSelectDate("../../");
	if(d!="" & d!=null&typeof d!="undefined"){  
		if(thisObj.type=="button"){                  
			thisObj.previousSibling.value=d;
			this.nowPage=1;
			this.create();
		}
	}
}  

showArticle.prototype.loadPage=function(){//系统加载时执行该程序
	var tools=new toolsClass();	
	tools.add("","生成Excel","editorDate.runExcel()","生成Excel");
	tools.create(toolsDiv);	
	editorDate.userLst=new Array();
	var forDate=urlPar("nowTime");
	var signUser=urlPar("signUser");
	if(forDate==null||forDate==""){
		var dt=new Date();		
		var nowDateSystem=dt.toLocaleString();
		var index=nowDateSystem.indexOf("月");
		var indexD=nowDateSystem.indexOf("日");
		$("selectTime").value=nowDateSystem.substring(0,4)+"-"+(nowDateSystem.substring(5,index)-1)+"-"+nowDateSystem.substring(index+1,indexD);         
	}else{
		$("selectTime").value=forDate;
	}
	if(signUser!=null&&signUser!=""){
		if(signUser.indexOf(c1)>-1){
			signUser=signUser.split(c1);
			for(var i=0;i<signUser.length;i++){
				editorDate.userLst.push(signUser[i]);	
			}
		}else{
			editorDate.userLst.push(signUser);	
		}
	}
	writeFettleLeft("提示:用鼠标选择行,然后进行相应的操作"); //状态栏提示
	this.nowPage=1;
	this.pageSize=13;//每页的大小
	this.create(); 
	loadBodyclick();
}

showArticle.prototype.runExcel=function(){//生成Excel
	if(this.selArray){
		if($("selectTime").value!=""&&$("selectTime").value!=null){
			var isShow=1;//不显示
			if($("R29-1").checked){
				isShow=0;	
			}
			var objResponse=new JHttpResponse();
			objResponse.write("selTime",$("selectTime").value);
			objResponse.write("userJoin",this.userJoin)
			objResponse.write("isShow",isShow);	
			var out=objAjax.getText("post","showArticle.aspx?type=runExcel",objResponse,null);
			if(out.indexOf(".xls")>-1){
				$("runExcel").href=out;
				$("runExcel").click();
			}else{
				alert(out)
			}
		}else{
			alert("非法进入");	
		}
	}else{
		alert("当前无任务数据\r\n请点击选择进行查找");	
	}
}
showArticle.prototype.create=function(){//读取数据进行绑定
	var cTable=$("bodyDiv");//存放信息
	var divPages=$("divPages");//存放分页信息
	var selectTime=$("selectTime");//获取当前选择的时间
	if(selectTime.value==""&&selectTime.value==null){
		return;	
	}
	if(this.userLst){
		if(this.userLst.length>0){
			this.userJoin=this.userLst.join(c1);	
		}
	}
	var objResponse=new JHttpResponse();
	objResponse.write("nowPage",this.nowPage);	
    objResponse.write("pageSize",this.pageSize);
	objResponse.write("selTime",selectTime.value);
	objResponse.write("userJoin",this.userJoin);
	var out=objAjax.getText("post","showArticle.aspx?type=readDate",objResponse,null);
	if(out.indexOf(c3)>-1){
		out=out.split(c3);
		this.selArray=new Array();
		this.pageCount=out[1];//总页数
		this.saveDateArray=out[0].split(c2);
		if(cTable.childNodes.length>0){
			cTable.firstChild.removeNode(true);
		}
		divPages.innerHTML="";		
		var t=new createOurTitle();
		t.add("序号","text-align:center;","40");
		t.add("文章标题","text-align:left;padding-left:5px;","360");
		t.add("发布人","text-align:center","100");
		t.add("发布时间","text-align:center","130");
		t.table=cTable;
		t.create();
		var tr=null;
		for(var i=0;i<this.saveDateArray.length;i++){
				tr=cTable.insertRow();
				var tSplit=this.saveDateArray[i].split(c1);
				tr.setAttribute("id",tSplit[0]);
				var createTD=tr.insertCell();
				//mid,tabname,ContentPage,title,saveUser,createDate,tabid,tabAsName
				createTD.style.cssText="text-align:center;height:23px;width:40px;";
				createTD.appendChild(document.createTextNode(i+1+(parseInt(this.nowPage)-1)*parseInt(this.pageSize)));
				
				createTD=tr.insertCell();
				createTD.style.cssText="text-align:left;padding-left:2px;height:23px;width:360px;";
				var cElement=document.createElement("a");
				var href="../../"+tSplit[2]+"?menuid="+tSplit[0]+"&tab="+tSplit[1]+"&tabid="+tSplit[6];
				cElement.setAttribute("href",href);
				cElement.setAttribute("title",tSplit[3]);
				cElement.setAttribute("target","_blank");
				var txt="["+tSplit[7]+"]"+tSplit[3];
				if(!$("R29-1").checked){
					txt=tSplit[3];
				}
				if(txt.length>30){
					txt=txt.substring(0,30);	
				}
				cElement.appendChild(document.createTextNode(txt));
				createTD.appendChild(cElement);
				
				createTD=tr.insertCell();
				createTD.style.cssText="text-align:center;height:23px;width:100px;";
				createTD.appendChild(document.createTextNode(tSplit[4]));
				
				createTD=tr.insertCell();
				createTD.style.cssText="text-align:center;color:#FF0000;;height:23px;width:130px;";				
				createTD.appendChild(document.createTextNode(tSplit[5]));
				tr.onmouseover=function(){
				   for(var i=0;i<this.childNodes.length;i++){
						this.childNodes[i].className="listTitleOption_1Other";	
				   }
				}
				tr.onmouseout=function(){
					for(var i=0;i<this.childNodes.length;i++){
						this.childNodes[i].className="listBodyOptionOther";	
					}
				}			
		}
		//分页写入开始
		var pages=parseInt(this.pageCount/this.pageSize);
		if(this.pageCount%this.pageSize>0){
			pages=pages+1;	
		}
		divPages.appendChild(document.createTextNode("一共有"+this.pageCount+"条,分"+pages+"页,第"+this.nowPage+"页"));		
		var cPage=document.createElement("span");
		cPage.setAttribute("title","首  页");
		cPage.style.cssText="padding-left:10px;cursor:hand;";
		cPage.innerHTML="首  页";	
		if(pages>1&&this.nowPage>1){
		   cPage.onclick=function(){
			   editorDate.nowPage=1;
			   editorDate.create();
		   }
		}else{
			cPage.style.cssText="padding-left:10px;color:#C0C0C0;";
		}
		divPages.appendChild(cPage);
		
		cPage=document.createElement("span");
		cPage.setAttribute("title","下一页");
		cPage.style.cssText="padding-left:10px;cursor:hand;";
		cPage.innerHTML="下一页";
		if(pages>1&&this.nowPage<pages){
		   cPage.onclick=function(){
			   editorDate.nowPage=parseInt(editorDate.nowPage)+1;
			   editorDate.create();
		   }
		}else{
			cPage.style.cssText="padding-left:10px;color:#C0C0C0;";
		}
		divPages.appendChild(cPage);
		
		cPage=document.createElement("span");
		cPage.setAttribute("title","上一页");
		cPage.style.cssText="padding-left:10px;cursor:hand;";
		cPage.innerHTML="上一页";
		if(pages>1&&this.nowPage>1){
		   cPage.onclick=function(){
			   editorDate.nowPage=parseInt(editorDate.nowPage)-1;
			   editorDate.create();
		   }
		}else{
			cPage.style.cssText="padding-left:10px;color:#C0C0C0;";
		}
		divPages.appendChild(cPage)
		
		cPage=document.createElement("span");
		cPage.setAttribute("title","尾  页");
		cPage.style.cssText="padding-left:10px;cursor:hand;";
		cPage.innerHTML="尾  页";
		if(pages>1&&this.nowPage<pages){
		   cPage.onclick=function(){
			   editorDate.nowPage=pages;
			   editorDate.create();
		   }
		}else{
			cPage.style.cssText="padding-left:10px;color:#C0C0C0;";
		}
		divPages.appendChild(cPage)
		var runTime=document.createElement("span");
		runTime.style.cssText="color:#FF0000;padding-left:25px;"
		runTime.innerHTML="页面运行总时间"+out[2]+"毫秒";
		divPages.appendChild(runTime);
	}else{
		if(cTable.childNodes.length>0){
			cTable.firstChild.removeNode(true);
		}
		divPages.innerHTML="<p style='color:#FF0000;'>从"+$("selectTime").value+"到现在没有相应的信息</p>";		
	}
}