index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <php>
  2. if (!function_exists('_get_system_widget')) {
  3. function _get_system_widget($name){
  4. </php>
  5. <switch name="name">
  6. <case value="CmfHub">
  7. <div class="panel panel-default">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">交流方式</h3>
  10. </div>
  11. <div class="panel-body home-info">
  12. <ul class="list-unstyled">
  13. <li>
  14. <em>官网</em> <span><a href="http://www.thinkcmf.com"
  15. target="_blank">www.thinkcmf.com</a></span>
  16. </li>
  17. <li><em>QQ 群</em> <span>100828313,316669417</span></li>
  18. <li><em>联系邮箱</em> <span>catman@thinkcmf.com</span></li>
  19. </ul>
  20. </div>
  21. </div>
  22. </case>
  23. <case value="CmfDocuments">
  24. <div class="panel panel-default">
  25. <div class="panel-heading">
  26. <h3 class="panel-title">开发手册</h3>
  27. </div>
  28. <div class="panel-body home-info">
  29. <ul class="list-unstyled">
  30. <li>
  31. <em>完全开发手册</em>
  32. <span>
  33. <a class="label label-success" href="https://www.thinkcmf.com/docs/cmf6/"
  34. target="_blank">立即阅读</a>
  35. </span>
  36. </li>
  37. <li>
  38. <em>常见问题手册</em>
  39. <span>
  40. <a class="label label-success" href="http://www.thinkcmf.com/faq.html"
  41. target="_blank">立即阅读</a>
  42. </span>
  43. </li>
  44. <li>
  45. <em>模板开发教程</em>
  46. <span>
  47. <a class="label label-success" href="http://www.thinkcmf.com/theme_tutorial.html"
  48. target="_blank">立即阅读</a>
  49. </span>
  50. </li>
  51. <li>
  52. <em>API开发手册</em>
  53. <span>
  54. <a class="label label-success" href="https://www.thinkcmf.com/docs/cmf6/#/API"
  55. target="_blank">立即阅读</a>
  56. </span>
  57. </li>
  58. </ul>
  59. </div>
  60. </div>
  61. </case>
  62. <case value="MainContributors">
  63. <div class="panel panel-default">
  64. <div class="panel-heading">
  65. <h3 class="panel-title">主要贡献者</h3>
  66. </div>
  67. <div class="panel-body home-info main_contributors">
  68. <ul class="list-inline">
  69. <li>加载中...</li>
  70. </ul>
  71. </div>
  72. </div>
  73. </case>
  74. <case value="Contributors">
  75. <div class="panel panel-default">
  76. <div class="panel-heading">
  77. <h3 class="panel-title">贡献者</h3>
  78. </div>
  79. <div class="panel-body home-info contributors">
  80. <ul class="list-inline">
  81. <li>加载中...</li>
  82. </ul>
  83. </div>
  84. </div>
  85. </case>
  86. </switch>
  87. <php>
  88. }
  89. }
  90. </php>
  91. <include file="public@header"/>
  92. <style>
  93. .home-info li em {
  94. float: left;
  95. width: 120px;
  96. font-style: normal;
  97. font-weight: bold;
  98. }
  99. .home-info ul {
  100. padding: 0;
  101. margin: 0;
  102. }
  103. .panel {
  104. margin-bottom: 0;
  105. }
  106. .grid-sizer {
  107. width: 10%;
  108. }
  109. .grid-item {
  110. margin-bottom: 6px;
  111. padding: 5px;
  112. }
  113. .home-grid .dashboard-box .panel-title {
  114. cursor: move;
  115. }
  116. .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
  117. padding-left: 8px;
  118. padding-right: 8px;
  119. float: none;
  120. }
  121. </style>
  122. <hook name="admin_before_head_end"/>
  123. </head>
  124. <body>
  125. <div class="wrap">
  126. <empty name="has_smtp_setting">
  127. <div class="grid-item col-md-12">
  128. <div class="alert alert-danger alert-dismissible fade in" role="alert" style="margin-bottom: 0;">
  129. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  130. <span aria-hidden="true">&times;</span>
  131. </button>
  132. <strong>提示!</strong> 邮箱配置未完成,无法进行邮件发送!
  133. <a href="#" data-dismiss="alert" aria-label="Close"
  134. onclick="parent.openapp('{:url('Mailer/index')}','admin_mailer_index','邮箱配置');">现在设置</a>
  135. </div>
  136. </div>
  137. </empty>
  138. <if condition="!function_exists('finfo_open')">
  139. <div class="grid-item col-md-12">
  140. <div class="alert alert-danger alert-dismissible fade in" role="alert" style="margin-bottom: 0;">
  141. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  142. <span aria-hidden="true">&times;</span>
  143. </button>
  144. <strong>提示!</strong> php_fileinfo扩展没有开启,无法正常上传文件!
  145. </div>
  146. </div>
  147. </if>
  148. <div class="grid-item col-md-12" id="thinkcmf-notices-grid" style="display:none;">
  149. <div class="dashboard-box">
  150. <div class="panel panel-default">
  151. <div class="panel-heading">
  152. <h3 class="panel-title">{:lang('SYSTEM_NOTIFICATIONS')}</h3>
  153. </div>
  154. <div class="panel-body home-info">
  155. <ul id="thinkcmf-notices" class="list-unstyled">
  156. <li>
  157. <img src="__TMPL__/public/assets/images/loading.gif" style="vertical-align: middle;"/>
  158. <span style="display: inline-block; vertical-align: middle;">加载中...</span>
  159. </li>
  160. </ul>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <div class="home-grid">
  166. <!-- width of .grid-sizer used for columnWidth -->
  167. <div class="grid-sizer"></div>
  168. <foreach name="dashboard_widgets" item="vo">
  169. <if condition="$vo.is_system">
  170. <div class="grid-item col-md-6" data-system="1" data-widget="{$vo.name}" data-width="6">
  171. <div class="dashboard-box">{:_get_system_widget($vo.name)}</div>
  172. </div>
  173. <else/>
  174. <present name="dashboard_widget_plugins[$vo['name']]">
  175. <div class="grid-item col-md-{$dashboard_widget_plugins[$vo['name']]['width']}" data-system="0"
  176. data-widget="{$vo.name}" data-width="{$dashboard_widget_plugins[$vo['name']]['width']}">
  177. <div class="dashboard-box">{$dashboard_widget_plugins[$vo.name]['view']}</div>
  178. </div>
  179. </present>
  180. </if>
  181. </foreach>
  182. </div>
  183. </div>
  184. <script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
  185. <php>
  186. $lang_set=cmf_current_lang();
  187. $thinkcmf_version=cmf_version();
  188. </php>
  189. <script>
  190. $('.dashboard-box').each(function () {
  191. var $this = $(this);
  192. if ($(this).children().length === 0) {
  193. $this.parents('.grid-item').remove();
  194. }
  195. });
  196. var $homeGrid = null;
  197. Wind.css('dragula');
  198. Wind.use('masonry', 'imagesloaded', 'dragula', function () {
  199. $homeGrid = $('.home-grid').masonry({
  200. // gutter: 10,
  201. // fitWidth:true,
  202. // set itemSelector so .grid-sizer is not used in layout
  203. itemSelector: '.grid-item',
  204. // use element for option
  205. columnWidth: '.grid-sizer',
  206. percentPosition: true,
  207. horizontalOrder: false,
  208. transitionDuration: 0
  209. });
  210. $homeGrid.masonry('on', 'layoutComplete', function (event, laidOutItems) {
  211. });
  212. $.ajax({
  213. url: "//www.thinkcmf.com/service/team.php?lang={$lang_set}&v={$thinkcmf_version}",
  214. type: 'get',
  215. dataType: 'json',
  216. success: function (data) {
  217. if (data.code == 1) {
  218. var $wrap = $('<ul class="list-inline"></ul>')
  219. $.each(data.data.main_contributors, function (i, item) {
  220. if (item.url) {
  221. $wrap.append('<li><a href="' + item.url + '" target="_blank">' + item.name + '</a></li>')
  222. } else {
  223. $wrap.append('<li>' + item.name + '</li>')
  224. }
  225. });
  226. $('.main_contributors').html($wrap);
  227. $wrap = $('<ul class="list-inline"></ul>');
  228. $.each(data.data.contributors, function (i, item) {
  229. if (item.url) {
  230. $wrap.append('<li><a href="' + item.url + '" target="_blank">' + item.name + '</a></li>')
  231. } else {
  232. $wrap.append('<li>' + item.name + '</li>')
  233. }
  234. });
  235. $('.contributors').html($wrap);
  236. $homeGrid.masonry();
  237. }
  238. },
  239. error: function () {
  240. },
  241. complete: function () {
  242. }
  243. });
  244. $homeGrid.masonry();
  245. var containers = [];
  246. $('.home-grid .grid-item').each(function () {
  247. containers.push(this);
  248. });
  249. dragula(containers, {
  250. isContainer: function (el) {
  251. return false; // only elements in drake.containers will be taken into account
  252. },
  253. moves: function (el, source, handle, sibling) {
  254. if ($(handle).is('.panel-title')) {
  255. return true;
  256. }
  257. return false; // elements are always draggable by default
  258. },
  259. accepts: function (el, target, source, sibling) {
  260. return true; // elements can be dropped in any of the `containers` by default
  261. },
  262. invalid: function (el, handle) {
  263. return false; // don't prevent any drags from initiating by default
  264. },
  265. direction: 'vertical', // Y axis is considered when determining where an element would be dropped
  266. copy: false, // elements are moved by default, not copied
  267. copySortSource: false, // elements in copy-source containers can be reordered
  268. revertOnSpill: false, // spilling will put the element back where it was dragged from, if this is true
  269. removeOnSpill: false, // spilling will `.remove` the element, if this is true
  270. mirrorContainer: document.body, // set the element that gets mirror elements appended
  271. ignoreInputTextSelection: true // allows users to select input text, see details below
  272. }).on('drop', function (el, target, source, sibling) {
  273. var $target = $(target);
  274. var targetClasses = $target.attr('class');
  275. var targetDataWidget = $target.data('widget');
  276. var targetDataSystem = $target.data('system');
  277. var $source = $(source);
  278. var sourceClasses = $source.attr('class');
  279. var sourceDataWidget = $source.data('widget');
  280. var sourceDataSystem = $source.data('system');
  281. $(source).append($(target).find('.dashboard-box').not('.gu-transit'));
  282. $(target).append(el);
  283. $target.attr('class', sourceClasses);
  284. $target.data('widget', sourceDataWidget);
  285. $target.data('system', sourceDataSystem);
  286. $source.attr('class', targetClasses);
  287. $source.data('widget', targetDataWidget);
  288. $source.data('system', targetDataSystem);
  289. $homeGrid.masonry();
  290. _widgetSort();
  291. }).on('shadow', function (el, container, source) {
  292. $homeGrid.masonry();
  293. });
  294. });
  295. function _widgetSort() {
  296. var widgets = [];
  297. $('.home-grid .grid-item').each(function () {
  298. var $this = $(this);
  299. widgets.push({
  300. name: $this.data('widget'),
  301. is_system: $this.data('system')
  302. });
  303. });
  304. $.ajax({
  305. url: "{:url('Main/dashboardWidget')}",
  306. type: 'post',
  307. dataType: 'json',
  308. data: {widgets: widgets},
  309. success: function (data) {
  310. },
  311. error: function () {
  312. },
  313. complete: function () {
  314. }
  315. });
  316. }
  317. //获取官方通知
  318. $.getJSON("//www.thinkcmf.com/service/sms_jsonp.php?lang={$lang_set}&v={$thinkcmf_version}&callback=?",
  319. function (data) {
  320. var tpl = '<li><em class="title"></em><span class="content"></span></li>';
  321. var $notices = $("#thinkcmf-notices");
  322. $notices.empty();
  323. if (data.length > 0) {
  324. $('#thinkcmf-notices-grid').show();
  325. $.each(data, function (i, n) {
  326. var $tpl = $(tpl);
  327. $(".title", $tpl).html(n.title);
  328. $(".content", $tpl).html(n.content);
  329. $notices.append($tpl);
  330. });
  331. } else {
  332. $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
  333. }
  334. });
  335. </script>
  336. <hook name="admin_before_body_end"/>
  337. </body>
  338. </html>