<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.opensymphony.xwork2.ActionContext" %>    
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>    
<%@ include file="../language.jsp" %>



<script src="../scripts/itsm/cm/ciTree.js?random=<%=new java.util.Date().getTime()%>"></script>
<script>
	var emailToEmail="0";
	var emailDelete="0";
</script>
<sec:authorize url="/pages/email!toEmail.action">
	<script>emailToEmail="1";</script>
</sec:authorize>
<sec:authorize url="/pages/email!delete.action">
	<script>emailDelete="1";</script>
</sec:authorize>
<script type="text/javascript" src="../scripts/itsm/tools/email.js?random=<%=new java.util.Date().getTime()%>"></script>

<script>
$(document).ready(function(){
	 $("#email_loading").hide();
	 $("#email_content").show();
});
</script>
<div style="padding:10px" id="email_loading"><img src="../images/icons/loading.gif" /></div>
<div style="padding:3px;display:none;" id="email_content">
	
<table id="emailGrid"></table>
<div id="emailPager"></div>

<div id="emailGridToolbar" style="display: none">
	<sec:authorize url="/pages/email!toEmail.action">
		<a id="newMail" class="easyui-linkbutton"  plain="true" icon="icon-add" onclick="javascript:itsm.tools.email.toolbar_addEmail()" ><fmt:message key="tool.mail.addEmail"/></a> 
	</sec:authorize>
	<sec:authorize url="/pages/email!toEmail.action">
		<a id="replyMail" class="easyui-linkbutton"  plain="true" icon="icon-edit" onclick="javascript:itsm.tools.email.toolbar_replyEmail()" ><fmt:message key="tool.mail.replyEmail"/></a> 
	</sec:authorize>
	<sec:authorize url="/pages/email!delete.action">
		<a class="easyui-linkbutton"  plain="true" icon="icon-cancel" onclick="itsm.tools.email.deleteEmailMessage_aff()"><fmt:message key="common.delete"/></a> 
	</sec:authorize>
	<sec:authorize url="/pages/email!find.action">
		<a class="easyui-linkbutton"  plain="true" icon="icon-search" onclick="itsm.tools.email.openEmailMessageSearchWin()"><fmt:message key="common.search" /></a> 
	</sec:authorize>
	<a onclick="itsm.tools.email.scanEmailServer()"  plain="true" class="easyui-linkbutton" icon="icon-save"><fmt:message key="common.scan"/></a>
	<a class="easyui-linkbutton"  plain="true" icon="icon-add" onclick="itsm.tools.email.emailToRequest_aff()"><fmt:message key="tool.mail.creatRequest"/></a> 
</div>
	

<!-- 写邮件 -->
<div id="addEmail"  class="easyui-window"  closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title="<fmt:message key="tool.mail.addEmail"/>" style="width:650px;height:auto">
<form id="addEmailForm">
	<input type="hidden" name="emailConnectionDto.host" id="emailConnectionHost" />
	<input type="hidden" name="emailConnectionDto.username" id="emailConnectionUserName"  />
	<input type="hidden" name="emailConnectionDto.password" id="emailConnectionPassword"/>
	<input type="hidden" name="emailConnectionDto.port" id="emailConnectionPort" />

	<div class="lineTableBgDiv">
		<table style="width:100%" class="lineTable" cellspacing="1">
	    	<tr>
	            <td><fmt:message key="tool.mail.receiveAddress"/></td>
	            <td><input id="to" name="emailDto.receiveAddress" class="easyui-validatebox"  required="true" style="width:96%" />
	            	<br><span><fmt:message key="label.email.address.format" /></span>
	            </td>
	        </tr>
	     	
	        <tr>
	            <td><fmt:message key="tool.mail.emailTitle"/></td>
	             <td><input id="subject" name="emailDto.subject" required="true"  style="width:96%" /></td>
	        </tr>
	        
	          <tr>
	            <td><fmt:message key="tool.mail.emailContent"/></td>
	             <td><textarea id="emailContent" name="emailDto.content" style="width:96%;height:180px" ></textarea>
	           </td>
	        </tr>
	       
	          <tr style="display: none">
	            <td><fmt:message key="tool.mail.remark"/></td>
	             <td><input id="remarks" style="width:96%" /></td>
	        </tr>
	        
	         <tr style="display: none">
	            <td><fmt:message key="tool.mail.emialDescription"/></td>
	             <td><input id="description" name="emailDto.description" style="width:96%" /></td>
	        </tr>
	        <tr>
	            <td colspan="2" style="padding-top:8px;">
	                 <a class="easyui-linkbutton" icon="icon-ok" onclick="itsm.tools.email.add_email()"><fmt:message key="tool.mail.confirmSend"/></a>
	        </td>
	        </tr>
	    </table>
    </div>
    </form>
</div>





<!--呼叫信息-->
<div id="logCall_win"  class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title="<fmt:message key="title.email.mailToRequest"/>" style="width:580px;height:auto">
<form id="mailTrqForm">
<input  id="email_emailMessageId" type="hidden" name="requestDTO.emailMessage" />
<div class="lineTableBgDiv">
		<table style="width:100%" class="lineTable" cellspacing="1">



	<tr>
		<td style="width:20%"  ><fmt:message key="tool.mail.toReuqest.title"/></td>
		<td style="width:80%" colspan="3" ><input name="requestDTO.etitle" id="email_request_etitle" value="${requestDTO.etitle}" class="easyui-validatebox input" required="true" /></td>
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.content"/></td>
		<td colspan="3">
		<textarea name="requestDTO.edesc" id="email_request_edesc"  style="height:120px;" class="easyui-validatebox input" required="true"></textarea>
		</td>
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.createByUser"/></td>
		<td colspan="3">
			<input  id="email_selectCreator" name="requestDTO.createdByName"  class="easyui-validatebox input" required="true" style="cursor:pointer" onclick="itsm.tools.email.selectRequestCreator()"
			value="${loginUserName}"/>
			<input  id="email_addRequestUserId" type="hidden" name="requestDTO.createdByNo" style="width:98%;color:#555;" />
		</td>
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.effectCI"/></td>
		<td colspan="3">
			<input style="width:96%;cursor:pointer"  id="email_selectCIName" />
			<input  id="email_addRequestCIId" type="hidden" name="requestDTO.ciId" />
		</td>
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.category"/></td>
		<td>
			<input type="hidden" name="requestDTO.requestCategoryNo" id="mailToRequestCategoryNo" />
			<input name="requestDTO.requestCategoryName"  id="mailToRequestCategoryName"  style="width:96%;cursor:pointer" readonly/>
			
		</td>	
		<td><fmt:message key="label.request.complexity"/></td>
		<td>
			<select id="email_request_level" name="requestDTO.levelNo" class="input">
			</select>
		</td>
		
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.effect"/></td>
		<td>
			<select id="email_request_effectRange" name="requestDTO.effectRangeNo" class="input"></select>
		</td>
		<td><fmt:message key="tool.mail.toReuqest.emergencyDegree"/></td>
		<td>
			<select id="email_request_seriousness" name="requestDTO.seriousnessNo" class="input"></select>
		</td>
	</tr>
	<tr>
		<td><fmt:message key="tool.mail.toReuqest.priority"/></td>
		<td>
			<select id="email_request_priority" name="requestDTO.priorityNo" class="input"></select>
		</td>
		<td><fmt:message key="tool.mail.toReuqest.form"/></td>
		<td>
			<select id="email_request_imode" name="requestDTO.imodeNo" class="input"></select>
		</td>
	</tr>

	<tr>			
		<td colspan="4">
	   
	   		<input type="hidden" name="requestDTO.technicianName" value="${loginUserName}"  />
	    	<a id="link_addcall_ok" class="easyui-linkbutton" icon="icon-ok" onclick="itsm.tools.email.emailToRequest_opt()"><fmt:message key="common.save"/></a>&nbsp;&nbsp;&nbsp;&nbsp;
	   
		</td>
	</tr>
	
</table>
</div>
</form>
</div>


<!--邮件信息搜索-->
<div id="emailMessageSearch_win"  class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="false" 
title="<fmt:message key="common.search"/>" icons="icon-search" style="width:400px;height:auto;padding: 10px;">
<form id="emailMessageSearchForm">
	<table>
		<tr>
			<td><fmt:message key="tool.mail.toReuqest.title"/></td>
			<td><input name="emailMessageQueryDto.subject" style="width: 95%" /></td>
		</tr>
		<tr>
			<td><fmt:message key="request.email.fromUser"/></td>
			<td><input name="emailMessageQueryDto.fromUser" style="width: 95%" /></td>
		</tr>
		<tr>
			<td><fmt:message key="request.email.toUser"/></td>
			<td><input name="emailMessageQueryDto.toUser" style="width: 95%" /></td>
		</tr>
		<tr>
			<td><fmt:message key="request.email.receiveDate"/></td>
			<td><input name="emailMessageQueryDto.receiveStartDate" class="easyui-datebox" style="width: 120px;"/><fmt:message key="setting.label.to" />
			<input name="emailMessageQueryDto.receiveEndDate" class="easyui-datebox" style="width:120px;"/></td>
		</tr>
		<tr>
			<td><fmt:message key="request.email.sendDate"/></td>
			<td><input name="emailMessageQueryDto.sendStartDate" class="easyui-datebox" style="width:120px;"/><fmt:message key="setting.label.to" />
			<input name="emailMessageQueryDto.sendEndDate" class="easyui-datebox" style="width:120px;"/></td>
		</tr>
		<tr>
			<td><fmt:message key="label.emailType"/></td>
			<td>
				<select name="emailMessageQueryDto.folderName">
					<option value="">--<fmt:message key="common.pleaseSelect" />--</option>
					<option value="OUTBOX"><fmt:message key="label.send" /></option>
					<option value="INBOX"><fmt:message key="label.receive" /></option>
				</select>
		</tr>
		<tr>			
		<td colspan="2">
	    	<a id="link_addcall_ok" class="easyui-linkbutton" icon="icon-ok" onclick="itsm.tools.email.emailMessageSearch()"><fmt:message key="common.search"/></a>&nbsp;&nbsp;&nbsp;&nbsp;
	   
		</td>
	</tr>
	</table>
</form>
</div>

<div id="email_to_request_select_category_panel"  class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title="<fmt:message key="setting.requestCategory"/>" style="width:320px;height:auto">
	<div id="email_to_request_select_category_tree"></div>
</div>

</div>

					 