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

OA系统

开发平台:

C#

  1. <%@ Page Language="C#" Inherits="CuteEditor.Dialogs.FileBrowserPage" %>
  2. <%@ Register TagPrefix="CE" Assembly="CuteEditor" Namespace="CuteEditor" %>
  3. <script runat="server">
  4. override protected void OnInit(EventArgs args)
  5. {
  6. if(Context.Request.QueryString["IsFrame"]==null)
  7. {
  8. string FrameSrc="Gecko_InsertDocument.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  9. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[InsertDocument]]",FrameSrc);
  10. Context.Response.End();
  11. }
  12. base.OnInit(args);
  13. }
  14. </script>
  15. <html xmlns="http://www.w3.org/1999/xhtml">
  16. <head>
  17. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)" />
  18. <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.1)" />
  19. <link href="Load.ashx?type=style&file=dialog.css" type="text/css" rel="stylesheet" />
  20. <!--[if IE]>
  21. <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
  22. <![endif]-->
  23. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogHead.js"></script>
  24. <script type="text/javascript">
  25. var OxOb2f6=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  26. </script>
  27. <title></title>
  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&file=openfolder.gif"></asp:Image>
  51. </td>
  52. <td style="width:240" class="normal">
  53. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  54. </td>
  55. <td>
  56. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="../Load.ashx?type=image&file=newfolder.gif"
  57. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="CreateDir_Click" />
  58. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="../Load.ashx?type=image&file=Copy.gif"
  59. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Copy_Click" />
  60. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="../Load.ashx?type=image&file=move.gif"
  61. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Move_Click" />
  62. <img style="display:none" src="../Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]"
  63. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  64. <img style="display:none" src="../Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]"
  65. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  66. <img style="display:none"  src="../Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]"
  67. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  68. </td>
  69. </tr>
  70. </table>
  71. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  72. <tr>
  73. <td valign="top"  style="white-space:nowrap; width:270">
  74. <div style="BORDER: 1.5pt inset; VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 270; HEIGHT: 240px; BACKGROUND-COLOR: white">
  75. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="1" Width="100%"
  76. CssClass="sortable">
  77. <asp:TableRow BackColor="#f0f0f0">
  78. <asp:TableHeaderCell Width="16px">
  79. <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]" onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);"
  80. ImageUrl="../Load.ashx?type=image&file=s_cut.gif" 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 valign="top">
  94. <div style="padding: 0; BORDER: 1.5pt inset; VERTICAL-ALIGN: top; OVERFLOW: auto; WIDTH: 300px; BORDER-BOTTOM: 1.5pt inset; HEIGHT: 240px; BACKGROUND-COLOR: white; TEXT-ALIGN: left">
  95. <div id="divpreview" style="BACKGROUND-COLOR: white">
  96. &nbsp;</div>
  97. </div>
  98. </td>
  99. </tr>
  100. </table>
  101. <table border="0" cellspacing="2" cellpadding="0" width="98%">
  102. <tr>
  103. <td valign="top">
  104. <fieldset>
  105. <legend>
  106. [[Properties]]</legend>
  107. <table border="0" cellpadding="4" cellspacing="0" id="Table3">
  108. <tr>
  109. <td>
  110. <table border="0" cellpadding="1" cellspacing="0" id="Table4" class="normal">
  111. <tr>
  112. <td>[[Target]]</td>
  113. <td><select id="sel_target">
  114. <option value="">[[NotSet]]</option>
  115. <option value="_blank">[[Newwindow]]</option>
  116. <option value="_self">[[Samewindow]]</option>
  117. <option value="_top">[[Topmostwindow]]</option>
  118. <option value="_parent">[[Parentwindow]]</option>
  119. </select>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td>[[Color]]:</td>
  124. <td>
  125. <input autocomplete="off" type="text" id="inp_color" name="inp_color" size="7" style="WIDTH:57px" />
  126. <img alt="" id="inp_color_preview" src="../images/colorpicker.gif" />
  127. </td>
  128. </tr>
  129. <tr>
  130. <td>[[CssClass]]:</td>
  131. <td><input id="inc_class" type="text" size="14" style="WIDTH:80px" name="inc_class" /></td>
  132. </tr>
  133. <tr>
  134. <td>[[ID]]:</td>
  135. <td><input id="inp_id" type="text" size="14" style="WIDTH:80px" name="inp_id" /></td>
  136. </tr>
  137. <tr>
  138. <td>[[TabIndex]]:</td>
  139. <td><input id="inp_index" type="text" size="14" maxlength="5" style="WIDTH:80px" name="inp_index"
  140. onkeypress="return CancelEventIfNotDigit()" /></td>
  141. </tr>
  142. <tr>
  143. <td>[[AccessKey]]:</td>
  144. <td><input id="inp_access" type="text" size="14" maxlength="1" style="WIDTH:80px" name="inp_access"
  145. onkeypress="return CancelEventIfNotDigit()" /></td>
  146. </tr>
  147. </table>
  148. </td>
  149. </tr>
  150. </table>
  151. </fieldset>
  152. </td>
  153. <td style="width:10">
  154. </td>
  155. <td valign="top">
  156. <fieldset>
  157. <legend>[[Insert]]</legend>
  158. <table border="0" cellpadding="4" cellspacing="0">
  159. <tr>
  160. <td>
  161. <table id="Table8" cellspacing="0" cellpadding="1" border="0" class="normal">
  162. <tr>
  163. <td valign="middle">[[Url]]:</td>
  164. <td><input id="TargetUrl" onpropertychange="do_preview()" type="text" size="40" name="TargetUrl"
  165. runat="server" /></td>
  166. </tr>
  167. <tr>
  168. <td valign="middle">[[Title]]:</td>
  169. <td valign="middle"><input id="inp_title" type="text" size="40" name="inp_title" /></td>
  170. </tr>
  171. </table>
  172. </td>
  173. </tr>
  174. </table>
  175. </fieldset>
  176. <fieldset id="fieldsetUpload">
  177. <legend>
  178. [[Upload]] ([[MaxFileSizeAllowed]]
  179. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)%>
  180. )</legend>
  181. <table border="0" cellspacing="1" cellpadding="0" width="98%" class="normal">
  182. <tr>
  183. <td valign="top" style="width:54%; FONT-SIZE: 8pt; VERTICAL-ALIGN: middle; FONT-FAMILY: MS Sans Serif">
  184. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td style="width:8">
  189. </td>
  190. </tr>
  191. <tr>
  192. <td style="width:5">
  193. </td>
  194. </tr>
  195. <tr>
  196. <td style="white-space:nowrap">
  197. [[MaxFolderSizeAllowed]]:
  198. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024)%>.
  199. [[Used]]:<%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  200. <span style="background-color:green;height:3px;width:40px;font-size:3px">
  201. <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px">
  202. </span>
  203. </span>
  204. </td>
  205. </tr>
  206. </table>
  207. </fieldset>
  208. <div style="padding-top:4px;">
  209. <input class="inputbuttoninsert" type="button" value="[[Insert]]" onclick="do_insert()" id="Button1" name="Button1" />
  210.     &nbsp;&nbsp;&nbsp; 
  211.     <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" name="Button2"/>
  212. </div>
  213. </td>
  214. </tr>
  215. </table>
  216. </form>
  217. <script runat="server">
  218. protected override void InitOfType()
  219. {
  220. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.FilesGalleryPath).TrimEnd('/')+"/";
  221. }
  222.     protected override void GetFiles(ArrayList files)
  223.     {
  224.         foreach (string ext in secset.DocumentFilters)
  225.         {
  226.             if (ext == null || ext.Length == 0) continue;
  227.             
  228. if ( ext.Length > 4 )
  229. {
  230. if ( !secset.DocumentFilters.Contains( ext.Substring( 0, 4 ) ) )
  231. {
  232. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  233. }
  234. }
  235. else
  236. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  237.         }        
  238.         
  239.     }
  240.     protected override bool AllowFileName(string filename)
  241.     {
  242.         filename = filename.ToLower();
  243.         foreach (string ext in secset.DocumentFilters)
  244.         {
  245.             if (ext == null || ext.Length == 0) continue;
  246.             if(filename.EndsWith(ext.ToLower()))
  247.                 return true;
  248.         }
  249.         return false;
  250.     }
  251.     protected override string CheckUploadData(ref byte[] data)
  252.     {
  253. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxDocumentFolderSize * 1024)
  254.            return "File folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024);
  255. if (data.Length >= secset.MaxDocumentSize * 1024)
  256.             return "File size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  257.         return null;
  258.     }
  259.     
  260.     protected int GetUsedSpaceBarWidth()
  261.     {
  262.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxDocumentFolderSize * 1024));
  263.       if(w<1)
  264. w=1;
  265.   if(w>40)
  266. w=40;
  267.       return w;      
  268.     }
  269. </script>
  270. </body>
  271. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  272. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_InsertDocument.js"></script>
  273. </html>