<%Response.Expires=0%>
<html>
<head>
<title>盛维在线调查系统v9.0免费版-&gt问卷调查系统后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="盛维在线调查系统v9.0免费版" name=description>
<link rel="stylesheet" href="../../inc/manage.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--#include file="../../config.asp"-->
<!--#include file="../../manage/checkuserflag.asp"-->
<%call CheckUserFlag("22")%>
<!--#include file="menu_email.asp"-->
<%
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

Set ObjDCW = Server.CreateObject("dc_data100_v1_0.C_A_Config")

s_catalogID=Request("catalogid")
'response.write "s_catalogID=" & s_catalogID & "<br>"

type_id=Request("type_id")
if type_id="" or not isnumeric(type_id) then
  type_id=0
else
  type_id=cint(type_id)
end if

keyword=replace(Request("keyword"),"'","")

%>
<!--#include file="include/const.asp"-->
<script language="javascript">
  function count_checked_items() {
  var number_checked=0;
  var box_count=document.frm_list.productid.length;
  if ( box_count==null ) {
  if ( document.frm_list.productid.checked==true ) {
  number_checked=1;}else {
  number_checked=0;}}
  else {
  for ( var i=0; i < (box_count); i++ ) {
  if ( document.frm_list.productid[i].checked==true ) {
  number_checked++;}}}return number_checked;
  }
  
  function add_to_edit() {
      if (count_checked_items()>0){                           
		  document.frm_list.action="email_edit.asp";
		  document.frm_list.submit();       
      }
      else{
          alert('请您先选择要修改的Email!');
          return false;       
      }}
	  
  function turn_to_edit() {
      if (count_checked_items()>0){ 
          if(confirm("您真的要把选中的Email设置成可公开吗?")){                       
			  document.frm_list.action="email_set.asp";
			  document.frm_list.submit(); 
		  }        
      }
      else{
          alert('请您先选择要设置的Email!');
          return false;       
      }}
      
  function del_to() {
      if (count_checked_items()>0){           
          if(confirm("您真的要删除这些Email吗?")){           
          document.frm_list.action="email_del.asp";
          document.frm_list.submit();
          }
      }
      else{
          alert('请您先选择要删除的Email!');
          return false;       
      }}
  
  function select_All(checked){
          
      for (var i=0;i<document.frm_list.elements.length;i++){
      var e = document.frm_list.elements[i];
      if (e.name != 'allbox')
          e.checked = checked;        
      }
      document.all.check_all.checked=checked;
  }       
  
  function select_ok(){
      if(document.all.check_all.checked){
          document.frm_list.button_select.value="取消";
          select_All(true)}
      else{
          document.frm_list.button_select.value="全选";
          select_All(false)
          }}
  
  function select_change(){
      if(document.frm_list.button_select.value=="全选"){
          document.frm_list.button_select.value="取消";
          select_All(true);
          }
      else{
          document.frm_list.button_select.value="全选";
          select_All(false);
          }    
  }
</script>
<table width="96%" border="0" cellspacing="1" cellpadding="0" align="center" height="37" class="p9">
  <form name="frm_search" action="email_list.asp" method="post">
    <tr> 
      <td align="center" bgcolor="#ffffff" height=40>
        邮件所属部门:
        <select name="bm" style="WIDTH: 150px; COLOR: navy; font-size:9pt">
                <%
				if Session("DC_Manage_DepartmentID")<>0 then
					sql_email=" where A_M_D_ID=" & Session("DC_Manage_DepartmentID")
				else
					sql_email=" where A_M_D_company_id=" & Session("DC_Manage_CompanyID")
				end if
				email_s=ObjDCW.read_record(D_data,DataPathFile,"A_Manage_Department","A_M_D_ID,A_M_D_Name",sql_email & " order by A_M_D_ID")
				myrs_root_count=ubound(D_data)
				if Session("DC_Manage_DepartmentID")=0 then
					Response.Write "<option value='' style='color:black;background:#f0f0f0'>所有部门</option>"
				end if
				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)
					response.write "</option>"
				next
%>
        </select>
        
        关键字: 
        <input type="text" style="WIDTH: 150px; COLOR: navy;font-size:9pt" name="keyword" class=p9 value="<%=keyword%>">
        <input type="submit" value="搜索" name=button_223 class="p9" style="WIDTH: 60px; HEIGHT: 22px;">
      </td>
    </tr>
  </form>
<%
'if s_catalogID<>0 then
	'strF=" p.catalogID=" & s_catalogID & " and "
'end if
'sqlstr="select p.*,t.id,t.typename from DC_Title_survey p,DC_Title_type t where " & strF & " p.type_id=t.id"
bm=request.form("bm")
sqlstr="select * from email_list where email_comp_id=" & Session("DC_Manage_CompanyID")
if Session("DC_Manage_DepartmentID")<>0 then
	sqlstr=sqlstr & " and email_dep_id=" & Session("DC_Manage_DepartmentID")
elseif len(bm)<>0 then
	sqlstr=sqlstr & " and email_dep_id=" & bm
end if

'response.write "sqlstr=" & sqlstr
'response.end
'if type_id>0 then sqlstr=sqlstr & " and p.type_id=" & type_id

if keyword<>"" then
          sqlstr=sqlstr & " and ("
          sqlstr=sqlstr & "email like '%" & keyword & "%' or email_user like '%" & keyword & "%' or email_mob like '%" & keyword & "%' or email_tel like '%" & keyword & "%' or email_fax like '%" & keyword & "%' or email_company like '%" & keyword & "%' or email_address like '%" & keyword & "%' or email_user like '%" & keyword & "%'"
          sqlstr=sqlstr & ")" 
end if
sqlstr=sqlstr & " order by email_id desc"

'Response.Write sqlstr
'Response.End 

'survey=ObjDCW.read_record(D_data,DataPathFile,"A_Manage_Department","A_M_D_ID,A_M_D_Name,A_M_D_Manager,A_M_D_Exp"," order by A_M_D_ID")'读出记录,结果保存在D_data数组中

set myrs=server.CreateObject("adodb.recordset")              
myrs.Open sqlstr,dbconn,1,1

%>    
    <tr bgcolor="#ffffff"> 
      <td align="center" class=p14 height=80> 
        <%if myrs.RecordCount=0 then%>
         没有找到<b><%=keyword%></b>相关Email!<a href="javascript:history.back();"><span class=p14>返回</span></a>
        <%else
          myrs.PageSize=10'每页显示的记录数
          total_page=myrs.PageCount
          total_red=myrs.RecordCount 
          current_page=Request.Form("me_page")
                  
          if current_page="" then
              current_page=1
          elseif not isnumeric(current_page) then
              current_page=1
          else
              current_page=cint(current_page)
          end if

          if current_page>total_page then 
              current_page=total_page
          elseif current_page<1 then
              current_page=1
          end if
                  
          myrs.AbsolutePage=current_page
          
          '加入的返回代码！
          Response.Cookies("back_page")=current_page
          Response.Cookies("back_keyword")=keyword
          Response.Cookies("back_catalogid")=s_catalogid
          Response.Cookies("back_type_id")=type_id
          'Response.Cookies("back_ver")=current_ver
  
      %>
        <table border="0" cellpadding="0" cellspacing="0" class="p9" width="100%">
          <form name="frm_list" method="post">
          <%if keyword<>"" then%>
          <tr align="left"> 
            <td height="26" >&nbsp;以下是与关键字<font color=red><%=keyword%></font>有关的Email列表</td>
          </tr>
          <%end if%>
          <tr align=center><td>
  <table border="1" cellpadding="2" cellspacing="0" class="p9" bordercolor="#99ccff" bordercolordark="#FFFFFF" bordercolorlight="#99ccff" width="100%">
          <tr> 
          <td width="4%" align="center" bgcolor="#99ccff" > 
            <input type="checkbox" name="check_all" value="1" onClick="select_ok();">          </td>
          <td width="27%" bgcolor="#99ccff"><b>邮箱地址</b></td>
          <td width="10%" align="center" bgcolor="#99ccff">联系人</td>
          <td width="38%" align="center" bgcolor="#99ccff">单位/地址/手机/电话/传真</td>
          <td width="10%" align="center" bgcolor="#99ccff">部门</td>
          <td width="11%" align="center" bgcolor="#99ccff">是否公开？</td>
          </tr>       
          <%For j = 1 to myrs.PageSize%>
          <tr height="26"> 
            <td width="4%" align="center" > 
              <input type="checkbox" name="productid" value="<%=myrs("email_id")%>">            </td>
            <td><%response.write myrs("email")%></td>
            <td align="center">&nbsp;<%=myrs("email_user")%></td>
            <td align="center"><%response.write myrs("email_company") & "/" & myrs("email_address") & "/" & myrs("email_mob") & "/" & myrs("email_tel") & "/" & myrs("email_fax")%></td>
            <td align="center"><%=myrs("email_dep_id")%></td>
            <td align="center">
            <%if myrs("email_gk")=true then
				response.write "公开"
			else
				response.write "不公开"
			end if%></td>
            </tr>
          <%myrs.MoveNext
          If myrs.EOF Then Exit For
        next
        %>
        </table>
        </td></tr>
          <tr align="center"> 
            <td height="50">
            <input type="hidden" name="catalogid" value=<%=catalogid%>>
             <!-- <input type="button" value="发送问卷" name=button_22 class="p9" style="WIDTH: 100px; HEIGHT: 24px;" size=134>
              -->
              <input type="button" value="修改" name=button_22 class="p9" style="WIDTH: 108px; HEIGHT: 24px;" size=134 onClick="javascript:add_to_edit();">
　              
<input type="button" value="设置成公开" name=button_22 class="p9" style="WIDTH: 100px; HEIGHT: 24px;" size=134 onClick="javascript:turn_to_edit();">
              　
              <input type="button" value="删除" name=button_21 class="p9" style="WIDTH: 80px; HEIGHT: 24px;" size=134 onClick="javascript:del_to();">
              　
              <input type="button" value="全选" name=button_select class="p9" style="WIDTH: 80px; HEIGHT: 24px;" size=134 onClick="javascript:select_change();">
            </td>
          </tr>
          </form>          
        </table>        
      </td>
  </tr>   
      <tr height="24" bgcolor="#f0f0f0"> 
            <td> 
              <div align="center"><strong>分页显示:</strong> <font color=red>第<%=current_page%>页/总<%=total_page%>页 
                | 总<%=total_red%>个</font> 
                <%call showpage%>
                　　转到第 
                <input type="text" name="goto_page1" value="<%=current_page%>" style="border: 1px solid rgb(200,200,200)" size=4 maxlength=4>
                页 
                <input style="height:20;WIDTH: 42px;" class="s02" hideFocus type="button" value="GoTo" name="cmd_goto" onClick="javascript:viewPage(document.all.goto_page1.value);">              
              <form action="survey_list.asp" method=post name="frm_page">
              <input type="hidden" name="me_page">
              <input type="hidden" name="catalogid" value=<%=s_catalogid%>>
              <input type="hidden" name="keyword" value=<%=keyword%>>
              <input type="hidden" name="type_id" value=<%=type_id%>>
              </form>
              </div>
            </td>
  </tr>
    <!--#include file="include/showpage.asp"-->
    <%end if%> 
</table>
<%myrs.Close
set myrs=nothing
dbconn.close
set dbconn=nothing%>
<br>
</body>
</html>