<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Download_Add.aspx.cs" Inherits="TotCms.Web.Admin.Download_Add" ValidateRequest="false" %>

<%@ Register src="UI/main_top.ascx" tagname="main_top" tagprefix="uc1" %>

<%@ Register assembly="TotCms.Controls" namespace="TotCms.Controls" tagprefix="cc1" %>

<!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 id="Head1" runat="server">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>添加下载</title>
    <link href="style/global.css" rel="stylesheet" type="text/css" />
    <script src="js/xmlhttp.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="../js/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="../js/jquery-ui-1.8.10/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
    <link href="../js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
      $(function () {
        $("#dialog:ui-dialog").dialog("destroy");
        $("#dialog-win").dialog({
          autoOpen: false,
          width: 530,
          height: 250,
          modal: true,
          close: function () {

          }
        });
      });
      function Upload_Open() {
        $("#dialog-win").dialog("open");
        document.getElementById('win_frame').src = 'Upload.aspx';
        $("#dialog-win").dialog('option', 'title', '上传图片');
      }
      function CloseFrame() {
        $("#dialog-win").dialog("close");
      }
</script>
    <script type="text/javascript">
    function setDownUrls(elem)
    {
      var checkOK = ".0123456789";
      var checkStr = elem.value;
      var allValid = true;
      var decPoints = 0;
      var allNum = "";
      for (i = 0;  i < checkStr.length;  i++)
      {
	        ch = checkStr.charAt(i);
	        for (j = 0;  j < checkOK.length;  j++)
  	        if (ch == checkOK.charAt(j))
            break;
	        if (j == checkOK.length)
	        {
  		        allValid = false;
  		        break;
	        }
      }
      if (!allValid)
      {
	        alert("只能输入数字。");
	        elem.focus();
	        elem.select();
	        return (false);
      }else{
        var div_urs=document.getElementById('Div_DownUrl');
        var w_str='';
        var d_options='';	
        for(var i=1;i<=parseInt(checkStr);i++){
	        //if(document.getElementById('DownServer'+i)==null){
		        w_str=w_str+'选择下载点：<select name="DownServer'+i+'" id="DownServer'+i+'"><%=GetDownloadServerOptionsJS()%></select>&nbsp;下载名称：<input type="text" name="DownTitle'+i+'" value="下载地址'+i+'" />&nbsp;文件路径：<input type="text" name="FileName'+i+'" id="FileName'+i+'" /><input name="UpLoad" type="button" id="UpLoad" value="上传" onclick="popupWindow(\'BigFileUpload.aspx?rid=FileName'+i+'\',\'UpLoad\',420,230,1)" /><br />';
	        //}
        }
        div_urs.innerHTML=w_str;
      }
      return (true);
    }
    </script>  
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
      <uc1:main_top ID="main_top1" runat="server" />
    
    </div>
    <table style="width:100%;" border="0" cellpadding="0" cellspacing="1" 
      class="black_border">
      <tr class="suphead">
        <td colspan="2">
                                        添加下载</td>
    </tr>
    <tr>
      <td class="fields_text" width="100">
        选择栏目：</td>
      <td class="fields_input">
          <asp:Label ID="CategoryTitle" runat="server" CssClass="category"></asp:Label>
          &lt;&lt;-提示：点击左侧“栏目导航”中的栏目名称来选择。
     </td>
    </tr>
    <tr>
      <td class="fields_text">
          软件名称：</td>
      <td class="fields_input">
        <asp:TextBox ID="Title" runat="server" CssClass="input_middle"></asp:TextBox>
          &nbsp; 字母索引：&nbsp; 
          <asp:DropDownList ID="SoftChar" runat="server" CssClass="select">
              <asp:ListItem>a</asp:ListItem>
              <asp:ListItem>b</asp:ListItem>
              <asp:ListItem>c</asp:ListItem>
              <asp:ListItem>d</asp:ListItem>
              <asp:ListItem>e</asp:ListItem>
              <asp:ListItem>f</asp:ListItem>
              <asp:ListItem>g</asp:ListItem>
              <asp:ListItem>h</asp:ListItem>
              <asp:ListItem>i</asp:ListItem>
              <asp:ListItem>j</asp:ListItem>
              <asp:ListItem>k</asp:ListItem>
              <asp:ListItem>l</asp:ListItem>
              <asp:ListItem>m</asp:ListItem>
              <asp:ListItem>n</asp:ListItem>
              <asp:ListItem>o</asp:ListItem>
              <asp:ListItem>p</asp:ListItem>
              <asp:ListItem>q</asp:ListItem>
              <asp:ListItem>r</asp:ListItem>
              <asp:ListItem>s</asp:ListItem>
              <asp:ListItem>t</asp:ListItem>
              <asp:ListItem>u</asp:ListItem>
              <asp:ListItem>v</asp:ListItem>
              <asp:ListItem>w</asp:ListItem>
              <asp:ListItem>x</asp:ListItem>
              <asp:ListItem>y</asp:ListItem>
              <asp:ListItem>z</asp:ListItem>
          </asp:DropDownList>
          <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
              ControlToValidate="Title" ErrorMessage="软件名称不能为空"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
      <td class="fields_text">
          关键字：</td>
      <td class="fields_input">
        <asp:TextBox ID="SoftKey" runat="server" CssClass="input_middle"></asp:TextBox>
          据此查找相关下载</td>
    </tr>
    <tr>
      <td class="fields_text">
          版本：</td>
      <td class="fields_input">
        <asp:TextBox ID="SoftVersion" runat="server" CssClass="input_middle"></asp:TextBox>
          &nbsp;</td>
    </tr>
    <tr>
      <td class="fields_text">
          语言：</td>
      <td class="fields_input">
          <asp:RadioButtonList ID="SoftLanguage" runat="server" 
              RepeatDirection="Horizontal" RepeatLayout="Flow">
              <asp:ListItem Selected="True">简体中文</asp:ListItem>
              <asp:ListItem>繁体中文</asp:ListItem>
              <asp:ListItem>英文</asp:ListItem>
              <asp:ListItem>多国语言</asp:ListItem>
          </asp:RadioButtonList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
          软件许可：</td>
      <td class="fields_input">
          <asp:RadioButtonList ID="SoftLicense" runat="server" 
              RepeatDirection="Horizontal" RepeatLayout="Flow">
              <asp:ListItem Selected="True">共享版</asp:ListItem>
              <asp:ListItem>免费版</asp:ListItem>
              <asp:ListItem>商业版</asp:ListItem>
              <asp:ListItem>试用版</asp:ListItem>
          </asp:RadioButtonList>
        </td>
    </tr>
    <tr>
      <td class="fields_text">
          软件属性：</td>
      <td class="fields_input">
          <asp:RadioButtonList ID="SoftAttr" runat="server" RepeatDirection="Horizontal" 
              RepeatLayout="Flow">
              <asp:ListItem Selected="True">国产软件</asp:ListItem>
              <asp:ListItem>国外软件</asp:ListItem>
              <asp:ListItem>汉化补丁</asp:ListItem>
              <asp:ListItem>破解补丁</asp:ListItem>
          </asp:RadioButtonList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        缩略图：</td>
      <td class="fields_input">
        <asp:TextBox ID="Photo" runat="server" CssClass="input_middle"></asp:TextBox>
        <input name="UpLoad" type="button" id="UpLoad" value="上传" 
          onclick="Upload_Open()" class="btn-general" />
          </td>
    </tr>
    <tr>
      <td class="fields_text">
          软件大小：</td>
      <td class="fields_input">
          <asp:TextBox ID="SoftSize" runat="server" CssClass="input_normal"></asp:TextBox>
          <asp:RadioButtonList ID="SoftSizeUnit" runat="server" 
              RepeatDirection="Horizontal" RepeatLayout="Flow">
              <asp:ListItem Selected="True">KB</asp:ListItem>
              <asp:ListItem>MB</asp:ListItem>
              <asp:ListItem>GB</asp:ListItem>
          </asp:RadioButtonList>
          </td>
    </tr>
    <tr id="outLink1" style="display:none;">
      <td class="fields_text">
          星级：</td>
      <td class="fields_input">
          <asp:RadioButtonList ID="SoftStars" runat="server" RepeatDirection="Horizontal" 
              RepeatLayout="Flow">
              <asp:ListItem Selected="True" Value="5">★★★★★</asp:ListItem>
              <asp:ListItem Value="4">★★★★</asp:ListItem>
              <asp:ListItem Value="3">★★★</asp:ListItem>
              <asp:ListItem Value="2">★★</asp:ListItem>
              <asp:ListItem Value="1">★</asp:ListItem>
          </asp:RadioButtonList>
          </td>
    </tr>
    <tr id="outLink2">
      <td class="fields_text">
          运行环境：</td>
      <td class="fields_input">
          <asp:CheckBoxList ID="SoftOs" runat="server" RepeatDirection="Horizontal" 
              RepeatLayout="Flow">
              <asp:ListItem>Win9x</asp:ListItem>
              <asp:ListItem>win200</asp:ListItem>
              <asp:ListItem>win2003</asp:ListItem>
              <asp:ListItem>Linux</asp:ListItem>
              <asp:ListItem>Unix</asp:ListItem>
              <asp:ListItem>其它</asp:ListItem>
          </asp:CheckBoxList>
          </td>
    </tr>
    <tr id="outLink3">
      <td class="fields_text">
          软件开发商：</td>
      <td class="fields_input">
          <asp:TextBox ID="SoftAuthor" runat="server" CssClass="input_normal"></asp:TextBox>
          开发商网址：<asp:TextBox ID="SoftAuthorUrl" runat="server" CssClass="input_normal">http://</asp:TextBox>
          </td>
    </tr>
    <tr id="outLink3">
      <td class="fields_text">
          演示网址：</td>
      <td class="fields_input">
          <asp:TextBox ID="SoftDemoUrl" runat="server" CssClass="input_normal">http://</asp:TextBox>
          </td>
    </tr>
    <tr id="outLink4">
      <td class="fields_text" valign="top">内容：</td>
      <td class="fields_input">
        <asp:TextBox ID="Content" runat="server" CssClass="hidden" 
          TextMode="MultiLine">下载内容</asp:TextBox>
          <cc1:Editor ID="Editor1" runat="server" FieldName="Content" />
          </td>
    </tr>
    <tr>
      <td class="fields_text">
                    摘要：</td>
      <td class="fields_input">
        <asp:TextBox ID="Summary" runat="server" CssClass="text_normal" 
          TextMode="MultiLine"></asp:TextBox>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
          下载设置：</td>
      <td class="fields_input">
        <asp:DropDownList ID="IsNeedLogin" runat="server" CssClass="select">
          <asp:ListItem Value="0">开放下载</asp:ListItem>
          <asp:ListItem Value="1">仅会员下载</asp:ListItem>
        </asp:DropDownList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
          下载地址：</td>
      <td class="fields_input">
          <div align="left">设置下载地址数目
        <input name="DownUrlNum" id="DownUrlNum" type="text" value="1" size="6" 
              onBlur="setDownUrls(this)" class="input_mini" />
      </div>
      <div align="left" id="Div_DownUrl"></div>
      <script type="text/javascript">setDownUrls(document.getElementById('DownUrlNum'));</script>
      <div align="left">提示：软件的真实下载地址是由“下载点URL+文件路径”组合而成。</div>
    </td>
    </tr>
    <tr>
      <td class="fields_text">
          自定义字段：</td>
      <td class="fields_input">
      <div id="CustomFields" runat="server"></div>
      </td>
    </tr>
    <tr>
      <td></td>
      <td align="left" height="50">
        <asp:Button ID="Button1" runat="server" Text="添加下载" onclick="Button1_Click" 
          CssClass="btn-submit" />
        <input id="Button2" type="reset" value="取 消" class="btn-cancel" /></td>
    </tr>
  </table>
  <div id="dialog-win" title="window">
	  <iframe id="win_frame" name="win_frame" src="Blank.htm" width="500" height="170" frameborder="0"></iframe>	
  </div>
  <br />
    </form>
</body>
</html>
