"Continue insertion" feature did not work with "Browse foreign values" links

This commit is contained in:
Marc Delisle
2010-12-18 08:47:50 -05:00
parent 45ec0da621
commit 02b9dc8008
2 changed files with 23 additions and 14 deletions

View File

@@ -258,6 +258,9 @@ function unNullify(urlField, multi_edit)
*/
$(document).ready(function() {
// these were hidden via the "hide" class
$('.foreign_values_anchor').show();
/**
* Handles all current checkboxes for Null
*
@@ -363,10 +366,15 @@ $(document).ready(function() {
*/
var last_row = $("#insertForm").find(".insertRowTable:last");
// need to access this at more than one level
// (also needs improvement because it should be calculated
// just once per cloned row, not once per column)
var new_row_index = 0;
//Clone the insert tables
$(last_row)
.clone()
.insertBefore("#insertForm > fieldset")
.insertBefore("#actions_panel")
.find('input[name*=multi_edit],select[name*=multi_edit]')
.each(function() {
@@ -387,7 +395,7 @@ $(document).ready(function() {
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0]);
/** calculate next index i.e. 11 */
var new_row_index = old_row_index + 1;
new_row_index = old_row_index + 1;
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
var new_name = name_parts[0] + '[' + new_row_index + ']' + name_parts[1];
@@ -417,7 +425,16 @@ $(document).ready(function() {
);
})
.end();
})
.end()
.find('.foreign_values_anchor')
.each(function() {
$anchor = $(this);
var new_value = 'pk=' + new_row_index;
// needs improvement in case something else inside
// the href contains this pattern
var new_href = $anchor.attr('href').replace(/pk=\d+/, new_value);
$anchor.attr('href', new_href );
});
//Insert/Clone the ignore checkboxes

View File

@@ -659,15 +659,7 @@ foreach ($rows as $row_id => $vrow) {
tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
id="field_<?php echo ($idindex); ?>_3"
value="<?php echo htmlspecialchars($data); ?>" />
<script type="text/javascript">
//<![CDATA[
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false"');
document.write(' href="browse_foreigners.php?');
document.write('<?php echo PMA_generate_common_url($db, $table); ?>');
document.writeln('&amp;field=<?php echo PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>">');
document.writeln('<?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
//]]>
</script>
<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>
<?php
} elseif (is_array($foreignData['disp_row'])) {
echo $backup_field . "\n";
@@ -1015,7 +1007,7 @@ $(function() {
?>
<br />
<fieldset>
<fieldset id="actions_panel">
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="middle" nowrap="nowrap">