This is not a primary key but a row number

This commit is contained in:
Marc Delisle
2010-12-19 05:42:40 -05:00
parent 02b9dc8008
commit 386581bcb6
3 changed files with 13 additions and 13 deletions

View File

@@ -39,13 +39,13 @@ if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
$foreignData = PMA_getForeignData($foreigners, $field, $override_total, isset($foreign_filter) ? $foreign_filter : '', $foreign_limit); $foreignData = PMA_getForeignData($foreigners, $field, $override_total, isset($foreign_filter) ? $foreign_filter : '', $foreign_limit);
if (isset($pk)) { if (isset($rownumber)) {
$pk_uri = '&pk=' . urlencode($pk); $rownumber_param = '&rownumber=' . urlencode($rownumber);
?> ?>
<input type="hidden" name="pk" value="<?php echo htmlspecialchars($pk); ?>" /> <input type="hidden" name="rownumber" value="<?php echo htmlspecialchars($rownumber); ?>" />
<?php <?php
} else { } else {
$pk_uri = ''; $rownumber_param = '';
} }
$gotopage = ''; $gotopage = '';
@@ -65,7 +65,7 @@ if (is_array($foreignData['disp_row'])) {
$gotopage = PMA_pageselector( $gotopage = PMA_pageselector(
'browse_foreigners.php?field=' . urlencode($field) . 'browse_foreigners.php?field=' . urlencode($field) .
'&amp;' . PMA_generate_common_url($db, $table) '&amp;' . PMA_generate_common_url($db, $table)
. $pk_uri . . $rownumber_param .
'&amp;fieldkey=' . (isset($fieldkey) ? urlencode($fieldkey) : '') . '&amp;fieldkey=' . (isset($fieldkey) ? urlencode($fieldkey) : '') .
'&amp;foreign_filter=' . (isset($foreign_filter) ? urlencode($foreign_filter) : '') . '&amp;foreign_filter=' . (isset($foreign_filter) ? urlencode($foreign_filter) : '') .
'&amp;', '&amp;',
@@ -102,8 +102,8 @@ if (is_array($foreignData['disp_row'])) {
if (opener && opener.document && opener.document.insertForm) { if (opener && opener.document && opener.document.insertForm) {
var field = 'fields'; var field = 'fields';
<?php if (isset($pk)) { ?> <?php if (isset($rownumber)) { ?>
var element_name = field + '[multi_edit][<?php echo htmlspecialchars($pk); ?>][' + fieldmd5 + ']'; var element_name = field + '[multi_edit][<?php echo htmlspecialchars($rownumber); ?>][' + fieldmd5 + ']';
<?php } else { ?> <?php } else { ?>
var element_name = field + '[]'; var element_name = field + '[]';
<?php } ?> <?php } ?>
@@ -141,8 +141,8 @@ if (is_array($foreignData['disp_row'])) {
<input type="hidden" name="field" value="<?php echo htmlspecialchars($field); ?>" /> <input type="hidden" name="field" value="<?php echo htmlspecialchars($field); ?>" />
<input type="hidden" name="fieldkey" <input type="hidden" name="fieldkey"
value="<?php echo isset($fieldkey) ? htmlspecialchars($fieldkey) : ''; ?>" /> value="<?php echo isset($fieldkey) ? htmlspecialchars($fieldkey) : ''; ?>" />
<?php if (isset($pk)) { ?> <?php if (isset($rownumber)) { ?>
<input type="hidden" name="pk" value="<?php echo htmlspecialchars($pk); ?>" /> <input type="hidden" name="rownumber" value="<?php echo htmlspecialchars($rownumber); ?>" />
<?php } ?> <?php } ?>
<span class="formelement"> <span class="formelement">
<label for="input_foreign_filter"><?php echo __('Search') . ':'; ?></label> <label for="input_foreign_filter"><?php echo __('Search') . ':'; ?></label>

View File

@@ -430,10 +430,10 @@ $(document).ready(function() {
.find('.foreign_values_anchor') .find('.foreign_values_anchor')
.each(function() { .each(function() {
$anchor = $(this); $anchor = $(this);
var new_value = 'pk=' + new_row_index; var new_value = 'rownumber=' + new_row_index;
// needs improvement in case something else inside // needs improvement in case something else inside
// the href contains this pattern // the href contains this pattern
var new_href = $anchor.attr('href').replace(/pk=\d+/, new_value); var new_href = $anchor.attr('href').replace(/rownumber=\d+/, new_value);
$anchor.attr('href', new_href ); $anchor.attr('href', new_href );
}); });

View File

@@ -285,7 +285,7 @@ foreach ($rows as $row_id => $vrow) {
} }
$jsvkey = $row_id; $jsvkey = $row_id;
$browse_foreigners_uri = '&amp;pk=' . $row_id; $rownumber_param = '&amp;rownumber=' . $row_id;
$vkey = '[multi_edit][' . $jsvkey . ']'; $vkey = '[multi_edit][' . $jsvkey . ']';
$vresult = (isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result); $vresult = (isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result);
@@ -659,7 +659,7 @@ foreach ($rows as $row_id => $vrow) {
tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
id="field_<?php echo ($idindex); ?>_3" id="field_<?php echo ($idindex); ?>_3"
value="<?php echo htmlspecialchars($data); ?>" /> value="<?php echo htmlspecialchars($data); ?>" />
<a class="hide foreign_values_anchor" 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 PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a> <a class="hide foreign_values_anchor" 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 PMA_escapeJsString(urlencode($field['Field']) . $rownumber_param); ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>
<?php <?php
} elseif (is_array($foreignData['disp_row'])) { } elseif (is_array($foreignData['disp_row'])) {
echo $backup_field . "\n"; echo $backup_field . "\n";