Nessuna descrizione
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.

index.htm 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
  3. <div id="append_parent"></div>
  4. <div id="ajaxwaitid"></div>
  5. <div class="page min-hg-c-10">
  6. <div class="flexigrid">
  7. <!-- 操作说明 -->
  8. <div id="explanation" class="explanation">
  9. <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
  10. <h4 title="提示相关设置操作时应注意的要点">提示</h4>
  11. <span title="收起提示" id="explanationZoom" style="display: block;"></span>
  12. </div>
  13. <ul>
  14. <li>必填:只针对友情链接的分组有效。</li>
  15. </ul>
  16. </div>
  17. <br/>
  18. <div class="hDiv">
  19. <div class="hDivBox">
  20. <table cellspacing="0" cellpadding="0" style="width: 100%">
  21. <thead>
  22. <tr>
  23. <th abbr="article_title" axis="col3" class="w40">
  24. <div class="tc">ID</div>
  25. </th>
  26. <th abbr="ac_id" axis="col4">
  27. <div class="text-l10">分组名称</div>
  28. </th>
  29. <th abbr="article_time" axis="col6" class="w60">
  30. <div class="tc">排序</div>
  31. </th>
  32. <th axis="col1" class="w120">
  33. <div class="tc">操作</div>
  34. </th>
  35. </tr>
  36. </thead>
  37. </table>
  38. </div>
  39. </div>
  40. <div class="bDiv" style="height: auto;">
  41. <form id="PostForm">
  42. <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
  43. <table style="width: 100%">
  44. <tbody id="Template">
  45. {empty name="list"}
  46. <tr>
  47. <td class="no-data" align="center" axis="col0" colspan="50">
  48. <div class="no_row">
  49. <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
  50. </div>
  51. </td>
  52. </tr>
  53. {else/}
  54. {foreach name="list" item="vo" key="k" }
  55. <tr class="tr">
  56. <td class="sort">
  57. <div class="w40 tc">
  58. <input type="hidden" name="id[]" value="{$vo.id}">
  59. {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
  60. {$vo.id}
  61. {else /}
  62. {$main_group_list[$vo['id']]['id']|default=$vo['id']}
  63. {/if}
  64. </div>
  65. </td>
  66. <td style="width: 100%">
  67. <div class="text-l10">
  68. {eq name="'LinksGroup@linksgroup_save'|is_check_access" value="1"}
  69. <input type="text" name="group_name[]" value="{$vo.group_name}" style="width: 200px;">
  70. {else /}
  71. {$vo.group_name}
  72. {/eq}
  73. </div>
  74. </td>
  75. <td class="sort">
  76. <div class="w60 tc">
  77. {eq name="'LinksGroup@linksgroup_save'|is_check_access" value="1"}
  78. <input class="tc" type="text" name="sort_order[]" size="4" value="{$vo.sort_order}" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" onpaste="this.value=this.value.replace(/[^\d]/g,'')" />
  79. {else /}
  80. {$vo.sort_order}
  81. {/eq}
  82. </div>
  83. </td>
  84. <td class="operation">
  85. <div class="w120 tc">
  86. {eq name="'LinksGroup@del'|is_check_access" value="1"}
  87. {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
  88. {if condition="$vo['id'] == $min_group_id"}
  89. <a class="btn grey" href="javascript:void(0);">删除</a>
  90. {else/}
  91. <a class="btn red" href="javascript:void(0);" data-url="{:url('LinksGroup/del')}" data-title="{$vo.group_name}" data-id="{$vo.id}" onClick="delGroup(this);">删除</a>
  92. {/if}
  93. {else /}
  94. <a class="btn grey" href="javascript:void(0);" title="请切换到主语言删除">删除</a>
  95. {/if}
  96. {/eq}
  97. </div>
  98. </td>
  99. </tr>
  100. {/foreach}
  101. {/empty}
  102. </tbody>
  103. </table>
  104. </div>
  105. </form>
  106. <div class="iDiv" style="display: none;"></div>
  107. </div>
  108. {notempty name="list"}
  109. <div class="footer-oper">
  110. {eq name="$Think.const.CONTROLLER_NAME.'@linksgroup_save'|is_check_access" value="1"}
  111. <div class="fbutton">
  112. <a href="javascript:void(0);" data-url="{:url('LinksGroup/linksgroup_save', ['_ajax'=>1])}" onclick="linksgroup_save(this);" class="layui-btn layui-btn-primary">
  113. <span class="">保存</span>
  114. </a>
  115. </div>
  116. {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
  117. <div class="fbutton">
  118. <a href="javascript:void(0);" onclick="link_group_add();" class="layui-btn layui-btn-primary">
  119. <span>新增分组</span>
  120. </a>
  121. </div>
  122. {/if}
  123. {/eq}
  124. {include file="public/page" /}
  125. </div>
  126. {/notempty}
  127. </div>
  128. </div>
  129. <script>
  130. $(document).ready(function(){
  131. // 表格行点击选中切换
  132. $('#flexigrid > table>tbody >tr').click(function(){
  133. $(this).toggleClass('trSelected');
  134. });
  135. // 点击刷新数据
  136. $('.fa-refresh').click(function(){
  137. location.href = location.href;
  138. });
  139. });
  140. // tr数,取唯一标识
  141. var tr_id = $('#Template .tr').length;
  142. function link_group_add(){
  143. var AddHtml = [];
  144. AddHtml +=
  145. '<tr class="tr" id="tr_'+tr_id+'">'+
  146. '<td class="sort">'+
  147. '<div class="w40 tc"><input type="hidden" name="id[]">&nbsp;</div>'+
  148. '</td>'+
  149. '<td style="width: 100%">'+
  150. '<div class="text-l10">'+
  151. '<input type="text" name="group_name[]" value="" style="width: 200px;">'+
  152. '</div>'+
  153. '</td>'+
  154. '<td class="sort">'+
  155. '<div class="w60 tc">'+
  156. '<input class="tc" type="text" name="sort_order[]" size="4" value="100" onkeyup="this.value=this.value.replace(/[^\\d]/g,\'\');" onpaste="this.value=this.value.replace(/[^\\d]/g,\'\')" />'+
  157. '</div>'+
  158. '</td>' +
  159. '<td class="operation">'+
  160. '<div class="w120 tc">'+
  161. '<a class="btn red" href="javascript:void(0);" data-trid="tr_'+tr_id+'" onclick="DelHtml(this)">删除</a>'+
  162. '</div>'+
  163. '</td>'+
  164. '</tr>';
  165. $('#Template').append(AddHtml);
  166. tr_id += 1;
  167. }
  168. // 删除未保存的级别
  169. function DelHtml(obj){
  170. $('#'+$(obj).attr('data-trid')).remove();
  171. }
  172. // 删除
  173. function delGroup(obj){
  174. layer.confirm('确认彻底删除?该链接分组的数据将一起清空。', {
  175. shade: layer_shade,
  176. area: ['480px', '190px'],
  177. move: false,
  178. title: '提示',
  179. btnAlign:'r',
  180. closeBtn: 3,
  181. btn: ['确定', '取消'] ,//按钮
  182. success: function () {
  183. $(".layui-layer-content").css('text-align', 'left');
  184. }
  185. }, function(){
  186. layer_loading('正在处理');
  187. // 确定
  188. $.ajax({
  189. type : 'post',
  190. url : $(obj).attr('data-url'),
  191. data : {del_id:$(obj).attr('data-id'),_ajax:1},
  192. dataType : 'json',
  193. success : function(data){
  194. layer.closeAll();
  195. if(data.code == 1){
  196. layer.msg(data.msg, {icon: 6});
  197. window.location.reload();
  198. }else{
  199. layer.alert(data.msg, {icon: 5, title:false});
  200. }
  201. }
  202. })
  203. }, function(index){
  204. layer.close(index);
  205. });
  206. return false;
  207. }
  208. // 提交
  209. function linksgroup_save(obj){
  210. if ($('input[name*=group_name]').length == 0) {
  211. layer.alert('至少新增一个分组!', {
  212. shade: layer_shade,
  213. area: ['480px', '190px'],
  214. move: false,
  215. title: '提示',
  216. btnAlign:'r',
  217. closeBtn: 3,
  218. success: function () {
  219. $(".layui-layer-content").css('text-align', 'left');
  220. }
  221. });
  222. return false;
  223. } else {
  224. var is_empty = true;
  225. $('input[name*=group_name]').each(function(index, item){
  226. if ($.trim($(item).val()) != '') {
  227. is_empty = false;
  228. return false;
  229. }
  230. });
  231. if (true == is_empty) {
  232. layer.alert('分组名称不能为空!', {
  233. shade: layer_shade,
  234. area: ['480px', '190px'],
  235. move: false,
  236. title: '提示',
  237. btnAlign:'r',
  238. closeBtn: 3,
  239. success: function () {
  240. $(".layui-layer-content").css('text-align', 'left');
  241. }
  242. });
  243. return false;
  244. }
  245. }
  246. layer_loading('正在处理');
  247. $.ajax({
  248. type : 'post',
  249. url : $(obj).attr('data-url'),
  250. data : $('#PostForm').serialize(),
  251. dataType : 'json',
  252. success : function(res){
  253. layer.closeAll();
  254. if(res.code == 1){
  255. layer.msg(res.msg, {icon: 6, time: 1000}, function(){
  256. window.location.reload();
  257. });
  258. }else{
  259. showErrorMsg(res.msg);
  260. }
  261. },
  262. error: function(e){
  263. layer.closeAll();
  264. showErrorAlert(e.responseText);
  265. }
  266. });
  267. }
  268. </script>
  269. {include file="public/footer" /}