index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. include '../auth.php';
  3. ?>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" href="scripts/tocas/tocas.css">
  7. <script src="scripts/jquery.min.js"></script>
  8. <title>AOB Documd</title>
  9. </head>
  10. <body>
  11. <br>
  12. <br>
  13. <div class="ts container stackable grid">
  14. <div class="sixteen wide column">
  15. <div class="ts secondary fitted menu">
  16. <div class="item">
  17. <h3 class="ts header">
  18. ArOZ Online Beta Documentation
  19. </h3>
  20. </div>
  21. <div class="right menu">
  22. <div class="item">
  23. <div class="ts breadcrumb">
  24. <a class="section">Documd</a>
  25. <i class="right chevron icon divider"></i>
  26. <div class="active section">Markdown Documentation Rendering Tool</div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="four wide column">
  33. <div class="ts icon fluid input">
  34. <input type="text" placeholder="Search...">
  35. <i class="search icon"></i>
  36. </div>
  37. <div class="ts top attached header">
  38. Documentation Chapters
  39. </div>
  40. <div class="ts bottom attached vertical menu" style="word-wrap: break-word;word-break: break-all;">
  41. <?php
  42. $folderList = [];
  43. $filesList = [];
  44. $fileNameList = [];
  45. $count = 0;
  46. $folders = glob("docs/*");
  47. foreach($folders as $folder){
  48. if (is_dir($folder)){
  49. echo '<a class="item" onClick="OpenFolder('.$count.')">
  50. <i class="folder open outline icon"></i> '.basename($folder).'
  51. </a>';
  52. array_push($folderList,bin2hex($folder));
  53. $count++;
  54. }
  55. }
  56. $count = 0;
  57. $files = glob("docs/*.md");
  58. foreach($files as $file){
  59. if (is_file($file)){
  60. $shortenFilename = wordwrap(basename($file), 35, "<br />\n");
  61. echo '<a class="item" onClick="OpenFile('.$count.')">
  62. <i class="file outline icon"></i> '.$shortenFilename.'
  63. </a>';
  64. array_push($filesList,bin2hex($file));
  65. array_push($fileNameList,$file);
  66. $count++;
  67. }
  68. }
  69. ?>
  70. </div>
  71. </div>
  72. <div class="twelve wide column">
  73. <div class="ts segments">
  74. <!-- 標題工具列 -->
  75. <div class="ts fitted primary segment">
  76. <div class="ts secondary horizontally fitted menu">
  77. <!-- 標題項目 -->
  78. <div class="header item">
  79. Documd Viewer
  80. </div>
  81. <div class="right menu">
  82. <div class="item">
  83. <div class="ts small buttons">
  84. <button class="ts icon button" onClick="PreviousPage();">
  85. <i class="left arrow icon"></i>
  86. </button>
  87. <button class="ts icon button"onClick="NextPage();">
  88. <i class="right arrow icon"></i>
  89. </button>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="ts segment">
  96. <div id="DocFileName" class="ts medium header">
  97. Current Page
  98. <div id="DocFullPath" class="sub header">
  99. /docs/title.md
  100. </div>
  101. </div>
  102. </div>
  103. <div class="ts segment"id="docContent">
  104. </div>
  105. <br><br><br><br>
  106. </div>
  107. </div>
  108. <div style="width:100%;" align="right">Documd Markdown Documentation Rendering Interface, Developed by IMUS Laboratory</div>
  109. </div>
  110. <script>
  111. var folderList = <?php echo json_encode($folderList);?>;
  112. var fileList = <?php echo json_encode($filesList);?>;
  113. var fileNameList = <?php echo json_encode($fileNameList);?>;
  114. var currentPage = 0;
  115. $(document).ready(function(){
  116. $('#docContent').load("getDoc.php?filename=" + fileList[0]);
  117. $('#DocFullPath').html(fileNameList[0]);
  118. });
  119. function OpenFolder(id){
  120. }
  121. function PreviousPage(){
  122. if (currentPage > 0){
  123. currentPage--;
  124. $('#docContent').load("getDoc.php?filename=" + fileList[currentPage]);
  125. $('#DocFullPath').html(fileNameList[currentPage]);
  126. }
  127. }
  128. function NextPage(){
  129. if (currentPage < fileList.length-1){
  130. currentPage++;
  131. $('#docContent').load("getDoc.php?filename=" + fileList[currentPage]);
  132. $('#DocFullPath').html(fileNameList[currentPage]);
  133. }
  134. }
  135. function OpenFile(id){
  136. var file = fileList[id];
  137. console.log(file);
  138. currentPage = id;
  139. $('#docContent').load("getDoc.php?filename=" + file);
  140. $('#DocFullPath').html(fileNameList[id]);
  141. }
  142. </script>
  143. </body>
  144. </html>
  145. </body>
  146. </html>