Просмотр исходного кода

Merge pull request #786 from visuddhinanda/nissaya-channel

义註channel在下面显示
visuddhinanda 4 лет назад
Родитель
Сommit
c080fa63bc

+ 3 - 3
public/app/article/function.php

@@ -119,9 +119,9 @@ class Article extends Table
 			}
 		}
 		#查询共享权限,如果共享权限更大,覆盖上面的的
-		$sharePower = share_get_res_power($_COOKIE["user_uid"],$id);
+		$sharePower = share_get_res_power($userId,$id);
 		if($collectionId!=""){
-			$sharePowerCollection = share_get_res_power($_COOKIE["user_uid"],$collectionId);
+			$sharePowerCollection = share_get_res_power($userId,$collectionId);
 		}
 		else{
 			$sharePowerCollection =0;
@@ -133,7 +133,7 @@ class Article extends Table
 			$iPower=$sharePowerCollection;
 		}
 		if($this->redis!==false){
-			$this->redis->hSet("power://article/".$id,$_COOKIE["user_uid"],$iPower);
+			$this->redis->hSet("power://article/".$id,$userId,$iPower);
 		}
 		return $iPower;
 	}

+ 12 - 0
public/app/article/style.css

@@ -317,4 +317,16 @@ img {
 #contents_nav{
 	display: flex;
     justify-content: space-between;
+}
+td, th {
+    border: unset;
+    vertical-align: baseline;
+    padding:6px;
+}
+table {
+  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
+  border-collapse: collapse;
+}
+tr {
+  border-bottom: 1px solid gray;
 }

+ 6 - 6
public/app/public/lang/my.json

@@ -32,7 +32,7 @@
 		"buddhist_calendar": "Buddhist Calendar",
 		"budha": "ဗုဓ",
 		"by": "By",
-		"cancel": "Cancel",
+		"cancel": "ဖျက်သိမ်းသည်",
 		"canda": "စန္ဒ",
 		"caption": "Caption",
 		"CE": "CE",
@@ -270,7 +270,7 @@
 		"sandhi_end": "Sandhi End",
 		"sandhi_orginal_word": "Sandhi Orginal Word",
 		"sandhi_splited_word": "Sandhi Splited Word",
-		"save": "Save",
+		"save": "သိမ်းထားသည",
 		"script": "Script",
 		"search": "Search",
 		"season": "Season ",
@@ -324,7 +324,7 @@
 		"up_and_down": "ပေါ် And အောက်",
 		"update_all_wbw_to_database": "Update All WBW to Database",
 		"user": "User",
-		"to_user_dictionary": "Save & Add to My Vocabulary List",
+		"to_user_dictionary": "သိမ်းထားသည & Add to My Vocabulary List",
 		"user_id": "User ID",
 		"userdict": "Vocabulary List",
 		"vannana": "vaṇṇanā",
@@ -387,7 +387,7 @@
 		"add_to_folder": "add to folder",
 		"rename": "rename",
 		"collaborate": "collaborate",
-		"help": "help",
+		"help": "အကူအညီ",
 		"function_introduce": "functions of Wikipāḷi",
 		"vedio_link": "vedio link",
 		"project_introduce": "conference of pāḷi-translating platform",
@@ -463,7 +463,7 @@
 		"comment": "comments",
 		"my_term": "my term",
 		"scan_in_reader": "scan in reader",
-		"selected": "selected",
+		"selected": "မှတ်ပါ",
 		"to_be_selected": "to be selected",
 		"text_without_title": "text without title",
 		"end_of_text": "No Prev",
@@ -626,7 +626,7 @@
 		"years_ago": " years ago",
 		"similar": "similar",
 		"suggest": "suggest",
-		"next_line": "new line",
+		"next_line": "နောက်တစ်ကြောင်း",
 		"link": "link",
 		"co_channel": "collaborative channels",
 		"permission": "permission",

+ 63 - 25
public/app/term/note.js

@@ -713,7 +713,9 @@ function note_json_html(in_json) {
 	//译文开始
 	output += "<div class='sent_tran_div'>";
 	for (const iterator of in_json.translation) {
-		output += render_one_sent_tran_a(iterator);
+        if(iterator.channalinfo.type != "commentary"){
+            output += render_one_sent_tran_a(iterator);
+        }
 	}
 	output += "</div>";
 	//译文结束
@@ -992,12 +994,18 @@ function render_one_sent_tran_a(iterator, diff = false) {
 			tranText = str_diff(orgText, iterator.text);
 		} else {
 			//note_init处理句子链接
-			tranText = note_init(term_std_str_to_tran(showText, iterator.channal, iterator.editor, iterator.lang));
+            if(iterator.type=='nissaya' || iterator.channalinfo.type=='nissaya'){
+                tranText = renderNissayaPreview(iterator.text);
+            }else{
+                tranText = iterator.text;
+            }
+			tranText = note_init(term_std_str_to_tran(tranText, iterator.channal, iterator.editor, iterator.lang));
+            if(iterator.type=='nissaya' || iterator.channalinfo.type=='nissaya'){
+                tranText = "<div class='nissaya'>"+tranText+"</div>";
+            }
 		}
 	}
-    if(iterator.type=='nissaya' || iterator.channalinfo.type=='nissaya'){
-        tranText = renderNissayaPreview(iterator.text);
-    }
+
 	let html = "";
 	html += "<div class='sent_tran ";
 	if (typeof iterator.is_pr != "undefined" && iterator.is_pr == true) {
@@ -1246,15 +1254,17 @@ function render_one_sent_tran_a(iterator, diff = false) {
 	return html;
 }
 function renderNissayaPreview(str){
-    let html ="<div class='nissaya'>";
+    let html ='';
+    //html +="<div class='nissaya'>";
     const sent = str.split("\n");
     for (const iterator of sent) {
         const word =  iterator.split("=");
-        if(word.length>1){
+        if(iterator.indexOf('=')>=0){
+            html += "<span class='nsy_word'>"
             html += "<span class='org'>";
             switch (getCookie('language')) {
                 case 'my':
-                    html += '<b>' + word[0] + '</b>';
+                    html +=  $.trim(word[0]) + "၊";
                     break;
                 default:
                     html += my_to_roman(word[0]);
@@ -1262,11 +1272,12 @@ function renderNissayaPreview(str){
             }
             html += "</span>";
             html += "<span class='meaning'>"+ word[1]+"</span>";
+            html += "</span>";
         }else{
             html += iterator;
         }
     }
-    html += "</div>";
+    //html += "</div>";
     return html;
 }
 function tran_sent_textarea_event_init() {
@@ -1616,19 +1627,35 @@ function set_more_button_display() {
 		const begin = sentid[2];
 		const end = sentid[3];
 		let count = 0;
+        let commentaryChannel=0;
+        if(channelType=='commentary'){
+            for (const iterator of _channal.split(',')) {
+                let thisChannel = find_channal(iterator);
+                if(thisChannel && thisChannel.type=='commentary'){
+                    commentaryChannel++;
+                }
+            }            
+        }
+
+        
 		for (const iterator of _channalData) {
 			if (iterator.final && iterator.type==channelType) {
 				for (const onesent of iterator.final) {
 					let id = onesent.id.split("-");
 					if (book == id[0] && para == id[1] && begin == id[2] && end == id[3] && onesent.final) {
-						if (_channal.indexOf(iterator.id) == -1) {
-							count++;
-						}
+                        if(channelType=='commentary'){
+                            count++;
+                        }else{
+                            if (_channal.indexOf(iterator.id) == -1) {
+                                count++;
+                            }
+                        }
 					}
 				}
 			}
 		}
-		if (count > 0) {
+		if (count > 0 || commentaryChannel>0) 
+        {
 			$(this).find(".other_tran_num").html(count);
 			$(this).find(".other_tran_num").attr("style", "display:inline-flex;");
 			$(this)
@@ -1642,8 +1669,7 @@ function set_more_button_display() {
 					let sentId = $(this).attr("sent");
                     let otherSentDiv = $(this).parent().parent().siblings(".other_tran").first();
 					if (otherSentDiv.css("display") == "none") {
-                        otherSentDiv.html("");
-						otherSentDiv.slideDown();
+						otherSentDiv.show();
                         //加号复位
 						//$(this).siblings(".more_tran ").css("transform", "unset");
 						$.get(
@@ -1658,20 +1684,31 @@ function set_more_button_display() {
 							function (data, status) {
 								let arrSent = JSON.parse(data);
 								let html = "<div class='compact "+channelType+"'>";
+                                if(channelType==='commentary'){
+                                    //先渲染被选择的channel
+                                    if (_channal != "") {
+                                        //for(const channel of _channal.split(","))
+                                        {
+                                            for (const sent of _arrData) {
+                                                if (sent.book == book && sent.para==para && sent.begin==begin && sent.end==end) {
+                                                    for (const tran of sent.translation) {
+                                                        if(tran.channalinfo.type=='commentary'){
+                                                            html += render_one_sent_tran_a(tran);
+                                                        }
+                                                    }
+                                                    break;
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                                //然后渲染没有被选择的
 								for (const iterator of arrSent) {
 									if (_channal.indexOf(iterator.channal) == -1) {
 										html += render_one_sent_tran_a(iterator);
 									}
 								}
 								html += "</div>";
-								let sentId =
-									arrSent[0].book +
-									"-" +
-									arrSent[0].paragraph +
-									"-" +
-									arrSent[0].begin +
-									"-" +
-									arrSent[0].end;
 								otherSentDiv.html(html);
                                 if(channelType==='commentary'){
                                     note_refresh_new(function(){
@@ -1685,11 +1722,12 @@ function set_more_button_display() {
 							}
 						);
 					} else {
-						otherSentDiv.slideUp();
+						otherSentDiv.hide();
 						$(this).siblings(".more_tran ").css("transform", "rotate(-90deg)");
 					}
 				});
-		} else {
+		}else 
+        {
 			//隐藏自己
 			//$(this).hide();
 			$(this).addClass("disable");

+ 5 - 2
public/app/term/term.css

@@ -1109,11 +1109,14 @@ pali>p {
 .preview .nissaya{
     display:inline;
 }
-.preview .nissaya .org{
+.preview .nissaya .nsy_word{
+    padding-right:10px;
+}
+.preview .nissaya .nsy_word .org{
     display:inline;
     font-weight: 700;
 }
-.preview .nissaya .meaning{
+.preview .nissaya .nsy_word .meaning{
     display:inline;
     font-weight: 500;
 }

+ 28 - 0
public/documents/tables.md

@@ -0,0 +1,28 @@
+# Tables
+
+业务表
+
+|name|description|
+|-|-|
+|wbws|逐词解析|
+|wbw_blocks|逐词解析段落索引|
+|channels|版本|
+|sentences|用户上传的句子|
+|sent_blocks|句子段落索引|
+|sent_prs|句子修改建议|
+|sent_histories|句子历史记录|
+|user_dicts|用户字典|
+|user_operation_dailies|用户操作记录(每日)|
+|user_operation_frames|用户操作记录(连续时间片段)|
+|user_operation_logs|用户操作记录(所有学习行为)|
+|articles|文章|
+|collections|文集|
+|article_collections|文章文集多对多|
+|dhamma_terms|术语|
+|shares|资源分享和协作|
+|group_infos|工作组|
+|group_members|工作组成员|
+|file_indices|逐词解析文件索引|
+|custom_books|用户自定义书名|
+|custom_book_sentences|用户自定义书句子|
+|custom_book_ids|用户自定义书最大序列号|