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