⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.jsp

📁 一个实现邮件收发功能的客户端程序
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html; charset=utf-8" session="true" errorPage="frame_user_error.jsp" %>
<%@ include file="validate.jsp" %>
<%@ page import="com.easyjf.web.tools.*" %>
<%@ page import="com.easyjf.util.*" %>
<%@ page import="java.util.*" %>
<jsp:include page="include/processbar.jsp"></jsp:include>
<%
	boolean isMyMail=false;
	int currentPage=CommUtil.null2Int(request.getParameter("page"));
	int pageSize=CommUtil.null2Int(request.getParameter("pageSize"));
	String box=CommUtil.null2String(request.getParameter("box"));
	box=new String(box.getBytes("iso-8859-1"),"utf-8");
	String boxName=EmailManage.getBoxName(box);
	if(boxName==null)boxName=box;
	//String flag=CommUtil.null2String(request.getParameter("flag"));
	if(currentPage<1)currentPage=1;
	if(pageSize<1)pageSize=10;
	List list=null;
	System.out.println(box+currentPage);
	int newNum=0;
	if(box.equals("inbox")) {
//		if("1".equals(flag)) {
//			//接收邮件
//			String path=Config.getMailPath()+"/"+user.getServerDomain()+"/"+user.getUserName()+"/newbox";
//			Thread thread=new Thread(new ReciveMail(user.getUserName(),user.getPassword(),user.getServerHost(),path));
//			thread.start();
//			try{
//				Thread.sleep(2000);
//			}
//			catch(Exception e) {
//			}
//		}
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"newbox");
		if(list!=null)
		{
			for(int i=0;i<list.size();i++)
			{
				Map mail=(Map)list.get(i);
				mail.put("isNew","true");
				newNum++;
			}
		}
		List nList=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"inbox");
		if(list!=null && nList!=null)
			list.addAll(nList);
	}
	else if("newbox".equals(box))
	{
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"newbox");
		if(list!=null)
		{
			for(int i=0;i<list.size();i++)
			{
				Map mail=(Map)list.get(i);
				mail.put("isNew","true");
				newNum++;
			}
		}
	}
	else if("sendbox".equals(box))
	{
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"sendbox");
	}
	else if("draftbox".equals(box))
	{
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"draftbox");
	}
	else if("delbox".equals(box))
	{
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),"delbox");	
	}
	else 
	{
		list=EmailManage.getMailList(user.getUserName(),user.getServerDomain(),box);
	}

	  //int page=0;
	  int pages=0;
	  int rows=0;
	  String showPageHtml=null;
	  IPageList pList=new PageList(new ListQuery(list));
	  if(pList!=null){
		    pList.doList(pageSize,currentPage,"","");
			//form.addResult("list",pList.getResult());
			//form.addResult("pages",new Integer(pList.getPages()));
			//form.addResult("rows",new Integer(pList.getRowCount()));
			//form.addResult("page",new Integer(pList.getCurrentPage()));
			//form.addResult("gotoPageHTML",CommUtil.showPageHtml(pList.getCurrentPage(),pList.getPages()));
			list=pList.getResult();
			pages=pList.getPages();
			rows=pList.getRowCount();
			currentPage=pList.getCurrentPage();
			showPageHtml=CommUtil.showPageHtml(pList.getCurrentPage(),pList.getPages());
		}
	 // form.addResult("list",list);	  
	  //form.addResult("boxList",EmailManage.getMailDir(user.getUserName(),user.getServerDomain()));
	  if(box.equals("sendbox")||box.equals("draftbox")) {
		//form.addResult("isMyMail","true");
		isMyMail=true;
	  }
	 // form.addResult("domain",domain);	 
	  //return module.findPage("list");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>收件箱</title>
<script src="js/public.js" type="text/JavaScript"></script>
<script src="include/CheckDataFunction.js" type="text/JavaScript"></script>
<script src="js/prototype.js" type="text/JavaScript"></script>
<SCRIPT LANGUAGE=javascript>
<!--
var EmailID=0;
function selectRow(id)
{
	ListForm.cid.value=id;
}
function selectAll(value)
{
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length=="undefined")
	{
		obj.checked=value;
	}
	for(var i=0;i<obj.length;i++)
		obj[i].checked=value;
}
function doDel()
{
	var ids="";
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length =="undefined") {
		if(obj.checked)ids=obj.value;
	}
	else {
		for(var i=0;i<obj.length;i++)
			if(obj[i].checked)
				ids+=obj[i].value+",";
	}
	//if(ids=="")ids=ListForm.cid.value+",";
	ListForm.mulitCid.value=ids;
	if(ids=="")
	{
		alert("请选择要删除的内容!");
		return false;
	}
	if(confirm('邮件将不可恢复,是否真的要永久删除此邮件?')) {
		//ListForm.easyJWebCommand.value="del";
		//ListForm.submit();
		location.href="del.jsp?box="+ListForm.box.value+"&mulitCid="+ListForm.mulitCid.value;
	}
}
function doDel2()
{
	var ids="";
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length =="undefined") {
		if(obj.checked)ids=obj.value;
	}
	else {
		for(var i=0;i<obj.length;i++)
			if(obj[i].checked)
				ids+=obj[i].value+",";
	}
	//if(ids=="")ids=ListForm.cid.value+",";
	ListForm.mulitCid.value=ids;
	if(ids=="")
	{
		alert("请选择要删除的内容!");
		return false;
	}
	if(confirm('邮件将不可恢复,是否真的要永久删除此邮件?')) {
		//ListForm.easyJWebCommand.value="del";
		//ListForm.submit();
		var pars="box="+ListForm.box.value+"&mulitCid="+ListForm.mulitCid.value;
		new Ajax.Request('del.jsp', {parameters:pars, onSuccess:handlerFunc, onFailure:errFunc});
	}
}
function doMove()
{
	var ids="";
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length =="undefined") {
		if(obj.checked)ids=obj.value;
	}
	else {
		for(var i=0;i<obj.length;i++)
			if(obj[i].checked)
				ids+=obj[i].value+",";
	}
	//if(ids=="")ids=ListForm.cid.value+",";
	ListForm.mulitCid.value=ids;
	if(ids=="")
	{
		alert("请选择要移动的邮件!");
		return false;
	}
	//ListForm.easyJWebCommand.value="move";
	//ListForm.submit();
	location.href="move.jsp?box="+ListForm.box.value+"&newBox="+ListForm.newBox.value+"&mulitCid="+ListForm.mulitCid.value;
}
function doMove2()
{
	var ids="";
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length =="undefined") {
		if(obj.checked)ids=obj.value;
	}
	else {
		for(var i=0;i<obj.length;i++)
			if(obj[i].checked)
				ids+=obj[i].value+",";
	}
	//if(ids=="")ids=ListForm.cid.value+",";
	ListForm.mulitCid.value=ids;
	if(ids=="")
	{
		alert("请选择要移动的邮件!");
		return false;
	}
	//ListForm.easyJWebCommand.value="move";
	//ListForm.submit();
	//location.href="move.jsp?box="+ListForm.box.value+"&newBox="+ListForm.newBox.value+"&mulitCid="+ListForm.mulitCid.value;
	if(confirm("您确认要移动这些邮件吗?")) {
		var pars="box="+ListForm.box.value+"&newBox="+$("newBox").value+"&mulitCid="+ListForm.mulitCid.value;
		new Ajax.Request('move.jsp', {parameters:pars, onSuccess:handlerFunc, onFailure:errFunc});
	}
}
function doReply()
{
	if(ListForm.cid.value==""){
		alert("请选择要回复的邮件!");
		return ;
	}
	//alert(ListForm.cid.value);
	//ListForm.easyJWebCommand.value="reply";
	//ListForm.submit();
	location.href="reply.jsp?cid="+ListForm.cid.value+"&box="+ListForm.box.value;
}
function doEdit()
{
	if(ListForm.cid.value==""){
		alert("请选择要修改的邮件!");
		return ;
	}
	//alert(ListForm.cid.value);
	//ListForm.easyJWebCommand.value="edit";
	//ListForm.submit();
	location.href="write.jsp?cid="+ListForm.cid.value+"&box="+ListForm.box.value;
}
function doForward()
{
	if(ListForm.cid.value==""){
		alert("请选择转发的邮件!");
		return ;
	}
	//alert(ListForm.cid.value);
	//ListForm.easyJWebCommand.value="forward";
	//ListForm.submit();
	location.href="forward.jsp?cid="+ListForm.cid.value+"&box="+ListForm.box.value;
}
function doReplyAll(id)
{
	if(ListForm.cid.value==""){
		alert("请选择要回复的邮件!");
		return ;
	}
	//ListForm.easyJWebCommand.value="replyAll";
	//ListForm.cid.value=id;
	//ListForm.submit();
	location.href="replyAll.jsp?cid="+ListForm.cid.value+"&box="+ListForm.box.value;
}
function doMoveToDel()
{
	if(confirm('邮件删除操作将把邮件移到废件箱,是否执行该操作?')){
		ListForm.newBox.value="delbox";
		doMove();
	}
}
function doMoveToDel2()
{
	var ids="";
	var obj;
	if(typeof ListForm.cids!="undefined")
		obj=ListForm.cids;
	else return;
	if(typeof obj.length =="undefined") {
		if(obj.checked)ids=obj.value;
	}
	else {
		for(var i=0;i<obj.length;i++)
			if(obj[i].checked)
				ids+=obj[i].value+",";
	}
	//if(ids=="")ids=ListForm.cid.value+",";
	ListForm.mulitCid.value=ids;
	if(ids=="")
	{
		alert("请选择要删除的邮件!");
		return false;
	}
	if(confirm('邮件删除操作将把邮件移到废件箱,是否执行该操作?')) {
		//location.href="move.jsp?box="+ListForm.box.value+"&newBox=delbox&mulitCid="+ListForm.mulitCid.value;
		var pars="box="+ListForm.box.value+"&newBox=delbox&mulitCid="+ListForm.mulitCid.value;
		new Ajax.Request('move.jsp', {parameters:pars, onSuccess:handlerFunc, onFailure:errFunc});
	}
}
function handlerFunc() {
	location.replace("list.jsp?box="+ListForm.box.value);
}
function errFunc() {
	alert("删除失败");
}
function gotoPage(n)
{
	ListForm.page.value=n;
	ListForm.submit();
}
function ChangeNoEx()
{
	if(!CheckPositiveInt(form1.txtPageNo,"请输入一个正整数!",false))
		return false;
	ChangePageNo(form1.txtPageNo.value);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -