<?php
@session_start();
include('inc/conn.php');
include('checkstate.php');
include('inc/function.php');
include('fun/funcount.php');

  $action=$_GET['action'];
  if($action=="add"){
     $userid=$_POST['userid'];
	 $contacter=$_POST['contacter'];
	 $title=$_POST['title'];
	 $content=$_POST['content'];
	 $time=date('Y-m-d H:i:s',time());
	 $fujian=$_POST['fujian'];
	 $slang=$_POST['slang'];
	  
	  
	 if($content=='' || $title==''){
	   echo "<script type='text/javascript'>alert('邮件内容都必须填写完整');</script>";
	   echo "<script type='text/javascript'>history.back();</script>";
	 }else{
	 
	 
	 $insert="insert into etw_onlines(yid,usernameid,contacter,title,content,senddate,translate,readed,language,childuserid) value(-1,'".$userid."','".$contacter."','".$title."','". $content."','".$time."','".time()."', '1','0','".$childid."' )";
	mysql_query($insert);
	$cha=sql_select("select id from etw_onlines where usernameid='".$userid."' and senddate='".$time."'");
	$in="insert into etw_translate(chatid,userid,source_content,receivetime,language,type,fujian) value(".$cha[0][0].", ".$userid.",'".$content."', '".time()."','0',1,'".$fujian."' )";
	mysql_query($in);
	
	}
  }

 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $info['company'];  ?> - 邮件询盘 - ETW 国际客户之窗</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />


</head>

<body>
<div id="main">
    <div id="top">
        <?php include('header.php');  ?>
       <div id="logo">
       <div id="menu">
          <ul><li class="current"><a href="manage.php">系统首页</a></li>
         <li><a href="news.php">新闻</a></li>
          <li><a href="commontools.php">工具箱</a></li>
       </ul><iframe style=" float:right;" width='350' height='30' marginwidth='0' marginheight='0' hspace='0' vspace='0' frameborder='0' scrolling='No' src='http://m.weather.com.cn/m/p3/weather1.htm' name="I6"></iframe></div>
       </div>
    </div>
     <!-- left -->
     <?php include('left.php');?>
     
     <div id="right">
       <p class="title"><strong>ETW 服务中心</strong> &gt;&gt; 翻译服务 </p>
               
         <div id="con">
         <div class="daoh"><a href="?action=tianjia">添加邮件翻译</a> | <a href="emailxunpan.php">查看邮件翻译</a></div>  
<?php   if($action=="add" || $action==""){ ?>
         <table width="727" border="1"  class="tables">
               <tr class="gren"><td width="133">序号</td><td width="243">主题</td><td width="187">时间</td>
               <td width="154">状态</td> </tr>       
<?php 
		    $sql="select * from etw_onlines where yid=-1 and usernameid=".$_SESSION['guestid'].$wherechild;
			
			$result=mysql_query($sql);
			$i=1;
			while($row=mysql_fetch_array($result)){  ?>

  <tr>
    <td><?php echo $i ?></td>
    <td><a href="inquirydetail.php?id=<?php echo $row['id']; ?>"  title="<?php echo "子帐户：".getchildemail($rs['childuserid']); ?>"><?php echo $row['title'] ?></a></td>
    <td><?php echo $row['senddate'] ?></td>
    <td><?php if($row['language']=="no") {echo "该语种未合作"; }else{ echo "翻译中"; }  ?></td> 
  </tr>
<?php $i++;	}  ?>     
</table>
<?php }else if($action=="tianjia"){ ?>	
	     
         <form name="myform" action="emailxunpan.php?action=add" method="post">
        <table width="684" border="0" style="background:#f9f9f9; line-height:30px;">
  <tr>
    <td colspan="2" align="center">添加邮件询盘翻译</td>
  </tr>

  <tr>
    <td width="81" align="right"> 邮件主题：</td>
    <td width="593"><input type="text" name="title" size="50" /></td> </tr>
  <!--<tr><td width="81" align="right"> 外语语种：</td> <td width="593">
  <select id="slang" name="slang">
        <option value="0">未知</option>
   <?php // $result=mysql_query("select * from etw_language");
		 // while($lan=mysql_fetch_array($result)){
		//	echo "<option value=\"".$lan[domain]."\">".$lan[language]."</option>"; 
		//} ?></select></td>
</tr>-->
 <input type="hidden" name="userid" value="<?php echo $_SESSION['guestid'];  ?>" />
  <tr>
    <td align="right"> 询盘内容：</td><td><textarea name="content" cols="65" rows="10"></textarea>*必填</td>
  </tr>
  <tr>
    <td align="right"> 添加附件：</td><td><input type="hidden" id="fujian" name="fujian" /><iframe src="uppic.php" width="320" height="20" scrolling="no" frameborder="0"></iframe>  (上传多个文件时请打包上传)</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="提交内容" /> <input type="reset" name="reset" value=" 重 填 " /></td>
  </tr>
</table>
</form>
<?php }  ?>
         </div>
     </div>
     <div id="footer"> Copy Rright &copy; 2008-2009 ETW International <?php if( @$_SESSION["username"]<>''){?>
<input type="hidden" id="onlineu" value="<?php echo $_SESSION["username"] ?>" />
<script type="text/javascript" src="js/onlinelisten.js"></script>
<script type="text/javascript">
window.setInterval(onlinemessage,30000);
</script>
<?php } ?></div>  
</div>
<script type="text/javascript" src="js/opencommon.js"></script>
<?php mysql_close();?>
</body>
</html>