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
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.
-rwxr-xr-xChangeLog2
-rw-r--r--browse_foreigners.php65
-rw-r--r--tbl_change.php2
3 files changed, 58 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index f094e42775..c9d5f2fe0c 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ $Id$
$Source$
2004-01-05 Garvin Hicking <returnofthegarv@supergarv.de>
+ * browse_foreigners.php, tbl_change.php: Sort key/value pairs
+ as discussed in RFE #868369. Made foreigner window resizable.
* libraries/functions.js: Reverted row marker patch. See RFE #867284
for details.
* libraries/display_tbl.lib.php, libraries/display_tbl_links.lib.php,
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>
diff --git a/tbl_change.php b/tbl_change.php
index 61729a7244..76e201b8ab 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -505,7 +505,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo ($i * $m_rows); ?>_1" />
<input type="text" name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $mrows); ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
<script type="text/javascript" language="javascript">
- document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
+ document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
</script>
</td>
<?php