<html>
<head>
<title>在线问卷调查系统_问卷列表_发送问卷</title>
<META NAME="robots" CONTENT="none">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../../inc/manage.css" type="text/css">
<style type="text/css">
.BgWin {
	FILTER: alpha(opacity=30)
}
#edit_survey_question_answer_div {
	LEFT: 50px; POSITION: absolute; top: 36px; VISIBILITY: visible; WIDTH: 125px; Z-INDEX: 10
}
</style>
<script language="javascript" src="../../inc/lock.js"></script>
<script language="javascript" type="text/javascript">
function add_new_select(s,s_id) //显示或关闭图层
{ //alert(s);
	if(s=="hidden"){
	document.all.add_new_select_div.style.visibility="hidden"; 
	startRequest_Read_UserInfo_Question(s_id);//读出并显示email串
	openEdit();
	document.all.add_new_select_div.style.display='none';
	}
	else{
	initFace();
	document.all.add_new_select_div.style.visibility="visible";    
	document.all.add_new_select_div.style.display='block';
	}
}
function initFace(){
  	document.all.BgWin.style.width=document.body.scrollWidth;   
  	document.all.BgWin.style.height=document.body.scrollHeight;
	document.all.BgWin.style.display='block';
  } 
function openEdit(){  
	document.all.BgWin.style.display='none';
	document.all.BgWin.style.width=document.body.clientWidth; 
	document.all.BgWin.style.height=document.body.clientHeight; 
	return   true;   
}
  
function startRequest_Read_UserInfo_Question(s_id) {
	createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange_user_info;
    xmlHttp.open("GET", "email_send_string.asp?s_id="+s_id, true);
    xmlHttp.send(null);
}
function handleStateChange_user_info() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            document.getElementById("survey_user_info").innerHTML = xmlHttp.responseText;
        }
    }
}
var xmlHttp;
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
//------------------------
function checkform()
{
	if (document.form1.fromEmail.value.length==0){
		alert("必须选择发件人！");
		return false;
	}
	if (document.form1.email_string.value.length<5){
		alert("必须填写收件人邮箱！");
		return false;
	}
	showLoading(""," 请稍等，正在发送……");
}
</script>
</head>
<body bgcolor="#FFFFFF" leftMargin="0" marginwidth="0" topmargin="0" onLoad="openEdit();">
<DIV class="BgWin" id="BgWin" style="DISPLAY: none; Z-INDEX: 2; LEFT: 0px; POSITION: absolute; TOP: 0px; width:100%; height:100%; BACKGROUND-COLOR: #000000"></DIV>
<!--#include file="../../config.asp"-->
<!--#include file="../../manage/checkuserflag.asp"-->
<%call CheckUserFlag("03")%>
<%survey_id=request("S_id")
function readSurveyCS(DataPathFile,survey_id,Survey_title,IsPassWord,IsPassWordSame,SamePassWord,PassWordString,PassWordSend,D_T_StartDate,D_T_OverDate)
	if IsNumeric(survey_id) then
		'openDb DataPathFile	
		sqlstr = "select Survey_title,is_password,is_pw_same,D_T_S_password,D_T_S_e_pw_str,password_send,D_T_StartDate,D_T_OverDate from DC_Title_survey where D_T_S_ID = " & survey_id
		set rs=dbconn.execute(sqlstr)
		if not rs.eof then
			Survey_title=rs("Survey_title")
			IsPassWord=rs("is_password")'投票是否需要密码
			IsPassWordSame=rs("is_pw_same")'是否所有人使用一个投票密码？真值表示使用同一个密码
			SamePassWord=rs("D_T_S_password")'相同的密码
			PassWordString=rs("D_T_S_e_pw_str")'不相同的密码串
			PassWordSend=rs("password_send")'密码发送方式,r人工，o自动
			D_T_StartDate=rs("D_T_StartDate")
			D_T_OverDate=rs("D_T_OverDate")
			readSurveyCS=1
		end if
		rs.close
		set rs=nothing
		'closeDB
	end if
end function
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#F0F0F0" class="p9">
  <tr> 
    <td width="60%" height="24" align="left" bgcolor="#f0f0f0"><font face="webdings" color="#215DC6">8</font>      <span style="FONT-SIZE: 14px"><b><font color="#215DC6">问卷管理 -> 使用电子邮件发送问卷</font></b></span></td>
    <td width="40%" align="right" bgcolor="#f0f0f0">
    <a href="survey_list.asp" target="_self"><font color="#000000">问卷列表</font></a> | <a href="../../manage/password.asp"><font color="#000000">修改密码</font></a> | <a href="../../manage/out.asp">
<font color="#000000">退出管理</font></a> </td>
  </tr>
  <tr> 
    <td height="1" colspan="2" bgcolor="#446CC1"></td>
  </tr>
</table>
<table width="98%" border="0" cellspacing="1" cellpadding="2" align="center" class="Info_Title">
  <tr> 
    <td height="23" align="left" valign="bottom"><font color="#ff6633"></font></td>
  </tr>
</table><form name="form1" method="post" action="survey_send_ok.asp" onSubmit="return checkform(this);">
<table width="700" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#B1C3D9">
  <tr> 
    <td height="28" colspan="2" background="../../images/s3wcn_bt2.gif"><table width="80%" border="0" align="left" cellpadding="0" cellspacing="6">
        <tr>
          <td width="9%" align="right"><img src="../../images/ico_05.gif" width="16" height="16"></td>
          <td width="91%" class="head_06">发送问卷</td>
        </tr>
      </table></td>
  </tr>
  <%
Dim PageNo	
Dim mpage
Dim startime
Dim endtime
PageNo = 20
Dim PageNum		
Dim RCount		
Dim i
			
Dim sql	
Dim rs	
Set ObjDCW = Server.CreateObject("dc_data100_v1_0.C_A_Config")

Function OpenDB(DBfile)
    Set ObjTC_DB = Server.CreateObject("dc_data100_v1_0.C_A_Config")
    Set DbConn = Server.CreateObject("ADODB.Connection")
    DbConn.open ObjTC_DB.dbPath(DBfile)
End Function
dim dbconn
openDb DataPathFile

%>
  <tr bgcolor="#FFFFFF">
    <td align="center">发件人</td>
    <td width="89%" align="left">
      <label>
<select name="fromEmail" id="fromEmail" style="WIDTH: 120px; COLOR: navy; font-size:9pt">  
                <%
				if Session("DC_Manage_DepartmentID")<>0 then'当不是超级管理员时（超级管理员不属于任何部门）
					sql_email=" where e_user=" & Session("DC_Manage_User") & " or (e_dep_id=" & Session("DC_Manage_DepartmentID") & " and eBenBuMen=1) or (e_comp_id=" & Session("DC_Manage_CompanyID") & " and eBenCOMP=1)"
				else
					sql_email=" where e_comp_id=" & Session("DC_Manage_CompanyID")
				end if
				email_s=ObjDCW.read_record(D_data,DataPathFile,"email_send_set_list","e_id,eZH,eDW",sql_email & " order by e_id")
				myrs_root_count=ubound(D_data)
				for i=0 to myrs_root_count-1 step 1
					myrs_root=split(D_data(i),",")
					Response.Write "<option value='"&myrs_root(0)&"' style='color:black;background:#f0f0f0'>" & myrs_root(1) & "@" &  myrs_root(2)
					response.write "</option>"
				next
%>
        </select>
      </label>    
      <a href="email_send_set_list.asp" target="_blank">管理发件人
      <label></label>
      </a></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td align="center">收件人</td>
    <td align="left" bgcolor="#FFFFFF"><label>
      <%email_string="email_s" & survey_id
	  email_string_input="<input name=""email_string"" type=""text"" id=""email_string"" size=""80"" value=""" & request.cookies(email_string) & """><a href=""javascript:add_new_select(''," & survey_id & ");"">导入收件人</a>"%>
      <div id="survey_user_info"><%=email_string_input%></div>
      </label></td>
  </tr>
  <%y=readSurveyCS(DataPathFile,survey_id,Survey_title,IsPassWord,IsPassWordSame,SamePassWord,PassWordString,PassWordSend,D_T_StartDate,D_T_OverDate)%>
  <tr bgcolor="#FFFFFF"> 
    <td width="11%" align="center">主　题</td>
    <td align="left"><input name="subject" type="text" id="subject" value="这是我的问卷，请在线填写" size="80"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td align="center" bgcolor="#FFFFFF">内　容</td>
    <td align="left">
    <textarea id="mailbody" name="mailbody" style="display:none"><div>这是我的问卷调查，请你填写！<br/>问卷调查主题：<%=Survey_title%><br/>投票起止日期：<%response.write "( " &D_T_StartDate & " )——( " & D_T_OverDate & " )"%>
<br/>问卷地址：<%
	address=WebUrl & "survey.asp?id=" & survey_id
	response.write  "<a href=""" & address & """ target=""_blank"">" & address & "</a>"%></div>
    <%if y=1 then
	  		if IsPassWord=True and PassWordSend="o" and ((IsPassWordSame=True and SamePassWord<>"") or (IsPassWordSame=False and PassWordString<>"")) then%>
    <div>投票密码：$PassWord</div>
    <%		end if
	end if%>
    </textarea>
<iframe id="myEditor" src="../../htmlEditor/Edit/editor.htm?id=mailbody&ReadCookie=0" frameborder="0" scrolling="no" width="621" height="100"></iframe>
      <%
	  if y=1 then
	  		if IsPassWord=True and PassWordSend="o" and ((IsPassWordSame=True and SamePassWord<>"") or (IsPassWordSame=False and PassWordString<>"")) then
				response.write "<br><label><input type=""checkbox"" name=""sendPassWord"" id=""sendPassWord"" value=""1"" checked>发送答题密码</label>"
			end if
	  end if
	  %>
      </td>
  </tr>
  
  <tr bgcolor="#FFFFFF">
    <td height="36" align="center">&nbsp;</td>
    <td align="left"><label>
      <input type="submit" name="button" id="button" value=" 发 送 ">
      <input name="survey_id" type="hidden" id="survey_id" value="<%=survey_id%>">
      <input name="IsPW" type="hidden" id="IsPW" value="<%=IsPassWord%>">
      <input name="IsPWSame" type="hidden" id="IsPWSame" value="<%=IsPassWordSame%>">
      <input name="PWSend" type="hidden" id="PWSend" value="<%=SamePassWord%>">
      <input name="SamePW" type="hidden" id="SamePW" value="<%=SamePassWord%>">
      <input name="PWString" type="hidden" id="PWString" value="<%=PassWordString%>">
    </label></td>
  </tr>
</table>
</form>
<DIV id="add_new_select_div" style="DISPLAY: block; Z-INDEX: 2; POSITION: absolute; left:expression((body.clientWidth-750)/2);top:expression((body.clientHeight-500)/5); WIDTH: 750; height:300; visibility: hidden;">
<table width="750" border="1" cellpadding="2" cellspacing="0" bordercolor="#5C99DC" bordercolorlight="#5C99DC" bordercolordark="#C7DBFB">
 <tr> 
     <td width="95%" height="20" align="left" bgcolor="#5C99DC"><font face="webdings" color="#ffffff">8</font>      <span style="FONT-SIZE: 14px"><b><font color="#ffffff">问卷管理 -> 发送问卷 -> 导入收件人</font></b></span></td>
     <td width="5%" align="center" bgcolor="#5C99DC"><a class=text href='javascript:add_new_select("hidden",<%=survey_id%>);' ><font color="#ffffff">关闭</font></a></td>
 </tr>
 <tr> 
     <td height="100" colspan="2" align="right" bgcolor="#FFFFFF">
<IFRAME name="p_password" src="email_list_load.asp?s_id=<%=survey_id%>&weizhi=2&dc_sort=1" frameBorder=0 width=750 scrolling=yes height=500 style="center"></IFRAME></td>
  </tr>
</table>
</div>
<br>
<%
Sub CloseDB()
	DbConn.Close
	Set DbConn = Nothing
End Sub

Function RequestText(text)
	if text<>"" and not IsNull(text) then
		RequestText=Trim(Replace(text,"'",""))
	else
		RequestText=""
	end if
End Function

sub out(text)
	response.write "<br><br><center><font size=2>" & text & "<a href="""&_
	"javascript:history.back();"">[返回]</a></font></center>"
	response.end
end sub

Sub CheckPage()
	rs.PageSize = PageNo
	mpage=rs.pagecount
	page=Request("p")
	If page <> "" and IsNumeric(page) Then
		PageNum = CINT(page)
	Else
		PageNum = 1
	End If
End Sub
%>