visuddhinanda 5 лет назад
Родитель
Сommit
4f1783ba9a

+ 2 - 1
app/article/article_add_dlg.js

@@ -9,7 +9,8 @@ function article_add_dlg_init(div) {
   html += "</div>";
   html += "<div>";
   html += "</div>";
-  html += "<div style='display:flex;'>";
+  html +=
+    "<div style='display:flex;justify-content: space-between;padding-top: 1em;'>";
   html += "<button onclick='article_add_cancel()'>Cancel</button>";
   html += "<button onclick='article_add_new()'>New</button>";
   html += "</div>";

+ 60 - 0
app/article/collect_add_dlg.js

@@ -0,0 +1,60 @@
+var _collect_add_dlg_div;
+function collect_add_dlg_init(div) {
+  _collect_add_dlg_div = div;
+  let html = "";
+  html += "<div id='collect_add_dlg'>";
+  html += "<div >";
+  html += "<div >Collect Title</div>";
+  html += "<input type='input' id='collect_add_title' />";
+  html += "</div>";
+  html += "<div>";
+  html += "</div>";
+  html +=
+    "<div style='display:flex;justify-content: space-between;padding-top: 1em;'>";
+  html += "<div>";
+  html += "<select id='collect_add_dlg_status'>";
+  html += "<option value='1'>私有</option>";
+  html += "<option value='2'>不公开列出</option>";
+  html += "<option value='3'>公开</option>";
+  html += "</select>";
+
+  html += "</div>";
+  html += "<div>";
+  html += "<button onclick='collect_add_cancel()'>Cancel</button>";
+  html += "<button onclick='collect_add_new()'>New</button>";
+  html += "</div>";
+  html += "</div>";
+  html += "</div>";
+
+  $("#" + div).append(html);
+}
+
+function collect_add_dlg_show() {
+  $("#" + _collect_add_dlg_div).show();
+}
+function collect_add_dlg_hide() {
+  $("#" + _collect_add_dlg_div).hide();
+}
+function collect_add_cancel() {
+  collect_add_dlg_hide();
+  $("#collect_add_title").val("");
+}
+
+function collect_add_new() {
+  $.post(
+    "../article/my_collect_put.php",
+    {
+      title: $("#collect_add_title").val(),
+      status: $("#collect_add_dlg_status").val(),
+    },
+    function (data) {
+      let error = JSON.parse(data);
+      if (error.status == 0) {
+        alert("ok");
+        collect_add_cancel();
+      } else {
+        alert(error.message);
+      }
+    }
+  );
+}

+ 2 - 2
app/article/get.php

@@ -10,8 +10,8 @@ require_once '../ucenter/function.php';
 if(isset($_GET["id"])){
     PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
     $id=$_GET["id"];
-    $query = "select * from article  where id = ".$PDO->quote($id);
-    $Fetch = PDO_FetchRow($query);
+    $query = "SELECT * FROM article  WHERE id = ? ";
+    $Fetch = PDO_FetchRow($query,array($id));
     if($Fetch){
         $userinfo = new UserInfo();
         $user = $userinfo->getName($Fetch["owner"]);

+ 0 - 2
app/article/my_article.js

@@ -103,7 +103,6 @@ function my_article_edit(id) {
             "<input type='hidden' name='summary' value='" +
             result.summary +
             "'/>";
-          html += "<input type='hidden' name='id' value='" + result.id + "'/>";
           html +=
             "<input type='hidden' name='status' value='" +
             result.status +
@@ -155,7 +154,6 @@ function article_preview() {
 
 function my_article_save() {
   $.ajax({
-    //几个参数需要注意一下
     type: "POST", //方法类型
     dataType: "json", //预期服务器返回的数据类型
     url: "../article/my_article_post.php", //url

+ 185 - 1
app/article/my_collect.js

@@ -1,3 +1,7 @@
+function my_collect_init() {
+  my_collect_list();
+  collect_add_dlg_init("collect_add_div");
+}
 function my_collect_list() {
   $.get(
     "../article/collect_list.php",
@@ -23,7 +27,7 @@ function my_collect_list() {
               "</div>";
             html += "<div style='flex:1;'>Copy Link</div>";
             html +=
-              "<div style='flex:1;'><a href='../article/my_article_edit.php?id=" +
+              "<div style='flex:1;'><a href='../article/my_collect_edit.php?id=" +
               iterator.id +
               "'>Edit</a></div>";
             html +=
@@ -43,3 +47,183 @@ function my_collect_list() {
     }
   );
 }
+var _arrArticleList;
+var _arrArticleOrder = new Array();
+function my_collect_edit(id) {
+  $.get(
+    "../article/collect_get.php",
+    {
+      id: id,
+      setting: "",
+    },
+    function (data, status) {
+      if (status == "success") {
+        try {
+          let html = "";
+          let result = JSON.parse(data);
+          $("#article_collect").attr("a_id", result.id);
+          html += '<div class="" style="padding:5px;">';
+          html += '<div style="max-width:2em;flex:1;"></div>';
+          html += "<input type='hidden' name='id' value='" + result.id + "'/>";
+          html +=
+            "<input type='hidden' name='subtitle' value='" +
+            result.subtitle +
+            "'/>";
+          html +=
+            "<input type='hidden' name='summary' value='" +
+            result.summary +
+            "'/>";
+          html +=
+            "<input type='hidden' name='status' value='" +
+            result.status +
+            "'/>";
+          html +=
+            "<input type='hidden' name='lang' value='" + result.lang + "'/>";
+          html +=
+            "<input id='form_article_list' type='hidden' name='article_list' value='" +
+            result.article_list +
+            "'/>";
+          html += "</div>";
+          html += "<div style='display:flex;'>";
+          html += "<div style='flex:4;'>";
+
+          _arrArticleList = JSON.parse(result.article_list);
+          html += "<ul id='ul_article_list'>";
+          for (let index = 0; index < _arrArticleList.length; index++) {
+            const element = _arrArticleList[index];
+            html += my_collect_render_article(index, element);
+            _arrArticleOrder.push(index);
+          }
+
+          html += "</ul>";
+
+          html += "</div>";
+
+          html += "<div id='preview_div'>";
+          html += "<div id='preview_inner' ></div>";
+          html += "</div>";
+
+          html += "</div>";
+
+          $("#article_list").html(html);
+          $("#collect_title").val(result.title);
+
+          $("#ul_article_list").sortable({
+            update: function (event, ui) {
+              let sortedIDs = $("#ul_article_list").sortable("toArray");
+              _arrArticleOrder = new Array();
+              for (const iSorted of sortedIDs) {
+                let newindex = parseInt($("#" + iSorted).attr("article_index"));
+                _arrArticleOrder.push(_arrArticleList[newindex]);
+              }
+              $("#form_article_list").val(JSON.stringify(_arrArticleOrder));
+            },
+          });
+
+          $("#aritcle_status").html(render_status(result.status));
+          let html_title =
+            "<input id='input_article_title' type='input' name='title' value='" +
+            result.title +
+            "' />";
+          $("#article_title").html(html_title);
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
+      }
+    }
+  );
+}
+
+function my_collect_render_article(index, article) {
+  let html = "";
+  html +=
+    "<li id='article_item_" +
+    index +
+    "' article_index='" +
+    index +
+    "' class='file_list_row'>";
+  html += "<span style='flex:1;'>";
+  html += "<select>";
+  let selected = "";
+  for (let i = 1; i < 9; i++) {
+    if (parseInt(article.level) == i) {
+      selected = "selected";
+    } else {
+      selected = "";
+    }
+    html += "<option " + selected + " value='" + i + "' >H " + i + "</option>";
+  }
+  html += "</select>";
+  html += "</span>";
+  html += "<span style='flex:3;'>";
+  html +=
+    "<a href='../article/my_article_edit.php?id=" + article.article + "'>";
+  html += article.title;
+  html += "</a>";
+  html += "</span>";
+  html +=
+    "<span style='flex:1;' onclick=\"article_preview('" +
+    article.article +
+    "')\">";
+  html += "Preview";
+  html += "</span>";
+  html += "</li>";
+  return html;
+}
+
+function article_preview(id) {
+  $.get(
+    "../article/get.php",
+    {
+      id: id,
+      setting: "",
+    },
+    function (data, status) {
+      if (status == "success") {
+        try {
+          let html = "";
+          let result = JSON.parse(data);
+          $("#preview_inner").html(note_init(result.content));
+          note_refresh_new();
+        } catch (e) {
+          console.error(e.message);
+        }
+      }
+    }
+  );
+}
+
+function my_collect_save() {
+  $.ajax({
+    type: "POST", //方法类型
+    dataType: "json", //预期服务器返回的数据类型
+    url: "../article/my_collect_post.php", //url
+    data: $("#collect_edit").serialize(),
+    success: function (result) {
+      console.log(result); //打印服务端返回的数据(调试用)
+
+      if (result.status == 0) {
+        alert("保存成功");
+      } else {
+        alert("error:" + result.message);
+      }
+    },
+    error: function (data, status) {
+      alert("异常!" + data.responseText);
+      switch (status) {
+        case "timeout":
+          break;
+        case "error":
+          break;
+        case "notmodified":
+          break;
+        case "parsererror":
+          break;
+        default:
+          break;
+      }
+    },
+  });
+}

+ 100 - 0
app/article/my_collect_edit.php

@@ -0,0 +1,100 @@
+<?php
+require_once '../studio/index_head.php';
+?>
+<body id="file_list_body" >
+
+	<script language="javascript" src="../article/my_collect.js"></script>
+	<script language="javascript" src="../term/note.js"></script>
+	<script language="javascript" src="../term/term.js"></script>
+	<script language="javascript" src="../public/js/marked.js"></script>
+	<script language="javascript" src="../article/add_to_collect_dlg.js"></script>
+	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.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;
+	}
+	.file_list_block{
+		width:unset;
+	}
+	.case_dropdown-content>a {
+		display:block;
+	}
+	.case_dropdown-content>.active{
+		background-color:gray;
+	}
+	.file_list_block {
+    max-width: 100%;
+    margin-right: 1em;
+	}
+	.index_inner {
+    margin-left: 16em;
+    margin-top: 5em;
+}
+#preview_div {
+    flex: 6;
+    overflow-y: scroll;
+    height: 550px;
+}
+
+	</style>
+
+	<?php
+	require_once '../studio/index_tool_bar.php';
+	?>
+		
+	<div class="index_inner " >
+	<form id="collect_edit" action="##" onsubmit="return false"  method="POST" >
+	<div class="file_list_block">
+		<div class="tool_bar">
+			<div style="display:flex;">
+				<a href="../article/my_collect_index.php">返回</a>
+				<span><input  id="collect_title" type='input' name='title' value="" /></span>
+			</div>
+			<div style="display:flex;">
+				<div id="aritcle_status"></div>
+				<span class="icon_btn_div">
+					<span class="icon_btn_tip">保存</span>
+					<button id="edit_save" type="button" class="icon_btn" title=" " onclick="my_collect_save()">
+						<svg class="icon">
+							<use xlink:href="../studio/svg/icon.svg#ic_save"></use>
+						</svg>
+					</button>
+				</span>
+				
+				<span class="icon_btn_div">				
+					<span class="icon_btn_tip">回收站</span>
+					<button id="to_recycle" type="button" class="icon_btn" onclick="article_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>
+</form>
+	</div>
+	
+<script>
+my_collect_edit("<?php echo $_GET["id"] ?>");
+</script>
+<?php
+require_once '../studio/index_foot.php';
+?>
+

+ 5 - 6
app/article/my_collect_index.php

@@ -1,11 +1,11 @@
 <?php
 require_once '../studio/index_head.php';
 ?>
-<body id="file_list_body" onLoad="my_collect_list()">
+<body id="file_list_body" onLoad="my_collect_init()">
 
 	<script language="javascript" src="../article/my_article.js"></script>
 	<script language="javascript" src="../article/my_collect.js"></script>
-
+	<script language="javascript" src="../article/collect_add_dlg.js"></script>
 	<script >
 	var gCurrPage="collect";
 	</script>
@@ -29,17 +29,16 @@ 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>文集列表</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">
+						<button id="file_add" type="button" class="icon_btn" title=" " onclick="collect_add_dlg_show()">
 							<svg class="icon">
 								<use xlink:href="../studio/svg/icon.svg#ic_add_circle"></use>
 							</svg>
-							</a>
 						</button>
+						<div id='collect_add_div' class="float_dlg"></div>
 					</span>
 					
 					<span class="icon_btn_div">				

+ 43 - 0
app/article/my_collect_post.php

@@ -0,0 +1,43 @@
+<?php
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../hostsetting/function.php';
+$respond=array("status"=>0,"message"=>"");
+
+PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+
+$query="UPDATE collect SET title = ? , subtitle = ? , summary = ?, article_list = ?  ,  status = ? , lang = ? , receive_time= ?  , modify_time= ?   where  id = ?  ";
+$sth = $PDO->prepare($query);
+$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$_POST["summary"], $_POST["article_list"] , $_POST["status"] , $_POST["lang"] ,  mTime() , mTime() , $_POST["id"]));
+$respond=array("status"=>0,"message"=>"");
+if (!$sth || ($sth && $sth->errorCode() != 0)) {
+	$error = PDO_ErrorInfo();
+	$respond['status']=1;
+	$respond['message']=$error[2];
+}
+else{
+    # 更新 article_list 表
+    $query = "DELETE FROM article_list WHERE collect_id = ? ";
+     PDO_Execute($query,array($_POST["id"]));
+     $arrList = json_decode($_POST["article_list"]);
+     if(count($arrList)>0){
+        /* 开始一个事务,关闭自动提交 */
+        $PDO->beginTransaction();
+        $query = "INSERT INTO article_list (collect_id, article_id,level,title) VALUES ( ?, ?, ? , ? )";
+        $sth = $PDO->prepare($query);
+        foreach ($arrList as $row) {
+            $sth->execute(array($_POST["id"],$row->article,$row->level,$row->title));
+        }
+        $PDO->commit();
+        if (!$sth || ($sth && $sth->errorCode() != 0)) {
+            /*  识别错误且回滚更改  */
+            $PDO->rollBack();
+            $error = PDO_ErrorInfo();
+            $respond['status']=1;
+            $respond['message']=$error[2];
+        }
+     }
+}
+echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+?>

+ 19 - 0
app/article/my_collect_put.php

@@ -0,0 +1,19 @@
+<?php
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../hostsetting/function.php';
+$respond=array("status"=>0,"message"=>"");
+PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
+
+$query="INSERT INTO collect ( id,  title  , subtitle  , summary , article_list   , owner, lang  , status  , create_time , modify_time , receive_time   )  VALUES  ( ? , ? , ? , ?  , ? , ? , ? , ? , ? , ? , ? ) ";
+$sth = $PDO->prepare($query);
+$sth->execute(array(UUID::v4() , $_POST["title"] , "" ,"", "[]" ,  $_COOKIE["userid"] , "" , 1 , mTime() ,  mTime() , mTime() ));
+$respond=array("status"=>0,"message"=>"");
+if (!$sth || ($sth && $sth->errorCode() != 0)) {
+	$error = PDO_ErrorInfo();
+	$respond['status']=1;
+	$respond['message']=$error[2];
+}
+echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+?>

+ 106 - 18
app/channal/channal.js

@@ -1,25 +1,113 @@
 var _my_channal = null;
 
-$.post(
-      "../channal/get.php",
-      {
-
-      },
-      function(data){
-          try{
-              _my_channal = JSON.parse(data);
-          }
-          catch(e){
-              console.error(e);
+function channal_list_init() {
+  my_channal_list();
+  channal_add_dlg_init("channal_add_div");
+}
+function channal_list() {
+  $.post("../channal/get.php", {}, function (data) {
+    try {
+      _my_channal = JSON.parse(data);
+    } catch (e) {
+      console.error(e);
+    }
+  });
+}
+
+function channal_getById(id) {
+  for (const iterator of _my_channal) {
+    if (iterator.id == id) {
+      return iterator;
+    }
+  }
+  return false;
+}
+
+function my_channal_list() {
+  $.get(
+    "../channal/my_channal_get.php",
+    {
+      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.name + "</div>";
+            html +=
+              "<div style='flex:2;'>" +
+              //render_status(iterator.status) +
+              "</div>";
+            html +=
+              "<div style='flex:1;'><a href='../channal/my_channal_edit.php?id=" +
+              iterator.id +
+              "'>Edit</a></div>";
+            html += "<div style='flex:1;'>15</div>";
+            html += "</div>";
           }
+          $("#my_channal_list").html(html);
+        } catch (e) {
+          console.error(e);
+        }
+      } else {
+        console.error("ajex error");
       }
-    );
+    }
+  );
+}
 
-function channal_getById(id) {
-    for (const iterator of _my_channal) {
-        if(iterator.id==id){
-            return iterator;
+function my_channal_edit(id) {
+  $.get(
+    "../channal/my_channal_get.php",
+    {
+      id: id,
+      setting: "",
+    },
+    function (data, status) {
+      if (status == "success") {
+        try {
+          let html = "";
+          let result = JSON.parse(data);
+          $("#article_collect").attr("a_id", result.id);
+          html += '<div class="" style="padding:5px;">';
+          html += '<div style="max-width:2em;flex:1;"></div>';
+          html += "</div>";
+          html += "<div style='display:flex;'>";
+          html += "<div style='flex:4;'>";
+          html += "<input type='hidden' name='id' value='" + result.id + "'/>";
+          html +=
+            "<input type='input' name='name' value='" + result.name + "'/>";
+          html += "<textarea name='summary'>" + result.summary + "</textarea>";
+          html +=
+            "<input type='hidden' name='status' value='" +
+            result.status +
+            "'/>";
+          html += "</div>";
+
+          html += "<div id='preview_div'>";
+          html += "<div id='preview_inner' ></div>";
+          html += "</div>";
+
+          html += "</div>";
+
+          $("#channal_info").html(html);
+
+          //$("#aritcle_status").html(render_status(result.status));
+          $("#channal_title").html(result.name);
+          $("#preview_inner").html();
+        } catch (e) {
+          console.error(e);
         }
+      } else {
+        console.error("ajex error");
+      }
     }
-    return false;
-}
+  );
+}

+ 60 - 0
app/channal/channal_add_dlg.js

@@ -0,0 +1,60 @@
+var _channal_add_dlg_div;
+function channal_add_dlg_init(div) {
+  _channal_add_dlg_div = div;
+  let html = "";
+  html += "<div id='channal_add_dlg'>";
+  html += "<div >";
+  html += "<div >Channal Title</div>";
+  html += "<input type='input' id='channal_add_title' />";
+  html += "</div>";
+  html += "<div>";
+  html += "</div>";
+  html +=
+    "<div style='display:flex;justify-content: space-between;padding-top: 1em;'>";
+  html += "<div>";
+  html += "<select id='channal_add_dlg_status'>";
+  html += "<option value='3'>公开</option>";
+  html += "<option value='2'>不公开列出</option>";
+  html += "<option value='1'>私有</option>";
+  html += "</select>";
+
+  html += "</div>";
+  html += "<div>";
+  html += "<button onclick='channal_add_cancel()'>Cancel</button>";
+  html += "<button onclick='channal_add_new()'>New</button>";
+  html += "</div>";
+  html += "</div>";
+  html += "</div>";
+
+  $("#" + div).append(html);
+}
+
+function channal_add_dlg_show() {
+  $("#" + _channal_add_dlg_div).show();
+}
+function channal_add_dlg_hide() {
+  $("#" + _channal_add_dlg_div).hide();
+}
+function channal_add_cancel() {
+  channal_add_dlg_hide();
+  $("#channal_add_title").val("");
+}
+
+function channal_add_new() {
+  $.post(
+    "../channal/my_channal_put.php",
+    {
+      name: $("#channal_add_title").val(),
+      status: $("#channal_add_dlg_status").val(),
+    },
+    function (data) {
+      let error = JSON.parse(data);
+      if (error.status == 0) {
+        alert("ok");
+        channal_add_cancel();
+      } else {
+        alert(error.message);
+      }
+    }
+  );
+}

+ 97 - 0
app/channal/my_channal_edit.php

@@ -0,0 +1,97 @@
+<?php
+require_once '../studio/index_head.php';
+?>
+<body id="file_list_body" >
+
+	<script language="javascript" src="../channal/channal.js"></script>
+	<script language="javascript" src="../public/js/marked.js"></script>
+	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
+
+	<script >
+	var gCurrPage="channal";
+	</script>
+
+	<style>
+	#channal {
+		background-color: var(--btn-border-color);
+		
+	}
+	#channal: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;
+	}
+	.file_list_block {
+    max-width: 100%;
+    margin-right: 1em;
+	}
+	.index_inner {
+    margin-left: 16em;
+    margin-top: 5em;
+}
+#preview_div {
+    flex: 6;
+    overflow-y: scroll;
+    height: 550px;
+}
+
+	</style>
+
+	<?php
+	require_once '../studio/index_tool_bar.php';
+	?>
+		
+	<div class="index_inner " >
+	<form id="collect_edit" action="##" onsubmit="return false"  method="POST" >
+	<div class="file_list_block">
+		<div class="tool_bar">
+			<div style="display:flex;">
+				<a href="../channal/my_channal_index.php">返回</a>
+				<span id="channal_title"></span>
+			</div>
+			<div style="display:flex;">
+				<div id="aritcle_status"></div>
+				<span class="icon_btn_div">
+					<span class="icon_btn_tip">保存</span>
+					<button id="edit_save" type="button" class="icon_btn" title=" " onclick="my_channal_save()">
+						<svg class="icon">
+							<use xlink:href="../studio/svg/icon.svg#ic_save"></use>
+						</svg>
+					</button>
+				</span>
+				
+				<span class="icon_btn_div">				
+					<span class="icon_btn_tip">回收站</span>
+					<button id="to_recycle" type="button" class="icon_btn" onclick="channal_del()" title=" ">
+						<svg class="icon">
+							<use xlink:href="../studio/svg/icon.svg#ic_delete"></use>
+						</svg>
+					</button>
+				</span>	
+			</div>
+		</div>
+
+		<div id="channal_info"  class="file_list_block" style="">
+
+		</div>
+
+	</div>
+</form>
+	</div>
+	
+<script>
+my_channal_edit("<?php echo $_GET["id"] ?>");
+</script>
+<?php
+require_once '../studio/index_foot.php';
+?>
+

+ 26 - 0
app/channal/my_channal_get.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["id"])){
+    PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
+    $id=$_GET["id"];
+    $query = "SELECT * FROM channal  WHERE id = ? ";
+    $Fetch = PDO_FetchRow($query,array($id));
+    echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
+}
+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);
+}
+
+
+?>

+ 8 - 8
app/channal/my_channal_list.php → app/channal/my_channal_index.php

@@ -1,10 +1,11 @@
 <?php
 require_once '../studio/index_head.php';
 ?>
-<body id="file_list_body" onLoad="course_list()">
+<body id="file_list_body" onLoad="channal_list_init()">
 
-	<script language="javascript" src="../course/my_couse.js"></script>
 	<script language="javascript" src="../ucenter/name_selector.js"></script>
+	<script language="javascript" src="../channal/channal_add_dlg.js"></script>
+	<script language="javascript" src="../channal/channal.js"></script>
 	<script >
 	var gCurrPage="channal";
 	</script>
@@ -36,12 +37,11 @@ require_once '../studio/index_head.php';
 	<div>
 		<span class="icon_btn_div">
 			<span class="icon_btn_tip"><?php echo $_local->gui->add;?></span>
-			<button id="file_add" type="button" class="icon_btn" title=" ">
-				<a href="../course/my_channal_new.php">
+			<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>
 				</svg>
-				</a>
+				<div id='channal_add_div' class="float_dlg"></div>
 			</button>
 		</span>
 		
@@ -57,9 +57,9 @@ require_once '../studio/index_head.php';
 				
 </div>
 
-<div id="userfilelist">
+<div id="my_channal_list">
 <?php
-//
+/*
 
 require_once "../path.php";
 require_once "../public/_pdo.php";
@@ -82,7 +82,7 @@ foreach($Fetch as $row){
     
     echo '</div>';
 }
-
+*/
 ?>				
 </div>
 			

+ 20 - 0
app/channal/my_channal_put.php

@@ -0,0 +1,20 @@
+<?php
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/function.php';
+require_once '../hostsetting/function.php';
+$respond=array("status"=>0,"message"=>"");
+if(isset($_COOKIE["userid"])){
+	PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
+	$query="INSERT INTO channal ( id,  owner  , name  , summary ,  status  , create_time , modify_time , receive_time   )  VALUES  ( ? , ? , ? , ? , ? , ? , ? , ?  ) ";
+	$sth = $PDO->prepare($query);
+	$sth->execute(array(UUID::v4() , $_COOKIE["userid"] , $_POST["name"] , "" ,$_POST["status"]  ,  mTime() ,  mTime() , mTime() ));
+	$respond=array("status"=>0,"message"=>"");
+	if (!$sth || ($sth && $sth->errorCode() != 0)) {
+		$error = PDO_ErrorInfo();
+		$respond['status']=1;
+		$respond['message']=$error[2];
+	}	
+}
+echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+?>

+ 1 - 1
app/studio/index_tool_bar.php

@@ -75,7 +75,7 @@
 					</span>
 				</li>
 
-				<li id="channal"  onclick="goto_url(this,'../channal/my_channal_list.php')">
+				<li id="channal"  onclick="goto_url(this,'../channal/my_channal_index.php')">
 					<span  class="navi_icon">
 						<svg class="icon">
 							<use xlink:href="../studio/svg/icon.svg#class_video"></use>