~ubuntu-branches/ubuntu/saucy/phpmyadmin/saucy-proposed

« back to all changes in this revision

Viewing changes to js/tbl_relation.js

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2013-08-04 13:24:37 UTC
  • mfrom: (1.2.44)
  • Revision ID: package-import@ubuntu.com-20130804132437-jznw8efwy4hr1nms
Tags: 4:4.0.5-1
* New upstream release.
  - Fixes security issue PMASA-2013-10.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function show_hide_clauses(a){if(a.val()!=""){a.parent().nextAll("span").show()}else{a.parent().nextAll("span").hide()}}AJAX.registerTeardown("tbl_relation.js",function(){$("select.referenced_column_dropdown").unbind("change")});AJAX.registerOnload("tbl_relation.js",function(){$("select.referenced_column_dropdown").each(function(a,b){show_hide_clauses($(b))});$("select.referenced_column_dropdown").change(function(){show_hide_clauses($(this))})});
 
 
b'\\ No newline at end of file'
 
1
/* vim: set expandtab sw=4 ts=4 sts=4: */
 
2
/**
 
3
 * for tbl_relation.php
 
4
 *
 
5
 */
 
6
function show_hide_clauses($thisDropdown)
 
7
{
 
8
    // here, one span contains the label and the clause dropdown
 
9
    // and we have one span for ON DELETE and one for ON UPDATE
 
10
    //
 
11
    if ($thisDropdown.val() != '') {
 
12
        $thisDropdown.parent().nextAll('span').show();
 
13
    } else {
 
14
        $thisDropdown.parent().nextAll('span').hide();
 
15
    }
 
16
}
 
17
 
 
18
/**
 
19
 * Unbind all event handlers before tearing down a page
 
20
 */
 
21
AJAX.registerTeardown('tbl_relation.js', function() {
 
22
    $('select.referenced_column_dropdown').unbind('change');
 
23
});
 
24
 
 
25
AJAX.registerOnload('tbl_relation.js', function() {
 
26
    // initial display
 
27
    $('select.referenced_column_dropdown').each(function(index, one_dropdown) {
 
28
        show_hide_clauses($(one_dropdown));
 
29
    });
 
30
    // change
 
31
    $('select.referenced_column_dropdown').change(function() {
 
32
        show_hide_clauses($(this));
 
33
    });
 
34
});