step3.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. require_once '../pcdl/html_head.php';
  3. ?>
  4. <body>
  5. <h3>Step 2 Dictionary</h3>
  6. <div style="margin:1em;background-color:#f1e7a4;">
  7. 生成字典数据库。约需要10分钟。您可以从网络下载已经生成好的数据库。
  8. <a href="https://www.dropbox.com/s/naf7sk9i9sf0dfi/appdata.7z?dl=0">drobox 7z format 754MB</a>
  9. 解压缩后放在项目目录中
  10. <pre>
  11. [project dir]
  12. └app
  13. └appdata
  14. └dict
  15. └3rd
  16. └system
  17. └palicanon
  18. └user
  19. </pre>
  20. </div>
  21. <div id="response"></div>
  22. <script>
  23. <?php
  24. echo "var rich_file_list = new Array();\n";
  25. $filelist = array();
  26. if(($handle=fopen(_DIR_DICT_TEXT_.'/rich/list.txt','r'))!==FALSE){
  27. while(($data=fgetcsv($handle,0,','))!==FALSE){
  28. $filelist[] = $data;
  29. }
  30. }
  31. else{
  32. exit("无法打开rich文件列表");
  33. }
  34. foreach($filelist as $value){
  35. echo "rich_file_list.push(['{$value[0]}','{$value[1]}']);\n";
  36. }
  37. echo "var sys_file_list = new Array();\n";
  38. $filelist = array();
  39. if(($handle=fopen(_DIR_DICT_TEXT_.'/system/list.txt','r'))!==FALSE){
  40. while(($data=fgetcsv($handle,0,','))!==FALSE){
  41. $filelist[] = $data;
  42. }
  43. }
  44. else{
  45. exit("无法打开system文件列表");
  46. }
  47. foreach($filelist as $value){
  48. echo "sys_file_list.push(['{$value[0]}','{$value[1]}']);\n";
  49. }
  50. ?>
  51. var iCurrRichDictIndex = 0;
  52. var iCurrSysDictIndex = 0;
  53. function run_rich_dict(index){
  54. if(index >= rich_file_list.length){
  55. $("#response").html($("#response").html()+"rich dict Down");
  56. run_sys_dict(0);
  57. }
  58. else{
  59. $.get("step3_run.php",
  60. {
  61. dbtype:"rich",
  62. filename:rich_file_list[index][0],
  63. dbname:rich_file_list[index][1]
  64. },
  65. function(data,status){
  66. $("#response").html($("#response").html()+data+"<br>");
  67. iCurrRichDictIndex++;
  68. run_rich_dict(iCurrRichDictIndex);
  69. });
  70. }
  71. }
  72. function run_sys_dict(index){
  73. if(index >= sys_file_list.length){
  74. $("#response").html($("#response").html()+"All Down");
  75. }
  76. else{
  77. iCurrSysDictIndex = index;
  78. $.get("step3_run.php",
  79. {
  80. dbtype:"system",
  81. filename:sys_file_list[index][0],
  82. dbname:sys_file_list[index][1]
  83. },
  84. function(data,status){
  85. $("#response").html($("#response").html()+data+"<br>");
  86. iCurrSysDictIndex++;
  87. run_sys_dict(iCurrSysDictIndex);
  88. });
  89. }
  90. }
  91. function run_part_dict(){
  92. $.get("step3_run.php",
  93. {
  94. dbtype:"part",
  95. filename:"",
  96. dbname:""
  97. },
  98. function(data,status){
  99. $("#response").html($("#response").html()+data+" done<br>");
  100. });
  101. }
  102. </script>
  103. <h2>
  104. <button onclick="run_rich_dict(0)">Build rich dictionary </button><span style="请注意!此操作将会覆盖原有数据库。"><br>
  105. <button onclick="run_part_dict()">Build part dictionary</button><span style="请注意!此操作将会覆盖原有数据库。">
  106. </h2>
  107. <hr>
  108. <h2><a href="step4.php">[Next]</a></h2>
  109. </body>
  110. </html>