blob: bdf62a75780edfb62ceb5a3ea5a0bfe8c9034550 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/**
* Unbind all event handlers before tearing down a page
*/
window.AJAX.registerTeardown('table/find_replace.js', function () {
$('#find_replace_form').off('submit');
$('#toggle_find').off('click');
});
/**
* Bind events
*/
window.AJAX.registerOnload('table/find_replace.js', function () {
$('<div id="toggle_find_div"><a id="toggle_find"></a></div>')
.insertAfter('#find_replace_form')
.hide();
$('#toggle_find')
.html(window.Messages.strHideFindNReplaceCriteria)
.on('click', function () {
var $link = $(this);
$('#find_replace_form').slideToggle();
if ($link.text() === window.Messages.strHideFindNReplaceCriteria) {
$link.text(window.Messages.strShowFindNReplaceCriteria);
} else {
$link.text(window.Messages.strHideFindNReplaceCriteria);
}
return false;
});
$('#find_replace_form').on('submit', function (e) {
e.preventDefault();
var findReplaceForm = $('#find_replace_form');
Functions.prepareForAjaxRequest(findReplaceForm);
var $msgbox = Functions.ajaxShowMessage();
$.post(findReplaceForm.attr('action'), findReplaceForm.serialize(), function (data) {
Functions.ajaxRemoveMessage($msgbox);
if (data.success === true) {
$('#toggle_find_div').show();
$('#toggle_find').trigger('click');
$('#sqlqueryresultsouter').html(data.preview);
} else {
$('#sqlqueryresultsouter').html(data.error);
}
});
});
});
|