file_widget_setting.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <include file="theme/functions"/>
  2. <include file="public@header"/>
  3. <style>
  4. html, body {
  5. overflow-x: hidden;
  6. }
  7. .form-control-widget-title {
  8. border: none;
  9. padding: 0;
  10. margin: 0;
  11. font-size: inherit;
  12. line-height: inherit;
  13. background: transparent;
  14. }
  15. .form-control-widget-title:focus {
  16. outline: none;
  17. background: #fff;
  18. }
  19. .widgets-group {
  20. min-height: 40px;
  21. }
  22. .widgets-group .ui-sortable-placeholder {
  23. background: #f9f9f9;
  24. visibility: visible !important;
  25. }
  26. .widgets-group .ui-sortable-placeholder.ui-sortable-placeholder-disabled {
  27. background: red;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <notempty name="has_file">
  33. <div class="wrap">
  34. <ul class="nav nav-tabs">
  35. <li class="active">
  36. <a href="{:url('Theme/fileSetting',['file'=>$fileName,'theme'=>$theme,'tab'=>'widget'])}">
  37. 组件
  38. </a>
  39. </li>
  40. <notempty name="file.more.vars">
  41. <li>
  42. <a href="{:url('Theme/fileSetting',['file'=>$fileName,'theme'=>$theme,'tab'=>'var'])}">
  43. 设置
  44. </a>
  45. </li>
  46. </notempty>
  47. <notempty name="has_public_var">
  48. <li>
  49. <a href="{:url('Theme/fileSetting',['file'=>$fileName,'theme'=>$theme,'tab'=>'public_var'])}">
  50. 全局设置
  51. </a>
  52. </li>
  53. </notempty>
  54. </ul>
  55. <form method="post" class="js-ajax-form margin-top-20" action="{:url('Theme/settingPost')}">
  56. <div class="list-group">
  57. <a href="javascript:parent.openIframeLayer('{:url('admin/Nav/index')}','导航管理')" class="list-group-item">导航管理</a>
  58. <a href="javascript:parent.openIframeLayer('{:url('admin/Slide/index')}','幻灯片管理')"
  59. class="list-group-item">幻灯片管理</a>
  60. <a href="javascript:parent.openIframeLayer('{:url('admin/Link/index')}','友情链接管理')"
  61. class="list-group-item">友情链接管理</a>
  62. </div>
  63. <foreach name="files" item="file">
  64. <notempty name="file['more']['widgets_blocks']">
  65. <foreach name="file['more']['widgets_blocks']" item="widgetsBlock" key="widgetsBlockName"
  66. index="index">
  67. <div class="panel panel-default">
  68. <div class="panel-heading">
  69. {$widgetsBlock.title|default='无标题'}
  70. </div>
  71. <ul class="list-group widgets-group"
  72. data-file_id="{$file.id}"
  73. data-block_name="{$widgetsBlockName}">
  74. <notempty name="widgetsBlock.widgets">
  75. <foreach name="widgetsBlock.widgets" item="widget">
  76. <li class="list-group-item widgets-group-item"
  77. data-file_id="{$file.id}"
  78. data-id="{$key}"
  79. data-title="设置">
  80. {$widget.title|default='无标题'}
  81. <a class="pull-right" onclick="doWidgetSetting(this)" href="javascript:;"><i class="fa fa-cog"></i></a>
  82. <empty name="widget.display">
  83. <div class="pull-right">
  84. <i class="fa fa-eye-slash "></i>&nbsp;
  85. </div>
  86. </empty>
  87. </li>
  88. </foreach>
  89. <else/>
  90. <!-- <li class="list-group-item">什么都没有~</li>-->
  91. </notempty>
  92. </ul>
  93. </div>
  94. </foreach>
  95. </notempty>
  96. </foreach>
  97. <notempty name="has_widget">
  98. <foreach name="files" item="file">
  99. <notempty name="file['more']['widgets']">
  100. <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  101. <foreach name="file['more']['widgets']" item="widget" key="widgetName" index="index">
  102. <div class="panel panel-default">
  103. <div class="panel-heading">
  104. <!--<a role="button" data-toggle="collapse" data-parent="#accordion"-->
  105. <!--href="#collapse-{$widgetName}">-->
  106. <!--{$widget.title}-->
  107. <!--</a>-->
  108. <input class="form-control-widget-title" type="text" value="{$widget.title}"
  109. name="files[{$file.id}][widget][{$widgetName}][title]">
  110. <label class="checkbox-inline pull-right">
  111. <php>$display_checked=empty($widget['display'])?'':'checked';</php>
  112. <input type="checkbox"
  113. name="files[{$file.id}][widget][{$widgetName}][display]"
  114. value="1"
  115. {$display_checked}>
  116. 显示
  117. </label>
  118. </div>
  119. <div id="collapse-{$widgetName}" class="panel-collapse collapse in" role="tabpanel">
  120. <div class="panel-body">
  121. {:_parse_vars($widget.vars,'files['.$file['id'].'][widget_vars]['.$widgetName.']',1,$widgetName,$file['id'])}
  122. <notempty name="file.is_public">
  123. <span class="pull-right label label-success">公共组件</span>
  124. <!--<a class="pull-right" title="公共组件" data-toggle="tooltip"><i class="fa fa-question-circle"></i></a>-->
  125. </notempty>
  126. </div>
  127. </div>
  128. </div>
  129. </foreach>
  130. </div>
  131. <else/>
  132. </notempty>
  133. </foreach>
  134. <else/>
  135. </notempty>
  136. <div class="form-group text-center" style="display: none;">
  137. <input type="hidden" name="id" value="{$file.id|default=''}">
  138. <button type="submit" class="btn btn-primary js-ajax-submit" id="submit-btn"
  139. data-success="successCallback">
  140. {:lang('SAVE')}
  141. </button>
  142. </div>
  143. </form>
  144. </div>
  145. <include file="theme/scripts"/>
  146. <script>
  147. parent.showDesignBtn();
  148. </script>
  149. </notempty>
  150. <empty name="has_file">
  151. <script>
  152. parent.hideDesignBtn();
  153. </script>
  154. </empty>
  155. <script>
  156. function successCallback(data, statusText, xhr, $form) {
  157. function _refresh() {
  158. if (data.url) {
  159. //返回带跳转地址
  160. window.location.href = data.url;
  161. } else {
  162. if (data.code == 1) {
  163. //刷新当前页
  164. reloadPage(window);
  165. }
  166. }
  167. }
  168. noty({
  169. text: data.msg,
  170. type: 'success',
  171. layout: 'topCenter',
  172. modal: true,
  173. // animation: {
  174. // open: 'animated bounceInDown', // Animate.css class names
  175. // close: 'animated bounceOutUp', // Animate.css class names
  176. // },
  177. timeout: 800,
  178. callback: {
  179. afterClose: function () {
  180. if (parent.afterSaveSetting) {
  181. parent.afterSaveSetting();
  182. }
  183. _refresh();
  184. }
  185. }
  186. });
  187. }
  188. </script>
  189. </body>
  190. </html>