2
0

index.php 6.5 KB

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