file_edit_file.tpl.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header', 'admin');
  4. ?>
  5. <style type="text/css">
  6. html{_overflow:hidden}
  7. .frmaa{float:left;width:80%; min-width: 870px; _width:870px;}
  8. .rraa{float: right; width:230px;}
  9. .pt{margin-top: 4px;}
  10. </style>
  11. <body style="overflow:hidden">
  12. <div class="pad-10" style="padding-bottom:0px">
  13. <div class="col-right">
  14. <h3 class="f14"><?php echo L('common_variables')?></h3>
  15. <input type="button" class="button pt" onClick="javascript:insertText('{CSS_PATH}')" value="{CSS_PATH}" title="<?php echo L('click_into')?>"/><br />
  16. <input type="button" class="button pt" onClick="javascript:insertText('{JS_PATH}')" value="{JS_PATH}" title="<?php echo L('click_into')?>"/><br />
  17. <input type="button" class="button pt" onClick="javascript:insertText('{IMG_PATH}')" value="{IMG_PATH}" title="<?php echo L('click_into')?>"/><br />
  18. <input type="button" class="button pt" onClick="javascript:insertText('{APP_PATH}')" value="{APP_PATH}" title="<?php echo L('click_into')?>"/><br />
  19. <input type="button" class="button pt" onClick="javascript:insertText('{get_siteid()}')" value="{get_siteid()}" title="获取站点ID"/><br />
  20. <input type="button" class="button pt" onClick="javascript:insertText('{loop $data $n $r}')" value="{loop $data $n $r}" title="<?php echo L('click_into')?>"/><br />
  21. <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'url\']}')" value="{$r['url']}" title="<?php echo L('click_into')?>"/><br />
  22. <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'title\']}')" value="{$r['title']}" title="<?php echo L('click_into')?>"/><br />
  23. <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'thumb\']}')" value="{$r['thumb']}" title="<?php echo L('click_into')?>"/><br />
  24. <input type="button" class="button pt" onClick="javascript:insertText('{strip_tags($r[description])}')" value="{strip_tags($r[description])}" title="<?php echo L('click_into')?>"/><br />
  25. <?php if (is_array($file_t_v[$file_t])) { foreach($file_t_v[$file_t] as $k => $v) {?>
  26. <input type="button" class="button pt" onClick="javascript:insertText('<?php echo $k?>')" value="<?php echo $k?>" title="<?php echo $v ? $v :L('click_into')?>"/><br />
  27. <?php } }?>
  28. </div>
  29. <div class="col-auto">
  30. <form action="?m=template&c=file&a=edit_file&style=<?php echo $this->style?>&dir=<?php echo $dir?>&file=<?php echo $file?>" method="post" name="myform" id="myform" onsubmit="return check_form();">
  31. <textarea name="code" id="code" style="height: 280px;width:96%; visibility:inherit"><?php echo $data?></textarea>
  32. <div class="bk10"></div>
  33. <input type="text" id="text" value="" /><input type="button" class="button" onClick="fnSearch()" value="<?php echo L('find_code')?>" /> <?php if ($is_write==0){echo '<font color="red">'.L("file_does_not_writable").'</font>';}?> <?php if (module_exists('tag')) {?><input type="button" class="button" onClick="create_tag()" value="<?php echo L('create_tag')?>" /> <input type="button" class="button" onClick="select_tag()" value="<?php echo L('select_tag')?>" /> <?php }?>
  34. <BR><input type="submit" id="dosubmit" class="button pt" name="dosubmit" value="<?php echo L('submit')?>" />
  35. </form>
  36. </div>
  37. </div>
  38. <script type="text/javascript">
  39. var oRange;
  40. var intCount = 0;
  41. var intTotalCount = 100;
  42. function fnSearch() {
  43. var strBeReplaced;
  44. var strReplace;
  45. strBeReplaced = $('#text').val();
  46. findInPage(strBeReplaced);
  47. }
  48. function create_tag() {
  49. window.top.art.dialog({id:'add',iframe:'?m=tag&c=tag&a=add&ac=js', title:"<?php echo L('create_tag')?>", width:'700', height:'500', lock:true}, function(){var d = window.top.art.dialog({id:'add'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()});
  50. }
  51. function insertText(text)
  52. {
  53. $('#code').focus();
  54. var str = document.selection.createRange();
  55. str.text = text;
  56. }
  57. function call(text) {
  58. $('#code').focus();
  59. var str = document.selection.createRange();
  60. var text_lenght = parseInt($('#text_lenght').val());
  61. str.moveStart("character", text_lenght);
  62. str.select();
  63. str.text = text;
  64. }
  65. function GetPoint() {
  66. if ($.browser.msie) {
  67. rng = event.srcElement.createTextRange();
  68. rng.moveToPoint(event.x,event.y);
  69. rng.moveStart("character",-event.srcElement.value.length);
  70. var text_lenght = rng.text.length;
  71. } else {
  72. //alert($('#code').selectionStart);
  73. }
  74. $('#text_lenght').val(text_lenght);
  75. }
  76. function select_tag() {
  77. window.top.art.dialog({id:'list',iframe:'?m=tag&c=tag&a=lists', title:"<?php echo L('tag_list')?>", width:'700', height:'500', lock:true}, function(){var d = window.top.art.dialog({id:'add'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'list'}).close()});
  78. }
  79. function fnNext(){
  80. if (intCount > 0 && intCount < intTotalCount){
  81. intCount = intCount + 1;
  82. } else {
  83. intCount = 1 ;
  84. }
  85. }
  86. function check_form() {
  87. if(findInPage("{php")) {
  88. alert("在线模板编辑禁止提交含有{php 的标签。");
  89. return false;
  90. } else if(findInPage("<\?php")) {
  91. alert('在线模板编辑禁止提交含有<\?php 的标签。');
  92. return false;
  93. } else {
  94. myform.submit();
  95. }
  96. }
  97. var isie = false;
  98. if(navigator.userAgent.indexOf("MSIE")>0) {
  99. isie = true;
  100. }
  101. var win = window; // window to search.
  102. var n = 0;
  103. function findInPage(str) {
  104. var txt, i, found;
  105. if (str == "")
  106. return false;
  107. if (isie) {
  108. txt = win.document.body.createTextRange();
  109. for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
  110. txt.moveStart("character", 1);
  111. txt.moveEnd("textedit");
  112. }
  113. if (found) {
  114. txt.moveStart("character", -1);
  115. txt.findText(str);
  116. txt.select();
  117. txt.scrollIntoView();
  118. n++;
  119. return true;
  120. } else {
  121. if (n > 0) {
  122. n = 0;
  123. findInPage(str);
  124. return true;
  125. }
  126. }
  127. return false;
  128. } else {
  129. if (!win.find(str))
  130. while(win.find(str, true))
  131. n++;
  132. else
  133. n++;
  134. if (n == 0) {
  135. return false
  136. } else {
  137. return true;
  138. }
  139. }
  140. }
  141. //-->
  142. </script>
  143. </body>
  144. </html>