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

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="SelectImage.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  9. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[Browse]]",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. <link href="Load.ashx?type=style&file=dialog.css" type="text/css" rel="stylesheet" />
  24. <!--[if IE]>
  25. <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
  26. <![endif]-->
  27. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogHead.js"></script>
  28. <script type="text/javascript">
  29. var OxOc8d7=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  30. </script>
  31. <style type="text/css">
  32. .row { HEIGHT: 22px }
  33. .cb { VERTICAL-ALIGN: middle }
  34. .itemimg { VERTICAL-ALIGN: middle }
  35. .editimg { VERTICAL-ALIGN: middle }
  36. .cell1 { VERTICAL-ALIGN: middle }
  37. .cell2 { VERTICAL-ALIGN: middle }
  38. .cell3 { PADDING-RIGHT: 4px; VERTICAL-ALIGN: middle; TEXT-ALIGN: right }
  39. .cb { }
  40. </style>
  41. </head>
  42. <body>
  43. <form runat="server" enctype="multipart/form-data" id="Form1">
  44. <!-- start hidden -->
  45. <input type="hidden" runat="server" id="hiddenDirectory" name="hiddenDirectory" />
  46. <input type="hidden" runat="server" id="hiddenFile" name="hiddenFile" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
  47. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange"
  48. name="hiddenAction" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
  49. <!-- end hidden -->
  50. <table border="0" cellspacing="2" cellpadding="0" width="100%">
  51. <tr>
  52. <td style="white-space:nowrap; width:20" >
  53. <asp:Image id="Image1" Runat="server" ImageUrl="Load.ashx?type=image&file=openfolder.gif"></asp:Image>
  54. </td>
  55. <td class="normal" style="white-space:nowrap;width:200" >
  56. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  57. </td>
  58. <td style="text-align:center">
  59. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="Load.ashx?type=image&file=newfolder.gif"
  60. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
  61. OnClick="CreateDir_Click" />
  62. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="Load.ashx?type=image&file=Copy.gif"
  63. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
  64. OnClick="Copy_Click" />
  65. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="Load.ashx?type=image&file=move.gif"
  66. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
  67. OnClick="Move_Click" />
  68. <img src="Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]" class="dialogButton"
  69. onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  70. <img src="Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]" class="dialogButton"
  71. onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  72. <img src="Load.ashx?type=image&file=bestfit.gif" onclick="BestFit();" alt="[[BestFit]]" class="dialogButton"
  73. onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  74. <img src="Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]" class="dialogButton"
  75. onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  76. <img src="Load.ashx?type=image&file=resize.gif" id="img_AutoThumbnail" onclick="AutoThumbnail();" alt="[[AutoThumbnail]]" class="dialogButton"
  77. onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  78. <% if(secset.AllowModify) {%>
  79. <img  class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" src="Load.ashx?type=image&file=imageeditor.gif" id="img_ImageEditor" onclick="ImageEditor();" alt="[[ImageEditor]]" />
  80. <%
  81. }
  82. else
  83. {
  84. %>
  85. <img  class="CuteEditorButtonDisabled" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" src="Load.ashx?type=image&file=imageeditor.gif" alt="[[ImageEditor]]" />
  86. <%
  87. }
  88. %>
  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:260">
  95. <div style="BORDER: 1.5pt inset;  VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 260; HEIGHT: 250px; Padding:0; BACKGROUND-COLOR: white">
  96. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="0" Width="100%" CssClass="sortable">
  97. <asp:TableRow BackColor="#f0f0f0">
  98. <asp:TableHeaderCell Width="16px" >
  99. <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]"
  100. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" 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. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
  106. OnClick="DoRefresh_Click" />
  107. </asp:TableHeaderCell>
  108. <asp:TableHeaderCell id="name_Cell" Wrap="True" Width="125px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  109. <asp:TableHeaderCell id="size_Cell" Width="62px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  110. <asp:TableHeaderCell id="op_Cell"  Width="16px">&nbsp;</asp:TableHeaderCell>
  111. <asp:TableHeaderCell id="op_space" Width="1px"></asp:TableHeaderCell>
  112. </asp:TableRow>
  113. </asp:Table>
  114. </div>
  115. </td>
  116. <td valign="top"  style="white-space:nowrap; width:320">
  117. <div style="border:1.5pt inset; Padding:0; vertical-align: top; overflow: auto; WIDTH: 280px; HEIGHT: 250px;  BACKGROUND-COLOR: white;">
  118. <div id="divpreview" style="BACKGROUND-COLOR: white; height:100%;width:100%">
  119. <img id="img_demo" src="../Load.ashx?type=image&file=1x1.gif" alt="" />
  120. </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="2" cellpadding="0" width="98%" style="text-align:center">
  130. <tr>
  131. <td valign="top">
  132. <fieldset style="width:98%;">
  133. <legend>
  134. [[Insert]]</legend>
  135. <table border="0" cellpadding="5" cellspacing="0">
  136. <tr>
  137. <td>
  138. <table id="Table8" cellspacing="0" cellpadding="2" border="0" class="normal">
  139. <tr>
  140. <td valign="middle">[[Url]]:</td>
  141. <td>
  142.     <input type="text" id="TargetUrl" style="width:400" name="TargetUrl" runat="server" />
  143. </td>
  144. </tr>
  145. </table>
  146. </td>
  147. </tr>
  148. </table>
  149. </fieldset>
  150. <fieldset style="width:98%;text-align:left">
  151. <legend>
  152. [[Upload]] ([[MaxFileSizeAllowed]]
  153. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)%>
  154. )</legend>
  155.     <table border="0" cellpadding="5" cellspacing="0">
  156.                     <tr>
  157.         <td>
  158.     <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  159.     </td>
  160.     </tr>
  161.     <tr>
  162.     <td style="height:5">
  163.     </td>
  164.     </tr>
  165.     <tr>
  166.     <td>
  167.         <ul style="margin-top:0; margin-bottom:0;">
  168.                     <% if(secset.RestrictUploadedImageDimension) {%>
  169.                     <li>
  170.                     [[MaxImagedImension]]
  171.                     <%= secset.MaxImageWidth%>
  172.                     x
  173.                     <%= secset.MaxImageHeight%>
  174.                     [[pixels]].
  175.                     </li>
  176.                     <li>
  177.                     [[AutomaticImageResizeOnOff]]
  178.                     <%= secset.AutoResizeUploadedImages? "on":"off" %>
  179.                     .</li>
  180.                     <%}%>
  181.                     <li>
  182.                     <span style="white-space:nowrap">
  183.                     [[MaxFolderSizeAllowed]]: <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024)%>.
  184.                     [[Used]]: <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  185.                     <span style="background-color:green;height:3px;width:40px;font-size:3px">
  186.                     <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px"></span>
  187.                     </span>
  188.                     </span>
  189.                     </li>
  190.                 </ul>
  191.     </td>
  192.     </tr>
  193.      </table>
  194. </fieldset>
  195. <p style="text-align:center">
  196. <input class="inputbuttoninsert" type="button" value="[[OK]]" onclick="do_insert()" id="Button1" name="Button1" />
  197. &nbsp;&nbsp;&nbsp; 
  198. <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" name="Button2" />
  199. </p>
  200. </td>
  201. </tr>
  202. </table>
  203. </form>
  204. </body>
  205. <script runat="server">
  206. protected override void InitOfType()
  207. {
  208. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.ImageGalleryPath).TrimEnd('/')+"/";
  209. }
  210.     protected override void GetFiles(ArrayList files)
  211.     {
  212.         foreach (string ext in secset.ImageFilters)
  213.         {
  214.             if (ext == null || ext.Length == 0) continue;
  215.             files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  216.         }
  217.     }
  218.     protected override bool AllowFileName(string filename)
  219.     {
  220.         filename = filename.ToLower();
  221.         foreach (string ext in secset.ImageFilters)
  222.         {
  223.             if (ext == null || ext.Length == 0) continue;
  224.             if(filename.EndsWith(ext.ToLower()))
  225.                 return true;
  226.         }
  227.         return false;
  228.     }
  229.     
  230.     protected int GetUsedSpaceBarWidth()
  231.     {
  232.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxImageFolderSize * 1024));
  233.       if(w<1)
  234. w=1;
  235.   if(w>40)
  236. w=40;
  237.       return w;      
  238.     }
  239.     
  240.     protected override string CheckUploadData(ref byte[] data)
  241.     {  
  242. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxImageFolderSize * 1024)
  243.            return "Image folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024);
  244.           
  245.       
  246.         System.Drawing.Image img;
  247.         try
  248.         {
  249.             img = System.Drawing.Image.FromStream(new System.IO.MemoryStream(data));
  250.         }
  251.         catch
  252.         {
  253.             return "Image is in the wrong format.";
  254.         }
  255.         //let base class to implement
  256.         /*
  257.         
  258.         if (data.Length >= secset.MaxImageSize * 1024)
  259.            return "Image size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  260.         if(secset.RestrictUploadedImageDimension)
  261.         {
  262. if(secset.AutoResizeUploadedImages)
  263. {
  264. return null;//let base class implement the secset.AutoResizeUploadedImages
  265. }
  266. else
  267. {
  268. if ((img.Width > secset.MaxImageWidth) || ((img.Height > secset.MaxImageHeight)))
  269. return String.Format("Image dimension ({0} x {1} pixels) exceeding limits.", img.Width, img.Height);
  270. }
  271. }
  272. */
  273.         return null;
  274.     }
  275. </script>
  276. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  277. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_SelectImage.js"></script>
  278. </html>