
<!--#include file="../inc/conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim ID,rsDown

ID=trim(request("ID"))
if ID="" then 
	response.Redirect("Download.asp")
end if
sql="select * from Download where ID=" & ID & ""
Set rsDown= Server.CreateObject("ADODB.Recordset")
rsDown.open sql,conn,1,1
if FoundErr=True then
	call WriteErrMsg()
else
%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass_down order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;
  // 当上传图片等文件时，往下拉框中填入图片路径，可根据实际需要更改此函数
  function doChange(objText, objDrop){
    if (!objDrop) return;
    var str = objText.value;
    var arr = str.split("|");
    var nIndex = objDrop.selectedIndex;
    objDrop.length=1;
    for (var i=0; i<arr.length; i++){
      objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
    }
    objDrop.selectedIndex = nIndex;
  }
  
function changelocation(locationid)
    {
    document.myform.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    

</script>
<!-- #include file="Inc/Head.asp" -->
<BR>
<table cellpadding="2" cellspacing="1" border="0" width="610" align="center" class="border">
	<tr>
		<td class="topbg" height="25" align="center"><strong>修 改 下 载</strong></td>
	</tr>
	<tr>
		<td align="center">
			<form method="POST" name="myform"  action="Download_Save.asp?action=Modify">
			  <table width="100%"  border="0" cellpadding="2" cellspacing="1" class="a3">
                <tr>
                  <td width="155" height="22" align="right"  class="tdbgl">所属栏目：</td>
                  <td colspan="2"  class="tdbg"><%
if session("purview")=3 or session("purview")=4 then
	response.write rsDown("BigClassName") & "<input name='BigClassName' type='hidden' value='" & rsDown("BigClassName") & "'>&gt;&gt;"
else		
			sql = "select * from BigClass_down"
			rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.write "请先添加栏目。"
	else
%>
                      <select name="BigClassName" 
onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
                        <%
do while not rs.eof
%>
                        <option <% if rs("BigClassName")=rsDown("BigClassName") then response.Write("selected") end if%> 
value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                        <%
rs.movenext
loop
end if
rs.close
%>
                      </select>
                      <%
end if
if session("purview")=4 then
	response.write rsDown("SmallClassName") & "<input name='SmallClassName' type='hidden' value='" & rsDown("SmallClassName") & "'>"
else
%>
                      <select name="SmallClassName">
                        <option value="" <%if rsDown("SmallClassName")="" then response.write "selected"%>>不指定小类</option>
                        <%
sql="select * from SmallClass_down where BigClassName='" & rsDown("BigClassName") & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
do while not rs.eof
%>
                        <option <% if rs("SmallClassName")=rsDown("SmallClassName") then response.Write("selected") end if%> 
value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                        <%
rs.movenext
loop
end if
rs.close
%>
                      </select>
                  <%
end if
%>                  </td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">标题名称：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="Title" id="Title" value="<%=trim(rsDown("Title"))%>" size="50" maxlength="80">
                  <font color="#FF0000">*</font></td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">文件大小：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="FileSize" id="FileSize" value="<%=trim(rsDown("FileSize"))%>" size="50" maxlength="80">
                  <FONT color=#ff0000>*</FONT> （带单位，例如：256KB或23.5MB）</td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">软件语言：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="Language" id="Language" value="<%=trim(rsDown("Language"))%>" size="50" maxlength="80">
                  <font color="#FF0000">*</font></td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">授权类型：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="Softclass" id="Softclass" value="<%=trim(rsDown("Softclass"))%>" size="50" maxlength="80">
                  <font color="#FF0000">*</font></td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">运行环境：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="System" id="System" value="<%=trim(rsDown("System"))%>" size="50" maxlength="80">
                  <font color="#FF0000">*</font></td>
                </tr>
                <tr >
                  <td width="155" height="25" align="right"  class="tdbgl">软件简介：</td>
                  <td colspan="2" align="right" valign="middle" class="tdbg"><div align="left">
                      <textarea name="Content" style="display:none">
<%if rsDown("html")=false then
Content=replace(rsDown("Content"),"<br>",chr(13))
Contentt=replace(Content,"&nbsp;"," ")
else
Content=rsDown("Content")
end if
response.write Content%><%=Server.HTMLEncode(rsDown("Content"))%></textarea>
              </textarea>
                     <iframe id="eWebEditor1" src="Editor/ewebeditor.asp?id=content&style=download&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" height="450"></iframe>
                  </div></td>
                </tr>
                <tr>
                  <td height="25" align="right"  class="tdbgl">图片地址：
                    <input type=hidden name=UploadFiles onChange="doChange(this,document.myform.DefaultPicList)"></td>
                  <td  class="tdbg"><input name="PhotoUrl" type="text" id="PhotoUrl" value="<%=rsDown("PhotoUrl")%>" size="50" maxlength="180">
                      <br>
                    首页的图片,直接从上传图片中选择：
                    <select name="DefaultPicList" id="DefaultPicList" onChange="PhotoUrl.value=this.value;">
                      <option value="" selected>不指定首页图片</option>
                      <%
if rsDown("UploadFiles")<>"" then
	dim IsOtherUrl
	IsOtherUrl=True
	if instr(rsDown("UploadFiles"),"|")>1 then
		dim arrUploadFiles,intTemp
		arrUploadFiles=split(rsDown("UploadFiles"),"|")						
		for intTemp=0 to ubound(arrUploadFiles)
			if rsDown("PhotoUrl")=arrUploadFiles(intTemp) then
				response.write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
				IsOtherUrl=False
			else
				response.write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
			end if
		next
	else
		if rsDown("UploadFiles")=rsDown("PhotoUrl") then
			response.write "<option value='" & rsDown("UploadFiles") & "' selected>" & rsDown("UploadFiles") & "</option>"
			IsOtherUrl=False
		else
			response.write "<option value='" & rsDown("UploadFiles") & "'>" & rsDown("UploadFiles") & "</option>"		
		end if
	end If
	if IsOtherUrl=True then
		response.write "<option value='" & rsDown("PhotoUrl") & "' selected>" & rsDown("PhotoUrl") & "</option>"
	end if
end if
%>
                    </select></td>
                  <td  class="tdbg"><iframe style="top:2px" id="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=0" frameborder=0 scrolling=no width="320" height="25"></iframe></td>
                </tr>
                <tr>
                  <td width="155" align="right"  class="tdbgl">下载地址二</td>
                  <td width="306" height="25"  class="tdbg"><input type="text" name="DownloadUrl" id="DownloadUrl" value="<%=trim(rsDown("DownloadUrl"))%>" size="40" maxlength="120">                  </td>
                  <td width="364"  class="tdbg"><iframe style="top:2px" id="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=1" frameborder=0 scrolling=no width="320" height="25"></iframe></td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">已通过审核：</td>
                  <td colspan="2"  class="tdbg"><input type="checkbox" name="Passed" id="Passed" value="yes" <% if rsDown("Passed")=true then response.Write("checked") end if%>>
                  <font color="#0000FF">（如果选中的话将直接发布）</font></td>
                </tr>
                <tr>
                  <td width="155" height="25" align="right"  class="tdbgl">下载推荐：</td>
                  <td colspan="2"  class="tdbg"><input type="checkbox" name="Elite" id="Elite" value="yes" <% if rsDown("Elite")=true then response.Write("checked") end if%>>
                  <font color="#0000FF">（是否设为推荐）</font></td>
                </tr>
                <tr>
                  <td width="155" height="12" align="right"  class="tdbgl">加入时间：</td>
                  <td colspan="2"  class="tdbg"><input type="text" name="AddDate" id="AddDate" value="<%=trim(rsDown("AddDate"))%>" maxlength="50">
                  当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
                <tr>
                  <td width="155" height="12" align="right"  class="tdbgl">&nbsp;</td>
                  <td colspan="2"  class="tdbg"><input name="ID" type="hidden" id="ID" value="<%=rsDown("ID")%>">
                      <input name="Save" type="submit"  id="Save" value="保存修改结果" >
                    &nbsp;
                  <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Download.asp'"  ></td>
                </tr>
              </table>
			</form>
		</td>
	</tr>
</table>
<BR>
<%
end if
rsDown.close
set rsDown=nothing
call CloseConn()
%><!-- #include file="Inc/foot.asp" -->