2
0

index.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <?php
  2. include "../path.php";
  3. include "../public/_pdo.php";
  4. global $PDO;
  5. if (isset($_GET['dict_id'])) {
  6. $dict_id = $_GET['dict_id'];
  7. } else {
  8. $dict_id = -1;
  9. }
  10. if (isset($_GET['page_no'])) {
  11. $page_no = $_GET['page_no'];
  12. } else {
  13. $page_no = 0;
  14. }
  15. if (isset($_GET['page_size'])) {
  16. $page_size = $_GET['page_size'];
  17. } else {
  18. $page_size = 20;
  19. }
  20. ?>
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  22. <html>
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  25. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  26. <script src="../public/js/jquery.js"></script>
  27. <script src="js/dict.js"></script>
  28. <script src="js/index.js"></script>
  29. <title>PCD Studio</title>
  30. <style>
  31. #body-inner{
  32. display:flex;
  33. }
  34. #left_tool_bar{
  35. flex:2;
  36. border-right: 1px solid gray;
  37. padding: 0 0.5em;
  38. }
  39. #build-dict{
  40. flex:6;
  41. padding: 0 0.5em;
  42. }
  43. #right-bar{
  44. flex:2;
  45. }
  46. .one_mean{
  47. display:inline-block;
  48. background-color:#EEE;
  49. padding:4px;
  50. margin:2px;
  51. }
  52. textarea{
  53. width:100%;
  54. height:1em;
  55. }
  56. #right_tool_bar{
  57. flex:3;
  58. position:fix;
  59. top:0;
  60. left:0;
  61. height:100%
  62. }
  63. #org_edit_text{
  64. height:8em;
  65. }
  66. .ref_word:hover{
  67. border-top: 1px solid #9797ff;
  68. border-bottom: 1px solid #9797ff;
  69. }
  70. .active{
  71. border-top: 1px solid #9797ff;
  72. border-bottom: 1px solid #9797ff;
  73. }
  74. .status_2{
  75. background-color:#d6d6d6;
  76. }
  77. .status_3{
  78. background-color:#ffc3b6;
  79. }
  80. .status_10{
  81. background-color:#a3f89e;
  82. }
  83. #word_org_text{
  84. border: 1px solid #9797ff;
  85. background: #ececec;
  86. padding: 5px 8px;
  87. margin: 2px 0;
  88. }
  89. #org_data h3{
  90. margin-bottom:5px;
  91. }
  92. .replace_table{
  93. height:30em;
  94. }
  95. table {
  96. border-collapse: collapse;
  97. width: 100%;
  98. }
  99. td,
  100. th {
  101. border: 1px solid #D2D2D2;
  102. vertical-align: baseline;
  103. }
  104. tr.h {
  105. background-color: #F5F5F5;
  106. font-weight: 500;
  107. color: #000000;
  108. }
  109. #message{
  110. background-color: #f2feff;
  111. border: 1px solid #bdbdbd;
  112. padding: 6px;
  113. margin: 5px;
  114. display:none;
  115. }
  116. #message_button{
  117. text-align: center;
  118. }
  119. #final_word{
  120. }
  121. #final_word_header{
  122. background-color:#a2de8c;
  123. }
  124. #final_word_body{
  125. background-color:#e7ffde;
  126. }
  127. </style>
  128. <script>
  129. var gDictId = <?php echo $dict_id ?> ;
  130. </script>
  131. </head>
  132. <body class="mainbody" id="mbody" onload="init()">
  133. <div id="body-inner">
  134. <div id="left_tool_bar" >
  135. <div id="right_tool_bar_title">
  136. <div>
  137. <select onchange="dict_changed(this)">
  138. <?php
  139. $dictFileName = _FILE_DB_REF_;
  140. PDO_Connect("$dictFileName");
  141. $query = "SELECT * from info where 1 limit 0,100";
  142. $Fetch = PDO_FetchAll($query);
  143. $iFetch = count($Fetch);
  144. if ($iFetch > 0) {
  145. if ($dict_id == -1) {
  146. echo "<option value=\"-1\" selected >选择一本字典</option>";
  147. }
  148. for ($i = 0; $i < $iFetch; $i++) {
  149. if ($Fetch[$i]["id"] == $dict_id) {
  150. $selected = "selected";
  151. } else {
  152. $selected = "";
  153. }
  154. echo "selected : $selected<br>";
  155. echo "<option value=\"" . $Fetch[$i]["id"] . "\" $selected >" . $Fetch[$i]["shortname"] . "</option>";
  156. }
  157. }
  158. if ($dict_id != -1) {
  159. $query = "SELECT count(*) from dict where dict_id = ? ";
  160. $dict_count = PDO_FetchOne($query, array($dict_id));
  161. $totle_page = ceil($dict_count / $page_size);
  162. } else {
  163. $totle_page = 0;
  164. }
  165. ?>
  166. </select>
  167. </div>
  168. <div id="dict_ref_search_input_div">
  169. <div id="dict_ref_search_input_head">
  170. <input id="dict_ref_search_input" type="input" onkeyup="dict_input_keyup(event,this)">
  171. </div>
  172. <div><span id="input_parts"><span></span></span></div>
  173. </div>
  174. <div id="dict_word_nav">
  175. <a
  176. <?php
  177. if ($page_no > 0) {
  178. $prev_page = $page_no - 1;
  179. echo "href='index.php?dict_id=$dict_id&page_no=$prev_page&page_size=$page_size'";
  180. }
  181. ?>
  182. >上一页</a>
  183. <input type="input" value="<?php echo $page_no; ?>" onchange="goto_page(this,<?php echo $dict_id; ?>,<?php echo $totle_page; ?>)" style="width:4em;" />/
  184. <span><?php echo $totle_page - 1; ?></span>
  185. <a
  186. <?php
  187. if ($page_no < $totle_page) {
  188. $next_page = $page_no + 1;
  189. echo "href='index.php?dict_id=$dict_id&page_no=$next_page&page_size=$page_size'";
  190. }
  191. ?>
  192. >下一页</a>
  193. </div>
  194. </div>
  195. <div id="left_tool_bar_inner">
  196. <div id="dict_ref_search">
  197. <div id="dict_ref_search_result">
  198. <?php
  199. if ($dict_id != -1) {
  200. $from = $page_no * $page_size;
  201. $query = "SELECT id, paliword,status from dict where dict_id = ? limit ? , ? ";
  202. $Fetch = PDO_FetchAll($query, array($dict_id, $from, $page_size));
  203. foreach ($Fetch as $word) {
  204. $class_status = "status_" . $word["status"];
  205. $str_status = "";
  206. switch ($word["status"]) {
  207. case 1:
  208. $str_status = "";
  209. break;
  210. case 2:
  211. $str_status = "[草]";
  212. break;
  213. case 3:
  214. $str_status = "[标]";
  215. break;
  216. case 10:
  217. $str_status = "";
  218. break;
  219. }
  220. echo "<div id='word_" . $word["id"] . "' class='ref_word $class_status' onclick='res_word_selected(this," . $word["id"] . ")'>$str_status<span class='pali_word' >" . $word["paliword"] . "</div>";
  221. }
  222. }
  223. ?>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. <div id="build-dict">
  229. <div id="message">
  230. <div id="message_text"></div>
  231. <div id="message_button"><button onclick="close_notify()">知道了</button></div>
  232. </div>
  233. <div>
  234. <button onclick=save(10)>保存</button>
  235. <button onclick=save(2)>存为草稿</button>
  236. <button onclick=save(3)>保存并加标记</button>
  237. <button onclick="refresh_word()">刷新</button>
  238. </div>
  239. <div id="org_data">
  240. </div>
  241. <div id="org_edit">
  242. <textarea id="org_edit_text" onkeyup="org_edit_changed()" onchange="org_edit_changed()"></textarea>
  243. </div>
  244. <div id="word_table">
  245. </div>
  246. </div>
  247. <div id="right-bar">
  248. <div id="right-bar-header">
  249. </div>
  250. <div id="right-bar-inner">
  251. <div>
  252. 替换表
  253. <select onchange="replace_table_show(this)">
  254. <option value="main" selected >主表</option>
  255. <option value="pali" >词头</option>
  256. <option value="type" >语法</option>
  257. <option value="part" >拆分</option>
  258. </select>
  259. <button onclick="save_replace_table()">保存</button>
  260. </div>
  261. <textarea id="replace_table_main" class="replace_table" ></textarea>
  262. <textarea id="replace_table_pali" class="replace_table" style="display:none;"></textarea>
  263. <textarea id="replace_table_type" class="replace_table" style="display:none;"></textarea>
  264. <textarea id="replace_table_part" class="replace_table" style="display:none;"></textarea>
  265. </div>
  266. </div>
  267. </div>
  268. </body>
  269. </html>