SelectFile.aspx
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:10k
源码类别:

OA系统

开发平台:

C#

  1. <%@ Page Language="C#" Inherits="CuteEditor.Dialogs.FileBrowserPage" %>
  2. <%@ Register TagPrefix="CE" Assembly="CuteEditor" Namespace="CuteEditor" %>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <script runat="server">
  6. override protected void OnInit(EventArgs args)
  7. {
  8. if(Context.Request.QueryString["IsFrame"]==null)
  9. {
  10. string FrameSrc="SelectFile.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  11. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[Browse]]",FrameSrc);
  12. Context.Response.End();
  13. }
  14. base.OnInit(args);
  15. }
  16. </script>
  17. <title></title>
  18. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)" />
  19. <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.1)" />
  20. <link href="Load.ashx?type=style&amp;file=dialog.css" type="text/css" rel="stylesheet" />
  21. <!--[if IE]>
  22. <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
  23. <![endif]-->
  24. <script type="text/javascript" src="Load.ashx?type=dialogscript&amp;file=DialogHead.js"></script>
  25. <script type="text/javascript">
  26. var OxO6543=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  27. </script>
  28. <style type="text/css">
  29. .row { HEIGHT: 22px }
  30. .cb { VERTICAL-ALIGN: middle }
  31. .itemimg { VERTICAL-ALIGN: middle }
  32. .editimg { VERTICAL-ALIGN: middle }
  33. .cell1 { VERTICAL-ALIGN: middle }
  34. .cell2 { VERTICAL-ALIGN: middle }
  35. .cell3 { PADDING-RIGHT: 4px; VERTICAL-ALIGN: middle; TEXT-ALIGN: right }
  36. .cb { }
  37. </style>
  38. </head>
  39. <body>
  40. <form runat="server" enctype="multipart/form-data" id="Form1">
  41. <!-- start hidden -->
  42. <input type="hidden" runat="server" id="hiddenDirectory" name="hiddenDirectory" />
  43. <input type="hidden" runat="server" id="hiddenFile" name="hiddenFile" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
  44. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange"
  45. name="hiddenAction" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
  46. <!-- end hidden -->
  47. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  48. <tr>
  49. <td style="width:20">
  50. <asp:Image id="Image1" Runat="server" ImageUrl="Load.ashx?type=image&amp;file=openfolder.gif"></asp:Image>
  51. </td>
  52. <td style="width:240px; white-space:nowrap" class="normal">
  53. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  54. </td>
  55. <td style="text-align:center; width:100%" >
  56. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]"
  57. ImageUrl="Load.ashx?type=image&amp;file=newfolder.gif" onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);"
  58. Visible="true" OnClick="CreateDir_Click" />
  59. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="Load.ashx?type=image&amp;file=Copy.gif"
  60. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Copy_Click" />
  61. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="Load.ashx?type=image&amp;file=move.gif"
  62. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Move_Click" />
  63. <img src="Load.ashx?type=image&amp;file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]"
  64. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  65. <img src="Load.ashx?type=image&amp;file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]"
  66. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  67. </td>
  68. </tr>
  69. </table>
  70. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  71. <tr>
  72. <td valign="top" style="white-space:nowrap;width:250">
  73. <div style="BORDER-RIGHT: 1.5pt inset; BORDER-TOP: 1.5pt inset; VERTICAL-ALIGN: middle; OVERFLOW: auto; BORDER-LEFT: 1.5pt inset; WIDTH: 250px; BORDER-BOTTOM: 1.5pt inset; HEIGHT: 240px; BACKGROUND-COLOR: white">
  74. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="1" Width="100%"
  75. CssClass="sortable">
  76. <asp:TableRow BackColor="#f0f0f0">
  77. <asp:TableHeaderCell Width="16px">
  78. <asp:ImageButton id="Delete" Runat="server" AlternateText="Delete the selected files/directories"
  79. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" ImageUrl="Load.ashx?type=image&file=s_cut.gif"
  80. Visible="true" OnClick="Delete_Click" />
  81. </asp:TableHeaderCell>
  82. <asp:TableHeaderCell Width="16px">
  83. <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="Load.ashx?type=image&file=s_refresh.gif"
  84. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="DoRefresh_Click" />
  85. </asp:TableHeaderCell>
  86. <asp:TableHeaderCell id="name_Cell" Width="136px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  87. <asp:TableHeaderCell id="size_Cell" Width="72px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  88. <asp:TableHeaderCell id="op_Cell" Width="16px">&nbsp;</asp:TableHeaderCell>
  89. </asp:TableRow>
  90. </asp:Table>
  91. </div>
  92. </td>
  93. <td style="width:10">
  94. </td>
  95. <td valign="top">
  96. <div style="padding:0; BORDER: 1.5pt inset; VERTICAL-ALIGN: top; OVERFLOW: auto; WIDTH: 280px; BORDER-BOTTOM: 1.5pt inset; HEIGHT: 240px; BACKGROUND-COLOR: white; TEXT-ALIGN: left">
  97. <div id="divpreview" style="BACKGROUND-COLOR: white">
  98. &nbsp;</div>
  99. </div>
  100. </td>
  101. </tr>
  102. </table>
  103. <div style="text-align:center">
  104. <table border="0" cellspacing="2" cellpadding="0" width="98%">
  105. <tr>
  106. <td valign="top">
  107. <fieldset style="width:98%;">
  108. <legend>
  109. [[Insert]]</legend>
  110. <table border="0" cellpadding="5" cellspacing="0">
  111. <tr>
  112. <td>
  113. <table id="Table8" cellspacing="0" cellpadding="2" border="0" class="normal">
  114. <tr>
  115. <td valign="middle">[[Url]]:</td>
  116. <td>
  117.     <input type="text" id="TargetUrl" style="WIDTH:400px" name="TargetUrl" runat="server" />
  118.     </td>
  119. </tr>
  120. </table>
  121. </td>
  122. </tr>
  123. </table>
  124. </fieldset>
  125. <fieldset style="width:98%;">
  126. <legend>
  127. [[Upload]] ([[MaxFileSizeAllowed]]
  128. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)%>
  129. )</legend>
  130. <table border="0" cellpadding="5" cellspacing="0">
  131.             <tr>
  132. <td>
  133. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  134. </td>
  135. </tr>
  136. <tr>
  137. <td style="height:12">
  138. </td>
  139. </tr>
  140. <tr>
  141.             <td style="white-space:nowrap">
  142. [[MaxFolderSizeAllowed]]:
  143. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024)%>.
  144. [[Used]]:<%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  145. <span style="FONT-SIZE:3px;WIDTH:40px;HEIGHT:3px;BACKGROUND-COLOR:green">
  146. <span style="FONT-SIZE:3px;HEIGHT:3px;BACKGROUND-COLOR:red"></span>
  147. </span>
  148. </td>
  149. </tr>
  150. </table>
  151. </fieldset>
  152. <p style="text-align:center">
  153. <input class="inputbuttoninsert" type="button" value="[[OK]]" onclick="do_insert()" id="Button1" name="Button1" />
  154. &nbsp;&nbsp;&nbsp; 
  155.     <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" name="Button2" />
  156. </p>
  157. </td>
  158. </tr>
  159. </table>
  160. </div>
  161. </form>
  162. <script runat="server">
  163. protected override void InitOfType()
  164. {
  165. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.FilesGalleryPath).TrimEnd('/')+"/";
  166. }
  167.     protected override void GetFiles(ArrayList files)
  168.     {
  169. files.AddRange(fs.GetFileItems(CurrentDirectory,secset.FileNamePrefix + "*.*"));
  170.     }
  171.     protected override bool AllowFileName(string filename)
  172.     {
  173.         filename = filename.ToLower();
  174.         if(filename.EndsWith(".swf"))return true;
  175.         foreach (string ext in secset.DocumentFilters)
  176.         {
  177.             if (ext == null || ext.Length == 0) continue;
  178.             if(filename.EndsWith(ext.ToLower()))
  179.                 return true;
  180.         }
  181.         foreach (string ext in secset.ImageFilters)
  182.         {
  183.             if (ext == null || ext.Length == 0) continue;
  184.             if(filename.EndsWith(ext.ToLower()))
  185.                 return true;
  186.         }
  187.         foreach (string ext in secset.MediaFilters)
  188.         {
  189.             if (ext == null || ext.Length == 0) continue;
  190.             if(filename.EndsWith(ext.ToLower()))
  191.                 return true;
  192.         }
  193.         return false;
  194.     }
  195.     protected override string CheckUploadData(ref byte[] data)
  196.     {
  197. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxDocumentFolderSize * 1024)
  198.            return "File folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024);
  199.         if (data.Length >= secset.MaxDocumentSize * 1024)
  200.             return "File size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  201.         return null;
  202.         
  203.     }
  204.     protected int GetUsedSpaceBarWidth()
  205.     {
  206.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxDocumentFolderSize * 1024));
  207.       if(w<1)
  208. w=1;
  209.   if(w>40)
  210. w=40;
  211.       return w;      
  212.     }
  213. </script>
  214. <script type="text/javascript" src="Load.ashx?type=dialogscript&amp;file=DialogFoot.js"></script>
  215. <script type="text/javascript" src="Load.ashx?type=dialogscript&amp;file=Dialog_SelectFile.js"></script>
  216. </body>
  217. </html>