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

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_InsertImage.aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  9. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[InsertImage]]",FrameSrc);
  10. Context.Response.End();
  11. }
  12. base.OnInit(args);
  13. }
  14. </script>
  15. <%
  16. string QUERY_STRING=Request.ServerVariables["QUERY_STRING"];
  17. %>
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19. <head>
  20.     <title></title>
  21. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)" />
  22. <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.1)" />
  23. <meta http-equiv="Cache-Control" content="no-cache" />
  24. <meta http-equiv="Pragma" content="no-cache" />
  25. <meta http-equiv="EXPIRES" content="0" />
  26. <link href="Load.ashx?type=style&file=dialog.css" type="text/css" rel="stylesheet" />
  27. <!--[if IE]>
  28. <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
  29. <![endif]-->
  30. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogHead.js"></script>
  31. <script type="text/javascript">
  32. var OxOe2ee=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  33. </script>
  34. <style type="text/css">
  35. .row { HEIGHT: 22px }
  36. .cb { VERTICAL-ALIGN: middle }
  37. .itemimg { VERTICAL-ALIGN: middle }
  38. .editimg { VERTICAL-ALIGN: middle }
  39. .cell1 { VERTICAL-ALIGN: middle }
  40. .cell2 { VERTICAL-ALIGN: middle }
  41. .cell3 { PADDING-RIGHT: 4px; VERTICAL-ALIGN: middle; TEXT-ALIGN: right }
  42. .cb { }
  43. </style>
  44. </head>
  45. <body>
  46. <form runat="server" enctype="multipart/form-data" id="Form1">
  47. <!-- start hidden -->
  48. <input type="hidden" runat="server" id="hiddenDirectory" name="hiddenDirectory" />
  49. <input type="hidden" runat="server" id="hiddenFile" name="hiddenFile" /> 
  50. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
  51. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange" name="hiddenAction" /> 
  52. <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
  53. <!-- end hidden -->
  54. <table border="0" cellspacing="2" cellpadding="0" width="100%">
  55. <tr>
  56. <td style="width:20">
  57. <asp:Image id="Image1" Runat="server" ImageUrl="../Load.ashx?type=image&file=openfolder.gif"></asp:Image>
  58. </td>
  59. <td style="width:240" class="normal">
  60. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  61. </td>
  62. <td>
  63. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="../Load.ashx?type=image&file=newfolder.gif"
  64. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="CreateDir_Click" />
  65. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="../Load.ashx?type=image&file=Copy.gif"
  66. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Copy_Click" />
  67. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="../Load.ashx?type=image&file=move.gif"
  68. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Move_Click" />
  69. <img style="display:none" src="../Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]"
  70. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  71. <img style="display:none" src="../Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]"
  72. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  73. <img style="display:none" src="../Load.ashx?type=image&file=bestfit.gif" onclick="BestFit();" alt="[[BestFit]]"
  74. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  75. <img style="display:none" src="../Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]"
  76. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  77. <img src="../Load.ashx?type=image&file=resize.gif" id="img_AutoThumbnail" onclick="AutoThumbnail();"
  78. alt="[[AutoThumbnail]]" class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  79. </td>
  80. </tr>
  81. </table>
  82. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  83. <tr>
  84. <td valign="top" style="white-space:nowrap; width:280">
  85. <div style="BORDER: 1.5pt inset;  VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 280; HEIGHT: 250px; Padding:0; BACKGROUND-COLOR: white">
  86. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="0" Width="100%"
  87. CssClass="sortable">
  88. <asp:TableRow BackColor="#f0f0f0">
  89. <asp:TableHeaderCell Width="16px">
  90. <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]" onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);"
  91. ImageUrl="../Load.ashx?type=image&file=s_cut.gif" Visible="true" OnClick="Delete_Click" />
  92. </asp:TableHeaderCell>
  93. <asp:TableHeaderCell Width="16px">
  94. <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="../Load.ashx?type=image&file=s_refresh.gif"
  95. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="DoRefresh_Click" />
  96. </asp:TableHeaderCell>
  97. <asp:TableHeaderCell id="name_Cell" Wrap="True" Width="145px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  98. <asp:TableHeaderCell id="size_Cell" Width="62px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  99. <asp:TableHeaderCell id="op_Cell" Width="16px">&nbsp;</asp:TableHeaderCell>
  100. <asp:TableHeaderCell id="op_space" Width="1px"></asp:TableHeaderCell>
  101. </asp:TableRow>
  102. </asp:Table>
  103. </div>
  104. </td>
  105. <td valign="top" style="white-space:nowrap; width:326">
  106. <div style="border:1.5pt inset; Padding:0; vertical-align: top; overflow: auto; width:100%; HEIGHT: 250px; BACKGROUND-COLOR: white;">
  107. <div id="divpreview" style="BACKGROUND-COLOR: white; height:100%;width:100%">
  108. <img alt="" id="img_demo" src="../Load.ashx?type=image&file=1x1.gif" />
  109. </div>
  110. </div>
  111. </td>
  112. </tr>
  113. <tr>
  114. <td colspan="2" style="height:2">
  115. </td>
  116. </tr>
  117. </table>
  118. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  119. <tr>
  120. <td valign="top">
  121. <fieldset>
  122. <legend>[[Layout]]</legend>
  123. <table border="0" cellpadding="4" cellspacing="0" width="100%">
  124. <tr>
  125. <td>
  126. <table border="0" cellpadding="1" cellspacing="0" class="normal">
  127. <tr>
  128. <td style="width:100">[[Alignment]]:</td>
  129. <td>
  130. <select name="ImgAlign" style="WIDTH : 80px" id="Align" onchange="do_preview()" onpropertychange="do_preview()">
  131. <option id="optNotSet" selected="selected" value="">[[Notset]]</option>
  132. <option id="optLeft" value="left">[[Left]]</option>
  133. <option id="optRight" value="right">[[Right]]</option>
  134. <option id="optTexttop" value="textTop">[[Texttop]]</option>
  135. <option id="optAbsMiddle" value="absMiddle">[[Absmiddle]]</option>
  136. <option id="optBaseline" value="baseline">[[Baseline]]</option>
  137. <option id="optAbsBottom" value="absBottom">[[Absbottom]]</option>
  138. <option id="optBottom" value="bottom">[[Bottom]]</option>
  139. <option id="optMiddle" value="middle">[[Middle]]</option>
  140. <option id="optTop" value="top">[[Top]]</option>
  141. </select>
  142. </td>
  143. </tr>
  144. <tr>
  145. <td>[[Bordersize]]:</td>
  146. <td>
  147. <input type="text" size="2" name="Border" onchange="do_preview()" onpropertychange="do_preview()"
  148. onkeypress="return CancelEventIfNotDigit()" style="WIDTH : 80px" id="Border" />
  149. </td>
  150. </tr>
  151. <tr>
  152. <td>[[Bordercolor]]:</td>
  153. <td>
  154. <input autocomplete="off" type="text" id="bordercolor" name="bordercolor" size="7" style="WIDTH:57px" />
  155. <img id="s_bordercolor" src="../images/colorpicker.gif" alt="" />
  156. <img style="display:none" alt="" src="../Load.ashx?type=image&file=colorpicker.gif" id="bordercolor_Preview" />
  157. </td>
  158. </tr>
  159. <tr>
  160. <td colspan="2">
  161. <table border="0" cellpadding="0" cellspacing="0" class="normal">
  162. <tr>
  163. <td style="white-space:nowrap; width:100" >[[Width]]:</td>
  164. <td>
  165. <input type="text" size="2" id="inp_width" onkeyup="checkConstrains('width');" onkeypress="return CancelEventIfNotDigit()"
  166. style="WIDTH : 80px" />
  167. </td>
  168. <td rowspan="2" align="right" valign="middle"><img src="../Load.ashx?type=image&file=locked.gif" id="imgLock" width="25" height="32"
  169. alt="[[ConstrainProportions]]" /></td>
  170. </tr>
  171. <tr>
  172. <td>[[Height]]:</td>
  173. <td>
  174. <input type="text" size="2" id="inp_height" onkeyup="checkConstrains('height');" onkeypress="return CancelEventIfNotDigit()"
  175. style="WIDTH : 80px" />
  176. </td>
  177. </tr>
  178. <tr>
  179. <td colspan="2">
  180. <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains();" />
  181. [[ConstrainProportions]]</td>
  182. </tr>
  183. </table>
  184. </td>
  185. </tr>
  186. </table>
  187. </td>
  188. </tr>
  189. </table>
  190. </fieldset>
  191. <fieldset>
  192. <legend>
  193. [[Spacing]]</legend>
  194. <table border="0" cellpadding="4" cellspacing="0" width="100%">
  195. <tr>
  196. <td>
  197. <table border="0" cellpadding="1" cellspacing="0" class="normal" width="100%">
  198. <tr>
  199. <td valign="middle" style="width:100">[[Horizontal]]:</td>
  200. <td><input type="text" size="2" name="HSpace" onchange="do_preview()" onpropertychange="do_preview()"
  201. onkeypress="return CancelEventIfNotDigit()" style="WIDTH:80px" id="HSpace" />
  202. </td>
  203. </tr>
  204. <tr>
  205. <td valign="middle">[[Vertical]]:</td>
  206. <td><input type="text" size="2" name="VSpace" onchange="do_preview()" onpropertychange="do_preview()"
  207. onkeypress="return CancelEventIfNotDigit()" style="WIDTH:80px" id="VSpace" /></td>
  208. </tr>
  209. </table>
  210. </td>
  211. </tr>
  212. </table>
  213. </fieldset>
  214. </td>
  215. <td style="width:2"></td>
  216. <td valign="top">
  217. <fieldset>
  218. <legend>
  219. [[Insert]]</legend>
  220. <table border="0" cellpadding="4" cellspacing="0">
  221. <tr>
  222. <td>
  223. <table border="0" cellpadding="1" cellspacing="0" class="normal">
  224. <tr>
  225. <td valign="middle">
  226. [[Url]]:</td>
  227. <td colspan="3">
  228. <input type="text" id="TargetUrl" onchange="do_preview()" onpropertychange="do_preview()"
  229. size="43" name="TargetUrl" runat="server" /></td>
  230. <td></td>
  231. </tr>
  232. <tr>
  233. <td valign="middle">[[Alternate]]:</td>
  234. <td valign="middle"><input type="text" id="AlternateText" size="22" name="AlternateText" /></td>
  235. <td valign="middle" style="white-space:nowrap" >&nbsp;[[ID]]:</td>
  236. <td><input type="text" id="inp_id" size="12" /></td>
  237. <td></td>
  238. </tr>
  239. <tr>
  240. <td valign="middle" style="white-space:nowrap" >[[longDesc]]:</td>
  241. <td valign="middle" colspan="3">
  242.     <input type="text" id="longDesc" size="43" name="longDesc" />
  243. </td>
  244. <td><img src="../Load.ashx?type=image&file=Accessibility.gif" alt="" /></td>
  245. </tr>
  246. </table>
  247. </td>
  248. </tr>
  249. </table>
  250. </fieldset>
  251. <fieldset id="fieldsetUpload">
  252. <legend>
  253. [[Upload]] ([[MaxFileSizeAllowed]]
  254. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)%>
  255. )</legend>
  256. <table border="0" cellspacing="2" cellpadding="0" width="100%" class="normal">
  257. <tr>
  258. <td style="width:8">
  259. </td>
  260. </tr>
  261. <tr>
  262. <td valign="top" style="FONT-SIZE: 8pt; vertical-align: middle; FONT-FAMILY: MS Sans Serif">
  263. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  264. </td>
  265. </tr>
  266. <tr>
  267. <td style="width:5">
  268. </td>
  269. </tr>
  270. <tr>
  271. <td>
  272.     <ul style="margin-top:0; margin-bottom:0;">
  273. <% if(secset.RestrictUploadedImageDimension) {%>
  274. <li>
  275. [[MaxImagedImension]]
  276. <%= secset.MaxImageWidth%>
  277. x
  278. <%= secset.MaxImageHeight%>
  279. [[pixels]].
  280. </li>
  281. <li>
  282. [[AutomaticImageResizeOnOff]]
  283. <%= secset.AutoResizeUploadedImages? "[[on]]":"[[off]]" %>
  284. .</li>
  285. <%}%>
  286. <li>
  287. <span style="white-space:nowrap">[[MaxFolderSizeAllowed]]:
  288. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024)%>. [[Used]]:
  289. <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  290. <span style="background-color:green;height:3px;width:40px;font-size:3px">
  291.     <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px">
  292. </span>
  293. </span>
  294. </span>
  295. </li>
  296. </ul>
  297. </td>
  298. </tr>
  299. </table>
  300. </fieldset>
  301. <div style="padding-top:4px;">
  302. <input class="inputbuttoninsert" type="button" value="[[Insert]]" onclick="do_insert()" id="Button1" />
  303. &nbsp;&nbsp;&nbsp; 
  304. <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" />
  305. </div>
  306. </td>
  307. </tr>
  308. </table>
  309. </form>
  310. <script runat="server">
  311. protected override void InitOfType()
  312. {
  313. this.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
  314. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.ImageGalleryPath).TrimEnd('/')+"/";
  315. }
  316. protected override void GetFiles(ArrayList files)
  317. {
  318. foreach (string ext in secset.ImageFilters)
  319. {
  320. if (ext == null || ext.Length == 0) continue;
  321. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  322. }
  323. }
  324. protected override bool AllowFileName(string filename)
  325. {
  326. filename = filename.ToLower();
  327. foreach (string ext in secset.ImageFilters)
  328. {
  329. if (ext == null || ext.Length == 0) continue;
  330. if(filename.EndsWith(ext.ToLower()))
  331. return true;
  332. }
  333. return false;
  334. }
  335.     
  336. protected int GetUsedSpaceBarWidth()
  337. {
  338. int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxImageFolderSize * 1024));
  339. if(w<1)
  340. w=1;
  341. if(w>40)
  342. w=40;
  343. return w;      
  344. }
  345. protected override string CheckUploadData(ref byte[] data)
  346. {            
  347.       
  348. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxImageFolderSize * 1024)
  349. return "Image folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024);
  350. System.Drawing.Image img;
  351. try
  352. {
  353. img = System.Drawing.Image.FromStream(new System.IO.MemoryStream(data));
  354. }
  355. catch
  356. {
  357. return "Image is in the wrong format.";
  358. }
  359. //let base class to implement
  360. /*
  361.         
  362. if (data.Length >= secset.MaxImageSize * 1024)
  363. return "Image size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  364. if(secset.RestrictUploadedImageDimension)
  365. {
  366. if(secset.AutoResizeUploadedImages)
  367. {
  368. return null;//let base class implement the secset.AutoResizeUploadedImages
  369. }
  370. else
  371. {
  372. if ((img.Width > secset.MaxImageWidth) || ((img.Height > secset.MaxImageHeight)))
  373. return String.Format("Image dimension ({0} x {1} pixels) exceeding limits.", img.Width, img.Height);
  374. }
  375. }
  376. */
  377. return null;
  378. }
  379. </script>
  380. </body>
  381. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  382. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_InsertImage.js"></script>
  383. </html>