visuddhinanda 5 роки тому
батько
коміт
730ffa6684

+ 38 - 0
app/article/article.js

@@ -0,0 +1,38 @@
+var _articel_id = "";
+var _channal = "";
+var _lang = "";
+var _author = "";
+var _display = "";
+
+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");
+      }
+    }
+  );
+}

+ 26 - 0
app/article/get.php

@@ -0,0 +1,26 @@
+<?php
+//查询term字典
+
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../ucenter/function.php';
+
+
+if(isset($_GET["id"])){
+    PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+    $id=$_GET["id"];
+    $query = "select * from article  where id = ".$PDO->quote($id);
+    $Fetch = PDO_FetchRow($query);
+    if($Fetch){
+        $userinfo = new UserInfo();
+        $user = $userinfo->getName($Fetch["owner"]);
+        $Fetch["username"] = $user;
+        echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+        exit;
+    }
+}
+
+echo json_encode(array(), JSON_UNESCAPED_UNICODE);	
+
+?>

+ 398 - 0
app/article/index.php

@@ -0,0 +1,398 @@
+<?php
+require_once "../public/load_lang.php";
+require_once "../path.php";
+
+?>
+
+<?PHP
+include "../pcdl/html_head.php";
+?>
+<body style="margin: 0;padding: 0;" class="reader_body" >
+	<script src="../term/term.js"></script>
+	<script src="../term/note.js"></script>
+	<script src="./article.js"></script>
+	<script>
+	<?php
+	$_id = "";
+	$_display = "";
+	$_channal  = "";
+
+	if(isset($_GET["id"])){
+		echo "_articel_id='".$_GET["id"]."';";
+	}
+	if(isset($_GET["display"])){
+		echo "_display='".$_GET["display"]."';";
+	}
+	if(isset($_GET["channal"])){
+		echo "_channal='".$_GET["channal"]."';";
+	}
+	if(isset($_GET["lang"])){
+		echo "_lang='".$_GET["lang"]."';";
+	}
+	if(isset($_GET["author"])){
+		echo "_author='".$_GET["author"]."';";
+	}
+	?>
+	</script>
+	<style>
+	body{
+		font-size:12pt;
+	}
+	.term_link,.term_link_new{
+		color: blue;
+		padding-left: 2px;
+		padding-right: 2px;
+	}
+	.term_link_new{
+		color:red;
+	}
+	#search_result{
+		position: absolute;
+		background: wheat;
+		max-width: 95%;
+		width: 24em;
+	}
+	note:hover chapter{
+		display:inline;
+	} 
+	.ref>chapter:first-child{
+		display:inline;
+	}
+	chapter{
+		display:none;
+		color: var(--box-bg-color1);
+		text-decoration: none;
+		cursor: pointer;
+	}
+	chapter:hover{
+		color: var(--link-color);
+		text-decoration: underline;
+	}
+	para{
+		background-color: var(--drop-bg-color);
+		padding: 2px 8px;
+		text-decoration: none;
+		cursor: pointer;
+		color: var(--btn-border-color);
+		border-radius: 5px;
+	}
+	para:hover{
+		text-decoration: underline;
+	}
+	.icon{
+		width: 15px;
+		height: 15px;
+	}
+	.submenu_title{
+		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{
+		background-color: #80808014;
+		padding: 0.5em 0.8em;
+		margin-bottom: 0.4em;
+		border-radius: 5px;
+		line-height:1.3em;
+		<?php
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+			echo "display:inline;";
+		}
+		else{
+			echo "display:block;";
+		}
+		?>
+	}
+	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 {
+		display: flex;
+		justify-content: space-between;
+	}
+	#head_bar{
+		display: flex;
+    justify-content: space-between;
+    height: 5em;
+    background-color: var(--bookx);
+    border-bottom: 1px solid var(--tool-line-color);
+	}
+	.term_block_bar_left{
+		display: flex;
+	}
+	.term_block_bar_left_icon{
+    display: inline-block;
+    width: 1.5em;
+    text-align: center;
+    height: 1.5em;
+    background-color: gray;
+    font-size: 180%;
+    color: white;
+    border-radius: 99px;
+	}
+	.term_block_bar_left_info{
+		    padding-left: 8px;
+	}
+	.term_meaning{
+		font-weight: 700;
+	}
+	.term_author{
+		font-size: 80%;
+		color: gray;
+	}
+	.term_tag{
+		font-size: 80%;
+		font-weight: 500;
+		margin: 0 8px;
+	}
+	.term_link {
+    cursor: pointer;
+	}
+	.main_view{
+		padding: 0 1em;
+		max-width: 1280px;
+		margin-left: auto;
+		margin-right: auto;
+	}
+	#term_list_right{
+		width: 25em;
+	}
+	#term_list{
+		width: 100%;
+		padding: 0.5em;
+	}
+	#term_list_div{
+		display: flex;
+		justify-content: space-between;
+	}
+	.fun_frame {
+		border-bottom: 1px solid gray;
+		margin-right: 10px;
+		margin-bottom: 10px;
+	}
+	.fun_frame>.title{
+		padding:6px;
+		font-weight: 700;
+	}
+	.fun_frame>.content{
+		padding:6px;
+		max-height:6em;
+		overflow-y: scroll;
+	}
+	
+	.fixed{
+		position:fixed;
+		right: 0;
+    	top: 0;
+	}
+	.when_right_fixed{
+		padding-right:20em;
+	}
+	.bg_color_1{
+		background-color:#ebebeb66;
+	}
+	.bg_color_2{
+		background:linear-gradient(to right, #6afdb033, #ebebeb66);
+	}
+	.bg_color_3{
+		background:linear-gradient(to right, #6a95fd26, #ebebeb66);
+	}
+	.bg_color_4{
+		background:linear-gradient(to right, #f9e7911c, #ebebeb66);
+	}
+	.bg_color_5{
+		background:linear-gradient(to right, #fe99b91c, #ebebeb66);
+	}
+
+	pre {
+		white-space: pre-line;
+		font-family: auto;
+		border-left: 3px solid var(--border-shadow);
+		margin-left: 1em;
+		padding-left: 0.5em;
+	}
+	#contents_view{
+		display:flex;
+	}
+	#contents{
+		flex:7;
+	}
+	#right_pannal{
+		flex:3;
+		max-width:20em;
+	}
+	#head_bar{
+		height:unset;
+	}
+
+<?php
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+?>
+	.tran>p{
+		display:inline;
+	}
+	note{
+		padding: 2px;
+		margin-bottom: unset;
+	}
+<?php
+		}
+?>
+
+	</style>
+
+<style media="screen and (max-width:767px)">
+#right_pannal{
+	display:none;
+}
+.when_right_fixed{
+	padding-right:0;
+}
+.index_toolbar{
+		position:unset;
+	}
+	#pali_pedia{
+		font-size: 200%;
+    margin-top: auto;
+    margin-bottom: auto;
+    padding-left: 0.5em;
+	}
+</style>
+
+<script>
+term_word_link_fun("wiki_goto_word");
+</script>
+
+<?php
+    require_once("../pcdl/head_bar.php");
+?>
+<div id="head_bar" >
+	<div id="pali_pedia" style="display:flex;">
+		<span>文集</span>
+	</div>
+
+	<div>
+		<span>
+		<?php
+		echo "<a href='../article/?id=".$_GET["id"];
+		echo "&display=para";
+		echo "'>[逐段]</a>";
+		echo "<a href='../article/?id=".$_GET["id"];
+		echo "&display=sent";
+		echo "'>[逐句]</a>";
+		?>
+			<a href="#">[帮助]</a>
+		</span>
+	</div>
+</div>
+<div id="main_view" class="main_view">
+<div id="article_head" style="border-bottom: 1px solid gray;">
+	<div id="article_title" class="term_word_head_pali">Title</div>
+	<div id="article_subtitle">Subtitle</div>
+	<div id="article_author">author</div>
+</div>
+<div id="contents_view">
+	<div id="contents" style="padding: 0 1em;">
+	loading...
+	</div>
+	<div id="right_pannal">
+		<div class="fun_frame">
+			<div class="title">About Author</div>
+			<div class="content" style="max-height:10em;">
+			</div>
+		</div>
+		<div class="fun_frame">
+			<div class="title">Table of Content</div>
+			<div class="content" style="max-height:10em;">
+			</div>
+		</div>
+		<div class="fun_frame">
+			<div class="title">Other Authors</div>
+			<div class="content" style="max-height:10em;">
+			</div>
+		</div>
+	</div>
+</div>
+</div>
+<script>
+	articel_load(_articel_id);
+
+	 window.addEventListener('scroll',winScroll);
+	function winScroll(e){ 
+		if(GetPageScroll().y>220){
+
+		}
+		else{
+
+		}
+		
+	}
+ //滚动条位置
+function GetPageScroll() 
+{ 
+	var pos=new Object();
+	var x, y; 
+	if(window.pageYOffset) 
+	{	// all except IE	
+		y = window.pageYOffset;	
+		x = window.pageXOffset; 
+	} else if(document.documentElement && document.documentElement.scrollTop) 
+	{	// IE 6 Strict	
+		y = document.documentElement.scrollTop;	
+		x = document.documentElement.scrollLeft; 
+	} else if(document.body) {	// all other IE	
+		y = document.body.scrollTop;	
+		x = document.body.scrollLeft;   
+	} 
+	pos.x=x;
+	pos.y=y;
+	return(pos);
+}
+	</script>
+
+</body>
+</html>

+ 28 - 0
app/article/list.php

@@ -0,0 +1,28 @@
+<?php
+//查询term字典
+
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../ucenter/function.php';
+
+
+if(isset($_GET["userid"])){
+    PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+    $userid=$_GET["userid"];
+    $query = "SELECT * from article  where owner = ".$PDO->quote($userid)." and status <> 0 order by modify_time DESC";
+    $Fetch = PDO_FetchAll($query);
+    if($Fetch){
+        /*
+        $userinfo = new UserInfo();
+        $user = $userinfo->getName($Fetch["owner"]);
+        $Fetch["username"] = $user;
+        */
+        echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+        exit;
+    }
+}
+
+echo json_encode(array(), JSON_UNESCAPED_UNICODE);	
+
+?>

+ 35 - 0
app/article/list_new.php

@@ -0,0 +1,35 @@
+<?php
+//
+
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/load_lang.php';
+require_once '../ucenter/function.php';
+
+global $PDO;
+PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+$query = "select * from article where 1  order by create_time DESC limit 0,4";
+$Fetch = PDO_FetchAll($query);
+
+foreach($Fetch as $row){
+    echo '<div class="content_block">';
+    echo '<div class="card">';
+
+    echo '<div class="pd-10">';
+    echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../article/?id='.$row["id"].'&display=para">'.$row["title"].'</a></div>';
+    echo '<div class="summary"  style="padding-bottom:5px;color: #ad4b00;">'.$row["subtitle"].'</div>';
+    echo '<div class="author"  style="padding-bottom:5px;margin-bottom:0.4em;">';
+    echo '<a href="../uhome/course.php?userid='.$row['owner'].'">';
+    echo ucenter_getA($row["owner"]);
+    echo '</a>';
+    echo '</div>';    
+    echo '<div class="summary"  style="padding-bottom:5px;height: 4.5em;line-height: 1.5em;overflow-y: hidden;">'.$row["summary"].'</div>';
+    echo '</div>';
+    echo '<div class="pd-10" style="display:flex;justify-content: space-between;">';
+    echo '</div>';
+    
+    echo '</div>';
+    echo '</div>';
+}
+
+?>

+ 33 - 0
app/article/my_article.js

@@ -0,0 +1,33 @@
+function my_article_list() {
+  $.get(
+    "../article/list.php",
+    {
+      userid: getCookie("userid"),
+      setting: "",
+    },
+    function (data, status) {
+      if (status == "success") {
+        try {
+          let html = "";
+          let result = JSON.parse(data);
+          let key = 1;
+          for (const iterator of result) {
+            html += '<div class="file_list_row" style="padding:5px;">';
+            html +=
+              '<div style="max-width:2em;flex:1;"><input type="checkbox" /></div>';
+            html += "<div style='flex:1;'>" + key++ + "</div>";
+            html += "<div style='flex:2;'>" + iterator.title + "</div>";
+            html += "<div style='flex:2;'>" + "</div>";
+            html += "<div style='flex:1;'>15</div>";
+            html += "</div>";
+          }
+          $("#article_list").html(html);
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
+      }
+    }
+  );
+}

+ 38 - 0
app/article/my_article_index.php

@@ -0,0 +1,38 @@
+<?php
+require_once '../studio/index_head.php';
+?>
+<body id="file_list_body" onLoad="my_article_list()">
+
+	<script language="javascript" src="../article/my_article.js"></script>
+	<script >
+	var gCurrPage="article";
+	</script>
+
+	<style>
+	#article {
+		background-color: var(--btn-border-color);
+		
+	}
+	#article:hover{
+		background-color: var(--btn-border-color);
+		color: var(--btn-color);
+		cursor:auto;
+	}
+	</style>
+
+	<?php
+	require_once '../studio/index_tool_bar.php';
+	?>
+		
+	<div class="index_inner" style="margin-left: 18em;margin-top: 5em;display:flex;">
+		<div id="article_list"  class="file_list_block" style="flex:3;">
+
+		</div>
+        <div style="flex:3;"></div>
+        <div style="flex:4;"></div>
+	</div>
+	
+<?php
+require_once '../studio/index_foot.php';
+?>
+

+ 0 - 0
app/article/my_collect_index.php


+ 1 - 0
app/path.php

@@ -69,5 +69,6 @@ define("_FILE_DB_MESSAGE_"  , __DIR__."/../tmp/user/message.db");
 define("_FILE_DB_USER_STATISTICS_"  , __DIR__."/../tmp/user/statistics.db3");
 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");
 
 ?>

+ 9 - 33
app/pcdl/index.php

@@ -55,43 +55,19 @@ require_once '../pcdl/html_head.php';
 			<span class="title_more"><a href="../palicanon">更多</a></span>
 		</div>
 		<div class="content">
-			<div class="content_inner">
-				<div class="content_block">
-					<div class="card">
+			<div id="article_new" class="content_inner">
 
-						<div class="title"><a href="#">Khudasikha</a></div>
-						<div class="summary">概要</div>
-						<div class="author">作者</div>
-					</div>
-				</div>
-				<div class="content_block">
-					<div class="card">
-
-						<div class="title pd-10">标题</div>
-						<div class="summary pd-10">概要</div>
-						<div class="author pd-10">作者</div>
-					</div>
-				</div>
-				<div class="content_block">
-					<div class="card">
-
-						<div class="title">标题</div>
-						<div class="summary">概要</div>
-						<div class="author">作者</div>
-					</div>
-				</div>
-				<div class="content_block">
-					<div class="card">
-
-						<div class="title">标题</div>
-						<div class="summary">概要</div>
-						<div class="author">作者</div>
-					</div>
-				</div>
 			</div>
 		</div>
 	</div>
-    
+	<script>
+	$.get("../article/list_new.php",function(data,status){
+		let xDiv = document.getElementById("article_new");
+		if(xDiv){
+			xDiv.innerHTML=data;
+		}
+	});
+	</script>	
 	
 	<div class="index_list_categories">
 		<div class="title_bar">

+ 1 - 1
app/studio/editor.php

@@ -60,7 +60,7 @@ else{$currDevice="computer";}
 	<script language="javascript" src="../public/js/comm.js"></script>
 	<script language="javascript" src="../public/js/localforage.min.js"></script>
 	<script language="javascript" src="../public/script/my.js"></script>
-
+	<script src="../public/js/mermaid.min.js"></script>
 	
 	<script language="javascript" src="module/editor/language/default.js"></script>	
 	<script src="js/jquery-3.3.1.min.js"></script>

+ 25 - 2
app/studio/index_tool_bar.php

@@ -105,9 +105,32 @@
 					</span>	
 					<span class="navi_text">
 					<?php echo $_local->gui->wiki_term;?>
-					
 					</span>
-				</li>				
+				</li>
+
+				<li id="article"  onclick="goto_url(this,'../article/my_article_index.php')">
+					<span  class="navi_icon">
+						<svg class="icon">
+							<use xlink:href="../studio/plugin/system_term/icon.svg#icon_term"></use>
+						</svg>	
+					</span>	
+					<span class="navi_text">
+					<?php echo "作品";?>
+					</span>
+				</li>
+
+				<li id="collect"  onclick="goto_url(this,'../article/my_collect_index.php')">
+					<span  class="navi_icon">
+						<svg class="icon">
+							<use xlink:href="../studio/plugin/system_term/icon.svg#icon_term"></use>
+						</svg>	
+					</span>	
+					<span class="navi_text">
+					<?php echo "文集";?>
+					</span>
+				</li>
+
+
 			</ul>
 		</div>
 		

+ 25 - 2
app/term/note.js

@@ -118,9 +118,32 @@ function note_refresh_new() {
             for (const iterator of arrData) {
               let id = iterator.id;
               let strHtml = "<a name='" + id + "'></a>";
-              strHtml += note_json_html(iterator);
-              $("#" + id).html(strHtml);
+              if (_display && _display == "para") {
+                let strPalitext = "<pali>" + iterator.palitext + "<pali>";
+                let divPali = $("#" + id)
+                  .parent()
+                  .children(".palitext");
+                if (divPali.length == 0) {
+                  $("#" + id)
+                    .parent()
+                    .prepend("<div class='palitext'></div>");
+                }
+                $("#" + id)
+                  .parent()
+                  .children(".palitext")
+                  .first()
+                  .append(strPalitext);
+                let htmlTran =
+                  "<span class='tran'>" +
+                  marked(term_std_str_to_tran(iterator.tran)) +
+                  "</span>";
+                $("#" + id).html(htmlTran);
+              } else {
+                strHtml += note_json_html(iterator);
+                $("#" + id).html(strHtml);
+              }
             }
+
             $(".palitext").click(function () {
               let sentid = $(this).parent().attr("info").split("-");
               window.open(

+ 14 - 6
app/term/note.php

@@ -46,12 +46,20 @@ $output = array();
 foreach ($_data as $key => $value) {
 	# code...
 	$id = $value["id"];
-	$arrInfo = str_getcsv($value["data"],"@");
-	$arrSent = str_getcsv($arrInfo[0],"-");
-	$bookId=$arrSent[0];
-	$para=$arrSent[1];
-	$begin=$arrSent[2];
-	$end=$arrSent[3];
+	$arrInfo = explode("@",$value["data"]);
+	if(isset($arrInfo[1])){
+		$sentChannal = $arrInfo[1];
+	}
+	else{
+		$sentChannal = "";
+	}
+	if(isset($arrInfo[0])){
+		$arrSent = str_getcsv($arrInfo[0],"-");
+		$bookId=$arrSent[0];
+		$para=$arrSent[1];
+		$begin=$arrSent[2];
+		$end=$arrSent[3];
+	}
 
 	$query="SELECT html FROM 'pali_sent' WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? ";
 	$sth = $db_pali_sent->prepare($query);