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.
This commit is contained in:
@@ -6,6 +6,8 @@ $Id$
|
|||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
2004-01-05 Garvin Hicking <returnofthegarv@supergarv.de>
|
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
|
* libraries/functions.js: Reverted row marker patch. See RFE #867284
|
||||||
for details.
|
for details.
|
||||||
* libraries/display_tbl.lib.php, libraries/display_tbl_links.lib.php,
|
* libraries/display_tbl.lib.php, libraries/display_tbl_links.lib.php,
|
||||||
|
@@ -139,30 +139,75 @@ $header = ' <tr>
|
|||||||
echo $header;
|
echo $header;
|
||||||
|
|
||||||
if (isset($disp) && $disp) {
|
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;
|
$count = 0;
|
||||||
while ($relrow = @PMA_mysql_fetch_array($disp)) {
|
while ($relrow = @PMA_mysql_fetch_array($disp)) {
|
||||||
$count++;
|
if ($foreign_display != FALSE) {
|
||||||
$bgcolor = ($count % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
$val = $relrow[$foreign_display];
|
||||||
|
} else {
|
||||||
|
$val = '';
|
||||||
|
}
|
||||||
|
|
||||||
$key = $relrow[$foreign_field];
|
$mysql_key_relrow[$count] = array($relrow[$foreign_field] => $val);
|
||||||
if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
|
$mysql_val_relrow[$count] = array($val => $relrow[$foreign_field]);
|
||||||
$value = (($foreign_display != FALSE) ? htmlspecialchars($relrow[$foreign_display]) : '');
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
if (strlen($val) <= $cfg['LimitChars']) {
|
||||||
|
$value = htmlspecialchars($val);
|
||||||
$vtitle = '';
|
$vtitle = '';
|
||||||
} else {
|
} else {
|
||||||
$vtitle = htmlspecialchars($relrow[$foreign_display]);
|
$vtitle = htmlspecialchars($val);
|
||||||
$value = (($foreign_display != FALSE) ? htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
|
$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;
|
$key_equals_data = isset($data) && $key == $data;
|
||||||
?>
|
?>
|
||||||
<tr>
|
<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 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 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>
|
<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 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>
|
<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>
|
</tr>
|
||||||
|
@@ -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="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); ?>" />
|
<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">
|
<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); ?>&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); ?>&field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
|
||||||
</script>
|
</script>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
|
Reference in New Issue
Block a user