- <%@ Page Language="C#" Inherits="CuteEditor.Dialogs.FileBrowserPage" %>
- <%@ Register TagPrefix="CE" Assembly="CuteEditor" Namespace="CuteEditor" %>
- <script runat="server">
- override protected void OnInit(EventArgs args)
- {
- if(Context.Request.QueryString["IsFrame"]==null)
- {
- string FrameSrc="SelectImage.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
- CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[Browse]]",FrameSrc);
- Context.Response.End();
- }
- base.OnInit(args);
- }
- </script>
- <%
- string QUERY_STRING=Request.ServerVariables["QUERY_STRING"];
- %>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)" />
- <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.1)" />
- <link href="Load.ashx?type=style&file=dialog.css" type="text/css" rel="stylesheet" />
- <!--[if IE]>
- <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
- <![endif]-->
- <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogHead.js"></script>
- <script type="text/javascript">
- var OxOc8d7=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;} ;
- </script>
- <style type="text/css">
- .row { HEIGHT: 22px }
- .cb { VERTICAL-ALIGN: middle }
- .itemimg { VERTICAL-ALIGN: middle }
- .editimg { VERTICAL-ALIGN: middle }
- .cell1 { VERTICAL-ALIGN: middle }
- .cell2 { VERTICAL-ALIGN: middle }
- .cell3 { PADDING-RIGHT: 4px; VERTICAL-ALIGN: middle; TEXT-ALIGN: right }
- .cb { }
- </style>
- </head>
- <body>
- <form runat="server" enctype="multipart/form-data" id="Form1">
- <!-- start hidden -->
- <input type="hidden" runat="server" id="hiddenDirectory" name="hiddenDirectory" />
- <input type="hidden" runat="server" id="hiddenFile" name="hiddenFile" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
- <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange"
- name="hiddenAction" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
- <!-- end hidden -->
- <table border="0" cellspacing="2" cellpadding="0" width="100%">
- <tr>
- <td style="white-space:nowrap; width:20" >
- <asp:Image id="Image1" Runat="server" ImageUrl="Load.ashx?type=image&file=openfolder.gif"></asp:Image>
- </td>
- <td class="normal" style="white-space:nowrap;width:200" >
- <asp:Label Runat="server" id="FolderDescription"></asp:Label>
- </td>
- <td style="text-align:center">
- <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="Load.ashx?type=image&file=newfolder.gif"
- onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
- OnClick="CreateDir_Click" />
- <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="Load.ashx?type=image&file=Copy.gif"
- onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
- OnClick="Copy_Click" />
- <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="Load.ashx?type=image&file=move.gif"
- onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
- OnClick="Move_Click" />
- <img src="Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]" class="dialogButton"
- onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
- <img src="Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]" class="dialogButton"
- onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
- <img src="Load.ashx?type=image&file=bestfit.gif" onclick="BestFit();" alt="[[BestFit]]" class="dialogButton"
- onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
- <img src="Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]" class="dialogButton"
- onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
- <img src="Load.ashx?type=image&file=resize.gif" id="img_AutoThumbnail" onclick="AutoThumbnail();" alt="[[AutoThumbnail]]" class="dialogButton"
- onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
- <% if(secset.AllowModify) {%>
- <img class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" src="Load.ashx?type=image&file=imageeditor.gif" id="img_ImageEditor" onclick="ImageEditor();" alt="[[ImageEditor]]" />
- <%
- }
- else
- {
- %>
- <img class="CuteEditorButtonDisabled" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" src="Load.ashx?type=image&file=imageeditor.gif" alt="[[ImageEditor]]" />
- <%
- }
- %>
- </td>
- </tr>
- </table>
- <table border="0" cellspacing="0" cellpadding="2" width="100%">
- <tr>
- <td valign="top" style="white-space:nowrap; width:260">
- <div style="BORDER: 1.5pt inset; VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 260; HEIGHT: 250px; Padding:0; BACKGROUND-COLOR: white">
- <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="0" Width="100%" CssClass="sortable">
- <asp:TableRow BackColor="#f0f0f0">
- <asp:TableHeaderCell Width="16px" >
- <asp:ImageButton id="Delete" Runat="server" AlternateText="[[Deletefiles]]"
- onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" ImageUrl="Load.ashx?type=image&file=s_cut.gif"
- Visible="true" OnClick="Delete_Click" />
- </asp:TableHeaderCell>
- <asp:TableHeaderCell Width="16px" >
- <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="Load.ashx?type=image&file=s_refresh.gif"
- onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true"
- OnClick="DoRefresh_Click" />
- </asp:TableHeaderCell>
- <asp:TableHeaderCell id="name_Cell" Wrap="True" Width="125px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
- <asp:TableHeaderCell id="size_Cell" Width="62px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
- <asp:TableHeaderCell id="op_Cell" Width="16px"> </asp:TableHeaderCell>
- <asp:TableHeaderCell id="op_space" Width="1px"></asp:TableHeaderCell>
- </asp:TableRow>
- </asp:Table>
- </div>
- </td>
- <td valign="top" style="white-space:nowrap; width:320">
- <div style="border:1.5pt inset; Padding:0; vertical-align: top; overflow: auto; WIDTH: 280px; HEIGHT: 250px; BACKGROUND-COLOR: white;">
- <div id="divpreview" style="BACKGROUND-COLOR: white; height:100%;width:100%">
- <img id="img_demo" src="../Load.ashx?type=image&file=1x1.gif" alt="" />
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2" style="height:2">
- </td>
- </tr>
- </table>
- <table border="0" cellspacing="2" cellpadding="0" width="98%" style="text-align:center">
- <tr>
- <td valign="top">
- <fieldset style="width:98%;">
- <legend>
- [[Insert]]</legend>
- <table border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <table id="Table8" cellspacing="0" cellpadding="2" border="0" class="normal">
- <tr>
- <td valign="middle">[[Url]]:</td>
- <td>
- <input type="text" id="TargetUrl" style="width:400" name="TargetUrl" runat="server" />
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </fieldset>
- <fieldset style="width:98%;text-align:left">
- <legend>
- [[Upload]] ([[MaxFileSizeAllowed]]
- <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)%>
- )</legend>
- <table border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
- </td>
- </tr>
- <tr>
- <td style="height:5">
- </td>
- </tr>
- <tr>
- <td>
- <ul style="margin-top:0; margin-bottom:0;">
- <% if(secset.RestrictUploadedImageDimension) {%>
- <li>
- [[MaxImagedImension]]
- <%= secset.MaxImageWidth%>
- x
- <%= secset.MaxImageHeight%>
- [[pixels]].
- </li>
- <li>
- [[AutomaticImageResizeOnOff]]
- <%= secset.AutoResizeUploadedImages? "on":"off" %>
- .</li>
- <%}%>
- <li>
- <span style="white-space:nowrap">
- [[MaxFolderSizeAllowed]]: <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024)%>.
- [[Used]]: <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
- <span style="background-color:green;height:3px;width:40px;font-size:3px">
- <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px"></span>
- </span>
- </span>
- </li>
- </ul>
- </td>
- </tr>
- </table>
- </fieldset>
- <p style="text-align:center">
- <input class="inputbuttoninsert" type="button" value="[[OK]]" onclick="do_insert()" id="Button1" name="Button1" />
-
- <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()" id="Button2" name="Button2" />
- </p>
- </td>
- </tr>
- </table>
- </form>
- </body>
- <script runat="server">
- protected override void InitOfType()
- {
- fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.ImageGalleryPath).TrimEnd('/')+"/";
- }
- protected override void GetFiles(ArrayList files)
- {
- foreach (string ext in secset.ImageFilters)
- {
- if (ext == null || ext.Length == 0) continue;
- files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
- }
- }
- protected override bool AllowFileName(string filename)
- {
- filename = filename.ToLower();
- foreach (string ext in secset.ImageFilters)
- {
- if (ext == null || ext.Length == 0) continue;
- if(filename.EndsWith(ext.ToLower()))
- return true;
- }
- return false;
- }
- protected int GetUsedSpaceBarWidth()
- {
- int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxImageFolderSize * 1024));
- if(w<1)
- w=1;
- if(w>40)
- w=40;
- return w;
- }
- protected override string CheckUploadData(ref byte[] data)
- {
- if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxImageFolderSize * 1024)
- return "Image folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageFolderSize * 1024);
- System.Drawing.Image img;
- try
- {
- img = System.Drawing.Image.FromStream(new System.IO.MemoryStream(data));
- }
- catch
- {
- return "Image is in the wrong format.";
- }
- //let base class to implement
- /*
- if (data.Length >= secset.MaxImageSize * 1024)
- return "Image size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxImageSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
- if(secset.RestrictUploadedImageDimension)
- {
- if(secset.AutoResizeUploadedImages)
- {
- return null;//let base class implement the secset.AutoResizeUploadedImages
- }
- else
- {
- if ((img.Width > secset.MaxImageWidth) || ((img.Height > secset.MaxImageHeight)))
- return String.Format("Image dimension ({0} x {1} pixels) exceeding limits.", img.Width, img.Height);
- }
- }
- */
- return null;
- }
- </script>
- <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
- <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_SelectImage.js"></script>
- </html>