<%@ page language="java"  pageEncoding="UTF-8"%>
<%@page import="com.myoa.common.util.SysConfUtil"%>
<%@ include file="/common/include/taglibs.jsp"%>
<HTML>
<HEAD>
<%@ include file="/common/include/meta.jsp"%>
<%@ include file="/common/include/toolbar.jsp"%>
<%@ include file="/common/include/jquery.jsp"%>
<%@ include file="/common/include/calendar.jsp"%>
<script type="text/javascript">
//上下视图
function updownview(){
 var rows = parent.document.all.layout.rows;
 if(rows=="40%,*"){
   parent.document.all.layout.rows="0.1%,*";
 }else{
   parent.document.all.layout.rows="40%,*"
 }
}
//全选
function selectAll(){
  document.all.selectText.innerHTML = '<fmt:message key="common.flow.toolbar.SelectInverse"/>';
  document.all.selectAllButton.title = '<fmt:message key="common.flow.toolbar.SelectInverse"/>';
  parent.listframe.selectAll();
}
//查询
function doSearch(){
 myform.submit();
}


 //转发邮件
 function forwardMail(){
   var checkedCount = parent.listframe.getCheckedCount();
   if(checkedCount>1){
	if(!window.confirm('<fmt:message key="common.flow.toolbar.OnlyFirstForward"/>')){
	  return;
	}
   }else if(checkedCount == 0){
	  alert('<fmt:message key="common.flow.toolbar.PleaseSelect"/>');
	  return;
   }
   var docId = parent.listframe.getCheckedValue('docId');
   parent.location.href="${ctx}/jsp/webmail/create/index.jsp?docId="+docId;	
 }
 
//删除
 function delDoc(){
   var checkedCount = parent.listframe.getCheckedCount();
   if(checkedCount == 0){
 	alert('<fmt:message key="common.flow.toolbar.PleaseSelect"/>');
     return;
   }
   if(!window.confirm('<fmt:message key="common.flow.toolbar.DeleteConfirm"/>')){
     return;
   } 
   delform.docIdStr.value = parent.listframe.getCheckedValues('docId');
   ajaxSubmitForm('delform',ajaxQueryHandler,'text');
 }

//发送
 function send(){
	var checkedCount = parent.listframe.getCheckedCount();
    if(checkedCount == 0){
     alert('<fmt:message key="common.flow.toolbar.PleaseSelect"/>');
    return;
    }else if(checkedCount >1){
     alert('<fmt:message key="common.flow.toolbar.OnleyOneAllowSend"/>');
     return;
    }
    var docId = parent.listframe.getCheckedValue('docId');
    var isSchedule = parent.listframe.getCheckedValue('isSchedule');
    if(!isSchedule){
    	alert('非一次性的定时发送的事项不允许立即发送！');
    	return;
    }
    ajaxQuery('${ctx}/collaborate.do?actionmethod=sendagain&docId='+docId,ajaxQueryHandler,'text');
 }
//处理结果
 function ajaxQueryHandler(responseText){
  if(responseText=='success'){
   alert('<fmt:message key="common.flow.toolbar.DoSuccess"/>');
   doSearch();
  }else if(responseText=='fail'){
   alert('<fmt:message key="common.flow.toolbar.DoFail"/>');
  }else{
   alert(responseText);
  }
  
 }


</script>
</HEAD>
<BODY class=toolBarBody scroll=no onkeydown=return(!(event.keyCode==78&&event.ctrlKey)) oncontextmenu="return false"    onselectstart="self.event.returnValue=false"  ondrag="return false" >
<FIELDSET>
<form name="myform" onsubmit="return false;" action="list.jsp?queryType=CUST" target=listframe method=post>
<TABLE cellPadding=0 cellSpacing=0 width="100%">
  <TR>
    <TD class=coolButton id=button_send noWrap title="<fmt:message key="common.flow.toolbar.Send"/>" vAlign=middle onclick=send()>&nbsp;
    <IMG align=middle src="${ctx}/common/images/toolbar/send.gif"><span id="selectText"><fmt:message key="common.flow.toolbar.Send"/></span>
    </TD>
    <%if(SysConfUtil.getWebmailSendable(session)){%>
     <TD class="coolButton" noWrap title="<fmt:message key="common.flow.toolbar.ForwardMail"/>" vAlign=center onclick="forwardMail()">&nbsp;
     <IMG align=absMiddle src="${ctx}/common/images/webmail/forward.gif"><fmt:message key="common.flow.toolbar.ForwardMail"/>
    </TD>  
    <%}%>
    <TD class=coolButton noWrap title="<fmt:message key="common.button.delete"/>" vAlign=center onclick="delDoc()">&nbsp;
    <IMG align=absMiddle src="${ctx}/common/images/toolbar/deldoc.gif"> <fmt:message key="common.button.delete"/>
    </TD>
    <TD class=coolButton noWrap id="selectAllButton" title="<fmt:message key="common.flow.toolbar.SelectAll"/>" vAlign=middle onclick="selectAll()">&nbsp;
    <IMG align=middle src="${ctx}/common/images/toolbar/selectall.gif"><span id="selectText"><fmt:message key="common.flow.toolbar.SelectAll"/></span>
    </TD>
    <TD class=coolButton noWrap title="<fmt:message key="common.flow.toolbar.UpDown"/>" vAlign=middle onclick="updownview()">&nbsp;
    <IMG align=middle src="${ctx}/common/images/toolbar/updown.gif" ><fmt:message key="common.flow.toolbar.UpDown"/>&nbsp;
    </TD>
    <TD style="WIDTH: 100%" align="right">
	<div class="div-float-right">
				<div class="div-float">
					<select name="mySelect" onChange="showNextSpecialCondition(this)" class="condition">
				    	 <option value="title"><fmt:message key="common.query.Subject"/></option>
	                     <option value="senddate"><fmt:message key="common.query.SendTime"/></option>
	                     <option value="content"><fmt:message key="common.query.Content"/></option>
	                     <option value="docSecretLevel"><fmt:message key="common.query.SecretLevel"/></option>
	                     <option value="docUrgentLevel"><fmt:message key="common.query.UrgentLevel"/></option>
				  	</select>
			  	</div>
			  	<div id="titleDiv" class="div-float"><input type="text" name="title" class="textfield"></div>
			  	<div id="senderDiv" class="div-float hidden"><input type="text" name="sender" class="textfield"></div>
			  	<div id="contentDiv" class="div-float hidden"><input type="text" name="content" class="textfield"></div>
			  	<div id="senddateDiv" class="div-float hidden">
			  		<input type="text" name="begDate" style="width:70px;" onclick="DoCal(this)" readonly>
			  		-
			  		<input type="text" name="endDate" style="width:70px;" onclick="DoCal(this)" readonly>
			  	</div>
			  	<div id="docSecretLevelDiv" class="div-float hidden">
	            <myoa:datadic groupid="28" name="docSecretLevel" style="width:100" id="docSecretLevel"></myoa:datadic>
	            </div>
	           <div id="docUrgentLevelDiv" style="display:none">
	            <myoa:datadic groupid="27" name="docUrgentLevel" style="width:100" id="docUrgentLevel"></myoa:datadic>
	           </div>
		  	</div>
    </TD>
    <TD class=coolButton id=mysearch noWrap title="<fmt:message key="common.query.Query"/>" vAlign=middle onclick="doSearch()">&nbsp;
    <IMG align=middle src="${ctx}/common/images/toolbar/search.gif" >&nbsp;<fmt:message key="common.query.Query"/>
    </TD>
</TR>
</TABLE>
</form>
<form id="delform" name="delform" action="del.jsp" height=0>
 <input type="hidden" name="docIdStr">
</form>
</FIELDSET>
 </BODY>
 </HTML>
