Improve storing columns on designer and add a translation
[phpmyadmin.git] / js / tbl_find_replace.js
blob8b48e53ef74f30509965977030e0221121273d20
1 /**
2  * Unbind all event handlers before tearing down a page
3  */
4 AJAX.registerTeardown('tbl_find_replace.js', function () {
5     $('#find_replace_form').off('submit');
6     $('#toggle_find').off('click');
7 });
9 /**
10  * Bind events
11  */
12 AJAX.registerOnload('tbl_find_replace.js', function () {
13     $('<div id="toggle_find_div"><a id="toggle_find"></a></div>')
14         .insertAfter('#find_replace_form')
15         .hide();
17     $('#toggle_find')
18         .html(PMA_messages.strHideFindNReplaceCriteria)
19         .click(function () {
20             var $link = $(this);
21             $('#find_replace_form').slideToggle();
22             if ($link.text() === PMA_messages.strHideFindNReplaceCriteria) {
23                 $link.text(PMA_messages.strShowFindNReplaceCriteria);
24             } else {
25                 $link.text(PMA_messages.strHideFindNReplaceCriteria);
26             }
27             return false;
28         });
30     $('#find_replace_form').submit(function (e) {
31         e.preventDefault();
32         var findReplaceForm = $('#find_replace_form');
33         PMA_prepareForAjaxRequest(findReplaceForm);
34         var $msgbox = PMA_ajaxShowMessage();
35         $.post(findReplaceForm.attr('action'), findReplaceForm.serialize(), function (data) {
36             PMA_ajaxRemoveMessage($msgbox);
37             if (data.success === true) {
38                 $('#toggle_find_div').show();
39                 $('#toggle_find').click();
40                 $('#sqlqueryresultsouter').html(data.preview);
41             } else {
42                 $('#sqlqueryresultsouter').html(data.error);
43             }
44         });
45     });
46 });