Browse Source

Merge pull request #163 from visuddhinanda/master

在选经界面增加缅文页码
visuddhinanda 5 years ago
parent
commit
1999ef4d72
5 changed files with 46 additions and 18 deletions
  1. 13 6
      app/collect/index.js
  2. 16 8
      app/pcdl/index.js
  3. 12 0
      app/studio/js/wizard.js
  4. 3 3
      app/studio/pc_get_pali_text.php
  5. 2 1
      app/studio/project.php

+ 13 - 6
app/collect/index.js

@@ -9,9 +9,11 @@ function collect_load(begin = 0) {
       let html = "";
       for (const iterator of arrCollectList.data) {
         html += "<div style='width:25%;padding:0.5em;'>";
-        html += "<div class='card' style='padding:10px;'>";
+        html += '<div style="position: relative;">';
         html +=
-          "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>" + gLocal.gui.ongoing + "</div>";
+          "<div class='' style='position: absolute;background-color: darkred;color: white;padding: 0 6px;right: 0;'>" + gLocal.gui.ongoing + "</div>";
+        html += "</div>";
+        html += "<div class='card' style='padding:10px;'>";
         html += "<div style='font-weight:700'>";
         html +=
           "<a href='../article/?collect=" +
@@ -21,14 +23,19 @@ function collect_load(begin = 0) {
           "</a>";
         html += "</div>";
 
-        html += "<div style=''>" + iterator.subtitle + "</div>";
+        if(iterator.subtitle){
+          html += "<div style=''>" + iterator.subtitle + "</div>";
+        }
 
         html += "<div style=''>" + iterator.username.nickname + "</div>";
+        if(iterator.summary){
+        html += "<div style=''>" + iterator.summary + "</div>";          
+        }
 
-        html += "<div style=''>" + iterator.summary + "</div>";
+        if(iterator.tag){
+          html += "<div style='overflow-wrap: anywhere;'>" + iterator.tag + "</div>";
+        }
 
-        html +=
-          "<div style='overflow-wrap: anywhere;'>" + iterator.tag + "</div>";
         const article_limit = 4;
         let article_count = 0;
         let article_list = JSON.parse(iterator.article_list);

+ 16 - 8
app/pcdl/index.js

@@ -16,9 +16,11 @@ function index_load_collect_new() {
       let html = "";
       for (const iterator of arrCollectList.data) {
         html += "<div style='width:25%;padding:0.5em;'>";
-        html += "<div class='card' style='padding:10px;'>";
+        html += '<div style="position: relative;">';
         html +=
-          "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>" +
+          "<div class='' style='position: absolute;background-color: darkred;color: white;padding: 0 6px;right: 0;'>" + gLocal.gui.ongoing + "</div>";
+        html += "</div>";
+        html += "<div class='card' style='padding:10px;'>";
           gLocal.gui.ongoing + "</div>";
         html += "<div style='font-weight:700'>";
         html +=
@@ -29,14 +31,20 @@ function index_load_collect_new() {
           "</a>";
         html += "</div>";
 
-        html += "<div style=''>" + iterator.subtitle + "</div>";
-
+        if(iterator.subtitle){
+          html += "<div style=''>" + iterator.subtitle + "</div>";
+        }
+        
         html += "<div style=''>" + iterator.username.nickname + "</div>";
 
-        html += "<div style=''>" + iterator.summary + "</div>";
-
-        html +=
-          "<div style='overflow-wrap: anywhere;'>" + iterator.tag + "</div>";
+        if(iterator.summary){
+          html += "<div style=''>" + iterator.summary + "</div>";
+        }
+        
+        if( iterator.tag){
+          html +="<div style='overflow-wrap: anywhere;'>" + iterator.tag + "</div>";
+        }
+        
         const article_limit = 4;
         let article_count = 0;
         let article_list = JSON.parse(iterator.article_list);

+ 12 - 0
app/studio/js/wizard.js

@@ -1091,6 +1091,7 @@ function wizard_palicannon_pali_text_query(bookId){
 	wizard_palicannon_pali_text_xmlhttp.send();
 }
 
+//获取巴利原文
 function wizard_palicannon_pali_text_serverResponse(){
 	if (wizard_palicannon_pali_text_xmlhttp.readyState==4)// 4 = "loaded"
 	{
@@ -1099,10 +1100,21 @@ function wizard_palicannon_pali_text_serverResponse(){
 			var xmlText = wizard_palicannon_pali_text_xmlhttp.responseText;
 			$("#wizard_palicannon_par_select_text_body").html(xmlText);
 			$("#wizard_palicannon_par_select_text_head").show();
+
+			$("a[name]").each(function(){
+				let name = $(this).attr("name");
+				if(name.slice(0,1)=="M"){
+					$(this).css("background-color","rgb(255 255 0 / 42%)");
+					$(this).css("position","absolute");
+					$(this).css("right","0");
+					$(this).html(name);
+				}
+			});			
 		}
 		else
 		{
 			document.getElementById('wizard_palicannon_par_select_text_body').innerHTML="Problem retrieving data:" + wizard_palicannon_pali_text_xmlhttp.statusText;
+
 		}
 	}
 }

+ 3 - 3
app/studio/pc_get_pali_text.php

@@ -15,8 +15,8 @@ include "../public/_pdo.php";
 	//open database
 	PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
 	
-	$query="SELECT paragraph,html FROM pali_text WHERE book = ".$PDO->quote($get_book);
-	$Fetch = PDO_FetchAll($query);
+	$query="SELECT paragraph,html FROM pali_text WHERE book = ?";
+	$Fetch = PDO_FetchAll($query,array($get_book));
 	$iFetch=count($Fetch);
 	if($iFetch>0){
 		for($i=0;$i<$iFetch;$i++){
@@ -25,7 +25,7 @@ include "../public/_pdo.php";
 			echo "<div class=\"wizard_par_tools\">";
 			echo "<div class=\"wizard_par_tools_title\">";
 			echo "<input id='par_enable_$parNumber' onclick='par_enable_change($parNumber,this)' type=\"checkbox\" checked/>";				
-			echo "<a href='#toc_root' name='pali_text_par_$parNumber'>$parNumber</a><span id='par_level_$parNumber' class='par_level'></span>";
+			echo "<a href='../pcdl/reader.php?view=para&book={$get_book}&para={$parNumber}' name='pali_text_par_$parNumber' target='_blank'>$parNumber</a><span id='par_level_$parNumber' class='par_level'></span>";
 			echo "</div>";
 			echo "</div>";
 			echo "<div id=\"wizard_pali_par_text_$parNumber\">".$Fetch[$i]["html"]."</div>";

+ 2 - 1
app/studio/project.php

@@ -145,7 +145,7 @@ switch($op){
 						$para_title["{$paragraph}"][1]=$result["text"];
 					}
 						
-					$db_file = _DIR_PALICANON_TEMPLET_."/p".$res_book."_tpl.db3";					
+					$db_file = _DIR_PALICANON_TEMPLET_."/p".$res_book."_tpl.db3";
 					PDO_Connect("sqlite:$db_file");
 					foreach($aParaList as $iPar){
 						$query="SELECT * FROM 'main' WHERE (\"paragraph\" = ".$PDO->quote($iPar)." ) ";
@@ -378,6 +378,7 @@ switch($op){
 				}
 				else{
 					echo $FetchWBW.$_local->gui->para;
+					echo "<a href='../studio/editor.php?op=openchannal&book=$book&para={$paraList}'>open</a>";
 				}
 				echo '</div>';