<%@page contentType="text/html; charset=UTF-8"%> <%@page import="com.csc.library.utilities.CheckNull,com.csc.library.mail.SendMail"%> <%@page import="com.csc.library.utilities.*"%> <%request.setCharacterEncoding("UTF-8");%> <% CheckNull chk = new CheckNull(); String cmd = chk.chkNullString(request.getParameter("__cmd")); int result=0; if(cmd.equalsIgnoreCase("send")){ String from = chk.chkNullString(request.getParameter("__mail_from")); String to = chk.chkNullString(request.getParameter("__mail_to")); String cc = chk.chkNullString(request.getParameter("__mail_cc")); String subject = new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("__mail_subject"))); String message=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("__mail_message")).replaceAll("\n","<br>")); if(!message.equals("")){ message+=" <A href=\"http://HRonline/hr/MYNOTE/INBOX.jsp\">Note Link</A>"; } SendMail mail = new SendMail( "", from, to, cc, subject, message); result = mail.send(); } %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="../CSS/TISCO.css" rel="stylesheet" type="text/css"> <script type='text/javascript' src='../JS/SCREEN.js'></script> <script type='text/javascript' src='../JS/DATEINPUT.js'></script> <script type='text/javascript' src='../JS/VIEWCALENDAR.js'></script> <script type='text/javascript' src='../JS/ICONSMENU.js'></script> <script language='javascript'>setLang('tha');</script> <script language="javascript">getTitleName();</script> <script language='javascript' src='../JS/HOTKEY.js'></script> <script language="JavaScript" type="text/JavaScript"> function GoSave(){} function GoUpdate(){} function GoDelete(){} function GoSearch(){} function goBack(){ close(); } function searchEmail(){ window.open("ASV2U002H.jsp","","left=150,top=20,width=1000,height=600,toolbar=no,status=yes,scrollbars=yes,resizable=no"); } function sendMailComp(status) { with(document.cscform){ if(status=="0"){ if(oldemp.value!=""){ setStatusS(oldemp.value); } if(sendall.value=="1"){ sendMailAll(); }else{ alert("การส่งเมล์ล้มเหลว"); } }else{ if(oldemp.value!=""){ setStatusF(oldemp.value); } if(sendall.value=="1"){ sendMailAll(); }else{ if(thisemp.value!=""){ alert("ส่งเมล์เรียบร้อยแล้ว"); }else{ window.parent.document.getElementById("mframe").height = "0"; alert("เสร็จสิ้นการส่งเมลล์"); } } } } } function sendMailAll(){ with(document.cscform){ if(thisemp.value!=""){ __cmd.value = "send"; submit(); }else{ window.parent.document.getElementById("mframe").height = "0"; alert("เสร็จสิ้นการส่งเมลล์"); } } } function setDefMail(){ with(document.cscform){ if(emp_id.value!=""){ var tmp_emp_id = emp_id.value.split(","); if(tmp_emp_id.length>0){ thisemp.value = tmp_emp_id[0]; } emp_id.value = ""; if(tmp_emp_id.length>1){ for(i=1;i<tmp_emp_id.length;i++){ if(emp_id.value!=""){ emp_id.value += ","; } emp_id.value += tmp_emp_id[i]; } } } if(thisemp.value!=""){ var tmp_thisemp = thisemp.value; __mail_to.value = getThisMailTo(tmp_thisemp); __mail_cc.value = getThisMailCc(tmp_thisemp); __mail_subject.value = getThisSubject(tmp_thisemp); __mail_message.value = getThisMass(tmp_thisemp); setStatusW(tmp_thisemp); } } } function getThisMailTo(empid){ return window.parent.document.getElementById("empmail$"+empid).value; } function getThisMailCc(empid){ if(window.parent.document.getElementById("type_cc").checked){ return window.parent.document.getElementById("bossmail$"+empid).value; }else{ return ""; } } function getThisSubject(empid){ var tmp = window.parent.document.cscform.subject0.value; if(window.parent.document.getElementById("type$"+empid).value=="1"){ tmp = window.parent.document.cscform.subject1.value; } return tmp; } function getThisMass(empid){ var tmp = window.parent.document.cscform.massage0.value; if(window.parent.document.getElementById("type$"+empid).value=="1"){ tmp = window.parent.document.cscform.massage1.value; } tmp = tmp.replace("empname",window.parent.document.getElementById("empname$"+empid).value); //alert(replaceDate(window.parent.document.getElementById("date$"+empid).value)); tmp = tmp.replace("traindate",replaceDate(window.parent.document.getElementById("date$"+empid).value)); return tmp; } function setStatusW(empid){ window.parent.document.getElementById("empid$"+empid).innerHTML = "<font class='wait'>"+window.parent.document.getElementById("empid$"+empid).value+"</font>"; } function setStatusF(empid){ window.parent.document.getElementById("empid$"+empid).innerHTML = "<font class='free'>"+window.parent.document.getElementById("empid$"+empid).value+"</font>"; } function setStatusS(empid){ window.parent.document.getElementById("empid$"+empid).innerHTML = "<font class='stop'>"+window.parent.document.getElementById("empid$"+empid).value+"</font>"; } function setStatusB(empid){ window.parent.document.getElementById("empid$"+empid).innerHTML = "<font class=''>"+window.parent.document.getElementById("empid$"+empid).value+"</font>"; } function replaceDate(date){ var tmp = date; var tmp_date; var thmonth = new Array ("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"); with(document.cscform){ tmp_date = tmp.split("-"); if(tmp_date.length==3){ tmp = subMyNum(tmp_date[0])+" "+thmonth[parseInt(subMyNum(tmp_date[1]))-1]+" "+(parseInt(tmp_date[2])+543); } } return tmp; } function subMyNum(num){ var t_num = num; if(t_num.indexOf("0")==0){ t_num = t_num.substring(1,2); } return t_num; } </script> <% String tmpMail = new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("__tmpMail"))); tmpMail = tmpMail.replace("$"," "); String tmpHead = new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("__tmp_head"))); tmpHead = tmpHead.replace("$"," "); %> </head> <body leftmargin="0" topmargin="0"> <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> <form name="cscform" method="post" action="?"> <input type="hidden" name="__screen" value="TRA02525MS_PHATRA"> <input type="hidden" name="__cmd" value=""> <input type="hidden" name="__help" value=""> <input type="hidden" name="__goPage" value=""> <input type="hidden" name="__orderBy" value=""> <input type="hidden" name="__helpReturn" value=""> <input type="hidden" name="__helpName" value=""> <input type="hidden" name="__pageCall" value=""> <input type="hidden" name="__fixCon" value=""> <input type="hidden" name="__fixFilter" value=""> <input type="hidden" name="__language" value="tha"> <input type="hidden" name="__companyid" value="<%//=screen.getUProfile().get("companyid")%>"> <input type="hidden" name="mailform" value="<%=chk.chkNullString(request.getParameter("mailform"))%>"> <input type="hidden" name="emp_id" value="<%=chk.chkNullString(request.getParameter("emp_id"))%>"> <input type="hidden" name="thisemp" value=""> <input type="hidden" name="oldemp" value="<%=chk.chkNullString(request.getParameter("thisemp"))%>"> <input type="hidden" name="sendall" value="<%=chk.chkNullString(request.getParameter("sendall"))%>"> <script language="javascript">getInputFormatDate();</script> <script language="javascript">initToolTips();</script> <table border="0" align="center" cellpadding="0" cellspacing="0" class="maxsize"> <tr> <td class="header">TRA02525MS_PHATRA,<script language="javascript">swapLang("Detail");</script> </td> </tr> <tr> <td class="blankspace"></td> </tr> <tr> <td> <table align="center" border="0" cellpadding="0" cellspacing="0" class="largest" colspan="2"> <tr> <td width="20%" align="right"><script language="javascript">swapLang("To");</script> </td> <td width="80%"><input name="__mail_to" type="text" size="70"value="" ></td> </tr> <tr> <td align="right"><script language="javascript">swapLang("cc");</script> </td> <td><input name="__mail_cc" type="text" size="70" onblur="chkEmail(this)" onkeypress = "chkNotThaiChaOnly()" value="" ></td> </tr> <tr> <td align="right"><script language="javascript">swapLang("From");</script> </td> <td><input name="__mail_from" type="text" size="70" maxlength="70" onblur = "chkEmail(this)" onkeypress = "chkNotThaiChaOnly()" value="<%=(chk.chkNullString(request.getParameter("__mail_from")).equals(""))?chk.chkNullString(request.getParameter("mailform")):chk.chkNullString(request.getParameter("__mail_from"))%>"></td> </tr> <tr> <td align="right"><script language="javascript">swapLang("Subject");</script> </td> <td><input name="__mail_subject" type="text" size="70" value=""></td> </tr> <tr> <td valign="top" align="right"><script language="javascript">swapLang("Message");</script> </td> <td><textarea name="__mail_message" cols="70" rows="6" ></textarea></td> </tr> </table> </td> </tr> <script language="javascript">setDefMail();</script> <tr> <td class="blankspace"></td> </tr> </table> <% if (request.getParameter("__cmd") != null && request.getParameter("__cmd").equals("send")) { %> <script language="javascript">sendMailComp('<%=result%>')</script> <% } %> </form> </body> </html>