rfe #2988633 Improve ON DELETE/ON UPDATE drop-downs
This commit is contained in:
@@ -75,6 +75,7 @@ $Id$
|
|||||||
- rfe #2972969 [interface] Fix flipping of headers in non-IE browsers.
|
- rfe #2972969 [interface] Fix flipping of headers in non-IE browsers.
|
||||||
+ rfe #2964518 [interface] Allow to choose servers from configuration for
|
+ rfe #2964518 [interface] Allow to choose servers from configuration for
|
||||||
synchronisation.
|
synchronisation.
|
||||||
|
+ rfe #2988633 [relation] Improve ON DELETE/ON UPDATE drop-downs
|
||||||
|
|
||||||
3.3.3.0 (not yet released)
|
3.3.3.0 (not yet released)
|
||||||
- patch #2982480 [navi] Do not group if there would be one table in group,
|
- patch #2982480 [navi] Do not group if there would be one table in group,
|
||||||
|
26
js/tbl_relation.js
Normal file
26
js/tbl_relation.js
Normal file
@@ -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));
|
||||||
|
});
|
||||||
|
});
|
@@ -18,6 +18,8 @@
|
|||||||
* Gets some core libraries
|
* Gets some core libraries
|
||||||
*/
|
*/
|
||||||
require_once './libraries/common.inc.php';
|
require_once './libraries/common.inc.php';
|
||||||
|
$GLOBALS['js_include'][] = 'tbl_relation.js';
|
||||||
|
|
||||||
require_once './libraries/tbl_common.php';
|
require_once './libraries/tbl_common.php';
|
||||||
$url_query .= '&goto=tbl_sql.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 htmlspecialchars($dropdown_question) . ' ';
|
||||||
|
|
||||||
echo '<select name="' . htmlspecialchars($select_name) . '">' . "\n";
|
echo '<select name="' . htmlspecialchars($select_name) . '">' . "\n";
|
||||||
echo '<option value=""></option>' . "\n";
|
|
||||||
|
|
||||||
foreach ($choices as $one_value => $one_label) {
|
foreach ($choices as $one_value => $one_label) {
|
||||||
echo '<option value="' . htmlspecialchars($one_value) . '"';
|
echo '<option value="' . htmlspecialchars($one_value) . '"';
|
||||||
@@ -471,7 +472,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
if (!empty($save_row[$i]['Key'])) {
|
if (!empty($save_row[$i]['Key'])) {
|
||||||
?>
|
?>
|
||||||
<span class="formelement">
|
<span class="formelement">
|
||||||
<select name="destination_foreign[<?php echo $myfield_md5; ?>]">
|
<select name="destination_foreign[<?php echo $myfield_md5; ?>]" class="referenced_column_dropdown">
|
||||||
<?php
|
<?php
|
||||||
if (isset($existrel_foreign[$myfield])) {
|
if (isset($existrel_foreign[$myfield])) {
|
||||||
// need to backquote to support a dot character inside
|
// need to backquote to support a dot character inside
|
||||||
@@ -508,10 +509,13 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
</span>
|
</span>
|
||||||
<span class="formelement">
|
<span class="formelement">
|
||||||
<?php
|
<?php
|
||||||
|
// For ON DELETE and ON UPDATE, the default action
|
||||||
|
// is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE
|
||||||
|
// won't display the clause if it's set as RESTRICT.
|
||||||
PMA_generate_dropdown('ON DELETE',
|
PMA_generate_dropdown('ON DELETE',
|
||||||
'on_delete[' . $myfield_md5 . ']',
|
'on_delete[' . $myfield_md5 . ']',
|
||||||
$options_array,
|
$options_array,
|
||||||
isset($existrel_foreign[$myfield]['on_delete']) ? $existrel_foreign[$myfield]['on_delete']: '');
|
isset($existrel_foreign[$myfield]['on_delete']) ? $existrel_foreign[$myfield]['on_delete']: 'RESTRICT');
|
||||||
|
|
||||||
echo '</span>' . "\n"
|
echo '</span>' . "\n"
|
||||||
.'<span class="formelement">' . "\n";
|
.'<span class="formelement">' . "\n";
|
||||||
@@ -519,7 +523,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
PMA_generate_dropdown('ON UPDATE',
|
PMA_generate_dropdown('ON UPDATE',
|
||||||
'on_update[' . $myfield_md5 . ']',
|
'on_update[' . $myfield_md5 . ']',
|
||||||
$options_array,
|
$options_array,
|
||||||
isset($existrel_foreign[$myfield]['on_update']) ? $existrel_foreign[$myfield]['on_update']: '');
|
isset($existrel_foreign[$myfield]['on_update']) ? $existrel_foreign[$myfield]['on_update']: 'RESTRICT');
|
||||||
echo '</span>' . "\n";
|
echo '</span>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo $strNoIndex;
|
echo $strNoIndex;
|
||||||
|
Reference in New Issue
Block a user