Browse Source

Merge pull request #362 from visuddhinanda:master

Merge branch 'master' of https://github.com/visuddhinanda/mint
visuddhinanda 5 years ago
parent
commit
26babc75be

+ 0 - 1
app/pali_sent/get_sim.php

@@ -39,7 +39,6 @@ foreach ($simList as $value) {
         $sent["path"] = _get_para_path($Fetch["book"], $Fetch["paragraph"]);
         $sent["path"] = _get_para_path($Fetch["book"], $Fetch["paragraph"]);
         $output[] = $sent;
         $output[] = $sent;
     }
     }
-
 }
 }
 
 
 echo json_encode($output, JSON_UNESCAPED_UNICODE);
 echo json_encode($output, JSON_UNESCAPED_UNICODE);

+ 0 - 0
app/pali_sent/upgrade_redis_para_path.php


+ 4 - 0
app/pali_sent/upgrade_redis_sim.php

@@ -0,0 +1,4 @@
+<?php 
+
+
+?>

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

@@ -611,7 +611,7 @@
 		"cooperate_group": "协作组",
 		"cooperate_group": "协作组",
 		"personal": "个人",
 		"personal": "个人",
 		"empty_null_mark": "这里很安静",
 		"empty_null_mark": "这里很安静",
-		"lesson_intro": "看看世界地的巴利专家都是如何解析圣典的",
+		"lesson_intro": "看看世界地的巴利专家都是如何解析圣典的",
 		"teaching_course": "主讲的课程",
 		"teaching_course": "主讲的课程",
 		"watching_course": "关注的课程",
 		"watching_course": "关注的课程",
 		"": ""
 		"": ""

+ 1 - 1
app/public/lang/zh-tw.json

@@ -610,7 +610,7 @@
 		"cooperate_group": "協作組",
 		"cooperate_group": "協作組",
 		"personal": "個人",
 		"personal": "個人",
 		"empty_null_mark": "這裡很安靜",
 		"empty_null_mark": "這裡很安靜",
-		"lesson_intro": "看看世界地的巴利專家都是如何解析聖典的",
+		"lesson_intro": "看看世界地的巴利專家都是如何解析聖典的",
 		"teaching_course": "主講的課程",
 		"teaching_course": "主講的課程",
 		"watching_course": "關注的課程",
 		"watching_course": "關注的課程",
 		"": ""
 		"": ""

+ 38 - 9
app/redis/upgrade_pali_sent.php

@@ -10,31 +10,60 @@ if (isset($argv[1])) {
     if ($argv[1] == "del") {
     if ($argv[1] == "del") {
         $redis = new redis();
         $redis = new redis();
         $r_conn = $redis->connect('127.0.0.1', 6379);
         $r_conn = $redis->connect('127.0.0.1', 6379);
-        $keys = 'pali_sent_*';
-        $redis->delete($redis->keys($keys));
+		$keys = $redis->keys('pali_sent_*');
+		$count=0;
+		foreach ($keys as $key => $value) {
+			# code...
+			$deleted = $redis->del($value);
+			$count += $deleted;
+		}
+		
+		echo "delete ok ".$count;
     }
     }
 } else {
 } else {
     $dns = "" . _FILE_DB_PALI_SENTENCE_;
     $dns = "" . _FILE_DB_PALI_SENTENCE_;
     $dbh = new PDO($dns, "", "", array(PDO::ATTR_PERSISTENT => true));
     $dbh = new PDO($dns, "", "", array(PDO::ATTR_PERSISTENT => true));
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+	$dns = "" . _FILE_DB_PALI_SENTENCE_SIM_;
+	$db_pali_sent_sim = new PDO($dns, "", "", array(PDO::ATTR_PERSISTENT => true));
+	$db_pali_sent_sim->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
 
-    $query = "SELECT book,paragraph, begin,end ,text FROM pali_sent WHERE 1 ";
+    $query = "SELECT id, book,paragraph, begin,end ,text FROM pali_sent WHERE 1 ";
     $stmt = $dbh->prepare($query);
     $stmt = $dbh->prepare($query);
     $stmt->execute();
     $stmt->execute();
     $redis = new redis();
     $redis = new redis();
     $r_conn = $redis->connect('127.0.0.1', 6379);
     $r_conn = $redis->connect('127.0.0.1', 6379);
-    $stringSize = 0;
+	$stringSize = 0;
+	$count = 0;
     if ($r_conn) {
     if ($r_conn) {
         while ($sent = $stmt->fetch(PDO::FETCH_ASSOC)) {
         while ($sent = $stmt->fetch(PDO::FETCH_ASSOC)) {
+			$count++;
             $stringSize += strlen($sent["text"]);
             $stringSize += strlen($sent["text"]);
             if ($stringSize > 50000000) {
             if ($stringSize > 50000000) {
                 sleep(1);
                 sleep(1);
-                $stringSize = 0;
-                echo $sent["book"] . "_" . $sent["paragraph"] . "\n";
-            }
-            $result = $redis->set('pali_sent_' . $sent["book"] . "_" . $sent["paragraph"] . "_" . $sent["begin"] . "_" . $sent["end"], $sent["text"]);
+                $stringSize = 0;  
+			}
+			if($count%10000==0){
+				echo $count . "-".$sent["book"] . "_" . $sent["paragraph"] . "\n";
+			}
+			$result = $redis->hSet('pali://sent/' . $sent["book"] . "_" . $sent["paragraph"] . "_" . $sent["begin"] . "_" . $sent["end"], "pali", $sent["text"]);
+			if($result===FALSE){
+				echo "hSet error \n";
+			}
+			$result = $redis->hSet('pali://sent/' . $sent["book"] . "_" . $sent["paragraph"] . "_" . $sent["begin"] . "_" . $sent["end"], "id", $sent["id"]);	
+
+			$query = "SELECT count FROM 'sent_sim_index' WHERE sent_id = ? ";
+			$sth = $db_pali_sent_sim->prepare($query);
+			$sth->execute(array($sent["id"]));
+			$row = $sth->fetch(PDO::FETCH_ASSOC);
+			if ($row) {
+				$pali_sim = $row["count"];
+			} else {
+				$pali_sim = 0;
+			}
+			$result = $redis->hSet('pali://sent/' . $sent["book"] . "_" . $sent["paragraph"] . "_" . $sent["begin"] . "_" . $sent["end"], "sim_count", $pali_sim);			
         }
         }
-        echo "完成";
+        echo "完成 ". count($redis->keys("pali://sent/*"));
     } else {
     } else {
         echo "连接redis失败";
         echo "连接redis失败";
     }
     }

+ 1 - 1
app/studio/js/relation.js

@@ -122,7 +122,7 @@ function rela_render_context(wordid,index,strRela,grammar){
 	output += "<div class=\"case_dropdown rela_menu\" style='display: inline-block'>";
 	output += "<div class=\"case_dropdown rela_menu\" style='display: inline-block'>";
 	output += "<p class=\"case_dropbtn\">";
 	output += "<p class=\"case_dropbtn\">";
 	if(strRela==""){
 	if(strRela==""){
-		output += "<span class='relation_blank'>Relation</span>";
+		output += "<span class='relation_blank'>"+gLocal.gui.relation+"</span>";
 	}
 	}
 	else{
 	else{
 		output += "<span class='relation_text'>"+strRela+"</span>";
 		output += "<span class='relation_text'>"+strRela+"</span>";

+ 1 - 1
app/studio/js/render.js

@@ -1705,7 +1705,7 @@ function render_tran_sent_block(book, para, begin, end, channal = 0, readonly =
 		output += "<span>";
 		output += "<span>";
 
 
 		if (thischannal) {
 		if (thischannal) {
-			output += thischannal.name + "-" + thischannal.lang + "@";
+			output += thischannal.name + "-<b>" + thischannal.lang + "</b>@";
 			if (thischannal.username == getCookie("username")) {
 			if (thischannal.username == getCookie("username")) {
 				output += gLocal.gui.your;
 				output += gLocal.gui.your;
 			} else {
 			} else {

+ 15 - 15
app/term/note.php

@@ -103,11 +103,12 @@ foreach ($_data as $key => $value) {
         $begin = 0;
         $begin = 0;
         $end = 0;
         $end = 0;
     }
     }
-
+	$pali_sim = 0;
     if ($redis != false) {
     if ($redis != false) {
-        $result = $redis->get('pali_sent_' . $bookId . "_" . $para . "_" . $begin . "_" . $end);
+        $result = $redis->hGet('pali://sent/' . $bookId . "_" . $para . "_" . $begin . "_" . $end,"pali");
 		$palitext = $result;
 		$palitext = $result;
-		$pali_text_id = 0;
+		$pali_text_id = $redis->hGet('pali://sent/' . $bookId . "_" . $para . "_" . $begin . "_" . $end,"id");
+		$pali_sim = $redis->hGet('pali://sent/' . $bookId . "_" . $para . "_" . $begin . "_" . $end,"sim_count");
     } else {
     } else {
         $query = "SELECT id,html FROM 'pali_sent' WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? ";
         $query = "SELECT id,html FROM 'pali_sent' WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? ";
         $sth = $db_pali_sent->prepare($query);
         $sth = $db_pali_sent->prepare($query);
@@ -119,22 +120,21 @@ foreach ($_data as $key => $value) {
         } else {
         } else {
             $palitext = "";
             $palitext = "";
             $pali_text_id = 0;
             $pali_text_id = 0;
-        }
-    }
+		}
+		//查询相似句
 
 
-    $pali_sim = 0;
 
 
-    $query = "SELECT count FROM 'sent_sim_index' WHERE sent_id = ? ";
-    $sth = $db_pali_sent_sim->prepare($query);
-    $sth->execute(array($pali_text_id));
-    $row = $sth->fetch(PDO::FETCH_ASSOC);
-    if ($row) {
-        $pali_sim = $row["count"]; //explode(",",$row["sim_sents"]) ;
-    } else {
-        $pali_sim = 0;
+			$query = "SELECT count FROM 'sent_sim_index' WHERE sent_id = ? ";
+			$sth = $db_pali_sent_sim->prepare($query);
+			$sth->execute(array($pali_text_id));
+			$row = $sth->fetch(PDO::FETCH_ASSOC);
+			if ($row) {
+				$pali_sim = $row["count"]; //explode(",",$row["sim_sents"]) ;
+			}		
     }
     }
 
 
-    //查询相似句
+
+    
 
 
     //find out translation 查询译文
     //find out translation 查询译文
 
 

+ 1 - 1
documents/users_guide/en/markdown_guide.md

@@ -9,7 +9,7 @@
 |`*italic*`|*italic*|
 |`*italic*`|*italic*|
 |`***bold Italic***`|***bold Italic***|
 |`***bold Italic***`|***bold Italic***|
 |`~~strikethrough~~`|~~strikethrough~~|
 |`~~strikethrough~~`|~~strikethrough~~|
-|`[link to wikipali](www.wikipali.org)`|[link to wikipali](www.wikipali.org)|
+|`[link to wikipali](www.wikipali.org "commentary&#10;note")`|[link to wikipali](www.wikipali.org "commentary&#10;note")|
 ---
 ---
 ## paragraph style
 ## paragraph style
 
 

+ 1 - 1
documents/users_guide/zh-cn/markdown_guide.md

@@ -8,7 +8,7 @@
 |`*斜体*`|*斜体*|
 |`*斜体*`|*斜体*|
 |`***粗斜体***`|***粗斜体***|
 |`***粗斜体***`|***粗斜体***|
 |`~~校对删除~~`|~~校对删除~~|
 |`~~校对删除~~`|~~校对删除~~|
-|`[链接标题](www.wikipali.org)`|[链接标题](www.wikipali.org)|
+|`[链接标题](www.wikipali.org "注&#10;释")`|[链接标题](www.wikipali.org "注&#10;释")|
 
 
 ## 段落样式
 ## 段落样式
 
 

+ 1 - 1
documents/users_guide/zh-tw/markdown_guide.md

@@ -7,7 +7,7 @@
 |`*斜體*`|*斜體*|
 |`*斜體*`|*斜體*|
 |`***粗斜體***`|***粗斜體***|
 |`***粗斜體***`|***粗斜體***|
 |`~~校對刪除~~`|~~校對刪除~~|
 |`~~校對刪除~~`|~~校對刪除~~|
-|`[連結標題](www.wikipali.org)`|[連結標題](www.wikipali.org)|
+|`[連結標題](www.wikipali.org "註&#10;釋")`|[連結標題](www.wikipali.org "註&#10;釋")|
 |\`内容`||
 |\`内容`||
 
 
 ## 段落樣式
 ## 段落樣式