From 44376ef1d1eb60dfc60fcf6ca554149e4b2ff856 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Wed, 31 Jul 2013 10:28:37 +0800 Subject: [PATCH] * code for task#1657. --- module/my/js/todo.js | 33 ++++++++++++++++++++++++++++++++ module/my/view/todo.html.php | 5 ++++- module/my/view/todolist.html.php | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/module/my/js/todo.js b/module/my/js/todo.js index a3a789eb21..9ce579181e 100644 --- a/module/my/js/todo.js +++ b/module/my/js/todo.js @@ -20,4 +20,37 @@ function changeAction(formName, actionName, actionLink) $('#' + formName).attr('action', actionLink).submit(); } +/** + * Delete todo. + * + * @param int todoID + * @access public + * @return void + */ +function deleteTodo(todoID) +{ + if(confirm(confirmDelete)) + { + url = createLink('todo', 'delete','todoID=' + todoID + '&confrim=yes'); + $.ajax( + { + type: 'GET', + url: url, + dataType: 'json', + success: function(data) + { + if(data.result == 'success') + { + url = createLink('my', 'todo'); + $('#todo').load(url + ' #todoList', function() + { + $('.colored').colorize(); + $('tfoot td').css('background', 'white').unbind('click').unbind('hover'); + }); + } + } + }); + } +} + $(".colorbox").colorbox({width:960, height:550, iframe:true, transition:'none'}); diff --git a/module/my/view/todo.html.php b/module/my/view/todo.html.php index b09db9ac73..754c9c8f10 100644 --- a/module/my/view/todo.html.php +++ b/module/my/view/todo.html.php @@ -14,6 +14,7 @@ +todo->confirmDelete)?>
@@ -48,7 +49,9 @@ ?>
- +
+ +
diff --git a/module/my/view/todolist.html.php b/module/my/view/todolist.html.php index 3c4881f51b..d7fcc5bafb 100644 --- a/module/my/view/todolist.html.php +++ b/module/my/view/todolist.html.php @@ -33,7 +33,7 @@ id", $todo, 'list', '', 'hiddenwin'); common::printIcon('todo', 'edit', "id=$todo->id", '', 'list', '', '', 'iframe', true); - common::printIcon('todo', 'delete', "id=$todo->id", '', 'list', '', 'hiddenwin'); + echo html::a("javascript:deleteTodo($todo->id)", ' ', '', "class='icon-green-common-delete' title='{$lang->todo->delete}'"); ?>