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

OA系统

开发平台:

C#

  1. <%@ Page Language="C#" Inherits="CuteEditor.Dialogs.TemplateBrowserPage" %>
  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_InsertTemplate.Aspx?IsFrame=1&"+Request.ServerVariables["QUERY_STRING"];
  9. CuteEditor.CEU.WriteDialogOuterFrame(Context,"[[InsertTemplate]]",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. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)" />
  21. <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.1)" />
  22. <link href="Load.ashx?type=style&file=dialog.css" type="text/css" rel="stylesheet" />
  23. <!--[if IE]>
  24. <link href="Load.ashx?type=style&file=IE.css" type="text/css" rel="stylesheet" />
  25. <![endif]-->
  26. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogHead.js"></script>
  27. <script type="text/javascript">
  28. var OxO575b=[]; function PostBackAction(){ <%=Page.ClientScript.GetPostBackEventReference(hiddenAction,"")%> ;}  ;
  29. </script>
  30. <title></title>
  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. #framepreview {
  41. width: 100%;
  42. height: 100%;
  43. overflow:hidden;
  44. text-align: left;
  45. vertical-align: top;
  46. padding: 0px;
  47. margin: 0px;
  48. zoom: 50%;
  49. background-color: white;
  50. }
  51. </style>
  52. </head>
  53. <body>
  54. <form runat="server" enctype="multipart/form-data" id="Form1">
  55. <!-- start hidden -->
  56. <input type="hidden" runat="server" id="hiddenDirectory" name="hiddenDirectory" />
  57. <input type="hidden" runat="server" id="hiddenHTML" name="hiddenDirectory" />
  58. <input type="hidden" runat="server" id="hiddenFile" name="hiddenFile" /> 
  59. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAlert" name="hiddenAlert" />
  60. <input type="hidden" runat="server" enableviewstate="false" id="hiddenAction" onserverchange="hiddenAction_ServerChange"
  61. name="hiddenAction" /> <input type="hidden" runat="server" enableviewstate="false" id="hiddenActionData" name="hiddenActionData" />
  62. <!-- end hidden -->
  63. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  64. <tr>
  65. <td style="width:20">
  66. <asp:Image id="Image1" Runat="server" ImageUrl="../Load.ashx?type=image&file=openfolder.gif"></asp:Image>
  67. </td>
  68. <td style="width:240" class="normal">
  69. <asp:Label Runat="server" id="FolderDescription"></asp:Label>
  70. </td>
  71. <td>
  72. <asp:ImageButton id="CreateDir" BorderWidth="1" Runat="server" AlternateText="[[Createdirectory]]" ImageUrl="../Load.ashx?type=image&file=newfolder.gif"
  73. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="CreateDir_Click" />
  74. <asp:ImageButton id="Copy" BorderWidth="1" Runat="server" AlternateText="[[Copyfiles]]" ImageUrl="../Load.ashx?type=image&file=Copy.gif"
  75. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Copy_Click" />
  76. <asp:ImageButton id="Move" BorderWidth="1" Runat="server" AlternateText="[[Movefiles]]" ImageUrl="../Load.ashx?type=image&file=move.gif"
  77. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="Move_Click" />
  78. <img style="display:none" src="../Load.ashx?type=image&file=zoom_in.gif" onclick="Zoom_In();" alt="[[ZoomIn]]"
  79. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  80. <img style="display:none" src="../Load.ashx?type=image&file=zoom_out.gif" onclick="Zoom_Out();" alt="[[ZoomOut]]"
  81. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" /> 
  82. <img style="display:none" src="../Load.ashx?type=image&file=Actualsize.gif" onclick="Actualsize();" alt="[[ActualSize]]"
  83. class="dialogButton" onmouseover="CuteEditor_ColorPicker_ButtonOver(this);" />
  84. <asp:ImageButton id="NewTemplate" BorderWidth="1" Runat="server" AlternateText="[[NewTemplate]]" ImageUrl="../Load.ashx?type=image&file=newtemplate.gif"
  85. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="NewTemplate_Click" />
  86. </td>
  87. </tr>
  88. </table>
  89. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  90. <tr>
  91. <td valign="top" style="white-space:nowrap;width:250">
  92. <div style="BORDER: 1.5pt inset;  VERTICAL-ALIGN: middle; OVERFLOW: auto; WIDTH: 250px; HEIGHT: 240px; Padding:0; BACKGROUND-COLOR: white">
  93. <asp:Table id="FoldersAndFiles" Runat="server" CellSpacing="1" CellPadding="1" Width="100%"
  94. CssClass="sortable">
  95. <asp:TableRow BackColor="#f0f0f0">
  96. <asp:TableHeaderCell Width="16px">
  97. <asp:ImageButton id="Delete" Runat="server" AlternateText="Delete the selected files/directories"
  98. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" ImageUrl="../Load.ashx?type=image&file=s_cut.gif"
  99. Visible="true" OnClick="Delete_Click" />
  100. </asp:TableHeaderCell>
  101. <asp:TableHeaderCell Width="16px">
  102. <asp:ImageButton id="DoRefresh" Runat="server" AlternateText="[[Refresh]]" ImageUrl="../Load.ashx?type=image&file=s_refresh.gif"
  103. onMouseOver="CuteEditor_ColorPicker_ButtonOver(this);" Visible="true" OnClick="DoRefresh_Click" />
  104. </asp:TableHeaderCell>
  105. <asp:TableHeaderCell id="name_Cell" Width="136px" CssClass="filelistHeadCol" Font-Bold="False">[[Name]]</asp:TableHeaderCell>
  106. <asp:TableHeaderCell id="size_Cell" Width="72px" CssClass="filelistHeadCol" Font-Bold="False">[[Count]]/[[Size]]</asp:TableHeaderCell>
  107. <asp:TableHeaderCell id="op_Cell" Width="16px">&nbsp;</asp:TableHeaderCell>
  108. <asp:TableHeaderCell id="op_Cell2" Width="16px">&nbsp;</asp:TableHeaderCell>
  109. </asp:TableRow>
  110. </asp:Table>
  111. </div>
  112. </td>
  113. <td valign="top">
  114. <div style="BORDER: 1.5pt inset; VERTICAL-ALIGN: top; OVERFLOW: auto;WIDTH: 380px; HEIGHT: 240px; BACKGROUND-COLOR: white;">
  115. <iframe id="framepreview" src="../template.aspx"></iframe>
  116. </div>
  117. </td>
  118. </tr>
  119. </table>
  120. <br />
  121. <table border="0" cellspacing="2" cellpadding="0" width="98%">
  122. <tr>
  123. <td valign="top">
  124. </td>
  125. <td style="width:10">
  126. </td>
  127. <td valign="top">
  128. <input type="hidden" id="TargetUrl" size="40" name="TargetUrl" runat="server" />
  129. <fieldset id="fieldsetUpload">
  130. <legend>
  131. [[Upload]] ([[MaxFileSizeAllowed]]
  132. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxTemplateSize * 1024)%>
  133. )</legend>
  134. <table border="0" cellspacing="2" cellpadding="0" width="98%" class="normal">
  135. <tr>
  136. <td style="height:10">
  137. </td>
  138. </tr>
  139. <tr>
  140. <td valign="top" style="FONT-SIZE: 8pt; VERTICAL-ALIGN: middle; width:54%">
  141. <CE:UploadSingleFile id="InputFile" runat="server"></CE:UploadSingleFile>
  142. </td>
  143. </tr>
  144. <tr>
  145. <td style="width:5">
  146. </td>
  147. </tr>
  148. <tr>
  149. <td style="white-space:nowrap">
  150. [[MaxFolderSizeAllowed]]:
  151. <%= CuteEditor.Impl.FileStorage.FormatSize(secset.MaxTemplateFolderSize * 1024)%>. [[Used]]:
  152. <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %>
  153. <span style="background-color:green;height:3px;width:40px;font-size:3px">
  154. <span style="background-color:red;height:3px;width:<%= GetUsedSpaceBarWidth() %>px;font-size:3px">
  155. </span>
  156. </span>
  157. </td>
  158. </tr>
  159. </table>
  160. </fieldset>
  161. <div style="padding-top:4px;">
  162. <input class="inputbuttoninsert" type="button" value="[[Insert]]" onclick="do_insert()"
  163. id="Button1" />
  164. &nbsp;&nbsp;&nbsp; 
  165. <input class="inputbuttoncancel" type="button" value="[[Cancel]]" onclick="do_cancel()"
  166. id="Button2" />
  167. </div>
  168. </td>
  169. </tr>
  170. </table>
  171. </form>
  172. <script runat="server">
  173. protected override void InitOfType()
  174. {
  175. fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,secset.TemplateGalleryPath).TrimEnd('/')+"/";
  176. }
  177.     protected override void GetFiles(ArrayList files)
  178.     {
  179. foreach (string ext in secset.TemplateFilters)
  180. {
  181. if (ext == null || ext.Length == 0) continue;
  182. if ( ext.Length > 4 )
  183. {
  184. if ( !secset.TemplateFilters.Contains( ext.Substring( 0, 4 ) ) )
  185. {
  186. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  187. }
  188. }
  189. else
  190. files.AddRange(fs.GetFileItems(CurrentDirectory, secset.FileNamePrefix + "*" + ext));
  191. }
  192.     }
  193.     protected override bool AllowFileName(string filename)
  194.     {
  195. filename = filename.ToLower();
  196. foreach (string ext in secset.TemplateFilters)
  197. {
  198. if (ext == null || ext.Length == 0) continue;
  199. if(filename.EndsWith(ext.ToLower()))
  200. return true;
  201. }
  202. return false;
  203.     }
  204.     protected override string CheckUploadData(ref byte[] data)
  205.     {
  206. if (fs.GetDirectorySize(fs.VirtualRoot) >= secset.MaxTemplateFolderSize * 1024)
  207.            return "Template folder size exceeds the limit: "+ CuteEditor.Impl.FileStorage.FormatSize(secset.MaxTemplateFolderSize * 1024);
  208. if (data.Length >= secset.MaxTemplateSize * 1024)
  209.             return "Template size exceeds "+CuteEditor.Impl.FileStorage.FormatSize(secset.MaxTemplateSize * 1024)+" limit: "+ CuteEditor.Impl.FileStorage.FormatSize(data.Length);
  210.         return null;
  211.     }
  212.     
  213.     protected int GetUsedSpaceBarWidth()
  214.     {
  215.       int w = Convert.ToInt32(40*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxTemplateFolderSize * 1024));
  216.       if(w<1)
  217. w=1;
  218.   if(w>40)
  219. w=40;
  220.       return w;      
  221.     }
  222. </script>
  223. </body>
  224. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=DialogFoot.js"></script>
  225. <script type="text/javascript" src="Load.ashx?type=dialogscript&file=Dialog_InsertTemplate.js"></script>
  226. </html>