Fixed JSDoc

This commit is contained in:
Crack
2010-06-11 23:42:36 +02:00
parent 4572e3ec82
commit 082604eed3

View File

@@ -1,7 +1,5 @@
/** /**
* functions used in setup script * Functions used in configuration forms
*
* @version $Id$
*/ */
// show this window in top frame // show this window in top frame
@@ -18,7 +16,7 @@ var PMA_messages = {};
/** /**
* Returns field type * Returns field type
* *
* @param Element field * @param {Element} field
*/ */
function getFieldType(field) { function getFieldType(field) {
field = $(field); field = $(field);
@@ -42,9 +40,9 @@ function getFieldType(field) {
* o boolean - if field_type is 'checkbox' * o boolean - if field_type is 'checkbox'
* o Array of values - if field_type is 'select' * o Array of values - if field_type is 'select'
* *
* @param Element field * @param {Element} field
* @param String field_type see getFieldType * @param {String} field_type see {@link #getFieldType}
* @param mixed value * @param {String|Boolean} [value]
*/ */
function setFieldValue(field, field_type, value) { function setFieldValue(field, field_type, value) {
field = $(field); field = $(field);
@@ -80,9 +78,9 @@ function setFieldValue(field, field_type, value) {
* o boolean - if type is 'checkbox' * o boolean - if type is 'checkbox'
* o Array of values - if type is 'select' * o Array of values - if type is 'select'
* *
* @param Element field * @param {Element} field
* @param String field_type see getFieldType * @param {String} field_type returned by {@link #getFieldType}
* @return mixed * @type Boolean|String|String[]
*/ */
function getFieldValue(field, field_type) { function getFieldValue(field, field_type) {
field = $(field); field = $(field);
@@ -127,8 +125,8 @@ function getAllValues() {
/** /**
* Checks whether field has its default value * Checks whether field has its default value
* *
* @param Element field * @param {Element} field
* @param String type * @param {String} type
* @return boolean * @return boolean
*/ */
function checkFieldDefault(field, type) { function checkFieldDefault(field, type) {
@@ -160,7 +158,7 @@ function checkFieldDefault(field, type) {
/** /**
* Returns element's id prefix * Returns element's id prefix
* @param Element element * @param {Element} element
*/ */
function getIdPrefix(element) { function getIdPrefix(element) {
return $(element).attr('id').replace(/[^-]+$/, ''); return $(element).attr('id').replace(/[^-]+$/, '');
@@ -210,7 +208,7 @@ var validators = {
/** /**
* Validates positive number * Validates positive number
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
validate_positive_number: function (isKeyUp) { validate_positive_number: function (isKeyUp) {
var result = this.value != '0' && validators._regexp_numeric.test(this.value); var result = this.value != '0' && validators._regexp_numeric.test(this.value);
@@ -219,7 +217,7 @@ var validators = {
/** /**
* Validates non-negative number * Validates non-negative number
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
validate_non_negative_number: function (isKeyUp) { validate_non_negative_number: function (isKeyUp) {
var result = validators._regexp_numeric.test(this.value); var result = validators._regexp_numeric.test(this.value);
@@ -228,7 +226,7 @@ var validators = {
/** /**
* Validates port number * Validates port number
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
validate_port_number: function(isKeyUp) { validate_port_number: function(isKeyUp) {
var result = validators._regexp_numeric.test(this.value) && this.value != '0'; var result = validators._regexp_numeric.test(this.value) && this.value != '0';
@@ -242,7 +240,7 @@ var validators = {
/** /**
* hide_db field * hide_db field
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
hide_db: function(isKeyUp) { hide_db: function(isKeyUp) {
if (!isKeyUp && this.value != '') { if (!isKeyUp && this.value != '') {
@@ -255,7 +253,7 @@ var validators = {
/** /**
* TrustedProxies field * TrustedProxies field
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
TrustedProxies: function(isKeyUp) { TrustedProxies: function(isKeyUp) {
if (!isKeyUp && this.value != '') { if (!isKeyUp && this.value != '') {
@@ -271,7 +269,7 @@ var validators = {
/** /**
* Validates Server fieldset * Validates Server fieldset
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
Server: function(isKeyUp) { Server: function(isKeyUp) {
if (!isKeyUp) { if (!isKeyUp) {
@@ -282,7 +280,7 @@ var validators = {
/** /**
* Validates Server_login_options fieldset * Validates Server_login_options fieldset
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
Server_login_options: function(isKeyUp) { Server_login_options: function(isKeyUp) {
return validators._fieldset.Server.apply(this, [isKeyUp]); return validators._fieldset.Server.apply(this, [isKeyUp]);
@@ -290,7 +288,7 @@ var validators = {
/** /**
* Validates Server_pmadb fieldset * Validates Server_pmadb fieldset
* *
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
Server_pmadb: function(isKeyUp) { Server_pmadb: function(isKeyUp) {
if (isKeyUp) { if (isKeyUp) {
@@ -311,9 +309,9 @@ var validators = {
/** /**
* Calls server-side validation procedures * Calls server-side validation procedures
* *
* @param Element parent input field in <fieldset> or <fieldset> * @param {Element} parent input field in <fieldset> or <fieldset>
* @param String id validator id * @param {String} id validator id
* @param Object values values hash (element_id: value) * @param {Object} values values hash {element1_id: value, ...}
*/ */
function ajaxValidate(parent, id, values) { function ajaxValidate(parent, id, values) {
parent = $(parent); parent = $(parent);
@@ -349,7 +347,7 @@ function ajaxValidate(parent, id, values) {
} else if (typeof response['error'] != 'undefined') { } else if (typeof response['error'] != 'undefined') {
error[parent.id] = [response['error']]; error[parent.id] = [response['error']];
} else { } else {
for (key in response) { for (var key in response) {
var value = response[key]; var value = response[key];
error[key] = jQuery.isArray(value) ? value : [value]; error[key] = jQuery.isArray(value) ? value : [value];
} }
@@ -367,10 +365,10 @@ function ajaxValidate(parent, id, values) {
/** /**
* Registers validator for given field * Registers validator for given field
* *
* @param String id field id * @param {String} id field id
* @param String type validator (key in validators object) * @param {String} type validator (key in validators object)
* @param boolean onKeyUp whether fire on key up * @param {boolean} onKeyUp whether fire on key up
* @param mixed params validation function parameters * @param {object} params validation function parameters
*/ */
function validateField(id, type, onKeyUp, params) { function validateField(id, type, onKeyUp, params) {
if (typeof validators[type] == 'undefined') { if (typeof validators[type] == 'undefined') {
@@ -385,9 +383,10 @@ function validateField(id, type, onKeyUp, params) {
/** /**
* Returns valdiation functions associated with form field * Returns valdiation functions associated with form field
* *
* @param String field_id form field id * @param {String} field_id form field id
* @param boolean onKeyUpOnly see validateField * @param {boolean} onKeyUpOnly see validateField
* @return Array array of [function, paramseters to be passed to function] * @type Array
* @return array of [function, paramseters to be passed to function]
*/ */
function getFieldValidators(field_id, onKeyUpOnly) { function getFieldValidators(field_id, onKeyUpOnly) {
// look for field bound validator // look for field bound validator
@@ -417,10 +416,10 @@ function getFieldValidators(field_id, onKeyUpOnly) {
* WARNING: created DOM elements must be identical with the ones made by * WARNING: created DOM elements must be identical with the ones made by
* display_input() in FormDisplay.tpl.php! * display_input() in FormDisplay.tpl.php!
* *
* @param Object error list (key: field id, value: error array) * @param {Object} error_list list of errors in the form {field id: error array}
*/ */
function displayErrors(error_list) { function displayErrors(error_list) {
for (field_id in error_list) { for (var field_id in error_list) {
var errors = error_list[field_id]; var errors = error_list[field_id];
var field = $('#'+field_id); var field = $('#'+field_id);
var isFieldset = field.attr('tagName') == 'FIELDSET'; var isFieldset = field.attr('tagName') == 'FIELDSET';
@@ -460,9 +459,9 @@ function displayErrors(error_list) {
/** /**
* Validates fieldset and puts errors in 'errors' object * Validates fieldset and puts errors in 'errors' object
* *
* @param Element field * @param {Element} fieldset
* @param boolean isKeyUp * @param {boolean} isKeyUp
* @param Object errors * @param {Object} errors
*/ */
function validate_fieldset(fieldset, isKeyUp, errors) { function validate_fieldset(fieldset, isKeyUp, errors) {
fieldset = $(fieldset); fieldset = $(fieldset);
@@ -483,9 +482,9 @@ function validate_fieldset(fieldset, isKeyUp, errors) {
/** /**
* Validates form field and puts errors in 'errors' object * Validates form field and puts errors in 'errors' object
* *
* @param Element field * @param {Element} field
* @param boolean isKeyUp * @param {boolean} isKeyUp
* @param Object errors * @param {Object} errors
*/ */
function validate_field(field, isKeyUp, errors) { function validate_field(field, isKeyUp, errors) {
field = $(field); field = $(field);
@@ -506,8 +505,8 @@ function validate_field(field, isKeyUp, errors) {
/** /**
* Validates form field and parent fieldset * Validates form field and parent fieldset
* *
* @param Element field * @param {Element} field
* @param boolean isKeyUp * @param {boolean} isKeyUp
*/ */
function validate_field_and_fieldset(field, isKeyUp) { function validate_field_and_fieldset(field, isKeyUp) {
field = $(field); field = $(field);
@@ -520,7 +519,7 @@ function validate_field_and_fieldset(field, isKeyUp) {
/** /**
* Marks field depending on its value (system default or custom) * Marks field depending on its value (system default or custom)
* *
* @param Element field * @param {Element} field
*/ */
function markField(field) { function markField(field) {
field = $(field); field = $(field);
@@ -536,8 +535,8 @@ function markField(field) {
/** /**
* Enables or disables the "restore default value" button * Enables or disables the "restore default value" button
* *
* @param Element field * @param {Element} field
* @param bool display * @param {boolean} display
*/ */
function setRestoreDefaultBtn(field, display) { function setRestoreDefaultBtn(field, display) {
var el = $(field).closest('td').find('.restore-default'); var el = $(field).closest('td').find('.restore-default');
@@ -599,7 +598,7 @@ $(function() {
/** /**
* Sets active tab * Sets active tab
* *
* @param Element tab_link * @param {Element} tab_link
*/ */
function setTab(tab_link) { function setTab(tab_link) {
var tabs_menu = $(tab_link).closest('.tabs'); var tabs_menu = $(tab_link).closest('.tabs');
@@ -666,7 +665,7 @@ $(function() {
// //
$(function() { $(function() {
$('input[type=button]').click(function(e) { $('input[type=button]').click(function() {
var fields = $(this).closest('fieldset').find('input, select, textarea'); var fields = $(this).closest('fieldset').find('input, select, textarea');
for (var i = 0, imax = fields.length; i < imax; i++) { for (var i = 0, imax = fields.length; i < imax; i++) {
setFieldValue(fields[i], getFieldType(fields[i])); setFieldValue(fields[i], getFieldType(fields[i]));
@@ -685,7 +684,7 @@ $(function() {
/** /**
* Restores field's default value * Restores field's default value
* *
* @param String field_id * @param {String} field_id
*/ */
function restoreField(field_id) { function restoreField(field_id) {
var field = $('#'+field_id); var field = $('#'+field_id);