2 * Unbind all event handlers before tearing down the page
4 AJAX.registerTeardown('db_tracking.js', function () {
5 $('body').off('click', '#trackedForm.ajax button[name="submit_mult"], #trackedForm.ajax input[name="submit_mult"]');
6 $('body').off('click', '#untrackedForm.ajax button[name="submit_mult"], #untrackedForm.ajax input[name="submit_mult"]');
7 $('body').off('click', 'a.delete_tracking_anchor.ajax');
13 AJAX.registerOnload('db_tracking.js', function () {
14 var $versions = $('#versions');
15 $versions.find('tr:first th').append($('<div class="sorticon"></div>'));
16 $versions.tablesorter({
20 2: { sorter: 'integer' },
27 var $noVersions = $('#noversions');
28 $noVersions.find('tr:first th').append($('<div class="sorticon"></div>'));
29 $noVersions.tablesorter({
37 var $body = $('body');
40 * Handles multi submit for tracked tables
42 $body.on('click', '#trackedForm.ajax button[name="submit_mult"], #trackedForm.ajax input[name="submit_mult"]', function (e) {
44 var $button = $(this);
45 var $form = $button.parent('form');
46 var argsep = PMA_commonParams.get('arg_separator');
47 var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
49 if ($button.val() === 'delete_tracking') {
50 var question = PMA_messages.strDeleteTrackingDataMultiple;
51 $button.PMA_confirm(question, $form.attr('action'), function (url) {
52 PMA_ajaxShowMessage(PMA_messages.strDeletingTrackingData);
54 $.post(url, submitData, AJAX.responseHandler);
57 PMA_ajaxShowMessage();
59 $.post($form.attr('action'), submitData, AJAX.responseHandler);
64 * Handles multi submit for untracked tables
66 $body.on('click', '#untrackedForm.ajax button[name="submit_mult"], #untrackedForm.ajax input[name="submit_mult"]', function (e) {
68 var $button = $(this);
69 var $form = $button.parent('form');
70 var argsep = PMA_commonParams.get('arg_separator');
71 var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
72 PMA_ajaxShowMessage();
74 $.post($form.attr('action'), submitData, AJAX.responseHandler);
78 * Ajax Event handler for 'Delete tracking'
80 $body.on('click', 'a.delete_tracking_anchor.ajax', function (e) {
82 var $anchor = $(this);
83 var question = PMA_messages.strDeleteTrackingData;
84 $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) {
85 PMA_ajaxShowMessage(PMA_messages.strDeletingTrackingData);
86 AJAX.source = $anchor;
87 var argSep = PMA_commonParams.get('arg_separator');
88 var params = getJSConfirmCommonParam(this, $anchor.getPostData());
89 params += argSep + 'ajax_page_request=1';
90 $.post(url, params, AJAX.responseHandler);