Translation update done using Pootle.
[phpmyadmin-themes.git] / js / sql.js
blobd28634802a0421c00b13f3d949fe8fcb6f39602d
1 /* vim: set expandtab sw=4 ts=4 sts=4: */
2 /**
3  * @fileoverview    functions used wherever an sql query form is used
4  *
5  * @requires    jQuery
6  * @requires    js/functions.js
7  *
8  */
10 /**
11  * decode a string URL_encoded
12  *
13  * @param string str
14  * @return string the URL-decoded string
15  */
16 function PMA_urldecode(str) {
17     return decodeURIComponent(str.replace(/\+/g, '%20'));
20 /**
21  * Get the field name for the current field.  Required to construct the query
22  * for inline editing
23  *
24  * @param   $this_field  jQuery object that points to the current field's tr
25  * @param   disp_mode    string
26  */
27 function getFieldName($this_field, disp_mode) {
29     if(disp_mode == 'vertical') {
30         var field_name = $this_field.siblings('th').find('a').text();
31         // happens when just one row (headings contain no a)
32         if ("" == field_name) {
33             field_name = $this_field.siblings('th').text();
34         }
35     }
36     else {
37         var this_field_index = $this_field.index();
38         // ltr or rtl direction does not impact how the DOM was generated
39         //
40         // 5 columns to account for the checkbox, edit, appended inline edit, copy and delete anchors but index is zero-based so substract 4
41         var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-4 )+') a').text();
42         // happens when just one row (headings contain no a)
43         if ("" == field_name) {
44             field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-4 )+')').text();
45         }
46     }
48     field_name = $.trim(field_name);
50     return field_name;
53 /**
54  * The function that iterates over each row in the table_results and appends a
55  * new inline edit anchor to each table row.
56  *
57  */
58 function appendInlineAnchor() {
59     var disp_mode = $("#top_direction_dropdown").val();
61     if (disp_mode == 'vertical') {
62         // there can be one or two tr containing this class, depending
63         // on the ModifyDeleteAtLeft and ModifyDeleteAtRight cfg parameters
64         $('#table_results tr')
65             .find('.edit_row_anchor')
66             .removeClass('.edit_row_anchor')
67             .parent().each(function() {
68             var $this_tr = $(this);
69             var $cloned_tr = $this_tr.clone();
71             var $img_object = $cloned_tr.find('img:first').attr('title', PMA_messages['strInlineEdit']);
72             var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
73             $img_object.attr('src', img_src);
75             $cloned_tr.find('td')
76              .addClass('inline_edit_anchor')
77              .find('a').attr('href', '#')
78              .find('span')
79              .text(' ' + PMA_messages['strInlineEdit'])
80              .prepend($img_object);
82             $cloned_tr.insertAfter($this_tr);
83         });
85         $('#rowsDeleteForm').find('tbody').find('th').each(function() {
86             var $this_th = $(this);
87             if ($this_th.attr('rowspan') == 4) {
88                 $this_th.attr('rowspan', '5');
89             }
90         });
91     }
92     else {
93         $('.edit_row_anchor').each(function() {
95             $this_td = $(this)
96             $this_td.removeClass('edit_row_anchor');
98             var $cloned_anchor = $this_td.clone();
100             var $img_object = $cloned_anchor.find('img').attr('title', PMA_messages['strInlineEdit']);
101             var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
102             $img_object.attr('src', img_src);
104             $cloned_anchor.addClass('inline_edit_anchor')
105             .find('a').attr('href', '#')
106             .find('span')
107             .text(' ' + PMA_messages['strInlineEdit'])
108             .prepend($img_object);
110             $this_td.after($cloned_anchor);
111         });
113         $('#rowsDeleteForm').find('thead, tbody').find('th').each(function() {
114             var $this_th = $(this);
115             if ($this_th.attr('colspan') == 4) {
116                 $this_th.attr('colspan', '5');
117             }
118         });
119     }
122 /**#@+
123  * @namespace   jQuery
124  */
127  * @description <p>Ajax scripts for sql and browse pages</p>
129  * Actions ajaxified here:
130  * <ul>
131  * <li>Retrieve results of an SQL query</li>
132  * <li>Paginate the results table</li>
133  * <li>Sort the results table</li>
134  * <li>Change table according to display options</li>
135  * <li>Inline editing of data</li>
136  * </ul>
138  * @name        document.ready
139  * @memberOf    jQuery
140  */
141 $(document).ready(function() {
143     /**
144      * Set a parameter for all Ajax queries made on this page.  Don't let the
145      * web server serve cached pages
146      */
147     $.ajaxSetup({
148         cache: 'false'
149     });
151     /**
152      * current value of the direction in which the table is displayed
153      * @type    String
154      * @fieldOf jQuery
155      * @name    disp_mode
156      */
157     var disp_mode = $("#top_direction_dropdown").val();
159     /**
160      * Update value of {@link jQuery.disp_mode} everytime the direction dropdown changes value
161      * @memberOf    jQuery
162      * @name        direction_dropdown_change
163      */
164     $("#top_direction_dropdown, #bottom_direction_dropdown").live('change', function(event) {
165         disp_mode = $(this).val();
166     })
168     /**
169      * Attach the {@link appendInlineAnchor} function to a custom event, which
170      * will be triggered manually everytime the table of results is reloaded
171      * @memberOf    jQuery
172      */
173     $("#sqlqueryresults").live('appendAnchor',function() {
174         appendInlineAnchor();
175     })
177     /**
178      * Trigger the appendAnchor event to prepare the first table for inline edit
179      * (see $GLOBALS['cfg']['AjaxEnable'])
180      * @memberOf    jQuery
181      * @name        sqlqueryresults_trigger
182      */
183     $("#sqlqueryresults.ajax").trigger('appendAnchor');
185     /**
186      * Append the "Show/Hide query box" message to the query input form
187      *
188      * @memberOf jQuery
189      * @name    appendToggleSpan
190      */
191     // do not add this link more than once
192     if (! $('#sqlqueryform').find('a').is('#togglequerybox')) {
193         $('<a id="togglequerybox"></a>')
194         .html(PMA_messages['strHideQueryBox'])
195         .appendTo("#sqlqueryform");
197         // Attach the toggling of the query box visibility to a click
198         $("#togglequerybox").bind('click', function() {
199             var $link = $(this)
200             $link.siblings().slideToggle("medium");
201             if ($link.text() == PMA_messages['strHideQueryBox']) {
202                 $link.text(PMA_messages['strShowQueryBox']);
203             } else {
204                 $link.text(PMA_messages['strHideQueryBox']);
205             }
206             // avoid default click action
207             return false;
208         })
209     }
211     /**
212      * Ajax Event handler for 'SQL Query Submit'
213      *
214      * @see         PMA_ajaxShowMessage()
215      * @see         $cfg['AjaxEnable']
216      * @memberOf    jQuery
217      * @name        sqlqueryform_submit
218      */
219     $("#sqlqueryform.ajax").live('submit', function(event) {
220         event.preventDefault();
221         // remove any div containing a previous error message
222         $('.error').remove();
224         $form = $(this);
225         PMA_ajaxShowMessage();
227             if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
228                 $form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
229             }
231         $.post($(this).attr('action'), $(this).serialize() , function(data) {
232             if(data.success == true) {
233                 // fade out previous success message, if any
234                 $('.success').fadeOut();
235                 // show a message that stays on screen
236                 $('#sqlqueryform').before(data.message);
237                 $('#sqlqueryresults').show();
238                 // this happens if a USE command was typed
239                 if (typeof data.reload != 'undefined') {
240                     $form.find('input[name=db]').val(data.db);
241                     // need to regenerate the whole upper part
242                     $form.find('input[name=ajax_request]').remove();
243                     $form.append('<input type="hidden" name="reload" value="true" />');
244                     $.post('db_sql.php', $form.serialize(), function(data) {
245                         $('body').html(data);
246                     }); // end inner post
247                 }
248             }
249             else if (data.success == false ) {
250                 // show an error message that stays on screen
251                 $('#sqlqueryform').before(data.error);
252                 $('#sqlqueryresults').hide();
253             }
254             else {
255                 // real results are returned
256                 $('#sqlqueryresults').show();
257                 $("#sqlqueryresults").html(data);
258                 $("#sqlqueryresults").trigger('appendAnchor');
259                 if($("#togglequerybox").siblings(":visible").length > 0) {
260                     $("#togglequerybox").trigger('click');
261                 }
262                 PMA_init_slider();
263             }
264         }) // end $.post()
265     }) // end SQL Query submit
267     /**
268      * Ajax Event handlers for Paginating the results table
269      */
271     /**
272      * Paginate when we click any of the navigation buttons
273      * (only if the element has the ajax class, see $cfg['AjaxEnable'])
274      * @memberOf    jQuery
275      * @name        paginate_nav_button_click
276      * @uses        PMA_ajaxShowMessage()
277      * @see         $cfg['AjaxEnable']
278      */
279     $("input[name=navig].ajax").live('click', function(event) {
280         /** @lends jQuery */
281         event.preventDefault();
283         PMA_ajaxShowMessage();
285         /**
286          * @var $the_form    Object referring to the form element that paginates the results table
287          */
288         var $the_form = $(this).parent("form");
290         $the_form.append('<input type="hidden" name="ajax_request" value="true" />');
292         $.post($the_form.attr('action'), $the_form.serialize(), function(data) {
293             $("#sqlqueryresults").html(data);
294             $("#sqlqueryresults").trigger('appendAnchor');
295             PMA_init_slider();
296         }) // end $.post()
297     })// end Paginate results table
299     /**
300      * Paginate results with Page Selector dropdown
301      * @memberOf    jQuery
302      * @name        paginate_dropdown_change
303      * @see         $cfg['AjaxEnable']
304      */
305     $("#pageselector").live('change', function(event) {
306         var $the_form = $(this).parent("form");
308         if ($(this).hasClass('ajax')) {
309             event.preventDefault();
311             PMA_ajaxShowMessage();
313             $.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
314                 $("#sqlqueryresults").html(data);
315                 $("#sqlqueryresults").trigger('appendAnchor');
316                 PMA_init_slider();
317             }) // end $.post()
318         } else {
319             $the_form.submit();
320         }
322     })// end Paginate results with Page Selector
324     /**
325      * Ajax Event handler for sorting the results table
326      * @memberOf    jQuery
327      * @name        table_results_sort_click
328      * @see         $cfg['AjaxEnable']
329      */
330     $("#table_results.ajax").find("a[title=Sort]").live('click', function(event) {
331         event.preventDefault();
333         PMA_ajaxShowMessage();
335         $anchor = $(this);
337         $.get($anchor.attr('href'), $anchor.serialize() + '&ajax_request=true', function(data) {
338             $("#sqlqueryresults")
339              .html(data)
340              .trigger('appendAnchor');
341         }) // end $.get()
342     })//end Sort results table
344     /**
345      * Ajax Event handler for the display options
346      * @memberOf    jQuery
347      * @name        displayOptionsForm_submit
348      * @see         $cfg['AjaxEnable']
349      */
350     $("#displayOptionsForm.ajax").live('submit', function(event) {
351         event.preventDefault();
353         $form = $(this);
355         $.post($form.attr('action'), $form.serialize() + '&ajax_request=true' , function(data) {
356             $("#sqlqueryresults")
357              .html(data)
358              .trigger('appendAnchor');
359             PMA_init_slider();
360         }) // end $.post()
361     })
362     //end displayOptionsForm handler
364     /**
365      * Ajax Event handlers for Inline Editing
366      */
368     /**
369      * On click, replace the fields of current row with an input/textarea
370      * @memberOf    jQuery
371      * @name        inline_edit_start
372      * @see         PMA_ajaxShowMessage()
373      * @see         getFieldName()
374      */
375     $(".inline_edit_anchor").live('click', function(event) {
376         /** @lends jQuery */
377         event.preventDefault();
379         $(this).removeClass('inline_edit_anchor').addClass('inline_edit_active');
381         // Initialize some variables
382         if(disp_mode == 'vertical') {
383             /**
384              * @var this_row_index  Index of the current <td> in the parent <tr>
385              *                      Current <td> is the inline edit anchor.
386              */
387             var this_row_index = $(this).index();
388             /**
389              * @var $input_siblings  Object referring to all inline editable events from same row
390              */
391             var $input_siblings = $(this).parents('tbody').find('tr').find('.inline_edit:nth('+this_row_index+')');
392             /**
393              * @var where_clause    String containing the WHERE clause to select this row
394              */
395             var where_clause = $(this).parents('tbody').find('tr').find('.where_clause:nth('+this_row_index+')').val();
396         }
397         else {
398             var $input_siblings = $(this).parent('tr').find('.inline_edit');
399             var where_clause = $(this).parent('tr').find('.where_clause').val();
400         }
402         $input_siblings.each(function() {
403             /** @lends jQuery */
404             /**
405              * @var data_value  Current value of this field
406              */
407             var data_value = $(this).html();
409             // We need to retrieve the value from the server for truncated/relation fields
410             // Find the field name
412             /**
413              * @var this_field  Object referring to this field (<td>)
414              */
415             var $this_field = $(this);
416             /**
417              * @var field_name  String containing the name of this field.
418              * @see getFieldName()
419              */
420             var field_name = getFieldName($this_field, disp_mode);
422             // In each input sibling, wrap the current value in a textarea
423             // and store the current value in a hidden span
424             if($this_field.is(':not(.truncated, .transformed, .relation, .enum, .null)')) {
425                 // handle non-truncated, non-transformed, non-relation values
426                 // We don't need to get any more data, just wrap the value
427                 $this_field.html('<textarea>'+data_value+'</textarea>')
428                 .append('<span class="original_data">'+data_value+'</span>');
429                 $(".original_data").hide();
430             }
431             else if($this_field.is('.truncated, .transformed')) {
432                 /** @lends jQuery */
433                 //handle truncated/transformed values values
435                 /**
436                  * @var sql_query   String containing the SQL query used to retrieve value of truncated/transformed data
437                  */
438                 var sql_query = 'SELECT ' + field_name + ' FROM ' + window.parent.table + ' WHERE ' + where_clause;
440                 // Make the Ajax call and get the data, wrap it and insert it
441                 $.post('sql.php', {
442                     'token' : window.parent.token,
443                     'db' : window.parent.db,
444                     'ajax_request' : true,
445                     'sql_query' : sql_query,
446                     'inline_edit' : true
447                 }, function(data) {
448                     if(data.success == true) {
449                         $this_field.html('<textarea>'+data.value+'</textarea>')
450                         .append('<span class="original_data">'+data_value+'</span>');
451                         $(".original_data").hide();
452                     }
453                     else {
454                         PMA_ajaxShowMessage(data.error);
455                     }
456                 }) // end $.post()
457             }
458             else if($this_field.is('.relation')) {
459                 /** @lends jQuery */
460                 //handle relations
462                 /**
463                  * @var curr_value  String containing the current value of this relational field
464                  */
465                 var curr_value = $this_field.find('a').text();
467                 /**
468                  * @var post_params Object containing parameters for the POST request
469                  */
470                 var post_params = {
471                         'ajax_request' : true,
472                         'get_relational_values' : true,
473                         'db' : window.parent.db,
474                         'table' : window.parent.table,
475                         'column' : field_name,
476                         'token' : window.parent.token,
477                         'curr_value' : curr_value
478                 }
480                 $.post('sql.php', post_params, function(data) {
481                     $this_field.html(data.dropdown)
482                     .append('<span class="original_data">'+data_value+'</span>');
483                     $(".original_data").hide();
484                 }) // end $.post()
485             }
486             else if($this_field.is('.enum')) {
487                 /** @lends jQuery */
488                 //handle enum fields
489                 /**
490                  * @var curr_value  String containing the current value of this relational field
491                  */
492                 var curr_value = $this_field.text();
494                 /**
495                  * @var post_params Object containing parameters for the POST request
496                  */
497                 var post_params = {
498                         'ajax_request' : true,
499                         'get_enum_values' : true,
500                         'db' : window.parent.db,
501                         'table' : window.parent.table,
502                         'column' : field_name,
503                         'token' : window.parent.token,
504                         'curr_value' : curr_value
505                 }
507                 $.post('sql.php', post_params, function(data) {
508                     $this_field.html(data.dropdown)
509                     .append('<span class="original_data">'+data_value+'</span>');
510                     $(".original_data").hide();
511                 }) // end $.post()
512             }
513             else if($this_field.is('.null')) {
514                 //handle null fields
515                 $this_field.html('<textarea></textarea>')
516                 .append('<span class="original_data">NULL</span>');
517                 $(".original_data").hide();
518             }
519         })
520     }) // End On click, replace the current field with an input/textarea
522     /**
523      * After editing, clicking again should post data
524      *
525      * @memberOf    jQuery
526      * @name        inline_edit_save
527      * @see         PMA_ajaxShowMessage()
528      * @see         getFieldName()
529      */
530     $(".inline_edit_active").live('click', function(event) {
531         /** @lends jQuery */
532         event.preventDefault();
534         /**
535          * @var $this_td    Object referring to the td containing the
536          * "Inline Edit" link that was clicked to save the row that is
537          * being edited
538          *
539          */
540         var $this_td = $(this);
542         var $test_element = ''; // to test the presence of a element
544         // Initialize variables
545         if(disp_mode == 'vertical') {
546             /**
547              * @var this_td_index  Index of the current <td> in the parent <tr>
548              *                      Current <td> is the inline edit anchor.
549              */
550             var this_td_index = $this_td.index();
551             /**
552              * @var $input_siblings  Object referring to all inline editable events from same row
553              */
554             var $input_siblings = $this_td.parents('tbody').find('tr').find('.inline_edit:nth('+this_td_index+')');
555             /**
556              * @var where_clause    String containing the WHERE clause to select this row
557              */
558             var where_clause = $this_td.parents('tbody').find('tr').find('.where_clause:nth('+this_td_index+')').val();
559         }
560         else {
561             var $input_siblings = $this_td.parent('tr').find('.inline_edit');
562             var where_clause = $this_td.parent('tr').find('.where_clause').val();
563         }
565         /**
566          * @var nonunique   Boolean, whether this row is unique or not
567          */
568         if($this_td.is('.nonunique')) {
569             var nonunique = 0;
570         }
571         else {
572             var nonunique = 1;
573         }
575         // Collect values of all fields to submit, we don't know which changed
576         /**
577          * @var params_to_submit    Array containing the name/value pairs of all fields
578          */
579         var params_to_submit = {};
580         /**
581          * @var relation_fields Array containing the name/value pairs of relational fields
582          */
583         var relation_fields = {};
584         /**
585          * @var transform_fields    Array containing the name/value pairs for transformed fields
586          */
587         var transform_fields = {};
588         /**
589          * @var transformation_fields   Boolean, if there are any transformed fields in this row
590          */
591         var transformation_fields = false;
593         $input_siblings.each(function() {
594             /** @lends jQuery */
595             /**
596              * @var this_field  Object referring to this field (<td>)
597              */
598             var $this_field = $(this);
599             /**
600              * @var field_name  String containing the name of this field.
601              * @see getFieldName()
602              */
603             var field_name = getFieldName($this_field, disp_mode);
605             /**
606              * @var this_field_params   Array temporary storage for the name/value of current field
607              */
608             var this_field_params = {};
610             if($this_field.is('.transformed')) {
611                 transformation_fields =  true;
612             }
614             if($this_field.is(":not(.relation, .enum)")) {
615                 this_field_params[field_name] = $this_field.find('textarea').val();
616                 if($this_field.is('.transformed')) {
617                     $.extend(transform_fields, this_field_params);
618                 }
619             }
620             else {
621                 // results from a drop-down
622                 $test_element = $this_field.find('select');
623                 if ($test_element.length != 0) {
624                     this_field_params[field_name] = $test_element.val();
625                 }
627                 // results from Browse foreign value
628                 $test_element = $this_field.find('span.curr_value');
629                 if ($test_element.length != 0) {
630                     this_field_params[field_name] = $test_element.text();
631                 }
633                 if($this_field.is('.relation')) {
634                     $.extend(relation_fields, this_field_params);
635                 }
636             }
638             $.extend(params_to_submit, this_field_params);
639         })
641         /**
642          * @var sql_query   String containing the SQL query to update this row
643          */
644         var sql_query = 'UPDATE ' + window.parent.table + ' SET ';
646         $.each(params_to_submit, function(key, value) {
647             if(value.length == 0) {
648                 value = 'NULL'
649             }
650            sql_query += ' ' + key + "='" + value.replace(/'/g, "''") + "' , ";
651         })
652         //Remove the last ',' appended in the above loop
653         sql_query = sql_query.replace(/,\s$/, '');
654         sql_query += ' WHERE ' + PMA_urldecode(where_clause);
656         /**
657          * @var rel_fields_list  String, url encoded representation of {@link relations_fields}
658          */
659         var rel_fields_list = $.param(relation_fields);
661         /**
662          * @var transform_fields_list  String, url encoded representation of {@link transform_fields}
663          */
664         var transform_fields_list = $.param(transform_fields);
666         // Make the Ajax post after setting all parameters
667         /**
668          * @var post_params Object containing parameters for the POST request
669          */
670         var post_params = {'ajax_request' : true,
671                             'sql_query' : sql_query,
672                             'disp_direction' : disp_mode,
673                             'token' : window.parent.token,
674                             'db' : window.parent.db,
675                             'table' : window.parent.table,
676                             'clause_is_unique' : nonunique,
677                             'where_clause' : where_clause,
678                             'rel_fields_list' : rel_fields_list,
679                             'do_transformations' : transformation_fields,
680                             'transform_fields_list' : transform_fields_list,
681                             'goto' : 'sql.php',
682                             'submit_type' : 'save'
683                           };
685         $.post('tbl_replace.php', post_params, function(data) {
686             if(data.success == true) {
687                 PMA_ajaxShowMessage(data.message);
688                 $this_td.removeClass('inline_edit_active').addClass('inline_edit_anchor');
690                 $input_siblings.each(function() {
691                     // Inline edit post has been successful.
692                     $this_sibling = $(this);
693                     if($this_sibling.is(':not(.relation, .enum)')) {
694                         /**
695                          * @var new_html    String containing value of the data field after edit
696                          */
697                         var new_html = $this_sibling.find('textarea').val();
699                         if($this_sibling.is('.transformed')) {
700                             var field_name = getFieldName($this_sibling, disp_mode);
701                             $.each(data.transformations, function(key, value) {
702                                 if(key == field_name) {
703                                     if($this_sibling.is('.text_plain, .application_octetstream')) {
704                                         new_html = value;
705                                         return false;
706                                     }
707                                     else {
708                                         var new_value = $this_sibling.find('textarea').val();
709                                         new_html = $(value).append(new_value);
710                                         return false;
711                                     }
712                                 }
713                             })
714                         }
715                     }
716                     else {
717                         var new_html = '';
718                         var new_value = '';
719                         $test_element = $this_sibling.find('select');
720                         if ($test_element.length != 0) {
721                             new_value = $test_element.val();
722                         }
724                         $test_element = $this_sibling.find('span.curr_value');
725                         if ($test_element.length != 0) {
726                             new_value = $test_element.text();
727                         }
730                         if($this_sibling.is('.relation')) {
731                             var field_name = getFieldName($this_sibling, disp_mode);
732                             $.each(data.relations, function(key, value) {
733                                 if(key == field_name) {
734                                     new_html = $(value).append(new_value);
735                                     return false;
736                                 }
737                             })
738                         }
739                         if($this_sibling.is('.enum')) {
740                             new_html = new_value;
741                         }
742                     }
743                     $this_sibling.html(new_html);
744                 })
745             }
746             else {
747                 PMA_ajaxShowMessage(data.error);
748             };
749         }) // end $.post()
750     }) // End After editing, clicking again should post data
751 }, 'top.frame_content') // end $(document).ready()
754  * Starting from some th, change the class of all td under it
755  */
756 function PMA_changeClassForColumn($this_th, newclass) {
757     // index 0 is the th containing the big T
758     var th_index = $this_th.index();
759     // .eq() is zero-based
760     th_index--;
761     var $tr_with_data = $this_th.closest('table').find('tbody tr ').has('td.data');
762     $tr_with_data.each(function() {
763         $(this).find('td.data:eq('+th_index+')').toggleClass(newclass);
764     });
767 $(document).ready(function() {
769     $('.browse_foreign').live('click', function(e) {
770         e.preventDefault();
771         window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes,resizable=yes');
772         $anchor = $(this);
773         $anchor.addClass('browse_foreign_clicked');
774         return false;
775     });
777     /**
778      * vertical column highlighting in horizontal mode when hovering over the column header
779      */
780     $('.column_heading').live('hover', function() {
781         PMA_changeClassForColumn($(this), 'hover');
782         });
784     /**
785      * vertical column marking in horizontal mode when clicking the column header
786      */
787     $('.column_heading').live('click', function() {
788         PMA_changeClassForColumn($(this), 'marked');
789         });
792 /**#@- */