فهرست منبع

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

Bhikkhu-Kosalla 5 سال پیش
والد
کامیت
334c10dc08

+ 38 - 13
app/channal/channal.js

@@ -79,6 +79,9 @@ function my_channal_list() {
 	);
 }
 
+/*
+编辑channel信息
+*/
 function my_channal_edit(id) {
 	$.get(
 		"../channal/my_channal_get.php",
@@ -95,9 +98,14 @@ function my_channal_edit(id) {
 					html += '<div class="" style="padding:5px;">';
 					html += '<div style="max-width:2em;flex:1;"></div>';
 					html += "</div>";
-					html += "<div style='display:flex;height: 20em;'>";
-					html += "<div style='flex:4;padding: 1em;'>";
+
+					html += "<div style='width: 60%;padding: 1em;min-width: 25em;'>";
+					html += '<div style="display:flex;line-height:32px;">';
+					html += "<div style='flex:2;'>" + gLocal.gui.title + "</div>";
+					html += "<div style='flex:8;'>";
 					html += "<input type='hidden' name='id' value='" + result.id + "'/>";
+					html += "</div>";
+					html += "</div>";
 
 					html += '<div style="display:flex;line-height:32px;">';
 					html += '<div style="flex:2;">'+gLocal.gui.name+'</div>';
@@ -105,13 +113,13 @@ function my_channal_edit(id) {
 					html +=
 						"<input type='input' name='name' value='" +
 						result.name +
-						"' maxlength='32' placeholder='📝≤32'/>";
+						"' maxlength='32' placeholder='channel title'/>";
 					html += "</div>";
 					html += "</div>";
 
-					html += '<div style="display:flex;line-height:32px;">';
-					html += '<div style="flex:2;">'+gLocal.gui.introduction+'</div>';
-					html += '<div style="flex:8;">';
+					html += "<div style='display:flex;'>";
+					html += "<div style='flex:2;'>" + gLocal.gui.introduction + "</div>";
+					html += "<div style='flex:8;'>";
 					html += "<textarea name='summary'>" + result.summary + "</textarea>";
 					html += "</div>";
 					html += "</div>";
@@ -120,7 +128,9 @@ function my_channal_edit(id) {
 					html += '<div style="flex:2;">'+gLocal.gui.language_select+'</div>';
 					html += '<div style="flex:8;">';
 					html +=
-						'<input id="channal_lang_select" type="input"  onchange="channal_lang_change()"  title="type language name/code" code="' +
+						'<input id="channal_lang_select" type="input"  onchange="channal_lang_change()"' +
+						' placeholder = "try type chinese or en " ' +
+						'  title="type language name/code" code="' +
 						result.lang +
 						'" value="' +
 						result.lang +
@@ -134,20 +144,23 @@ function my_channal_edit(id) {
 					html += '<div style="flex:2;">'+gLocal.gui.privacy+'</div>';
 					html += '<div style="flex:8;">';
 					let arrStatus = [
-						{ id: 0, string: gLocal.gui.disable },
-						{ id: 10, string: gLocal.gui.private },
-						{ id: 30, string: gLocal.gui.public },
+						{ id: 0, string: gLocal.gui.disable, note: gLocal.gui.disable_note },
+						{ id: 10, string: gLocal.gui.private, note: gLocal.gui.private_note },
+						{ id: 30, string: gLocal.gui.public, note: gLocal.gui.public_note },
 					];
-					html += "<select id = 'status'  name = 'status'>";
+					html += "<select id = 'status'  name = 'status' onchange='status_change(this)'>";
+					let status_note = "";
 					for (const iterator of arrStatus) {
 						html += "<option ";
 						if (parseInt(result.status) == iterator.id) {
 							html += " selected ";
+							status_note = iterator.note;
 						}
 						html += " value='" + iterator.id + "'>" + iterator.string + "</option>";
 					}
 
 					html += "</select>";
+					html += "<span id = 'status_help' style='margin: 0 1em;'>" + status_note + "</span><a href='#' target='_blank'>["+gLocal.gui.infomation+"]</li>";
 					html += "</div>";
 					html += "</div>";
 					html += "</div>";
@@ -156,8 +169,6 @@ function my_channal_edit(id) {
 					html += "<div id='preview_inner' ></div>";
 					html += "</div>";
 
-					html += "</div>";
-
 					$("#channal_info").html(html);
 					tran_lang_select_init("channal_lang_select");
 					//$("#aritcle_status").html(render_status(result.status));
@@ -173,6 +184,20 @@ function my_channal_edit(id) {
 	);
 }
 
+function status_change(obj) {
+	let arrStatus = [
+		{ id: 0, string: gLocal.gui.disable, note: gLocal.gui.disable_note },
+		{ id: 10, string: gLocal.gui.private, note: gLocal.gui.private_note },
+		{ id: 30, string: gLocal.gui.public, note: gLocal.gui.public_note },
+	];
+	let newStatus = $(obj).val();
+	for (const iterator of arrStatus) {
+		if (parseInt(newStatus) == iterator.id) {
+			$("#status_help").html(iterator.note);
+		}
+	}
+}
+
 function channal_lang_change() {
 	let lang = $("#channal_lang_select").val();
 	if (lang.split("_").length == 3) {

+ 1 - 1
app/channal/my_channal_edit.php

@@ -82,7 +82,7 @@ require_once '../studio/index_head.php';
 			</div>
 		</div>
 
-		<div id="channal_info"  class="file_list_block" style="">
+		<div id="channal_info"  class="file_list_block" style="height: 28em;">
 
 		</div>
 

+ 3 - 3
app/collect/index.php

@@ -95,7 +95,7 @@ include "../pcdl/html_head.php";
         .collect_title {
             font-size: 20px;
             font-weight: 700;
-
+            width: calc(100% - 30px);
         }
 
         .subtitle {
@@ -213,8 +213,8 @@ include "../pcdl/html_head.php";
     ?>
     <div id='course_head_bar' class='collect_head_bar'>
         <div class='section_inner'>
-            <h1><?php echo $_local->gui->composition;?></h1>
-            <div style='width:30em'><?php echo $_local->gui->composition_intro;?></div>
+            <h1><?php echo $_local->gui->composition; ?></h1>
+            <div style='max-width:30em'><?php echo $_local->gui->composition_intro; ?></div>
             <!--
             <div id="main_tag">
                 <span tag="vinaya">sīla</span>

+ 1 - 0
app/public/lang/default.json

@@ -570,6 +570,7 @@
 		"show_nissaya": "show nissaya",
 		"related_para": "related&nbsp;paragraph",
 		"disable": "disable",
+		"disable_note": "disable & invisible to anyone including myself",
 		"not_found": "not&nbsp;found",
 		"": ""
 	},

+ 1 - 0
app/public/lang/en.json

@@ -569,6 +569,7 @@
 		"show_nissaya": "show nissaya",
 		"related_para": "related&nbsp;paragraph",
 		"disable": "disable",
+		"disable_note": "disable & invisible to anyone including myself",
 		"not_found": "not&nbsp;found",
 		"": ""
 	},

+ 1 - 0
app/public/lang/my.json

@@ -569,6 +569,7 @@
 		"show_nissaya": "show nissaya",
 		"related_para": "related&nbsp;paragraph",
 		"disable": "disable",
+		"disable_note": "disable & invisible to anyone including myself",
 		"not_found": "not&nbsp;found",
 		"": "",
 		"": ""

+ 1 - 0
app/public/lang/si.json

@@ -574,6 +574,7 @@
 		"show_nissaya": "show nissaya",
 		"related_para": "related&nbsp;paragraph",
 		"disable": "disable",
+		"disable_note": "disable & invisible to anyone including myself",
 		"not_found": "not&nbsp;found",
 		"": "",
 		"": ""

+ 4 - 3
app/public/lang/zh-cn.json

@@ -526,11 +526,11 @@
 		"blank": "空白",
 		"vocabulary_list": "词汇列表",
 		"private": "私享",
-		"private_note": "仅自己可见,不订阅,不可搜索",
+		"private_note": "仅自己可见,不支持订阅,不可搜索",
 		"unlisted": "不公开列出",
-		"unlisted_note": "可通过链接访问,不推订阅,不可搜索",
+		"unlisted_note": "可通过链接访问,不支持订阅,其他人搜索不到",
 		"public": "公开",
-		"public_note": "可通过链接访问,订阅,可搜索",
+		"public_note": "可通过链接访问,支持订阅,可搜索",
 		"copy_link": "复制链接",
 		"saved": "已保存",
 		"title_necessary": "必须填写标题",
@@ -571,6 +571,7 @@
 		"show_nissaya": "显示nissaya",
 		"related_para": "相应段落",
 		"disable": "停用",
+		"disable_note": "停用,即使自己也无法更新",
 		"not_found": "未找到",
 		"site_intro": "想学巴利不知从何开始<br>学过巴利语法但是面对圣典无从下手<br>想要翻译巴利但面临种种困难<br>我们都有相关工具为您提供支持<br>降低巴利语的阅读门槛",
 

+ 1 - 0
app/public/lang/zh-tw.json

@@ -570,6 +570,7 @@
 		"show_nissaya": "显示nissaya",
 		"related_para": "相應段落",
 		"disable": "停用",
+		"disable_note": "停用",
 		"not_found": "未找到",
 		"site_intro": "想學巴利不知從何開始<br>學過巴利語法但是面對聖典無從下手<br>想要翻譯巴利但面臨種種困難<br>我們都有相關工具為您提供支援<br>降低巴利語的閱讀門檻",
 		"": ""

+ 40 - 5
app/usent/get.php

@@ -1,23 +1,56 @@
 <?php
 /*
-get xml doc from db
+获取句子译文
 */
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once "../public/function.php";
 
+	#查询有阅读权限的channel
+	$channal_list = array();
+	if(isset($_COOKIE["userid"])){
+		PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
+		$query = "SELECT id from channal where owner = ?   limit 0,100";
+		$Fetch_my = PDO_FetchAll($query,array($_COOKIE["userid"]));
+		foreach ($Fetch_my as $key => $value) {
+			# code...
+			$channal_list[]=$value["id"];
+		}
 
+		# 找协作的
+		$Fetch_coop = array();
+		$query = "SELECT channal_id FROM cooperation WHERE  user_id = ? ";
+		$coop_channal = PDO_FetchAll($query,array($_COOKIE["userid"]));
+		if(count($coop_channal)>0){
+			foreach ($coop_channal as $key => $value) {
+				# code...
+				$channal_list[]=$value["channal_id"];
+			}
+		}
+		/*  创建一个填充了和params相同数量占位符的字符串 */
+
+	}
+	if(count($channal_list)>0){
+		$channel_place_holders = implode(',', array_fill(0, count($channal_list), '?'));
+		$channel_query = " OR channal IN ($channel_place_holders)";
+	}
+	else{
+		$channel_query = "";
+	}
+
+	# 查询有阅读权限的channel 结束
 
 $dns = "sqlite:"._FILE_DB_SENTENCE_;
 $dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
 /* 开始一个事务,关闭自动提交 */
-$query="SELECT * FROM sentence WHERE 0";
+
 if(isset($_GET["sentences"])){
+	#查询句子编号列表
     $arrSent = explode(",",$_GET["sentences"]);
     /*  创建一个填充了和params相同数量占位符的字符串 */
     $place_holders = implode(',', array_fill(0, count($arrSent), '?'));
-    $query="SELECT * FROM sentence WHERE id IN ($place_holders)";
+    $query="SELECT * FROM sentence WHERE id IN ($place_holders) and (status = 30 {$channel_query} )";
     $stmt = $dbh->prepare($query);
     $stmt->execute($arrSent);
 }
@@ -26,9 +59,11 @@ else{
     $para = $_GET["para"];
     $begin = $_GET["begin"];
     $end = $_GET["end"];
-    $query="SELECT * FROM sentence WHERE (book = ?  AND paragraph = ? AND begin = ? AND end = ? and text <> '' ) order by modify_time DESC  ";
+    $query="SELECT * FROM sentence WHERE (book = ?  AND paragraph = ? AND begin = ? AND end = ? and strlen >0 and (status = 30 {$channel_query} ) ) order by modify_time DESC  ";
     $stmt = $dbh->prepare($query);
-    $stmt->execute(array($book,$para,$begin,$end));
+    $parm = array($book,$para,$begin,$end);
+    $parm = array_merge_recursive($parm,$channal_list);
+    $stmt->execute($parm);
 }
 
 $Fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);