InsertMedia.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="InsertMedia.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  9. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[InsertMedia]]",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 OxO147d=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  27. </script>
  28. <style type="text/css">
  29. .row
  30. {
  31. height:22px;
  32. }
  33. .cb
  34. {
  35. vertical-align:middle;
  36. }
  37. .itemimg
  38. {
  39. vertical-align:middle;
  40. }
  41. .editimg
  42. {
  43. vertical-align:middle;
  44. }
  45. .cell1
  46. {
  47. vertical-align:middle;
  48. }
  49. .cell2
  50. {
  51. vertical-align:middle;
  52. }
  53. .cell3
  54. {
  55. vertical-align:middle;
  56.     
  57. text-align:right;
  58. padding-right:4px;
  59. }
  60. .cb
  61. {
  62. }
  63. </style>
  64. </head>
  65. <body>
  66. <form runat="server" enctype="multipart/form-data" id="Form1">
  67. <!-- start hidden -->
  68. <input type="hidden" runat="server" id="hiddenDirectory" /> 
  69. <input type="hidden" runat="server" id="hiddenFile" />
  70. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" /> 
  71. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange" />
  72. <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" />
  73. <!-- end hidden -->
  74. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  75. <tr>
  76. <td style="width:20">
  77. <asp:Image id="Image1" Runat="server" ImageUrl="../Load.ashx?type=image&file=openfolder.gif"></asp:Image>
  78. </td>
  79. <td style="width:240" class="normal">
  80. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  81. </td>
  82. <td>
  83. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="../Load.ashx?type=image&file=newfolder.gif" Visible="true" OnClick="CreateDir_Click" />
  84. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="../Load.ashx?type=image&file=Copy.gif" Visible="true" OnClick="Copy_Click" />
  85. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="../Load.ashx?type=image&file=move.gif" Visible="true" OnClick="Move_Click" />
  86. <img src="../Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]" class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  87. <img src="../Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]" class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  88. <img src="../Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]" class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  89. </td>
  90. </tr>
  91. </table>
  92. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  93. <tr>
  94. <td valign="top" style="white-space:nowrap;width:250">
  95. <div style="border: 1.5pt inset; vertical-align: middle; overflow: auto; width: 250;background-color: white; height: 240px">
  96. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="1" Width="100%" CssClass="sortable">
  97. <asp:TableRow BackColor="#f0f0f0">
  98. <asp:TableHeaderCell Width="16px" >
  99. <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]"
  100. ImageUrl="../Load.ashx?type=image&file=s_cut.gif"
  101. Visible="true" OnClick="Delete_Click" />
  102. </asp:TableHeaderCell>
  103. <asp:TableHeaderCell Width="16px" >
  104. <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="../Load.ashx?type=image&file=s_refresh.gif"
  105. Visible="true"
  106. OnClick="DoRefresh_Click" />
  107. </asp:TableHeaderCell>
  108. <asp:TableHeaderCell id="name_Cell" Width="136px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  109. <asp:TableHeaderCell id="size_Cell" Width="72px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  110. <asp:TableHeaderCell id="op_Cell"  Width="16px">&nbsp;</asp:TableHeaderCell>
  111. </asp:TableRow>
  112. </asp:Table>
  113. </div>
  114. </td>
  115. <td valign="top">
  116. <div style="text-align: left; overflow: auto; background-color: white; border: 1.5pt inset;
  117.                         width: 300px; height: 240px; overflow: auto; text-align: center; vertical-align: top;
  118.                         padding: 10px;">
  119. <div id="divpreview" style="background-color: white; width:100%;height:100%">
  120. &nbsp;</div>
  121. </div>
  122. </td>
  123. </tr>
  124. <tr>
  125. <td colspan="2" style="height:2">
  126. </td>
  127. </tr>
  128. </table>
  129. <table border="0" cellspacing="0" cellpadding="0" width="99%">
  130. <tr>
  131. <td valign="top">
  132. <fieldset>
  133. <legend>[[Properties]]</legend>
  134. <table border="0" cellpadding="4" cellspacing="0" class="normal">
  135. <tr>
  136. <td>
  137. <table border="0" cellpadding="1" cellspacing="0" class="normal">
  138. <tr>
  139. <td style="width:100">
  140. [[Width]]:</td>
  141. <td>
  142. <input type="text" name="Width" id="Width" style="width: 80px;" onchange="do_preview()"
  143. onpropertychange="do_preview()" value="200" /></td>
  144. </tr>
  145. <tr>
  146. <td>
  147. [[Height]]:</td>
  148. <td>
  149. <input type="text" name="Height" id="Height" style="width: 80px;" onchange="do_preview()"
  150. onpropertychange="do_preview()" value="200" /></td>
  151. </tr>
  152. <tr>
  153. <td>
  154. [[AutoStart]]:</td>
  155. <td>
  156. <input type="checkbox" name="Transparency" onchange="do_preview()" onpropertychange="do_preview()"
  157. id="AutoStart" checked="checked" value="AutoStart" /></td>
  158. </tr>
  159. <tr>
  160. <td style="height: 24px">
  161. [[ShowControls]]:</td>
  162. <td style="height: 24px">
  163. <input type="checkbox" name="Transparency" onchange="do_preview()" onpropertychange="do_preview()"
  164. id="ShowControls" checked="checked" value="ShowControls" /></td>
  165. </tr>
  166. <tr>
  167. <td>
  168. [[ShowStatusBar]]:</td>
  169. <td>
  170. <input type="checkbox" name="Transparency" onchange="do_preview()" onpropertychange="do_preview()"
  171. id="ShowStatusBar" checked="checked" value="ShowStatusBar" /></td>
  172. </tr>
  173. </table>
  174. </td>
  175. </tr>
  176. </table>
  177. </fieldset>
  178. </td>
  179. <td style="width:10">
  180. </td>
  181. <td valign="top">
  182. <fieldset style="margin-bottom:5px">
  183. <legend>[[Insert]]</legend>
  184. <table border="0" cellpadding="4" cellspacing="0">
  185. <tr>
  186. <td>
  187. <table border="0" cellpadding="1" cellspacing="0" class="normal">
  188. <tr>
  189. <td valign="middle">
  190. [[Url]]:</td>
  191. <td>
  192. <input type="text" id="TargetUrl" size="40" name="TargetUrl" runat="server" />
  193. </td>
  194. </tr>
  195. </table>
  196. </td>
  197. </tr>
  198. </table>
  199. </fieldset>
  200. <fieldset id="fieldsetUpload">
  201. <legend>
  202. [[Upload]] ([[MaxFileSizeAllowed]]
  203. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxMediaSize * 1024)%>
  204. )</legend>
  205. <table border="0" cellspacing="1" cellpadding="0" width="98%" class="normal">
  206. <tr>
  207. <td style="height:10">
  208. </td>
  209. </tr>
  210. <tr>
  211. <td valign="top" style="width:54%;font-size: 8pt; vertical-align: middle; font-family: MS Sans Serif">
  212. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td style="width:8">
  217. </td>
  218. </tr>
  219. <tr>
  220. <td style="width:5">
  221. </td>
  222. </tr>
  223. <tr>
  224. <td>
  225. <span style="white-space:nowrap">
  226. [[MaxFolderSizeAllowed]]: <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxMediaFolderSize * 1024)%>.
  227. [[Used]]: <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  228. <span style="background-color:green;height:3px;width:40px;font-size:3px">
  229. <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px"></span>
  230. </span>
  231. </span>
  232. </td>
  233. </tr>
  234. </table>
  235. </fieldset>
  236. <div style="padding-top:12px;">
  237. <input class="inputbuttoninsert" type="button" value="[[Insert]]" onclick="do_insert()" id="Button1" />
  238. &nbsp;&nbsp;&nbsp; 
  239. <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" />
  240. </div>
  241. </td>
  242. </tr>
  243. </table>
  244. </form>
  245. </body>
  246. <script runat="server">
  247. protected override void InitOfType()
  248. {
  249. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.MediaGalleryPath).TrimEnd('/')+"/";
  250. }
  251.     protected override void GetFiles(ArrayList files)
  252.     {
  253.         foreach (string ext in secset.MediaFilters)
  254.         {
  255.             if (ext == null || ext.Length == 0) continue;
  256.             files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  257.         }
  258.     }
  259.     protected override bool AllowFileName(string filename)
  260.     {
  261.         filename = filename.ToLower();
  262.         foreach (string ext in secset.MediaFilters)
  263.         {
  264.             if (ext == null || ext.Length == 0) continue;
  265.             if(filename.EndsWith(ext.ToLower()))
  266.                 return true;
  267.         }
  268.         return false;
  269.     }
  270.     protected override string CheckUploadData(ref byte[] data)
  271.     {
  272.  if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxMediaFolderSize * 1024)
  273.            return "Media folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxMediaFolderSize * 1024);
  274.         if (data.Length >= secset.MaxMediaSize * 1024)
  275.             return "Media size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxMediaSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  276.         return null;
  277.     }
  278.     protected int GetUsedSpaceBarWidth()
  279.     {
  280.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxMediaFolderSize * 1024));
  281.       if(w<1)
  282. w=1;
  283.   if(w>40)
  284. w=40;
  285.       return w;      
  286.     }
  287. </script>
  288. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  289. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_InsertMedia.js"></script>
  290. </html>