Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

free_content.htm 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. {include file="public/layout" /}
  2. {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
  3. {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
  4. {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
  5. <body style="background-color: #FFF; overflow: auto;min-width:auto;">
  6. <div id="toolTipLayer"
  7. style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  8. <div id="append_parent"></div>
  9. <div id="ajaxwaitid"></div>
  10. <div class="page" style="min-width:auto;box-shadow:none;">
  11. <form class="form-horizontal" id="post_form" action="{:url('Article/add')}" method="post">
  12. <div class="ncap-form-default" style="overflow: unset;">
  13. <div id="free_content_dl">
  14. <textarea class="span12 ckeditor" id="free_content" data-func="free_content" name="free_content" title="">{$free_content}</textarea>
  15. <div class="opt-moreOper" style="margin-top: 20px;">
  16. <p>
  17. <a href="javascript:void(0);" onclick="remote_to_local_free_content();" class="ncap-btn2">远程图片本地化</a>&nbsp;
  18. <a href="javascript:void(0);" onclick="replace_links_free_content();"
  19. class="ncap-btn2">清除非本站链接</a>&nbsp;
  20. </p>
  21. </div>
  22. </div>
  23. </div>
  24. <script type="text/javascript">
  25. // 打开多图选择及上传界面
  26. function OpenImagesList(e, obj) {
  27. var OpenUrl = "{:url('Uploadimgnew/upload', ['num'=>30, 'path'=>'allimg', 'is_water'=>1])}";
  28. OpenUrl += "&func=images_call_content";
  29. top.layer.open({
  30. type: 2,
  31. title: '图片上传',
  32. shade: layer_shade,
  33. maxmin: false,
  34. shadeClose: false,
  35. area: ['1000px', '625px'],
  36. content: OpenUrl
  37. });
  38. }
  39. var ue_free_content = UE.getEditor('free_content', {
  40. serverUrl: "{:url('Ueditor/index',array('savepath'=>'allimg'))}",
  41. zIndex: 999,
  42. initialFrameWidth: "100%", //初化宽度
  43. initialFrameHeight: 450, //初化高度
  44. focus: false, //初始化时,是否让编辑器获得焦点true或false
  45. maximumWords: 99999,
  46. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
  47. pasteplain: false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  48. autoHeightEnabled: false,
  49. toolbars: ueditor_toolbars
  50. });
  51. ue_free_content.ready(function() {
  52. ue_free_content.setContent($("#free_content",window.parent.document).val());
  53. });
  54. //必须在提交前渲染编辑器;
  55. function free_content() {
  56. //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
  57. if (UE.getEditor("free_content").queryCommandState('source') != 0) {
  58. UE.getEditor("free_content").execCommand('source'); //切换到【设计】视图
  59. }
  60. }
  61. // 加载图片到编辑器指定位置
  62. function images_call_content(fileurl_tmp,filename_tmp) {
  63. var addBody = '';
  64. $.each(fileurl_tmp, function(index, items) {
  65. addBody += '<p><img src="'+items+'" alt="'+filename_tmp[index]+'"></p>';
  66. });
  67. UE.getEditor("free_content").execCommand('inserthtml', addBody);
  68. }
  69. // 自动远程图片本地化/自动清除非本站链接
  70. function ajax_auto_editor_content(local,link) {
  71. var body = UE.getEditor("free_content").getContent();
  72. $.ajax({
  73. type: 'POST',
  74. url: "{:url('Archives/ajax_auto_editor')}",
  75. data: {local:local,link:link,body:body,_ajax:1},
  76. dataType: "JSON",
  77. async:false,
  78. success: function(res){
  79. if (res.code == 1) {
  80. UE.getEditor("free_content").setContent(res.data.body);
  81. }
  82. }
  83. });
  84. }
  85. // 远程图片本地化
  86. function remote_to_local_free_content() {
  87. var body = UE.getEditor("free_content").getContent();
  88. layer_loading('下载中');
  89. $.ajax({
  90. type: 'POST',
  91. url: "{:url('Archives/ajax_remote_to_local')}",
  92. data: {body: body, _ajax: 1},
  93. dataType: "JSON",
  94. success: function (res) {
  95. layer.closeAll();
  96. if (res.code == 1) {
  97. UE.getEditor("free_content").setContent(res.data.body);
  98. layer.msg(res.msg, {icon: 1, time: 1000});
  99. } else {
  100. showErrorMsg(res.msg);
  101. }
  102. },
  103. error: function (e) {
  104. layer.closeAll();
  105. showErrorMsg(res.msg);
  106. }
  107. });
  108. }
  109. // 清除非本站链接
  110. function replace_links_free_content() {
  111. var body = UE.getEditor("free_content").getContent();
  112. layer_loading('正在处理');
  113. $.ajax({
  114. type: 'POST',
  115. url: "{:url('Archives/ajax_replace_links')}",
  116. data: {body: body, _ajax: 1},
  117. dataType: "JSON",
  118. success: function (res) {
  119. layer.closeAll();
  120. if (res.code == 1) {
  121. UE.getEditor("free_content").setContent(res.data.body);
  122. layer.msg(res.msg, {icon: 1, time: 1000});
  123. } else {
  124. showErrorMsg(res.msg);
  125. }
  126. },
  127. error: function (e) {
  128. layer.closeAll();
  129. showErrorMsg(res.msg);
  130. }
  131. });
  132. }
  133. </script>
  134. <div class="ncap-form-default">
  135. <div>
  136. <a href="JavaScript:void(0);" onclick="confirm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  137. </div>
  138. </div>
  139. </form>
  140. </div>
  141. <script>
  142. // 判断输入框是否为空
  143. function confirm(){
  144. var content = ue_free_content.getContent()
  145. var parentObj = parent.layer.getFrameIndex(window.name);
  146. var _parent = parent;
  147. _parent.layer.close(parentObj);
  148. $("#free_content",window.parent.document).val(content);
  149. }
  150. </script>
  151. {include file="public/footer" /}