Added documentation, fixed some minor bugs/typos
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* function used in table data manipulation pages
|
||||
* @fileoverview function used in table data manipulation pages
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @requires js/functions.js
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -249,13 +253,24 @@ function unNullify(urlField, multi_edit)
|
||||
} // end of the 'unNullify()' function
|
||||
|
||||
/**
|
||||
* Ajax handlers for this page
|
||||
* Ajax handlers for Change Table page
|
||||
*
|
||||
* Actions Ajaxified here:
|
||||
* Submit Data to be inserted into the table
|
||||
* Restart insertion with 'N' rows.
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
//Submission of data to be inserted into table
|
||||
/**
|
||||
* Submission of data to be inserted into table
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
*/
|
||||
$("#insertForm").live('submit', function(event) {
|
||||
|
||||
/**
|
||||
* @var the_form Object referring to the insertion form
|
||||
*/
|
||||
var the_form = $(this);
|
||||
event.preventDefault();
|
||||
|
||||
@@ -265,6 +280,7 @@ $(document).ready(function() {
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize(), function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
|
||||
$("#topmenucontainer")
|
||||
.next('div')
|
||||
.remove()
|
||||
@@ -277,6 +293,7 @@ $(document).ready(function() {
|
||||
$(notice_class).remove();
|
||||
}
|
||||
|
||||
//Clear the data in the forms
|
||||
$(the_form).find('input:reset').trigger('click');
|
||||
}
|
||||
else {
|
||||
@@ -285,15 +302,27 @@ $(document).ready(function() {
|
||||
})
|
||||
}) // end submission of data to be inserted into table
|
||||
|
||||
//Restart Insertion form
|
||||
/**
|
||||
* Restart Insertion form
|
||||
*/
|
||||
$("#insert_rows").live('change', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
* @var curr_rows Number of current insert rows already on page
|
||||
*/
|
||||
var curr_rows = $(".insertRowTable").length;
|
||||
/**
|
||||
* @var target_rows Number of rows the user wants
|
||||
*/
|
||||
var target_rows = $("#insert_rows").val();
|
||||
|
||||
if(curr_rows < target_rows ) {
|
||||
while( curr_rows < target_rows ) {
|
||||
|
||||
/**
|
||||
* @var last_row Object referring to the last row
|
||||
*/
|
||||
var last_row = $("#insertForm").find(".insertRowTable:last");
|
||||
|
||||
//Clone the insert tables
|
||||
@@ -308,17 +337,20 @@ $(document).ready(function() {
|
||||
* name is of format funcs[multi_edit][10][<long random string of alphanum chars>]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var this_name String containing name of the input/select elements
|
||||
*/
|
||||
var this_name = $(this).attr('name');
|
||||
//split at [10], so we have the parts that can be concatenated later
|
||||
/** split {@link this_name} at [10], so we have the parts that can be concatenated later */
|
||||
var name_parts = this_name.split(/\[\d+\]/);
|
||||
//extract the [10]
|
||||
/** extract the [10] from {@link name_parts} */
|
||||
var old_row_index_string = this_name.match(/\[\d+\]/)[0];
|
||||
//extract 10 - had to split into two steps to accomodate double digits
|
||||
/** extract 10 - had to split into two steps to accomodate double digits */
|
||||
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0]);
|
||||
|
||||
//calculate next index i.e. 11
|
||||
/** calculate next index i.e. 11 */
|
||||
var new_row_index = old_row_index + 1;
|
||||
//generate the new name i.e. funcs[multi_edit][11][foobarbaz]
|
||||
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
|
||||
var new_name = name_parts[0] + '[' + new_row_index + ']' + name_parts[1];
|
||||
|
||||
$(this).attr('name', new_name);
|
||||
@@ -331,10 +363,17 @@ $(document).ready(function() {
|
||||
.after('<label for="insert_ignore_check_1">' + PMA_messages['strIgnore'] + '</label>');
|
||||
}
|
||||
else {
|
||||
|
||||
/**
|
||||
* @var last_checkbox Object reference to the last checkbox in #insertForm
|
||||
*/
|
||||
var last_checkbox = $("#insertForm").children('input:checkbox:last');
|
||||
|
||||
/** name of {@link last_checkbox} */
|
||||
var last_checkbox_name = $(last_checkbox).attr('name');
|
||||
/** index of {@link last_checkbox} */
|
||||
var last_checkbox_index = parseInt(last_checkbox_name.match(/\d+/));
|
||||
/** name of new {@link last_checkbox} */
|
||||
var new_name = last_checkbox_name.replace(/\d+/,last_checkbox_index+1);
|
||||
|
||||
$(last_checkbox)
|
||||
@@ -359,4 +398,4 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 'top.frame_content'); //end Ajax handlers
|
||||
}, 'top.frame_content'); //end $(document).ready()
|
Reference in New Issue
Block a user