index.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <?php
  2. session_start();
  3. //Can't come in without logged in
  4. if (!isset($_SESSION['loggedin'])) {
  5. header('Location: pages-signin.html');
  6. exit;
  7. }
  8. ?>
  9. <!doctype html>
  10. <html class="fixed">
  11. <head>
  12. <!-- Basic -->
  13. <meta charset="UTF-8">
  14. <title>資料庫管理</title>
  15. <meta name="keywords" content="HTML5 Admin Template" />
  16. <meta name="description" content="JSOFT Admin - Responsive HTML5 Template">
  17. <meta name="author" content="JSOFT.net">
  18. <script src="assets/vendor/jquery/jquery.js"></script>
  19. <!-- Mobile Metas -->
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  21. <!-- Web Fonts -->
  22. <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
  23. <!-- jstree CSS -->
  24. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/themes/default/style.min.css">
  25. <!-- Vendor CSS -->
  26. <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
  27. <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
  28. <link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
  29. <link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />
  30. <link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />
  31. <!-- Specific Page Vendor CSS -->
  32. <link rel="stylesheet" href="assets/vendor/jquery-ui/css/ui-lightness/jquery-ui-1.10.4.custom.css" />
  33. <link rel="stylesheet" href="assets/vendor/bootstrap-multiselect/bootstrap-multiselect.css" />
  34. <link rel="stylesheet" href="assets/vendor/morris/morris.css" />
  35. <link rel="stylesheet" href="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.css" />
  36. <!-- Theme CSS -->
  37. <link rel="stylesheet" href="assets/stylesheets/theme.css" />
  38. <!-- Skin CSS -->
  39. <link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
  40. <!-- Theme Custom CSS -->
  41. <link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
  42. <!-- Head Libs -->
  43. <script src="assets/vendor/modernizr/modernizr.js"></script>
  44. <!-- chart.js -->
  45. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  46. <!-- DataTable -->
  47. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
  48. <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
  49. <!-- Icon -->
  50. <link rel="shortcut icon" href="assets/images/favicon.ico" />
  51. <link href="https://js.arcgis.com/4.21/esri/themes/light/main.css" rel="stylesheet">
  52. <link href="./CustomCSS/main.css" rel="stylesheet">
  53. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/jstree.min.js"></script>
  54. <script src="./script/js/jstreeAJAX.js"></script>
  55. <script src="https://js.arcgis.com/4.21/"></script>
  56. <style>
  57. .row {
  58. margin-top: -15px;
  59. }
  60. .page-header>ul {
  61. list-style: none;
  62. padding: 0;
  63. margin: 0;
  64. }
  65. .page-header>ul>li {
  66. display: inline-block;
  67. font-size: 25px;
  68. color: #FFFFFF;
  69. }
  70. .page-header>ul>li.right {
  71. float: right;
  72. padding-right: 10px;
  73. }
  74. .input-search {
  75. margin-top: 8px;
  76. }
  77. .page-header li>label {
  78. margin-top: 13px;
  79. border-bottom: 4px solid #0088cc;
  80. height: 41px;
  81. }
  82. .sidebar-left {
  83. box-shadow: 0 0 0;
  84. }
  85. .jstree-default .jstree-icon {
  86. color: #ffe693;
  87. }
  88. .jqsfield {
  89. color: white;
  90. font: 10px arial, san serif;
  91. text-align: left;
  92. }
  93. .jstree-anchor {
  94. width: 250px;
  95. text-overflow: ellipsis;
  96. overflow: hidden;
  97. white-space: nowrap;
  98. }
  99. .jstree-anchor,
  100. .jstree-anchor:link,
  101. .jstree-anchor:visited,
  102. .jstree-anchor:hover,
  103. .jstree-anchor:active {
  104. color: #abb4be;
  105. }
  106. td,
  107. th {
  108. text-align: center;
  109. }
  110. th {
  111. width: 30%;
  112. }
  113. .nav-main {
  114. padding: 15px;
  115. }
  116. .node-hidden {
  117. display: none;
  118. }
  119. html.fixed .page-header {
  120. left: 349px;
  121. }
  122. html.fixed .content-body {
  123. margin-left: 350px;
  124. }
  125. .sidebar-left {
  126. width: 350px;
  127. }
  128. #datatable-ajax tr:hover {
  129. background-color: #e8e8e8;
  130. }
  131. #viewDiv {
  132. height: 100%;
  133. width: 100%;
  134. }
  135. #zoom {
  136. margin-bottom: 5px;
  137. }
  138. #actions {
  139. padding: 5px;
  140. }
  141. .container {
  142. height: 50%;
  143. width: 100%;
  144. }
  145. #createSlideDiv {
  146. background-color: white;
  147. opacity: 0.9;
  148. color: black;
  149. padding: 6px;
  150. }
  151. #slidesDiv {
  152. background-color: white;
  153. opacity: 0.9;
  154. color: black;
  155. padding: 10px;
  156. visibility: hidden;
  157. bottom: 20px;
  158. overflow-y: auto;
  159. text-align: center;
  160. height: 260px;
  161. }
  162. #slidesDiv .slide {
  163. /* Show cursor as pointer when on a slide */
  164. cursor: pointer;
  165. margin-bottom: 6px;
  166. }
  167. #slidesDiv .slide .title {
  168. /* Center the title text */
  169. text-align: center;
  170. }
  171. /* Draw active slide with a nice border around the thumbnail */
  172. #slidesDiv .slide.active img {
  173. box-shadow: 0px 0px 12px black;
  174. border-style: solid;
  175. border-width: thin;
  176. border-color: black;
  177. }
  178. </style>
  179. <script>
  180. $(document).ready(function() {
  181. getToken();
  182. });
  183. var token;
  184. function getToken() {
  185. var t;
  186. $.ajax({
  187. url: "./scripts/PHP/access_token.php",
  188. type: "GET",
  189. async: false,
  190. }).done(function(data) {
  191. token = data;
  192. //data = JSON.parse(data);
  193. }).error(function() {
  194. });
  195. }
  196. require([
  197. "esri/config",
  198. "esri/Map",
  199. "esri/WebScene",
  200. "esri/views/SceneView",
  201. "esri/core/urlUtils",
  202. "esri/identity/OAuthInfo",
  203. "esri/identity/IdentityManager",
  204. "esri/widgets/Legend",
  205. "esri/widgets/Home",
  206. "esri/widgets/Fullscreen",
  207. "esri/widgets/Slider",
  208. "esri/widgets/BasemapGallery",
  209. "esri/widgets/LayerList",
  210. "esri/layers/GroupLayer",
  211. "esri/layers/FeatureLayer",
  212. "esri/widgets/FeatureTable",
  213. "esri/tasks/support/Query",
  214. "esri/layers/SceneLayer",
  215. "esri/widgets/Zoom",
  216. "esri/widgets/Compass",
  217. "esri/widgets/NavigationToggle",
  218. "esri/widgets/Slice",
  219. "esri/widgets/Search",
  220. "esri/geometry/Point",
  221. "esri/geometry/Polyline",
  222. "esri/webscene/Slide",
  223. "esri/symbols/WebStyleSymbol",
  224. "esri/widgets/DirectLineMeasurement3D",
  225. "esri/Graphic",
  226. "esri/widgets/Search/LocatorSearchSource",
  227. "esri/renderers/UniqueValueRenderer",
  228. "esri/geometry/geometryEngine",
  229. "esri/widgets/Expand",
  230. "esri/layers/GeoJSONLayer",
  231. "esri/PopupTemplate",
  232. "esri/renderers/Renderer",
  233. "esri/geometry/projection"
  234. ], (esriConfig, Map, WebScene, SceneView, urlUtils, OAuthInfo, esriId,
  235. Legend,
  236. Home,
  237. Fullscreen,
  238. Slider,
  239. BasemapGallery,
  240. LayerList,
  241. GroupLayer,
  242. FeatureLayer,
  243. FeatureTable,
  244. Query,
  245. SceneLayer,
  246. Zoom,
  247. Compass,
  248. NavigationToggle,
  249. Slice,
  250. Search,
  251. Point,
  252. Polyline,
  253. Slide,
  254. WebStyleSymbol,
  255. DirectLineMeasurement3D,
  256. Graphic,
  257. LocatorSearchSource,
  258. UniqueValueRenderer,
  259. geometryEngine,
  260. Expand, GeoJsonLayer, PopupTemplate, Renderer, projection) => {
  261. esriConfig.apiKey = token;
  262. const webscene = new WebScene({
  263. portalItem: {
  264. id: "dea6580d8d4547df9915a822fe7f2b9d"
  265. },
  266. opacity: .75,
  267. showAttribution: false,
  268. });
  269. var featureLayer = new FeatureLayer({
  270. url: "https://services3.arcgis.com/W6g8dmWX0ILAHcNd/arcgis/rest/services/%E5%B7%A5%E7%A8%8B%E8%A8%AD%E8%A8%88%E8%B3%87%E6%96%99%E5%BA%AB/FeatureServer",
  271. outFields: ["*"],
  272. //renderer: poleRenderer,
  273. title: "工程設計資料庫",
  274. elevationInfo: "on-the-ground",
  275. visible: true
  276. });
  277. webscene.add(featureLayer);
  278. const view = new SceneView({
  279. container: "viewDiv",
  280. map: webscene,
  281. popup: {
  282. defaultPopupTemplateEnabled: true,
  283. dockEnabled: true,
  284. dockOptions: {
  285. breakpoint: false,
  286. buttonEnabled: false,
  287. position: "bottom-right",
  288. }
  289. }
  290. });
  291. window.view = view;
  292. view.ui.empty("top-left");
  293. //view.ui.empty("manual");
  294. view.ui.add(
  295. new Expand({
  296. view: view,
  297. content: new BasemapGallery({
  298. view: view
  299. }),
  300. autoCollapse: true,
  301. group: "top-left"
  302. }),
  303. "top-left"
  304. );
  305. view.ui.add(
  306. new Expand({
  307. view: view,
  308. content: new Legend({
  309. view: view
  310. }),
  311. autoCollapse: true,
  312. group: "top-left"
  313. }),
  314. "top-left"
  315. );
  316. view.ui.add(
  317. new Home({
  318. view: view,
  319. group: "top-left"
  320. }),
  321. "top-left"
  322. );
  323. view.ui.add(
  324. new Fullscreen({
  325. view: view,
  326. group: "top-left"
  327. }),
  328. "top-left"
  329. );
  330. var activeMeasureWidget = new DirectLineMeasurement3D({
  331. view: view
  332. });
  333. var pMeasureExpand = new Expand({
  334. view: view,
  335. container: document.getElementById("measureExpendDiv"),
  336. content: activeMeasureWidget,
  337. group: "top-left"
  338. });
  339. view.ui.add(
  340. pMeasureExpand,
  341. "top-left"
  342. );
  343. $("#measureExpendDiv .esri-widget--button").click(function() {
  344. if (pMeasureExpand.expanded) {
  345. activeMeasureWidget.viewModel.newMeasurement();
  346. } else {
  347. activeMeasureWidget.viewModel.clearMeasurement();
  348. }
  349. });
  350. function zoomToLayer(layer) {
  351. return layer.queryExtent().then((response) => {
  352. view.goTo(response.extent).catch((error) => {
  353. console.error(error);
  354. });
  355. });
  356. }
  357. $('#treeAjaxHTML').on("select_node.jstree", function(e, data) {
  358. if (data.node.text.includes("-")) {
  359. project_id = data.node.text.split("-")[0];
  360. featureLayer.definitionExpression = "計畫編號 = " + project_id;
  361. zoomToLayer(featureLayer);
  362. }
  363. /*else{
  364. type = data.node.text;
  365. console.log(type);
  366. featureLayer.definitionExpression = "工程類別 = '"+ type + "'";
  367. zoomToLayer(featureLayer);
  368. }*/
  369. });
  370. view.when(function() {
  371. });
  372. });
  373. </script>
  374. </head>
  375. <body>
  376. <script type="application/javascript">
  377. var test;
  378. var i = 0;
  379. var download;
  380. var fileName;
  381. var folder;
  382. var software;
  383. var userName = 'maabim';
  384. jQuery(window).load(function() {
  385. var searchURL = window.location.search;
  386. searchURL = searchURL.substring(1, searchURL.length);
  387. if (searchURL.includes("=")) {
  388. projectId = decodeURIComponent(searchURL.split("&")[1].split("=")[1]);
  389. var projectNode = $(".jstree-anchor").filter(function() {
  390. return $(this).text().includes(projectId);
  391. });
  392. var projectId = projectNode[0].attributes.id.value;
  393. $('#treeAjaxHTML').jstree("select_node", projectId);
  394. $("#treeAjaxHTML").jstree("close_all");
  395. }
  396. });
  397. //var typeId = node[0].attributes.id.value;
  398. </script>
  399. <section class="body">
  400. <!-- start: header -->
  401. <header class="header">
  402. <div class="logo-container">
  403. <div class="banner-txt">資料庫管理</div>
  404. <div class="visible-xs toggle-sidebar-left" data-toggle-class="sidebar-left-opened" data-target="html" data-fire-event="sidebar-left-opened">
  405. <i class="fa fa-bars" aria-label="Toggle sidebar"></i>
  406. </div>
  407. </div>
  408. <!-- start: search & user box -->
  409. <div class="header-right">
  410. <span class="separator"></span>
  411. <div id="userbox" class="userbox">
  412. <a href="#" data-toggle="dropdown">
  413. <figure class="profile-picture"> <img src="assets/images/!logged-user.jpg" alt="Joseph Doe" class="img-circle" data-lock-picture="assets/images/!logged-user.jpg" /> </figure>
  414. <div class="profile-info" data-lock-name="John Doe" data-lock-email="johndoe@JSOFT.com"> <span class="name"><?php echo $_SESSION['name'] ?></span> <span class="role">administrator</span> </div> <i class="fa custom-caret"></i>
  415. </a>
  416. <div class="dropdown-menu">
  417. <ul class="list-unstyled">
  418. <li class="divider"></li>
  419. <li> <a role="menuitem" tabindex="-1" href="./script/php/Logout.php"><i class="fa fa-power-off"></i> Logout</a> </li>
  420. </ul>
  421. </div>
  422. </div>
  423. </div>
  424. <!-- end: search & user box -->
  425. </header>
  426. <!-- end: header -->
  427. <div class="inner-wrapper">
  428. <!-- start: sidebar -->
  429. <aside id="sidebar-left" class="sidebar-left">
  430. <div class="nano">
  431. <div class="nano-content">
  432. <nav id="menu" class="nav-main" role="navigation">
  433. <div class="widget-header clearfix">
  434. <h6 class="title pull-left mt-xs">資料庫文件</h6>
  435. </div>
  436. <div class="widget-content">
  437. <div class="jstree jstree-1 jstree-default" id="treeAjaxHTML"></div>
  438. </div>
  439. </nav>
  440. </div>
  441. </div>
  442. </aside>
  443. <!-- end: sidebar -->
  444. <section role="main" class="content-body">
  445. <header class="page-header">
  446. <ul>
  447. <li>
  448. <label id="header"></label>
  449. </li>
  450. <li class="right">
  451. <div class="input-group input-search" style="table-layout: auto;"><input type="text" class="form-control" name="search" id="search" placeholder="Search..."><span class="input-group-btn"><button class="btn btn-default" id="btn-search"><i class="fa fa-search"></i></button></span></div>
  452. </li>
  453. </ul>
  454. </header>
  455. <div class="row">
  456. <div class="col-md-12">
  457. <section class="panel">
  458. <div class="panel-body">
  459. <div id="folderPath" style="float: left;"></div>
  460. <button id="reset" type="button" class="mb-xs mr-xs btn btn-default" style="float: right;"><i class="fa fa-reply"></i> 上一層</button>
  461. <button id="test" type="button" class="mb-xs mr-xs btn btn-default" style="float: right;"><i class="fa fa-reply"></i> test</button>
  462. <table style="width:99%;" class="table table-bordered table-striped" id="datatable-ajax">
  463. <thead>
  464. <tr>
  465. <th id="SN">項次</th>
  466. <th id="name">類別</th>
  467. <th>關鍵字</th>
  468. <th>版次</th>
  469. </tr>
  470. </thead>
  471. <tbody>
  472. </tbody>
  473. </table>
  474. </div>
  475. </section>
  476. </div>
  477. </div>
  478. <div class="row">
  479. <div class="col-md-6">
  480. <section class="panel">
  481. <div id="panel" class="panel-body" style="height:370px">
  482. <div class="table-responsive" style="display:none;">
  483. <table class="table table-bordered mb-none" id="tableDetail">
  484. <tbody>
  485. <tr>
  486. <th>計畫編號</th>
  487. <td id="plan_code"></td>
  488. </tr>
  489. <tr>
  490. <th>計畫名稱</th>
  491. <td id="plan_name"></td>
  492. </tr>
  493. <tr>
  494. <th>圖名</th>
  495. <td id="fileName"></td>
  496. </tr>
  497. <tr>
  498. <th>版次</th>
  499. <td id="version"></td>
  500. </tr>
  501. <tr>
  502. <th>文件</th>
  503. <td id="download"></td>
  504. </tr>
  505. </tbody>
  506. </table>
  507. </div>
  508. </div>
  509. </section>
  510. </div>
  511. <div class="col-md-6">
  512. <section class="panel">
  513. <div id="arcgis" class="panel-body" style="height:370px">
  514. <div class="mapok" style="height:100%">
  515. <div id="viewDiv"></div>
  516. <div id="measureExpendDiv"></div>
  517. <div id="slidesDiv" class="esri-widget"></div>
  518. <span style="display:none;" id="project-id"></span>
  519. </div>
  520. </div>
  521. </section>
  522. </div>
  523. </div>
  524. </div>
  525. </section>
  526. </div>
  527. </section>
  528. </body>
  529. </html>