Browse Source

术语查询 优先级 排序

visuddhinanda 5 years ago
parent
commit
551393a921

+ 2 - 1
app/article/article.js

@@ -4,6 +4,7 @@ var _lang = "";
 var _author = "";
 var _display = "";
 
+function article_onload() {}
 function articel_load(id) {
   if (id == "") {
     return;
@@ -48,7 +49,7 @@ function articel_load_collect(article_id) {
       if (status == "success") {
         try {
           let result = JSON.parse(data);
-          if (result) {
+          if (result && result.length > 0) {
             $("#collect_title").html(result[0].title);
             let html = "";
             html += "<ul>";

+ 64 - 55
app/article/index.php

@@ -8,9 +8,11 @@ require_once "../pcdl/html_head.php";
 	<script src="../term/note.js"></script>
 	<script src="../channal/channal.js"></script>
 	<script src="./article.js"></script>
-	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
+
 	<link type="text/css" rel="stylesheet" href="../term/term.css"/>
-	<link type="text/css" rel="stylesheet" href="../public/js/jquery-ui-1.12.1/jquery-ui.css"/>
+	<script src="../widget/click_dropdown.js"></script>
+	<link type="text/css" rel="stylesheet" href="../widget/click_dropdown.css"/>
+
 	<script>
 	<?php
 	$_id = "";
@@ -52,34 +54,7 @@ require_once "../pcdl/html_head.php";
 		font-size: 120%;
 		font-weight: 700;		
 	}
-	.term_word_head_pali {
-		text-transform: capitalize;
-		font-size: 200%;
-		margin: 0.5em 0;
-	}
-	.term_word_head{
-		border-bottom: 1px solid #cecece;
-		padding: 5px 0;
-	}
-	.term_block{
-		border-bottom: 1px solid #cecece;
-		padding: 5px 0;
-	}
-	.term_word_head_authors a{
-		color: blue;
-		margin: 0 3px;
-	}
-	.term_word_head_authors a:hover{
-		text-decoration: underline;
-		cursor: pointer;
-	}
 
-	note .ref{
-		text-align: right;
-		padding: 5px;
-		font-size: 75%;
-		margin-top: 8px;
-	}
 	note{
 		padding: 0.5em 0.8em;
 		margin-bottom: 0.4em;
@@ -95,24 +70,7 @@ require_once "../pcdl/html_head.php";
 		}
 		?>
 	}
-	note>.tran{
-		color: #5c5c5c;
-		padding-left: 1em;
-	}
-	note>.palitext , .palitext{
-		font-family: Noto serif;
-		line-height: 1.5em;
-		color: #9f3a01;
-		font-weight: 500;
-	}
-	note>.palitext>note{
-		display:inline;
-		color:blue;
-		background-color: unset;
-		padding: unset;
-		margin-bottom: unset;
-		border-radius: unset;
-	}
+
 
 
 	.term_block_bar {
@@ -166,7 +124,7 @@ require_once "../pcdl/html_head.php";
 		margin-right: 10px;
 		margin-bottom: 10px;
 	}
-	.fun_frame>.title{
+	.fun_frame .title{
 		padding:6px;
 		font-weight: 700;
 	}
@@ -275,6 +233,11 @@ require_once "../pcdl/html_head.php";
 	.ui-dialog{
 		box-shadow:  8px 8px 20px var(--border-shadow);
 	}
+	.active{
+		background-color: var(--btn-hover-bg-color);
+	}
+
+
 	</style>
 
 <style media="screen and (max-width:767px)">
@@ -314,12 +277,38 @@ term_word_link_fun("wiki_goto_word");
 		<?php
 		echo "<button class='icon_btn'><a href='../article/my_article_edit.php?id=".$_GET["id"];
 		echo "'>Open in Studio</a></button>";
-		echo "<button class='icon_btn'><a href='../article/?id=".$_GET["id"];
-		echo "&display=para";
-		echo "'>{$_local->gui->each_paragraph}</a></button>";
-		echo "<button class='icon_btn'><a href='../article/?id=".$_GET["id"];
-		echo "&display=sent";
-		echo "'>{$_local->gui->each_sentence}</a></button>";
+		
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+			echo "<button class='icon_btn active'>";
+			echo $_local->gui->each_paragraph;
+			echo "</button>";
+		}
+		else{
+			echo "<button class='icon_btn'>";
+			echo "<a href='../article/?id=".$_GET["id"];
+			if(isset($_GET["channal"])){
+				echo "&channal=".$_GET["channal"];
+			}
+			echo "&display=para'>";		
+			echo $_local->gui->each_paragraph;
+			echo "</a>";
+			echo "</button>";
+		}
+
+		if(isset($_GET["display"]) && $_GET["display"]=="sent"){
+			echo "<button class='icon_btn active'>";
+			echo $_local->gui->each_sentence;
+			echo "</button>";
+		}
+		else{
+			echo "<button class='icon_btn'><a href='../article/?id=".$_GET["id"];
+			if(isset($_GET["channal"])){
+				echo "&channal=".$_GET["channal"];
+			}
+			echo "&display=sent";
+			echo "'>{$_local->gui->each_sentence}</a></button>";
+		}
+
 		?>
 			<button class='icon_btn'><a href="#"><?php echo $_local->gui->help; ?></a></button>
 		</span>
@@ -353,7 +342,21 @@ term_word_link_fun("wiki_goto_word");
 			</div>
 		</div>
 		<div class="fun_frame">
-			<div class="title"><?php echo $_local->gui->channels; ?></div>
+			<div style="display:flex;justify-content: space-between;">
+				<div class="title"><?php echo $_local->gui->channels; ?></div>
+				<div class="click_dropdown_div">
+					<div class="click_dropdown_button">more</div>
+					<div class="click_dropdown_content">
+						<div class="click_dropdown_content_inner" id="channal_select">
+						列表
+						</div>
+						<div>
+						<button class="icon_btn click_dropdown_ok">Ok</button>
+						<button class="icon_btn click_dropdown_cancel">Cancel</button>
+						</div>
+					</div>	
+				</div>
+			</div>
 			<div id="channal_list" class="content" style="max-height:20em;">
 			</div>
 		</div>
@@ -367,9 +370,15 @@ term_word_link_fun("wiki_goto_word");
 </div>
 
 <script>
+	$(document).ready(function(){
 	note_create();
 	articel_load(_articel_id);
 	articel_load_collect(_articel_id);
+	click_dropdown_init();
+	ntf_init();
+	});
+
+
 
 	 window.addEventListener('scroll',winScroll);
 	function winScroll(e){ 

+ 6 - 0
app/pcdl/html_head.php

@@ -40,6 +40,12 @@ else{
 
 	<script src="../public/js/marked.js"></script>
 	<script src="../public/js/mermaid.min.js"></script>
+
+	<script src="../public/js/notify.js"></script>
+    <link type="text/css" rel="stylesheet" href="../public/css/notify.css"/>
+
+	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
+	<link type="text/css" rel="stylesheet" href="../public/js/jquery-ui-1.12.1/jquery-ui.css"/>	
 	
 	<script >
 	<?php require_once '../public/load_lang_js.php';?>

+ 3 - 1
app/studio/index_head.php

@@ -25,7 +25,9 @@ require_once '../public/load_lang.php';
 	<script src="../public/js/notify.js"></script>
 
 	<script src="../public/js/comm.js"></script>
-
+	
+	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
+	<link type="text/css" rel="stylesheet" href="../public/js/jquery-ui-1.12.1/jquery-ui.css"/>	
 
 	<script type="text/javascript">
 	<?php require_once '../public/load_lang_js.php';//加载js语言包?>

+ 1 - 1
app/term/channal_list.php

@@ -45,7 +45,7 @@ foreach ($_data as $key => $value) {
 		$Fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
 		foreach ($Fetch as $key => $value) {
             # code...
-            if(isset($value["channal"])){
+            if(isset($channal[$value["channal"]])){
                 $channal[$value["channal"]] ++;
 			}
 			else{

+ 22 - 18
app/term/my_dict_list.php

@@ -1,8 +1,10 @@
 <?php
 require_once '../studio/index_head.php';
 ?>
-<body id="file_list_body" onLoad="course_list()">
-
+<body id="file_list_body" onLoad="my_term_onload()">
+    <script src="../term/my_term.js"></script>
+    <script src="../term/term_edit_dlg.js"></script>
+	<link type="text/css" rel="stylesheet" href="../term/term_edit_dlg.css"/>	
 	<script >
 	var gCurrPage="term";
 	</script>
@@ -31,18 +33,16 @@ require_once '../studio/index_head.php';
 
 		<div class="tool_bar">
 	<div>
-	术语百科
+	Term
 	</div>
 
 	<div>
 		<span class="icon_btn_div">
 			<span class="icon_btn_tip"><?php echo $_local->gui->add;?></span>
-			<button id="file_add" type="button" class="icon_btn" title=" ">
-				<a href="../course/my_channal_new.php">
+			<button id="file_add" type="button" class="icon_btn" title=" " onclick="term_edit_dlg_open()">
 				<svg class="icon">
 					<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>
 				</svg>
-				</a>
 			</button>
 		</span>
 		
@@ -78,9 +78,9 @@ $iOnePage=300;
 $dictFileName=_FILE_DB_TERM_;
 PDO_Connect("sqlite:$dictFileName");
 
-$query = "select count(*) as co  from term where owner= ".$PDO->quote($USER_NAME);
+$query = "select count(*) as co  from term where owner= ? ";
 
-$allWord = PDO_FetchOne($query);
+$allWord = PDO_FetchOne($query,array($_COOKIE["userid"]));
 $iCountWords=$allWord;
 
 if($iCountWords==0){
@@ -94,8 +94,8 @@ else{
     }
     $begin=$iCurrPage*$iOnePage;
 
-    $query = "select *  from term where owner= ".$PDO->quote($USER_NAME);
-    $allWords = PDO_FetchAll($query);
+    $query = "select *  from term where owner= ? ";
+    $allWords = PDO_FetchAll($query,array($_COOKIE["userid"]));
 
     echo '<div id="setting_user_dict_nav">';
 
@@ -125,12 +125,14 @@ else{
     <div>
         <div style="display:flex;">
             <div style='max-width:2em;flex:1;'></div>
-            <div style='flex:1;'>序号</div>
-            <div style='flex:2;'>拼写</div>
-            <div style='flex:2;'>意思</div>
-            <div style='flex:2;'>第二个意思</div>
-            <div style='flex:5;'>注解</div>
-            <div style='flex:1;'>语言</div>
+            <div style='flex:1;'>Sn</div>
+            <div style='flex:2;'>Spell</div>
+            <div style='flex:2;'>Meaning</div>
+            <div style='flex:2;'>Meaning2</div>
+            <div style='flex:4;'>Note</div>
+            <div style='flex:1;'>Language</div>
+            <div style='flex:1;'>Channal</div>
+            <div style='flex:1;'></div>
         </div>
     <?php
     
@@ -141,8 +143,10 @@ else{
         echo "<div style='flex:2;'>{$word["word"]}</div>";
         echo "<div style='flex:2;'>{$word["meaning"]}</div>";
         echo "<div style='flex:2;'>{$word["other_meaning"]}</div>";
-        echo "<div style='flex:5;'><textarea style='width:100%;'>{$word["note"]}</textarea></div>";
-        echo "<div style='flex:1;'></div>";
+        echo "<div style='flex:4;'><textarea style='width:100%;'>{$word["note"]}</textarea></div>";
+        echo "<div style='flex:1;'>{$word["language"]}</div>";
+        echo "<div style='flex:1;'>{$word["channal"]}</div>";
+        echo "<div style='flex:1;'><button onclick=\"term_edit_dlg_open('{$word["guid"]}')\">edit</button></div>";
         echo "</div>";
     }
 

+ 3 - 0
app/term/my_term.js

@@ -0,0 +1,3 @@
+function my_term_onload() {
+  term_edit_dlg_init();
+}

+ 57 - 8
app/term/note.js

@@ -134,6 +134,24 @@ function note_refresh_new() {
                   .parent()
                   .children(".palitext");
                 if (divPali.length == 0) {
+                  if (_channal != "") {
+                    let arrChannal = _channal.split(",");
+                    for (
+                      let index = arrChannal.length - 1;
+                      index >= 0;
+                      index--
+                    ) {
+                      const iChannal = arrChannal[index];
+                      $("#" + id)
+                        .parent()
+                        .prepend(
+                          "<div class='tran_div'  channal='" +
+                            iChannal +
+                            "'></div>"
+                        );
+                    }
+                  }
+
                   $("#" + id)
                     .parent()
                     .prepend("<div class='palitext'></div>");
@@ -145,12 +163,29 @@ function note_refresh_new() {
                   .append(strPalitext);
                 let htmlTran = "";
                 for (const oneTran of iterator.translation) {
-                  htmlTran +=
-                    "<span class='tran'>" +
-                    marked(term_std_str_to_tran(oneTran.text)) +
+                  let html =
+                    "<span class='tran' lang='" +
+                    oneTran.lang +
+                    "' channal='" +
+                    oneTran.channal +
+                    "'>" +
+                    marked(
+                      term_std_str_to_tran(
+                        oneTran.text,
+                        oneTran.channal,
+                        oneTran.editor,
+                        oneTran.lang
+                      )
+                    ) +
                     "</span>";
+                  if (_channal == "") {
+                    htmlTran += html;
+                  } else {
+                    $("#" + id)
+                      .siblings(".tran_div[channal='" + oneTran.channal + "']")
+                      .append(html);
+                  }
                 }
-
                 $("#" + id).html(htmlTran);
               } else {
                 //句子模式
@@ -328,6 +363,7 @@ function render_channal_list(channalinfo) {
   return output;
 }
 
+//点击引用 需要响应的事件
 function note_ref_init() {
   $("chapter").click(function () {
     let bookid = $(this).attr("book");
@@ -357,7 +393,7 @@ function note_json_html(in_json) {
   let output = "";
   output += "<div class='palitext'>" + in_json.palitext + "</div>";
   for (const iterator of in_json.translation) {
-    output += "<div class='tran'>";
+    output += "<div class='tran' lang='" + iterator.lang + "'>";
     output +=
       "<span class='edit_button' onclick=\"note_edit_sentence('" +
       in_json.book +
@@ -385,9 +421,22 @@ function note_json_html(in_json) {
       "'>";
     if (iterator.text == "") {
       //let channal = find_channal(iterator.channal);
-      output += "<span style='color:var(--border-line-color);'>新建译文</span>";
+      output += "<span style='color:var(--border-line-color);'></span>";
+      output +=
+        "<span style='color:var(--border-line-color);'>" +
+        iterator.channalinfo.name +
+        "-" +
+        iterator.channalinfo.lang +
+        "</span>";
     } else {
-      output += marked(term_std_str_to_tran(iterator.text));
+      output += marked(
+        term_std_str_to_tran(
+          iterator.text,
+          iterator.channal,
+          iterator.editor,
+          iterator.lang
+        )
+      );
     }
     output += "</div>";
 
@@ -485,7 +534,7 @@ function note_sent_save() {
       if (result.status > 0) {
         alert("error" + result.message);
       } else {
-        alert("成功");
+        ntf_show("success");
         $(
           "#tran_text_" +
             result.book +

+ 25 - 7
app/term/note.php

@@ -1,8 +1,11 @@
 <?php
 require_once "../public/_pdo.php";
 require_once "../public/function.php";
+require_once "../channal/function.php";
 require_once "../path.php";
 
+$_channal = new Channal();
+
 $_data = array();
 if(isset($_POST["data"])){
 	$_data = json_decode($_POST["data"],true);
@@ -77,9 +80,10 @@ foreach ($_data as $key => $value) {
 		$palitext="";
 	}
 
-	//find out translation
+	//find out translation 查询译文
 	$tran="";
 	$translation = array();
+	$tran_channal = array();
 	try{
 		if(empty($_setting["channal"])){
 			if($sentChannal==""){
@@ -102,7 +106,10 @@ foreach ($_data as $key => $value) {
 				$Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
 				if($Fetch){
 					$tran = $Fetch["text"];
-					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"channal"=>$Fetch["channal"]);
+					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"lang"=>$Fetch["language"],"channal"=>$Fetch["channal"],"editor"=>$Fetch["editor"]);
+					if(!empty($Fetch["channal"])){
+						$tran_channal[$Fetch["channal"]] = $Fetch["channal"];
+					}
 				}
 			}
 			else{
@@ -110,7 +117,8 @@ foreach ($_data as $key => $value) {
 				$Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
 				if($Fetch){
 					$tran = $Fetch["text"];
-					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"channal"=>$Fetch["channal"]);
+					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"lang"=>$Fetch["language"],"channal"=>$Fetch["channal"],"editor"=>$Fetch["editor"]);
+					$tran_channal[$Fetch["channal"]] = $Fetch["channal"];
 				}
 			}
 		}
@@ -121,21 +129,31 @@ foreach ($_data as $key => $value) {
 				$stmt->execute(array($bookId,$para,$begin,$end,$value));
 				$Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
 				if($Fetch){
-					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"channal"=>$value);
+					$translation[]=array("id"=>$Fetch["id"],"text"=>$Fetch["text"],"lang"=>$Fetch["language"],"channal"=>$value,"editor"=>$Fetch["editor"]);
+					
 				}
 				else{
-					$translation[]=array("id"=>"","text"=>"","channal"=>$value);
+					$translation[]=array("id"=>"","text"=>"","lang"=>"","channal"=>$value);
 				}
+				$tran_channal[$value] = $value;
 			}
 		}
-		
-
 		$tran_count = 1;
 	}
 	catch (Exception $e) {
 		$tran = $e->getMessage();
 		//echo 'Caught exception: ',  $e->getMessage(), "\n";
 	}
+
+	foreach ($tran_channal as $key => $value) {
+		# code...
+		$tran_channal[$key] = $_channal->getChannal($key);
+	}
+	foreach ($translation as $key => $value) {
+		# code...
+		$translation[$key]["channalinfo"]=$tran_channal[$value["channal"]];
+	}
+
 	
 	$para_path=_get_para_path($bookId,$para);
 

+ 50 - 0
app/term/term.css

@@ -63,3 +63,53 @@ commentary {
   border-left: 3px solid gray;
   padding-left: 5px;
 }
+
+note > .tran {
+  color: #5c5c5c;
+  padding-left: 1em;
+  padding: 3px;
+}
+note > .palitext,
+.palitext {
+  font-family: Noto serif;
+  line-height: 1.5em;
+  color: #9f3a01;
+  font-weight: 500;
+}
+note > .palitext > note {
+  display: inline;
+  color: blue;
+  background-color: unset;
+  padding: unset;
+  margin-bottom: unset;
+  border-radius: unset;
+}
+
+.term_word_head_pali {
+  text-transform: capitalize;
+  font-size: 200%;
+  margin: 0.5em 0;
+}
+.term_word_head {
+  border-bottom: 1px solid #cecece;
+  padding: 5px 0;
+}
+.term_block {
+  border-bottom: 1px solid #cecece;
+  padding: 5px 0;
+}
+.term_word_head_authors a {
+  color: blue;
+  margin: 0 3px;
+}
+.term_word_head_authors a:hover {
+  text-decoration: underline;
+  cursor: pointer;
+}
+
+note .ref {
+  text-align: right;
+  padding: 5px;
+  font-size: 75%;
+  margin-top: 8px;
+}

+ 114 - 59
app/term/term.js

@@ -5,8 +5,10 @@ var arrAllMean = new Array();
 var arrTermAllPali = new Array();
 var arrWordIdTermId = new Array();
 
+//术语渲染模板
 var strTermTanslationTmp = "[%mean%](%pali% %mean2% %mymean%)";
 var strTermTanslationTmp2 = "[%mean%]";
+
 var termCounter = new Array();
 var noteCounter = 0; //正文内注释计数器
 
@@ -23,16 +25,25 @@ function note_replace(strIn) {
   return output;
 }
 
-function term_init() { }
+function term_init() {}
 var str_term_fun_word_link = "term_show_win";
 function term_word_link_fun(fun_name) {
   str_term_fun_word_link = fun_name;
 }
 //将存储状态的字符串转换为预显示字符串
 //设置状态为 0:未处理的原始状态
-function term_std_str_to_tran(strIn) {
+function term_std_str_to_tran(strIn, channal = "", editor = "", lang = "") {
   return strIn
-    .replace(/\[\[/g, "<term status='0'>")
+    .replace(
+      /\[\[/g,
+      "<term status='0' channal='" +
+        channal +
+        "' editor='" +
+        editor +
+        "' lang='" +
+        lang +
+        "'>"
+    )
     .replace(/\]\]/g, "</term>");
 }
 
@@ -93,9 +104,9 @@ function term_get_std_str(strMean) {
   return "unkow@" + strMean;
 }
 function term_get_my_std_str(strMean) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].meaning == strMean) {
-      return arrMyTerm[x].guid + "@" + strMean;
+  for (const iterator of arrMyTerm) {
+    if (iterator.meaning == strMean) {
+      return iterator.guid + "@" + strMean;
     }
   }
   return "unkow@" + strMean;
@@ -104,9 +115,9 @@ function term_get_my_std_str(strMean) {
 function note_lookup(word, showto) {
   $("#" + showto).load(
     "../term/term.php?op=search&word=" +
-    word +
-    "&username=" +
-    getCookie("username"),
+      word +
+      "&username=" +
+      getCookie("username"),
     function (responseTxt, statusTxt, xhr) {
       if (statusTxt == "success") {
         $(".term_note").each(function (index, element) {
@@ -191,12 +202,12 @@ function term_load_preview(guid, showto) {
 var term_get_word_to_div_callback = null;
 function term_get_word_to_div(strWord, div, callback) {
   term_get_word_to_div_callback = callback;
-  $.get(
-    "../term/term.php",
+  let word = [{ pali: strWord, channal: "", editor: "", lang: "" }];
+
+  $.post(
+    "../term/term_get.php",
     {
-      op: "get",
-      word: strWord,
-      format: "json",
+      words: JSON.stringify(word),
     },
     function (data, status) {
       if (status == "success") {
@@ -214,7 +225,7 @@ function term_get_word_to_div(strWord, div, callback) {
                 type[iterator.tag] = new Array();
               }
               type[iterator.tag].push(iterator.meaning);
-              authors[iterator.owner] = 1;
+              authors[iterator.owner] = iterator.user;
             }
 
             html += "<div class='term_word_head'>";
@@ -231,9 +242,16 @@ function term_get_word_to_div(strWord, div, callback) {
               }
               html += "</div>";
             }
-            html += "<div class='term_word_head_authors'>" + gLocal.gui.contributor + ":";
+            html +=
+              "<div class='term_word_head_authors'>" +
+              gLocal.gui.contributor +
+              ":";
             for (y in authors) {
-              html += '<a onclick="">' + y + "</a> ";
+              if (authors[y].nickname != "") {
+                html += '<a onclick="">' + authors[y].nickname + "</a> ";
+              } else {
+                html += '<a onclick="">' + y + "</a> ";
+              }
             }
 
             html += "</div>";
@@ -266,9 +284,17 @@ function term_get_word_to_div(strWord, div, callback) {
 
               html += "<div class='term_block_bar_right'>";
               html +=
-                "<span><button class='icon_btn'><a href='#'>" + gLocal.gui.edit + "</a></button>";
-              html += "<button class='icon_btn'><a href='#'>" + gLocal.gui.like + "</a></button>";
-              html += "<button class='icon_btn'><a href='#'>" + gLocal.gui.favorite + "</a></button></span>";
+                "<span><button class='icon_btn'><a href='#'>" +
+                gLocal.gui.edit +
+                "</a></button>";
+              html +=
+                "<button class='icon_btn'><a href='#'>" +
+                gLocal.gui.like +
+                "</a></button>";
+              html +=
+                "<button class='icon_btn'><a href='#'>" +
+                gLocal.gui.favorite +
+                "</a></button></span>";
               html += "</div>";
 
               html += "</div>";
@@ -284,17 +310,17 @@ function term_get_word_to_div(strWord, div, callback) {
             html += "<div id='term_list_right' >";
 
             html += '<div class="fun_frame">';
-            html += '<div class="title">' + gLocal.gui.language + '</div>';
+            html += '<div class="title">' + gLocal.gui.language + "</div>";
             html += '<div class="content" style="max-height:10em;">';
-            html += '<div><a href="">' + gLocal.gui.all + '</a></div>';
+            html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
             html += "</div>";
             html += "</div>";
 
             html += '<div class="fun_frame">';
-            html += '<div class="title">' + gLocal.gui.translation + '</div>';
+            html += '<div class="title">' + gLocal.gui.translation + "</div>";
             html +=
               '<div id="channal_list"  class="content" style="max-height:10em;">';
-            html += '<div><a href="">' + gLocal.gui.all + '</a></div>';
+            html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
             html += "</div>";
             html += "</div>";
 
@@ -335,7 +361,7 @@ function term_get_word_to_div(strWord, div, callback) {
     }
   );
 }
-function term_get_guid_to_html(strGuid) { }
+function term_get_guid_to_html(strGuid) {}
 function term_apply(guid) {
   if (g_eCurrWord) {
     setNodeText(g_eCurrWord, "note", "=term(" + guid + ")");
@@ -456,17 +482,24 @@ function term_get_my() {
 }
 
 //在我的术语字典里查询
-function term_lookup_my(pali) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].meaning == pali) {
-      return arrMyTerm[x];
+function term_lookup_my(pali, channal = "", owner = "", lang = "") {
+  for (const iterator of arrMyTerm) {
+    if (channal != "") {
+      if (channal == iterator.channal && iterator.word == pali) {
+        return iterator;
+      }
     }
-    if (arrMyTerm[x].word == pali) {
-      return arrMyTerm[x];
+  }
+  for (const iterator of arrMyTerm) {
+    if (owner != "") {
+      if (owner == iterator.owner && iterator.language == lang) {
+        return iterator;
+      }
     }
   }
-  return null;
+  return false;
 }
+
 function term_lookup_my_id(id) {
   for (var x in arrMyTerm) {
     if (arrMyTerm[x].guid == id) {
@@ -558,7 +591,12 @@ function term_updata_translation() {
       noteCounter++;
     } else {
       if (status == 0 || status == 2) {
-        let myterm = term_lookup_my(termText); //我的术语字典
+        let myterm = term_lookup_my(
+          termText,
+          $(this).attr("channal"),
+          $(this).attr("editor"),
+          $(this).attr("lang")
+        ); //我的术语字典
         if (myterm) {
           $(this).attr("status", "1");
           $(this).attr("type", "0");
@@ -576,15 +614,20 @@ function term_updata_translation() {
       let pali = $(this).attr("pali");
       let mean = $(this).attr("mean");
       let mean2 = $(this).attr("mean2");
-      var renderTo = $(this).attr("pos");
-      var noteText = "";
+      let renderTo = $(this).attr("pos");
+      let noteText = "";
 
       if (termCounter[guid]) {
         termCounter[guid] = 2;
       } else {
         termCounter[guid] = 1;
       }
-      var myterm = term_lookup_my(pali); //我的术语字典
+      myterm = term_lookup_my(
+        pali,
+        $(this).attr("channal"),
+        $(this).attr("editor"),
+        $(this).attr("lang")
+      ); //我的术语字典
       let linkclass = "";
       if (myterm) {
         linkclass = "term_link";
@@ -605,18 +648,18 @@ function term_updata_translation() {
         noteText = noteText.replace(
           "[",
           "<span class='" +
-          linkclass +
-          "' id='term_link_" +
-          guid +
-          "' gid='" +
-          guid +
-          "' onclick=\"" +
-          str_term_fun_word_link +
-          "('" +
-          guid +
-          "','" +
-          pali +
-          "')\">"
+            linkclass +
+            "' id='term_link_" +
+            guid +
+            "' gid='" +
+            guid +
+            "' onclick=\"" +
+            str_term_fun_word_link +
+            "('" +
+            guid +
+            "','" +
+            pali +
+            "')\">"
         );
         noteText = noteText.replace("]", "</span>");
         noteText = noteText.replace(
@@ -669,8 +712,8 @@ function term_show_win(guid, keyWord = "") {
   if (guid == "") {
     $(term_body).html(
       "当前词条未创建。<br /><a onclick=\"term_add_new('" +
-      keyWord +
-      "')\">现在创建</a>"
+        keyWord +
+        "')\">现在创建</a>"
     );
   } else {
     let currWord = term_lookup_my_id(guid);
@@ -787,6 +830,7 @@ function term_show_new() {
 
 function term_get_dict() {
   let termwordlist = new Array();
+  /*
   let objTerm = document.querySelectorAll("term");
   for (const iterator of objTerm) {
     if (iterator.getAttributeNode("status").value == 0) {
@@ -795,13 +839,24 @@ function term_get_dict() {
       termwordlist.push(iterator.getAttributeNode("pali").value);
     }
   }
-
-  let wordquery = "('" + termwordlist.join("','") + "')";
+*/
+  $("term").each(function () {
+    if ($(this).attr("status") == 0) {
+      $(this).attr("pali", $(this).text());
+    }
+    let termword = new Object();
+    termword.pali = $(this).attr("pali");
+    termword.channal = $(this).attr("channal");
+    termword.editor = $(this).attr("editor");
+    termword.lang = $(this).attr("lang");
+    termwordlist.push(termword);
+  });
+  //let wordquery = "('" + termwordlist.join("','") + "')";
   $.post(
-    "../term/term.php",
+    "../term/term_get.php",
     {
-      op: "extract",
-      words: wordquery,
+      words: JSON.stringify(termwordlist),
+      channal: _channal,
     },
     function (data, status) {
       if (data.length > 0) {
@@ -827,16 +882,16 @@ function term_popup_init() {
         //出现在左侧
         $(this).append(
           '<div id="gid_' +
-          gid +
-          '" class="guide_contence" style="left: -5px;"></div>'
+            gid +
+            '" class="guide_contence" style="left: -5px;"></div>'
         );
         $(".guide_contence:after").css("left", "0");
       } else {
         //出现在右侧
         $(this).append(
           '<div id="gid_' +
-          gid +
-          '" class="guide_contence" style="right: -5px;"></div>'
+            gid +
+            '" class="guide_contence" style="right: -5px;"></div>'
         );
         $(".guide_contence:after").css("right", "0");
       }

+ 63 - 0
app/term/term_get.php

@@ -0,0 +1,63 @@
+<?php
+/*
+查询term字典
+输入单词列表
+输出查到的结果
+*/
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../ucenter/function.php';
+
+PDO_Connect("sqlite:"._FILE_DB_TERM_);
+
+$output = array();
+if(isset($_POST["words"])){
+    $wordlist = json_decode($_POST["words"]);
+
+    foreach ($wordlist as $key => $value) {
+        # code...
+        $pali = $value->pali;
+        $parm = array();
+        $parm[] = $pali;       
+
+        $otherCase = "";
+        if($value->channal != ""){
+            $otherCase .= " channal = ? ";
+            $parm[] = $value->channal;
+        }
+
+        if($value->editor != ""){
+            if($otherCase != ""){
+                $otherCase .= " OR ";
+            }
+            $otherCase .= " owner = ? ";
+            $parm[] = $value->editor;
+        }
+
+        if($value->lang != ""){
+            if($otherCase != ""){
+                $otherCase .= " OR ";
+            }
+            $otherCase .= " language = ? ";
+            $parm[] = $value->lang;
+        }
+
+        if($otherCase==""){
+            $query = "SELECT * FROM term WHERE word = ? ";
+        }
+        else{
+            $query = "SELECT * FROM term WHERE word = ? AND ( $otherCase )";
+        }
+
+        $fetch = PDO_FetchAll($query,$parm);
+        $userinfo = new UserInfo();
+        foreach ($fetch as $key => $value) {
+            # code...
+            $fetch[$key]["user"]=$userinfo->getName($value["owner"]);
+            $output[] =  $fetch[$key];
+        }
+    }
+}
+echo json_encode($output, JSON_UNESCAPED_UNICODE);
+?>

+ 3 - 0
app/term/term_post.php

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

+ 0 - 0
app/term/term_put.php


+ 16 - 0
app/widget/click_dropdown.css

@@ -0,0 +1,16 @@
+.click_dropdown_div {
+  position: relative;
+}
+.click_dropdown_content {
+  display: none;
+  position: absolute;
+  right: 0;
+  width: 19em;
+  border-radius: 4px;
+  background-color: var(--drop-bg-color);
+}
+
+.click_dropdown_content_inner {
+  max-height: 300px;
+  min-height: 10em;
+}

+ 9 - 0
app/widget/click_dropdown.js

@@ -0,0 +1,9 @@
+function click_dropdown_init() {
+  $(".click_dropdown_button").click(function () {
+    $(this).siblings(".click_dropdown_content").first().show();
+  });
+
+  $(".click_dropdown_cancel").click(function () {
+    $(this).parent().parent().hide();
+  });
+}