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="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.     <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&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&file=DialogHead.js"></script>
  25. <script type="text/javascript">
  26. var OxO50da=[]; 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" /> 
  44. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
  45. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange"
  46. name="hiddenAction" /> 
  47. <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
  48. <!-- end hidden -->
  49. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  50. <tr>
  51. <td style="width:20">
  52. <asp:Image id="Image1" Runat="server" ImageUrl="../Load.ashx?type=image&file=openfolder.gif"></asp:Image>
  53. </td>
  54. <td style="width:240" class="normal">
  55. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  56. </td>
  57. <td>
  58. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="../Load.ashx?type=image&file=newfolder.gif"
  59. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="CreateDir_Click" />
  60. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="../Load.ashx?type=image&file=Copy.gif"
  61. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Copy_Click" />
  62. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="../Load.ashx?type=image&file=move.gif"
  63. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Move_Click" />
  64. <img src="../Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]"
  65. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  66. <img src="../Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]"
  67. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  68. <img src="../Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]"
  69. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  70. </td>
  71. </tr>
  72. </table>
  73. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  74. <tr>
  75. <td valign="top"  style="white-space:nowrap;width:270">
  76. <div style="BORDER: 1.5pt inset; VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 270; HEIGHT: 240px; BACKGROUND-COLOR: white">
  77. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="1" Width="100%"
  78. CssClass="sortable">
  79. <asp:TableRow BackColor="#f0f0f0">
  80. <asp:TableHeaderCell Width="16px">
  81. <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]" onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);"
  82. ImageUrl="../Load.ashx?type=image&file=s_cut.gif" Visible="true" OnClick="Delete_Click" />
  83. </asp:TableHeaderCell>
  84. <asp:TableHeaderCell Width="16px">
  85. <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="../Load.ashx?type=image&file=s_refresh.gif"
  86. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="DoRefresh_Click" />
  87. </asp:TableHeaderCell>
  88. <asp:TableHeaderCell id="name_Cell" Width="136px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  89. <asp:TableHeaderCell id="size_Cell" Width="72px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  90. <asp:TableHeaderCell id="op_Cell" Width="16px">&nbsp;</asp:TableHeaderCell>
  91. </asp:TableRow>
  92. </asp:Table>
  93. </div>
  94. </td>
  95. <td valign="top">
  96. <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">
  97. <div id="divpreview" style="BACKGROUND-COLOR: white">&nbsp;</div>
  98. </div>
  99. </td>
  100. </tr>
  101. </table>
  102. <table border="0" cellspacing="2" cellpadding="0" width="98%">
  103. <tr>
  104. <td valign="top">
  105. <fieldset>
  106. <legend>
  107. [[Properties]]</legend>
  108. <table border="0" cellpadding="4" cellspacing="0" id="Table3">
  109. <tr>
  110. <td>
  111. <table border="0" cellpadding="1" cellspacing="0" id="Table4" class="normal">
  112. <tr>
  113. <td>[[Target]]</td>
  114. <td><select id="sel_target">
  115. <option value="">[[NotSet]]</option>
  116. <option value="_blank">[[Newwindow]]</option>
  117. <option value="_self">[[Samewindow]]</option>
  118. <option value="_top">[[Topmostwindow]]</option>
  119. <option value="_parent">[[Parentwindow]]</option>
  120. </select>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td>[[Color]]:</td>
  125. <td><input type="text" id="inp_color" name="inp_color" size="7" style="WIDTH:57px" />
  126. <img alt="" src="../Load.ashx?type=image&file=colorpicker.gif" id="inp_color_preview"
  127. style='behavior:url(Load.ashx?type=htc&file=ColorPicker.htc)' oncolorchange="inp_color.value=this.selectedColor; inp_color.style.backgroundColor=this.selectedColor;inp_color_preview.style.backgroundColor=this.selectedColor" />
  128. </td>
  129. </tr>
  130. <tr>
  131. <td>[[CssClass]]:</td>
  132. <td><input id="inc_class" type="text" size="14" style="WIDTH:80px" name="inc_class" /></td>
  133. </tr>
  134. <tr>
  135. <td>[[ID]]:</td>
  136. <td><input id="inp_id" type="text" size="14" style="WIDTH:80px" name="inp_id" /></td>
  137. </tr>
  138. <tr>
  139. <td>[[TabIndex]]:</td>
  140. <td><input id="inp_index" type="text" size="14" maxlength="5" style="WIDTH:80px" name="inp_index"
  141. onkeypress="return CancelEventIfNotDigit()" /></td>
  142. </tr>
  143. <tr>
  144. <td>[[AccessKey]]:</td>
  145. <td><input id="inp_access" type="text" size="14" maxlength="1" style="WIDTH:80px" name="inp_access"
  146. onkeypress="return CancelEventIfNotDigit()" /></td>
  147. </tr>
  148. </table>
  149. </td>
  150. </tr>
  151. </table>
  152. </fieldset>
  153. </td>
  154. <td style="width:10">
  155. </td>
  156. <td valign="top">
  157. <fieldset>
  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" />
  166. </td>
  167. </tr>
  168. <tr>
  169. <td valign="middle">[[Title]]:</td>
  170. <td valign="middle"><input id="inp_title" type="text" size="40" name="inp_title" /></td>
  171. </tr>
  172. </table>
  173. </td>
  174. </tr>
  175. </table>
  176. </fieldset>
  177. <fieldset id="fieldsetUpload">
  178. <legend>
  179. [[Upload]] ([[MaxFileSizeAllowed]]
  180. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)%>
  181. )</legend>
  182. <table border="0" cellspacing="1" cellpadding="0" width="98%" class="normal">
  183. <tr>
  184. <td style="height:12">
  185. </td>
  186. </tr>
  187. <tr>
  188. <td valign="top"  style="width:54%; FONT-SIZE: 8pt; VERTICAL-ALIGN: middle; FONT-FAMILY: MS Sans Serif">
  189. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td style="width:8">
  194. </td>
  195. </tr>
  196. <tr>
  197. <td style="width:5">
  198. </td>
  199. </tr>
  200. <tr>
  201. <td>
  202. <span style="white-space:nowrap">[[MaxFolderSizeAllowed]]:
  203. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024)%>.
  204. [[Used]]:<%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  205. <span style="background-color:green;height:3px;width:40px;font-size:3px">
  206. <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px">
  207. </span>
  208. </span>
  209. </span>
  210. </td>
  211. </tr>
  212. </table>
  213. </fieldset>
  214. <div style="padding-top:4px;">
  215. <input class="inputbuttoninsert" type="button" value="[[Insert]]" onclick="do_insert()" id="Button1" />
  216. &nbsp;&nbsp;&nbsp; 
  217. <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" />
  218. </div>
  219. </td>
  220. </tr>
  221. </table>
  222. </form>
  223. <script runat="server">
  224. protected override void InitOfType()
  225. {
  226. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.FilesGalleryPath).TrimEnd('/')+"/";
  227. }
  228.     protected override void GetFiles(ArrayList files)
  229.     {
  230.         foreach (string ext in secset.DocumentFilters)
  231.         {
  232.             if (ext == null || ext.Length == 0) continue;
  233.             
  234. if ( ext.Length > 4 )
  235. {
  236. if ( !secset.DocumentFilters.Contains( ext.Substring( 0, 4 ) ) )
  237. {
  238. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  239. }
  240. }
  241. else
  242. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  243.         }        
  244.         
  245.     }
  246.     protected override bool AllowFileName(string filename)
  247.     {
  248.         filename = filename.ToLower();
  249.         foreach (string ext in secset.DocumentFilters)
  250.         {
  251.             if (ext == null || ext.Length == 0) continue;
  252.             if(filename.EndsWith(ext.ToLower()))
  253.                 return true;
  254.         }
  255.         return false;
  256.     }
  257.     protected override string CheckUploadData(ref byte[] data)
  258.     {
  259. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxDocumentFolderSize * 1024)
  260.            return "File folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentFolderSize * 1024);
  261. if (data.Length >= secset.MaxDocumentSize * 1024)
  262.             return "File size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxDocumentSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  263.         return null;
  264.     }
  265.     
  266.     protected int GetUsedSpaceBarWidth()
  267.     {
  268.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxDocumentFolderSize * 1024));
  269.       if(w<1)
  270. w=1;
  271.   if(w>40)
  272. w=40;
  273.       return w;      
  274.     }
  275. </script>
  276. </body>
  277. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  278. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_InsertDocument.js"></script>
  279. </html>