api-detail.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. session_start();
  3. if (!isset($_SESSION['loggedin'])) {
  4. header('Location: pages-signin.html');
  5. exit;
  6. }
  7. ?>
  8. <!doctype html>
  9. <html class="fixed sidebar-left-collapsed">
  10. <head>
  11. <!-- jstree CSS -->
  12. <link rel="stylesheet" href="assets/vendor/jstree/themes/default/style.css" />
  13. <?php include("bim-support-header.html"); ?>
  14. <script src="./script/js/global.js"></script>
  15. <script type="application/javascript">
  16. var i = 0;
  17. var api = [];
  18. var fileName;
  19. var folder;
  20. var software;
  21. var userName = '<?php echo $_SESSION['name']; ?>';
  22. var webLink;
  23. var source;
  24. var searchURL = window.location.search;
  25. searchURL = searchURL.substring(1, searchURL.length);
  26. object = decodeURIComponent(searchURL.split("&")[0].split("=")[1]);
  27. if(object == 'undefined'){
  28. window.location.href = "./api-list.php";
  29. console.log("in " + object);
  30. }else{
  31. console.log("not in: "+object);
  32. }
  33. $.ajax({
  34. url: "./script/php/api_group_detail.php",
  35. type: "GET",
  36. async: false,
  37. data: {
  38. object: object,
  39. },
  40. contentType: "application/json",
  41. dataType: "json"
  42. }).done(function(data) {
  43. if(data.APIID == null)
  44. data.APIID ='';
  45. folder = data.software + '/' + data.APIID + data.APIName;
  46. data[1] = data[1]=="Dynamo" ? data.software + " " + data.dynamoVersion : data.software + " " + data.revitVersion;
  47. for (i = 0; i < 6; i++) {
  48. if (data[i] != null)
  49. table.push(data[i]);
  50. else
  51. table.push("空");
  52. }
  53. webLink = data.webLink;
  54. source = data.source;
  55. }).error(function(error) {
  56. console.log(error);
  57. });
  58. $.ajax({
  59. url: "./script/php/update_popularity.php",
  60. type: "GET",
  61. async: false,
  62. data: {
  63. api_id: object,
  64. update_type: "viewTimes",
  65. },
  66. contentType: "application/json",
  67. dataType: "json"
  68. });
  69. pageHeader = "BIM程式庫";
  70. </script>
  71. </head>
  72. <body>
  73. <canvas id="c"></canvas>
  74. <section class="body">
  75. <!-- start: header -->
  76. <header-menu></header-menu>
  77. <!-- end: header -->
  78. <div class="inner-wrapper">
  79. <!-- start: sidebar -->
  80. <side-bar></side-bar>
  81. <!-- end: sidebar -->
  82. <section role="main" class="content-body">
  83. <header class="page-header">
  84. <h2>{{pageHeader}}</h2>
  85. </header>
  86. <!-- start: page -->
  87. <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
  88. <div class="content-with-menu-container">
  89. <inner-menu>
  90. <template v-slot:inner-equipment>
  91. <api-list></api-list>
  92. </template>
  93. </inner-menu>
  94. <div class="inner-body mg-main">
  95. <div class="inner-toolbar">
  96. <ul>
  97. <li class="right">
  98. <a href="#" onclick="window.history.go(-1); return false;"><i class="fa fa-undo"></i> 返回</a>
  99. </li>
  100. </ul>
  101. </div>
  102. <div class="row">
  103. <div class="col-md-12">
  104. <section class="panel">
  105. <div class="panel-body">
  106. <div class="table-responsive">
  107. <table class="table table-bordered mb-none">
  108. <thead>
  109. <tr>
  110. <th width="10%">名稱</th>
  111. <th>開發版本</th>
  112. <th>詳細說明</th>
  113. <th>操作方式</th>
  114. <th width="5%">開發者</th>
  115. <th>備註</th>
  116. </tr>
  117. </thead>
  118. <tbody>
  119. <tr>
  120. <td>{{table[0]}}</td>
  121. <td>{{table[1]}}</td>
  122. <td>{{table[2]}}</td>
  123. <td>{{table[3]}}</td>
  124. <td id="webLink"></td>
  125. <td>{{table[5]}}</td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. </div>
  130. </div>
  131. </section>
  132. </div>
  133. </div>
  134. <div class="row">
  135. <div class="col-md-6">
  136. <section class="panel">
  137. <div class="panel-body">
  138. <h5 class="text-semibold text-dark text-uppercase">參考檔案下載</h5>
  139. <div id="treeAjaxHTML"></div>
  140. </div>
  141. </section>
  142. </div>
  143. <div class="col-md-6">
  144. <section class="panel">
  145. <div class="panel-body">
  146. <img v-if="table[1].includes('ynamo')" src="./assets/images/dynamo-icon.png" style="height:80px; display: inline-block; vertical-align: top;"></img>
  147. <img v-else-if="table[1].includes('Revit')" src="./assets/images/revit-icon.png" style="height:80px; display: inline-block; vertical-align: top;"></img>
  148. <div class="summary" style="display: inline-block;">
  149. <div class="title"><strong>程式下載</strong></div>
  150. <div class="info" id="apiList">
  151. </div>
  152. </div>
  153. </div>
  154. </section>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </section>
  160. <!-- end: page -->
  161. </section>
  162. </div>
  163. </section>
  164. <script>
  165. /*Vue */
  166. vm.mount('.body');
  167. if(webLink != null){
  168. $("#webLink").append("<a href='" + webLink + "' target='_blank'>" + source + "</a>");
  169. }else if(webLink == null){
  170. $("#webLink").append("<span>" + source + "</span>");
  171. }
  172. $(document).ready(function() {
  173. $("#apiList a").on("click", function() {
  174. $.ajax({
  175. url: "./script/php/update_popularity.php",
  176. type: "GET",
  177. async: false,
  178. data: {
  179. api_id: object,
  180. update_type: "downloadTimes",
  181. },
  182. contentType: "application/json",
  183. dataType: "json"
  184. });
  185. });
  186. });
  187. </script>
  188. <script src="assets/vendor/jstree/jstree.js"></script>
  189. <script src="assets/javascripts/ui-elements/examples.treeview.js"></script>
  190. <?php include("bim-support-body.html"); ?>
  191. <script>
  192. </script>
  193. </body>
  194. </html>