bug #3057481 Unchecking ignore does not work for duplicated insert rows
This commit is contained in:
@@ -222,8 +222,6 @@ function Validator(urlField, multi_edit,theType){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dt.className="";
|
||||
}
|
||||
/* End of datetime validation*/
|
||||
|
||||
@@ -260,6 +258,20 @@ function unNullify(urlField, multi_edit)
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Handles all current checkboxes for Null
|
||||
*
|
||||
*/
|
||||
$('.checkbox_null').bind('click', function(e) {
|
||||
nullify(
|
||||
// use hidden fields populated by tbl_change.php
|
||||
$(this).siblings('.nullify_code').val(),
|
||||
$(this).closest('tr').find('input:hidden').first().val(),
|
||||
$(this).siblings('.hashed_field').val(),
|
||||
$(this).siblings('.multi_edit').val()
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Submission of data to be inserted into table
|
||||
*
|
||||
@@ -302,7 +314,7 @@ $(document).ready(function() {
|
||||
}) // end submission of data to be inserted into table
|
||||
|
||||
/**
|
||||
* Restart Insertion form
|
||||
* Continue Insertion form
|
||||
*/
|
||||
$("#insert_rows").live('change', function(event) {
|
||||
event.preventDefault();
|
||||
@@ -352,8 +364,33 @@ $(document).ready(function() {
|
||||
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
|
||||
var new_name = name_parts[0] + '[' + new_row_index + ']' + name_parts[1];
|
||||
|
||||
var hashed_field = name_parts[1].match(/\[(.+)\]/)[1];
|
||||
$(this).attr('name', new_name);
|
||||
$(this).attr('value', '');
|
||||
|
||||
$(this).filter('.textfield')
|
||||
.attr('value', '')
|
||||
.unbind('change')
|
||||
.attr('onchange', null)
|
||||
.bind('change', function(e) {
|
||||
Validator(
|
||||
hashed_field,
|
||||
new_row_index,
|
||||
$(this).closest('tr').find('span.column_type').html()
|
||||
);
|
||||
})
|
||||
.end();
|
||||
|
||||
$(this).filter('.checkbox_null')
|
||||
.bind('click', function(e) {
|
||||
nullify(
|
||||
$(this).siblings('.nullify_code').val(),
|
||||
$(this).closest('tr').find('input:hidden').first().val(),
|
||||
hashed_field,
|
||||
'[multi_edit][' + new_row_index + ']'
|
||||
);
|
||||
})
|
||||
.end();
|
||||
|
||||
});
|
||||
|
||||
//Insert/Clone the ignore checkboxes
|
||||
@@ -378,7 +415,7 @@ $(document).ready(function() {
|
||||
|
||||
$(last_checkbox)
|
||||
.clone()
|
||||
.attr({'id':new_name, 'name': new_name})
|
||||
.attr({'id':new_name, 'name': new_name, 'checked': true})
|
||||
.add('label[for^=insert_ignore]:last')
|
||||
.clone()
|
||||
.attr('for', new_name)
|
||||
|
@@ -431,8 +431,8 @@ foreach ($rows as $row_id => $vrow) {
|
||||
<input type="hidden" name="fields_name<?php echo $field_name_appendix; ?>" value="<?php echo $field['Field_html']; ?>"/>
|
||||
</td>
|
||||
<?php if ($cfg['ShowFieldTypesInDataEditView']) { ?>
|
||||
<td align="center"<?php echo $field['wrap']; ?>>
|
||||
<?php echo $field['pma_type']; ?>
|
||||
<td align="center"<?php echo $field['wrap']; ?>><span class="column_type">
|
||||
<?php echo $field['pma_type']; ?></span>
|
||||
</td>
|
||||
|
||||
<?php } //End if
|
||||
@@ -614,32 +614,35 @@ foreach ($rows as $row_id => $vrow) {
|
||||
}
|
||||
echo ' />' . "\n";
|
||||
|
||||
echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
|
||||
echo ' <input type="checkbox" class="checkbox_null" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
|
||||
. ' name="fields_null' . $field_name_appendix . '"';
|
||||
if ($real_null_value && !$field['first_timestamp']) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' id="field_' . ($idindex) . '_2"';
|
||||
$onclick = ' onclick="if (this.checked) {nullify(';
|
||||
echo ' id="field_' . ($idindex) . '_2" />';
|
||||
|
||||
// nullify_code is needed by the js nullify() function
|
||||
if (strstr($field['True_Type'], 'enum')) {
|
||||
if (strlen($field['Type']) > 20) {
|
||||
$onclick .= '1, ';
|
||||
$nullify_code = '1';
|
||||
} else {
|
||||
$onclick .= '2, ';
|
||||
$nullify_code = '2';
|
||||
}
|
||||
} elseif (strstr($field['True_Type'], 'set')) {
|
||||
$onclick .= '3, ';
|
||||
$nullify_code = '3';
|
||||
} elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == false) {
|
||||
// foreign key in a drop-down
|
||||
$onclick .= '4, ';
|
||||
$nullify_code = '4';
|
||||
} elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == true) {
|
||||
// foreign key with a browsing icon
|
||||
$onclick .= '6, ';
|
||||
$nullify_code = '6';
|
||||
} else {
|
||||
$onclick .= '5, ';
|
||||
$nullify_code = '5';
|
||||
}
|
||||
$onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n";
|
||||
echo $onclick;
|
||||
// to be able to generate calls to nullify() in jQuery
|
||||
echo '<input type="hidden" class="nullify_code" name="nullify_code' . $field_name_appendix . '" value="' . $nullify_code . '" />';
|
||||
echo '<input type="hidden" class="hashed_field" name="hashed_field' . $field_name_appendix . '" value="' . $field['Field_md5'] . '" />';
|
||||
echo '<input type="hidden" class="multi_edit" name="multi_edit' . $field_name_appendix . '" value="' . PMA_escapeJsString($vkey) . '" />';
|
||||
}
|
||||
echo ' </td>' . "\n";
|
||||
|
||||
|
Reference in New Issue
Block a user