visuddhinanda 5 år sedan
förälder
incheckning
474236ed74

+ 74 - 0
app/article/article.js

@@ -36,3 +36,77 @@ function articel_load(id) {
     }
   );
 }
+
+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) {
+            $("#collect_title").html(result[0].title);
+            let html = "";
+            html += "<ul>";
+            let article_list = JSON.parse(result[0].article_list);
+            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.aticle == _articel_id) {
+                if (index > 0) {
+                  const prev = article_list[index - 1];
+                  prevArticle =
+                    "<a href='../article/index.php?id=" +
+                    prev.aticle +
+                    display +
+                    "'>" +
+                    prev.title +
+                    "</a>";
+                }
+                if (index < article_list.length - 1) {
+                  const next = article_list[index + 1];
+                  nextArticle =
+                    "<a href='../article/index.php?id=" +
+                    next.aticle +
+                    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.aticle +
+                display +
+                "'>" +
+                element.title +
+                "</a></li>";
+            }
+
+            html += "</ul>";
+
+            $("#toc_content").html(html);
+          }
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
+      }
+    }
+  );
+}

+ 36 - 0
app/article/collect_get.php

@@ -0,0 +1,36 @@
+<?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 collect  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;
+    }
+}
+else if(isset($_GET["article"])){
+    PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+    $article=$_GET["article"];
+    $query = "select * from collect  where article_list like ".$PDO->quote('%'.$article.'%');
+    $Fetch = PDO_FetchAll($query);
+
+        echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+        exit;
+
+}
+
+echo json_encode(array(), JSON_UNESCAPED_UNICODE);	
+
+?>

+ 26 - 0
app/article/collect_list.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["userid"])){
+    PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+    $userid=$_GET["userid"];
+    $query = "SELECT * from collect  where owner = ".$PDO->quote($userid)." and status <> 0 order by modify_time DESC";
+    $Fetch = PDO_FetchAll($query);
+    if($Fetch){
+        /*
+
+        */
+        echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+        exit;
+    }
+}
+
+echo json_encode(array(), JSON_UNESCAPED_UNICODE);	
+
+?>

+ 46 - 13
app/article/index.php

@@ -112,7 +112,6 @@ require_once "../pcdl/html_head.php";
 		margin-top: 8px;
 	}
 	note{
-		background-color: #80808014;
 		padding: 0.5em 0.8em;
 		margin-bottom: 0.4em;
 		border-radius: 5px;
@@ -123,6 +122,7 @@ require_once "../pcdl/html_head.php";
 		}
 		else{
 			echo "display:block;";
+			echo "background-color: #80808014;";
 		}
 		?>
 	}
@@ -229,6 +229,12 @@ require_once "../pcdl/html_head.php";
 	.when_right_fixed{
 		padding-right:20em;
 	}
+	<?php
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+
+		}
+		else{
+?>
 	.bg_color_1{
 		background-color:#ebebeb66;
 	}
@@ -244,6 +250,10 @@ require_once "../pcdl/html_head.php";
 	.bg_color_5{
 		background:linear-gradient(to right, #fe99b91c, #ebebeb66);
 	}
+<?php
+		}
+		?>
+
 
 	pre {
 		white-space: pre-line;
@@ -255,9 +265,13 @@ require_once "../pcdl/html_head.php";
 	#contents_view{
 		display:flex;
 	}
-	#contents{
+	#contents_div{
 		flex:7;
 	}
+	#contents{
+		min-height: 400px;
+	}
+	
 	#right_pannal{
 		flex:3;
 		max-width:20em;
@@ -282,6 +296,18 @@ require_once "../pcdl/html_head.php";
 		}
 ?>
 
+#toc_content .level_2{
+	padding-left:0.5em;
+}
+#toc_content .level_3{
+	padding-left:1em;
+}
+#toc_content .level_4{
+	padding-left:1.5em;
+}
+#toc_content .level_5{
+	padding-left:2em;
+}
 	</style>
 
 <style media="screen and (max-width:767px)">
@@ -335,22 +361,28 @@ term_word_link_fun("wiki_goto_word");
 	<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 id="contents_div" style="padding: 0 1em;">
+		<div id="contents">
+		loading...
+		</div>
+		<div id="contents_foot">
+			<div id="contents_nav" style="display:flex;justify-content: space-between;">
+				<div id="contents_nav_left"></div>
+				<div id="contents_nav_right"></div>
+			</div>
+			<div id="contents_dicuse">
+			
 			</div>
 		</div>
+	</div>
+	<div id="right_pannal">
 		<div class="fun_frame">
-			<div class="title">Table of Content</div>
-			<div class="content" style="max-height:10em;">
+			<div id = "collect_title" class="title">Table of Content</div>
+			<div id = "toc_content" class="content" style="max-height:10em;">
 			</div>
 		</div>
 		<div class="fun_frame">
-			<div class="title">Other Authors</div>
+			<div class="title">Translations</div>
 			<div class="content" style="max-height:10em;">
 			</div>
 		</div>
@@ -359,7 +391,8 @@ term_word_link_fun("wiki_goto_word");
 </div>
 <script>
 	articel_load(_articel_id);
-
+	articel_load_collect(_articel_id);
+	
 	 window.addEventListener('scroll',winScroll);
 	function winScroll(e){ 
 		if(GetPageScroll().y>220){

+ 93 - 1
app/article/my_article.js

@@ -17,7 +17,19 @@ function my_article_list() {
               '<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:2;'>" +
+              render_status(iterator.status) +
+              "</div>";
+            html += "<div style='flex:1;'>Copy Link</div>";
+            html +=
+              "<div style='flex:1;'><a href='../article/my_article_edit.php?id=" +
+              iterator.id +
+              "'>Edit</a></div>";
+            html +=
+              "<div style='flex:1;'><a href='../article/?id=" +
+              iterator.id +
+              "' target='_blank'>Preview</a></div>";
             html += "<div style='flex:1;'>15</div>";
             html += "</div>";
           }
@@ -31,3 +43,83 @@ function my_article_list() {
     }
   );
 }
+
+function render_status(status) {
+  status = parseInt(status);
+  let html = "";
+  let objStatus = [
+    { id: 1, name: "私有", tip: "仅自己可见" },
+    { id: 2, name: "不公开列出", tip: "不能被搜索到,只能通过链接访问" },
+    { id: 3, name: "公开", tip: "所有人均可看到" },
+  ];
+  html += '<div class="case_dropdown">';
+  for (const iterator of objStatus) {
+    if (iterator.id == status) {
+      html += "<div >" + iterator.name + "</div>";
+    }
+  }
+  html += '<div class="case_dropdown-content">';
+
+  for (const iterator of objStatus) {
+    let active = "";
+    if (iterator.id == status) {
+      active = "active";
+    }
+    html += "<a class='" + active + "'  onclick='setStatus()'>";
+    html += "<div style='font-size:110%'>" + iterator.name + "</div>";
+    html += "<div style='font-size:80%'>" + iterator.tip + "</div>";
+    html += "</a>";
+  }
+  html += "</div></div>";
+  return html;
+}
+
+function my_article_edit(id) {
+  $.get(
+    "../article/get.php",
+    {
+      id: id,
+      setting: "",
+    },
+    function (data, status) {
+      if (status == "success") {
+        try {
+          let html = "";
+          let result = JSON.parse(data);
+
+          html += '<div class="" style="padding:5px;">';
+          html += '<div style="max-width:2em;flex:1;"></div>';
+          html += "<div style='flex:2;'>" + result.title + "</div>";
+          html +=
+            "<div style='flex:2;'>" + render_status(result.status) + "</div>";
+          html += "<div style='flex:1;'>Copy Link</div>";
+          html +=
+            "<div style='flex:1;'><a href='../article/my_article_edit.php?id=" +
+            result.id +
+            "'>Edit</a></div>";
+          html +=
+            "<div style='flex:1;'><a href='../article/?id=" +
+            result.id +
+            "' target='_blank'>Preview</a></div>";
+          html += "<div style='flex:1;'>15</div>";
+          html += "</div>";
+          html += "<div style='display:flex;'>";
+          html += "<div style='flex:5;'>";
+          html +=
+            "<textarea style='height:500px;'>" + result.content + "</textarea>";
+          html += "</div>";
+          html += "<div style='flex:5;'>";
+
+          html += "</div>";
+          html += "</div>";
+
+          $("#article_list").html(html);
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
+      }
+    }
+  );
+}

+ 75 - 0
app/article/my_article_edit.php

@@ -0,0 +1,75 @@
+<?php
+require_once '../studio/index_head.php';
+?>
+<body id="file_list_body" >
+
+	<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;
+	}
+	.file_list_block{
+		width:unset;
+	}
+	.case_dropdown-content>a {
+		display:block;
+	}
+	.case_dropdown-content>.active{
+		background-color:gray;
+	}
+	</style>
+
+	<?php
+	require_once '../studio/index_tool_bar.php';
+	?>
+		
+	<div class="index_inner " style="margin-left: 18em;margin-top: 5em;">
+	<div class="file_list_block">
+		<div class="tool_bar">
+			<div><a href="../article/my_article_index.php">返回</a><span id="article_title"></span></div>
+			<div>
+				<span class="icon_btn_div">
+					<span class="icon_btn_tip"></span>
+					<button id="file_add" type="button" class="icon_btn" title=" ">
+						<a href="../course/my_course_index.php?op=new">
+						<svg class="icon">
+							<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>
+						</svg>
+						</a>
+					</button>
+				</span>
+				
+				<span class="icon_btn_div">				
+					<span class="icon_btn_tip">回收站</span>
+					<button id="to_recycle" type="button" class="icon_btn" onclick="file_del()" title=" ">
+						<svg class="icon">
+							<use xlink:href="../studio/svg/icon.svg#ic_delete"></use>
+						</svg>
+					</button>
+				</span>	
+			</div>
+		</div>
+
+		<div id="article_list"  class="file_list_block" style="">
+
+		</div>
+	</div>
+	</div>
+	
+<script>
+my_article_edit("<?php echo $_GET["id"] ?>");
+</script>
+<?php
+require_once '../studio/index_foot.php';
+?>
+

+ 38 - 4
app/article/my_article_index.php

@@ -18,18 +18,52 @@ require_once '../studio/index_head.php';
 		color: var(--btn-color);
 		cursor:auto;
 	}
+	.file_list_block{
+		width:unset;
+	}
+	.case_dropdown-content>a {
+		display:block;
+	}
+	.case_dropdown-content>.active{
+		background-color:gray;
+	}
 	</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 class="index_inner " style="margin-left: 18em;margin-top: 5em;">
+		<div class="file_list_block">
+			<div class="tool_bar">
+				<div>作品列表</div>
+				<div>
+					<span class="icon_btn_div">
+						<span class="icon_btn_tip"></span>
+						<button id="file_add" type="button" class="icon_btn" title=" ">
+							<a href="../course/my_course_index.php?op=new">
+							<svg class="icon">
+								<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>
+							</svg>
+							</a>
+						</button>
+					</span>
+					
+					<span class="icon_btn_div">				
+						<span class="icon_btn_tip">回收站</span>
+						<button id="to_recycle" type="button" class="icon_btn" onclick="file_del()" title=" ">
+							<svg class="icon">
+								<use xlink:href="../studio/svg/icon.svg#ic_delete"></use>
+							</svg>
+						</button>
+					</span>	
+				</div>
+			</div>
+
+			<div id="article_list"  class="file_list_block" style="">
 
+			</div>
 		</div>
-        <div style="flex:3;"></div>
-        <div style="flex:4;"></div>
 	</div>
 	
 <?php

+ 45 - 0
app/article/my_collect.js

@@ -0,0 +1,45 @@
+function my_collect_list() {
+  $.get(
+    "../article/collect_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;'>" +
+              render_status(iterator.status) +
+              "</div>";
+            html += "<div style='flex:1;'>Copy Link</div>";
+            html +=
+              "<div style='flex:1;'><a href='../article/my_article_edit.php?id=" +
+              iterator.id +
+              "'>Edit</a></div>";
+            html +=
+              "<div style='flex:1;'><a href='../article/?id=" +
+              iterator.id +
+              "' target='_blank'>Preview</a></div>";
+            html += "<div style='flex:1;'>15</div>";
+            html += "</div>";
+          }
+          $("#article_list").html(html);
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
+      }
+    }
+  );
+}

+ 65 - 0
app/article/my_collect_index.php

@@ -0,0 +1,65 @@
+<?php
+require_once '../studio/index_head.php';
+?>
+<body id="file_list_body" onLoad="my_collect_list()">
+
+	<script language="javascript" src="../article/my_article.js"></script>
+	<script language="javascript" src="../article/my_collect.js"></script>
+
+	<script >
+	var gCurrPage="collect";
+	</script>
+
+	<style>
+	#collect {
+		background-color: var(--btn-border-color);
+		
+	}
+	#collect: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;">
+		<div class="file_list_block">
+			<div class="tool_bar">
+				<div>作品列表</div>
+				<div>
+					<span class="icon_btn_div">
+						<span class="icon_btn_tip"></span>
+						<button id="file_add" type="button" class="icon_btn" title=" ">
+							<a href="../course/my_course_index.php?op=new">
+							<svg class="icon">
+								<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>
+							</svg>
+							</a>
+						</button>
+					</span>
+					
+					<span class="icon_btn_div">				
+						<span class="icon_btn_tip">回收站</span>
+						<button id="to_recycle" type="button" class="icon_btn" onclick="file_del()" title=" ">
+							<svg class="icon">
+								<use xlink:href="../studio/svg/icon.svg#ic_delete"></use>
+							</svg>
+						</button>
+					</span>	
+				</div>
+			</div>
+
+			<div id="article_list"  class="file_list_block" style="">
+
+			</div>
+		</div>
+	</div>
+	
+<?php
+require_once '../studio/index_foot.php';
+?>
+

+ 41 - 0
app/pcdl/reader.php

@@ -18,7 +18,9 @@ $_channal = new Channal();
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	<link type="text/css" rel="stylesheet" href="../studio/css/font.css"/>
+	<link type="text/css" rel="stylesheet" href="../pcdl/css/color_day.css" id="colorchange" />
 	<link type="text/css" rel="stylesheet" href="css/reader.css"/>
+	<link type="text/css" rel="stylesheet" href="../guide/guide.css"/>
 	<link type="text/css" rel="stylesheet" href="css/reader_mob.css" media="screen and (max-width:767px)">
 	<title id="page_title">PCD Reader</title>
 
@@ -30,6 +32,10 @@ $_channal = new Channal();
 	<script src="../public/js/notify.js"></script>
 	<script src="../term/term.js"></script>
 	<script src="../term/note.js"></script>
+	<script src="../public/js/marked.js"></script>
+	<script src="../public/js/mermaid.min.js"></script>
+	<script src="../guide/guide.js"></script>
+	<link type="text/css" rel="stylesheet" href="../guide/guide.css"/>
 </head>
 <body class="reader_body" >
 <a name="page_head"></a>
@@ -43,11 +49,19 @@ $_channal = new Channal();
 	</script>
 
 <style>
+.term_link {
+    background: unset;
+    position: relative;
+}
+	.term_link:hover .guide_contence {
+		display: inline-block;
+	}
 .par_translate_div{
 	margin-left: 1em;
     border-left: 1px solid gray;
     padding-left: 0.5em;
     margin-top: 0.5em;
+	font-size: 1.1em
 }
 	.edit_icon{
 		display:inline-block;
@@ -255,6 +269,16 @@ note{
 	color:blue;
 	cursor: pointer;
 }
+more{
+    position: absolute;
+    display: none;
+    width: 1em;
+    height: 1em;
+    background-color: gray;
+}
+sent:hover more{
+	display: inline-block;
+}
 </style>
 		<!-- tool bar begin-->
 		<div id="main_tool_bar" class='reader_toolbar'>
@@ -1251,6 +1275,23 @@ function render_sent($sent_data,$sn,$display_mode,$sent_count,$class=""){
 
 <script>
 reader_init();
+var htmlDropdown  = "<div class='case_dropdown'>";
+htmlDropdown  +="<svg class='edit_icon' >";
+htmlDropdown  +="<use xlink:href='svg/icon.svg#ic_more'></use>";
+htmlDropdown  +="</svg>";
+htmlDropdown  +="<div class='case_dropdown-content'>";
+htmlDropdown  +="<a onclick='copy_ref()'>复制引用</a>";
+htmlDropdown  +="<a onclick='add_to_list()'>添加到选择列表</a>";
+htmlDropdown  +="</div>";
+htmlDropdown  +="</div>";
+$("sent").each(function(){
+	$(this).append("<more>"+htmlDropdown+"</more>")
+})
+function copy_ref(){
+	let pali_sent = $(this).parent().parent().parent().prev();
+	let strRef = "{{"+pali_sent.attr("book")+"-"+pali_sent.attr("para")+"-"+pali_sent.attr("begin")+"-"+pali_sent.attr("end")+"}}";
+	alert(strRef);
+}
 </script>
 	
 </body>

+ 24 - 2
app/term/note.js

@@ -120,7 +120,18 @@ function note_refresh_new() {
               let id = iterator.id;
               let strHtml = "<a name='" + id + "'></a>";
               if (_display && _display == "para") {
-                let strPalitext = "<pali>" + iterator.palitext + "<pali>";
+                let strPalitext =
+                  "<pali book='" +
+                  iterator.book +
+                  "' para='" +
+                  iterator.para +
+                  "' begin='" +
+                  iterator.begin +
+                  "' end='" +
+                  iterator.end +
+                  "' >" +
+                  iterator.palitext +
+                  "</pali>";
                 let divPali = $("#" + id)
                   .parent()
                   .children(".palitext");
@@ -144,7 +155,6 @@ function note_refresh_new() {
                 $("#" + id).html(strHtml);
               }
             }
-
             $(".palitext").click(function () {
               let sentid = $(this).parent().attr("info").split("-");
               window.open(
@@ -158,6 +168,18 @@ function note_refresh_new() {
                   sentid[3]
               );
             });
+            $("pali").click(function () {
+              window.open(
+                "../pcdl/reader.php?view=sent&book=" +
+                  $(this).attr("book") +
+                  "&para=" +
+                  $(this).attr("para") +
+                  "&begin=" +
+                  $(this).attr("begin") +
+                  "&end=" +
+                  $(this).attr("end")
+              );
+            });
             note_ref_init();
             term_get_dict();
             note_channal_list();

+ 16 - 1
app/term/note.php

@@ -60,6 +60,12 @@ foreach ($_data as $key => $value) {
 		$begin=$arrSent[2];
 		$end=$arrSent[3];
 	}
+	else{
+		$bookId=0;
+		$para=0;
+		$begin=0;
+		$end=0;
+	}
 
 	$query="SELECT html FROM 'pali_sent' WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? ";
 	$sth = $db_pali_sent->prepare($query);
@@ -101,7 +107,16 @@ foreach ($_data as $key => $value) {
 	
 	$para_path=_get_para_path($bookId,$para);
 
-	$output[]=array("id"=>$id,"palitext"=>$palitext,"tran"=>$tran,"ref"=>$para_path,"tran_count"=>$tran_count);
+	$output[]=array("id"=>$id,
+							   "palitext"=>$palitext,
+							   "tran"=>$tran,
+							   "ref"=>$para_path,
+							   "tran_count"=>$tran_count,
+							   "book"=>$bookId,
+							   "para"=>$para,
+							   "begin"=>$begin,
+							   "end"=>$end
+							);
 
 }