فهرست منبع

channal 列表增加其他空白channal

visuddhinanda 5 سال پیش
والد
کامیت
982b8f9460

+ 3 - 2
app/article/index.php

@@ -6,6 +6,7 @@ require_once "../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="../channal/channal.js"></script>
 	<script src="./article.js"></script>
 	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
 	<link type="text/css" rel="stylesheet" href="../term/term.css"/>
@@ -346,12 +347,12 @@ term_word_link_fun("wiki_goto_word");
 	<div id="right_pannal">
 		<div class="fun_frame">
 			<div id = "collect_title" class="title">Table of Content</div>
-			<div id = "toc_content" class="content" style="max-height:10em;">
+			<div id = "toc_content" class="content" style="max-height:20em;">
 			</div>
 		</div>
 		<div class="fun_frame">
 			<div class="title">Translations</div>
-			<div id="channal_list" class="content" style="max-height:10em;">
+			<div id="channal_list" class="content" style="max-height:20em;">
 			</div>
 		</div>
 	</div>

+ 3 - 1
app/channal/channal.js

@@ -1,4 +1,5 @@
 var _my_channal = null;
+channal_list();
 
 function channal_list_init() {
   my_channal_list();
@@ -25,7 +26,7 @@ function channal_getById(id) {
 
 function my_channal_list() {
   $.get(
-    "../channal/my_channal_get.php",
+    "../channal/get.php",
     {
       setting: "",
     },
@@ -41,6 +42,7 @@ function my_channal_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.name + "</div>";
+            html += "<div style='flex:2;'>" + iterator.owner + "</div>";
             html +=
               "<div style='flex:2;'>" +
               //render_status(iterator.status) +

+ 35 - 5
app/channal/get.php

@@ -3,11 +3,41 @@
 
 require_once "../path.php";
 require_once "../public/_pdo.php";
+require_once '../ucenter/function.php';
+
+$_userinfo = new UserInfo();
 
-global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
-$query = "select * from channal where owner = '{$_COOKIE["userid"]}'   limit 0,100";
-$Fetch = PDO_FetchAll($query);
-echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+$query = "SELECT * from channal where owner = ?   limit 0,100";
+$Fetch_my = PDO_FetchAll($query,array($_COOKIE["userid"]));
+
+# 找协作的
+$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[]=$value["channal_id"];
+    }
+    /*  创建一个填充了和params相同数量占位符的字符串 */
+    $place_holders = implode(',', array_fill(0, count($channal), '?'));
+    $query = "SELECT * FROM channal WHERE id IN ($place_holders) order by owner";
+    $Fetch_coop = PDO_FetchAll($query,$channal);
+}
+$all = array_merge_recursive($Fetch_my,$Fetch_coop);
+$output = array();
+foreach ($all as $key => $value) {
+    # code...
+    $new = $value;
+    $name = $_userinfo->getName($value["owner"]);
+    $new["username"] = $name["username"];
+	$new["nickname"] = $name["nickname"];
+	$new["count"] = 0;
+    $new["all"] = 1;
+    $output[]=$new;
+}
+
+echo json_encode($output, JSON_UNESCAPED_UNICODE);
 
-?>				
+?>

+ 0 - 1
app/channal/my_channal_get.php

@@ -16,7 +16,6 @@ if(isset($_GET["id"])){
 }
 else{
     PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
-    $id=$_GET["id"];
     $query = "SELECT * FROM channal  WHERE owner = ? ";
     $Fetch = PDO_FetchAll($query,array($_COOKIE["userid"]));
     echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);

+ 1 - 1
app/channal/my_channal_index.php

@@ -36,7 +36,7 @@ require_once '../studio/index_head.php';
 
 	<div>
 		<span class="icon_btn_div">
-			<span class="icon_btn_tip"><?php echo $_local->gui->add;?></span>
+			<span class="icon_btn_tip"><?php echo "Add";?></span>
 			<button id="file_add" type="button" class="icon_btn" title=" "  onclick="channal_add_dlg_show()">
 				<svg class="icon">
 					<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>

+ 33 - 3
app/studio/js/render.js

@@ -1860,7 +1860,7 @@ function render_tran_sent_block(
   let id =
     "tran_pre_" + book + "_" + para + "_" + begin + "_" + end + "_" + channal;
   output +=
-    "<div class='trans_text_content' id = '" +
+    "<div class='trans_text_content' tid = '" +
     id +
     "'  pcds='sent-net' " +
     " book='" +
@@ -1878,7 +1878,9 @@ function render_tran_sent_block(
     output += sent_text;
   } else {
     output +=
-      "<span onclick=\"sent_edit_click('" +
+      "<span id='" +
+      id +
+      "' onclick=\"sent_edit_click('" +
       book +
       "','" +
       para +
@@ -1912,6 +1914,17 @@ function render_tran_sent_block(
       " onkeyup = \"updateTranslationPreview('" +
       id +
       "',this)\" " +
+      " onchange=\"trans_text_save('" +
+      book +
+      "','" +
+      para +
+      "','" +
+      begin +
+      "','" +
+      end +
+      "','" +
+      channal +
+      "')\"" +
       "class='trans_sent_edit' style='background-color: #f8f8fa;color: black;border-color: silver;' " +
       "sent_id='" +
       objSent.id +
@@ -1948,6 +1961,19 @@ function render_tran_sent_block(
       "','" +
       channal +
       "')\">保存</button>";
+    output +=
+      "<button onclick=\"trans_text_send('" +
+      book +
+      "','" +
+      para +
+      "','" +
+      begin +
+      "','" +
+      end +
+      "','" +
+      channal +
+      "')\">发送</button>";
+
     output += "</div>";
     output += "</div>";
   }
@@ -4140,8 +4166,12 @@ function repeat_combine(list) {
 }
 
 function show_pop_note(wordid) {
+  let html = $("wnc[wid='" + wordid + "']")
+    .parent()
+    .html();
   $("#word_note_pop_content").html(
-    note_init(doc_word("#" + wordid).val("note"))
+    html
+    /*note_init(doc_word("#" + wordid).val("note"))*/
   );
   $("#word_note_pop").show("500");
 }

+ 9 - 4
app/term/channal_list.php

@@ -45,9 +45,12 @@ foreach ($_data as $key => $value) {
 		$Fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
 		foreach ($Fetch as $key => $value) {
             # code...
-            if(!empty($value["channal"])){
-                $channal[$value["channal"]] = 1;
-            }
+            if(isset($value["channal"])){
+                $channal[$value["channal"]] ++;
+			}
+			else{
+				$channal[$value["channal"]] = 1;
+			}
             
         }
 	}
@@ -65,7 +68,9 @@ foreach ($channal as $key => $value) {
     $channalInfo = $_channal->getChannal($key);
     $name = $_userinfo->getName($channalInfo["owner"]);
     $channalInfo["username"] = $name["username"];
-    $channalInfo["nickname"] = $name["nickname"];
+	$channalInfo["nickname"] = $name["nickname"];
+	$channalInfo["count"] = $value;
+	$channalInfo["all"] = count($_data);
     $output[]= $channalInfo;
 }
 

+ 32 - 3
app/term/note.js

@@ -217,11 +217,32 @@ function note_channal_list() {
       function (data, status) {
         if (status == "success") {
           try {
-            _channalData = JSON.parse(data);
+            let active = JSON.parse(data);
+            _channalData = active;
+            for (const iterator of _my_channal) {
+              let found = false;
+              for (const one of active) {
+                if (iterator.id == one.id) {
+                  found = true;
+                  break;
+                }
+              }
+              if (found == false) {
+                _channalData.push(iterator);
+              }
+            }
             let strHtml = "";
             for (const iterator of _channalData) {
-              strHtml += render_channal_list(iterator);
+              if (_channal.indexOf(iterator.id) >= 0) {
+                strHtml += render_channal_list(iterator);
+              }
             }
+            for (const iterator of _channalData) {
+              if (_channal.indexOf(iterator.id) == -1) {
+                strHtml += render_channal_list(iterator);
+              }
+            }
+
             $("#channal_list").html(strHtml);
             $("[channal_id]").change(function () {
               let channal_list = new Array();
@@ -268,7 +289,7 @@ function render_channal_list(channalinfo) {
   output += "</span>";
   output += "</div>";
 
-  output += "<div>";
+  output += "<div style='width: 100%;'>";
 
   output += "<div>";
 
@@ -285,7 +306,15 @@ function render_channal_list(channalinfo) {
   output += "<div>";
   output += "@" + channalinfo["username"];
   output += "</div>";
+  output += "<div style='background-color: #e0dfdffa;'>";
+  output +=
+    "<span  style='display: inline-block;background-color: #65ff65;width: " +
+    (channalinfo["count"] * 100) / channalinfo["all"] +
+    "%;'>";
+  output += channalinfo["count"] + "/" + channalinfo["all"];
+  output += "</span>";
 
+  output += "</div>";
   output += "</div>";
   output += "</div>";
   return output;