RoadFlow2.1 临时演示

Default.aspx 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebForm.Controls.UploadFiles.Default" %>
  2. <!DOCTYPE html>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <title></title>
  7. </head>
  8. <body>
  9. <form id="form1" runat="server">
  10. <%
  11. string extName = Request.QueryString["filetype"];
  12. string tmpID = Guid.NewGuid().ToString("N");
  13. string tmpID1 = RoadFlow.Platform.Users.CurrentUserID.ToString();
  14. RoadFlow.Cache.IO.Opation.Set(tmpID, tmpID1);
  15. %>
  16. <script src="Uploadify/jquery.uploadify.js?v=<%=RoadFlow.Utility.DateTimeNew.Now.Ticks %>" type="text/javascript"></script>
  17. <style type="text/css">
  18. .uploadify-ico{border:none 0;vertical-align:middle;margin-right:3px;}
  19. </style>
  20. <table cellpadding="0" cellspacing="1" border="0" width="98%" align="center" style="margin-top:8px;">
  21. <tr>
  22. <td style="height:40px;" id="uploadtable"><input id="file_upload" name="file_upload" type="file" multiple="true" /></td>
  23. <td align="right" style="padding-right:20px;">
  24. <input type="button" class="mybutton" value="删除所选" onclick="delselect()" />
  25. <input type="button" class="mybutton" value="&nbsp;确&nbsp;&nbsp;认&nbsp;" onclick="confirm1();" />
  26. <input type="button" class="mybutton" value="&nbsp;关&nbsp;&nbsp;闭&nbsp;" onclick="closewin();" />
  27. </td>
  28. </tr>
  29. </table>
  30. <div id="queue" style="margin:0 auto 5px 0;"></div>
  31. <div id="filelist">
  32. <table cellpadding="0" cellspacing="1" border="0" id="filetable" width="98%" class="listtable" style="width:98%; margin:0 auto;">
  33. <thead>
  34. <tr>
  35. <th style="width:70%">文件</th>
  36. <th style="width:20%">大小(KB)</th>
  37. <th><input type="checkbox" id="checkall" onclick="checkallbox(this);" style="vertical-align:middle;" />删除</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <%
  42. string files = Request.QueryString["files"];
  43. if (!files.IsNullOrEmpty())
  44. {
  45. string[] filesArray = files.Split('|');
  46. foreach (string file in filesArray)
  47. {
  48. string size = RoadFlow.Utility.Tools.GetFileSize(Server.MapPath(file));
  49. %>
  50. <tr>
  51. <td style="background:#ffffff;"><a target="_blank" href="<%=file %>"><img alt="" class="uploadify-ico" src="../../Images/ico/doc_stand.png" style="border:none;" /><%=file.Substring(file.LastIndexOf('/')+1) %></a></td>
  52. <td style="background:#ffffff;"><%=size %></td>
  53. <td style="background:#ffffff;"><input type="checkbox" name="delfile" value="<%=file %>" /></td>
  54. </tr>
  55. <%
  56. }
  57. }
  58. %>
  59. </tbody>
  60. </table>
  61. </div>
  62. <script type="text/javascript">
  63. var win = new RoadUI.Window();
  64. var eid = '<%=Request.QueryString["eid"]%>';
  65. $(function ()
  66. {
  67. $('#file_upload').uploadify({
  68. 'formData': { "str1": "<%=tmpID%>", "str2": "<%=tmpID1%>", "filetype": "<%=extName%>" },
  69. 'swf': 'Uploadify/uploadify.swf' + '?ver=' + new Date().toString(),
  70. 'uploader': 'Upload.ashx',
  71. 'buttonText': '添加文件',
  72. 'fileTypeDesc': '文件',
  73. 'fileTypeExts': '<%=extName%>',
  74. 'auto': true,
  75. 'multi': true,
  76. 'queueID': 'queue',
  77. 'onUploadSuccess': function (file, data, response)
  78. {
  79. var dataArray = data.split('|');
  80. if (dataArray.length > 0 && dataArray[0] == "1")
  81. {
  82. addFile(file, dataArray);
  83. }
  84. else
  85. {
  86. alert(data);
  87. }
  88. },
  89. 'onSelect': function ()
  90. {
  91. $("#queue").show();
  92. },
  93. 'onQueueComplete': function ()
  94. {
  95. $("#queue").hide(1000);
  96. }
  97. });
  98. });
  99. function addFile(file, dataArray)
  100. {
  101. if (dataArray.length != 4) return;
  102. var tr = '<tr>';
  103. tr += '<td style="background:#ffffff;">';
  104. tr += '<a href="' + dataArray[1] + '" target="_blank">';
  105. tr += '<img src="../../Images/ico/doc_stand.png" alt="" class="uploadify-ico" />';
  106. tr += dataArray[3];
  107. tr += '</a>';
  108. tr += '</td>';
  109. tr += '<td style="background:#ffffff;">';
  110. tr += dataArray[2];
  111. tr += '</td>';
  112. tr += '<td style="background:#ffffff;">';
  113. tr += '<input type="checkbox" name="delfile" value="' + dataArray[1] + '" />';
  114. tr += '</td>';
  115. tr += '</tr>';
  116. $("#filetable tbody").append(tr);
  117. return false;
  118. }
  119. function checkallbox(box)
  120. {
  121. $("input[name='delfile']").prop("checked", $(box).prop("checked"));
  122. }
  123. function confirm1()
  124. {
  125. var title = [];
  126. var value = [];
  127. $("#filetable tbody tr").each(function ()
  128. {
  129. var filename = $("td:eq(0)", $(this)).text();
  130. var filepathname = $("input[name='delfile']", $(this)).val();
  131. title.push(filename);
  132. value.push(filepathname);
  133. });
  134. var ele = win.getOpenerElement(eid);
  135. var ele1 = win.getOpenerElement(eid + "_text");
  136. if (ele1 != null && ele1.size() > 0)
  137. {
  138. ele1.val('共' + value.length + '个文件');
  139. }
  140. if (ele != null && ele.size() > 0)
  141. {
  142. ele.val(value.join('|'));
  143. }
  144. closewin();
  145. }
  146. function closewin()
  147. {
  148. try
  149. {
  150. $('#file_upload').uploadify('destroy');
  151. } catch (e)
  152. {
  153. }
  154. win.close();
  155. }
  156. function delselect()
  157. {
  158. if ($(":checkbox[name='delfile']:checked").size() == 0)
  159. {
  160. alert("您没有选择要删除的文件!"); return;
  161. }
  162. $(":checkbox[name='delfile']:checked").each(function ()
  163. {
  164. var box = $(this);
  165. var file = box.val();
  166. $.getScript("Delete.ashx?file=" + file+"&str1=<%=tmpID%>&str2=<%=tmpID1%>", function ()
  167. {
  168. if ("1" == json.success)
  169. {
  170. box.parent().parent().remove();
  171. }
  172. else
  173. {
  174. alert(json.message);
  175. }
  176. });
  177. });
  178. }
  179. </script>
  180. </form>
  181. </body>
  182. </html>