global_ftpsetting.aspx
上传用户:wenllgg125
上传日期:2020-04-09
资源大小:7277k
文件大小:8k
源码类别:

SCSI/ASPI

开发平台:

Others

  1. <%@ Register TagPrefix="cc1" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
  2. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="global_ftpsetting.aspx.cs" Inherits="Discuz.Web.Admin.ftpsetting" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head runat="server">
  6. <title>远程附件设置</title>
  7. <link href="../styles/tab.css" type="text/css" rel="stylesheet" />
  8. <link href="../styles/colorpicker.css" type="text/css" rel="stylesheet" />
  9. <script type="text/javascript" src="../js/common.js"></script>
  10. <link href="../styles/dntmanager.css" type="text/css" rel="stylesheet" />
  11. <link href="../styles/modelpopup.css" type="text/css" rel="stylesheet" />
  12. <script type="text/javascript" src="../js/AjaxHelper.js"></script>
  13. <script type="text/javascript" src="../js/modalpopup.js"></script>
  14. <script type="text/javascript">
  15. function ShowFtpLayout(ischecked)
  16. {
  17. document.getElementById("FtpLayout").style.display = ischecked ? "block" : "none";
  18. }
  19. function validate(thisform)
  20. {
  21. document.getElementById("success").style.display = "block";
  22. var remoteurl = document.getElementById("Remoteurl").value;
  23. var uploadpath = document.getElementById("Uploadpath").value;
  24. if(uploadpath.lastIndexOf("/") == uploadpath.length - 1)
  25. {
  26. resetpage();
  27. alert("附件保存路径非法,不能以“/”结尾");
  28. return false;
  29. }
  30. if(remoteurl.substring(0,7).toLowerCase() != "http://" ||
  31.    remoteurl.lastIndexOf("/") == remoteurl.length - 1)
  32. {
  33. resetpage();
  34. alert("远程访问 URL 非法!不是以“http://”开头或是以“/”结尾");
  35. return false;
  36. }
  37. //            if(remoteurl.indexOf(uploadpath) == -1)
  38. //            {
  39. //                resetpage();
  40. //                alert("远程访问 URL 未以“附件保存路径”结尾");
  41. //                return false;
  42. //            }
  43. if(document.getElementById("Allowupload_0").checked)
  44. {
  45. var result = TestFtp();
  46. if(result != "ok")
  47. {
  48. resetpage();
  49. ShowFtpLayout(false);
  50. document.getElementById("Allowupload_1").checked = true;
  51. alert("无法链接FTP,不能保存设置!");
  52. return false;
  53. }
  54. }
  55. return true;
  56. }
  57. function resetpage()
  58. {
  59. document.getElementById("success").style.display = "none";
  60. document.getElementById("SaveFtpInfo").disabled = false;
  61. }
  62. function TestFtp()
  63. {
  64. var serveraddress = document.getElementById("Serveraddress").value;
  65. var serverport = document.getElementById("Serverport").value;
  66. var username = document.getElementById("Username").value;
  67. var password = document.getElementById("Password").value;
  68. var timeout = document.getElementById("Timeout").value;
  69. var uploadpath = document.getElementById("Uploadpath").value;
  70. var url = "serveraddress="+serveraddress+"&serverport="+serverport+"&username="+username+"&password="+password.replace(/+/g,"%2B");
  71. url += "&timeout="+timeout+"&uploadpath="+uploadpath;
  72. var result = getReturn('global_ajaxcall.aspx?opname=ftptest&' + url);
  73. return result;
  74. }
  75. function TestFtp_Click()
  76. {
  77. document.getElementById("TestFtpButton").disabled = true;
  78. var result = TestFtp();
  79. if(result == "ok")
  80. {
  81. alert("远程附件设置测试通过!");
  82. }
  83. else
  84. {
  85. alert(result);
  86. }
  87. document.getElementById("TestFtpButton").disabled = false;
  88. }
  89. </script>
  90. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  91. </head>
  92. <body>
  93. <div class="ManagerForm">
  94. <form id="Form1" method="post" runat="server">
  95. <fieldset>
  96. <legend style="background:url(../images/icons/icon56.jpg) no-repeat 6px 50%;">远程附件设置</legend>
  97. <table width="100%">
  98. <tr><td class="item_title" colspan="2">启用远程附件</td></tr>
  99. <tr>
  100. <td class="vtop rowform">
  101. <cc1:RadioButtonList ID="Allowupload" runat="server" RepeatColumns="2">
  102. <asp:ListItem Value="1">是</asp:ListItem>
  103. <asp:ListItem Value="0" Selected="true">否</asp:ListItem>
  104. </cc1:RadioButtonList>
  105. </td>
  106. <td class="vtop"></td>
  107. </tr>
  108. </table>     
  109. <div id="FtpLayout" runat="server">
  110. <table width="100%">
  111. <tr><td class="item_title" colspan="2">FTP服务器</td></tr>
  112. <tr>
  113. <td class="vtop rowform">
  114. <cc1:TextBox id="Serveraddress" runat="server" RequiredFieldType="暂无校验" CanBeNull="必填" Width="170"></cc1:TextBox>
  115. </td>
  116. <td class="vtop">可以是 FTP 服务器的 IP 地址或域名</td>
  117. </tr>
  118. <tr><td class="item_title" colspan="2">FTP端口</td></tr>
  119. <tr>
  120. <td class="vtop rowform">
  121. <cc1:TextBox id="Serverport" runat="server" MinimumValue="1" CanBeNull="必填" size="7" maxlength="5" Text="21"></cc1:TextBox>
  122. </td>
  123. <td class="vtop">默认为 21</td>
  124. </tr>
  125. <tr><td class="item_title" colspan="2">用户名</td></tr>
  126. <tr>
  127. <td class="vtop rowform">
  128. <cc1:TextBox id="Username" runat="server" CanBeNull="必填" Width="170"></cc1:TextBox>
  129. </td>
  130. <td class="vtop">该帐号必需具有以下权限:读取文件 写入文件 删除文件 创建目录 子目录继承</td>
  131. </tr>
  132. <tr><td class="item_title" colspan="2">密  码</td></tr>
  133. <tr>
  134. <td class="vtop rowform">
  135. <cc1:TextBox id="Password" TextMode="password" runat="server" RequiredFieldType="暂无校验" CanBeNull="必填" Width="170"></cc1:TextBox>
  136. <input type="hidden" id="hiddpassword" runat="server" />
  137. </td>
  138. <td class="vtop"></td>
  139. </tr>
  140. <tr><td class="item_title" colspan="2">超时时间(秒)</td></tr>
  141. <tr>
  142. <td class="vtop rowform">
  143. <cc1:TextBox ID="Timeout" runat="server" CanBeNull="必填" MinimumValue="0" Width="100" Text="10"></cc1:TextBox>
  144. </td>
  145. <td class="vtop">单位:秒,10 为服务器默认.0为不受超时时间限制.</td>
  146. </tr>
  147. <tr><td class="item_title" colspan="2">附件保存路径</td></tr>
  148. <tr>
  149. <td class="vtop rowform">
  150.  <cc1:TextBox ID="Uploadpath" runat="server" CanBeNull="必填" RequiredFieldType="暂无校验" Width="170" Text="forumattach/"></cc1:TextBox>
  151. </td>
  152. <td class="vtop">远程附件目录的绝对路径或相对于 FTP 主目录的相对路径,结尾不要加斜杠"/","."表示 FTP 主目录</td>
  153. </tr>
  154. <tr><td class="item_title" colspan="2">远程访问 URL</td></tr>
  155. <tr>
  156. <td class="vtop rowform">
  157. <cc1:TextBox ID="Remoteurl" runat="server" CanBeNull="必填" Width="200"></cc1:TextBox>
  158.         <div stylle="margin:4px 0;"><button type="button" class="ManagerButton" id="TestFtpButton" onclick="TestFtp_Click()"><img src="../images/submit.gif" /> 测试远程附件设置 </button></div>
  159. </td>
  160. <td class="vtop">仅支持 HTTP 协议,结尾不要加斜杠"/";<br/>例如上传的文件是"1.jpg", 则最终远程链接为<br/>"http://远程访问URL/1.jpg"</td>
  161. </tr>
  162. <tr><td class="item_title" colspan="2">是否保留本地附件</td></tr>
  163. <tr>
  164. <td class="vtop rowform">
  165. <cc1:RadioButtonList ID="Reservelocalattach" runat="server" RepeatColumns="2" Width="20%">
  166. <asp:ListItem Value="1">是</asp:ListItem>
  167. <asp:ListItem Selected="true" Value="0">否</asp:ListItem>
  168. </cc1:RadioButtonList>
  169. </td>
  170. <td class="vtop"></td>
  171. </tr>
  172. </table>
  173. </div>
  174. <div class="Navbutton">
  175. <cc1:Button id="SaveFtpInfo" runat="server" Text=" 提 交 " OnClick="SaveFtpInfo_Click" ValidateForm="true"></cc1:Button>
  176. </div>         
  177. </fieldset>
  178. <cc1:Hint ID="Hint1" runat="server" HintImageUrl="../images"></cc1:Hint>
  179. <div style="display:none">
  180. <tr><td class="item_title" colspan="2">FTP模式</td></tr>
  181. <tr>
  182. <td class="vtop rowform">
  183. <cc1:RadioButtonList ID="Mode" runat="server" RepeatColumns="2" Width="96%">
  184. <asp:ListItem Value="1" Selected="true">被动模式</asp:ListItem>
  185. <asp:ListItem Value="2">主动模式</asp:ListItem>
  186. </cc1:RadioButtonList>
  187. </td>
  188. <td class="vtop"></td>
  189. </tr>
  190. </div>
  191. </form>
  192. </div>
  193. <script type="text/javascript">document.getElementById("Password").value = document.getElementById("hiddpassword").value;</script>
  194. <% =footer %>
  195. </body>
  196. </html>