Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarvin Hicking <me@supergarv.de>2004-01-05 19:56:46 +0300
committerGarvin Hicking <me@supergarv.de>2004-01-05 19:56:46 +0300
commite1a7b0d74cb165e5b58a098f4cfcbee3f442ce16 (patch)
treecae63c1441c93241af84d68c5af4e5d7be6fb3a4 /browse_foreigners.php
parent62de51e0858dcac392c2c9812ffcc96f2ef7ea19 (diff)
Improved browsing foreign windows as discussed in 868396. Please see my entry there, there is a known limitation to the new way of sorting we may need to straighten out.
Diffstat (limited to 'browse_foreigners.php')
-rw-r--r--browse_foreigners.php65
1 files changed, 55 insertions, 10 deletions
diff --git a/browse_foreigners.php b/browse_foreigners.php
index f18ce72f93..5461bc39f2 100644
--- a/browse_foreigners.php
+++ b/browse_foreigners.php
@@ -139,30 +139,75 @@ $header = ' <tr>
echo $header;
if (isset($disp) && $disp) {
+ function dimsort($arrayA, $arrayB) {
+ $keyA = key($arrayA);
+ $keyB = key($arrayB);
+
+ if ($arrayA[$keyA] == $arrayB[$keyB]) {
+ return 0;
+ }
+
+ return ($arrayA[$keyA] < $arrayB[$keyB]) ? -1 : 1;
+ }
+
+ $mysql_key_relrow = array();
+ $mysql_val_relrow = array();
$count = 0;
while ($relrow = @PMA_mysql_fetch_array($disp)) {
+ if ($foreign_display != FALSE) {
+ $val = $relrow[$foreign_display];
+ } else {
+ $val = '';
+ }
+
+ $mysql_key_relrow[$count] = array($relrow[$foreign_field] => $val);
+ $mysql_val_relrow[$count] = array($val => $relrow[$foreign_field]);
$count++;
- $bgcolor = ($count % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
+ }
+
+ usort($mysql_val_relrow, 'dimsort');
+
+ $hcount = 0;
+ for ($i = 0; $i < $count; $i++) {
+ $hcount++;
+ $bgcolor = ($hcount % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
+
+ if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
+ echo $header;
+ $hcount = -1;
+ }
+
+
+ $val = key($mysql_val_relrow[$i]);
+ $key = $mysql_val_relrow[$i][$val];
- $key = $relrow[$foreign_field];
- if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
- $value = (($foreign_display != FALSE) ? htmlspecialchars($relrow[$foreign_display]) : '');
+ if (strlen($val) <= $cfg['LimitChars']) {
+ $value = htmlspecialchars($val);
$vtitle = '';
} else {
- $vtitle = htmlspecialchars($relrow[$foreign_display]);
- $value = (($foreign_display != FALSE) ? htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
+ $vtitle = htmlspecialchars($val);
+ $value = htmlspecialchars(substr($val, 0, $cfg['LimitChars']) . '...');
}
- if ($cfg['RepeatCells'] > 0 && $count > $cfg['RepeatCells']) {
- echo $header;
- $count = -1;
- }
$key_equals_data = isset($data) && $key == $data;
?>
<tr>
<td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
<td width="20%"><img src="images/spacer.gif" alt="" width="1" height="1"></td>
+<?php
+ $key = key($mysql_key_relrow[$i]);
+ $val = $mysql_key_relrow[$i][$key];
+ if (strlen($val) <= $cfg['LimitChars']) {
+ $value = htmlspecialchars($val);
+ $vtitle = '';
+ } else {
+ $vtitle = htmlspecialchars($val);
+ $value = htmlspecialchars(substr($val, 0, $cfg['LimitChars']) . '...');
+ }
+
+ $key_equals_data = isset($data) && $key == $data;
+?>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
<td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
</tr>