[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA1-1194-g5b4938b
Marc Delisle
lem9 at users.sourceforge.net
Mon Dec 27 14:31:24 CET 2010
The branch, master has been updated
via 5b4938bae5705661e1d5a8a87fbd49b8d8323a0c (commit)
via ab393d3f820ab03bb484a0bb673f1c4caf9d3596 (commit)
from 8a8986d9da55d2ef7951f7fcb59ec7a01f9a8b63 (commit)
- Log -----------------------------------------------------------------
commit 5b4938bae5705661e1d5a8a87fbd49b8d8323a0c
Merge: ab393d3f820ab03bb484a0bb673f1c4caf9d3596 8a8986d9da55d2ef7951f7fcb59ec7a01f9a8b63
Author: Marc Delisle <marc at infomarc.info>
Date: Mon Dec 27 08:30:15 2010 -0500
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit ab393d3f820ab03bb484a0bb673f1c4caf9d3596
Author: Marc Delisle <marc at infomarc.info>
Date: Mon Dec 27 08:29:31 2010 -0500
Bug #3141327 (Foreign key input options)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
libraries/relation.lib.php | 55 +++++++++++++++++++++++++------------------
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1e7c645..da67ab5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -127,6 +127,7 @@
- [interface] Use less noisy message and remove disable link on server charts and database statistics.
+ rfe #3141330 [relation] When displaying results, show a link to the foreign
table even when phpMyAdmin configuration storage is not active
+- bug #3141327 [relation] Foreign key input options
3.3.10.0 (not yet released)
diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php
index 74800fe..960e890 100644
--- a/libraries/relation.lib.php
+++ b/libraries/relation.lib.php
@@ -840,7 +840,9 @@ function PMA__foreignDropdownBuild($foreign, $data, $mode)
{
$reloptions = array();
- if ($mode == 'id-content') {
+ // id-only is a special mode used when no foreign display column
+ // is available
+ if ($mode == 'id-content' || $mode == 'id-only') {
// sort for id-content
if ($GLOBALS['cfg']['NaturalOrder']) {
uksort($foreign, 'strnatcasecmp');
@@ -857,7 +859,6 @@ function PMA__foreignDropdownBuild($foreign, $data, $mode)
}
foreach ($foreign as $key => $value) {
-
if (PMA_strlen($value) <= $GLOBALS['cfg']['LimitChars']) {
$vtitle = '';
$value = htmlspecialchars($value);
@@ -866,7 +867,7 @@ function PMA__foreignDropdownBuild($foreign, $data, $mode)
$value = htmlspecialchars(substr($value, 0, $GLOBALS['cfg']['LimitChars']) . '...');
}
- $reloption = ' <option value="' . htmlspecialchars($key) . '"';
+ $reloption = '<option value="' . htmlspecialchars($key) . '"';
if ($vtitle != '') {
$reloption .= ' title="' . $vtitle . '"';
}
@@ -876,9 +877,11 @@ function PMA__foreignDropdownBuild($foreign, $data, $mode)
}
if ($mode == 'content-id') {
- $reloptions[] = $reloption . '>' . $value . ' - ' . htmlspecialchars($key) . '</option>' . "\n";
- } else {
- $reloptions[] = $reloption . '>' . htmlspecialchars($key) . ' - ' . $value . '</option>' . "\n";
+ $reloptions[] = $reloption . '>' . $value . ' - ' . htmlspecialchars($key) . '</option>';
+ } elseif ($mode == 'id-content') {
+ $reloptions[] = $reloption . '>' . htmlspecialchars($key) . ' - ' . $value . '</option>';
+ } elseif ($mode == 'id-only') {
+ $reloptions[] = $reloption . '>' . htmlspecialchars($key) . '</option>';
}
} // end foreach
@@ -925,33 +928,39 @@ function PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display, $data,
// put the dropdown sections in correct order
$top = array();
- $bot = array();
- if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'], 'array')) {
- if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'][0])) {
- $top = PMA__foreignDropdownBuild($foreign, $data,
- $GLOBALS['cfg']['ForeignKeyDropdownOrder'][0]);
- }
- if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'][1])) {
- $bot = PMA__foreignDropdownBuild($foreign, $data,
- $GLOBALS['cfg']['ForeignKeyDropdownOrder'][1]);
+ $bottom = array();
+ if ($foreign_display) {
+ if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'], 'array')) {
+ if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'][0])) {
+ $top = PMA__foreignDropdownBuild($foreign, $data,
+ $GLOBALS['cfg']['ForeignKeyDropdownOrder'][0]);
+ }
+ if (PMA_isValid($GLOBALS['cfg']['ForeignKeyDropdownOrder'][1])) {
+ $bottom = PMA__foreignDropdownBuild($foreign, $data,
+ $GLOBALS['cfg']['ForeignKeyDropdownOrder'][1]);
+ }
+ } else {
+ $top = PMA__foreignDropdownBuild($foreign, $data, 'id-content');
+ $bottom = PMA__foreignDropdownBuild($foreign, $data, 'content-id');
}
} else {
- $top = PMA__foreignDropdownBuild($foreign, $data, 'id-content');
- $bot = PMA__foreignDropdownBuild($foreign, $data, 'content-id');
+ $top = PMA__foreignDropdownBuild($foreign, $data, 'id-only');
}
// beginning of dropdown
- $ret = '<option value=""> </option>' . "\n";
-
+ $ret = '<option value=""> </option>';
$top_count = count($top);
if ($max == -1 || $top_count < $max) {
$ret .= implode('', $top);
- if ($top_count > 0) {
- $ret .= ' <option value=""> </option>' . "\n";
- $ret .= ' <option value=""> </option>' . "\n";
+ if ($foreign_display && $top_count > 0) {
+ // this empty option is to visually mark the beginning of the
+ // second series of values (bottom)
+ $ret .= '<option value=""> </option>';
}
}
- $ret .= implode('', $bot);
+ if ($foreign_display) {
+ $ret .= implode('', $bottom);
+ }
return $ret;
} // end of 'PMA_foreignDropdown()' function
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list