The branch, master has been updated via 369c9c550a82cd97ebd914a0f8ad0e32d390dee3 (commit) from 516891a6b8b38c6fc0921e434318a834d2133038 (commit)
- Log ----------------------------------------------------------------- commit 369c9c550a82cd97ebd914a0f8ad0e32d390dee3 Author: Marc Delisle marc@infomarc.info Date: Tue Sep 20 12:45:19 2011 -0400
Ajax and bookmark delete
-----------------------------------------------------------------------
Summary of changes: import.php | 12 ++++++++++-- js/sql.js | 14 +++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/import.php b/import.php index 12af12f..d3c4b79 100644 --- a/import.php +++ b/import.php @@ -166,6 +166,7 @@ if (!empty($id_bookmark)) { $import_text = PMA_Bookmark_get($db, $id_bookmark); if ($GLOBALS['is_ajax_request'] == true) { $extra_data['sql_query'] = $import_text; + $extra_data['action_bookmark'] = $action_bookmark; $message = PMA_Message::success(__('Showing bookmark')); PMA_ajaxResponse($message, $message->isSuccess(), $extra_data); } else { @@ -175,8 +176,15 @@ if (!empty($id_bookmark)) { case 2: // bookmarked query that have to be deleted $import_text = PMA_Bookmark_get($db, $id_bookmark); PMA_Bookmark_delete($db, $id_bookmark); - $run_query = false; - $error = true; // this is kind of hack to skip processing the query + if ($GLOBALS['is_ajax_request'] == true) { + $message = PMA_Message::success(__('The bookmark has been deleted.')); + $extra_data['action_bookmark'] = $action_bookmark; + $extra_data['id_bookmark'] = $id_bookmark; + PMA_ajaxResponse($message, $message->isSuccess(), $extra_data); + } else { + $run_query = false; + $error = true; // this is kind of hack to skip processing the query + } break; } } // end bookmarks reading diff --git a/js/sql.js b/js/sql.js index 2572c35..097d9af 100644 --- a/js/sql.js +++ b/js/sql.js @@ -217,9 +217,17 @@ $(document).ready(function() { } } else { // button_submit_bookmark - $('#sqlquery').text(data.sql_query); - // send to codemirror if possible - setQuery(data.sql_query); + // + // view only + if ('1' == data.action_bookmark) { + $('#sqlquery').text(data.sql_query); + // send to codemirror if possible + setQuery(data.sql_query); + } + // delete + if ('2' == data.action_bookmark) { + $("#id_bookmark option[value='" + data.id_bookmark . "']").remove(); + } // fade out previous messages, if any $('.success').fadeOut(); $('.sqlquery_message').fadeOut();
hooks/post-receive