소스 검색

pali canon 索引业标签支持层级

visuddhinanda 5 년 전
부모
커밋
e02c5b0223
7개의 변경된 파일249개의 추가작업 그리고 183개의 파일을 삭제
  1. 7 5
      app/course/course.php
  2. 8 11
      app/course/my_lesson_edit.php
  3. 11 3
      app/course/my_lesson_update.php
  4. 62 25
      app/palicanon/index.php
  5. 139 139
      app/public/book_tag/en.json
  6. 20 0
      app/public/book_tag/tag_list.json
  7. 2 0
      app/studio/index.php

+ 7 - 5
app/course/course.php

@@ -73,14 +73,16 @@ echo '</div>';
         echo '<div style="flex:7;">';
         echo '<div class="pd-10">';
         echo '<div class="title" style="padding-bottom:5px;font-size:100%;font-weight:600;">'.$row["title"].'</div>';
-        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["subtitle"].'</div>';
         echo '<div class="summary"  style="padding-bottom:5px;">'.$row["summary"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["live"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["replay"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["attachment"].'</div>';
         echo '</div>'; 
         echo '</div>';
 
         echo '<div style="flex:3;max-width:15em;">';
         echo '<div >开始:'.date("Y/m/d h:ia",$row["date"]/1000) .'</div>';
-        $dt = $row["duration"];
+        $dt = $row["duration"]/60;
         $sdt = "";
         if($dt>59){
             $sdt .= floor($dt/60)."小时";
@@ -96,12 +98,12 @@ echo '</div>';
             $lesson_time = "尚未开始";
         }
         else if($now>$row["date"] && $now<($row["date"]+$dt*1000)){
-            $lesson_time = "已经结束";
+            $lesson_time = "正在进行";
         }
         else{
-            $lesson_time = "正在进行";
+            $lesson_time = "已经结束";
         }
-        echo '<div ><span class="lesson_status">已经结束</span></div>';
+        echo '<div ><span class="lesson_status">'.$lesson_time.'</span></div>';
         echo '</div>';
 
         echo '</div>';

+ 8 - 11
app/course/my_lesson_edit.php

@@ -68,11 +68,6 @@ echo '<form action="../course/my_course_index.php" onsubmit="return lesson_valid
 echo '<input type="hidden" name="lesson" value="'.$lesson_info["id"].'" />';
 echo '<input type="hidden" name="op" value="update" />';
 echo '<div id="userfilelist">';
-    echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'封面'.'</div>';
-    echo '<div id="img_cover" style="flex:8;">'.$cover_html.'</div>';
-    echo "<input id = 'cover_id' type='hidden' name = 'cover' value='{$lesson_info["cover"]}'>";
-    echo '</div>';
 
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.'标题'.'</div>';
@@ -88,17 +83,19 @@ echo '<div id="userfilelist">';
     echo '<div style="flex:8;"><input type="input" name = "subtitle" value="'.$lesson_info["subtitle"].'" /></div>';
     echo '</div>';
     $strDate = date("Y-m-d",$lesson_info["date"]/1000);
+    $strTime = date("H:i",$lesson_info["date"]/1000);
+    $strDuration = date("H:i",$lesson_info["duration"]);
     echo 'Date: <input type="date" name="lesson_date" value="'.$strDate.'"/>';
-    echo 'Time: <input type="time" name="lesson_time" />';
-    echo 'Duration: <input type="time" name="lesson_duration" />';
+    echo 'Time: <input type="time" name="lesson_time" value="'.$strTime.'"/>';
+    echo 'Duration: <input type="time" name="duration" value="'.$strDuration.'"/>';
 
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'直播链接'.'</div>';
-    echo '<div style="flex:8;"><textarea name="link" style="height:6em;">'.$lesson_info["link"].'</textarea></div>';
+    echo '<div style="flex:2;">'.'直播'.'</div>';
+    echo '<div style="flex:8;"><textarea name="live" style="height:6em;">'.$lesson_info["live"].'</textarea></div>';
     echo '</div>';
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'录播链接'.'</div>';
-    echo '<div style="flex:8;"><textarea name="link1" style="height:6em;">'.$lesson_info["link"].'</textarea></div>';
+    echo '<div style="flex:2;">'.'录播'.'</div>';
+    echo '<div style="flex:8;"><textarea name="replay" style="height:6em;">'.$lesson_info["replay"].'</textarea></div>';
     echo '</div>';
 
 

+ 11 - 3
app/course/my_lesson_update.php

@@ -6,10 +6,13 @@ require_once '../public/function.php';
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
-$query="UPDATE lesson SET title = ? , subtitle = ? , link = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
+$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
 $sth = $PDO->prepare($query);
-
-$sth->execute(array($_POST["title"] , $_POST["subtitle"] , $_POST["link"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
+$data = strtotime($_POST["lesson_date"]);
+$time = strtotime($_POST["lesson_time"]) - strtotime("today");
+$datatime = ($data+$time)*1000;
+$duration = strtotime($_POST["duration"]) - strtotime("today");
+$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();
@@ -21,6 +24,11 @@ else{
 	$respond['status']=0;
 	$respond['message']="成功";
 	echo "<div style=''>Lesson 数据修改成功</div>";
+	echo $d=strtotime("today");
+
+	echo  strtotime($_POST["lesson_date"])."<br>";
+	echo  strtotime($_POST["lesson_time"])."<br>";
+	echo  (strtotime($_POST["duration"]) - $d)."<br>";
 }
 //echo json_encode($respond, JSON_UNESCAPED_UNICODE);
 ?>

+ 62 - 25
app/palicanon/index.php

@@ -14,14 +14,14 @@ include "../pcdl/html_head.php";
     }
     #main_tag span{
         margin: 2px;
-    padding: 2px 12px;
-    font-weight: 500;
-    transition-duration: 0.2s;
-    cursor: pointer;
-    display: inline-flex;
-    align-items: center;
-    flex-wrap: nowrap;
-    justify-content: center;
+        padding: 2px 12px;
+        font-weight: 500;
+        transition-duration: 0.2s;
+        cursor: pointer;
+        display: inline-flex;
+        align-items: center;
+        flex-wrap: nowrap;
+        justify-content: center;
         font-size:110%;
         border: unset;
         border-radius: 0;
@@ -47,7 +47,11 @@ include "../pcdl/html_head.php";
     tag .icon:hover{
         background-color: silver;
     }
+    var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
 </style>
+<script>
+    var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
+</script>
 <?php
 //
 
@@ -56,8 +60,6 @@ require_once "../public/_pdo.php";
 require_once '../media/function.php';
 require_once '../public/function.php';
 
-
-
 echo "<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 10px 10px;'>";
 echo "<div class='index_inner '>";
 echo "<div style='font-size:140%'>";
@@ -71,8 +73,16 @@ echo '<span tag="aṭṭhakathā">Aṭṭhakathā</span>';
 echo '<span tag="ṭīkā">ṭīkā</span>';
 echo '<span tag="añña">añña</span>';
 echo '</div>';
-echo '<div id="tag_selected" class="summary"  style="padding-bottom:5px;margin:0.5em 0;"></div>';
-echo '<div id="tag_others" class="summary"  style="padding-bottom:5px;"></div>';
+echo '<div id="tag_selected" class=""  style="padding-bottom:5px;margin:0.5em 0;"></div>';
+echo '<div level="0" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="1" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="2" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="3" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="4" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="5" class="tag_others"  style="padding-bottom:5px;"></div>';
+
+echo '<div level="100" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="8" class="tag_others"  style="padding-bottom:5px;"></div>';
 echo "</div>";
 echo '</div>';
 ?>
@@ -83,7 +93,8 @@ echo '</div>';
 <script>
     var main_tag="";
     var list_tag=new Array();
-    
+    var currTagLevel0= new Array();
+
     $("span[tag]").click(function(){
         $(this).siblings().removeClass("select");
         $(this).addClass("select");
@@ -111,13 +122,7 @@ echo '</div>';
                 let html="";
                 allTags = new Array();
                 for (const iterator of arrBookList) {
-                    html += "<div style='width:25%;padding:0.5em;'>";
-                    html += "<div class='card' style='padding:10px;'>";
-                    html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
-                    html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
-                    html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
-                    html += "</div>";
-                    html += "</div>";
+                    let tag0="";
                     let tags = iterator[0].tag.split("::");
                     let currTag = new Array();
                     currTag[main_tag] = 1;
@@ -131,7 +136,9 @@ echo '</div>';
                         if(tag.slice(-1)==":"){
                             tag = tag.slice(0,-1);
                         }
-
+                        if(currTagLevel0.hasOwnProperty(tag)){
+                            tag0 = tag;
+                        }
                         if(!currTag.hasOwnProperty(tag)){
                             if(allTags.hasOwnProperty(tag) ){
                                 allTags[tag] += 1;
@@ -141,7 +148,26 @@ echo '</div>';
                             } 
                         }
                     }
+
+                    html += "<div style='width:25%;padding:0.5em;'>";
+                    html += "<div class='card' style='padding:10px;'>";
+                    html += "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>"+tag0+"</div>";
+                    html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
+                    html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
+                    html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
+                    html += "</div>";
+                    html += "</div>";
+
                 }
+
+                let newTags = new Array();
+                for (const oneTag in allTags) {
+                    if(allTags[oneTag]<arrBookList.length){
+                        newTags[oneTag] = allTags[oneTag];
+                    }
+                    
+                }
+                allTags = newTags;
                 allTags.sort(sortNumber);
                 tag_render_others();
                 $("#book_list").html(html);
@@ -152,24 +178,35 @@ echo '</div>';
 $("#tag_input").keypress(function(){
     tag_render_others();
 });
+
   function tag_render_others(){
     let strOthersTag = "";
+    currTagLevel0= new Array();
+    $(".tag_others").html("");
     for (const key in allTags) {
         if (allTags.hasOwnProperty(key)) {
             if($("#tag_input").val().length>0){
                 if(key.indexOf($("#tag_input").val())>=0){
-                    strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+                    strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
                 }
             }
             else{
-                strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+                strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
             }
-            
+            let thisLevel = 100;
+            if(tag_level.hasOwnProperty(key)){
+                thisLevel = tag_level[key].level;
+                if(tag_level[key].level==0){
+                    currTagLevel0[key] = 1;
+                }
+            }
+            $(".tag_others[level='"+thisLevel+"']").html($(".tag_others[level='"+thisLevel+"']").html()+strOthersTag);
         }
     }
-    $("#tag_others").html(strOthersTag);
+   
 
   }
+
   function tag_click(tag){
     list_tag.push(tag);
     render_tag_list();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 139 - 139
app/public/book_tag/en.json


+ 20 - 0
app/public/book_tag/tag_list.json

@@ -0,0 +1,20 @@
+{
+  "sutta": { "level": 0 },
+  "vinaya": { "level": 0 },
+  "abhidhamma": { "level": 0 },
+  "mūla": { "level": 0 },
+  "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 },
+  "mahāvibhaṅga": { "level": 1 },
+  "Bhikkhunīvibhaṅga": { "level": 1 },
+  "mahāvaggapāḷi": { "level": 1 },
+  "Cūḷavaggapāḷi": { "level": 1 },
+  "vibhaṅga": { "level": 1 },
+  "Theragāthā": { "level": 2 }
+}

+ 2 - 0
app/studio/index.php

@@ -488,6 +488,7 @@ file_list();
 </script>
 		
 <script>
+/*
 		$.get('../uwbw/update_analytics.php', function (csvStr) {
 			csvStr = csvStr.replace(/\n\n/g, '\n');
 			Highcharts.chart('container', {
@@ -596,6 +597,7 @@ file_list();
 			}]
 			});
 		});
+		*/
         </script>
 	</div>
 	

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.