Fix admin TodoList

This commit is contained in:
MacWarrior 2016-10-09 10:53:39 +02:00
parent 531ce61936
commit 4409a3a338
4 changed files with 84 additions and 61 deletions

View file

@ -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"];

View file

@ -307,11 +307,9 @@
<div class="widgetBox">
<div class="addTodo paddingRightSmall paddingLeftLarge marginBottomLarge">
<div class="row">
<div class="from-group col-md-10">
<input type="text" name="addTodo" class="form-control">
</div>
<div class="from-group relative">
<div class="addTodoButton">
<div class="from-group">
<input type="text" name="addTodo" class="form-control addTodoText">
<button id="addTodo" class="btn btn-primary btn-sm">Add</button>
</div>
</div>
@ -789,7 +787,8 @@ $.ajax({
e.preventDefault();
var self = this;
var newVal = $(this).parents(".addTodo").find("input").val();
if(newVal.length){
if(newVal.length)
{
$(this).parents(".addTodo").find("input").val("");
var ajaxCall = $.ajax({
url: page,

View file

@ -640,3 +640,8 @@ ul.mainTabs{
width: 100%;
z-index: 10;
}
.addTodoText {
width: 80%;
display: inline;
}

View file

@ -946,6 +946,25 @@ class myquery {
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
*/