2
0
Эх сурвалжийг харах

Merge pull request #35 from visuddhinanda/master

Fix word chart
Bhikkhu-Kosalla 5 жил өмнө
parent
commit
5f7280a0d2

+ 3 - 1
app/dict/css/style.css

@@ -19,9 +19,11 @@
     font-weight: 300;
     display: inline-block;
     font-style: normal;
+ 
 }
 
 .dict_word input,select,textarea{
 	background-color:white;
-	color:black;
+    color:rgb(0, 0, 0);
+
 }

+ 1 - 0
app/dict/dict.js

@@ -29,6 +29,7 @@ function dict_search(word) {
 			$("#dict_search_result").html(data);
 			$("#dict_list").html($("#dictlist").html());
 			$("#dictlist").html("");
+			guide_init();
 		});
 }
 function standardize(word) {

+ 33 - 29
app/dict/dict_lookup.php

@@ -157,7 +157,7 @@ switch($op){
 	case "search":
 		echo "<div id='dict_list'></div>";
 		echo "<div id='dict_ref'>";	
-
+		$dict_list_a = [];
 		//社区字典开始
 		PDO_Connect("sqlite:"._FILE_DB_WBW_);
 		$query = "select *  from dict where \"pali\"= ".$PDO->quote($word)." limit 0,100";
@@ -183,30 +183,14 @@ switch($op){
 					$userdict["{$userwordcase}"]["factors"] = $value["factors"];
 				}
 				
-/*
-				$mean=$Fetch[$i]["mean"];
-				echo "<div class='dict_word'>";
-				echo "<div class='pali'>{$word}</div>";
-				echo "<div class=''>语法:{$Fetch[$i]["type"]}-{$Fetch[$i]["gramma"]}</div>";
-				if(strlen($Fetch[$i]["parent"])>0){
-					echo "<div class=''>语基:{$Fetch[$i]["parent"]}</div>";
-				}
-				echo "<div class=''>意思:{$Fetch[$i]["mean"]}</div>";
-				if(strlen($Fetch[$i]["note"]>0)){
-					echo "<div class=''>注解:{$Fetch[$i]["note"]}</div>";
-				}
-				echo "<div class=''>组分:{$Fetch[$i]["factors"]}</div>";
-				echo "<div class=''>组分意思:{$Fetch[$i]["factormean"]}</div>";
-				echo "<div class=''>贡献者:{$Fetch[$i]["creator"]}</div>";
-				echo "<div class=''>收藏:{$Fetch[$i]["ref_counter"]}次</div>";
-				echo "</div>";
-				*/
+
 			}
 			echo "<div class='dict_word'>";
-			echo "<div class='dict'>社区字典</div>";
+			echo "<div class='dict'>社区字典</div><a name='net'></a>";
+			$dict_list_a[] = array("net","社区字典");
+
 			foreach($userdict as $key => $value){
 				echo "<div class='mean'>{$key}:{$value["mean"]}</div>";
-				
 			}
 			echo "<div><span>贡献者:</span>";
 			foreach ($userlist as $key => $value) {
@@ -229,6 +213,7 @@ switch($op){
 				$mean=$Fetch[$i]["mean"];
 				$dictid=$Fetch[$i]["dict_id"];
 				$dict_list[$dictid]=$Fetch[$i]["shortname"];
+				$dict_list_a[] = array("ref_dict_$dictid",$Fetch[$i]["shortname"]);
 				$outXml = "<div class='dict_word'>";
 				$outXml = $outXml."<a name='ref_dict_$dictid'></a>";
 				$outXml = $outXml."<div class='dict'>".$Fetch[$i]["shortname"]."</div>";
@@ -245,11 +230,19 @@ switch($op){
 			if($end==$case[$row][1]){
 				$base=mb_substr($word, 0,mb_strlen($word,"UTF-8")-$len,"UTF-8").$case[$row][0];
 				if($base!=$word){
+					$thiscase = "";
+					$arrCase = explode('$',$case[$row][2]);
+					foreach($arrCase as $value){
+						$caseid = "grammar_".str_replace('.','',$value);
+						$thiscase .= "<guide gid='$caseid'>$value</guide>";
+					}
+					
+					
 					if(isset($newWord[$base])){
-						$newWord[$base] .= "<br />".$case[$row][2];
+						$newWord[$base] .= "<br />".$thiscase;
 					}
 					else{
-						$newWord[$base] = $case[$row][2];
+						$newWord[$base] = $thiscase;
 					}
 				}
 			}
@@ -262,11 +255,18 @@ switch($op){
 				$iFetch=count($Fetch);
 				$count_return+=$iFetch;
 				if($iFetch>0){
-					echo $x . ":<div class='dict_find_gramma'>" . $x_value . "</div>";
+					$dict_list_a[] = array("word_$x",$x);
+					echo "<div style='font-size:120%;font-weight:700;'><a name='word_$x'></a>".$x."</div>" ;
+					//语法信息
+					foreach($_local->grammastr as $gr){
+						$x_value = str_replace($gr->id,$gr->value,$x_value);
+					}
+					echo "<div class='dict_find_gramma'>" . $x_value . "</div>";
 					for($i=0;$i<$iFetch;$i++){
 						$mean=$Fetch[$i]["mean"];
 						$dictid=$Fetch[$i]["dict_id"];
 						$dict_list[$dictid]=$Fetch[$i]["shortname"];
+						$dict_list_a[] = array("ref_dict_$dictid",$Fetch[$i]["shortname"]);
 						echo "<div class='dict_word'>";
 						echo "<a name='ref_dict_$dictid'></a>";
 						echo "<div class='dict'>".$Fetch[$i]["shortname"]."</div>";
@@ -280,7 +280,7 @@ switch($op){
 		
 		//查连读词
 		if($count_return<2){
-			echo "Junction:<br />";
+			echo "<div>Junction</div>";
 			$newWord=array();
 			for ($row = 0; $row < count($un); $row++) {
 				$len=mb_strlen($un[$row][1],"UTF-8");
@@ -355,9 +355,14 @@ switch($op){
 
 
 		echo "<div id='dictlist'>";
-		foreach($dict_list as $x=>$x_value) {
-		  echo "<div><a href='#ref_dict_$x'>$x_value</a></div>";
-		}
+		foreach($dict_list_a as $x_value) {
+			if(substr($x_value[0],0,4)=="word"){
+				echo "<div style='font-size:120%;font-weight:700;margin-top:15px;'><a href='#{$x_value[0]}'>$x_value[1]</a></div>";
+			}
+			else{
+				echo "<div><a href='#{$x_value[0]}'>$x_value[1]</a></div>";
+			}
+		  }		
 		echo "<div>";
 
 		$arrWords = countWordInPali($word,true);
@@ -383,7 +388,6 @@ switch($op){
 		echo "</div>";
 		echo "</div>";
 		//参考字典查询结束
-		
 
 		//用户词典
 		echo "<div id='dict_user' >";	

+ 71 - 11
app/dict/word_statistics.php

@@ -1,5 +1,6 @@
 <?PHP
 include "../pcdl/html_head.php";
+require_once "../public/load_lang_js.php";//语言文件
 ?>
 	<body>
 		<style type="text/css">
@@ -37,6 +38,15 @@ include "../pcdl/html_head.php";
             }
             .highcharts-data-table tr:hover {
                 background: #f1f7ff;
+            }
+            .chart_head_1 {
+                text-align: center;
+                font-size: x-large;
+                margin-bottom: 0;
+                font-weight: bold;
+            }
+            .highcharts-data-label {
+                font-size: small;
             }
 		</style>
 <script src="../public/js/highcharts/highcharts.js"></script>
@@ -47,7 +57,7 @@ include "../pcdl/html_head.php";
 <?php
     require_once("../pcdl/head_bar.php");
 ?>
-<h2 style="text-align:center;"><?php echo $_GET["word"] ?></h2>
+<h2 class="chart_head_1"><?php echo $_local->gui->statistical.$_local->gui->chart.":"; ?><?php echo ucfirst($_GET["word"]) ?></h2>
 <div style="display:flex;">
 <figure class="highcharts-figure">
     <div id="container"></div>
@@ -68,7 +78,7 @@ include "../pcdl/html_head.php";
     Highcharts.getOptions().colors.splice(0, 0, 'transparent');
 
     Highcharts.setOptions({
-            colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
+            colors: ['#f5f5f5', '#d2691e', '#7cb5ec', '#f08080', '#ffd700', '#f15c80', '#e4d354', '#8b0000', '#8d4653']
         });
     Highcharts.chart('container', {
         chart: {
@@ -76,7 +86,7 @@ include "../pcdl/html_head.php";
         },
 
         title: {
-            text: 'Distribution'
+            text: gLocal.gui.distribution
         },
         subtitle: {
             text: ''
@@ -99,6 +109,9 @@ include "../pcdl/html_head.php";
                 level: 1,
                 levelIsConstant: false,
                 dataLabels: {
+                    style: {
+        				fontSize: 'x-large',
+	        		},
                     filter: {
                         property: 'outerArcLength',
                         operator: '>',
@@ -107,13 +120,23 @@ include "../pcdl/html_head.php";
                 }
             }, {
                 level: 2,
-                colorByPoint: true
+                colorByPoint: true,
+                dataLabels: {
+                    style: {
+        				fontSize: 'large',
+	        		},
+                }
             },
             {
                 level: 3,
                 colorVariation: {
                     key: 'brightness',
                     to: -0.5
+                },
+                dataLabels: {
+                    style: {
+        				fontSize: 'small',
+	        		},
                 }
             }, {
                 level: 4,
@@ -125,7 +148,7 @@ include "../pcdl/html_head.php";
         }],
         tooltip: {
             headerFormat: "",
-            pointFormat: '三藏译文 <b>{point.name}</b> 为 <b>{point.value}</b>'
+            pointFormat: '<b><?php echo ucfirst($_GET["word"]) ?></b> <?php echo $_local->gui->in ?> <b>{point.name}</b> <?php echo $_local->gui->present ?> <b>{point.value}</b> '+gLocal.gui.times
         }
     });
   });
@@ -141,24 +164,61 @@ include "../pcdl/html_head.php";
             type: 'bar'
         },
         title: {
-            text: 'Declension List'
+            text: gLocal.gui.declension_list,
+            style: {
+				fontSize: 'large',
+			    }
         },
         xAxis: {
-            categories: worddata.wordlist
+            categories: worddata.wordlist,
+            labels: {
+                enabled: true,//显示
+                //crosshair: false, 功能未知
+                style: {
+                    fontSize: 'small',
+                },
+                padding: 5,
+                //reserveSpace: false, 轴标签是否占空间
+                step: 1//每个标签都显示,不跳
+    		},
+            //tickWidth: 1,//刻度显示宽度
+            //tickPixelInterval: 0,
+            //tickAmount: 10
+
         },
         yAxis: {
             min: 0,
             title: {
-                text: 'Frequency'
-            }
+                text: gLocal.gui.frequency,
+                style: {
+				fontSize: 'large',
+			    }
+            },
+            labels: {
+                style: {
+                    fontSize: 'small',
+                }
+    		},
         },
         legend: {
-            reversed: true
+            reversed: true,
+            verticalAlign: "top",
+            enabled: true //图例开关
         },
         plotOptions: {
             series: {
                 stacking: 'normal'
-            }
+            },
+            bar: {
+                pointPadding: 0,
+                borderWidth: 0,
+                //pointWidth: 10,
+                dataLabels: {
+                    //allowOverlap: true,
+                    //enabled: true
+                }
+		}
+
         },
         series: worddata.data
     });

+ 1 - 1
app/guide/get.php

@@ -23,7 +23,7 @@ else{
     }
     else{
         //尝试使用英语文件不成功,报错
-        $output["data"]  =  "Error: Can't Find Item In Server. Item Id:{$_GET["id"]}  Language:{$lang}";
+        $output["data"]  =  "Error: Can't Find Item In Server.<br> Item Id:{$_GET["id"]} <br> Language:{$lang}";
         $output["id"]  =$_GET["id"];
     }
 }

+ 13 - 7
app/guide/guide.js

@@ -1,12 +1,18 @@
 function guide_init() {
     $("guide").each(function () {
-        if ($(this).offset().left < $(document.body).width() / 2) {
-            $(this).append('<div  class="guide_contence" style="left: -5px;"></div>');
-            $(".guide_contence:after").css("left", "0");
-        }
-        else {
-            $(this).append('<div  class="guide_contence" style="right: -5px;"></div>');
-            $(".guide_contence:after").css("right", "0");
+        if ($(this).attr("init") != "1") {
+            if ($(this).text().length > 0) {
+                $(this).css("background", "unset");
+            }
+            if ($(this).offset().left < $(document.body).width() / 2) {
+                $(this).append('<div  class="guide_contence" style="left: -5px;"></div>');
+                $(".guide_contence:after").css("left", "0");
+            }
+            else {
+                $(this).append('<div  class="guide_contence" style="right: -5px;"></div>');
+                $(".guide_contence:after").css("right", "0");
+            }
+            $(this).attr("init", "1");
         }
     });
 

+ 6 - 1
app/public/lang/default.json

@@ -428,7 +428,12 @@
 		"forms": "spelling forms",
 		"add_to": "add to",
 		"undone_function": "unfinished function",
-		"": "",
+		"click_to_chart": "click to check the chart",
+		"frequency": "Frequency",
+		"declension_list": "Declension List",
+		"distribution": "Distribution Chart",
+		"in": "present in",
+		"present": ""
 		"": ""
 	},
 	"grammastr": [

+ 4 - 0
app/public/lang/en.json

@@ -428,6 +428,10 @@
 		"forms": "spelling forms",
 		"add_to": "add to",
 		"undone_function": "unfinished function",
+		"click_to_chart": "click to check the chart",
+		"frequency": "Frequency",
+		"declension_list": "Declension List",
+		"distribution": "Distribution Chart",
 		"": "",
 		"": ""
 	},

+ 4 - 0
app/public/lang/my.json

@@ -428,6 +428,10 @@
 		"forms": "spelling forms",
 		"add_to": "add to",
 		"undone_function": "unfinished function",
+		"click_to_chart": "click to check the chart",
+		"frequency": "Frequency",
+		"declension_list": "Declension List",
+		"distribution": "Distribution Chart",
 		"": "",
 		"": ""
 	},

+ 4 - 0
app/public/lang/si.json

@@ -433,6 +433,10 @@
 		"forms": "spelling forms",
 		"add_to": "add to",
 		"undone_function": "unfinished function",
+		"click_to_chart": "click to check the chart",
+		"frequency": "Frequency",
+		"declension_list": "Declension List",
+		"distribution": "Distribution Chart",
 		"": "",
 		"": ""
 	},

+ 6 - 1
app/public/lang/zh-cn.json

@@ -431,7 +431,12 @@
 		"undone_function": "未完成功能",
 		"click_to_chart": "点击查看统计图表",
 		"frequency": "词频",
-		"": ""
+		"declension_list": "变化表",
+		"distribution": "分布图",
+		"statistical": "统计",
+		"chart": "图表",
+		"in": "在",
+		"present": "中出现"
 	},
 	"grammastr": [
 		{

+ 4 - 0
app/public/lang/zh-tw.json

@@ -429,6 +429,10 @@
 		"forms": "種形式",
 		"add_to": "新增到",
 		"undone_function": "未完成功能",
+		"click_to_chart": "點選檢視統計圖表",
+		"frequency": "詞頻",
+		"declension_list": "變化表",
+		"distribution": "分佈圖",
 		"": ""
 	},
 	"grammastr": [

+ 0 - 0
app/studio/_FILE_DB_MESSAGE_


+ 0 - 0
app/studio/_FILE_DB_PALITEXT_


+ 0 - 0
app/studio/_FILE_DB_RES_INDEX_


+ 5 - 0
documents/users_guide/zh-cn/grammar_m.md

@@ -0,0 +1,5 @@
+# 阳性词
+
+巴利语:
+
+巴利语中三种词性的一种

+ 5 - 0
documents/users_guide/zh-cn/grammar_nom.md

@@ -0,0 +1,5 @@
+# 主格
+巴利语:
+
+动作的发出者。
+