<%Response.Expires=0%>
<!--#include file="../../dbconn.asp"-->
<%openDb DataPathFile
Set ObjDCW = Server.CreateObject("dc_data100_v1_0.C_A_Config")
%>
<html>
<head>
<title>盛维在线调查系统v9.0免费版--问卷目录管理</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">
</head>

<body bgcolor="#FFFFFF" leftMargin=0 marginwidth="0" topmargin=0>
<!--#include file="../../manage/checkuserflag.asp"-->
<%call CheckUserFlag("04")%>
<br>
<script language="javascript">
function add_sort(formName){
  if(formName.boardname.value==""){     
      alert("请输入问卷目录名!");
      formName.boardname.focus();
      return false;
      }
   else if(formName.root_sort.value=="A") {
		  alert("请选择所属！");
          formName.root_sort.focus();
          return false;
          }
   else if((formName.root_sort.value=="0")&&(formName.big_sort.value=="")) {
		  alert("请选择所属部门！");
          formName.root_sort.focus();
          return false;
          }
   else{
   return true;}
}


function edit_sort(formName){
  if(formName.type_id.value=="" || formName.sort_name.value==""){
      alert("请在问卷目录列表中选择要修改的问卷目录名!");
      return false;
      }
  else if(formName.old_boardname.value!=formName.sort_name.value){
      alert("请重新选择要修改的问卷目录名!");
      return false;
      }
  else if(formName.boardname.value==""){
      alert("请输入新问卷目录名!");
      formName.boardname.focus();
      return false;
      }
  else
      return true;
}

</script>
<script language="javascript">
function bao(s) 
{ 
	if(s==0){
	document.all.new_catalog.style.display=""; 
	//alert(s);
	}
	else{
	document.all.new_catalog.style.display="none"; 
	}
	//history.back(-1);
    //选择后,让第一项被选中,这样,就有Change啦. 
    //document.all.sel.options[0].selected=true; 
} 
</script> 
<table width="96%" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#f0f0f0">
  <tr> 
    <td height="25"><font face=webdings color="#215DC6">8</font> 
      <span style="font-size:14.9px"><b><font color="#215DC6">问卷目录管理</font></b></span></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="5" bordercolorlight="#000000" bordercolordark="#FFFFFF" class=p9 align="center">
        <tr> 
          <td height="206" align="center" class="p9" width="50%" valign="top"> 
            <table width="100%" border="0" cellspacing="2" cellpadding="2" class="p9" height="199">
              <tr> 
                <td height="22" bgcolor="#f0f0f0">　现有问卷目录列表：</td>
              </tr>
              <tr> 
                <td valign="top" align=center> 
                  <!--#include file="menutree.asp"-->
                </td>
              </tr>
            </table>
          </td>
          <td height="206" align="center" class="p9" valign="top" width="50%"> 
            <table width="100%" border="0" cellspacing="2" cellpadding="2" class="box" height="96">
              <form name="frm_add" method="post" action="sort_ok.asp?version=<%=current_ver%>" onSubmit="javascript:return add_sort(document.frm_add);">
                <tr> 
                  <td height="22" bgcolor="#f0f0f0">　新增问卷目录:</td>
                </tr>
                <tr> 
                  <td height="8">　目录名:　 
                    <input type="text" name="boardname" class=p9 style="width:230px;height:22px">                  </td>
                </tr>
                <tr> 
                  <td height="21">　所属于:　 
                    <select name="root_sort" class=p9 style="width:230px;height:22px" onChange="javascript:bao(this.options[this.options.selectedIndex].value);">
                      <option value="A" selected>---请选择目录---</option>
                      <option value="0">新建一级目录</option>
					  <%
					sql_str="where Catalog_company_id=" & Session("DC_Manage_CompanyID")
					if Session("DC_Manage_DepartmentID")<>0 then
						sql_str=sql_str & " and CatalogBig=" & Session("DC_Manage_DepartmentID")
					end if
					set myrs_root=server.CreateObject("adodb.recordset")
                    myrs_root.Open "select catalogID,catalogname,CatalogBig from DC_Title_catalog " & sql_str & " order by CatalogBig",dbconn,1,1
                do until myrs_root.EOF
                      '输出一级分类
					Response.Write "<option value=" & myrs_root("catalogid") & ">" & myrs_root("catalogname") & "("
					CatalogBig=myrs_root("CatalogBig")
					if CatalogBig<>"" then
						departM=ObjDCW.read_record(D_data_Dep,DataPathFile,"A_Manage_Department","A_M_D_Name"," where A_M_D_ID=" & CatalogBig)
						if departM=0 then
							response.write "-"
						else
							totalput = UBound(D_data_Dep)
							rs_dep=split(D_data_Dep(0),",")
							response.write rs_dep(0)
						end if
					end if
					response.write ")</option>"
					myrs_root.movenext
				loop
				myrs_root.Close 
				set myrs_root=nothing
                  %>
                    </select>                  </td>
                </tr>
                <tr  id="new_catalog" style="display:none">
                  <td height="2">　部　门:　 
				    <select name="big_sort" id="big_sort">
                <%
				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> <font color=red>*</font></td>
                </tr>         
                <tr> 
                  <td height="2">　操　作:　 
                    <input type="Submit" name="Submit4" value="新增" style="width:60px;height:22px" class=p9>
                    <input type="reset" name="Submit22" value="取消" style="width:60px;height:22px" class=p9>
                    <input type="hidden" name="sort_action" value="add_new">                  </td>
                </tr>
              </form>
            </table>
            <br>
            <table width="100%" border="0" cellspacing="2" cellpadding="2" class="box" height="84">
              <form name="frm_edit" method="post" action="sort_ok.asp?version=<%=current_ver%>" onSubmit="javascript:return edit_sort(document.frm_edit);">
                <tr> 
                  <td height="22" bgcolor="#f0f0f0">　修改问卷目录:</td>
                </tr>
                <tr> 
                  <td height="2">　原目录名: 
                    <input type="text" name="old_boardname" class=p9 style="width:230px;height:22px" readonly>
                  </td>
                </tr>
                <tr> 
                  <td height="2">　新目录名: 
                    <input type="text" name="boardname" class=p9 style="width:230px;height:22px">
                  </td>
                </tr>
                <tr> 
                  <td height="7">　操　作:　 
                    <input type="submit" name="Submit" value="修改" style="width:60px;height:22px" class=p9>
                    <input type="reset" name="Submit2" value="取消" style="width:60px;height:22px" class=p9>
                    <input type="hidden" name="type_id">
                    <input type="hidden" name="level_name">
                    <input type="hidden" name="sort_name">
                    <input type="hidden" name="sort_action" value="edit">
                  </td>
                </tr>
              </form>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td height="10"></td>
  </tr>
</table>
<br>
</body>
</html>