Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

new_appoint_tplfile.htm 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {include file="public/layout" /}
  2. <link rel="stylesheet" type="text/css" href="__SKIN__/js/codemirror/codemirror.css?v={$version}">
  3. <script type="text/javascript" src="__SKIN__/js/codemirror/codemirror.js?v={$version}"></script>
  4. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/xml/xml.js?v={$version}"></script>
  5. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/javascript/javascript.js?v={$version}"></script>
  6. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/css/css.js?v={$version}"></script>
  7. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/php/php.js?v={$version}"></script>
  8. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/clike/clike.js?v={$version}"></script>
  9. <script type="text/javascript" src="__SKIN__/js/codemirror/mode/htmlmixed/htmlmixed.js?v={$version}"></script>
  10. <body style="background-color: #FFF; overflow: auto;min-width:auto;">
  11. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  12. <div id="append_parent"></div>
  13. <div id="ajaxwaitid"></div>
  14. <div class="page" style="min-width:auto;box-shadow:none;">
  15. <form class="form-horizontal" id="post_form" action="{:url('Ajax/new_appoint_tplfile')}" method="post">
  16. <div class="ncap-form-default">
  17. <dl class="row">
  18. <dt class="tit">模板目录</dt>
  19. <dd class="opt">
  20. {$tpldirpath}
  21. <span class="err"></span>
  22. <p class="notic"></p>
  23. </dd>
  24. </dl>
  25. <dl class="row">
  26. <dt class="tit">
  27. <label for="url"><em>*</em>文件名称</label>
  28. </dt>
  29. <dd class="opt">
  30. {$type}_<input type="text" name="filename" value="" id="filename" placeholder="自定义" tabindex="2" onkeyup="this.value=this.value.replace(/[^\w\-]/g,'');" onpaste="this.value=this.value.replace(/[^\w\-]/g,'')" autocomplete="off">.htm
  31. <span class="err"></span>
  32. <p class="notic">只允许字母、数字、下划线、连接符的任意组合</p>
  33. <p class="red" id="txt_filename"></p>
  34. </dd>
  35. </dl>
  36. <dl class="row">
  37. <dt class="tit">
  38. <label for="content">HTML代码</label>
  39. </dt>
  40. <dd class="opt">
  41. <textarea name='content' id="content" style='width:99%;height:500px;background:#ffffff;' tabindex="3"></textarea>
  42. <span class="err"></span>
  43. <p class="notic"></p>
  44. </dd>
  45. </dl>
  46. <div class="bot">
  47. <input type="hidden" id="type" name="type" value="{$type}" />
  48. <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn" tabindex="4">确认提交</a>
  49. </div>
  50. </div>
  51. </form>
  52. </div>
  53. <script type="text/javascript">
  54. var editor = '';
  55. $(function(){
  56. editor = CodeMirror.fromTextArea(document.getElementById('content'), {
  57. lineNumbers: true, // 显示行号
  58. lineWrapping: true, // 在行槽中添加行号显示器、折叠器、语法检测器`
  59. autofocus:true, //自动聚焦
  60. mode: 'text/html'
  61. });
  62. editor.setSize('auto','500px');
  63. $('#filename').keyup(function(){
  64. $.ajax({
  65. type: "POST",
  66. url: "{:url('Ajax/new_appoint_tplfile', ['nosubmit'=>1,'_ajax'=>1])}",
  67. data: $('#post_form').serialize(),
  68. dataType: 'json',
  69. success: function (res) {
  70. if(res.code == 1){
  71. $('#txt_filename').html('');
  72. } else {
  73. $('#txt_filename').html(res.msg);
  74. }
  75. }
  76. });
  77. });
  78. });
  79. // 判断输入框是否为空
  80. function checkForm(){
  81. if($('input[name=filename]').val() == ''){
  82. showErrorMsg('文件名称不能为空!');
  83. $('input[name=filename]').focus();
  84. return false;
  85. }
  86. var content = editor.getValue();
  87. if(content == ''){
  88. showErrorMsg('HTML代码不能为空!');
  89. $('#content').focus();
  90. return false;
  91. }
  92. layer_loading('正在处理');
  93. $.ajax({
  94. type: "POST",
  95. url: "{:url('Ajax/new_appoint_tplfile', ['_ajax'=>1])}",
  96. data: {filename:$('#filename').val(), content:content, type:$('#type').val()},
  97. dataType: 'json',
  98. success: function (res) {
  99. if(res.code == 1){
  100. parent.layer.closeAll();
  101. var id = res.data.select_input_id;
  102. $('#'+id, window.parent.document).append('<option value="'+res.data.filename+'" selected="true">'+res.data.filename+'</option>');
  103. parent.layer.msg(res.msg, {icon: 1, time: 1000});
  104. return false;
  105. }else{
  106. layer.closeAll();
  107. if (res.data.focus) {
  108. $('#'+res.data.focus).focus();
  109. }
  110. layer.msg(res.msg, {icon: 2});
  111. return false;
  112. }
  113. },
  114. error:function(e){
  115. layer.closeAll();
  116. layer.alert(e.responseText, {icon: 2, title:false});
  117. }
  118. });
  119. }
  120. </script>
  121. {include file="public/footer" /}