Ver Fonte

Merge branch 'master' of https://github.com/visuddhinanda/mint

Bhikkhu-Kosalla há 5 anos atrás
pai
commit
ff5fd9fb71

+ 1 - 1
.vscode/launch.json

@@ -8,7 +8,7 @@
       "type": "chrome",
       "request": "launch",
       "name": "Launch Chrome against localhost",
-      "url": "http://localhost:80",
+      "url": "http://localhost:80/mint/app",
       "webRoot": "${workspaceFolder}"
     },
     {

+ 128 - 142
app/article/article.js

@@ -5,162 +5,148 @@ var _author = "";
 var _display = "";
 var _collect_id = "";
 
-function article_onload() {}
+function article_onload() {
+	historay_init();
+}
 function articel_load(id) {
-  if (id == "") {
-    return;
-  }
-  $.get(
-    "../article/get.php",
-    {
-      id: id,
-      setting: "",
-    },
-    function (data, status) {
-      if (status == "success") {
-        try {
-          let result = JSON.parse(data);
-          if (result) {
-            $("#article_title").html(result.title);
-            $("#article_subtitle").html(result.subtitle);
-            $("#article_author").html(
-              result.username.nickname + "@" + result.username.username
-            );
-            $("#contents").html(note_init(result.content));
-            note_refresh_new();
-          }
-        } catch (e) {
-          console.error(e);
-        }
-      } else {
-        console.error("ajex error");
-      }
-    }
-  );
+	if (id == "") {
+		return;
+	}
+	$.get(
+		"../article/get.php",
+		{
+			id: id,
+			setting: "",
+		},
+		function (data, status) {
+			if (status == "success") {
+				try {
+					let result = JSON.parse(data);
+					if (result) {
+						$("#article_title").html(result.title);
+						$("#article_subtitle").html(result.subtitle);
+						$("#article_author").html(result.username.nickname + "@" + result.username.username);
+						$("#contents").html(note_init(result.content));
+						note_refresh_new();
+					}
+				} catch (e) {
+					console.error(e);
+				}
+			} else {
+				console.error("ajex error");
+			}
+		}
+	);
 }
 
 function collect_load(id) {
-  if (id == "") {
-    return;
-  }
-  $.get(
-    "../article/collect_get.php",
-    {
-      id: id,
-      setting: "",
-    },
-    function (data, status) {
-      if (status == "success") {
-        try {
-          let result = JSON.parse(data);
-          if (result) {
-            $("#article_title").html(result.title);
-            if (result.subtitle) {
-              $("#article_subtitle").html(result.subtitle);
-            }
-            $("#article_author").html(
-              result.username.nickname + "@" + result.username.username
-            );
-            $("#contents").html(marked(result.summary));
+	if (id == "") {
+		return;
+	}
+	$.get(
+		"../article/collect_get.php",
+		{
+			id: id,
+			setting: "",
+		},
+		function (data, status) {
+			if (status == "success") {
+				try {
+					let result = JSON.parse(data);
+					if (result) {
+						$("#article_title").html(result.title);
+						if (result.subtitle) {
+							$("#article_subtitle").html(result.subtitle);
+						}
+						$("#article_author").html(result.username.nickname + "@" + result.username.username);
+						$("#contents").html(marked(result.summary));
 
-            let article_list = JSON.parse(result.article_list);
-            render_article_list(article_list);
-          }
-        } catch (e) {
-          console.error(e);
-        }
-      } else {
-        console.error("ajex error");
-      }
-    }
-  );
+						let article_list = JSON.parse(result.article_list);
+						render_article_list(article_list);
+					}
+				} catch (e) {
+					console.error(e);
+				}
+			} else {
+				console.error("ajex error");
+			}
+		}
+	);
 }
 
 function articel_load_collect(article_id) {
-  $.get(
-    "../article/collect_get.php",
-    {
-      article: article_id,
-      setting: "",
-    },
-    function (data, status) {
-      if (status == "success") {
-        try {
-          let result = JSON.parse(data);
-          if (result && result.length > 0) {
-            $("#collect_title").html(result[0].title);
-            let article_list = JSON.parse(result[0].article_list);
-            render_article_list(article_list);
-          }
-        } catch (e) {
-          console.error(e);
-        }
-      } else {
-        console.error("ajex error");
-      }
-    }
-  );
+	$.get(
+		"../article/collect_get.php",
+		{
+			article: article_id,
+			setting: "",
+		},
+		function (data, status) {
+			if (status == "success") {
+				try {
+					let result = JSON.parse(data);
+					if (result && result.length > 0) {
+						$("#collect_title").html(result[0].title);
+						let article_list = JSON.parse(result[0].article_list);
+						render_article_list(article_list);
+					}
+				} catch (e) {
+					console.error(e);
+				}
+			} else {
+				console.error("ajex error");
+			}
+		}
+	);
 }
 
 function render_article_list(article_list) {
-  let html = "";
-  html += "<ul>";
-  let display = "";
-  if (_display == "para") {
-    display = "&display=para";
-  }
-  let prevArticle = "无";
-  let nextArticle = "无";
-  for (let index = 0; index < article_list.length; index++) {
-    const element = article_list[index];
-    if (element.article == _articel_id) {
-      if (index > 0) {
-        const prev = article_list[index - 1];
-        prevArticle =
-          "<a href='../article/index.php?id=" +
-          prev.article +
-          display +
-          "'>" +
-          prev.title +
-          "</a>";
-      }
-      if (index < article_list.length - 1) {
-        const next = article_list[index + 1];
-        nextArticle =
-          "<a href='../article/index.php?id=" +
-          next.article +
-          display +
-          "'>" +
-          next.title +
-          "</a>";
-      }
-      $("#contents_nav_left").html(prevArticle);
-      $("#contents_nav_right").html(nextArticle);
-    }
-    html +=
-      "<li class='level_" +
-      element.level +
-      "'>" +
-      "<a href='../article/index.php?id=" +
-      element.article +
-      display +
-      "'>" +
-      element.title +
-      "</a></li>";
-  }
+	let html = "";
+	html += "<ul>";
+	let display = "";
+	if (_display == "para") {
+		display = "&display=para";
+	}
+	let prevArticle = "无";
+	let nextArticle = "无";
+	for (let index = 0; index < article_list.length; index++) {
+		const element = article_list[index];
+		if (element.article == _articel_id) {
+			if (index > 0) {
+				const prev = article_list[index - 1];
+				prevArticle = "<a href='../article/index.php?id=" + prev.article + display + "'>" + prev.title + "</a>";
+			}
+			if (index < article_list.length - 1) {
+				const next = article_list[index + 1];
+				nextArticle = "<a href='../article/index.php?id=" + next.article + display + "'>" + next.title + "</a>";
+			}
+			$("#contents_nav_left").html(prevArticle);
+			$("#contents_nav_right").html(nextArticle);
+		}
+		html +=
+			"<li class='level_" +
+			element.level +
+			"'>" +
+			"<a href='../article/index.php?id=" +
+			element.article +
+			display +
+			"'>" +
+			element.title +
+			"</a></li>";
+	}
 
-  html += "</ul>";
+	html += "</ul>";
 
-  $("#toc_content").html(html);
+	$("#toc_content").html(html);
 }
 
 function set_channal(channalid) {
-  let url = "../article/index.php?id=" + _articel_id;
-  if (channalid != "") {
-    url += "&channal=" + channalid;
-  }
-  if (_display != "") {
-    url += "&display=" + _display;
-  }
-  location.assign(url);
+	let url = "../article/index.php?id=" + _articel_id;
+	if (channalid != "") {
+		url += "&channal=" + channalid;
+	}
+	if (_display != "") {
+		url += "&display=" + _display;
+	}
+	location.assign(url);
 }

+ 3 - 6
app/article/index.php

@@ -264,7 +264,7 @@ require_once "../pcdl/html_head.php";
 		</div>
 		<div class="fun_frame">
 			<div style="display:flex;justify-content: space-between;">
-				<div class="title"><?php echo $_local->gui->channels; ?></div>
+				<div class="title"><?php echo "Contributor" ?></div>
 				<div class="click_dropdown_div">
 					<div class="click_dropdown_button"><?php echo $_local->gui->more; ?></div>
 					<div class="click_dropdown_content">
@@ -285,17 +285,14 @@ require_once "../pcdl/html_head.php";
 </div>
 </div>
 
-<!-- ui-dialog -->
-<div id="dialog" title="Dialog Title">
-	<div id="edit_dialog_content"></div>
-</div>
+
 
 <script>
 	$(document).ready(function(){
 	ntf_init();				
 	click_dropdown_init();
 	note_create();
-	term_edit_dlg_init();
+	historay_init();
 	if(_collect_id==""){
 		articel_load(_articel_id);
 		articel_load_collect(_articel_id);

+ 1 - 0
app/article/my_article_edit.php

@@ -54,6 +54,7 @@ require_once '../studio/index_head.php';
 }
 #preview_inner{
 	background-color: var(--bg-color);
+	color: var(--main-color);
 }
 	</style>
 

+ 1 - 1
app/doc/load_channal_para.php

@@ -36,7 +36,7 @@ else{
 	echo "        <ver>1</ver>\n";
 	echo "        <toc></toc>\n";
 	echo "        <style></style>\n";
-	echo "        <title>{$book}-{$para}</title>\n";
+	echo "        <title>{$book}-{$paralist[0]}</title>\n";
 	echo "    </head>\n";
 	echo "\n<dict></dict>\n";
 	echo "<message></message>\n";

+ 9 - 4
app/palicanon/palicanon.js

@@ -22,13 +22,18 @@ function palicanon_onload() {
 }
 
 function palicanon_load_term() {
-	$.get(
-		"../term/term.php",
+	$.post(
+		"../term/get_term_index.php",
 		{
-			op: "my",
+			lang: "zh-hans",
 		},
 		function (data) {
-			arrMyTerm = JSON.parse(data);
+			let result = JSON.parse(data);
+			if (result.status == 0) {
+				arrMyTerm = result.data;
+			} else {
+				alert(result.error);
+			}
 		}
 	);
 }

+ 1 - 0
app/path.php

@@ -71,5 +71,6 @@ define("_FILE_DB_CHANNAL_"  , __DIR__."/../tmp/user/channal.db3");
 define("_FILE_DB_USER_DICT_"  , __DIR__."/../tmp/user/udict.db3");
 define("_FILE_DB_USER_ARTICLE_"  , __DIR__."/../tmp/user/article.db3");
 define("_FILE_DB_HOSTSETTING_"  , __DIR__."/../tmp/user/hostsetting.db3");
+define("_FILE_DB_USER_SENTENCE_HISTORAY_"  , __DIR__."/../tmp/user/usent_historay.db3");
 
 ?>

+ 65 - 84
app/pcdl/css/basic_style.css

@@ -1,21 +1,21 @@
 body {
-  font-family: "Noto Sans", "Noto Sans SC", "Noto Sans TC", Arial, Verdana;
-  font-style: normal;
-  color: var(--main-color);
-  font-weight: 400;
-  font-size: 13px;
-  overflow-x: hidden;
-  margin: 0;
+	font-family: "Noto Sans", "Noto Sans SC", "Noto Sans TC", Arial, Verdana;
+	font-style: normal;
+	color: var(--main-color);
+	font-weight: 400;
+	font-size: 13px;
+	overflow-x: hidden;
+	margin: 0;
 }
 div {
-  -webkit-box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  box-sizing: border-box;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
 }
 hr {
-  margin: 14px 0;
-  border: 1px solid var(--tool-line-color);
-  transform: scaleY(0.4);
+	margin: 14px 0;
+	border: 1px solid var(--tool-line-color);
+	transform: scaleY(0.4);
 }
 
 input,
@@ -28,112 +28,93 @@ hr,
 h1,
 h2,
 h3 {
-  font-family: inherit;
-  font-size: inherit;
-  font-style: inherit;
-  font-weight: inherit;
-  color: inherit;
-  background-color: inherit;
-  -webkit-box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  box-sizing: border-box;
+	font-family: inherit;
+	font-size: inherit;
+	font-style: inherit;
+	font-weight: inherit;
+	color: inherit;
+	background-color: inherit;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
 }
 
 input[type="text"],
 input[type="input"],
 textarea {
-  font-weight: 300;
-  width: 100%;
-  border: 1px solid var(--btn-border-line-color);
-  border-radius: 4px;
-  padding: 0.1em 0.3em;
-  font-size: 100%;
-  min-height: 1.2em;
-  margin: 2px 0;
+	font-weight: 300;
+	width: 100%;
+	border: 1px solid var(--btn-border-line-color);
+	border-radius: 4px;
+	padding: 0.1em 0.3em;
+	font-size: 100%;
+	min-height: 1.2em;
+	margin: 2px 0;
 }
 select {
-  font-weight: 400;
-  border: 1px solid #aaaaaa;
-  padding: 2px 4px;
-  min-height: 2em;
-  border-radius: 4px;
-  cursor: pointer;
-  margin: 3px 0;
+	font-weight: 400;
+	border: 1px solid #aaaaaa;
+	padding: 2px 4px;
+	min-height: 2em;
+	border-radius: 4px;
+	cursor: pointer;
+	margin: 3px 0;
 }
 
 ul,
 li {
-  white-space: normal;
-  color: inherit;
-  margin: 0px;
-  padding: 0px;
-  word-break: keep-all;
-  text-overflow: ellipsis;
-  list-style-type: none;
+	white-space: normal;
+	color: inherit;
+	margin: 0px;
+	padding: 0px;
+	word-break: keep-all;
+	text-overflow: ellipsis;
+	list-style-type: none;
 }
 a,
 a:link,
 a:visited {
-  color: var(--link-color);
-  text-decoration: none;
-  cursor: pointer;
+	color: var(--link-color);
+	text-decoration: none;
+	cursor: pointer;
 }
 
 a:focus {
-  outline: 1px dotted;
+	outline: 1px dotted;
 }
 
 a:hover,
 a:active {
-  color: var(--tool-link-hover-color);
-  outline: none;
+	color: var(--tool-link-hover-color);
+	outline: none;
 }
 .footer_navbar {
-  display: flex;
-  flex-wrap: wrap;
-  width: 100%;
+	display: flex;
+	flex-wrap: wrap;
+	width: 100%;
 }
 
 .icon {
-  height: 1.4em;
-  width: 1.4em;
-  fill: #555;
-  transition: all 0.2s ease;
+	height: 1.4em;
+	width: 1.4em;
+	fill: #555;
+	transition: all 0.2s ease;
 }
 
 .small_icon {
-  height: 1em;
-  width: 1em;
-  fill: #555;
-  -webkit-transition-duration: 0.2s;
-  transition-duration: 0.2s;
+	height: 1em;
+	width: 1em;
+	fill: #555;
+	-webkit-transition-duration: 0.2s;
+	transition-duration: 0.2s;
 }
 
 .broder-1 {
-  border: 1px solid var(--border-line-color);
+	border: 1px solid var(--border-line-color);
 }
 .broder-2 {
-  border: 2px solid var(--border-line-color);
+	border: 2px solid var(--border-line-color);
 }
 .broder-r {
-  border-radius: 5px;
-}
-
-.tran:hover .edit_button {
-  display: inline-block;
-}
-.edit_button {
-  position: absolute;
-  display: none;
-  width: auto;
-  min-width: 24px;
-  height: auto;
-  min-height: 24px;
-  cursor: pointer;
-  background: url(edit.svg);
-  background-repeat: no-repeat;
-  background-size: contain;
-  margin: 0 6px;
-  margin-left: -24px;
-  color: var(--tool-color);
+	border-radius: 5px;
 }

+ 2 - 1
app/pcdl/html_head.php

@@ -58,7 +58,8 @@ else{
 		?>
 	<script src="../term/term_edit_dlg.js"></script>
 	<link type="text/css" rel="stylesheet" href="../term/term_edit_dlg.css"/>	
-	
+	<script src="../uwbw/wbw_channal_list.js"></script>
+	<script src="../usent/historay.js"></script>
 	<script >
 	<?php require_once '../public/load_lang_js.php';?>
 	</script>

Diff do ficheiro suprimidas por serem muito extensas
+ 3997 - 3997
app/public/book_tag/en.json


+ 48 - 10
app/public/book_tag/tag_list.json

@@ -6,17 +6,55 @@
   "aṭṭhakathā": { "level": 0 },
   "ṭīkā": { "level": 0 },
   "añña": { "level": 0 },
-  "dīgha": { "level": 1 },
-  "majjhima": { "level": 1 },
-  "saṃyutta": { "level": 1 },
-  "aṅguttara": { "level": 1 },
-  "khuddaka": { "level": 1 },
+  "dīghanikāya": { "level": 1 },
+  "majjhimanikāya": { "level": 1 },
+  "saṃyuttanikāya": { "level": 1 },
+  "aṅguttaranikāya": { "level": 1 },
+  "khuddakanikāya": { "level": 1 },
   "mahāvibhaṅga": { "level": 1 },
-  "Bhikkhunīvibhaṅga": { "level": 1 },
-  "mahāvaggapāḷi": { "level": 1 },
-  "Cūḷavaggapāḷi": { "level": 1 },
+  "bhikkhunīvibhaṅga": { "level": 1 },
+  "mahāvagga": { "level": 1 },
+  "cūḷavagga": { "level": 1 },
+  "parivāra": { "level": 1 },
   "vibhaṅga": { "level": 1 },
+  "dhammasaṅgaṇī": { "level": 1 },
+  "dhātukathā": { "level": 1 },
+  "puggalapaññatti": { "level": 1 },
+  "kathāvatthu": { "level": 1 },
+  "yamaka": { "level": 1 },
+  "paṭṭhāna": { "level": 1 },
+  "visuddhimagga": { "level": 2 },
+  "samantapāsādikā": { "level": 2 },
+  "vajirabuddhi": { "level": 2 },
+  "vimativinodanī": { "level": 2 },
+  "pācityādiyojanā": { "level": 2 },
+  "kaṅkhāvitaraṇī": { "level": 2 },
+  "bhikkhupātimokkha": { "level": 2 },
+  "khuddasikkhā": { "level": 2 },
+  "mūlasikkhā": { "level": 2 },
+  "sāratthadīpanī": { "level": 2 },
+  "vinayavinicchaya": { "level": 2 },
+  "uttaravinicchaya": { "level": 2 },
+  "vinayālaṅkāra": { "level": 2 },
+  "vinayasaṅgaha": { "level": 2 },
+  "khuddakapāṭha": { "level": 2 },
+  "dhammapada": { "level": 2 },
+  "udāna": { "level": 2 },
+  "itivuttaka": { "level": 2 },
+  "suttanipāta": { "level": 2 },
+  "vimānavatthu": { "level": 2 },
+  "petavatthu": { "level": 2 },
   "theragāthā": { "level": 2 },
-  "Visuddhimagga": { "level": 2 },
-  "mātikā": { "level": 2 }
+  "therīgāthā": { "level": 2 },
+  "therāpadāna": { "level": 2 },
+  "therīpadāna": { "level": 2 },
+  "buddhavaṃsa": { "level": 2 },
+  "cariyāpiṭa": { "level": 2 },
+  "jātaka": { "level": 2 },
+  "mahāniddesa": { "level": 2 },
+  "cūḷaniddesa": { "level": 2 },
+  "paṭisambhidāmagga": { "level": 2 },
+  "nettippakaraṇa": { "level": 2 },
+  "milindapañha": { "level": 2 },
+  "peṭakopadesa": { "level": 2 }
 }

+ 0 - 5
app/reader/index.php

@@ -363,17 +363,12 @@ require_once "../pcdl/html_head.php";
 </div>
 </div>
 
-<!-- ui-dialog -->
-<div id="dialog" title="Dialog Title">
-	<div id="edit_dialog_content"></div>
-</div>
 
 <script>
 	$(document).ready(function(){
 	ntf_init();				
 	click_dropdown_init();
 	note_create();
-	term_edit_dlg_init();
 	reader_load();
 	});
 

+ 4 - 0
app/reader/reader.js

@@ -243,3 +243,7 @@ function set_channal(channalid) {
 	}
 	location.assign(url);
 }
+
+function edit_wbw(book, para) {
+	wbw_channal_list_open(book, [para]);
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 409 - 414
app/studio/css/style.css


+ 1 - 1
app/studio/editor.php

@@ -148,7 +148,7 @@ else{$currDevice="computer";}
 		font-size: 75%;
 	}
 	.trans_text_info .tools{
-		visibility: hidden;
+		/*visibility: hidden;*/
 	}
 	.trans_text_block:hover .trans_text_info .tools{
 		visibility: visible;

Diff do ficheiro suprimidas por serem muito extensas
+ 401 - 206
app/studio/js/editor.js


+ 7 - 0
app/term/edit.svg

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 24 24" style="fill: #6baaff;" xml:space="preserve">
+		<path
+			d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" />
+</svg>

+ 36 - 0
app/term/get_term_index.php

@@ -0,0 +1,36 @@
+<?php
+/*
+查询term字典
+输入单词列表
+输出查到的结果
+*/
+require_once "../path.php";
+require_once "../public/_pdo.php";
+
+$output["status"]=0;
+$output["error"]="";
+
+PDO_Connect("sqlite:"._FILE_DB_TERM_);
+
+if(isset($_POST["lang"])){
+    $lang = $_POST["lang"];
+}
+else{
+    $output["status"]=1;
+    $output["error"]="#no_param lang";
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
+if(isset($_POST["word"])){
+    $word = $_POST["word"];
+    $query ="select word,meaning,language,owner,count(*) as co from term where word=? and language=? group by word,meaning order by co DESC";
+    $output["data"] = PDO_FetchAll($query,array($word,$lang));
+}
+else{
+    $query ="select * from (select word,meaning,language,owner,count(*) as co from term where language=? group by word,meaning order by co DESC) where 1 group by word";
+    $output["data"] = PDO_FetchAll($query,array($lang));
+}
+
+echo json_encode($output, JSON_UNESCAPED_UNICODE);
+?>

+ 131 - 53
app/term/note.js

@@ -4,9 +4,11 @@ var _channal = "";
 var _lang = "";
 var _author = "";
 
-var _arrData;
+var _arrData = new Array();
 var _channalData;
 
+var MAX_NOTE_NEST = 2;
+
 /*
 {{203-1654-23-45@11@en@*}}
 <note>203-1654-23-45@11@en@*</note>
@@ -31,7 +33,13 @@ var _channalData;
 
 */
 function note_create() {
-	$("#dialog").dialog({
+	wbw_channal_list_init();
+	note_sent_edit_dlg_init();
+	term_edit_dlg_init();
+}
+function note_sent_edit_dlg_init() {
+	$("body").append('<div id="note_sent_edit_dlg" title="Edit"><div id="edit_dialog_content"></div></div>');
+	$("#note_sent_edit_dlg").dialog({
 		autoOpen: false,
 		width: 550,
 		buttons: [
@@ -51,12 +59,12 @@ function note_create() {
 		],
 	});
 }
-
 function note_init(input) {
-	let output = "<div>";
 	let newString = input.replace(/\{\{/g, '<note info="');
 	newString = newString.replace(/\}\}/g, '"></note>');
-	output = marked(newString);
+
+	let output = "<div>";
+	output += marked(newString);
 	output += "</div>";
 	return output;
 }
@@ -85,6 +93,20 @@ function note_refresh_new() {
 	for (const iterator of objNotes) {
 		let id = iterator.id;
 		if (id == null || id == "") {
+			//查看这个节点是第几层note嵌套。大于预定层数退出。
+			let layout = 1;
+			let parent = iterator.parentNode;
+			while (parent.nodeType == 1) {
+				if (parent.nodeName == "NOTE") {
+					layout++;
+					if (layout > MAX_NOTE_NEST) {
+						return false;
+					}
+				} else if (parent.nodeName == "BODY") {
+					break;
+				}
+				parent = parent.parentNode;
+			}
 			id = com_guid();
 			iterator.id = id;
 			let info = iterator.getAttributeNode("info").value;
@@ -113,8 +135,8 @@ function note_refresh_new() {
 			function (data, status) {
 				if (status == "success") {
 					try {
-						_arrData = JSON.parse(data);
-						for (const iterator of _arrData) {
+						let sentData = JSON.parse(data);
+						for (const iterator of sentData) {
 							let id = iterator.id;
 							let strHtml = "<a name='" + id + "'></a>";
 							if (_display && _display == "para") {
@@ -186,6 +208,10 @@ function note_refresh_new() {
 								$("#" + id).html(strHtml);
 							}
 						}
+						//刷新句子链接递归,有加层数限制。
+						note_refresh_new();
+
+						_arrData = _arrData.concat(sentData);
 						note_ref_init();
 						term_get_dict();
 						note_channal_list();
@@ -377,7 +403,8 @@ ref
 function note_json_html(in_json) {
 	let output = "";
 	output += '<div class="note_tool_bar" style=" position: relative;">';
-	output += '<div class="case_dropdown" style="position: absolute; right: 0;width:1.5em;">';
+	output +=
+		'<div class="case_dropdown note_tool_context" style="position: absolute; right: 0;width:1.5em;text-align: right;">';
 	output += "<svg class='icon' >";
 	output += "<use xlink:href='../studio/svg/icon.svg#ic_more'></use>";
 	output += "</svg>";
@@ -398,26 +425,27 @@ function note_json_html(in_json) {
 		gLocal.gui.copy_link +
 		"</a>";
 	output += "<a onclick='copy_text(this)'>" + gLocal.gui.copy + "“" + gLocal.gui.pāli + "”</a>";
+	output +=
+		"<a onclick=\"edit_in_studio('" +
+		in_json.book +
+		"','" +
+		in_json.para +
+		"','" +
+		in_json.begin +
+		"','" +
+		in_json.end +
+		"')\">" +
+		gLocal.gui.edit_now +
+		"</a>";
 	output += "<a onclick='add_to_list()'>" + gLocal.gui.add_to_edit_list + "</a>";
 	output += "</div>";
 	output += "</div>";
 	output += " </div>";
+
 	output += "<div class='palitext'>" + in_json.palitext + "</div>";
+
 	for (const iterator of in_json.translation) {
-		output += "<div class='tran' lang='" + iterator.lang + "'";
-		output +=
-			" onclick=\"note_edit_sentence('" +
-			in_json.book +
-			"' ,'" +
-			in_json.para +
-			"' ,'" +
-			in_json.begin +
-			"' ,'" +
-			in_json.end +
-			"' ,'" +
-			iterator.channal +
-			"')\">";
-		output += "<span class='edit_button'></span>";
+		output += "<div class='tran' lang='" + iterator.lang + "'>";
 
 		output +=
 			"<div class='text' id='tran_text_" +
@@ -432,8 +460,6 @@ function note_json_html(in_json) {
 			iterator.channal +
 			"'>";
 		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);'>" +
 				iterator.channalinfo.name +
@@ -441,10 +467,38 @@ function note_json_html(in_json) {
 				iterator.channalinfo.lang +
 				"</span>";
 		} else {
-			output += marked(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
+			//note_init处理句子链接 marked不处理
+			//output += marked(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
+			output += note_init(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
 		}
 		output += "</div>";
-
+		//句子工具栏
+		output += "<div class='tran_text_tool_bar'>";
+		output += "<span class = 'tip_buttom' ";
+		output +=
+			" onclick=\"note_edit_sentence('" +
+			in_json.book +
+			"' ,'" +
+			in_json.para +
+			"' ,'" +
+			in_json.begin +
+			"' ,'" +
+			in_json.end +
+			"' ,'" +
+			iterator.channal +
+			"')\"";
+		output += ">Edit</span>";
+		output += "<span class = 'tip_buttom'>Like</span>";
+		output += "<span class = 'tip_buttom'>Comment</span>";
+		output += "<span class = 'tip_buttom'>Share</span>";
+		output += "<span class = 'tip_buttom'>Copy</span>";
+		output += "<span class = 'tip_buttom'>Digest</span>";
+		output += "<span class = 'tip_buttom' ";
+		output += " onclick=\"history_show('" + iterator.id + "')\"";
+		output += ">History</span>";
+		output += "<span class = 'tip_buttom'>Expand</span>";
+		output += "</div>";
+		//句子工具栏结束
 		output += "</div>";
 	}
 
@@ -494,13 +548,13 @@ function note_edit_sentence(book, para, begin, end, channal) {
 						tran.text +
 						"</textarea>";
 					$("#edit_dialog_content").html(html);
-					break;
+					$("#note_sent_edit_dlg").dialog("open");
+					return;
 				}
 			}
 		}
 	}
-
-	$("#dialog").dialog("open");
+	alert("未找到句子");
 }
 
 function note_sent_save() {
@@ -530,30 +584,50 @@ function note_sent_save() {
 				alert("error" + result.message);
 			} else {
 				ntf_show("success");
-				$(
-					"#tran_text_" +
-						result.book +
-						"_" +
-						result.para +
-						"_" +
-						result.begin +
-						"_" +
-						result.end +
-						"_" +
-						result.channal
-				).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
-				term_updata_translation();
-				for (const iterator of _arrData) {
-					if (
-						iterator.book == result.book &&
-						iterator.para == result.para &&
-						iterator.begin == result.begin &&
-						iterator.end == result.end
-					) {
-						for (const tran of iterator.translation) {
-							if (tran.channal == result.channal) {
-								tran.text = result.text;
-								break;
+				if (result.text == "") {
+					let channel_info = "Empty";
+					let thisChannel = find_channal(result.channal);
+					if (thisChannel) {
+						channel_info = thisChannel.name + "-" + thisChannel.nickname;
+					}
+					$(
+						"#tran_text_" +
+							result.book +
+							"_" +
+							result.para +
+							"_" +
+							result.begin +
+							"_" +
+							result.end +
+							"_" +
+							result.channal
+					).html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
+				} else {
+					$(
+						"#tran_text_" +
+							result.book +
+							"_" +
+							result.para +
+							"_" +
+							result.begin +
+							"_" +
+							result.end +
+							"_" +
+							result.channal
+					).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
+					term_updata_translation();
+					for (const iterator of _arrData) {
+						if (
+							iterator.book == result.book &&
+							iterator.para == result.para &&
+							iterator.begin == result.begin &&
+							iterator.end == result.end
+						) {
+							for (const tran of iterator.translation) {
+								if (tran.channal == result.channal) {
+									tran.text = result.text;
+									break;
+								}
 							}
 						}
 					}
@@ -567,3 +641,7 @@ function copy_ref(book, para, begin, end) {
 	let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
 	copy_to_clipboard(strRef);
 }
+
+function edit_in_studio(book, para, begin, end) {
+	wbw_channal_list_open(book, [para]);
+}

+ 85 - 4
app/term/term.css

@@ -60,7 +60,9 @@ para:hover {
 	text-decoration: underline;
 }
 
-commentary {
+commentary,
+com,
+nt {
 	margin-left: 1.5em;
 	display: block;
 	border-left: 3px solid gray;
@@ -70,14 +72,78 @@ commentary {
 note > .tran {
 	color: #5c5c5c;
 	padding-left: 1em;
-	padding: 3px;
+	padding: 0;
+	position: relative;
+	margin-top: -0.5em;
+}
+note > .tran > .text {
+	margin-bottom: 2em;
+}
+note > .tran > .tran_text_tool_bar {
+	padding: 0;
+	position: absolute;
+	display: none;
+	color: var(--border-line-color);
+	margin-left: 0;
+	z-index: 40;
+	width: auto;
+	font-size: 14px;
+	height: 28px;
+	line-height: 28px;
+	margin-top: -2em;
+	background-color: var(--box-bg-color1);
+	border-radius: 5px;
+}
+note > .tran:lang(my) > .tran_text_tool_bar {
+	margin-top: -2.5em;
+}
+note > .tran > .tran_text_tool_bar::after {
+	content: " ";
+	position: absolute;
+	left: 0;
+	bottom: 100%;
+	margin-left: 20px;
+	border-width: 5px;
+	border-style: solid;
+	border-color: transparent transparent var(--box-bg-color1) transparent;
+}
+
+.tran:hover > .tran_text_tool_bar {
+	display: block;
+}
+.tip_buttom {
+	border-right: 2px solid var(--border-line-color);
+	padding: 5px 8px;
+	cursor: pointer;
 }
+.tip_buttom:hover {
+	background-color: var(--btn-border-color);
+}
+.tran:hover .edit_button {
+	display: inline-block;
+}
+.edit_button {
+	display: inline-block;
+	width: auto;
+	min-width: 24px;
+	height: auto;
+	min-height: 24px;
+	cursor: pointer;
+	fill: var(--tool-color);
+	background: url(edit.svg);
+	background-repeat: no-repeat;
+	background-size: contain;
+	color: var(--tool-color);
+	margin-top: -2em;
+}
+
 note > .palitext,
 .palitext {
 	font-family: Noto serif;
 	line-height: 1.5em;
 	color: #9f3a01;
 	font-weight: 500;
+	margin-bottom: 10px;
 }
 note > .palitext > note {
 	display: inline;
@@ -114,7 +180,7 @@ note .ref {
 	text-align: right;
 	padding: 5px;
 	font-size: 75%;
-	margin-top: 8px;
+	margin-top: -2em;
 }
 
 .tran {
@@ -230,7 +296,7 @@ r {
 }
 
 note {
-	padding: 0.5em 0.8em;
+	padding: 0.5em 1em;
 	margin-bottom: 0.4em;
 	border-radius: 5px;
 	line-height: 1.3em;
@@ -265,6 +331,7 @@ pre {
 .note_tool_bar {
 	position: relative;
 	display: none;
+	z-index: 50;
 }
 
 note:hover .note_tool_bar {
@@ -289,3 +356,17 @@ note:hover .note_tool_bar {
 .tran p {
 	margin: 0;
 }
+
+.note_tool_context {
+	position: absolute;
+	right: 0;
+	width: 1.5em;
+	text-align: right;
+}
+
+.note_tool_context .icon {
+	fill: var(--link-color);
+}
+.note_tool_context:hover .icon {
+	fill: (--link-hover-color);
+}

+ 15 - 4
app/ucenter/function.php

@@ -40,28 +40,39 @@ function ucenter_getA($userid,$fields="nickname"){
 
 class UserInfo
 {
-    public $dbh;
+    private $dbh;
+    private $buffer;
     public function __construct() {
         $dns = "sqlite:"._FILE_DB_USERINFO_;
         $this->dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
         $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
+        $buffer = array();
     }
 
     public function getName($id){
+        if(empty($id)){
+            return array("nickname"=>"","username"=>"");
+        }
+        if(isset($buffer[$id])){
+            return $buffer[$id];
+        }
         if($this->dbh){
             $query = "SELECT nickname,username FROM user WHERE userid= ? ";
             $stmt = $this->dbh->prepare($query);
             $stmt->execute(array($id));
             $user = $stmt->fetchAll(PDO::FETCH_ASSOC);
             if(count($user)>0){
-                return array("nickname"=>$user[0]["nickname"],"username"=>$user[0]["username"]);
+                $buffer[$id] = array("nickname"=>$user[0]["nickname"],"username"=>$user[0]["username"]);
+                return $buffer[$id];
             }
             else{
-                return array("nickname"=>"","username"=>"");
+                $buffer[$id] =array("nickname"=>"","username"=>"");
+                return $buffer[$id];
             }            
         }
         else{
-            return array("nickname"=>"","username"=>"");
+            $buffer[$id] =array("nickname"=>"","username"=>"");
+            return $buffer[$id];
         }
     }
 }

+ 74 - 0
app/usent/historay.js

@@ -0,0 +1,74 @@
+function historay_init() {
+	$("body").append('<div id="sent_history_dlg" title="History"><div id="sent_history_content"></div></div>');
+	$("#sent_history_dlg").dialog({
+		autoOpen: false,
+		width: 550,
+		buttons: [
+			{
+				text: "Save",
+				click: function () {
+					$(this).dialog("close");
+				},
+			},
+			{
+				text: "Cancel",
+				click: function () {
+					$(this).dialog("close");
+				},
+			},
+		],
+	});
+}
+
+function history_show(id) {
+	$.get(
+		"../usent/historay_get.php",
+		{
+			id: id,
+		},
+		function (data) {
+			let result = JSON.parse(data);
+			let html = "";
+			if (result.status == 0) {
+				let currDate = new Date();
+
+				for (const iterator of result.data) {
+					let pass = currDate.getTime() - iterator.date;
+					let strPassTime = "";
+					if (pass < 60 * 1000) {
+						//一分钟内
+						strPassTime = Math.floor(pass / 1000) + "秒前";
+					} else if (pass < 3600 * 1000) {
+						//一小时内
+						strPassTime = Math.floor(pass / 1000 / 60) + "分钟前";
+					} else if (pass < 3600 * 24 * 1000) {
+						//一天内
+						strPassTime = Math.floor(pass / 1000 / 3600) + "小时前";
+					} else if (pass < 3600 * 24 * 7 * 1000) {
+						//一周内
+						strPassTime = Math.floor(pass / 1000 / 3600 / 24) + "天前";
+					} else if (pass < 3600 * 24 * 30 * 1000) {
+						//一个月内
+						strPassTime = Math.floor(pass / 1000 / 3600 / 24 / 7) + "周前";
+					} else {
+						//超过一个月
+						strPassTime = Math.floor(pass / 1000 / 3600 / 24 / 30) + "月前";
+					}
+					if (iterator.userinfo.username == getCookie("username")) {
+						html += "<div class=''>You</div>";
+					} else {
+						html += "<div class=''>" + iterator.userinfo.nickname + "</div>";
+					}
+
+					html += "<div class=''>" + strPassTime + "</div>";
+					html += "<div class=''>" + iterator.text + "</div>";
+					html += "<div class=''><button>restore</button></div>";
+				}
+				$("#sent_history_content").html(html);
+				$("#sent_history_dlg").dialog("open");
+			} else {
+				ntf_show(result.error);
+			}
+		}
+	);
+}

+ 25 - 0
app/usent/historay_get.php

@@ -0,0 +1,25 @@
+<?php
+#句子的历史记录
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once "../public/function.php";
+require_once "../ucenter/function.php";
+
+$respond['id']=$_GET["id"];
+$respond['status']=0;
+$respond['error']="";
+$respond['data']=array();
+PDO_Connect("sqlite:"._FILE_DB_USER_SENTENCE_HISTORAY_);
+$query =  "SELECT sent_id,  user_id,  text,  date, landmark FROM  sent_historay  WHERE sent_id = ? LIMIT 0,200";
+$fetch = PDO_FetchAll($query,array($_GET["id"]));
+
+
+$_userinfo = new UserInfo();
+
+foreach ($fetch as $key => $value) {
+    # code...
+    $fetch[$key]["userinfo"]=$_userinfo->getName($value["user_id"]);
+}
+$respond['data'] = $fetch;
+echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+?>

+ 50 - 6
app/usent/sent_post.php

@@ -11,7 +11,13 @@ if(!isset($_COOKIE["userid"])){
     echo json_encode($respond, JSON_UNESCAPED_UNICODE);
     exit;
 }
-
+if(isset($_POST["landmark"])){
+    $_landmark = $_POST["landmark"];
+}
+else{
+    $_landmark = "";
+}
+//回传数据
 $respond=array("status"=>0,"message"=>"");
 $respond['book']=$_POST["book"];
 $respond['para']=$_POST["para"];
@@ -97,7 +103,8 @@ else{
 														) 
 										VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
             $stmt = $PDO->prepare($query);
-            $stmt->execute(array(UUID::v4(),
+            $newId = UUID::v4();
+            $stmt->execute(array($newId,
 										  "",
 										  $_POST["book"], 
 										  $_POST["para"], 
@@ -125,11 +132,19 @@ else{
                 exit;
             }
             else{
-                $respond['data']=array();
+                # 没错误
+                # 更新historay
+                #没错误 更新历史记录
+                $respond['message']=update_historay($newId,$_COOKIE["userid"] ,$_POST["text"],$_landmark);
+                if($respond['message']!==""){
+                    $respond['status']=1;
+                    echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+                    exit;
+                }
             }
         }
         else{
-            #没权限
+            #TO DO没权限 插入建议数据
             $respond['message']="没有权限";
             $respond['status']=1;
         }
@@ -156,12 +171,18 @@ else{
                 exit;
             }
             else{
-                #没错误
+                #没错误 更新历史记录
 
+                $respond['message']=update_historay($_id,$_COOKIE["userid"] ,$_POST["text"],$_landmark);
+                if($respond['message']!==""){
+                    $respond['status']=1;
+                    echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+                    exit;                   
+                }
             }
         }
         else{
-            #没权限 建议
+            #TO DO没权限 插入建议数据
             $respond['message']="没有权限";
             $respond['status']=1;
         }
@@ -169,4 +190,27 @@ else{
 
 
 echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+
+
+function update_historay($sent_id,$user_id,$text,$landmark){
+    # 更新historay
+    PDO_Connect("sqlite:"._FILE_DB_USER_SENTENCE_HISTORAY_);
+    $query =  "INSERT INTO sent_historay (sent_id,  user_id,  text,  date, landmark) VALUES (? , ? , ? , ? , ? )";
+    $stmt  = PDO_Execute($query,
+                                        array($sent_id,
+                                                 $user_id, 
+                                                 $text ,
+                                                mTime(),
+                                                $landmark
+                                            ));
+    if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
+    /*  识别错误  */
+    $error = PDO_ErrorInfo();
+        return $error[2];
+    }
+    else{
+    #没错误
+        return "";
+    }
+}
 ?>

+ 2 - 2
app/usent/update.php

@@ -1,6 +1,6 @@
 <?php
 /*
-get xml doc from db
+向句子库中插入或更新数据
 */
 require_once "../path.php";
 require_once "../public/_pdo.php";
@@ -36,7 +36,7 @@ foreach ($aData as $data) {
 		$oldList[] = $data;
 	}
 }
-$update_list = array(); //已经成功修改数据库的数据列表 回传客户端
+$update_list = array(); //已经成功修改数据库的数据 回传客户端
 
 /* 修改现有数据 */
 $PDO->beginTransaction();

+ 271 - 0
app/uwbw/create_wbw.php

@@ -0,0 +1,271 @@
+<?php
+//工程文件操作
+//建立,
+require_once '../path.php';
+require_once "../public/_pdo.php";
+require_once "../public/function.php";
+define("MAX_LETTER" ,20000);
+
+$output["status"]=0;
+$output["error"]="";
+$output{"book"}="";
+$output{"para"}="";
+$output{"channel"}="";
+
+if(isset($_POST["book"])){
+    $_book = $_POST["book"];
+}
+else{
+    $output["status"]=1;
+    $output["error"]="#no_param book";
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+if(isset($_POST["para"])){
+    $_para = json_decode($_POST["para"]);
+}
+else{
+    $output["status"]=1;
+    $output["error"]="#no_param paragraph";
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+if(isset($_POST["channel"])){
+    $_channel = $_POST["channel"];
+}
+else{
+    $output["status"]=1;
+    $output["error"]="#no_param channel";
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+$output{"book"}=$_book;
+$output{"para"}=$_para;
+$output{"channel"}=$_channel;
+
+//判断单词数量 太大的不能加载
+PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
+$params = array(1, 21, 63, 171);
+/*  创建一个填充了和params相同数量占位符的字符串 */
+$place_holders = implode(',', array_fill(0, count($_para), '?'));
+
+$query = "SELECT sum(lenght) FROM pali_text WHERE   paragraph IN ($place_holders) AND book = ?";
+$param_letter = $_para;
+$param_letter[] = $_book;
+$sum_len = PDO_FetchOne($query,$param_letter);
+
+if($sum_len>MAX_LETTER){
+    $output["status"]=1;
+    $output["error"]="#oversize_to_load";
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
+
+# 查询数据库是否有数据,没有就建立
+// 查询逐词解析库
+PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
+
+//模板库
+$db_tpl = "sqlite:"._DIR_PALICANON_TEMPLET_."/p".$_book."_tpl.db3";
+$dbh_tpl = new PDO($db_tpl, "", "");
+$dbh_tpl->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+#用户逐词译库
+$db_wbw = "sqlite:"._FILE_DB_USER_WBW_;
+$dbh_wbw= new PDO($db_wbw, "", "");
+$dbh_wbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+foreach ($_para as $key => $para) {
+    # code...
+    $query = "SELECT count(*) FROM wbw_block WHERE channal = ? AND book= ? and paragraph = ? ";
+    $FetchWBW = PDO_FetchOne($query,array($_channel,$_book,$para));
+    if($FetchWBW==0){
+        #建立
+        //写入数据库
+        // 开始一个事务,关闭自动提交
+        #更新block库
+        $block_id=UUID::v4();
+        $trans_block_id = UUID::v4();
+        $block_data = array($block_id,
+                                         "",
+                                         $_channel,
+                                         $_COOKIE["userid"],
+                                         $_book,
+                                         $para,
+                                         "",
+                                         $_POST["lang"],
+                                         1,
+                                         mTime(),
+                                         mTime()
+                                        );
+        $block_list[] = array("channal"=>$_channel,
+                                        "type"=>6,//word by word
+                                        "book"=>$_book,
+                                        "paragraph"=>$para,
+                                        "block_id"=>$block_id,
+                                        "readonly"=>false
+                                    );
+        $dbh_wbw->beginTransaction();
+        $query="INSERT INTO wbw_block ('id',
+                                                                 'parent_id',
+                                                                 'channal',
+                                                                 'owner',
+                                                                 'book',
+                                                                 'paragraph',
+                                                                 'style',
+                                                                 'lang',
+                                                                 'status',
+                                                                 'modify_time',
+                                                                 'receive_time')
+                                                  VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+        $stmt_wbw = $dbh_wbw->prepare($query);
+        $stmt_wbw->execute($block_data);
+        // 提交更改 
+        $dbh_wbw->commit();
+        if (!$stmt_wbw || ($stmt_wbw && $stmt_wbw->errorCode() != 0)) {
+            $error = $dbh_wbw->errorInfo();
+            $output["status"]=1;
+            $output["error"]=$error[2];
+            echo json_encode($output, JSON_UNESCAPED_UNICODE);
+            eixt;
+        }
+
+        #逐词解析库
+        $query="SELECT * FROM 'main' WHERE paragraph = ? ";
+        
+        $sth = $dbh_tpl->prepare($query);
+        $sth->execute(array($para));
+        
+        $level=100;
+        $title="";
+        while($result = $sth->fetch(PDO::FETCH_ASSOC))
+        {
+            if($result["gramma"]=="?"){
+                $wGrammar="";
+            }
+            else{
+                $wGrammar=$result["gramma"];
+            }
+
+            $strXml="<word>";
+            $strXml.="<pali>{$result["word"]}</pali>";
+            $strXml.="<real>{$result["real"]}</real>";
+            $wordid = "p{$result["book"]}-{$result["paragraph"]}-{$result["wid"]}"; 
+            $strXml.="<id>{$wordid}</id>";
+            $strXml.="<type s=\"0\">{$result["type"]}</type>";
+            $strXml.="<gramma s=\"0\">{$wGrammar}</gramma>";
+            $strXml.="<mean s=\"0\"></mean>";
+            $strXml.="<org s=\"0\">".mb_strtolower($result["part"], 'UTF-8')."</org>";
+            $strXml.="<om s=\"0\"></om>";
+            $strXml.="<case s=\"0\">{$result["type"]}#{$wGrammar}</case>";
+            $strXml.="<style>{$result["style"]}</style>";
+            $strXml.="<status>0</status>";
+            $strXml.="</word>";
+            $wbw_data[] = array(UUID::v4(),
+                                              $block_id,
+                                              $_book,
+                                              $para,
+                                              $result["wid"],
+                                              $result["real"],
+                                              $strXml,
+                                              mTime(),
+                                              mTime(),
+                                              1,
+                                              $_COOKIE["userid"]
+                                            );
+        }
+                
+            // 开始一个事务,关闭自动提交
+
+            $dbh_wbw->beginTransaction();
+            $query="INSERT INTO wbw ('id',
+                                                           'block_id',
+                                                           'book',
+                                                           'paragraph',
+                                                           'wid',
+                                                           'word',
+                                                           'data',
+                                                           'modify_time',
+                                                           'receive_time',
+                                                           'status',
+                                                           'owner'
+                                                           ) 
+                                           VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+            $stmt_wbw = $dbh_wbw->prepare($query);
+            foreach($wbw_data as $oneParam){
+                $stmt_wbw->execute($oneParam);
+            }
+            // 提交更改 
+            $dbh_wbw->commit();
+            if (!$stmt_wbw || ($stmt_wbw && $stmt_wbw->errorCode() != 0)) {
+                $error = $dbh_wbw->errorInfo();
+                $output["status"]=1;
+                $output["error"]=$error[2];
+                echo json_encode($output, JSON_UNESCAPED_UNICODE);
+                eixt;
+            }
+
+    }
+}
+
+/*TO DO 
+            //更新服务器端文件列表
+            $db_file = _FILE_DB_FILEINDEX_;
+            PDO_Connect("sqlite:$db_file");
+            $query="INSERT INTO fileindex ('id',
+                                        'parent_id',
+                                        'channal',
+                                        'user_id',
+                                        'book',
+                                        'paragraph',
+                                        'file_name',
+                                        'title',
+                                        'tag',
+                                        'status',
+                                        'create_time',
+                                        'modify_time',
+                                        'accese_time',
+                                        'file_size',
+                                        'share',
+                                        'doc_info',
+                                        'doc_block',
+                                        'receive_time'
+                                        ) 
+                            VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+            $stmt = $PDO->prepare($query);
+            $doc_id=UUID::v4();
+            $file_name = $book . '_' . $create_para . '_' . time();
+            $newData=array(
+                           $doc_id,
+                           "",
+                           $_POST["channal"],
+                           $uid,
+                           $book,
+                           $create_para,
+                           $file_name,
+                           $user_title,
+                           $tag,
+                           1,
+                           mTime(),
+                           mTime(),
+                           mTime(),
+                           $filesize,
+                           0,
+                           $doc_head,
+                           json_encode($block_list, JSON_UNESCAPED_UNICODE),
+                           mTime()
+                           );
+            $stmt->execute($newData);
+            if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
+                $error = PDO_ErrorInfo();
+                echo "error - $error[2] <br>";
+            }
+            else{
+                echo "成功新建一个文件.";
+            }
+
+*/
+echo json_encode($output, JSON_UNESCAPED_UNICODE);
+
+?>

+ 85 - 0
app/uwbw/wbw_channal_list.js

@@ -0,0 +1,85 @@
+var _wbw_channel;
+function wbw_channal_list_init() {
+	$("body").append(
+		'<div id="wbw_channal_list_dlg" title="Open WBW"><div id="wbw_channal_list_dlg_content"></div></div>'
+	);
+	$("#wbw_channal_list_dlg").dialog({
+		autoOpen: false,
+		width: 550,
+		buttons: [
+			{
+				text: "Cancel",
+				click: function () {
+					$(this).dialog("close");
+				},
+			},
+		],
+	});
+}
+
+function wbw_channal_list_open(book, paralist) {
+	$.post(
+		"../uwbw/wbw_channel_list.php",
+		{
+			book: book,
+			para: JSON.stringify(paralist),
+		},
+		function (data) {
+			_wbw_channel = JSON.parse(data);
+			if (_wbw_channel.status == 0) {
+				let html = "";
+				for (let index = 0; index < _wbw_channel.data.length; index++) {
+					const element = _wbw_channel.data[index];
+					html += "<div style='display:flex;'>";
+					html += "<span style='flex:2'>";
+					html += "<button onclick=\"wbw_create('" + index + "')\">";
+					if (parseInt(element.wbw_para) > 0) {
+						html += "打开";
+					} else {
+						html += "新建";
+					}
+
+					html += "</button>";
+					html += "</span>";
+					html += "<span  style='flex:1'>" + (index + 1) + "</span>";
+					html += "<span style='flex:3'>" + element.name + "</span>";
+					html += "<span style='flex:2'>" + element.lang + "</span>";
+					html += "<span style='flex:2'>" + element.wbw_para + "/" + element.count + "</span>";
+					html += "</div>";
+				}
+
+				$("#wbw_channal_list_dlg_content").html(html);
+				$("#wbw_channal_list_dlg").dialog("open");
+			} else {
+				ntf_show(_wbw_channel.error);
+			}
+		}
+	);
+}
+
+function wbw_create(index) {
+	$.post(
+		"../uwbw/create_wbw.php",
+		{
+			book: _wbw_channel.book,
+			para: _wbw_channel.para,
+			lang: _wbw_channel.data[index].lang,
+			channel: _wbw_channel.data[index].id,
+		},
+		function (data) {
+			let msg = JSON.parse(data);
+			if (msg.status == 0) {
+				$("#wbw_channal_list_dlg_content").html("正在打开编辑窗口");
+				let book = msg.book;
+				let paralist = msg.para.join(",");
+				let channel = msg.channel;
+				let url =
+					"../studio/editor.php?op=openchannal&book=" + book + "&para=" + paralist + "&channal=" + channel;
+				window.open(url, "_blank");
+				$("#wbw_channal_list_dlg").dialog("close");
+			} else {
+				ntf_show(msg.error);
+			}
+		}
+	);
+}

+ 42 - 0
app/uwbw/wbw_channel_list.php

@@ -0,0 +1,42 @@
+<?php
+require_once '../path.php';
+require_once "../public/_pdo.php";
+require_once "../public/function.php";
+
+$output["status"]=0;
+$output["error"]="";
+$output["data"]="";
+if(!isset($_COOKIE["userid"])){
+    $output["status"]=1;
+    $output["error"]="#not_login";
+    echo json_encode(output, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
+    $_book = $_POST["book"];
+    $_para = json_decode($_POST["para"]);
+    $output["para"]=$_POST["para"];
+    $output["book"]=$_POST["book"];
+    
+    /*  创建一个填充了和params相同数量占位符的字符串 */
+    $place_holders = implode(',', array_fill(0, count($_para), '?'));
+    $params = $_para;
+    $params[]=$_book;
+
+    PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
+    $query = "SELECT * FROM channal WHERE owner = ?  LIMIT 0,100";
+    $FetchChannal = PDO_FetchAll($query,array($_COOKIE["userid"]));
+    $i=0;
+    foreach($FetchChannal as $key=>$row){
+        PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
+
+        $queryParam = $params;
+        $queryParam[]=$row["id"];
+        $query = "SELECT count(*) FROM wbw_block WHERE  paragraph IN ($place_holders)  AND book = ? AND channal = ? ";
+        $wbwCount = PDO_FetchOne($query,$queryParam);
+        $FetchChannal[$key]["wbw_para"] = $wbwCount;
+        $FetchChannal[$key]["count"] = count($_para);
+    }
+    $output["data"]=$FetchChannal;
+    echo json_encode($output, JSON_UNESCAPED_UNICODE);
+?>

+ 54 - 54
app/wiki/wiki.js

@@ -22,79 +22,79 @@ var _author = "";
 function wiki_index_init() {}
 
 function wiki_load_id(guid) {
-  note_lookup_guid_json(guid, "wiki_contents");
+	note_create();
+	note_lookup_guid_json(guid, "wiki_contents");
 }
 
 function wiki_load_word(word) {
-  term_get_word_to_div(word, "wiki_contents", wiki_word_loaded);
+	note_create();
+	term_get_word_to_div(word, "wiki_contents", wiki_word_loaded);
 }
 function wiki_goto_word(guid, strWord) {
-  window.open("wiki.php?word=" + strWord, "_blank");
+	window.open("wiki.php?word=" + strWord, "_blank");
 }
 function wiki_word_loaded(wordlist) {
-  $("#doc_title").text(
-    wordlist[0].word + "[" + wordlist[0].meaning + "]-圣典百科"
-  );
+	$("#doc_title").text(wordlist[0].word + "[" + wordlist[0].meaning + "]-圣典百科");
 }
 
 function term_show_win(guid, word) {
-  window.location.assign("wiki.php?word=" + word);
+	window.location.assign("wiki.php?word=" + word);
 }
 
 function wiki_search_keyup(e, obj) {
-  var keynum;
-  var keychar;
-  var numcheck;
+	var keynum;
+	var keychar;
+	var numcheck;
 
-  if ($("#wiki_search_input").val() == "") {
-    $("#search_result").html("");
-    return;
-  }
+	if ($("#wiki_search_input").val() == "") {
+		$("#search_result").html("");
+		return;
+	}
 
-  if (window.event) {
-    // IE
-    keynum = e.keyCode;
-  } else if (e.which) {
-    // Netscape/Firefox/Opera
-    keynum = e.which;
-  }
-  var keychar = String.fromCharCode(keynum);
-  if (keynum == 13) {
-    //dict_search(obj.value);
-  } else {
-    wiki_pre_search(obj.value);
-  }
+	if (window.event) {
+		// IE
+		keynum = e.keyCode;
+	} else if (e.which) {
+		// Netscape/Firefox/Opera
+		keynum = e.which;
+	}
+	var keychar = String.fromCharCode(keynum);
+	if (keynum == 13) {
+		//dict_search(obj.value);
+	} else {
+		wiki_pre_search(obj.value);
+	}
 }
 
 function wiki_pre_search(keyword) {
-  $.get(
-    "../term/term.php",
-    {
-      op: "pre",
-      word: keyword,
-      format: "json",
-    },
-    function (data, status) {
-      let result = JSON.parse(data);
-      let html = "<ul class='wiki_search_list'>";
-      if (result.length > 0) {
-        for (x in result) {
-          html +=
-            "<li><a href='wiki.php?op=get&word=" +
-            result[x].word +
-            "'>" +
-            result[x].word +
-            "[" +
-            result[x].meaning +
-            "]</a></li>";
-        }
-      }
-      html += "</ul>";
-      $("#search_result").html(html);
-    }
-  );
+	$.get(
+		"../term/term.php",
+		{
+			op: "pre",
+			word: keyword,
+			format: "json",
+		},
+		function (data, status) {
+			let result = JSON.parse(data);
+			let html = "<ul class='wiki_search_list'>";
+			if (result.length > 0) {
+				for (x in result) {
+					html +=
+						"<li><a href='wiki.php?op=get&word=" +
+						result[x].word +
+						"'>" +
+						result[x].word +
+						"[" +
+						result[x].meaning +
+						"]</a></li>";
+				}
+			}
+			html += "</ul>";
+			$("#search_result").html(html);
+		}
+	);
 }
 
 function set_channal(channalid) {
-  location.assign("../wiki/wiki.php?word=" + _word + "&channal=" + channalid);
+	location.assign("../wiki/wiki.php?word=" + _word + "&channal=" + channalid);
 }

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff