improve js validators
add missing validations and language strings
This commit is contained in:
11
js/config.js
11
js/config.js
@@ -169,13 +169,16 @@ var validate = {};
|
||||
// form validator list
|
||||
var validators = {
|
||||
// regexp: numeric value
|
||||
_regexp_numeric: new RegExp('^[0-9]*$'),
|
||||
_regexp_numeric: new RegExp('^[0-9]+$'),
|
||||
/**
|
||||
* Validates positive number
|
||||
*
|
||||
* @param {boolean} isKeyUp
|
||||
*/
|
||||
validate_positive_number: function (isKeyUp) {
|
||||
if (isKeyUp && this.value == '') {
|
||||
return true;
|
||||
}
|
||||
var result = this.value != '0' && validators._regexp_numeric.test(this.value);
|
||||
return result ? true : PMA_messages['error_nan_p'];
|
||||
},
|
||||
@@ -185,6 +188,9 @@ var validators = {
|
||||
* @param {boolean} isKeyUp
|
||||
*/
|
||||
validate_non_negative_number: function (isKeyUp) {
|
||||
if (isKeyUp && this.value == '') {
|
||||
return true;
|
||||
}
|
||||
var result = validators._regexp_numeric.test(this.value);
|
||||
return result ? true : PMA_messages['error_nan_nneg'];
|
||||
},
|
||||
@@ -194,6 +200,9 @@ var validators = {
|
||||
* @param {boolean} isKeyUp
|
||||
*/
|
||||
validate_port_number: function(isKeyUp) {
|
||||
if (isKeyUp && this.value == '') {
|
||||
return true;
|
||||
}
|
||||
var result = validators._regexp_numeric.test(this.value) && this.value != '0';
|
||||
if (!result || this.value > 65536) {
|
||||
result = PMA_messages['error_incorrect_port'];
|
||||
|
@@ -39,6 +39,7 @@ $cfg_db['LeftDefaultTabTable'] = array(
|
||||
$cfg_db['NavigationBarIconic'] = array(true, false, 'both');
|
||||
$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
|
||||
$cfg_db['ProtectBinary'] = array(false, 'blob', 'all');
|
||||
$cfg_db['DefaultDisplay'] = array('horizontal', 'vertical', 'horizontalflipped');
|
||||
$cfg_db['CharEditing'] = array('input', 'textarea');
|
||||
$cfg_db['PropertiesIconic'] = array(true, false, 'both');
|
||||
$cfg_db['DefaultTabServer'] = array(
|
||||
@@ -97,20 +98,26 @@ $cfg_db['_overrides']['Servers/1/extension'] = extension_loaded('mysqli')
|
||||
* Use only full paths and form ids
|
||||
*/
|
||||
$cfg_db['_validators'] = array(
|
||||
'CharTextareaCols' => 'validate_positive_number',
|
||||
'CharTextareaRows' => 'validate_positive_number',
|
||||
'DefaultPropDisplay' => 'validate_DefaultPropDisplay',
|
||||
'ForeignKeyMaxLimit' => 'validate_positive_number',
|
||||
'Import/skip_queries' => 'validate_non_negative_number',
|
||||
'InsertRows' => 'validate_positive_number',
|
||||
'LeftFrameTableLevel' => 'validate_positive_number',
|
||||
'LimitChars' => 'validate_positive_number',
|
||||
'LoginCookieValidity' => 'validate_positive_number',
|
||||
'LoginCookieStore' => 'validate_non_negative_number',
|
||||
'MaxCharactersInDisplayedSQL' => 'validate_positive_number',
|
||||
'MaxRows' => 'validate_positive_number',
|
||||
'QueryHistoryMax' => 'validate_positive_number',
|
||||
'QueryWindowWidth' => 'validate_positive_number',
|
||||
'QueryWindowHeight' => 'validate_positive_number',
|
||||
'RepeatCells' => 'validate_non_negative_number',
|
||||
'Server' => 'validate_server',
|
||||
'Server_pmadb' => 'validate_pmadb',
|
||||
'Servers/1/port' => 'validate_port_number',
|
||||
'Servers/1/hide_db' => 'validate_regex',
|
||||
'TrustedProxies' => 'validate_trusted_proxies',
|
||||
'LoginCookieValidity' => 'validate_positive_number',
|
||||
'LoginCookieStore' => 'validate_non_negative_number',
|
||||
'QueryHistoryMax' => 'validate_positive_number',
|
||||
'LeftFrameTableLevel' => 'validate_positive_number',
|
||||
'MaxRows' => 'validate_positive_number',
|
||||
'CharTextareaCols' => 'validate_positive_number',
|
||||
'CharTextareaRows' => 'validate_positive_number',
|
||||
'InsertRows' => 'validate_positive_number',
|
||||
'ForeignKeyMaxLimit' => 'validate_positive_number',
|
||||
'DefaultPropDisplay' => 'validate_DefaultPropDisplay',
|
||||
'Import/skip_queries' => 'validate_non_negative_number');
|
||||
'TextareaCols' => 'validate_positive_number',
|
||||
'TrustedProxies' => 'validate_trusted_proxies');
|
||||
?>
|
@@ -43,6 +43,7 @@ $strSetupConfirm_name = __('Confirm DROP queries');
|
||||
$strSetupCtrlArrowsMoving_name = __('Field navigation using Ctrl+Arrows');
|
||||
$strSetupDefaultCharset_desc = __('Default character set used for conversions');
|
||||
$strSetupDefaultCharset_name = __('Default character set');
|
||||
$strSetupDefaultDisplay_name = __('Default display direction');
|
||||
$strSetupDefaultLanguage = __('Default language');
|
||||
$strSetupDefaultPropDisplay_name = __('Display direction for altering/creating columns');
|
||||
$strSetupDefaultPropDisplay_desc = __('[kbd]horizontal[/kbd], [kbd]vertical[/kbd] or a number that indicates maximum number for which vertical model is used');
|
||||
@@ -54,6 +55,8 @@ $strSetupDefaultTabServer_name = __('Default server tab');
|
||||
$strSetupDefaultTabTable_desc = __('Tab that is displayed when entering a table');
|
||||
$strSetupDefaultTabTable_name = __('Default table tab');
|
||||
$strSetupDirectoryNotice = __('This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.');
|
||||
$strSetupDisplayBinaryAsHex_name = __('Show binary contents as HEX');
|
||||
$strSetupDisplayBinaryAsHex_desc = __('Show binary contents as HEX by default');
|
||||
$strSetupDisplayDatabasesList_desc = __('Show database listing as a list instead of a drop down');
|
||||
$strSetupDisplayDatabasesList_name = __('Display databases as a list');
|
||||
$strSetupDisplay = __('Display');
|
||||
@@ -61,6 +64,8 @@ $strSetupDisplayServersList_desc = __('Show server listing as a list instead of
|
||||
$strSetupDisplayServersList_name = __('Display servers as a list');
|
||||
$strSetupDonateLink = __('Donate');
|
||||
$strSetupDownload = __('Download');
|
||||
$strSetupEditInWindow_name = __('Edit in window');
|
||||
$strSetupEditInWindow_desc = __('Edit SQL queries in popup window');
|
||||
$strSetupEndOfLine = __('End of line');
|
||||
$strSetupErrorIconic_name = __('Iconic errors');
|
||||
$strSetupErrorIconic_desc = __('Show icons for warning, error and information messages');
|
||||
@@ -109,7 +114,7 @@ $strSetupForm_Other_core_settings = __('Other core settings');
|
||||
$strSetupForm_Query_window_desc = __('Customize query window options');
|
||||
$strSetupForm_Query_window = __('Query window');
|
||||
$strSetupForm_Page_titles = __('Page titles');
|
||||
$strSetupForm_Page_titles_desc = __('Specify windows\' title bar. Refer to [a@Documentation.html#cfg_TitleTable]documentation[/a] for magic strings that can be used to get special values.');
|
||||
$strSetupForm_Page_titles_desc = __('Specify browser\'s title bar text. Refer to [a@Documentation.html#cfg_TitleTable]documentation[/a] for magic strings that can be used to get special values.');
|
||||
$strSetupForm_Security_desc = __('Please note that phpMyAdmin is just a user interface and its features do not limit MySQL');
|
||||
$strSetupForm_Security = __('Security');
|
||||
$strSetupForm_Server = __('Basic settings');
|
||||
@@ -178,6 +183,8 @@ $strSetupLeftPointerEnable_name = __('Enable highlighting');
|
||||
$strSetupLetUserChoose = __('let the user choose');
|
||||
$strSetupLightTabs_desc = __('Use less graphically intense tabs');
|
||||
$strSetupLightTabs_name = __('Light tabs');
|
||||
$strSetupLimitChars_name = __('Limit column characters');
|
||||
$strSetupLimitChars_desc = __('Maximum number of characters shown in any non-numeric column on browse view');
|
||||
$strSetupLoad = __('Load');
|
||||
$strSetupLoginCookieDeleteAll_desc = __('If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.');
|
||||
$strSetupLoginCookieDeleteAll_name = __('Delete all cookies on logout');
|
||||
@@ -201,6 +208,8 @@ $strSetupMaxTableList_desc = __('Maximum number of tables displayed in table lis
|
||||
$strSetupMaxTableList_name = __('Maximum tables');
|
||||
$strSetupMemoryLimit_desc = __('The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)');
|
||||
$strSetupMemoryLimit_name = __('Memory limit');
|
||||
$strSetupModifyDeleteAtLeft_name = __('Show left delete link');
|
||||
$strSetupModifyDeleteAtRight_name = __('Show right delete link');
|
||||
$strSetupNaturalOrder_name = __('Natural order');
|
||||
$strSetupNaturalOrder_desc = __('Use natural order for sorting table and database names');
|
||||
$strSetupNavigationBarIconic_desc = __('Use only icons, only text or both');
|
||||
@@ -219,12 +228,18 @@ $strSetupPropertiesIconic_desc = __('Use only icons, only text or both');
|
||||
$strSetupPropertiesIconic_name = __('Iconic table operations');
|
||||
$strSetupProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing');
|
||||
$strSetupProtectBinary_name = __('Protect binary columns');
|
||||
$strSetupRepeatCells_name = __('Repeat headers');
|
||||
$strSetupRepeatCells_desc = __('Repeat the headers every X cells, [kbd]0[/kbd] deactivates this feature');
|
||||
$strSetupQueryHistoryDB_desc = __('Enable if you want DB-based query history (requires pmadb). If disabled, this utilizes JS-routines to display query history (lost by window close).');
|
||||
$strSetupQueryHistoryDB_name = __('Permanent query history');
|
||||
$strSetupQueryHistoryMax_desc = __('How many queries are kept in history');
|
||||
$strSetupQueryHistoryMax_name = __('Query history length');
|
||||
$strSetupQueryWindowDefTab_desc = __('Tab displayed when opening a new query window');
|
||||
$strSetupQueryWindowDefTab_name = __('Default query window tab');
|
||||
$strSetupQueryWindowHeight_name = __('Query window height');
|
||||
$strSetupQueryWindowHeight_desc = __('Query window height (in pixels)');
|
||||
$strSetupQueryWindowWidth_name = __('Query window width');
|
||||
$strSetupQueryWindowWidth_desc = __('Query window height (in pixels)');
|
||||
$strSetupRecodingEngine_desc = __('Select which functions will be used for character set conversion');
|
||||
$strSetupRecodingEngine_name = __('Recoding engine');
|
||||
$strSetupReplaceHelpImg_name = __('Show help button');
|
||||
@@ -328,6 +343,8 @@ $strSetupShowAll_name = __('Allow to display all the rows');
|
||||
$strSetupShowChgPassword_desc = __('Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly');
|
||||
$strSetupShowChgPassword_name = __('Show password change form');
|
||||
$strSetupShowCreateDb_name = __('Show create database form');
|
||||
$strSetupShowFieldTypesInDataEditView_name = __('Show field types');
|
||||
$strSetupShowFieldTypesInDataEditView_desc = __('Defines whether or not type fields should be initially displayed in edit/insert mode');
|
||||
$strSetupShowForm = __('Show form');
|
||||
$strSetupShowFunctionFields_desc = __('Display the function fields in edit/insert mode');
|
||||
$strSetupShowFunctionFields_name = __('Show function fields');
|
||||
|
@@ -16,30 +16,30 @@ $forms['Features']['Text_fields'] = array(
|
||||
'CharEditing',
|
||||
'CharTextareaCols',
|
||||
'CharTextareaRows',
|
||||
'TextareaCols',// [s-]
|
||||
'TextareaRows',// [s-]
|
||||
'LongtextDoubleTextarea');// [s-]
|
||||
'TextareaCols',
|
||||
'TextareaRows',
|
||||
'LongtextDoubleTextarea');
|
||||
$forms['Sql_queries']['Sql_queries'] = array(
|
||||
'ShowSQL',
|
||||
'Confirm',
|
||||
'IgnoreMultiSubmitErrors',
|
||||
'VerboseMultiSubmit',
|
||||
'MaxCharactersInDisplayedSQL',// [s-]
|
||||
'EditInWindow',// [s-]
|
||||
'QueryWindowWidth',// [s-]
|
||||
'QueryWindowHeight',// [s-]
|
||||
'QueryWindowDefTab');// [s-]
|
||||
'MaxCharactersInDisplayedSQL',
|
||||
'EditInWindow',
|
||||
'QueryWindowWidth',
|
||||
'QueryWindowHeight',
|
||||
'QueryWindowDefTab');
|
||||
$forms['Sql_queries']['Sql_box'] = array(
|
||||
'SQLQuery/Edit',// [s-]
|
||||
'SQLQuery/Explain',// [s-]
|
||||
'SQLQuery/ShowAsPHP',// [s-]
|
||||
'SQLQuery/Edit',
|
||||
'SQLQuery/Explain',
|
||||
'SQLQuery/ShowAsPHP',
|
||||
'SQLQuery/Validate',// [false or no override]
|
||||
'SQLQuery/Refresh');// [s-]
|
||||
'SQLQuery/Refresh');
|
||||
$forms['Features']['Page_titles'] = array(
|
||||
'TitleDefault',// [s-]
|
||||
'TitleTable',// [s-]
|
||||
'TitleDatabase',// [s-]
|
||||
'TitleServer');// [s-]
|
||||
'TitleDefault',
|
||||
'TitleTable',
|
||||
'TitleDatabase',
|
||||
'TitleServer');
|
||||
$forms['Left_frame']['Left_frame'] = array(
|
||||
'LeftFrameLight',
|
||||
'LeftDisplayLogo',
|
||||
@@ -72,20 +72,20 @@ $forms['Main_frame']['Browse'] = array(
|
||||
'DisplayBinaryAsHex',
|
||||
'BrowsePointerEnable',
|
||||
'BrowseMarkerEnable',
|
||||
'RepeatCells',// [s-]
|
||||
'LimitChars',// [s-]
|
||||
'ModifyDeleteAtLeft',// [s-]
|
||||
'ModifyDeleteAtRight',// [s-]
|
||||
'DefaultDisplay');// [s-]
|
||||
'RepeatCells',
|
||||
'LimitChars',
|
||||
'ModifyDeleteAtLeft',
|
||||
'ModifyDeleteAtRight',
|
||||
'DefaultDisplay');
|
||||
$forms['Main_frame']['Edit'] = array(
|
||||
'ProtectBinary',
|
||||
'ShowFunctionFields',
|
||||
'ShowFieldTypesInDataEditView',// [s-]
|
||||
'ShowFieldTypesInDataEditView',
|
||||
'InsertRows',
|
||||
'ForeignKeyDropdownOrder',// [s, ? custom text value]
|
||||
'ForeignKeyMaxLimit',
|
||||
'CtrlArrowsMoving',
|
||||
'DefaultPropDisplay');// [s-]
|
||||
'DefaultPropDisplay');
|
||||
$forms['Main_frame']['Tabs'] = array(
|
||||
'LightTabs',
|
||||
'PropertiesIconic',
|
||||
|
@@ -270,7 +270,7 @@ fieldset th small {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
fieldset th, fieldset td {
|
||||
fieldset th, fieldset td, .form .lastrow {
|
||||
border-top: 1px #555 dotted;
|
||||
}
|
||||
|
||||
@@ -280,10 +280,6 @@ fieldset .lastrow, .form .lastrow {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form .lastrow {
|
||||
border-top: 1px #555 dotted;
|
||||
}
|
||||
|
||||
fieldset .lastrow input, .form .lastrow input {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@@ -1228,14 +1228,14 @@ table#serverconnection_trg_local {
|
||||
float:left;
|
||||
}
|
||||
/**
|
||||
* Validation error message styles
|
||||
* Validation error message styles<style>/*
|
||||
*/
|
||||
.invalid_value
|
||||
{background:#F00;}
|
||||
|
||||
/* config forms */
|
||||
.config-form ul.tabs {
|
||||
margin: 1em 0.2em 0;
|
||||
margin: 1.1em 0.2em 0;
|
||||
padding: 0 0 0.3em 0;
|
||||
list-style: none;
|
||||
font-weight: bold;
|
||||
@@ -1270,7 +1270,7 @@ table#serverconnection_trg_local {
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
clear: both;
|
||||
border-color: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
|
||||
/*border-color: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;*/
|
||||
}
|
||||
|
||||
.config-form legend {
|
||||
@@ -1286,7 +1286,7 @@ table#serverconnection_trg_local {
|
||||
margin: 0 -2px 1em -2px;
|
||||
padding: 0.5em 1.5em;
|
||||
background: #FBEAD9;
|
||||
border: 1px #C83838 solid;
|
||||
border: 0 #C83838 solid;
|
||||
border-width: 1px 0;
|
||||
list-style: none;
|
||||
font-family: sans-serif;
|
||||
@@ -1327,8 +1327,12 @@ table#serverconnection_trg_local {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.config-form fieldset th, fieldset td {
|
||||
border-top: 1px #666 dotted;
|
||||
.config-form fieldset th, .config-form fieldset td {
|
||||
border-top: 1px <?php echo $GLOBALS['cfg']['BgTwo']; ?> solid;
|
||||
}
|
||||
|
||||
.config-form .lastrow {
|
||||
border-top: 1px #000 solid;
|
||||
}
|
||||
|
||||
.config-form .lastrow {
|
||||
@@ -1337,10 +1341,6 @@ table#serverconnection_trg_local {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.config-form .form .lastrow {
|
||||
border-top: 1px #555 dotted;
|
||||
}
|
||||
|
||||
.config-form .lastrow input {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
Reference in New Issue
Block a user