<%@ page language="java"  pageEncoding="GB2312" contentType="text/html;charset=GB2312" %>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<script language="javascript" src='<c:url value="/scripts/change_page.js"/>'></script>
<Script language="javascript">
<!--
/**
 * form 表单
 * pageNo 翻页页码
 */



function selectAll(form, isCheck) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox") {
			e.checked = isCheck;
		}
	}
}

function getChecked(form) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox" && e.checked && e.name == "ids") {
			return e.value;			
		}
	}
	return "";
}

function getChecks(form) {
	var ids = "";
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox" && e.checked && e.name == "ids") {
			if(ids != "") {
				ids += ",";
			}
			ids += e.value;			
		}
	}
	return ids;
}

function getRadioChecked(form) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "radio" && e.checked && e.name == "id") {
			return e.value;			
		}
	}
	return "";
}
function dowork(how, entityid) {
	var form = document.messageForm;
	var pageCurrent = '<c:out value="${pageObject.pageCurrent}"/>';
	var pageCount = '<c:out value="${pageObject.pageCount}"/>';
	var mid = getChecked(form);
	switch(how) {
		case 'add' : 
			//window.location.href='<c:url value="/sys/cmsComment/addCMSComment.html"/>';
			form.action = '<c:url value="/sys/message/addMessage.html"/>';
			form.submit();
			break;
		case 'edit' : 
		    if(entityid == "") {
				alert("请选择修改项!");
			} else {
				//window.location.href='<c:url value="/sys/cmsComment/editCMSComment.html"/>?id=' + entityid;
				form.action = '<c:url value="/sys/message/editMessage.html"/>';
				form.id.value = entityid;
			    form.submit();
			    break;
			}
			break;
		case 'view':
		    if(entityid == "") {
				alert("请选择查看项项!");
			} else {
				//window.location.href='<c:url value="/sys/cmsarticle/editCMSArticle.html"/>?id=' + entityid;
				openWin2('<c:url value="/sys/message/viewMessage.html"/>?method=view&id=' + entityid);
			    break;
			}
			break;
		case 'search':
			if (form.keyword.value==""){
				alert("请填写检索内容");
				form.keyword.focus() ;
			}else{
				form.action ='<c:url value="/sys/message/find.html"/>';
				form.method.value="find" ;
				form.submit() ;
			}
			break;
	}//end switch
}
function openWin2(url) {	
	var myWin = window.open(url, "", "width=700, height=600, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	myWin.focus();
}
//-->
</script>
<html>
<body>
<table border=1>
	<tr><td colspan=5>信息列表</td></tr>
	<tr>
		<td>id</td>
		<td>姓名</td>
		<td>主题</td>
		<td>ip</td>
		<td>操作</td>
	</tr>
<html:form action="/sys/webuser/searchWebuser.html">
<html:hidden property="pageCurrent"/>
<html:hidden property = "id" value="" />
<input type="hidden" name="method" value="">
<input type="hidden" name="firstId" value="<c:out value="${firstId}"/>">
<input type="hidden" name="lastId" value="<c:out value="${lastId}"/>">
	<c:forEach var="message" items="${webuserList}">
	<tr>
		<td align=center><input type="checkbox" id="ids" name="ids" value='<c:out value="${message.id}"/>'></td>
		<td><c:out value="${message.username}"/></td>
		<td><a href='javascript: dowork("view", "<c:out value="${message.id}"/>");'>查看</a></td>
	</tr>
	</c:forEach>
		  <!-- 操作 start -->
          <tr>
            <td colspan="5" bgcolor="#e8e8e8">
            <input type="checkbox" name="allcheck" onclick="selectAll(this.form, this.checked);">全选 
            <input type="button" value="删除" name="del" onclick="dowork('del');">
            <input type="button" value="添加" name="add" onclick="dowork('add');">
			<input type="button" value="关闭" name="close" onclick="window.close();">
            </td>
          </tr>
		  <!-- 操作 end -->
		  <!-- 分页 start -->
          <tr align="right">
            <td colspan="10">
			<script language="javascript">
	            drawDispartPageView("document.messageForm", <c:out value="${pageObject.pageCurrent}"/>, <c:out value="${pageObject.pageCount}"/>, <c:out value="${pageObject.rowCount}"/>);
	        </script>
			</td>
          </tr>
		  <!-- 分页 end -->
<tr>
	<td colspan="10"><html:text property="keyword" value="" /><html:button property="testb" value="检索" onclick="dowork('search');"/></td>
</tr>
</html:form>

</table>
</body>
</html>