diff --git a/upload/admin_area/index.php b/upload/admin_area/index.php index 31104028..30310de3 100644 --- a/upload/admin_area/index.php +++ b/upload/admin_area/index.php @@ -49,7 +49,7 @@ switch($mode) die(); } break; - case 'update_todo': + case 'update_todo': /* Never used yet */ { $id = $_POST["pk"]; @@ -61,7 +61,7 @@ switch($mode) die(); } break; - case 'update_pharse': + case 'update_pharse': /* Never used yet */ { $id = $_POST["pk"]; diff --git a/upload/admin_area/styles/cb_2014/layout/index.html b/upload/admin_area/styles/cb_2014/layout/index.html index 9c7aa7e8..63c9be18 100644 --- a/upload/admin_area/styles/cb_2014/layout/index.html +++ b/upload/admin_area/styles/cb_2014/layout/index.html @@ -307,13 +307,11 @@
-
- -
-
-
- -
+
+
+ + +
@@ -789,53 +787,54 @@ $.ajax({ e.preventDefault(); var self = this; var newVal = $(this).parents(".addTodo").find("input").val(); - if(newVal.length){ - $(this).parents(".addTodo").find("input").val(""); - var ajaxCall = $.ajax({ - url: page, - type: "post", - data: { - val: newVal, - mode: "add_todo", - }, - }); - ajaxCall.success(function(data){ - data = $.parseJSON(data); - var li = document.createElement("li"); - li.className = "col-md-12"; - var p = document.createElement("p"); - p.className = "oneTodo paddingLeftSmall col-md-10"; - p.id = data.id; - p.innerHTML = data.todo; - var a = document.createElement("a"); - a.href = "#"; - a.className = "col-md-2 btn btn-danger btn-xs delete"; - a.innerHTML = "Delete"; - $(a).on("click", function(e){ - e.preventDefault(); - var self = this; - var id = $(this).prev().attr("id"); - var ajaxCall = $.ajax({ - url: page, - type: "post", - data: { - id: id, - mode: "delete_todo", - }, - }); - ajaxCall.success(function(data){ - $(self).parents("li").remove(); - }); + if(newVal.length) + { + $(this).parents(".addTodo").find("input").val(""); + var ajaxCall = $.ajax({ + url: page, + type: "post", + data: { + val: newVal, + mode: "add_todo", + }, + }); + ajaxCall.success(function(data){ + data = $.parseJSON(data); + var li = document.createElement("li"); + li.className = "col-md-12"; + var p = document.createElement("p"); + p.className = "oneTodo paddingLeftSmall col-md-10"; + p.id = data.id; + p.innerHTML = data.todo; + var a = document.createElement("a"); + a.href = "#"; + a.className = "col-md-2 btn btn-danger btn-xs delete"; + a.innerHTML = "Delete"; + $(a).on("click", function(e){ + e.preventDefault(); + var self = this; + var id = $(this).prev().attr("id"); + var ajaxCall = $.ajax({ + url: page, + type: "post", + data: { + id: id, + mode: "delete_todo", + }, + }); + ajaxCall.success(function(data){ + $(self).parents("li").remove(); + }); - }); - var div = document.createElement("div"); - div.className = "col-md-12"; + }); + var div = document.createElement("div"); + div.className = "col-md-12"; - $(li).append(div).find("div").append(p).append(a); - $(self).parents(".widgetBox").find("ul").prepend(li); - }); + $(li).append(div).find("div").append(p).append(a); + $(self).parents(".widgetBox").find("ul").prepend(li); + }); }else{ - alert("Please enter a valid value"); + alert("Please enter a valid value"); } } }); diff --git a/upload/admin_area/styles/cb_2014/theme/css/styles.css b/upload/admin_area/styles/cb_2014/theme/css/styles.css index 7c08936a..65463ffe 100644 --- a/upload/admin_area/styles/cb_2014/theme/css/styles.css +++ b/upload/admin_area/styles/cb_2014/theme/css/styles.css @@ -639,4 +639,9 @@ ul.mainTabs{ top: 40px; width: 100%; z-index: 10; +} + +.addTodoText { + width: 80%; + display: inline; } \ No newline at end of file diff --git a/upload/includes/classes/my_queries.class.php b/upload/includes/classes/my_queries.class.php index 1f412d50..eb6b563f 100644 --- a/upload/includes/classes/my_queries.class.php +++ b/upload/includes/classes/my_queries.class.php @@ -932,20 +932,39 @@ class myquery { //$db->update(tbl("comments"),array("comment"),array($text)," comment_id = $cid"); } - /** - * Function used to update comment vote - */ - function update_comment_vote($cid,$text) - { - global $db; - $db->Execute("UPDATE ".tbl("comments")." SET vote='$text' WHERE comment_id='$cid'"); - } + /** + * Function used to update comment vote + */ + function update_comment_vote($cid,$text) + { + global $db; + $db->Execute("UPDATE ".tbl("comments")." SET vote='$text' WHERE comment_id='$cid'"); + } function get_todos() { global $db; return $db->select(tbl('admin_todo'),'*'," userid='".userid()."'",NULL," date_added DESC "); } + + function insert_todo($text) + { + global $db; + $db->insert(tbl("admin_todo"),array('todo,date_added,userid'), array(mysql_clean($text),NOW(),userid())); + } + + function update_todo($id,$text) + { + global $db; + $db->Execute("UPDATE ".tbl("admin_todo")." SET todo='".mysql_clean($text)."' WHERE comment_id='$id'"); + } + + function delete_todo($id) + { + global $db; + $db->delete(tbl("admin_todo"),array("todo_id"),array($id)); + } + /** * Function used to validate comments */