Attachment_index.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <style>
  2. html{_overflow-y:scroll}
  3. .swfupload {position: absolute;z-index: 1;}
  4. .mainnav_title {display:none;}
  5. </style>
  6. <link href="__ROOT__/Public/Js/swfupload/swfupload.css" rel="stylesheet" type="text/css" />
  7. <link rel="stylesheet" href="/js/layui/css/layui.css">
  8. <script src="/js/layui/layui.js"></script>
  9. <script type="text/javascript" src="__ROOT__/Public/Js/swfupload/swfupload.js"></script>
  10. <script type="text/javascript" src="__ROOT__/Public/Js/swfupload/fileprogress.js"></script>
  11. <script type="text/javascript" src="__ROOT__/Public/Js/swfupload/handlers.js"></script>
  12. <script type="text/javascript">
  13. $.ajaxSetup ({ cache: false });
  14. var file_limit = {$file_limit};
  15. var swfu;
  16. function ajaxload(typeid,page,inputid,isadmin)
  17. {
  18. var data = '';
  19. var url = "{:U('Attachment/filelist')}&typeid="+typeid+"&p="+page+"&inputid="+inputid+"&isadmin="+isadmin;
  20. $.ajax({
  21. type: "POST",
  22. url: url,
  23. data: data,
  24. success: function(msg){
  25. $('#'+inputid).html(msg);
  26. for(var i=0;i<ids.length;i++){
  27. $('#on_'+ids[i]).addClass("on");
  28. }
  29. }
  30. });
  31. }
  32. </script>
  33. <div id="content">
  34. <div id="tabs">
  35. <div class="title"><ul><li class="on"><a href="javascript:void(0);">{:L('upload_file')}</a></li>
  36. <li><a href="javascript:void(0);">{:L('upload_url')}</a></li>
  37. <if condition="!empty($more)">
  38. <li><a href="javascript:void(0);" onclick="ajaxload(1,1,'filelist',<?php echo $isadmin;?>);">{:L('upload_list_file')}</a></li>
  39. <li><a href="javascript:void(0);" onclick="ajaxload(0,1,'nouselist',<?php echo $isadmin;?>);">{:L('upload_unuse_file')}</a></li>
  40. </if>
  41. <if condition="!empty($no_use_files)">
  42. <li style="border:0;background:none;"><a href="{:U('Attachment/cleanfile?isadmin='.$isadmin)}" style="color:#FB0000;">{:L('no_use_files')}</a></li>
  43. </if>
  44. </ul></div>
  45. <div class="content_1">
  46. <div class="tabbox" style="display:block;">
  47. <div id="divMovieContainer">
  48. <!-- <div class="selectbut"><span id="spanButtonPlaceHolder"></span></div>
  49. <input type="button" value="{:L('start_upload')}" id="uploadbut" onclick="swfu.startUpload();"/> -->
  50. <div style="display: inline-block;float:left;">
  51. <button type="button" class="layui-btn layui-btn-sm" id="upload">
  52. <i class="layui-icon">&#xe67c;</i>上传图片
  53. </button>
  54. </div>
  55. <div style="color:#959595;line-height:24px;height:24px;background:url() no-repeat;padding-left:20px;"><input type="checkbox" id="addwater" name="addwater" value="1" onclick="addwater_enable();" <if condition="$watermark_enable==1"> checked</if>/> <font color="green">{:L('upload_add_water')}</font> , {:L('upload_say4')} <font color="red">{$file_types}</font> {:L('upload_say5')}</div><br>
  56. <div style="color:#454545;clear:both;line-height:24px;height:24px;"> {:L('upload_say1')} <font color="red">{$file_limit}</font> {:L('upload_say2')} <font color="red">{$file_size}</font> {:L('upload_say3')}</div>
  57. </div>
  58. <!-- <div id="divStatus">{:L('upload_say6')}<span id="tdFilesQueued">0</span>{:L('upload_say7')}<span id="tdErrors">0</span> {:L('upload_say8')}<span id="tdFilesUploaded">0</span> {:L('upload_say9')}</div> -->
  59. <fieldset id="swfupload-box">
  60. <legend>{:L('file_list')}</legend>
  61. <ul id="fsUploadProgress"></ul>
  62. <ul class="attachment-list" id="thumbnails"></ul>
  63. </fieldset>
  64. </div>
  65. <div class="tabbox">
  66. <br>
  67. {:L('upload_fileurl')}: <input type="text" id="fileurl" name="fileurl" class="input-text" value="" style="width:350px;" onblur="addfileurl(this)">
  68. <br><br><br>
  69. </div>
  70. <div class="tabbox">
  71. <div id="filelist"></div>
  72. </div>
  73. <div class="tabbox">
  74. <div id="nouselist"></div>
  75. </div>
  76. </div>
  77. </div>
  78. <div id="myuploadform" style="display:none;" ></div>
  79. <script>
  80. new Tabs("#tabs",".title ul li",".content_1",".tabbox","on",1);
  81. function addfileurl(obj) {
  82. var strs = $(obj).val() ? $(obj).val() : '';
  83. if(strs){
  84. var datas='<div id="uplist_1"><input type="hidden" id="aids" name="aids" value="0" /><input type="text" id="filedata" name="filedata" value="'+strs+'" /><input type="text" id="namedata" name="namedata" value="" /> &nbsp;<a href="javascript:remove_this(\'uplist_1\');">{:L('remove')}</a> </div>';
  85. $('#myuploadform').html(datas);
  86. $('#thumbnails a ').removeClass("on");
  87. $('.img a ').removeClass("on");
  88. }else{
  89. $('#myuploadform').html('');
  90. }
  91. }
  92. var insert2Xheditor = insert2Xheditor || function(){
  93. <if condition="$_GET[immediate]==1">var immediate='!';</if>
  94. var arrMsg=[],img = '',data = '',i=0;
  95. var num = $('#myuploadform > div').length;
  96. if(num){
  97. $('#myuploadform div').each(function(){
  98. var status = $(this).find('#status').val();
  99. var aid = $(this).find('#aids').val();
  100. var src = $(this).find('#filedata').val();
  101. var name = $(this).find('#namedata').val();
  102. if(status!=0) aid=0;
  103. arrMsg[i]= { "url":immediate+src,"localfile":name,"id":aid,"editorid":"{$_GET[editorid]}" };
  104. i++;
  105. });
  106. // $('#{$_GET[editorid]}_aid_box').append(data);
  107. }
  108. //arrMsg.push({"name":"","url":"!200906030521128703.gif","id":});
  109. callback(arrMsg);
  110. }
  111. layui.use('upload', function () {
  112. var upload = layui.upload;
  113. //执行实例
  114. var uploadInst = upload.render({
  115. elem: '#upload' //绑定元素
  116. , url: '{:U('Attachment/upload')}' //上传接口
  117. , data:{ "PHPSESSID": "<?php echo $sessid;?>", "isadmin": "<?php echo $isadmin;?>", "userid": "<?php echo $userid?>", "swf_auth_key": "<?php echo $swf_auth_key;?>", "isthumb": "<?php echo $isthumb;?>", "moduleid": "<?php echo $moduleid?>", "addwater": "<?php echo intval($watermark_enable);?>", "lang": "<?php echo $lang;?>" }
  118. ,multiple :true
  119. ,number:file_limit
  120. , done: function (res) {
  121. if (res.status == 1) {
  122. file_limit--;
  123. if(file_limit <= 0){
  124. $('#divMovieContainer').hide();
  125. }
  126. add_uploadok(res.data);
  127. }
  128. }
  129. , error: function () {
  130. }
  131. });
  132. $('#addwater').on('click', function () {
  133. if ($(this).attr('checked')) {
  134. uploadInst.config.data.addwater = "1"
  135. } else {
  136. uploadInst.config.data.addwater = ""
  137. }
  138. })
  139. })
  140. </script>
  141. <if condition="!empty($_GET[editorid])">
  142. <div id="bootline"></div>
  143. <div id="btnbox" class="btn" style="padding-left:450px;">
  144. <INPUT TYPE="submit" onclick="insert2Xheditor();" value="{:L(dosubmit)}" class="button " >
  145. <input TYPE="reset" onclick="unloadme();" value="{:L(cancel)}" class="button">
  146. </div>
  147. </if>