From 5a75ca180ae0eb5c47a80428c7707cca6d5d1269 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 17 Apr 2010 19:22:12 -0400 Subject: [PATCH] rfe #2988633 Improve ON DELETE/ON UPDATE drop-downs --- ChangeLog | 1 + js/tbl_relation.js | 26 ++++++++++++++++++++++++++ tbl_relation.php | 12 ++++++++---- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 js/tbl_relation.js diff --git a/ChangeLog b/ChangeLog index f3dd9fce3..57c1c8cbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,7 @@ $Id$ - rfe #2972969 [interface] Fix flipping of headers in non-IE browsers. + rfe #2964518 [interface] Allow to choose servers from configuration for synchronisation. ++ rfe #2988633 [relation] Improve ON DELETE/ON UPDATE drop-downs 3.3.3.0 (not yet released) - patch #2982480 [navi] Do not group if there would be one table in group, diff --git a/js/tbl_relation.js b/js/tbl_relation.js new file mode 100644 index 000000000..5cdb0d7d9 --- /dev/null +++ b/js/tbl_relation.js @@ -0,0 +1,26 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * for tbl_relation.php + * + */ +function show_hide_clauses(thisDropdown) { + // here, one span contains the label and the clause dropdown + // and we have one span for ON DELETE and one for ON UPDATE + // + if (thisDropdown.val() != '') { + thisDropdown.parent().next('span').show().next('span').show(); + } else { + thisDropdown.parent().next('span').hide().next('span').hide(); + } +} + +$(document).ready(function() { + // initial display + $('.referenced_column_dropdown').each(function(index, one_dropdown) { + show_hide_clauses($(one_dropdown)); + }); + // change + $('.referenced_column_dropdown').change(function() { + show_hide_clauses($(this)); + }); +}); diff --git a/tbl_relation.php b/tbl_relation.php index 997ef605d..e1b32531d 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -18,6 +18,8 @@ * Gets some core libraries */ require_once './libraries/common.inc.php'; +$GLOBALS['js_include'][] = 'tbl_relation.js'; + require_once './libraries/tbl_common.php'; $url_query .= '&goto=tbl_sql.php'; @@ -61,7 +63,6 @@ function PMA_generate_dropdown($dropdown_question, $select_name, $choices, $sele echo htmlspecialchars($dropdown_question) . '  '; echo ' +