[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_7-10093-g8c5f758
Marc Delisle
lem9 at users.sourceforge.net
Mon Sep 13 00:58:49 CEST 2010
The branch, master has been updated
via 8c5f758e4ad5c2708eabdeae4f1dd81efaddf591 (commit)
from ae04356ed298c86901fb4948596b8c0c7fe1f449 (commit)
- Log -----------------------------------------------------------------
commit 8c5f758e4ad5c2708eabdeae4f1dd81efaddf591
Author: Marc Delisle <marc at infomarc.info>
Date: Sun Sep 12 18:58:38 2010 -0400
bug #3057481 Unchecking ignore does not work for duplicated insert rows
-----------------------------------------------------------------------
Summary of changes:
js/tbl_change.js | 47 ++++++++++++++++++++++++++++++++++++++++++-----
tbl_change.php | 29 ++++++++++++++++-------------
2 files changed, 58 insertions(+), 18 deletions(-)
diff --git a/js/tbl_change.js b/js/tbl_change.js
index 4a4e444..52d8432 100644
--- a/js/tbl_change.js
+++ b/js/tbl_change.js
@@ -222,8 +222,6 @@ function Validator(urlField, multi_edit,theType){
}
}
}
-
- dt.className="";
}
/* End of datetime validation*/
@@ -261,6 +259,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
*
* @uses PMA_ajaxShowMessage()
@@ -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)
diff --git a/tbl_change.php b/tbl_change.php
index 6d2e957..3e4d814 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -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";
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list