Merge branch 'master' into Feature499

Conflicts:
	js/server_privileges.js
This commit is contained in:
Kasun Chathuranga 2013-04-29 21:18:14 +05:30
commit 45caa5896a
206 changed files with 82210 additions and 61127 deletions

22
.jshintrc Normal file
View File

@ -0,0 +1,22 @@
{
// Show more errors
"maxerr" : 1000,
// Globals
"jquery" : true,
// Stricter checking
"curly" : true,
"immed" : true,
"indent" : 4,
"latedef" : true,
"noarg" : true,
"noempty" : true,
"unused" : false,
"trailing" : true,
// Relaxing rules
"sub" : false,
"funcscope" : false,
"laxbreak" : false
}

View File

@ -3,6 +3,9 @@ phpMyAdmin - ChangeLog
4.1.0.0 (not yet released)
4.0.1.0 (not yet released)
- bug #3879 Import broken for CSV using LOAD DATA
4.0.0.0 (not yet released)
+ Patch #3481047 for rfe #3480477 Insert as new row enhancement
+ Patch #3480999 Activate codemirror in the query window
@ -106,9 +109,23 @@ underscore
- bug #3865 Using like operator on each backslash needs 4 backslash protection
- bug #3860 Displayed git revision info is not set
- bug #3871 Check referential integrity broken across databases
- bug #3874 [export] No preselected option when exporting table
- bug #3873 Can't copy table to target database if table exists there
- bug #3683 Incorrect listing of records from to count
- bug #3876 [import] PHP 5.2 - unexpected T_PAAMAYIM_NEKUDOTAYIM
- [security] Local file inclusion vulnerability, reported by Janek Vind
(see PMASA-2013-4)
- [security] Global variables overwrite in export.php, reported by Janek Vind
(see PMASA-2013-5)
3.5.9.0 (not yet released)
3.5.8.1 (2013-04-24)
- [security] Remote code execution (preg_replace), reported by Janek Vind
(see PMASA-2013-2)
- [security] Locally Saved SQL Dump File Multiple File Extension Remote Code
Execution, reported by Janek Vind (see PMASA-2013-3)
3.5.8.0 (2013-04-08)
- bug #3828 MariaDB reported as MySQL
- bug #3854 Incorrect header for Safari 6.0

View File

@ -163,7 +163,7 @@ if (isset($rownumber)) {
. htmlspecialchars($rownumber) . '" />';
}
$output .= '<span class="formelement">'
. '<label for="input_foreign_filter">' . __('Search') . ':' . '</label>'
. '<label for="input_foreign_filter">' . __('Search:') . '</label>'
. '<input type="text" name="foreign_filter" id="input_foreign_filter" value="'
. (isset($foreign_filter) ? htmlspecialchars($foreign_filter) : '') . '" />'
. '<input type="submit" name="submit_foreign_filter" value="'

View File

@ -4,7 +4,7 @@
<property name="source" value="."/>
<property name="source_comma_sep" value="."/>
<fileset dir="${source}" includes="js/*.js" id="jsfiles" />
<fileset dir="${source}" includes="js/pmd/*.js,js/*.js" id="jsfiles" />
<pathconvert pathsep=" " property="js-list" refid="jsfiles" />
<target name="clean" description="Clean up and create artifact directories">
@ -107,7 +107,7 @@
<target name="jshint" description="Javascript checks">
<exec executable="jshint" output="${basedir}/build/logs/jslint.xml">
<arg line="--jslint-reporter ${js-list}" />
<arg line="--config ./.jshintrc --jslint-reporter ${js-list}" />
</exec>
</target>

View File

@ -154,7 +154,7 @@ foreach ($tables as $table) {
* Displays the comments of the table if MySQL >= 3.23
*/
if (!empty($show_comment)) {
echo __('Table comments') . ': ' . htmlspecialchars($show_comment) . '<br /><br />';
echo __('Table comments:') . ' ' . htmlspecialchars($show_comment) . '<br /><br />';
}
/**

View File

@ -182,7 +182,7 @@ if ($num_tables == 0) {
if (! empty($sts_data['Create_time'])) {
?>
<tr>
<td class="right"><?php echo __('Creation') . ': '; ?></td>
<td class="right"><?php echo __('Creation:'); ?></td>
<td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Create_time'])); ?></td>
</tr>
<?php
@ -191,7 +191,7 @@ if ($num_tables == 0) {
if (! empty($sts_data['Update_time'])) {
?>
<tr>
<td class="right"><?php echo __('Last update') . ': '; ?></td>
<td class="right"><?php echo __('Last update:'); ?></td>
<td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Update_time'])); ?></td>
</tr>
<?php
@ -200,7 +200,7 @@ if ($num_tables == 0) {
if (! empty($sts_data['Check_time'])) {
?>
<tr>
<td class="right"><?php echo __('Last check') . ': '; ?></td>
<td class="right"><?php echo __('Last check:'); ?></td>
<td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Check_time'])); ?></td>
</tr>
<?php

View File

@ -14,13 +14,117 @@ require_once 'libraries/zip.lib.php';
require_once 'libraries/plugin_interface.lib.php';
/**
* Sets globals from all $_POST (in export.php only)
* Would it not be tiresome to list all export-plugin options here?
* Sets globals from $_POST
*
* - Please keep the parameters in order of their appearance in the form
* - Some of these parameters are not used, as the code below directly
* verifies from the superglobal $_POST or $_REQUEST
*/
foreach ($_POST as $one_post_param => $one_post_value) {
$GLOBALS[$one_post_param] = $one_post_value;
$post_params = array(
'db',
'table',
'single_table',
'export_type',
'export_method',
'quick_or_custom',
'limit_to',
'limit_from',
'allrows',
'output_format',
'filename_template',
'remember_template',
'charset_of_file',
'compression',
'what',
'htmlword_structure_or_data',
'htmlword_null',
'htmlword_columns',
'mediawiki_structure_or_data',
'mediawiki_caption',
'pdf_report_title',
'pdf_structure_or_data',
'odt_structure_or_data',
'odt_relation',
'odt_comments',
'odt_mime',
'odt_columns',
'odt_null',
'codegen_structure_or_data',
'codegen_format',
'excel_null',
'excel_columns',
'excel_edition',
'excel_structure_or_data',
'yaml_structure_or_data',
'ods_null',
'ods_structure_or_data',
'ods_columns',
'json_structure_or_data',
'xml_structure_or_data',
'xml_export_functions',
'xml_export_procedures',
'xml_export_tables',
'xml_export_triggers',
'xml_export_views',
'xml_export_contents',
'texytext_structure_or_data',
'texytext_columns',
'texytext_null',
'phparray_structure_or_data',
'sql_include_comments',
'sql_header_comment',
'sql_dates',
'sql_relation',
'sql_mime',
'sql_use_transaction',
'sql_disable_fk',
'sql_compatibility',
'sql_structure_or_data',
'sql_drop_table',
'sql_procedure_function',
'sql_create_table_statements',
'sql_if_not_exists',
'sql_auto_increment',
'sql_backquotes',
'sql_truncate',
'sql_delayed',
'sql_ignore',
'sql_type',
'sql_insert_syntax',
'sql_max_query_size',
'sql_hex_for_blob',
'sql_utc_time',
'csv_separator',
'csv_enclosed',
'csv_escaped',
'csv_terminated',
'csv_null',
'csv_columns',
'csv_structure_or_data',
'latex_caption',
'latex_structure_or_data',
'latex_structure_caption',
'latex_structure_continued_caption',
'latex_structure_label',
'latex_relation',
'latex_comments',
'latex_mime',
'latex_columns',
'latex_data_caption',
'latex_data_continued_caption',
'latex_data_label',
'latex_null'
);
foreach ($post_params as $one_post_param) {
if (isset($_POST[$one_post_param])) {
$GLOBALS[$one_post_param] = $_POST[$one_post_param];
}
}
// sanitize this parameter which will be used below in a file inclusion
$what = PMA_securePath($what);
PMA_Util::checkParameters(array('what', 'export_type'));
// export class instance, not array of properties, as before
@ -352,7 +456,9 @@ if ($asfile) {
}
}
$filename = PMA_Util::expandUserString($filename_template);
$filename = PMA_sanitizeFilename($filename);
// remove dots in filename (coming from either the template or already
// part of the filename) to avoid a remote code execution vulnerability
$filename = PMA_sanitizeFilename($filename, $replaceDots = true);
// Grab basic dump extension and mime type
// Check if the user already added extension;

View File

@ -158,7 +158,7 @@ foreach ($gis_types as $gis_type) {
}
echo '</select>';
echo '&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<label for="srid">' . __("SRID") . ':</label>';
echo '<label for="srid">' . __('SRID:') . '</label>';
echo '<input name="gis_data[srid]" type="text" value="' . $srid . '" />';
echo '</div>';
echo '<!-- End of header section -->';
@ -181,7 +181,7 @@ for ($a = 0; $a < $geom_count; $a++) {
if ($geom_type == 'GEOMETRYCOLLECTION') {
echo '<br/><br/>';
echo __("Geometry") . ' ' . ($a + 1) . ': ';
printf(__('Geometry %d:'), $a + 1);
echo '<br/>';
if (isset($gis_data[$a]['gis_type'])) {
$type = $gis_data[$a]['gis_type'];
@ -203,7 +203,7 @@ for ($a = 0; $a < $geom_count; $a++) {
if ($type == 'POINT') {
echo '<br/>';
echo __("Point") . ': ';
echo __('Point:');
echo '<label for="x">' . __("X") . '</label>';
echo '<input name="gis_data[' . $a . '][POINT][x]" type="text"'
. ' value="' . escape($gis_data[$a]['POINT']['x']) . '" />';
@ -259,12 +259,12 @@ for ($a = 0; $a < $geom_count; $a++) {
for ($i = 0; $i < $no_of_lines; $i++) {
echo '<br/>';
if ($type == 'MULTILINESTRING') {
echo __("Linestring") . ' ' . ($i + 1) . ':';
printf(__('Linestring %d:'), $i + 1);
} else {
if ($i == 0) {
echo __("Outer Ring") . ':';
echo __('Outer ring:');
} else {
echo __("Inner Ring") . ' ' . $i . ':';
printf(__('Inner ring %d:'), $i);
}
}
@ -322,7 +322,7 @@ for ($a = 0; $a < $geom_count; $a++) {
for ($k = 0; $k < $no_of_polygons; $k++) {
echo '<br/>';
echo __("Polygon") . ' ' . ($k + 1) . ':';
printf(__('Polygon %d:'), $k + 1);
$no_of_lines = isset($gis_data[$a][$type][$k]['no_of_lines'])
? $gis_data[$a][$type][$k]['no_of_lines'] : 1;
if ($no_of_lines < 1) {
@ -338,9 +338,9 @@ for ($a = 0; $a < $geom_count; $a++) {
for ($i = 0; $i < $no_of_lines; $i++) {
echo '<br/><br/>';
if ($i == 0) {
echo __("Outer Ring") . ':';
echo __('Outer ring:');
} else {
echo __("Inner Ring") . ' ' . $i . ':';
printf(__('Inner ring %d:'), $i);
}
$no_of_points = isset($gis_data[$a][$type][$k][$i]['no_of_points'])

View File

@ -474,7 +474,8 @@ if (! $error) {
$import_plugin = PMA_getPlugin(
"import",
$format,
'libraries/plugins/import/'
'libraries/plugins/import/',
$import_type
);
if ($import_plugin == null) {
$error = true;

View File

@ -152,7 +152,7 @@ if ($server > 0
echo ' <form method="post" action="index.php">' . "\n"
. PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
. ' <label for="select_collation_connection">' . "\n"
. ' '. PMA_Util::getImage('s_asci.png') . " "
. ' '. PMA_Util::getImage('s_asci.png') . " "
. __('Server connection collation') . "\n"
// put the doc link in the form so that it appears on the same line
. PMA_Util::showMySQLDocu(
@ -233,28 +233,28 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
echo '<h2>' . __('Database server') . '</h2>';
echo '<ul>' . "\n";
PMA_printListItem(
__('Server') . ': ' . $server_info,
__('Server:') . ' ' . $server_info,
'li_server_info'
);
PMA_printListItem(
__('Server type') . ': ' . PMA_Util::getServerType(),
__('Server type:') . ' ' . PMA_Util::getServerType(),
'li_server_type'
);
PMA_printListItem(
__('Server version') . ': ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
__('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
'li_server_version'
);
PMA_printListItem(
__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
__('Protocol version:') . ' ' . PMA_DBI_get_proto_info(),
'li_mysql_proto'
);
PMA_printListItem(
__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
__('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
'li_user_info'
);
echo ' <li id="li_select_mysql_charset">';
echo ' ' . __('Server charset') . ': '
echo ' ' . __('Server charset:') . ' '
. ' <span lang="en" dir="ltr">'
. ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']] . "\n"
. ' (' . $mysql_charset_map['utf-8'] . ')' . "\n"
@ -279,11 +279,11 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
$client_version_str = 'libmysql - ' . $client_version_str;
}
PMA_printListItem(
__('Database client version') . ': ' . $client_version_str,
__('Database client version:') . ' ' . $client_version_str,
'li_mysql_client_version'
);
$php_ext_string = __('PHP extension') . ': '
$php_ext_string = __('PHP extension:') . ' '
. $GLOBALS['cfg']['Server']['extension'] . ' '
. PMA_Util::showPHPDocu(
'book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'
@ -320,7 +320,7 @@ if ($GLOBALS['cfg']['VersionCheck']
$class = 'jsversioncheck';
}
PMA_printListItem(
__('Version information') . ': ' . PMA_VERSION,
__('Version information:') . ' ' . PMA_VERSION,
'li_pma_version',
null,
null,

View File

@ -19,7 +19,7 @@ OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
/**
* Function: onImageLoadError
*/
OpenLayers.Util.onImageLoadError = function() {
OpenLayers.Util.onImageLoadError = function () {
if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
} else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
@ -43,7 +43,7 @@ OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, options) {
initialize: function (name, options) {
var url = [
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
@ -75,7 +75,7 @@ OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, options) {
initialize: function (name, options) {
var url = [
"http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
"http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
@ -107,7 +107,7 @@ OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, options) {
initialize: function (name, options) {
var url = [
"http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
"http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",

View File

@ -34,11 +34,11 @@ var AJAX = {
*
* @return int
*/
hash: function (key){
hash: function (key) {
/* http://burtleburtle.net/bob/hash/doobs.html#one */
key += "";
var len = key.length, hash=0, i=0;
for (; i<len; ++i) {
var len = key.length, hash = 0, i = 0;
for (; i < len; ++i) {
hash += key.charCodeAt(i);
hash += (hash << 10);
hash ^= (hash >> 6);
@ -142,7 +142,7 @@ var AJAX = {
event.preventDefault();
event.stopImmediatePropagation();
}
if (AJAX.active == true) {
if (AJAX.active === true) {
// Silently bail out, there is already a request in progress.
// TODO: save a reference to the request and cancel the old request
// when the user requests something else. Something like this is
@ -277,7 +277,7 @@ var AJAX = {
$('#pma_errors').remove();
if (data._errors) {
$('<div/>', {id:'pma_errors'})
$('<div/>', {id : 'pma_errors'})
.insertAfter('#selflink')
.append(data._errors);
}
@ -475,7 +475,7 @@ AJAX.cache = {
if (this.pages.length > AJAX.cache.MAX) {
// Trim the cache, to the maximum number of allowed entries
// This way we will have a cached menu for every page
for (var i=0; i<this.pages.length-this.MAX; i++) {
for (var i = 0; i < this.pages.length - this.MAX; i++) {
delete this.pages[i];
}
}
@ -516,7 +516,7 @@ AJAX.cache = {
navigate: function (index) {
if (typeof this.pages[index] === 'undefined') {
PMA_ajaxShowMessage(
'<div class="error">' + PMA_messages['strInvalidPage'] + '</div>',
'<div class="error">' + PMA_messages.strInvalidPage + '</div>',
false
);
} else {
@ -553,7 +553,7 @@ AJAX.cache = {
*
* @return int
*/
size: function(obj) {
size: function (obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
@ -714,9 +714,9 @@ AJAX.setUrlHash = (function (jQuery, window) {
} else {
// We don't have a valid hash, so we'll set it up
// when the page finishes loading
jQuery(function(){
jQuery(function () {
/* Check if we should set URL */
if (savedHash != "") {
if (savedHash !== "") {
window.location.hash = savedHash;
savedHash = "";
resetFavicon();
@ -728,7 +728,7 @@ AJAX.setUrlHash = (function (jQuery, window) {
/**
* Register an event handler for when the url hash changes
*/
jQuery(function(){
jQuery(function () {
jQuery(window).hashchange(function () {
if (userChange === false) {
// Ignore internally triggered hash changes
@ -788,13 +788,13 @@ $('form').live('submit', AJAX.requestHandler);
* Gracefully handle fatal server errors
* (e.g: 500 - Internal server error)
*/
$(document).ajaxError(function(event, request, settings){
$(document).ajaxError(function (event, request, settings) {
if (request.status !== 0) { // Don't handle aborted requests
var errorCode = $.sprintf(PMA_messages['strErrorCode'], request.status);
var errorText = $.sprintf(PMA_messages['strErrorText'], request.statusText);
var errorCode = $.sprintf(PMA_messages.strErrorCode, request.status);
var errorText = $.sprintf(PMA_messages.strErrorText, request.statusText);
PMA_ajaxShowMessage(
'<div class="error">'
+ PMA_messages['strErrorProcessingRequest']
+ PMA_messages.strErrorProcessingRequest
+ '<div>' + errorCode + '</div>'
+ '<div>' + errorText + '</div>'
+ '</div>',

View File

@ -14,31 +14,31 @@ var ChartType = {
/**
* Abstract chart factory which defines the contract for chart factories
*/
var ChartFactory = function() {
var ChartFactory = function () {
};
ChartFactory.prototype = {
createChart : function(type, options) {
createChart : function (type, options) {
throw new Error("createChart must be implemented by a subclass");
}
};
/**
* Abstract chart which defines the contract for charts
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var Chart = function(elementId) {
var Chart = function (elementId) {
this.elementId = elementId;
};
Chart.prototype = {
draw : function(data, options) {
draw : function (data, options) {
throw new Error("draw must be implemented by a subclass");
},
redraw : function(options) {
redraw : function (options) {
throw new Error("redraw must be implemented by a subclass");
},
destroy : function() {
destroy : function () {
throw new Error("destroy must be implemented by a subclass");
}
};
@ -51,21 +51,21 @@ Chart.prototype = {
* <code>ColumnType.NUMBER<code> and represents a data series.</li>
* </ul>
* Line chart, area chart, bar chart, column chart are typical examples.
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var BaseChart = function(elementId) {
var BaseChart = function (elementId) {
Chart.call(this, elementId);
};
BaseChart.prototype = new Chart();
BaseChart.prototype.constructor = BaseChart;
BaseChart.prototype.validateColumns = function(dataTable) {
BaseChart.prototype.validateColumns = function (dataTable) {
var columns = dataTable.getColumns();
if (columns.length < 2) {
throw new Error("Minimum of two columns are required for this chart");
}
for ( var i = 1; i < columns.length; i++) {
for (var i = 1; i < columns.length; i++) {
if (columns[i].type != ColumnType.NUMBER) {
throw new Error("Column " + (i + 1) + " should be of type 'Number'");
}
@ -75,16 +75,16 @@ BaseChart.prototype.validateColumns = function(dataTable) {
/**
* Abstract pie chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var PieChart = function(elementId) {
var PieChart = function (elementId) {
BaseChart.call(this, elementId);
};
PieChart.prototype = new BaseChart();
PieChart.prototype.constructor = PieChart;
PieChart.prototype.validateColumns = function(dataTable) {
PieChart.prototype.validateColumns = function (dataTable) {
var columns = dataTable.getColumns();
if (columns.length > 2) {
throw new Error("Pie charts can draw only one series");
@ -94,16 +94,16 @@ PieChart.prototype.validateColumns = function(dataTable) {
/**
* Abstract timeline chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var TimelineChart = function(elementId) {
var TimelineChart = function (elementId) {
BaseChart.call(this, elementId);
};
TimelineChart.prototype = new BaseChart();
TimelineChart.prototype.constructor = TimelineChart;
TimelineChart.prototype.validateColumns = function(dataTable) {
TimelineChart.prototype.validateColumns = function (dataTable) {
var result = BaseChart.prototype.validateColumns.call(this, dataTable);
if (result) {
var columns = dataTable.getColumns();
@ -117,41 +117,41 @@ TimelineChart.prototype.validateColumns = function(dataTable) {
/**
* The data table contains column information and data for the chart.
*/
var DataTable = function() {
var DataTable = function () {
var columns = [];
var data;
this.addColumn = function(type, name) {
this.addColumn = function (type, name) {
columns.push({
'type' : type,
'name' : name
});
};
this.getColumns = function() {
this.getColumns = function () {
return columns;
};
this.setData = function(rows) {
this.setData = function (rows) {
data = rows;
fillMissingValues();
};
this.getData = function() {
this.getData = function () {
return data;
};
var fillMissingValues = function() {
if (columns.length == 0) {
var fillMissingValues = function () {
if (columns.length === 0) {
throw new Error("Set columns first");
}
var row, column;
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
row = data[i];
if (row.length > columns.length) {
row.splice(columns.length - 1, row.length - columns.length);
} else if (row.length < columns.length) {
for ( var j = row.length; j < columns.length; j++) {
for (var j = row.length; j < columns.length; j++) {
row.push(null);
}
}
@ -176,10 +176,10 @@ var ColumnType = {
/**
* Chart factory that returns JQPlotCharts
*/
var JQPlotChartFactory = function() {
var JQPlotChartFactory = function () {
};
JQPlotChartFactory.prototype = new ChartFactory();
JQPlotChartFactory.prototype.createChart = function(type, elementId) {
JQPlotChartFactory.prototype.createChart = function (type, elementId) {
var chart;
switch (type) {
case ChartType.LINE:
@ -210,54 +210,54 @@ JQPlotChartFactory.prototype.createChart = function(type, elementId) {
/**
* Abstract JQplot chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotChart = function(elementId) {
var JQPlotChart = function (elementId) {
Chart.call(this, elementId);
this.plot;
this.validator;
};
JQPlotChart.prototype = new Chart();
JQPlotChart.prototype.constructor = JQPlotChart;
JQPlotChart.prototype.draw = function(data, options) {
JQPlotChart.prototype.draw = function (data, options) {
if (this.validator.validateColumns(data)) {
this.plot = $.jqplot(this.elementId, this.prepareData(data), this
.populateOptions(data, options));
}
};
JQPlotChart.prototype.destroy = function() {
if (this.plot != null) {
JQPlotChart.prototype.destroy = function () {
if (this.plot !== null) {
this.plot.destroy();
}
};
JQPlotChart.prototype.redraw = function(options) {
if (this.plot != null) {
JQPlotChart.prototype.redraw = function (options) {
if (this.plot !== null) {
this.plot.replot(options);
}
};
JQPlotChart.prototype.populateOptions = function(dataTable, options) {
JQPlotChart.prototype.populateOptions = function (dataTable, options) {
throw new Error("populateOptions must be implemented by a subclass");
};
JQPlotChart.prototype.prepareData = function(dataTable) {
JQPlotChart.prototype.prepareData = function (dataTable) {
throw new Error("prepareData must be implemented by a subclass");
};
/**
* JQPlot line chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotLineChart = function(elementId) {
var JQPlotLineChart = function (elementId) {
JQPlotChart.call(this, elementId);
this.validator = BaseChart.prototype;
};
JQPlotLineChart.prototype = new JQPlotChart();
JQPlotLineChart.prototype.constructor = JQPlotLineChart;
JQPlotLineChart.prototype.populateOptions = function(dataTable, options) {
JQPlotLineChart.prototype.populateOptions = function (dataTable, options) {
var columns = dataTable.getColumns();
var optional = {
axes : {
@ -274,31 +274,31 @@ JQPlotLineChart.prototype.populateOptions = function(dataTable, options) {
series : []
};
$.extend(true, optional, options);
if (optional.series.length == 0) {
for ( var i = 1; i < columns.length; i++) {
if (optional.series.length === 0) {
for (var i = 1; i < columns.length; i++) {
optional.series.push({
label : columns[i].name.toString()
});
}
}
if (optional.axes.xaxis.ticks.length == 0) {
if (optional.axes.xaxis.ticks.length === 0) {
var data = dataTable.getData();
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
optional.axes.xaxis.ticks.push(data[i][0].toString());
}
}
return optional;
};
JQPlotLineChart.prototype.prepareData = function(dataTable) {
JQPlotLineChart.prototype.prepareData = function (dataTable) {
var data = dataTable.getData(), row;
var retData = [], retRow;
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
row = data[i];
for ( var j = 1; j < row.length; j++) {
for (var j = 1; j < row.length; j++) {
retRow = retData[j - 1];
if (retRow == null) {
if (retRow === null) {
retRow = [];
retData[j - 1] = retRow;
}
@ -310,17 +310,17 @@ JQPlotLineChart.prototype.prepareData = function(dataTable) {
/**
* JQPlot spline chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotSplineChart = function(elementId) {
var JQPlotSplineChart = function (elementId) {
JQPlotLineChart.call(this, elementId);
};
JQPlotSplineChart.prototype = new JQPlotLineChart();
JQPlotSplineChart.prototype.constructor = JQPlotSplineChart;
JQPlotSplineChart.prototype.populateOptions = function(dataTable, options) {
JQPlotSplineChart.prototype.populateOptions = function (dataTable, options) {
var optional = {};
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
options);
@ -337,26 +337,26 @@ JQPlotSplineChart.prototype.populateOptions = function(dataTable, options) {
/**
* JQPlot timeline chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotTimelineChart = function(elementId) {
var JQPlotTimelineChart = function (elementId) {
JQPlotLineChart.call(this, elementId);
this.validator = TimelineChart.prototype;
};
JQPlotTimelineChart.prototype = new JQPlotLineChart();
JQPlotTimelineChart.prototype.constructor = JQPlotAreaChart;
JQPlotTimelineChart.prototype.populateOptions = function(dataTable, options) {
JQPlotTimelineChart.prototype.populateOptions = function (dataTable, options) {
var optional = {
axes : {
xaxis : {
tickOptions : {
formatString:'%b %#d, %y'
formatString: '%b %#d, %y'
}
}
}
}
};
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable, options);
var compulsory = {
@ -370,19 +370,19 @@ JQPlotTimelineChart.prototype.populateOptions = function(dataTable, options) {
return optional;
};
JQPlotTimelineChart.prototype.prepareData = function(dataTable) {
JQPlotTimelineChart.prototype.prepareData = function (dataTable) {
var data = dataTable.getData(), row, d;
var retData = [], retRow;
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
row = data[i];
d = row[0];
for ( var j = 1; j < row.length; j++) {
for (var j = 1; j < row.length; j++) {
retRow = retData[j - 1];
if (retRow == null) {
if (retRow === null) {
retRow = [];
retData[j - 1] = retRow;
}
if (d != null) {
if (d !== null) {
retRow.push([d.getTime(), row[j]]);
}
}
@ -392,28 +392,28 @@ JQPlotTimelineChart.prototype.prepareData = function(dataTable) {
/**
* JQPlot area chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotAreaChart = function(elementId) {
var JQPlotAreaChart = function (elementId) {
JQPlotLineChart.call(this, elementId);
};
JQPlotAreaChart.prototype = new JQPlotLineChart();
JQPlotAreaChart.prototype.constructor = JQPlotAreaChart;
JQPlotAreaChart.prototype.populateOptions = function(dataTable, options) {
JQPlotAreaChart.prototype.populateOptions = function (dataTable, options) {
var optional = {
seriesDefaults : {
fillToZero : true
}
}
};
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
options);
var compulsory = {
seriesDefaults : {
fill : true
}
}
};
$.extend(true, optional, opt, compulsory);
return optional;
@ -421,21 +421,21 @@ JQPlotAreaChart.prototype.populateOptions = function(dataTable, options) {
/**
* JQPlot column chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotColumnChart = function(elementId) {
var JQPlotColumnChart = function (elementId) {
JQPlotLineChart.call(this, elementId);
};
JQPlotColumnChart.prototype = new JQPlotLineChart();
JQPlotColumnChart.prototype.constructor = JQPlotColumnChart;
JQPlotColumnChart.prototype.populateOptions = function(dataTable, options) {
JQPlotColumnChart.prototype.populateOptions = function (dataTable, options) {
var optional = {
seriesDefaults : {
fillToZero : true
}
}
};
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
options);
@ -450,22 +450,22 @@ JQPlotColumnChart.prototype.populateOptions = function(dataTable, options) {
/**
* JQPlot bar chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotBarChart = function(elementId) {
var JQPlotBarChart = function (elementId) {
JQPlotLineChart.call(this, elementId);
};
JQPlotBarChart.prototype = new JQPlotLineChart();
JQPlotBarChart.prototype.constructor = JQPlotBarChart;
JQPlotBarChart.prototype.populateOptions = function(dataTable, options) {
JQPlotBarChart.prototype.populateOptions = function (dataTable, options) {
var columns = dataTable.getColumns();
var optional = {
axes : {
yaxis : {
label : columns[0].name,
label : columns[0].name,
labelRenderer : $.jqplot.CanvasAxisLabelRenderer,
renderer : $.jqplot.CategoryAxisRenderer,
ticks : []
@ -479,7 +479,7 @@ JQPlotBarChart.prototype.populateOptions = function(dataTable, options) {
seriesDefaults : {
fillToZero : true
}
};
};
var compulsory = {
seriesDefaults : {
renderer : $.jqplot.BarRenderer,
@ -489,15 +489,15 @@ JQPlotBarChart.prototype.populateOptions = function(dataTable, options) {
}
};
$.extend(true, optional, options, compulsory);
if (optional.axes.yaxis.ticks.length == 0) {
if (optional.axes.yaxis.ticks.length === 0) {
var data = dataTable.getData();
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
optional.axes.yaxis.ticks.push(data[i][0].toString());
}
}
if (optional.series.length == 0) {
for ( var i = 1; i < columns.length; i++) {
if (optional.series.length === 0) {
for (var i = 1; i < columns.length; i++) {
optional.series.push({
label : columns[i].name.toString()
});
@ -508,18 +508,18 @@ JQPlotBarChart.prototype.populateOptions = function(dataTable, options) {
/**
* JQPlot pie chart
*
*
* @param elementId
* id of the div element the chart is drawn in
*/
var JQPlotPieChart = function(elementId) {
var JQPlotPieChart = function (elementId) {
JQPlotChart.call(this, elementId);
this.validator = PieChart.prototype;
};
JQPlotPieChart.prototype = new JQPlotChart();
JQPlotPieChart.prototype.constructor = JQPlotPieChart;
JQPlotPieChart.prototype.populateOptions = function(dataTable, options) {
JQPlotPieChart.prototype.populateOptions = function (dataTable, options) {
var optional = {};
var compulsory = {
seriesDefaults : {
@ -530,10 +530,10 @@ JQPlotPieChart.prototype.populateOptions = function(dataTable, options) {
return optional;
};
JQPlotPieChart.prototype.prepareData = function(dataTable) {
JQPlotPieChart.prototype.prepareData = function (dataTable) {
var data = dataTable.getData(), row;
var retData = [];
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
row = data[i];
retData.push([ row[0], row[1] ]);
}

View File

@ -207,7 +207,7 @@ var PMA_querywindow = (function ($, window) {
);
}
if (! querywindow.opener) {
querywindow.opener = window.window;
querywindow.opener = window.window;
}
if (window.focus) {
querywindow.focus();
@ -233,7 +233,7 @@ var PMA_querywindow = (function ($, window) {
var hiddenqueryform = querywindow
.document
.getElementById('hiddenqueryform');
if (hiddenqueryform.querydisplay_tab != 'sql' ) {
if (hiddenqueryform.querydisplay_tab != 'sql') {
hiddenqueryform.querydisplay_tab.value = "sql";
hiddenqueryform.sql_query.value = sql_query;
$(hiddenqueryform).addClass('disableAjax');
@ -254,7 +254,7 @@ var PMA_querywindow = (function ($, window) {
refresh: function (url) {
if (! querywindow.closed && querywindow.location) {
var $form = $(querywindow.document).find('#sqlqueryform');
if ($form.find('#checkbox_lock:checked').length == 0) {
if ($form.find('#checkbox_lock:checked').length === 0) {
PMA_querywindow.open(url);
}
}
@ -272,7 +272,7 @@ var PMA_querywindow = (function ($, window) {
reload: function (db, table, sql_query) {
if (! querywindow.closed && querywindow.location) {
var $form = $(querywindow.document).find('#sqlqueryform');
if ($form.find('#checkbox_lock:checked').length == 0) {
if ($form.find('#checkbox_lock:checked').length === 0) {
var $hiddenform = $(querywindow.document)
.find('#hiddenqueryform');
$hiddenform.find('input[name=db]').val(db);

View File

@ -6,7 +6,7 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('config.js', function() {
AJAX.registerTeardown('config.js', function () {
$('input[id], select[id], textarea[id]').unbind('change').unbind('keyup');
$('input[type=button][name=submit_reset]').unbind('click');
$('div.tabs_contents').undelegate();
@ -16,7 +16,7 @@ AJAX.registerTeardown('config.js', function() {
$('#prefs_autoload').find('a').unbind('click');
});
AJAX.registerOnload('config.js', function() {
AJAX.registerOnload('config.js', function () {
$('#topmenu2').find('li.active a').attr('rel', 'samepage');
$('#topmenu2').find('li:not(.active) a').attr('rel', 'newpage');
});
@ -60,27 +60,27 @@ function setFieldValue(field, field_type, value)
{
field = $(field);
switch (field_type) {
case 'text':
//TODO: replace to .val()
field.attr('value', (value != undefined ? value : field.attr('defaultValue')));
break;
case 'checkbox':
//TODO: replace to .prop()
field.attr('checked', (value != undefined ? value : field.attr('defaultChecked')));
break;
case 'select':
var options = field.prop('options');
var i, imax = options.length;
if (value == undefined) {
for (i = 0; i < imax; i++) {
options[i].selected = options[i].defaultSelected;
}
} else {
for (i = 0; i < imax; i++) {
options[i].selected = (value.indexOf(options[i].value) != -1);
}
case 'text':
//TODO: replace to .val()
field.attr('value', (value !== undefined ? value : field.attr('defaultValue')));
break;
case 'checkbox':
//TODO: replace to .prop()
field.attr('checked', (value !== undefined ? value : field.attr('defaultChecked')));
break;
case 'select':
var options = field.prop('options');
var i, imax = options.length;
if (value === undefined) {
for (i = 0; i < imax; i++) {
options[i].selected = options[i].defaultSelected;
}
break;
} else {
for (i = 0; i < imax; i++) {
options[i].selected = (value.indexOf(options[i].value) != -1);
}
}
break;
}
markField(field);
}
@ -101,19 +101,19 @@ function getFieldValue(field, field_type)
{
field = $(field);
switch (field_type) {
case 'text':
return field.prop('value');
case 'checkbox':
return field.prop('checked');
case 'select':
var options = field.prop('options');
var i, imax = options.length, items = [];
for (i = 0; i < imax; i++) {
if (options[i].selected) {
items.push(options[i].value);
}
case 'text':
return field.prop('value');
case 'checkbox':
return field.prop('checked');
case 'select':
var options = field.prop('options');
var i, imax = options.length, items = [];
for (i = 0; i < imax; i++) {
if (options[i].selected) {
items.push(options[i].value);
}
return items;
}
return items;
}
return null;
}
@ -203,11 +203,11 @@ var validators = {
* @param {boolean} isKeyUp
*/
validate_positive_number: function (isKeyUp) {
if (isKeyUp && this.value == '') {
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'];
return result ? true : PMA_messages.error_nan_p;
},
/**
* Validates non-negative number
@ -215,23 +215,23 @@ var validators = {
* @param {boolean} isKeyUp
*/
validate_non_negative_number: function (isKeyUp) {
if (isKeyUp && this.value == '') {
if (isKeyUp && this.value === '') {
return true;
}
var result = validators._regexp_numeric.test(this.value);
return result ? true : PMA_messages['error_nan_nneg'];
return result ? true : PMA_messages.error_nan_nneg;
},
/**
* Validates port number
*
* @param {boolean} isKeyUp
*/
validate_port_number: function(isKeyUp) {
if (this.value == '') {
validate_port_number: function (isKeyUp) {
if (this.value === '') {
return true;
}
var result = validators._regexp_numeric.test(this.value) && this.value != '0';
return result && this.value <= 65535 ? true : PMA_messages['error_incorrect_port'];
return result && this.value <= 65535 ? true : PMA_messages.error_incorrect_port;
},
/**
* Validates value according to given regular expression
@ -239,14 +239,14 @@ var validators = {
* @param {boolean} isKeyUp
* @param {string} regexp
*/
validate_by_regex: function(isKeyUp, regexp) {
if (isKeyUp && this.value == '') {
validate_by_regex: function (isKeyUp, regexp) {
if (isKeyUp && this.value === '') {
return true;
}
// convert PCRE regexp
var parts = regexp.match(validators._regexp_pcre_extract);
var valid = this.value.match(new RegExp(parts[2], parts[3])) != null;
return valid ? true : PMA_messages['error_invalid_value'];
var valid = this.value.match(new RegExp(parts[2], parts[3])) !== null;
return valid ? true : PMA_messages.error_invalid_value;
},
/**
* Validates upper bound for numeric inputs
@ -254,12 +254,12 @@ var validators = {
* @param {boolean} isKeyUp
* @param {int} max_value
*/
validate_upper_bound: function(isKeyUp, max_value) {
var val = parseInt(this.value);
validate_upper_bound: function (isKeyUp, max_value) {
var val = parseInt(this.value, 10);
if (isNaN(val)) {
return true;
}
return val <= max_value ? true : $.sprintf(PMA_messages['error_value_lte'], max_value);
return val <= max_value ? true : $.sprintf(PMA_messages.error_value_lte, max_value);
},
// field validators
_field: {
@ -331,15 +331,15 @@ function displayErrors(error_list)
{
for (var field_id in error_list) {
var errors = error_list[field_id];
var field = $('#'+field_id);
var field = $('#' + field_id);
var isFieldset = field.attr('tagName') == 'FIELDSET';
var errorCnt = isFieldset
? field.find('dl.errors')
: field.siblings('.inline_errors');
// remove empty errors (used to clear error list)
errors = $.grep(errors, function(item) {
return item != '';
errors = $.grep(errors, function (item) {
return item !== '';
});
// CSS error class
@ -351,7 +351,7 @@ function displayErrors(error_list)
if (errors.length) {
// if error container doesn't exist, create it
if (errorCnt.length == 0) {
if (errorCnt.length === 0) {
if (isFieldset) {
errorCnt = $('<dl class="errors" />');
field.find('table').before(errorCnt);
@ -411,7 +411,7 @@ function validate_field(field, isKeyUp, errors)
errors[field_id] = [];
var functions = getFieldValidators(field_id, isKeyUp);
for (var i = 0; i < functions.length; i++) {
var args = functions[i][1] != null
var args = functions[i][1] !== null
? functions[i][1].slice(0)
: [];
args.unshift(isKeyUp);
@ -469,41 +469,41 @@ function setRestoreDefaultBtn(field, display)
el[display ? 'show' : 'hide']();
}
AJAX.registerOnload('config.js', function() {
AJAX.registerOnload('config.js', function () {
// register validators and mark custom values
var elements = $('input[id], select[id], textarea[id]');
$('input[id], select[id], textarea[id]').each(function(){
$('input[id], select[id], textarea[id]').each(function () {
markField(this);
var el = $(this);
el.bind('change', function() {
el.bind('change', function () {
validate_field_and_fieldset(this, false);
markField(this);
});
var tagName = el.attr('tagName');
// text fields can be validated after each change
if (tagName == 'INPUT' && el.attr('type') == 'text') {
el.keyup(function() {
el.keyup(function () {
validate_field_and_fieldset(el, true);
markField(el);
});
}
// disable textarea spellcheck
if (tagName == 'TEXTAREA') {
el.attr('spellcheck', false);
el.attr('spellcheck', false);
}
});
// check whether we've refreshed a page and browser remembered modified
// form values
var check_page_refresh = $('#check_page_refresh');
if (check_page_refresh.length == 0 || check_page_refresh.val() == '1') {
if (check_page_refresh.length === 0 || check_page_refresh.val() == '1') {
// run all field validators
var errors = {};
for (var i = 0; i < elements.length; i++) {
validate_field(elements[i], false, errors);
}
// run all fieldset validators
$('fieldset').each(function(){
$('fieldset').each(function () {
validate_fieldset(this, false, errors);
});
@ -534,14 +534,14 @@ function setTab(tab_id)
$('form.config-form input[name=tab_hash]').val(location.hash);
}
AJAX.registerOnload('config.js', function() {
AJAX.registerOnload('config.js', function () {
var tabs = $('ul.tabs');
if (!tabs.length) {
return;
}
// add tabs events and activate one tab (the first one or indicated by location hash)
tabs.find('a')
.click(function(e) {
.click(function (e) {
e.preventDefault();
setTab($(this).attr('href').substr(1));
})
@ -553,7 +553,7 @@ AJAX.registerOnload('config.js', function() {
// tab links handling, check each 200ms
// (works with history in FF, further browser support here would be an overkill)
var prev_hash;
var tab_check_fnc = function() {
var tab_check_fnc = function () {
if (location.hash != prev_hash) {
prev_hash = location.hash;
if (location.hash.match(/^#tab_.+/) && $('#' + location.hash.substr(5)).length) {
@ -573,8 +573,8 @@ AJAX.registerOnload('config.js', function() {
// Form reset buttons
//
AJAX.registerOnload('config.js', function() {
$('input[type=button][name=submit_reset]').click(function() {
AJAX.registerOnload('config.js', function () {
$('input[type=button][name=submit_reset]').click(function () {
var fields = $(this).closest('fieldset').find('input, select, textarea');
for (var i = 0, imax = fields.length; i < imax; i++) {
setFieldValue(fields[i], getFieldType(fields[i]));
@ -597,18 +597,22 @@ AJAX.registerOnload('config.js', function() {
*/
function restoreField(field_id)
{
var field = $('#'+field_id);
if (field.length == 0 || defaultValues[field_id] == undefined) {
var field = $('#' + field_id);
if (field.length === 0 || defaultValues[field_id] === undefined) {
return;
}
setFieldValue(field, getFieldType(field), defaultValues[field_id]);
}
AJAX.registerOnload('config.js', function() {
AJAX.registerOnload('config.js', function () {
$('div.tabs_contents')
.delegate('.restore-default, .set-value', 'mouseenter', function(){$(this).css('opacity', 1)})
.delegate('.restore-default, .set-value', 'mouseleave', function(){$(this).css('opacity', 0.25)})
.delegate('.restore-default, .set-value', 'click', function(e) {
.delegate('.restore-default, .set-value', 'mouseenter', function () {
$(this).css('opacity', 1);
})
.delegate('.restore-default, .set-value', 'mouseleave', function () {
$(this).css('opacity', 0.25);
})
.delegate('.restore-default, .set-value', 'click', function (e) {
e.preventDefault();
var href = $(this).attr('href');
var field_sel;
@ -635,7 +639,7 @@ AJAX.registerOnload('config.js', function() {
// User preferences import/export
//
AJAX.registerOnload('config.js', function() {
AJAX.registerOnload('config.js', function () {
offerPrefsAutoimport();
var radios = $('#import_local_storage, #export_local_storage');
if (!radios.length) {
@ -646,24 +650,24 @@ AJAX.registerOnload('config.js', function() {
radios
.prop('disabled', false)
.add('#export_text_file, #import_text_file')
.click(function(){
.click(function () {
var enable_id = $(this).attr('id');
var disable_id = enable_id.match(/local_storage$/)
? enable_id.replace(/local_storage$/, 'text_file')
: enable_id.replace(/text_file$/, 'local_storage');
$('#opts_'+disable_id).addClass('disabled').find('input').prop('disabled', true);
$('#opts_'+enable_id).removeClass('disabled').find('input').prop('disabled', false);
$('#opts_' + disable_id).addClass('disabled').find('input').prop('disabled', true);
$('#opts_' + enable_id).removeClass('disabled').find('input').prop('disabled', false);
});
// detect localStorage state
var ls_supported = window.localStorage || false;
var ls_exists = ls_supported ? (window.localStorage['config'] || false) : false;
$('div.localStorage-'+(ls_supported ? 'un' : '')+'supported').hide();
$('div.localStorage-'+(ls_exists ? 'empty' : 'exists')).hide();
$('div.localStorage-' + (ls_supported ? 'un' : '') + 'supported').hide();
$('div.localStorage-' + (ls_exists ? 'empty' : 'exists')).hide();
if (ls_exists) {
updatePrefsDate();
}
$('form.prefs-form').change(function(){
$('form.prefs-form').change(function () {
var form = $(this);
var disabled = false;
if (!ls_supported) {
@ -673,7 +677,7 @@ AJAX.registerOnload('config.js', function() {
disabled = true;
}
form.find('input[type=submit]').prop('disabled', disabled);
}).submit(function(e) {
}).submit(function (e) {
var form = $(this);
if (form.attr('name') == 'prefs_export' && $('#export_local_storage')[0].checked) {
e.preventDefault();
@ -685,7 +689,7 @@ AJAX.registerOnload('config.js', function() {
}
});
$('div.click-hide-message').live('click', function(){
$('div.click-hide-message').live('click', function () {
$(this)
.hide()
.parent('.group')
@ -714,7 +718,7 @@ function savePrefsToLocalStorage(form)
token: form.find('input[name=token]').val(),
submit_get_json: true
},
success: function(response) {
success: function (response) {
window.localStorage['config'] = response.prefs;
window.localStorage['config_mtime'] = response.mtime;
window.localStorage['config_mtime_local'] = (new Date()).toUTCString();
@ -726,7 +730,7 @@ function savePrefsToLocalStorage(form)
form.hide('fast');
form.prev('.click-hide-message').show('fast');
},
complete: function() {
complete: function () {
submit.prop('disabled', false);
}
});
@ -738,7 +742,7 @@ function savePrefsToLocalStorage(form)
function updatePrefsDate()
{
var d = new Date(window.localStorage['config_mtime_local']);
var msg = PMA_messages['strSavedOn'].replace('@DATE@', formatDate(d));
var msg = PMA_messages.strSavedOn.replace('@DATE@', formatDate(d));
$('#opts_import_local_storage div.localStorage-exists').html(msg);
}
@ -750,10 +754,10 @@ function updatePrefsDate()
function formatDate(d)
{
return d.getFullYear() + '-'
+ (d.getMonth() < 10 ? '0'+d.getMonth() : d.getMonth())
+ '-' + (d.getDate() < 10 ? '0'+d.getDate() : d.getDate())
+ ' ' + (d.getHours() < 10 ? '0'+d.getHours() : d.getHours())
+ ':' + (d.getMinutes() < 10 ? '0'+d.getMinutes() : d.getMinutes());
+ (d.getMonth() < 10 ? '0' + d.getMonth() : d.getMonth())
+ '-' + (d.getDate() < 10 ? '0' + d.getDate() : d.getDate())
+ ' ' + (d.getHours() < 10 ? '0' + d.getHours() : d.getHours())
+ ':' + (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes());
}
/**
@ -766,14 +770,15 @@ function offerPrefsAutoimport()
if (!cnt.length || !has_config) {
return;
}
cnt.find('a').click(function(e) {
cnt.find('a').click(function (e) {
e.preventDefault();
var a = $(this);
if (a.attr('href') == '#no') {
cnt.remove();
$.post('index.php', {
token: cnt.find('input[name=token]').val(),
prefs_autoload: 'hide'});
prefs_autoload: 'hide'
});
return;
}
cnt.find('input[name=json]').val(window.localStorage['config']);

View File

@ -56,9 +56,11 @@
// "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"
// ------------------------------------------------------------------
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x) {return(x<0||x>9?"":"0")+x}
var MONTH_NAMES = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
var DAY_NAMES = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
function LZ(x) {
return (x < 0 || x > 9 ? "" : "0") + x;
}
// ------------------------------------------------------------------
// isDate ( date_string, format_string )
@ -67,11 +69,13 @@ function LZ(x) {return(x<0||x>9?"":"0")+x}
// It is recommended that you trim whitespace around the value before
// passing it to this function, as whitespace is NOT ignored!
// ------------------------------------------------------------------
function isDate(val,format) {
var date=getDateFromFormat(val,format);
if (date==0) { return false; }
return true;
function isDate(val, format) {
var date = getDateFromFormat(val, format);
if (date === 0) {
return false;
}
return true;
}
// -------------------------------------------------------------------
// compareDates(date1,date1format,date2,date2format)
@ -81,97 +85,115 @@ function isDate(val,format) {
// 0 if date2 is greater than date1 of if they are the same
// -1 if either of the dates is in an invalid format
// -------------------------------------------------------------------
function compareDates(date1,dateformat1,date2,dateformat2) {
var d1=getDateFromFormat(date1,dateformat1);
var d2=getDateFromFormat(date2,dateformat2);
if (d1==0 || d2==0) {
function compareDates(date1, dateformat1, date2, dateformat2) {
var d1 = getDateFromFormat(date1, dateformat1);
var d2 = getDateFromFormat(date2, dateformat2);
if (d1 === 0 || d2 === 0) {
return -1;
}
else if (d1 > d2) {
} else if (d1 > d2) {
return 1;
}
return 0;
}
return 0;
}
// ------------------------------------------------------------------
// formatDate (date_object, format)
// Returns a date in the output format specified.
// The format string uses the same abbreviations as in getDateFromFormat()
// ------------------------------------------------------------------
function formatDate(date,format) {
format=format+"";
var result="";
var i_format=0;
var c="";
var token="";
var y=date.getYear()+"";
var M=date.getMonth()+1;
var d=date.getDate();
var E=date.getDay();
var H=date.getHours();
var m=date.getMinutes();
var s=date.getSeconds();
var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
function formatDate(date, format) {
format = format + "";
var result = "";
var i_format = 0;
var c = "";
var token = "";
var y = date.getYear() + "";
var M = date.getMonth() + 1;
var d = date.getDate();
var E = date.getDay();
var H = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();
// Convert real date parts into formatted versions
var value=new Object();
if (y.length < 4) {y=""+(y-0+1900);}
value["y"]=""+y;
value["yyyy"]=y;
value["yy"]=y.substring(2,4);
value["M"]=M;
value["MM"]=LZ(M);
value["MMM"]=MONTH_NAMES[M-1];
value["NNN"]=MONTH_NAMES[M+11];
value["d"]=d;
value["dd"]=LZ(d);
value["E"]=DAY_NAMES[E+7];
value["EE"]=DAY_NAMES[E];
value["H"]=H;
value["HH"]=LZ(H);
if (H==0){value["h"]=12;}
else if (H>12){value["h"]=H-12;}
else {value["h"]=H;}
value["hh"]=LZ(value["h"]);
if (H>11){value["K"]=H-12;} else {value["K"]=H;}
value["k"]=H+1;
value["KK"]=LZ(value["K"]);
value["kk"]=LZ(value["k"]);
if (H > 11) { value["a"]="PM"; }
else { value["a"]="AM"; }
value["m"]=m;
value["mm"]=LZ(m);
value["s"]=s;
value["ss"]=LZ(s);
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] != null) { result=result + value[token]; }
else { result=result + token; }
}
return result;
var value = new Object();
if (y.length < 4) {
y = "" + (y - 0 + 1900);
}
value["y"] = "" + y;
value["yyyy"] = y;
value["yy"] = y.substring(2, 4);
value["M"] = M;
value["MM"] = LZ(M);
value["MMM"] = MONTH_NAMES[M - 1];
value["NNN"] = MONTH_NAMES[M + 11];
value["d"] = d;
value["dd"] = LZ(d);
value["E"] = DAY_NAMES[E + 7];
value["EE"] = DAY_NAMES[E];
value["H"] = H;
value["HH"] = LZ(H);
if (H === 0) {
value["h"] = 12;
} else if (H > 12) {
value["h"] = H - 12;
} else {
value["h"] = H;
}
value["hh"] = LZ(value["h"]);
if (H > 11) {
value["K"] = H - 12;
} else {
value["K"] = H;
}
value["k"] = H + 1;
value["KK"] = LZ(value["K"]);
value["kk"] = LZ(value["k"]);
if (H > 11) {
value["a"] = "PM";
} else {
value["a"] = "AM";
}
value["m"] = m;
value["mm"] = LZ(m);
value["s"] = s;
value["ss"] = LZ(s);
while (i_format < format.length) {
c = format.charAt(i_format);
token = "";
while ((format.charAt(i_format) == c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] !== null) {
result = result + value[token];
} else {
result = result + token;
}
}
return result;
}
// ------------------------------------------------------------------
// Utility functions for parsing in getDateFromFormat()
// ------------------------------------------------------------------
function _isInteger(val) {
var digits="1234567890";
for (var i=0; i < val.length; i++) {
if (digits.indexOf(val.charAt(i))==-1) { return false; }
}
var digits = "1234567890";
for (var i = 0; i < val.length; i++) {
if (digits.indexOf(val.charAt(i)) == -1) { return false; }
}
return true;
}
function _getInt(str,i,minlength,maxlength) {
for (var x=maxlength; x>=minlength; x--) {
var token=str.substring(i,i+x);
if (token.length < minlength) { return null; }
if (_isInteger(token)) { return token; }
}
function _getInt(str, i, minlength, maxlength) {
for (var x = maxlength; x >= minlength; x--) {
var token = str.substring(i, i + x);
if (token.length < minlength) {
return null;
}
if (_isInteger(token)) {
return token;
}
return null;
}
return null;
}
// ------------------------------------------------------------------
// getDateFromFormat( date_string , format_string )
@ -180,129 +202,178 @@ function _getInt(str,i,minlength,maxlength) {
// If the date string matches the format string, it returns the
// getTime() of the date. If it does not match, it returns 0.
// ------------------------------------------------------------------
function getDateFromFormat(val,format) {
val=val+"";
format=format+"";
var i_val=0;
var i_format=0;
var c="";
var token="";
var token2="";
var x,y;
var now=new Date();
var year=now.getYear();
var month=now.getMonth()+1;
var date=1;
var hh=now.getHours();
var mm=now.getMinutes();
var ss=now.getSeconds();
var ampm="";
function getDateFromFormat(val, format) {
val = val + "";
format = format + "";
var i_val = 0;
var i_format = 0;
var c = "";
var token = "";
var token2 = "";
var x, y;
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = 1;
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getSeconds();
var ampm = "";
while (i_format < format.length) {
// Get next token from format string
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
c = format.charAt(i_format);
token = "";
while ((format.charAt(i_format) == c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
}
// Extract contents of value based on format token
if (token=="yyyy" || token=="yy" || token=="y") {
if (token=="yyyy") { x=4;y=4; }
if (token=="yy") { x=2;y=2; }
if (token=="y") { x=2;y=4; }
year=_getInt(val,i_val,x,y);
if (year==null) { return 0; }
if (token == "yyyy" || token == "yy" || token == "y") {
if (token == "yyyy") {
x = 4;
y = 4;
} else if (token == "yy") {
x = 2;
y = 2;
} else if (token == "y") {
x = 2;
y = 4;
}
year = _getInt(val, i_val, x, y);
if (year === null) {
return 0;
}
i_val += year.length;
if (year.length==2) {
if (year > 70) { year=1900+(year-0); }
else { year=2000+(year-0); }
if (year.length == 2) {
if (year > 70) {
year = 1900 + (year - 0);
} else {
year = 2000 + (year - 0);
}
}
else if (token=="MMM"||token=="NNN"){
month=0;
for (var i=0; i<MONTH_NAMES.length; i++) {
var month_name=MONTH_NAMES[i];
if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
if (token=="MMM"||(token=="NNN"&&i>11)) {
month=i+1;
if (month>12) { month -= 12; }
} else if (token == "MMM" || token == "NNN") {
month = 0;
for (var i = 0; i < MONTH_NAMES.length; i++) {
var month_name = MONTH_NAMES[i];
if (val.substring(i_val, i_val + month_name.length).toLowerCase() == month_name.toLowerCase()) {
if (token == "MMM" || (token == "NNN" && i > 11)) {
month = i + 1;
if (month > 12) {
month -= 12;
}
i_val += month_name.length;
break;
}
}
}
if ((month < 1)||(month>12)){return 0;}
}
else if (token=="EE"||token=="E"){
for (var i=0; i<DAY_NAMES.length; i++) {
var day_name=DAY_NAMES[i];
if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
if ((month < 1) || (month > 12)) {
return 0;
}
} else if (token == "EE" || token == "E") {
for (var i = 0; i < DAY_NAMES.length; i++) {
var day_name = DAY_NAMES[i];
if (val.substring(i_val, i_val + day_name.length).toLowerCase() == day_name.toLowerCase()) {
i_val += day_name.length;
break;
}
}
}
else if (token=="MM"||token=="M") {
month=_getInt(val,i_val,token.length,2);
if (month==null||(month<1)||(month>12)){return 0;}
i_val+=month.length;}
else if (token=="dd"||token=="d") {
date=_getInt(val,i_val,token.length,2);
if (date==null||(date<1)||(date>31)){return 0;}
i_val+=date.length;}
else if (token=="hh"||token=="h") {
hh=_getInt(val,i_val,token.length,2);
if (hh==null||(hh<1)||(hh>12)){return 0;}
i_val+=hh.length;}
else if (token=="HH"||token=="H") {
hh=_getInt(val,i_val,token.length,2);
if (hh==null||(hh<0)||(hh>23)){return 0;}
i_val+=hh.length;}
else if (token=="KK"||token=="K") {
hh=_getInt(val,i_val,token.length,2);
if (hh==null||(hh<0)||(hh>11)){return 0;}
i_val+=hh.length;}
else if (token=="kk"||token=="k") {
hh=_getInt(val,i_val,token.length,2);
if (hh==null||(hh<1)||(hh>24)){return 0;}
i_val+=hh.length;hh--;}
else if (token=="mm"||token=="m") {
mm=_getInt(val,i_val,token.length,2);
if (mm==null||(mm<0)||(mm>59)){return 0;}
i_val+=mm.length;}
else if (token=="ss"||token=="s") {
ss=_getInt(val,i_val,token.length,2);
if (ss==null||(ss<0)||(ss>59)){return 0;}
i_val+=ss.length;}
else if (token=="a") {
if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
else {return 0;}
i_val+=2;}
else {
if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
else {i_val+=token.length;}
} else if (token == "MM" || token == "M") {
month = _getInt(val, i_val, token.length, 2);
if (month === null || (month < 1) || (month > 12)) {
return 0;
}
i_val += month.length;
} else if (token == "dd" || token == "d") {
date = _getInt(val, i_val, token.length, 2);
if (date === null || (date < 1) || (date > 31)) {
return 0;
}
i_val += date.length;
} else if (token == "hh" || token == "h") {
hh = _getInt(val, i_val, token.length, 2);
if (hh === null || (hh < 1) || (hh > 12)) {
return 0;
}
i_val += hh.length;
} else if (token == "HH" || token == "H") {
hh = _getInt(val, i_val, token.length, 2);
if (hh === null || (hh < 0) || (hh > 23)) {
return 0;
}
i_val += hh.length;
} else if (token == "KK" || token == "K") {
hh = _getInt(val, i_val, token.length, 2);
if (hh === null || (hh < 0) || (hh > 11)) {
return 0;
}
i_val += hh.length;
} else if (token == "kk" || token == "k") {
hh = _getInt(val, i_val, token.length, 2);
if (hh === null || (hh < 1) || (hh > 24)) {
return 0;
}
i_val += hh.length;
hh--;
} else if (token == "mm" || token == "m") {
mm = _getInt(val, i_val, token.length, 2);
if (mm === null || (mm < 0) || (mm > 59)) {
return 0;
}
i_val += mm.length;
} else if (token == "ss" || token == "s") {
ss = _getInt(val, i_val, token.length, 2);
if (ss === null || (ss < 0) || (ss > 59)) {
return 0;
}
i_val += ss.length;
} else if (token == "a") {
if (val.substring(i_val, i_val + 2).toLowerCase() == "am") {
ampm = "AM";
} else if (val.substring(i_val, i_val + 2).toLowerCase() == "pm") {
ampm = "PM";
} else {
return 0;
}
i_val += 2;
} else {
if (val.substring(i_val, i_val + token.length) != token) {
return 0;
} else {
i_val += token.length;
}
}
// If there are any trailing characters left in the value, it doesn't match
if (i_val != val.length) { return 0; }
// Is date valid for month?
if (month==2) {
// Check for leap year
if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
if (date > 29){ return 0; }
}
else { if (date > 28) { return 0; } }
}
if ((month==4)||(month==6)||(month==9)||(month==11)) {
if (date > 30) { return 0; }
}
// Correct hours value
if (hh<12 && ampm=="PM") { hh=hh-0+12; }
else if (hh>11 && ampm=="AM") { hh-=12; }
var newdate=new Date(year,month-1,date,hh,mm,ss);
return newdate.getTime();
}
// If there are any trailing characters left in the value, it doesn't match
if (i_val != val.length) {
return 0;
}
// Is date valid for month?
if (month == 2) {
// Check for leap year
if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) { // leap year
if (date > 29) {
return 0;
}
} else {
if (date > 28) {
return 0;
}
}
}
if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) {
if (date > 30) {
return 0;
}
}
// Correct hours value
if (hh < 12 && ampm == "PM") {
hh = hh - 0 + 12;
} else if (hh > 11 && ampm == "AM") {
hh -= 12;
}
var newdate = new Date(year, month - 1, date, hh, mm, ss);
return newdate.getTime();
}
// ------------------------------------------------------------------
// parseDate( date_string [, prefer_euro_format] )
@ -318,18 +389,20 @@ function getDateFromFormat(val,format) {
// Returns a Date object or null if no patterns match.
// ------------------------------------------------------------------
function parseDate(val) {
var preferEuro=(arguments.length==2)?arguments[1]:false;
generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');
monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');
dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');
var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');
var d=null;
for (var i=0; i<checkList.length; i++) {
var l=window[checkList[i]];
for (var j=0; j<l.length; j++) {
d=getDateFromFormat(val,l[j]);
if (d!=0) { return new Date(d); }
var preferEuro = (arguments.length == 2) ? arguments[1] : false;
generalFormats = new Array('y-M-d', 'MMM d, y', 'MMM d,y', 'y-MMM-d', 'd-MMM-y', 'MMM d');
monthFirst = new Array('M/d/y', 'M-d-y', 'M.d.y', 'MMM-d', 'M/d', 'M-d');
dateFirst = new Array('d/M/y', 'd-M-y', 'd.M.y', 'd-MMM', 'd/M', 'd-M');
var checkList = new Array('generalFormats', preferEuro ? 'dateFirst' : 'monthFirst', preferEuro ? 'monthFirst' : 'dateFirst');
var d = null;
for (var i = 0; i < checkList.length; i++) {
var l = window[checkList[i]];
for (var j = 0; j < l.length; j++) {
d = getDateFromFormat(val, l[j]);
if (d !== 0) {
return new Date(d);
}
}
return null;
}
return null;
}

View File

@ -21,18 +21,18 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_operations.js', function() {
AJAX.registerTeardown('db_operations.js', function () {
$("#rename_db_form.ajax").die('submit');
$("#copy_db_form.ajax").die('submit');
$("#change_db_charset_form.ajax").die('submit');
});
AJAX.registerOnload('db_operations.js', function() {
AJAX.registerOnload('db_operations.js', function () {
/**
* Ajax event handlers for 'Rename Database'
*/
$("#rename_db_form.ajax").live('submit', function(event) {
$("#rename_db_form.ajax").live('submit', function (event) {
event.preventDefault();
var $form = $(this);
@ -41,17 +41,17 @@ AJAX.registerOnload('db_operations.js', function() {
PMA_prepareForAjaxRequest($form);
$form.PMA_confirm(question, $form.attr('action'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strRenamingDatabases'], false);
$.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function(data) {
if (data.success == true) {
$form.PMA_confirm(question, $form.attr('action'), function (url) {
PMA_ajaxShowMessage(PMA_messages.strRenamingDatabases, false);
$.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
PMA_commonParams.set('db', data.newname);
PMA_reloadNavigation(function() {
PMA_reloadNavigation(function () {
$('#pma_navigation_tree')
.find("a:not('.expander')")
.each(function(index) {
.each(function (index) {
var $thisAnchor = $(this);
if ($thisAnchor.text() == data.newname) {
// simulate a click on the new db name
@ -64,23 +64,23 @@ AJAX.registerOnload('db_operations.js', function() {
PMA_ajaxShowMessage(data.error, false);
}
}); // end $.get()
})
});
}); // end Rename Database
/**
* Ajax Event Handler for 'Copy Database'
*/
$("#copy_db_form.ajax").live('submit', function(event) {
$("#copy_db_form.ajax").live('submit', function (event) {
event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strCopyingDatabase'], false);
PMA_ajaxShowMessage(PMA_messages.strCopyingDatabase, false);
var $form = $(this);
PMA_prepareForAjaxRequest($form);
$.get($form.attr('action'), $form.serialize(), function(data) {
$.get($form.attr('action'), $form.serialize(), function (data) {
// use messages that stay on screen
$('div.success, div.error').fadeOut();
if (data.success == true) {
if (data.success === true) {
PMA_commonParams.set('db', data.newname);
if ( $("#checkbox_switch").is(":checked")) {
if ($("#checkbox_switch").is(":checked")) {
PMA_commonParams.set('db', data.newname);
PMA_commonActions.refreshMain(false, function () {
PMA_ajaxShowMessage(data.message);
@ -98,13 +98,13 @@ AJAX.registerOnload('db_operations.js', function() {
/**
* Ajax Event handler for 'Change Charset' of the database
*/
$("#change_db_charset_form.ajax").live('submit', function(event) {
$("#change_db_charset_form.ajax").live('submit', function (event) {
event.preventDefault();
var $form = $(this);
PMA_prepareForAjaxRequest($form);
PMA_ajaxShowMessage(PMA_messages['strChangingCharset']);
$.get($form.attr('action'), $form.serialize() + "&submitcollation=1", function(data) {
if (data.success == true) {
PMA_ajaxShowMessage(PMA_messages.strChangingCharset);
$.get($form.attr('action'), $form.serialize() + "&submitcollation=1", function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
} else {
PMA_ajaxShowMessage(data.error, false);

View File

@ -18,7 +18,7 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_search.js', function() {
AJAX.registerTeardown('db_search.js', function () {
$('#buttonGo').unbind('click');
$('#togglesearchresultlink').unbind('click');
$("#togglequerybox").unbind('click');
@ -36,16 +36,16 @@ AJAX.registerTeardown('db_search.js', function() {
*/
function loadResult(result_path, table_name, link)
{
$(function() {
$(function () {
/** Hides the results shown by the delete criteria */
var $msg = PMA_ajaxShowMessage(PMA_messages['strBrowsing'], false);
var $msg = PMA_ajaxShowMessage(PMA_messages.strBrowsing, false);
$('#sqlqueryform').hide();
$('#togglequerybox').hide();
/** Load the browse results to the page */
$("#table-info").show();
$('#table-link').attr({"href" : 'sql.php?'+link }).text(table_name);
$('#table-link').attr({"href" : 'sql.php?' + link }).text(table_name);
var url = result_path + " #sqlqueryresults";
$('#browse-results').load(url, null, function() {
$('#browse-results').load(url, null, function () {
$('html, body')
.animate({
scrollTop: $("#browse-results").offset().top
@ -66,7 +66,7 @@ function loadResult(result_path, table_name, link)
*/
function deleteResult(result_path, msg)
{
$(function() {
$(function () {
/** Hides the results shown by the browse criteria */
$("#table-info").hide();
$('#browse-results').hide();
@ -74,14 +74,14 @@ function deleteResult(result_path, msg)
$('#togglequerybox').hide();
/** Conformation message for deletion */
if (confirm(msg)) {
var $msg = PMA_ajaxShowMessage(PMA_messages['strDeleting'], false);
var $msg = PMA_ajaxShowMessage(PMA_messages.strDeleting, false);
/** Load the deleted option to the page*/
$('#sqlqueryform').html('');
var url = result_path + " #result_query, #sqlqueryform";
$('#browse-results').load(url, function () {
/** Refresh the search results after the deletion */
document.getElementById('buttonGo').click();
$('#togglequerybox').html(PMA_messages['strHideQueryBox']);
$('#togglequerybox').html(PMA_messages.strHideQueryBox);
/** Show the results of the deletion option */
$('#browse-results').show();
$('#sqlqueryform').show();
@ -92,17 +92,17 @@ function deleteResult(result_path, msg)
}, 1000);
PMA_ajaxRemoveMessage($msg);
});
}
}
});
}
AJAX.registerOnload('db_search.js', function() {
AJAX.registerOnload('db_search.js', function () {
/** Hide the table link in the initial search result */
var icon = PMA_getImage('s_tbl.png', '', {'id': 'table-image'}).toString();
$("#table-info").prepend(icon).hide();
/** Hide the browse and deleted results in the new search criteria */
$('#buttonGo').click(function(){
$('#buttonGo').click(function () {
$("#table-info").hide();
$('#browse-results').hide();
$('#sqlqueryform').hide();
@ -122,17 +122,17 @@ AJAX.registerOnload('db_search.js', function() {
* the hide/show criteria in search result forms
*/
$('#togglesearchresultlink')
.html(PMA_messages['strHideSearchResults'])
.bind('click', function() {
var $link = $(this);
$('#searchresults').slideToggle();
if ($link.text() == PMA_messages['strHideSearchResults']) {
$link.text(PMA_messages['strShowSearchResults']);
} else {
$link.text(PMA_messages['strHideSearchResults']);
}
/** avoid default click action */
return false;
.html(PMA_messages.strHideSearchResults)
.bind('click', function () {
var $link = $(this);
$('#searchresults').slideToggle();
if ($link.text() == PMA_messages.strHideSearchResults) {
$link.text(PMA_messages.strShowSearchResults);
} else {
$link.text(PMA_messages.strHideSearchResults);
}
/** avoid default click action */
return false;
});
/**
@ -149,13 +149,13 @@ AJAX.registerOnload('db_search.js', function() {
*/
$("#togglequerybox")
.hide()
.bind('click', function() {
.bind('click', function () {
var $link = $(this);
$('#sqlqueryform').slideToggle("medium");
if ($link.text() == PMA_messages['strHideQueryBox']) {
$link.text(PMA_messages['strShowQueryBox']);
if ($link.text() == PMA_messages.strHideQueryBox) {
$link.text(PMA_messages.strShowQueryBox);
} else {
$link.text(PMA_messages['strHideQueryBox']);
$link.text(PMA_messages.strHideQueryBox);
}
/** avoid default click action */
return false;
@ -163,44 +163,44 @@ AJAX.registerOnload('db_search.js', function() {
/** don't show it until we have results on-screen */
/**
* Changing the displayed text according to
* the hide/show criteria in search criteria form
*/
$('#togglesearchformlink')
.html(PMA_messages['strShowSearchCriteria'])
.bind('click', function() {
/**
* Changing the displayed text according to
* the hide/show criteria in search criteria form
*/
$('#togglesearchformlink')
.html(PMA_messages.strShowSearchCriteria)
.bind('click', function () {
var $link = $(this);
$('#db_search_form').slideToggle();
if ($link.text() == PMA_messages['strHideSearchCriteria']) {
$link.text(PMA_messages['strShowSearchCriteria']);
if ($link.text() == PMA_messages.strHideSearchCriteria) {
$link.text(PMA_messages.strShowSearchCriteria);
} else {
$link.text(PMA_messages['strHideSearchCriteria']);
$link.text(PMA_messages.strHideSearchCriteria);
}
/** avoid default click action */
return false;
});
});
/**
* Ajax Event handler for retrieving the result of an SQL Query
*/
$("#db_search_form.ajax").live('submit', function(event) {
$("#db_search_form.ajax").live('submit', function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage(PMA_messages['strSearching'], false);
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
// jQuery object to reuse
var $form = $(this);
PMA_prepareForAjaxRequest($form);
var url = $form.serialize() + "&submit_search=" + $("#buttonGo").val();
$.post($form.attr('action'), url, function(data) {
if (data.success == true) {
$.post($form.attr('action'), url, function (data) {
if (data.success === true) {
// found results
$("#searchresults").html(data.message);
$('#togglesearchresultlink')
// always start with the Show message
.text(PMA_messages['strHideSearchResults']);
.text(PMA_messages.strHideSearchResults);
$('#togglesearchresultsdiv')
// now it's time to show the div containing the link
.show();
@ -213,7 +213,7 @@ AJAX.registerOnload('db_search.js', function() {
.hide();
$('#togglesearchformlink')
// always start with the Show message
.text(PMA_messages['strShowSearchCriteria']);
.text(PMA_messages.strShowSearchCriteria);
$('#togglesearchformdiv')
// now it's time to show the div containing the link
.show();
@ -223,6 +223,6 @@ AJAX.registerOnload('db_search.js', function() {
}
PMA_ajaxRemoveMessage($msgbox);
})
})
});
});
}); // end $()

View File

@ -21,7 +21,7 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_structure.js', function() {
AJAX.registerTeardown('db_structure.js', function () {
$("span.fkc_switch").unbind('click');
$('#fkc_checkbox').unbind('change');
$("a.truncate_table_anchor.ajax").die('click');
@ -36,13 +36,13 @@ AJAX.registerTeardown('db_structure.js', function() {
*/
function PMA_adjustTotals() {
var byteUnits = new Array(
PMA_messages['strB'],
PMA_messages['strKiB'],
PMA_messages['strMiB'],
PMA_messages['strGiB'],
PMA_messages['strTiB'],
PMA_messages['strPiB'],
PMA_messages['strEiB']
PMA_messages.strB,
PMA_messages.strKiB,
PMA_messages.strMiB,
PMA_messages.strGiB,
PMA_messages.strTiB,
PMA_messages.strPiB,
PMA_messages.strEiB
);
/**
* @var $allTr jQuery object that references all the rows in the list of tables
@ -60,7 +60,7 @@ function PMA_adjustTotals() {
// Get the number of rows for this SQL table
var strRows = $this.find('.tbl_rows').text();
// If the value is approximated
if (strRows.indexOf('~') == 0) {
if (strRows.indexOf('~') === 0) {
rowSumApproximated = true;
// The approximated value contains a preceding ~ and a following 2 (Eg 100 --> ~1002)
strRows = strRows.substring(1, strRows.length - 1);
@ -123,13 +123,13 @@ function PMA_adjustTotals() {
// Update summary with new data
var $summary = $("#tbl_summary_row");
$summary.find('.tbl_num').text($.sprintf(PMA_messages['strTables'], tableSum));
$summary.find('.tbl_num').text($.sprintf(PMA_messages.strTables, tableSum));
$summary.find('.tbl_rows').text(strRowSum);
$summary.find('.tbl_size').text(sizeSum + " " + byteUnits[size_magnitude]);
$summary.find('.tbl_overhead').text(overheadSum + " " + byteUnits[overhead_magnitude]);
}
AJAX.registerOnload('db_structure.js', function() {
AJAX.registerOnload('db_structure.js', function () {
/**
* Handler for the print view multisubmit.
* All other multi submits can be handled via ajax, but this one needs
@ -159,28 +159,28 @@ AJAX.registerOnload('db_structure.js', function() {
* Event handler for 'Foreign Key Checks' disabling option
* in the drop table confirmation form
*/
$("span.fkc_switch").click(function(event){
if ($("#fkc_checkbox").prop('checked')) {
$("#fkc_checkbox").prop('checked', false);
$("#fkc_status").html(PMA_messages['strForeignKeyCheckDisabled']);
return;
}
$("#fkc_checkbox").prop('checked', true);
$("#fkc_status").html(PMA_messages['strForeignKeyCheckEnabled']);
$("span.fkc_switch").click(function (event) {
if ($("#fkc_checkbox").prop('checked')) {
$("#fkc_checkbox").prop('checked', false);
$("#fkc_status").html(PMA_messages.strForeignKeyCheckDisabled);
return;
}
$("#fkc_checkbox").prop('checked', true);
$("#fkc_status").html(PMA_messages.strForeignKeyCheckEnabled);
});
$('#fkc_checkbox').change(function () {
if ($(this).prop("checked")) {
$("#fkc_status").html(PMA_messages['strForeignKeyCheckEnabled']);
$("#fkc_status").html(PMA_messages.strForeignKeyCheckEnabled);
return;
}
$("#fkc_status").html(PMA_messages['strForeignKeyCheckDisabled']);
$("#fkc_status").html(PMA_messages.strForeignKeyCheckDisabled);
}); // End of event handler for 'Foreign Key Check'
/**
* Ajax Event handler for 'Truncate Table'
*/
$("a.truncate_table_anchor.ajax").live('click', function(event) {
$("a.truncate_table_anchor.ajax").live('click', function (event) {
event.preventDefault();
/**
@ -200,12 +200,12 @@ AJAX.registerOnload('db_structure.js', function() {
PMA_messages.strTruncateTableStrongWarning + ' '
+ $.sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name));
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function(url) {
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
if (data.success == true) {
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
// Adjust table statistics
var $tr = $this_anchor.closest('tr');
@ -221,7 +221,7 @@ AJAX.registerOnload('db_structure.js', function() {
.removeClass('truncate_table_anchor');
PMA_adjustTotals();
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); //end $.PMA_confirm()
@ -230,7 +230,7 @@ AJAX.registerOnload('db_structure.js', function() {
/**
* Ajax Event handler for 'Drop Table' or 'Drop View'
*/
$("a.drop_table_anchor.ajax").live('click', function(event) {
$("a.drop_table_anchor.ajax").live('click', function (event) {
event.preventDefault();
var $this_anchor = $(this);
@ -261,12 +261,12 @@ AJAX.registerOnload('db_structure.js', function() {
$.sprintf(PMA_messages.strDoYouReally, 'DROP VIEW ' + escapeHtml(curr_table_name));
}
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function(url) {
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
var $msg = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
if (data.success == true) {
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
toggleRowColors($curr_row.next());
$curr_row.hide("medium").remove();
@ -274,7 +274,7 @@ AJAX.registerOnload('db_structure.js', function() {
PMA_reloadNavigation();
PMA_ajaxRemoveMessage($msg);
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); // end $.PMA_confirm()
@ -283,7 +283,7 @@ AJAX.registerOnload('db_structure.js', function() {
/**
* Ajax Event handler for 'Drop tracking'
*/
$('a.drop_tracking_anchor.ajax').live('click', function(event) {
$('a.drop_tracking_anchor.ajax').live('click', function (event) {
event.preventDefault();
var $anchor = $(this);
@ -295,14 +295,14 @@ AJAX.registerOnload('db_structure.js', function() {
/**
* @var question String containing the question to be asked for confirmation
*/
var question = PMA_messages['strDeleteTrackingData'];
var question = PMA_messages.strDeleteTrackingData;
$anchor.PMA_confirm(question, $anchor.attr('href'), function(url) {
$anchor.PMA_confirm(question, $anchor.attr('href'), function (url) {
PMA_ajaxShowMessage(PMA_messages['strDeletingTrackingData']);
PMA_ajaxShowMessage(PMA_messages.strDeletingTrackingData);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if (data.success == true) {
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) {
if (data.success === true) {
var $tracked_table = $curr_tracking_row.parents('table');
var table_name = $curr_tracking_row.find('td:nth-child(2)').text();
@ -313,7 +313,7 @@ AJAX.registerOnload('db_structure.js', function() {
} else {
// There are more rows left after the deletion
toggleRowColors($curr_tracking_row.next());
$curr_tracking_row.hide("slow", function() {
$curr_tracking_row.hide("slow", function () {
$(this).remove();
});
}
@ -325,7 +325,7 @@ AJAX.registerOnload('db_structure.js', function() {
if ($untracked_table.length > 0) {
var $rows = $untracked_table.find('tbody tr');
$rows.each(function(index) {
$rows.each(function (index) {
var $row = $(this);
var tmp_tbl_name = $row.find('td:first-child').text();
var is_last_iteration = (index == ($rows.length - 1));
@ -358,7 +358,7 @@ AJAX.registerOnload('db_structure.js', function() {
PMA_ajaxShowMessage(data.message);
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); // end $.PMA_confirm()
@ -369,15 +369,15 @@ AJAX.registerOnload('db_structure.js', function() {
* Ajax Event handler for calculatig the real end for a InnoDB table
*
*/
$('#real_end_input').live('click', function(event) {
$('#real_end_input').live('click', function (event) {
event.preventDefault();
/**
* @var question String containing the question to be asked for confirmation
*/
var question = PMA_messages['strOperationTakesLongTime'];
var question = PMA_messages.strOperationTakesLongTime;
$(this).PMA_confirm(question, '', function() {
$(this).PMA_confirm(question, '', function () {
return true;
});
return false;

View File

@ -7,7 +7,7 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('export.js', function() {
AJAX.registerTeardown('export.js', function () {
$("#plugins").unbind('change');
$("input[type='radio'][name='sql_structure_or_data']").unbind('change');
$("input[type='radio'][name='latex_structure_or_data']").unbind('change');
@ -27,16 +27,16 @@ AJAX.registerOnload('export.js', function () {
* Toggles the hiding and showing of each plugin's options
* according to the currently selected plugin from the dropdown list
*/
$("#plugins").change(function() {
$("#plugins").change(function () {
$("#format_specific_opts div.format_specific_options").hide();
var selected_plugin_name = $("#plugins option:selected").val();
$("#" + selected_plugin_name + "_options").show();
});
});
/**
* Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
*/
$("input[type='radio'][name='sql_structure_or_data']").change(function() {
$("input[type='radio'][name='sql_structure_or_data']").change(function () {
var comments_are_present = $("#checkbox_sql_include_comments").prop("checked");
var show = $("input[type='radio'][name='sql_structure_or_data']:checked").val();
if (show == 'data') {
@ -54,7 +54,7 @@ AJAX.registerOnload('export.js', function () {
$("#checkbox_sql_relation").removeProp('disabled').parent().fadeTo('fast', 1);
$("#checkbox_sql_mime").removeProp('disabled').parent().fadeTo('fast', 1);
}
});
});
});
@ -82,19 +82,19 @@ function toggle_structure_data_opts(pluginName)
}
AJAX.registerOnload('export.js', function () {
$("input[type='radio'][name='latex_structure_or_data']").change(function() {
$("input[type='radio'][name='latex_structure_or_data']").change(function () {
toggle_structure_data_opts("latex");
});
$("input[type='radio'][name='odt_structure_or_data']").change(function() {
$("input[type='radio'][name='odt_structure_or_data']").change(function () {
toggle_structure_data_opts("odt");
});
$("input[type='radio'][name='texytext_structure_or_data']").change(function() {
$("input[type='radio'][name='texytext_structure_or_data']").change(function () {
toggle_structure_data_opts("texytext");
});
$("input[type='radio'][name='htmlword_structure_or_data']").change(function() {
$("input[type='radio'][name='htmlword_structure_or_data']").change(function () {
toggle_structure_data_opts("htmlword");
});
$("input[type='radio'][name='sql_structure_or_data']").change(function() {
$("input[type='radio'][name='sql_structure_or_data']").change(function () {
toggle_structure_data_opts("sql");
});
});
@ -125,7 +125,7 @@ AJAX.registerOnload('export.js', function () {
*/
function toggle_sql_include_comments()
{
$("#checkbox_sql_include_comments").change(function() {
$("#checkbox_sql_include_comments").change(function () {
if (!$("#checkbox_sql_include_comments").prop("checked")) {
$("#ul_include_comments > li").fadeTo('fast', 0.4);
$("#ul_include_comments > li > input").prop('disabled', true);
@ -147,10 +147,10 @@ AJAX.registerOnload('export.js', function () {
*/
var $create = $("#checkbox_sql_create_table_statements");
var $create_options = $("#ul_create_table_statements input");
$create.change(function() {
$create.change(function () {
$create_options.prop('checked', $(this).prop("checked"));
});
$create_options.change(function() {
$create_options.change(function () {
if ($create_options.is(":checked")) {
$create.prop('checked', true);
}
@ -159,7 +159,7 @@ AJAX.registerOnload('export.js', function () {
/**
* Disables the view output as text option if the output must be saved as a file
*/
$("#plugins").change(function() {
$("#plugins").change(function () {
var active_plugin = $("#plugins option:selected").val();
var force_file = $("#force_file_" + active_plugin).val();
if (force_file == "true") {
@ -217,20 +217,41 @@ AJAX.registerOnload('export.js', function () {
toggle_structure_data_opts($("select#plugins").val());
toggle_sql_include_comments();
/**
* Initially disables the "Dump some row(s)" sub-options
*/
disable_dump_some_rows_sub_options();
/**
* Disables the "Dump some row(s)" sub-options when it is not selected
*/
$("input[type='radio'][name='allrows']").change(function() {
$("input[type='radio'][name='allrows']").change(function () {
if ($("input[type='radio'][name='allrows']").prop("checked")) {
$("label[for='limit_to']").fadeTo('fast', 0.4);
$("label[for='limit_from']").fadeTo('fast', 0.4);
$("input[type='text'][name='limit_to']").prop('disabled', true);
$("input[type='text'][name='limit_from']").prop('disabled', true);
enable_dump_some_rows_sub_options();
} else {
$("label[for='limit_to']").fadeTo('fast', 1);
$("label[for='limit_from']").fadeTo('fast', 1);
$("input[type='text'][name='limit_to']").removeProp('disabled');
$("input[type='text'][name='limit_from']").removeProp('disabled');
disable_dump_some_rows_sub_options();
}
});
});
/**
* Disables the "Dump some row(s)" sub-options
*/
function disable_dump_some_rows_sub_options()
{
$("label[for='limit_to']").fadeTo('fast', 0.4);
$("label[for='limit_from']").fadeTo('fast', 0.4);
$("input[type='text'][name='limit_to']").prop('disabled', 'disabled');
$("input[type='text'][name='limit_from']").prop('disabled', 'disabled');
}
/**
* Enables the "Dump some row(s)" sub-options
*/
function enable_dump_some_rows_sub_options()
{
$("label[for='limit_to']").fadeTo('fast', 1);
$("label[for='limit_from']").fadeTo('fast', 1);
$("input[type='text'][name='limit_to']").prop('disabled', '');
$("input[type='text'][name='limit_from']").prop('disabled', '');
}

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ var gisEditorLoaded = false;
/**
* Closes the GIS data editor and perform necessary clean up work.
*/
function closeGISEditor(){
function closeGISEditor() {
$("#popup_background").fadeOut("fast");
$("#gis_editor").fadeOut("fast", function () {
$(this).empty();
@ -24,20 +24,20 @@ function closeGISEditor(){
function prepareJSVersion() {
// Change the text on the submit button
$("#gis_editor input[name='gis_data[save]']")
.val(PMA_messages['strCopy'])
.val(PMA_messages.strCopy)
.insertAfter($('#gis_data_textarea'))
.before('<br/><br/>');
// Add close and cancel links
$('#gis_data_editor').prepend('<a class="close_gis_editor" href="#">' + PMA_messages['strClose'] + '</a>');
$('<a class="cancel_gis_editor" href="#"> ' + PMA_messages['strCancel'] + '</a>')
$('#gis_data_editor').prepend('<a class="close_gis_editor" href="#">' + PMA_messages.strClose + '</a>');
$('<a class="cancel_gis_editor" href="#"> ' + PMA_messages.strCancel + '</a>')
.insertAfter($("input[name='gis_data[save]']"));
// Remove the unnecessary text
$('div#gis_data_output p').remove();
// Remove 'add' buttons and add links
$('#gis_editor input.add').each(function(e) {
$('#gis_editor input.add').each(function (e) {
var $button = $(this);
$button.addClass('addJs').removeClass('add');
var classes = $button.attr('class');
@ -56,10 +56,10 @@ function prepareJSVersion() {
* @returns the HTML for a data point
*/
function addDataPoint(pointNumber, prefix) {
return '<br/>' + $.sprintf(PMA_messages['strPointN'], (pointNumber + 1)) + ': '
+ '<label for="x">' + PMA_messages['strX'] + '</label>'
return '<br/>' + $.sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': '
+ '<label for="x">' + PMA_messages.strX + '</label>'
+ '<input type="text" name="' + prefix + '[' + pointNumber + '][x]" value=""/>'
+ '<label for="y">' + PMA_messages['strY'] + '</label>'
+ '<label for="y">' + PMA_messages.strY + '</label>'
+ '<input type="text" name="' + prefix + '[' + pointNumber + '][y]" value=""/>';
}
@ -109,12 +109,12 @@ function loadJSAndGISEditor(value, field, type, input_name, token) {
script = document.createElement('script');
script.type = 'text/javascript';
script.onreadystatechange = function() {
script.onreadystatechange = function () {
if (this.readyState == 'complete') {
loadGISEditor(value, field, type, input_name, token);
}
};
script.onload = function() {
script.onload = function () {
loadGISEditor(value, field, type, input_name, token);
};
@ -144,8 +144,8 @@ function loadGISEditor(value, field, type, input_name, token) {
'get_gis_editor' : true,
'token' : token,
'ajax_request': true
}, function(data) {
if (data.success == true) {
}, function (data) {
if (data.success === true) {
$gis_editor.html(data.gis_editor);
initGISEditorVisualization();
prepareJSVersion();
@ -172,7 +172,7 @@ function openGISEditor() {
var $backgrouond = $("#popup_background");
$gis_editor.css({"top": popupOffsetTop, "left": popupOffsetLeft, "width": popupWidth, "height": popupHeight});
$backgrouond.css({"opacity":"0.7"});
$backgrouond.css({"opacity" : "0.7"});
$gis_editor.append('<div id="gis_data_editor"><img class="ajaxIcon" id="loadingMonitorIcon" src="'
+ pmaThemeImage + 'ajax_clock_small.gif" alt=""/></div>'
@ -191,8 +191,8 @@ function insertDataAndClose() {
var $form = $('form#gis_data_editor_form');
var input_name = $form.find("input[name='input_name']").val();
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function(data) {
if (data.success == true) {
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function (data) {
if (data.success === true) {
$("input[name='" + input_name + "']").val(data.result);
} else {
PMA_ajaxShowMessage(data.error, false);
@ -204,7 +204,7 @@ function insertDataAndClose() {
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('gis_data_editor.js', function() {
AJAX.registerTeardown('gis_data_editor.js', function () {
$("#gis_editor input[name='gis_data[save]']").die('click');
$('#gis_editor').die('submit');
$('#gis_editor').find("input[type='text']").die('change');
@ -216,7 +216,7 @@ AJAX.registerTeardown('gis_data_editor.js', function() {
$('#gis_editor a.addJs.addGeom').die('click');
});
AJAX.registerOnload('gis_data_editor.js', function() {
AJAX.registerOnload('gis_data_editor.js', function () {
// Remove the class that is added due to the URL being too long.
$('span.open_gis_editor a').removeClass('formLinkSubmit');
@ -224,7 +224,7 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Prepares and insert the GIS data to the input field on clicking 'copy'.
*/
$("#gis_editor input[name='gis_data[save]']").live('click', function(event) {
$("#gis_editor input[name='gis_data[save]']").live('click', function (event) {
event.preventDefault();
insertDataAndClose();
});
@ -232,7 +232,7 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Prepares and insert the GIS data to the input field on pressing 'enter'.
*/
$('#gis_editor').live('submit', function(event) {
$('#gis_editor').live('submit', function (event) {
event.preventDefault();
insertDataAndClose();
});
@ -240,10 +240,10 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Trigger asynchronous calls on data change and update the output.
*/
$('#gis_editor').find("input[type='text']").live('change', function() {
$('#gis_editor').find("input[type='text']").live('change', function () {
var $form = $('form#gis_data_editor_form');
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function(data) {
if (data.success == true) {
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function (data) {
if (data.success === true) {
$('#gis_data_textarea').val(data.result);
$('#placeholder').empty().removeClass('hasSVG').html(data.visualization);
$('#openlayersmap').empty();
@ -258,12 +258,12 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Update the form on change of the GIS type.
*/
$("#gis_editor select.gis_type").live('change', function(event) {
$("#gis_editor select.gis_type").live('change', function (event) {
var $gis_editor = $("#gis_editor");
var $form = $('form#gis_data_editor_form');
$.post('gis_data_editor.php', $form.serialize() + "&get_gis_editor=true&ajax_request=true", function(data) {
if (data.success == true) {
$.post('gis_data_editor.php', $form.serialize() + "&get_gis_editor=true&ajax_request=true", function (data) {
if (data.success === true) {
$gis_editor.html(data.gis_editor);
initGISEditorVisualization();
prepareJSVersion();
@ -276,21 +276,21 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Handles closing of the GIS data editor.
*/
$('#gis_editor a.close_gis_editor, #gis_editor a.cancel_gis_editor').live('click', function() {
$('#gis_editor a.close_gis_editor, #gis_editor a.cancel_gis_editor').live('click', function () {
closeGISEditor();
});
/**
* Handles adding data points
*/
$('#gis_editor a.addJs.addPoint').live('click', function() {
$('#gis_editor a.addJs.addPoint').live('click', function () {
var $a = $(this);
var name = $a.attr('name');
// Eg. name = gis_data[0][MULTIPOINT][add_point] => prefix = gis_data[0][MULTIPOINT]
var prefix = name.substr(0, name.length - 11);
// Find the number of points
var $noOfPointsInput = $("input[name='" + prefix + "[no_of_points]" + "']");
var noOfPoints = parseInt($noOfPointsInput.val());
var noOfPoints = parseInt($noOfPointsInput.val(), 10);
// Add the new data point
var html = addDataPoint(noOfPoints, prefix);
$a.before(html);
@ -300,7 +300,7 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Handles adding linestrings and inner rings
*/
$('#gis_editor a.addLine.addJs').live('click', function() {
$('#gis_editor a.addLine.addJs').live('click', function () {
var $a = $(this);
var name = $a.attr('name');
@ -310,23 +310,24 @@ AJAX.registerOnload('gis_data_editor.js', function() {
// Find the number of lines
var $noOfLinesInput = $("input[name='" + prefix + "[no_of_lines]" + "']");
var noOfLines = parseInt($noOfLinesInput.val());
var noOfLines = parseInt($noOfLinesInput.val(), 10);
// Add the new linesting of inner ring based on the type
var html = '<br/>';
var noOfPoints;
if (type == 'MULTILINESTRING') {
html += PMA_messages['strLineString'] + ' ' + (noOfLines + 1) + ':';
var noOfPoints = 2;
html += PMA_messages.strLineString + ' ' + (noOfLines + 1) + ':';
noOfPoints = 2;
} else {
html += PMA_messages['strInnerRing'] + ' ' + noOfLines + ':';
var noOfPoints = 4;
html += PMA_messages.strInnerRing + ' ' + noOfLines + ':';
noOfPoints = 4;
}
html += '<input type="hidden" name="' + prefix + '[' + noOfLines + '][no_of_points]" value="' + noOfPoints + '"/>';
for (var i = 0; i < noOfPoints; i++) {
html += addDataPoint(i, (prefix + '[' + noOfLines + ']'));
}
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfLines + '][add_point]" href="#">+ '
+ PMA_messages['strAddPoint'] + '</a><br/>';
+ PMA_messages.strAddPoint + '</a><br/>';
$a.before(html);
$noOfLinesInput.val(noOfLines + 1);
@ -335,27 +336,27 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Handles adding polygons
*/
$('#gis_editor a.addJs.addPolygon').live('click', function() {
$('#gis_editor a.addJs.addPolygon').live('click', function () {
var $a = $(this);
var name = $a.attr('name');
// Eg. name = gis_data[0][MULTIPOLYGON][add_polygon] => prefix = gis_data[0][MULTIPOLYGON]
var prefix = name.substr(0, name.length - 13);
// Find the number of polygons
var $noOfPolygonsInput = $("input[name='" + prefix + "[no_of_polygons]" + "']");
var noOfPolygons = parseInt($noOfPolygonsInput.val());
var noOfPolygons = parseInt($noOfPolygonsInput.val(), 10);
// Add the new polygon
var html = PMA_messages['strPolygon'] + ' ' + (noOfPolygons + 1) + ':<br/>';
html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1"/>';
+ '<br/>' + PMA_messages['strOuterRing'] + ':';
var html = PMA_messages.strPolygon + ' ' + (noOfPolygons + 1) + ':<br/>';
html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1"/>'
+ '<br/>' + PMA_messages.strOuterRing + ':'
+ '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][0][no_of_points]" value="4"/>';
for (var i = 0; i < 4; i++) {
html += addDataPoint(i, (prefix + '[' + noOfPolygons + '][0]'));
}
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfPolygons + '][0][add_point]" href="#">+ '
+ PMA_messages['strAddPoint'] + '</a><br/>'
+ PMA_messages.strAddPoint + '</a><br/>'
+ '<a class="addLine addJs" name="' + prefix + '[' + noOfPolygons + '][add_line]" href="#">+ '
+ PMA_messages['strAddInnerRing'] + '</a><br/><br/>';
+ PMA_messages.strAddInnerRing + '</a><br/><br/>';
$a.before(html);
$noOfPolygonsInput.val(noOfPolygons + 1);
@ -364,24 +365,26 @@ AJAX.registerOnload('gis_data_editor.js', function() {
/**
* Handles adding geoms
*/
$('#gis_editor a.addJs.addGeom').live('click', function() {
$('#gis_editor a.addJs.addGeom').live('click', function () {
var $a = $(this);
var prefix = 'gis_data[GEOMETRYCOLLECTION]';
// Find the number of geoms
var $noOfGeomsInput = $("input[name='" + prefix + "[geom_count]" + "']");
var noOfGeoms = parseInt($noOfGeomsInput.val());
var noOfGeoms = parseInt($noOfGeomsInput.val(), 10);
var html1 = PMA_messages['strGeometry'] + ' ' + (noOfGeoms + 1) + ':<br/>';
var html1 = PMA_messages.strGeometry + ' ' + (noOfGeoms + 1) + ':<br/>';
var $geomType = $("select[name='gis_data[" + (noOfGeoms - 1) + "][gis_type]']").clone();
$geomType.attr('name', 'gis_data[' + noOfGeoms + '][gis_type]').val('POINT');
var html2 = '<br/>' + PMA_messages['strPoint'] + ' :'
+ '<label for="x"> ' + PMA_messages['strX'] + ' </label>'
var html2 = '<br/>' + PMA_messages.strPoint + ' :'
+ '<label for="x"> ' + PMA_messages.strX + ' </label>'
+ '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][x]" value=""/>'
+ '<label for="y"> ' + PMA_messages['strY'] + ' </label>'
+ '<label for="y"> ' + PMA_messages.strY + ' </label>'
+ '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][y]" value=""/>'
+ '<br/><br/>';
$a.before(html1); $geomType.insertBefore($a); $a.before(html2);
$a.before(html1);
$geomType.insertBefore($a);
$a.before(html2);
$noOfGeomsInput.val(noOfGeoms + 1);
});
});

View File

@ -11,13 +11,13 @@
*/
function changePluginOpts()
{
$("#format_specific_opts div.format_specific_options").each(function() {
$("#format_specific_opts div.format_specific_options").each(function () {
$(this).hide();
});
var selected_plugin_name = $("#plugins option:selected").val();
$("#" + selected_plugin_name + "_options").fadeIn('slow');
if (selected_plugin_name == "csv") {
$("#import_notification").text(PMA_messages['strImportCSV']);
$("#import_notification").text(PMA_messages.strImportCSV);
} else {
$("#import_notification").text("");
}
@ -31,7 +31,7 @@ function matchFile(fname)
{
var fname_array = fname.toLowerCase().split(".");
var len = fname_array.length;
if (len != 0) {
if (len !== 0) {
var extension = fname_array[len - 1];
if (extension == "gz" || extension == "bz2" || extension == "zip") {
len--;
@ -47,7 +47,7 @@ function matchFile(fname)
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('import.js', function() {
AJAX.registerTeardown('import.js', function () {
$("#plugins").unbind('change');
$("#input_import_file").unbind('change');
$("#select_local_import_file").unbind('change');
@ -55,20 +55,20 @@ AJAX.registerTeardown('import.js', function() {
$("#select_local_import_file").unbind('focus');
});
AJAX.registerOnload('import.js', function() {
AJAX.registerOnload('import.js', function () {
// Initially display the options for the selected plugin
changePluginOpts();
// Whenever the selected plugin changes, change the options displayed
$("#plugins").change(function() {
$("#plugins").change(function () {
changePluginOpts();
});
$("#input_import_file").change(function() {
$("#input_import_file").change(function () {
matchFile($(this).val());
});
$("#select_local_import_file").change(function() {
$("#select_local_import_file").change(function () {
matchFile($(this).val());
});
@ -76,13 +76,13 @@ AJAX.registerOnload('import.js', function() {
* When the "Browse the server" form is clicked or the "Select from the web server upload directory"
* form is clicked, the radio button beside it becomes selected and the other form becomes disabled.
*/
$("#input_import_file").bind("focus change", function() {
$("#radio_import_file").prop('checked', true);
$("#radio_local_import_file").prop('checked', false);
$("#input_import_file").bind("focus change", function () {
$("#radio_import_file").prop('checked', true);
$("#radio_local_import_file").prop('checked', false);
});
$("#select_local_import_file").focus(function() {
$("#radio_local_import_file").prop('checked', true);
$("#radio_import_file").prop('checked', false);
$("#select_local_import_file").focus(function () {
$("#radio_local_import_file").prop('checked', true);
$("#radio_import_file").prop('checked', false);
});
/**

View File

@ -38,7 +38,7 @@ function checkIndexType()
if ($select_index_type.val() == 'SPATIAL') {
// Disable and hide the size column
$size_header.hide();
$size_inputs.each(function(){
$size_inputs.each(function () {
$(this)
.prop('disabled', true)
.parent('td').hide();
@ -46,7 +46,7 @@ function checkIndexType()
// Disable and hide the columns of the index other than the first one
var initial = true;
$column_inputs.each(function() {
$column_inputs.each(function () {
$column_input = $(this);
if (! initial) {
$column_input
@ -62,14 +62,14 @@ function checkIndexType()
} else {
// Enable and show the size column
$size_header.show();
$size_inputs.each(function() {
$size_inputs.each(function () {
$(this)
.prop('disabled', false)
.parent('td').show();
});
// Enable and show the columns of the index
$column_inputs.each(function() {
$column_inputs.each(function () {
$(this)
.prop('disabled', false)
.parent('td').show();
@ -83,7 +83,7 @@ function checkIndexType()
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('indexes.js', function() {
AJAX.registerTeardown('indexes.js', function () {
$('#select_index_type').die('change');
$('a.drop_primary_key_index_anchor.ajax').die('click');
$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").die('click');
@ -99,10 +99,10 @@ AJAX.registerTeardown('indexes.js', function() {
* <li>create/edit/drop indexes</li>
* </ul>
*/
AJAX.registerOnload('indexes.js', function() {
AJAX.registerOnload('indexes.js', function () {
checkIndexType();
checkIndexName("index_frm");
$('#select_index_type').live('change', function(event){
$('#select_index_type').live('change', function (event) {
event.preventDefault();
checkIndexType();
checkIndexName("index_frm");
@ -111,7 +111,7 @@ AJAX.registerOnload('indexes.js', function() {
/**
* Ajax Event handler for 'Drop Index'
*/
$('a.drop_primary_key_index_anchor.ajax').live('click', function(event) {
$('a.drop_primary_key_index_anchor.ajax').live('click', function (event) {
event.preventDefault();
var $anchor = $(this);
/**
@ -132,15 +132,15 @@ AJAX.registerOnload('indexes.js', function() {
.val()
);
$anchor.PMA_confirm(question, $anchor.attr('href'), function(url) {
var $msg = PMA_ajaxShowMessage(PMA_messages['strDroppingPrimaryKeyIndex'], false);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if (data.success == true) {
$anchor.PMA_confirm(question, $anchor.attr('href'), function (url) {
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingPrimaryKeyIndex, false);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msg);
var $table_ref = $rows_to_hide.closest('table');
if ($rows_to_hide.length == $table_ref.find('tbody > tr').length) {
// We are about to remove all rows from the table
$table_ref.hide('medium', function() {
$table_ref.hide('medium', function () {
$('div.no_indexes_defined').show('medium');
$rows_to_hide.remove();
});
@ -151,8 +151,8 @@ AJAX.registerOnload('indexes.js', function() {
$rows_to_hide.hide("medium", function () {
$(this).remove();
});
}
if ($('#result_query').length) {
}
if ($('#result_query').length) {
$('#result_query').remove();
}
if (data.sql_query) {
@ -160,12 +160,12 @@ AJAX.registerOnload('indexes.js', function() {
.html(data.sql_query)
.prependTo('#page_content');
}
PMA_commonActions.refreshMain(false, function() {
PMA_commonActions.refreshMain(false, function () {
$("a.ajax[href^=#indexes]").click();
});
PMA_reloadNavigation();
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); // end $.PMA_confirm()
@ -174,9 +174,10 @@ AJAX.registerOnload('indexes.js', function() {
/**
*Ajax event handler for index edit
**/
$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").live('click', function(event) {
$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").live('click', function (event) {
event.preventDefault();
if ($(this).find("a").length == 0) {
var url, title;
if ($(this).find("a").length === 0) {
// Add index
var valid = checkFormElementInRange(
$(this).closest('form')[0],
@ -186,20 +187,20 @@ AJAX.registerOnload('indexes.js', function() {
if (! valid) {
return;
}
var url = $(this).closest('form').serialize();
var title = PMA_messages['strAddIndex'];
url = $(this).closest('form').serialize();
title = PMA_messages.strAddIndex;
} else {
// Edit index
var url = $(this).find("a").attr("href");
url = $(this).find("a").attr("href");
if (url.substring(0, 16) == "tbl_indexes.php?") {
url = url.substring(16, url.length);
}
var title = PMA_messages['strEditIndex'];
title = PMA_messages.strEditIndex;
}
url += "&ajax_request=true";
indexEditorDialog(url, title, function() {
indexEditorDialog(url, title, function () {
// refresh the page using ajax
PMA_commonActions.refreshMain(false, function() {
PMA_commonActions.refreshMain(false, function () {
$("a.ajax[href^=#indexes]").click();
});
});

View File

@ -5,24 +5,24 @@
* @param object event data
*/
AJAX.registerTeardown('keyhandler.js', function() {
AJAX.registerTeardown('keyhandler.js', function () {
$('#table_columns').die('keydown');
$('table.insertRowTable').die('keydown');
});
AJAX.registerOnload('keyhandler.js', function() {
$('#table_columns').live('keydown', function(event) {
AJAX.registerOnload('keyhandler.js', function () {
$('#table_columns').live('keydown', function (event) {
onKeyDownArrowsHandler(event.originalEvent);
});
$('table.insertRowTable').live('keydown', function(event) {
$('table.insertRowTable').live('keydown', function (event) {
onKeyDownArrowsHandler(event.originalEvent);
});
});
function onKeyDownArrowsHandler(e)
{
e = e||window.event;
var o = (e.srcElement||e.target);
e = e || window.event;
var o = (e.srcElement || e.target);
if (!o) {
return;
}
@ -51,25 +51,25 @@ function onKeyDownArrowsHandler(e)
var nO = null;
switch(e.keyCode) {
case 38:
// up
y--;
break;
case 40:
// down
y++;
break;
case 37:
// left
x--;
break;
case 39:
// right
x++;
break;
default:
return;
switch (e.keyCode) {
case 38:
// up
y--;
break;
case 40:
// down
y++;
break;
case 37:
// left
x--;
break;
case 39:
// right
x++;
break;
default:
return;
}
var id = "field_" + y + "_" + x;

View File

@ -77,7 +77,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param e event
* @param obj dragged div object
*/
dragStartRsz: function(e, obj) {
dragStartRsz: function (e, obj) {
var n = $(g.cRsz).find('div').index(obj); // get the index of separator (i.e., column index)
$(obj).addClass('colborder_active');
g.colRsz = {
@ -99,7 +99,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param e event
* @param obj table header object
*/
dragStartReorder: function(e, obj) {
dragStartReorder: function (e, obj) {
// prepare the cCpy (column copy) and cPointer (column pointer) from the dragged column
$(g.cCpy).text($(obj).text());
var objPos = $(obj).position();
@ -137,7 +137,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*
* @param e event
*/
dragMove: function(e) {
dragMove: function (e) {
if (g.colRsz) {
var dx = e.pageX - g.colRsz.x0;
if (g.colRsz.objWidth + dx > g.minColWidth) {
@ -179,7 +179,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*
* @param e event
*/
dragEnd: function(e) {
dragEnd: function (e) {
if (g.colRsz) {
var dx = e.pageX - g.colRsz.x0;
var nw = g.colRsz.objWidth + dx;
@ -230,8 +230,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param n zero-based column index
* @param nw new width of the column in pixel
*/
resize: function(n, nw) {
$(g.t).find('tr').each(function() {
resize: function (n, nw) {
$(g.t).find('tr').each(function () {
$(this).find('th.draggable:visible:eq(' + n + ') span,' +
'td:visible:eq(' + (g.actionSpan + n) + ') span')
.css('width', nw);
@ -241,7 +241,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Reposition column resize bars.
*/
reposRsz: function() {
reposRsz: function () {
$(g.cRsz).find('div').hide();
var $firstRowCols = $(g.t).find('tr:first th.draggable:visible');
var $resizeHandles = $(g.cRsz).find('div').removeClass('condition');
@ -253,7 +253,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($col.hasClass('condition')) {
$($resizeHandles[n]).addClass('condition');
if (n > 0) {
$($resizeHandles[n-1]).addClass('condition');
$($resizeHandles[n - 1]).addClass('condition');
}
}
}
@ -269,8 +269,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param oldn old zero-based column index
* @param newn new zero-based column index
*/
shiftCol: function(oldn, newn) {
$(g.t).find('tr').each(function() {
shiftCol: function (oldn, newn) {
$(g.t).find('tr').each(function () {
if (newn < oldn) {
$(this).find('th.draggable:eq(' + newn + '),' +
'td:eq(' + (g.actionSpan + newn) + ')')
@ -312,10 +312,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param e event
* @return the hovered column's th object or undefined if no hovered column found.
*/
getHoveredCol: function(e) {
getHoveredCol: function (e) {
var hoveredCol;
$headers = $(g.t).find('th.draggable:visible');
$headers.each(function() {
$headers.each(function () {
var left = $(this).offset().left;
var right = left + $(this).outerWidth();
if (left <= e.pageX && e.pageX <= right) {
@ -331,14 +331,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param obj table header <th> object
* @return zero-based index of the specified table header in the set of table headers (visible or not)
*/
getHeaderIdx: function(obj) {
getHeaderIdx: function (obj) {
return $(obj).parents('tr').find('th.draggable').index(obj);
},
/**
* Reposition the columns back to normal order.
*/
restoreColOrder: function() {
restoreColOrder: function () {
// use insertion sort, since we already have shiftCol function
for (var i = 1; i < g.colOrder.length; i++) {
var x = g.colOrder[i];
@ -360,8 +360,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Send column preferences (column order and visibility) to the server.
*/
sendColPrefs: function() {
if ($(g.t).is('.ajax')) { // only send preferences if ajax class
sendColPrefs: function () {
if ($(g.t).is('.ajax')) { // only send preferences if ajax class
var post_params = {
ajax_request: true,
db: g.db,
@ -377,8 +377,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (g.colVisib.length > 0) {
$.extend(post_params, {col_visib: g.colVisib.toString()});
}
$.post('sql.php', post_params, function(data) {
if (data.success != true) {
$.post('sql.php', post_params, function (data) {
if (data.success !== true) {
var $temp_div = $(document.createElement('div'));
$temp_div.html(data.error);
$temp_div.addClass("error");
@ -392,7 +392,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* Refresh restore button state.
* Make restore button disabled if the table is similar with initial state.
*/
refreshRestoreButton: function() {
refreshRestoreButton: function () {
// check if table state is as initial state
var isInitial = true;
for (var i = 0; i < g.colOrder.length; i++) {
@ -415,7 +415,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* Update current hint using the boolean values (showReorderHint, showSortHint, etc.).
*
*/
updateHint: function() {
updateHint: function () {
var text = '';
if (!g.colRsz && !g.colReorder) { // if not resizing or dragging
if (g.visibleHeadersCount > 1) {
@ -450,11 +450,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*
* @return boolean True if the column is toggled successfully.
*/
toggleCol: function(n) {
toggleCol: function (n) {
if (g.colVisib[n]) {
// can hide if more than one column is visible
if (g.visibleHeadersCount > 1) {
$(g.t).find('tr').each(function() {
$(g.t).find('tr').each(function () {
$(this).find('th.draggable:eq(' + n + '),' +
'td:eq(' + (g.actionSpan + n) + ')')
.hide();
@ -467,7 +467,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
return false;
}
} else { // column n is not visible
$(g.t).find('tr').each(function() {
$(g.t).find('tr').each(function () {
$(this).find('th.draggable:eq(' + n + '),' +
'td:eq(' + (g.actionSpan + n) + ')')
.show();
@ -484,7 +484,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* This function is separated from toggleCol because, sometimes, we want to toggle
* some columns together at one time and do just one adjustment after it, e.g. in showAllColumns().
*/
afterToggleCol: function() {
afterToggleCol: function () {
// some adjustments after hiding column
g.reposRsz();
g.reposDrop();
@ -500,7 +500,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*
* @param obj The drop down arrow of column visibility list
*/
showColList: function(obj) {
showColList: function (obj) {
// only show when not resizing or reordering
if (!g.colRsz && !g.colReorder) {
var pos = $(obj).position();
@ -520,7 +520,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Hide columns' visibility list.
*/
hideColList: function() {
hideColList: function () {
$(g.cList).hide();
$(g.cDrop).find('.coldrop-hover').removeClass('coldrop-hover');
},
@ -528,7 +528,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Reposition the column visibility drop-down arrow.
*/
reposDrop: function() {
reposDrop: function () {
var $th = $(t).find('th:not(.draggable)');
for (var i = 0; i < $th.length; i++) {
var $cd = $(g.cDrop).find('div:eq(' + i + ')'); // column drop-down arrow
@ -543,7 +543,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Show all hidden columns.
*/
showAllColumns: function() {
showAllColumns: function () {
for (var i = 0; i < g.colVisib.length; i++) {
if (!g.colVisib[i]) {
g.toggleCol(i);
@ -557,7 +557,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*
* @param cell <td> element to be edited
*/
showEditCell: function(cell) {
showEditCell: function (cell) {
if ($(cell).is('.grid_edit') &&
!g.colRsz && !g.colReorder)
{
@ -596,7 +596,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @param field Optional, the edited <td>. If not specified, the function will
* use currently edited <td> from g.currentEditCell.
*/
hideEditCell: function(force, data, field) {
hideEditCell: function (force, data, field) {
if (g.isCellEditActive && !force) {
// cell is being edited, save or post the edited data
g.saveOrPostEditedCell();
@ -604,7 +604,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
// cancel any previous request
if (g.lastXHR != null) {
if (g.lastXHR !== null) {
g.lastXHR.abort();
g.lastXHR = null;
}
@ -613,7 +613,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (g.currentEditCell) { // save value of currently edited cell
// replace current edited field with the new value
var $this_field = $(g.currentEditCell);
var is_null = $this_field.data('value') == null;
var is_null = $this_field.data('value') === null;
if (is_null) {
$this_field.find('span').html('NULL');
$this_field.addClass('null');
@ -630,14 +630,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$this_field.find('span').text(new_html);
}
}
if (data.transformations != undefined) {
$.each(data.transformations, function(cell_index, value) {
if (data.transformations !== undefined) {
$.each(data.transformations, function (cell_index, value) {
var $this_field = $(g.t).find('.to_be_saved:eq(' + cell_index + ')');
$this_field.find('span').html(value);
});
}
if (data.relations != undefined) {
$.each(data.relations, function(cell_index, value) {
if (data.relations !== undefined) {
$.each(data.relations, function (cell_index, value) {
var $this_field = $(g.t).find('.to_be_saved:eq(' + cell_index + ')');
$this_field.find('span').html(value);
});
@ -666,7 +666,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Show drop-down edit area when edit cell is focused.
*/
showEditArea: function() {
showEditArea: function () {
if (!g.isCellEditActive) { // make sure the edit area has not been shown
g.isCellEditActive = true;
g.isEditCellTextEditable = false;
@ -738,37 +738,37 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// if the select/editor is changed un-check the 'checkbox_null_<field_name>_<row_index>'.
if ($td.is('.enum, .set')) {
$editArea.find('select').live('change', function(e) {
$editArea.find('select').live('change', function (e) {
$checkbox.prop('checked', false);
});
} else if ($td.is('.relation')) {
$editArea.find('select').live('change', function(e) {
$editArea.find('select').live('change', function (e) {
$checkbox.prop('checked', false);
});
$editArea.find('.browse_foreign').live('click', function(e) {
$editArea.find('.browse_foreign').live('click', function (e) {
$checkbox.prop('checked', false);
});
} else {
$(g.cEdit).find('.edit_box').live('keypress change', function(e) {
$(g.cEdit).find('.edit_box').live('keypress change', function (e) {
$checkbox.prop('checked', false);
});
// Capture ctrl+v (on IE and Chrome)
$(g.cEdit).find('.edit_box').live('keydown', function(e) {
$(g.cEdit).find('.edit_box').live('keydown', function (e) {
if (e.ctrlKey && e.which == 86) {
$checkbox.prop('checked', false);
}
});
$editArea.find('textarea').live('keydown', function(e) {
$editArea.find('textarea').live('keydown', function (e) {
$checkbox.prop('checked', false);
});
}
// if null checkbox is clicked empty the corresponding select/editor.
$checkbox.click(function(e) {
$checkbox.click(function (e) {
if ($td.is('.enum')) {
$editArea.find('select').val('');
} else if ($td.is('.set')) {
$editArea.find('select').find('option').each(function() {
$editArea.find('select').find('option').each(function () {
var $option = $(this);
$option.prop('selected', false);
});
@ -806,7 +806,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
'relation_key_or_display_column' : relation_key_or_display_column
};
g.lastXHR = $.post('sql.php', post_params, function(data) {
g.lastXHR = $.post('sql.php', post_params, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
if ($(data.dropdown).is('select')) {
@ -824,13 +824,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// hide the value next to 'Browse foreign values' link
$editArea.find('span.curr_value').hide();
// handle update for new values selected from new window
$editArea.find('span.curr_value').change(function() {
$editArea.find('span.curr_value').change(function () {
$(g.cEdit).find('.edit_box').val($(this).text());
});
}); // end $.post()
$editArea.show();
$editArea.find('select').live('change', function(e) {
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
g.isEditCellTextEditable = true;
@ -843,16 +843,16 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @var post_params Object containing parameters for the POST request
*/
var post_params = {
'ajax_request' : true,
'get_enum_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
'ajax_request' : true,
'get_enum_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
};
g.lastXHR = $.post('sql.php', post_params, function(data) {
g.lastXHR = $.post('sql.php', post_params, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
$editArea.append(data.dropdown);
@ -860,7 +860,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}); // end $.post()
$editArea.show();
$editArea.find('select').live('change', function(e) {
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
}
@ -872,17 +872,17 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @var post_params Object containing parameters for the POST request
*/
var post_params = {
'ajax_request' : true,
'get_set_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
'ajax_request' : true,
'get_set_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
};
g.lastXHR = $.post('sql.php', post_params, function(data) {
g.lastXHR = $.post('sql.php', post_params, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
$editArea.append(data.select);
@ -890,7 +890,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}); // end $.post()
$editArea.show();
$editArea.find('select').live('change', function(e) {
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
}
@ -901,10 +901,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.append('<textarea></textarea>');
$editArea.find('textarea')
.val(value)
.live('keyup', function(e) {
.live('keyup', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
$(g.cEdit).find('.edit_box').live('keyup', function(e) {
$(g.cEdit).find('.edit_box').live('keyup', function (e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
@ -928,10 +928,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
'ajax_request' : true,
'sql_query' : sql_query,
'grid_edit' : true
}, function(data) {
}, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
if (data.success == true) {
if (data.success === true) {
if ($td.is('.truncated')) {
// get the truncated data length
g.maxTruncatedLen = $(g.currentEditCell).text().length - 3;
@ -942,10 +942,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.append('<textarea></textarea>');
$editArea.find('textarea')
.val(data.value)
.live('keyup', function(e) {
.live('keyup', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
$(g.cEdit).find('.edit_box').live('keyup', function(e) {
$(g.cEdit).find('.edit_box').live('keyup', function (e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
@ -970,26 +970,26 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
PMA_addDatepicker($editArea, {
altField: $input_field,
showTimepicker: showTimeOption,
onSelect: function(dateText, inst) {
onSelect: function (dateText, inst) {
// remove null checkbox if it exists
$(g.cEdit).find('.null_div input[type=checkbox]').prop('checked', false);
}
});
// cancel any click on the datepicker element
$editArea.find('> *').click(function(e) {
$editArea.find('> *').click(function (e) {
e.stopPropagation();
});
// force to restore modified $input_field value after adding datepicker
// (after adding a datepicker, the input field doesn't display the time anymore, only the date)
if (is_null
|| current_datetime_value == '0000-00-00'
if (is_null
|| current_datetime_value == '0000-00-00'
|| current_datetime_value == '0000-00-00 00:00:00'
) {
$input_field.val(current_datetime_value);
} else {
$editArea.datetimepicker('setDate', current_datetime_value);
$editArea.datetimepicker('setDate', current_datetime_value);
}
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
@ -1015,7 +1015,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Post the content of edited cell.
*/
postEditedCell: function() {
postEditedCell: function () {
if (g.isSaving) {
return;
}
@ -1070,7 +1070,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
// loop each edited row
$('td.to_be_saved').parents('tr').each(function() {
$('td.to_be_saved').parents('tr').each(function () {
var $tr = $(this);
var where_clause = $tr.find('.where_clause').val();
full_where_clause.push(PMA_urldecode(where_clause));
@ -1085,7 +1085,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var fields_null = [];
// loop each edited cell in a row
$tr.find('.to_be_saved').each(function() {
$tr.find('.to_be_saved').each(function () {
/**
* @var $this_field Object referring to the td that is being edited
*/
@ -1137,7 +1137,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var field_str = '`' + g.table + '`.' + '`' + field_name + '`';
for (var field in condition_array) {
if (field.indexOf(field_str) > -1) {
condition_array[field] = is_null ? 'IS NULL' : "= '" + this_field_params[field_name].replace(/'/g,"''") + "'";
condition_array[field] = is_null ? 'IS NULL' : "= '" + this_field_params[field_name].replace(/'/g, "''") + "'";
break;
}
}
@ -1201,7 +1201,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
url: 'tbl_replace.php',
data: post_params,
success:
function(data) {
function (data) {
g.isSaving = false;
if (!g.saveCellsAtOnce) {
$(g.cEdit).find('*').removeProp('disabled');
@ -1210,11 +1210,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$('div.save_edited').removeClass('saving_edited_data')
.find('input').removeProp('disabled'); // enable the save button back
}
if (data.success == true) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
// update where_clause related data in each edited row
$('td.to_be_saved').parents('tr').each(function() {
$('td.to_be_saved').parents('tr').each(function () {
var new_clause = $(this).data('new_clause');
var $where_clause = $(this).find('.where_clause');
var old_clause = $where_clause.val();
@ -1223,20 +1223,20 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$where_clause.val(new_clause);
// update Edit, Copy, and Delete links also
$(this).find('a').each(function() {
$(this).find('a').each(function () {
$(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
// update delete confirmation in Delete link
if ($(this).attr('href').indexOf('DELETE') > -1) {
$(this).removeAttr('onclick')
.unbind('click')
.bind('click', function() {
.bind('click', function () {
return confirmLink(this, 'DELETE FROM `' + g.db + '`.`' + g.table + '` WHERE ' +
decoded_new_clause + (is_unique ? '' : ' LIMIT 1'));
});
}
});
// update the multi edit checkboxes
$(this).find('input[type=checkbox]').each(function() {
$(this).find('input[type=checkbox]').each(function () {
var $checkbox = $(this);
var checkbox_name = $checkbox.attr('name');
var checkbox_value = $checkbox.val();
@ -1273,7 +1273,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Save edited cell, so it can be posted later.
*/
saveEditedCell: function() {
saveEditedCell: function () {
/**
* @var $this_field Object referring to the td that is being edited
*/
@ -1312,7 +1312,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
this_field_params[field_name] = '0b' + $(g.cEdit).find('.edit_box').val();
} else if ($this_field.is('.set')) {
$test_element = $(g.cEdit).find('select');
this_field_params[field_name] = $test_element.map(function(){
this_field_params[field_name] = $test_element.map(function () {
return $(this).val();
}).get().join(",");
} else if ($this_field.is('.relation, .enum')) {
@ -1343,7 +1343,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Save or post currently edited cell, depending on the "saveCellsAtOnce" configuration.
*/
saveOrPostEditedCell: function() {
saveOrPostEditedCell: function () {
var saved = g.saveEditedCell();
if (!g.saveCellsAtOnce) {
if (saved) {
@ -1363,7 +1363,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Initialize column resize feature.
*/
initColResize: function() {
initColResize: function () {
// create column resizer div
g.cRsz = document.createElement('div');
g.cRsz.className = 'cRsz';
@ -1372,10 +1372,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var $firstRowCols = $(g.t).find('tr:first th.draggable');
// create column borders
$firstRowCols.each(function() {
$firstRowCols.each(function () {
var cb = document.createElement('div'); // column border
$(cb).addClass('colborder')
.mousedown(function(e) {
.mousedown(function (e) {
g.dragStartRsz(e, this);
});
$(g.cRsz).append(cb);
@ -1389,7 +1389,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Initialize column reordering feature.
*/
initColReorder: function() {
initColReorder: function () {
g.cCpy = document.createElement('div'); // column copy, to store copy of dragged column header
g.cPointer = document.createElement('div'); // column pointer, used when reordering column
@ -1402,7 +1402,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cPointer).css('visibility', 'hidden'); // set visibility to hidden instead of calling hide() to force browsers to cache the image in cPointer class
// assign column reordering hint
g.reorderHint = PMA_messages['strColOrderHint'];
g.reorderHint = PMA_messages.strColOrderHint;
// get data columns in the first row of the table
var $firstRowCols = $(g.t).find('tr:first th.draggable');
@ -1412,7 +1412,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($col_order.length > 0) {
g.colOrder = $col_order.val().split(',');
for (var i = 0; i < g.colOrder.length; i++) {
g.colOrder[i] = parseInt(g.colOrder[i]);
g.colOrder[i] = parseInt(g.colOrder[i], 10);
}
} else {
g.colOrder = [];
@ -1423,25 +1423,25 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// register events
$(t).find('th.draggable')
.mousedown(function(e) {
.mousedown(function (e) {
if (g.visibleHeadersCount > 1) {
g.dragStartReorder(e, this);
}
})
.mouseenter(function(e) {
.mouseenter(function (e) {
if (g.visibleHeadersCount > 1) {
$(this).css('cursor', 'move');
} else {
$(this).css('cursor', 'inherit');
}
})
.mouseleave(function(e) {
.mouseleave(function (e) {
g.showReorderHint = false;
$(this).tooltip("option", {
content: g.updateHint()
}) ;
});
})
.dblclick(function(e) {
.dblclick(function (e) {
e.preventDefault();
$("<div/>")
.prop("title", PMA_messages["strColNameCopyTitle"])
@ -1459,7 +1459,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.find("input").focus().select();
});
// restore column order when the restore button is clicked
$('div.restore_column').click(function() {
$('div.restore_column').click(function () {
g.restoreColOrder();
});
@ -1468,7 +1468,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.gDiv).append(g.cCpy);
// prevent default "dragstart" event when dragging a link
$(t).find('th a').bind('dragstart', function() {
$(t).find('th a').bind('dragstart', function () {
return false;
});
@ -1479,7 +1479,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Initialize column visibility feature.
*/
initColVisib: function() {
initColVisib: function () {
g.cDrop = document.createElement('div'); // column drop-down arrows
g.cList = document.createElement('div'); // column visibility list
@ -1491,7 +1491,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cList).hide();
// assign column visibility related hints
g.showAllColText = PMA_messages['strShowAllCol'];
g.showAllColText = PMA_messages.strShowAllCol;
// get data columns in the first row of the table
var $firstRowCols = $(g.t).find('tr:first th.draggable');
@ -1501,7 +1501,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($col_visib.length > 0) {
g.colVisib = $col_visib.val().split(',');
for (var i = 0; i < g.colVisib.length; i++) {
g.colVisib[i] = parseInt(g.colVisib[i]);
g.colVisib[i] = parseInt(g.colVisib[i], 10);
}
} else {
g.colVisib = [];
@ -1516,16 +1516,16 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
PMA_tooltip(
$colVisibTh,
'th',
PMA_messages['strColVisibHint']
PMA_messages.strColVisibHint
);
// create column visibility drop-down arrow(s)
$colVisibTh.each(function() {
$colVisibTh.each(function () {
var $th = $(this);
var cd = document.createElement('div'); // column drop-down arrow
var pos = $th.position();
$(cd).addClass('coldrop')
.click(function() {
.click(function () {
if (g.cList.style.display == 'none') {
g.showColList(this);
} else {
@ -1545,8 +1545,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.prepend('<input type="checkbox" ' + (g.colVisib[i] ? 'checked="checked" ' : '') + '/>');
$listDiv.append(listElmt);
// add event on click
$(listElmt).click(function() {
if ( g.toggleCol($(this).index()) ) {
$(listElmt).click(function () {
if (g.toggleCol($(this).index())) {
g.afterToggleCol();
}
});
@ -1556,21 +1556,21 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(showAll).addClass('showAllColBtn')
.text(g.showAllColText);
$(g.cList).append(showAll);
$(showAll).click(function() {
$(showAll).click(function () {
g.showAllColumns();
});
// prepend "show all column" button at top if the list is too long
if ($firstRowCols.length > 10) {
var clone = showAll.cloneNode(true);
$(g.cList).prepend(clone);
$(clone).click(function() {
$(clone).click(function () {
g.showAllColumns();
});
}
}
// hide column visibility list if we move outside the list
$(t).find('td, th.draggable').mouseenter(function() {
$(t).find('td, th.draggable').mouseenter(function () {
g.hideColList();
});
@ -1585,11 +1585,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* Initialize grid editing feature.
*/
initGridEdit: function() {
initGridEdit: function () {
function startGridEditing(e, cell) {
if (g.isCellEditActive) {
g.saveOrPostEditedCell();
g.saveOrPostEditedCell();
} else {
g.showEditCell(cell);
}
@ -1605,18 +1605,18 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cEdit).hide();
// assign cell editing hint
g.cellEditHint = PMA_messages['strCellEditHint'];
g.saveCellWarning = PMA_messages['strSaveCellWarning'];
g.alertNonUnique = PMA_messages['strAlertNonUnique'];
g.gotoLinkText = PMA_messages['strGoToLink'];
g.showDataRowLinkText = PMA_messages['strShowDataRowLink'];
g.cellEditHint = PMA_messages.strCellEditHint;
g.saveCellWarning = PMA_messages.strSaveCellWarning;
g.alertNonUnique = PMA_messages.strAlertNonUnique;
g.gotoLinkText = PMA_messages.strGoToLink;
g.showDataRowLinkText = PMA_messages.strShowDataRowLink;
// initialize cell editing configuration
g.saveCellsAtOnce = $('#save_cells_at_once').val();
// register events
$(t).find('td.data.click1')
.click(function(e) {
.click(function (e) {
startGridEditing(e, this);
// prevent default action when clicking on "link" in a table
if ($(e.target).is('.grid_edit a')) {
@ -1625,21 +1625,21 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
});
$(t).find('td.data.click2')
.click(function(e) {
.click(function (e) {
$cell = $(this);
// In the case of relational link, We want single click on the link
// In the case of relational link, We want single click on the link
// to goto the link and double click to start grid-editing.
var $link = $(e.target);
if ($link.is('.grid_edit.relation a')) {
e.preventDefault();
// get the click count and increase
var clicks = $cell.data('clicks');
clicks = (clicks == null) ? 1 : clicks + 1;
clicks = (clicks === null) ? 1 : clicks + 1;
if (clicks == 1) {
// if there are no previous clicks,
// if there are no previous clicks,
// start the single click timer
timer = setTimeout(function() {
timer = setTimeout(function () {
// temporarily remove ajax class so the page loader will not handle it,
// submit and then add it back
$link.removeClass('ajax');
@ -1659,7 +1659,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
}
})
.dblclick(function(e) {
.dblclick(function (e) {
if ($(e.target).is('.grid_edit a')) {
e.preventDefault();
} else {
@ -1667,39 +1667,39 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
});
$(g.cEdit).find('.edit_box').focus(function(e) {
$(g.cEdit).find('.edit_box').focus(function (e) {
g.showEditArea();
});
$(g.cEdit).find('.edit_box, select').live('keydown', function(e) {
$(g.cEdit).find('.edit_box, select').live('keydown', function (e) {
if (e.which == 13) {
// post on pressing "Enter"
e.preventDefault();
g.saveOrPostEditedCell();
}
});
$(g.cEdit).keydown(function(e) {
$(g.cEdit).keydown(function (e) {
if (!g.isEditCellTextEditable) {
// prevent text editing
e.preventDefault();
}
});
$('html').click(function(e) {
$('html').click(function (e) {
// hide edit cell if the click is not from g.cEdit
if ($(e.target).parents().index(g.cEdit) == -1) {
g.hideEditCell();
}
}).keydown(function(e) {
}).keydown(function (e) {
if (e.which == 27 && g.isCellEditActive) {
// cancel on pressing "Esc"
g.hideEditCell(true);
}
});
$('div.save_edited').click(function() {
$('div.save_edited').click(function () {
g.hideEditCell();
g.postEditedCell();
});
$(window).bind('beforeunload', function(e) {
$(window).bind('beforeunload', function (e) {
if (g.isCellEdited) {
return g.saveCellWarning;
}
@ -1709,11 +1709,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.gDiv).append(g.cEdit);
// add hint for grid editing feature when hovering "Edit" link in each table row
if (PMA_messages['strGridEditFeatureHint'] != undefined) {
if (PMA_messages.strGridEditFeatureHint !== undefined) {
PMA_tooltip(
$(g.t).find('.edit_row_anchor a'),
'a',
PMA_messages['strGridEditFeatureHint']
PMA_messages.strGridEditFeatureHint
);
}
}
@ -1751,9 +1751,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.tableCreateTime = $('#table_create_time').val();
// assign the hints
g.sortHint = PMA_messages['strSortHint'];
g.markHint = PMA_messages['strColMarkHint'];
g.copyHint = PMA_messages['strColNameCopyHint'];
g.sortHint = PMA_messages.strSortHint;
g.markHint = PMA_messages.strColMarkHint;
g.copyHint = PMA_messages.strColNameCopyHint;
// assign common hidden inputs
var $common_hidden_inputs = $('div.common_hidden_inputs');
@ -1773,10 +1773,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.gDiv).append(t);
// FEATURES
enableResize = enableResize == undefined ? true : enableResize;
enableReorder = enableReorder == undefined ? true : enableReorder;
enableVisib = enableVisib == undefined ? true : enableVisib;
enableGridEdit = enableGridEdit == undefined ? true : enableGridEdit;
enableResize = enableResize === undefined ? true : enableResize;
enableReorder = enableReorder === undefined ? true : enableReorder;
enableVisib = enableVisib === undefined ? true : enableVisib;
enableGridEdit = enableGridEdit === undefined ? true : enableGridEdit;
if (enableResize) {
g.initColResize();
}
@ -1803,25 +1803,25 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// register events for hint tooltip (anchors inside draggable th)
$(t).find('th.draggable a')
.mouseenter(function(e) {
.mouseenter(function (e) {
g.showSortHint = true;
$(t).find("th.draggable").tooltip("option", {
content: g.updateHint()
});
});
})
.mouseleave(function(e) {
.mouseleave(function (e) {
g.showSortHint = false;
$(t).find("th.draggable").tooltip("option", {
content: g.updateHint()
});
});
});
// register events for dragging-related feature
if (enableResize || enableReorder) {
$(document).mousemove(function(e) {
$(document).mousemove(function (e) {
g.dragMove(e);
});
$(document).mouseup(function(e) {
$(document).mouseup(function (e) {
g.dragEnd(e);
});
}

View File

@ -57,15 +57,6 @@ $js_messages['strReloadingPrivileges'] = __('Reloading Privileges');
$js_messages['strRemovingSelectedUsers'] = __('Removing Selected Users');
$js_messages['strClose'] = __('Close');
/* for server_status.js */
$js_messages['strEdit'] = __('Edit');
$js_messages['strLiveTrafficChart'] = __('Live traffic chart');
$js_messages['strLiveConnChart'] = __('Live conn./process chart');
$js_messages['strLiveQueryChart'] = __('Live query chart');
$js_messages['strStaticData'] = __('Static data');
/* l10n: Total number of queries */
$js_messages['strTotal'] = __('Total');
/* l10n: Other, small valued, queries */
$js_messages['strOther'] = __('Other');
/* l10n: Thousands separator */

View File

@ -8,7 +8,7 @@
/**
* Executed on page load
*/
$(function() {
$(function () {
if (! $('#pma_navigation').length) {
// Don't bother running any code if the navigation is not even on the page
return;
@ -21,7 +21,7 @@ $(function() {
* opens/closes (hides/shows) tree elements
* loads data via ajax
*/
$('#pma_navigation_tree a.expander').live('click', function(event) {
$('#pma_navigation_tree a.expander').live('click', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
var $this = $(this);
@ -40,7 +40,8 @@ $(function() {
var $throbber = $('#pma_navigation .throbber')
.first()
.clone()
.css('visibility', 'visible');
.css('visibility', 'visible')
.click(false);
$icon.hide();
$throbber.insertBefore($icon);
@ -114,7 +115,7 @@ $(function() {
$('#pma_navigation_tree.highlight li:not(.fast_filter)').live(
'mouseover',
function () {
if ($('li:visible', this).length == 0) {
if ($('li:visible', this).length === 0) {
$(this).addClass('activePointer');
}
}
@ -129,8 +130,8 @@ $(function() {
/**
* Jump to recent table
*/
$('#recentTable').live('change', function() {
if (this.value != '') {
$('#recentTable').live('change', function () {
if (this.value !== '') {
var arr = jQuery.parseJSON(this.value);
var $form = $(this).closest('form');
$form.find('input[name=db]').val(arr['db']);
@ -143,41 +144,41 @@ $(function() {
$('li.new_procedure a.ajax, li.new_function a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('routine');
dialog.editorDialog(1, $(this))
dialog.editorDialog(1, $(this));
});
$('li.new_trigger a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('trigger');
dialog.editorDialog(1, $(this))
dialog.editorDialog(1, $(this));
});
$('li.new_event a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('event');
dialog.editorDialog(1, $(this))
dialog.editorDialog(1, $(this));
});
/** Edit Routines, Triggers and Events */
$('li.procedure > a.ajax, li.function > a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('routine');
dialog.editorDialog(0, $(this))
dialog.editorDialog(0, $(this));
});
$('li.trigger > a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('trigger');
dialog.editorDialog(0, $(this))
dialog.editorDialog(0, $(this));
});
$('li.event > a.ajax').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object('event');
dialog.editorDialog(0, $(this))
dialog.editorDialog(0, $(this));
});
/** Export Routines, Triggers and Events */
$('li.procedure a.ajax img, li.function a.ajax img, li.trigger a.ajax img, li.event a.ajax img').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object();
dialog.exportDialog($(this).parent())
dialog.exportDialog($(this).parent());
});
/** New index */
@ -186,7 +187,7 @@ $(function() {
var url = $(this).attr('href').substr(
$(this).attr('href').indexOf('?') + 1
) + '&ajax_request=true';
var title = PMA_messages['strAddIndex'];
var title = PMA_messages.strAddIndex;
indexEditorDialog(url, title);
});
@ -196,7 +197,7 @@ $(function() {
var url = $(this).attr('href').substr(
$(this).attr('href').indexOf('?') + 1
) + '&ajax_request=true';
var title = PMA_messages['strEditIndex'];
var title = PMA_messages.strEditIndex;
indexEditorDialog(url, title);
});
@ -210,7 +211,7 @@ $(function() {
/**
* Reloads the whole navigation tree while preserving its state
*
* @param function the callback function
* @param function the callback function
* @return void
*/
function PMA_reloadNavigation(callback) {
@ -227,7 +228,7 @@ function PMA_reloadNavigation(callback) {
var count = 0;
$('#pma_navigation_tree').find('a.expander:visible').each(function () {
if ($(this).find('img').is('.ic_b_minus')
&& $(this).closest('li').find('div.list_container .ic_b_minus').length == 0
&& $(this).closest('li').find('div.list_container .ic_b_minus').length === 0
) {
params['n' + count + '_aPath'] = $(this).find('span.aPath').text();
params['n' + count + '_vPath'] = $(this).find('span.vPath').text();
@ -286,12 +287,13 @@ function PMA_navigationTreePagination($this)
{
var $msgbox = PMA_ajaxShowMessage();
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
var url, params;
if ($this[0].tagName == 'A') {
var url = $this.attr('href');
var params = 'ajax_request=true';
url = $this.attr('href');
params = 'ajax_request=true';
} else { // tagName == 'SELECT'
var url = 'navigation.php';
var params = $this.closest("form").serialize() + '&ajax_request=true';
url = 'navigation.php';
params = $this.closest("form").serialize() + '&ajax_request=true';
}
var searchClause = PMA_fastFilter.getSearchClause();
if (searchClause) {
@ -381,14 +383,14 @@ var ResizeHandler = function () {
$collapser
.css(this.left, pos + resizer_width)
.html(this.getSymbol(pos))
.prop('title', PMA_messages['strShowPanel']);
.prop('title', PMA_messages.strShowPanel);
} else {
$collapser
.css(this.left, pos)
.html(this.getSymbol(pos))
.prop('title', PMA_messages['strHidePanel']);
.prop('title', PMA_messages.strHidePanel);
}
setTimeout(function (){
setTimeout(function () {
$(window).trigger('resize');
}, 4);
};
@ -424,13 +426,13 @@ var ResizeHandler = function () {
*/
this.getSymbol = function (width) {
if (this.left == 'left') {
if (width == 0) {
if (width === 0) {
return '&rarr;';
} else {
return '&larr;';
}
} else {
if (width == 0) {
if (width === 0) {
return '&larr;';
} else {
return '&rarr;';
@ -505,12 +507,12 @@ var ResizeHandler = function () {
}
// Register the events for the resizer and the collapser
$('#pma_navigation_resizer')
.live('mousedown', {'resize_handler':this}, this.mousedown);
.live('mousedown', {'resize_handler': this}, this.mousedown);
$(document)
.bind('mouseup', {'resize_handler':this}, this.mouseup)
.bind('mousemove', {'resize_handler':this}, $.throttle(this.mousemove, 4));
.bind('mouseup', {'resize_handler': this}, this.mouseup)
.bind('mousemove', {'resize_handler': this}, $.throttle(this.mousemove, 4));
var $collapser = $('#pma_navigation_collapser');
$collapser.live('click', {'resize_handler':this}, this.collapse);
$collapser.live('click', {'resize_handler': this}, this.collapse);
// Add the correct arrow symbol to the collapser
$collapser.html(this.getSymbol($('#pma_navigation').width()));
}; // End of ResizeHandler
@ -559,8 +561,8 @@ var PMA_fastFilter = {
this.timeout = null;
var $filterInput = $this.find('li.fast_filter input.searchClause');
if ( $filterInput.length != 0
&& $filterInput.val() != ''
if ($filterInput.length !== 0
&& $filterInput.val() !== ''
&& $filterInput.val() != $filterInput[0].defaultValue
) {
this.request();
@ -590,7 +592,7 @@ var PMA_fastFilter = {
var $filterContainer = $this.closest('div.list_container');
var $filterInput = $([]);
while (1) {
if ($filterContainer.find('li.fast_filter:not(.db_fast_filter) input.searchClause').length != 0) {
if ($filterContainer.find('li.fast_filter:not(.db_fast_filter) input.searchClause').length !== 0) {
$filterInput = $filterContainer.find('li.fast_filter:not(.db_fast_filter) input.searchClause');
break;
} else if (! $filterContainer.is('div.list_container')) {
@ -601,7 +603,7 @@ var PMA_fastFilter = {
.closest('div.list_container');
}
var searchClause2 = '';
if ($filterInput.length != 0
if ($filterInput.length !== 0
&& $filterInput.first().val() != $filterInput[0].defaultValue
) {
searchClause2 = $filterInput.val();
@ -628,7 +630,7 @@ var PMA_fastFilter = {
}
},
blur: function (event) {
if ($(this).val() == '') {
if ($(this).val() === '') {
$(this).val(this.defaultValue);
}
var $obj = $(this).closest('div.list_container');
@ -639,7 +641,7 @@ var PMA_fastFilter = {
keyup: function (event) {
var $obj = $(this).closest('div.list_container');
var str = '';
if ($(this).val() != this.defaultValue && $(this).val() != '') {
if ($(this).val() != this.defaultValue && $(this).val() !== '') {
$obj.find('div.pageselector').hide();
str = $(this).val().toLowerCase();
}
@ -657,13 +659,13 @@ var PMA_fastFilter = {
container_filter($group); // recursive
}
$group.parent().show().removeClass('hidden');
if ($group.children().not('.hidden').length == 0) {
if ($group.children().not('.hidden').length === 0) {
$group.parent().hide().addClass('hidden');
}
});
};
container_filter($obj, str);
if ($(this).val() != this.defaultValue && $(this).val() != '') {
if ($(this).val() != this.defaultValue && $(this).val() !== '') {
if (! $obj.data('fastFilter')) {
$obj.data(
'fastFilter',
@ -713,7 +715,7 @@ PMA_fastFilter.filter.prototype.request = function ()
{
var self = this;
clearTimeout(self.timeout);
if (self.$this.find('li.fast_filter').find('img.throbber').length == 0) {
if (self.$this.find('li.fast_filter').find('img.throbber').length === 0) {
self.$this.find('li.fast_filter').append(
$('<div class="throbber"></div>').append(
$('#pma_navigation_content')
@ -730,7 +732,7 @@ PMA_fastFilter.filter.prototype.request = function ()
var url = $('#pma_navigation').find('a.navigation_url').attr('href');
var results = self.$this.find('li:not(.hidden):not(.fast_filter):not(.navGroup)').not('[class^=new]').length;
var params = self.$this.find('> ul > li > form.fast_filter').first().serialize() + "&results=" + results;
if (self.$this.find('> ul > li > form.fast_filter:first input[name=searchClause]').length == 0) {
if (self.$this.find('> ul > li > form.fast_filter:first input[name=searchClause]').length === 0) {
var $input = $('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause');
if ($input.length && $input.val() != $input[0].defaultValue) {
params += '&searchClause=' + encodeURIComponent($input.val());
@ -745,9 +747,9 @@ PMA_fastFilter.filter.prototype.request = function ()
var data = $.parseJSON(jqXHR.responseText);
self.$this.find('li.fast_filter').find('div.throbber').remove();
if (data && data.results) {
var $listItem = $('<li />', {'class':'moreResults'})
var $listItem = $('<li />', {'class': 'moreResults'})
.appendTo(self.$this.find('li.fast_filter'));
var $link = $('<a />', {href:'#'})
var $link = $('<a />', {href: '#'})
.text(data.results)
.appendTo($listItem)
.click(function (event) {

View File

@ -4,28 +4,15 @@
* @package PhpMyAdmin-Designer
*/
/**
*
*/
function makeRequest(url, parameters)
{
var $msg = PMA_ajaxShowMessage();
$.post(url, parameters, function (data) {
PMA_ajaxRemoveMessage($msg);
PrintXML(data);
});
return true;
}
/**
*
*/
function PrintXML(data)
{
var $root = $(data).find('root');
if ($root.length == 0) {
if ($root.length === 0) {
// error
var myWin=window.open('','Report','width=400, height=250, resizable=1, scrollbars=1, status=1');
var myWin = window.open('', 'Report', 'width=400, height=250, resizable=1, scrollbars=1, status=1');
var tmp = myWin.document;
tmp.write(data);
tmp.close();
@ -58,3 +45,16 @@ function PrintXML(data)
}
}
}
/**
*
*/
function makeRequest(url, parameters)
{
var $msg = PMA_ajaxShowMessage();
$.post(url, parameters, function (data) {
PMA_ajaxRemoveMessage($msg);
PrintXML(data);
});
return true;
}

View File

@ -22,8 +22,8 @@ function panel(index)
if (!index) {
$(".toggle_container").hide();
}
$("h2.tiger").click(function() {
$(this).toggleClass("active").next().slideToggle("slow");
$("h2.tiger").click(function () {
$(this).toggleClass("active").next().slideToggle("slow");
});
}
@ -38,17 +38,17 @@ function panel(index)
*
**/
function display(init,finit)
function display(init, finit)
{
var str,i,j,k,sto;
var str, i, j, k, sto;
// this part sorts the history array based on table name,this is needed for clubbing all object of same name together.
for (i = init; i < finit; i++) {
sto = history_array[i];
var temp = history_array[i].get_tab() ;//+ '.' + history_array[i].get_obj_no(); for Self JOINS
var temp = history_array[i].get_tab();//+ '.' + history_array[i].get_obj_no(); for Self JOINS
for (j = 0; j < i; j++) {
if (temp > (history_array[j].get_tab())) {//+ '.' + history_array[j].get_obj_no())) { //for Self JOINS
for (k = i; k > j; k--) {
history_array[k] = history_array[k-1];
history_array[k] = history_array[k - 1];
}
history_array[j] = sto;
break;
@ -56,30 +56,30 @@ function display(init,finit)
}
}
// this part generates HTML code for history tab.adds delete,edit,and/or and detail features with objects.
str =''; // string to store Html code for history tab
for (var i=0; i < history_array.length; i++) {
str = ''; // string to store Html code for history tab
for (var i = 0; i < history_array.length; i++) {
var temp = history_array[i].get_tab(); //+ '.' + history_array[i].get_obj_no(); for Self JOIN
str += '<h2 class="tiger"><a href="#">' + temp + '</a></h2>';
str += '<div class="toggle_container">\n';
while ((history_array[i].get_tab()) == temp) { //+ '.' + history_array[i].get_obj_no()) == temp) {
str +='<div class="block"> <table width ="250">';
str += '<div class="block"> <table width ="250">';
str += '<thead><tr><td>';
if (history_array[i].get_and_or()) {
str +='<img src="' + pmaThemeImage + 'pmd/or_icon.png" onclick="and_or('+i+')" title="OR"/></td>';
str += '<img src="' + pmaThemeImage + 'pmd/or_icon.png" onclick="and_or(' + i + ')" title="OR"/></td>';
} else {
str +='<img src="' + pmaThemeImage + 'pmd/and_icon.png" onclick="and_or('+i+')" title="AND"/></td>';
str += '<img src="' + pmaThemeImage + 'pmd/and_icon.png" onclick="and_or(' + i + ')" title="AND"/></td>';
}
str +='<td style="padding-left: 5px;" class="right">' + PMA_getImage('b_sbrowse.png', 'column name') + '</td><td width="175" style="padding-left: 5px">' + history_array[i].get_column_name();
str += '<td style="padding-left: 5px;" class="right">' + PMA_getImage('b_sbrowse.png', 'column name') + '</td><td width="175" style="padding-left: 5px">' + history_array[i].get_column_name();
if (history_array[i].get_type() == "GroupBy" || history_array[i].get_type() == "OrderBy") {
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '<td title="' + detail(i) +'">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')>' + PMA_getImage('b_drop.png', 'Delete') + '</td></tr></thead>';
} else {
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '</td><td title="' + detail(i) +'">' + history_array[i]. get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit('+ i +')>' + PMA_getImage('b_edit.png', PMA_messages['strEdit']) + '</td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
}
i++;
if (i >= history_array.length) {
break;
}
str += '</table></div><br/>';
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '<td title="' + detail(i) + '">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')>' + PMA_getImage('b_drop.png', 'Delete') + '</td></tr></thead>';
} else {
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '</td><td title="' + detail(i) + '">' + history_array[i].get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit(' + i + ')>' + PMA_getImage('b_edit.png', PMA_messages.strEdit) + '</td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
}
i++;
if (i >= history_array.length) {
break;
}
str += '</table></div><br/>';
}
i--;
str += '</div><br/>';
@ -103,7 +103,7 @@ function and_or(index)
history_array[index].set_and_or(1);
}
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(0,0);
existingDiv.innerHTML = display(0, 0);
panel(1);
}
@ -114,7 +114,7 @@ function and_or(index)
*
**/
function detail (index)
function detail(index)
{
var type = history_array[index].get_type();
var str;
@ -128,10 +128,10 @@ function detail (index)
str = 'Select ' + history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
}
if (type == "GroupBy") {
str = 'GroupBy ' + history_array[index].get_column_name() ;
str = 'GroupBy ' + history_array[index].get_column_name();
}
if (type == "OrderBy") {
str = 'OrderBy ' + history_array[index].get_column_name() ;
str = 'OrderBy ' + history_array[index].get_column_name();
}
if (type == "Having") {
str = 'Having ';
@ -156,13 +156,13 @@ function history_delete(index)
{
for (var k = 0; k < from_array.length; k++) {
if (from_array[k] == history_array[index].get_tab()) {
from_array.splice(k,1);
from_array.splice(k, 1);
break;
}
}
history_array.splice(index,1);
history_array.splice(index, 1);
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(0,0);
existingDiv.innerHTML = display(0, 0);
panel(1);
}
@ -222,7 +222,7 @@ function history_edit(index)
function edit(type)
{
if (type == "Rename") {
if (document.getElementById('e_rename').value != "") {
if (document.getElementById('e_rename').value !== "") {
history_array[g_index].get_obj().setrename_to(document.getElementById('e_rename').value);
document.getElementById('e_rename').value = "";
}
@ -236,14 +236,14 @@ function edit(type)
document.getElementById('query_Aggregate').style.visibility = 'hidden';
}
if (type == "Where") {
if (document.getElementById('erel_opt').value != '--' && document.getElementById('eQuery').value !="") {
history_array[g_index].get_obj().setquery(document.getElementById('eQuery').value);
history_array[g_index].get_obj().setrelation_operator(document.getElementById('erel_opt').value);
if (document.getElementById('erel_opt').value != '--' && document.getElementById('eQuery').value !== "") {
history_array[g_index].get_obj().setquery(document.getElementById('eQuery').value);
history_array[g_index].get_obj().setrelation_operator(document.getElementById('erel_opt').value);
}
document.getElementById('query_where').style.visibility = 'hidden';
}
if (type == "Having") {
if (document.getElementById('hrel_opt').value != '--' && document.getElementById('hQuery').value !="") {
if (document.getElementById('hrel_opt').value != '--' && document.getElementById('hQuery').value !== "") {
history_array[g_index].get_obj().setquery(document.getElementById('hQuery').value);
history_array[g_index].get_obj().setrelation_operator(document.getElementById('hrel_opt').value);
history_array[g_index].get_obj().set_operator(document.getElementById('hoperator').value);
@ -251,7 +251,7 @@ function edit(type)
document.getElementById('query_having').style.visibility = 'hidden';
}
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(0,0);
existingDiv.innerHTML = display(0, 0);
panel(1);
}
@ -266,7 +266,7 @@ function edit(type)
*
**/
function history(ncolumn_name,nobj,ntab,nobj_no,ntype)
function history(ncolumn_name, nobj, ntab, nobj_no, ntype)
{
var and_or;
var obj;
@ -277,40 +277,40 @@ function history(ncolumn_name,nobj,ntab,nobj_no,ntype)
this.set_column_name = function (ncolumn_name) {
column_name = ncolumn_name;
};
this.get_column_name = function() {
this.get_column_name = function () {
return column_name;
};
this.set_and_or = function(nand_or) {
this.set_and_or = function (nand_or) {
and_or = nand_or;
};
this.get_and_or = function() {
this.get_and_or = function () {
return and_or;
};
this.get_relation = function() {
this.get_relation = function () {
return and_or;
};
this.set_obj = function(nobj) {
this.set_obj = function (nobj) {
obj = nobj;
};
this.get_obj = function() {
this.get_obj = function () {
return obj;
};
this.set_tab = function(ntab) {
this.set_tab = function (ntab) {
tab = ntab;
};
this.get_tab = function() {
this.get_tab = function () {
return tab;
};
this.set_obj_no = function(nobj_no) {
this.set_obj_no = function (nobj_no) {
obj_no = nobj_no;
};
this.get_obj_no = function() {
};
this.get_obj_no = function () {
return obj_no;
};
this.set_type = function(ntype) {
this.set_type = function (ntype) {
type = ntype;
};
this.get_type = function() {
this.get_type = function () {
return type;
};
this.set_obj_no(nobj_no);
@ -330,19 +330,19 @@ function history(ncolumn_name,nobj,ntab,nobj_no,ntype)
**/
var where = function (nrelation_operator,nquery) {
var where = function (nrelation_operator, nquery) {
var relation_operator;
var query;
this.setrelation_operator = function(nrelation_operator) {
this.setrelation_operator = function (nrelation_operator) {
relation_operator = nrelation_operator;
};
this.setquery = function(nquery) {
this.setquery = function (nquery) {
query = nquery;
};
this.getquery = function() {
this.getquery = function () {
return query;
};
this.getrelation_operator = function() {
this.getrelation_operator = function () {
return relation_operator;
};
this.setquery(nquery);
@ -358,26 +358,26 @@ var where = function (nrelation_operator,nquery) {
*
**/
var having = function (nrelation_operator,nquery,noperator) {
var having = function (nrelation_operator, nquery, noperator) {
var relation_operator;
var query;
var operator;
this.set_operator = function(noperator) {
this.set_operator = function (noperator) {
operator = noperator;
};
this.setrelation_operator = function(nrelation_operator) {
this.setrelation_operator = function (nrelation_operator) {
relation_operator = nrelation_operator;
};
this.setquery = function(nquery) {
this.setquery = function (nquery) {
query = nquery;
};
this.getquery = function() {
this.getquery = function () {
return query;
};
this.getrelation_operator = function() {
this.getrelation_operator = function () {
return relation_operator;
};
this.get_operator = function() {
this.get_operator = function () {
return operator;
};
this.setquery(nquery);
@ -392,12 +392,12 @@ var having = function (nrelation_operator,nquery,noperator) {
*
**/
var rename = function(nrename_to) {
var rename = function (nrename_to) {
var rename_to;
this.setrename_to = function(nrename_to) {
this.setrename_to = function (nrename_to) {
rename_to = nrename_to;
};
this.getrename_to =function() {
this.getrename_to = function () {
return rename_to;
};
this.setrename_to(nrename_to);
@ -410,12 +410,12 @@ var rename = function(nrename_to) {
*
**/
var aggregate = function(noperator) {
var aggregate = function (noperator) {
var operator;
this.set_operator = function(noperator) {
this.set_operator = function (noperator) {
operator = noperator;
};
this.get_operator = function() {
this.get_operator = function () {
return operator;
};
this.set_operator(noperator);
@ -430,18 +430,16 @@ var aggregate = function(noperator) {
function unique(arrayName)
{
var newArray=[];
label:for (var i=0; i<arrayName.length; i++ )
{
for (var j=0; j<newArray.length; j++ )
{
if (newArray[j]==arrayName[i]) {
var newArray = [];
label: for (var i = 0; i < arrayName.length; i++) {
for (var j = 0; j < newArray.length; j++) {
if (newArray[j] == arrayName[i]) {
continue label;
}
}
newArray[newArray.length] = arrayName[i];
}
return newArray;
return newArray;
}
/**
@ -452,10 +450,12 @@ function unique(arrayName)
* @param value value which is to be searched in the array
*/
function found(arrayName,value)
function found(arrayName, value)
{
for (var i=0; i<arrayName.length; i++) {
if (arrayName[i] == value) { return 1;}
for (var i = 0; i < arrayName.length; i++) {
if (arrayName[i] == value) {
return 1;
}
}
return -1;
}
@ -479,33 +479,33 @@ function build_query(formtitle, fadin)
var temp;
for (var i = 0;i < select_field.length; i++) {
temp = check_aggregate(select_field[i]);
if (temp != "") {
if (temp !== "") {
q_select += temp;
temp = check_rename(select_field[i]);
q_select += temp + ",";
} else {
temp = check_rename(select_field[i]);
q_select += select_field[i] + temp +",";
q_select += select_field[i] + temp + ",";
}
}
q_select = q_select.substring(0,q_select.length - 1);
q_select = q_select.substring(0, q_select.length - 1);
q_select += " FROM " + query_from();
if (query_where() != "") {
q_select +="\n WHERE";
if (query_where() !== "") {
q_select += "\n WHERE";
q_select += query_where();
}
if (query_groupby() != "") { q_select += "\nGROUP BY " + query_groupby(); }
if (query_having() != "") { q_select += "\nHAVING " + query_having(); }
if (query_orderby() != "") { q_select += "\nORDER BY " + query_orderby(); }
if (query_groupby() !== "") { q_select += "\nGROUP BY " + query_groupby(); }
if (query_having() !== "") { q_select += "\nHAVING " + query_having(); }
if (query_orderby() !== "") { q_select += "\nORDER BY " + query_orderby(); }
var box = document.getElementById('box');
document.getElementById('filter').style.display='block';
document.getElementById('filter').style.display = 'block';
var btitle = document.getElementById('boxtitle');
btitle.innerHTML = 'SELECT';//formtitle;
if (fadin) {
gradient("box", 0);
fadein("box");
} else{
box.style.display='block';
} else {
box.style.display = 'block';
}
document.getElementById('textSqlquery').innerHTML = q_select;
}
@ -536,28 +536,28 @@ function query_from()
var key2;
var key3;
var parts1;
for (i = 0; i < history_array.length ; i++) {
for (i = 0; i < history_array.length; i++) {
from_array.push(history_array[i].get_tab());
}
from_array = unique( from_array );
from_array = unique(from_array);
tab_left = from_array;
temp = tab_left.shift();
quer = temp;
tab_used.push(temp);
// if master table (key2) matches with tab used get all keys and check if tab_left matches
//after this check if master table (key2) matches with tab left then check if any foriegn matches with master .
for (i =0; i<2 ; i++) {
for (i = 0; i < 2; i++) {
for (K in contr) {
for (key in contr[K]) {// contr name
for (key2 in contr[K][key]) {// table name
for (key2 in contr[K][key]) {// table name
parts = key2.split(".");
if (found(tab_used,parts[1]) > 0) {
if (found(tab_used, parts[1]) > 0) {
for (key3 in contr[K][key][key2]) {
parts1 = contr[K][key][key2][key3][0].split(".");
if (found(tab_left,parts1[1]) > 0) {
if (found(tab_left, parts1[1]) > 0) {
query += "\n" + 'LEFT JOIN ';
query += '`' + parts1[0] + '`.`' + parts1[1] + '` ON ' ;
query += '`' + parts[1] +'`.`' + key3 + '` = ';
query += '`' + parts1[0] + '`.`' + parts1[1] + '` ON ';
query += '`' + parts[1] + '`.`' + key3 + '` = ';
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` ';
t_tab_left.push(parts1[1]);
}
@ -567,40 +567,40 @@ function query_from()
}
}
K = 0;
t_tab_left = unique (t_tab_left);
tab_used = add_array(t_tab_left,tab_used);
tab_left = remove_array(t_tab_left,tab_left);
t_tab_left = unique(t_tab_left);
tab_used = add_array(t_tab_left, tab_used);
tab_left = remove_array(t_tab_left, tab_left);
t_tab_left = [];
for (K in contr) {
for (key in contr[K]) {
for (key2 in contr[K][key]) {// table name
parts = key2.split(".");
if (found(tab_left,parts[1]) > 0) {
for (key3 in contr[K][key][key2]) {
parts1 = contr[K][key][key2][key3][0].split(".");
if (found(tab_used,parts1[1]) > 0) {
query += "\n" + 'LEFT JOIN ';
query += '`' + parts[0] + '`.`' + parts[1] + '` ON ' ;
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` = ';
query += '`' + parts[1] + '`.`' + key3 + '` ';
t_tab_left.push(parts[1]);
}
}
}
}
for (key in contr[K]) {
for (key2 in contr[K][key]) {// table name
parts = key2.split(".");
if (found(tab_left, parts[1]) > 0) {
for (key3 in contr[K][key][key2]) {
parts1 = contr[K][key][key2][key3][0].split(".");
if (found(tab_used, parts1[1]) > 0) {
query += "\n" + 'LEFT JOIN ';
query += '`' + parts[0] + '`.`' + parts[1] + '` ON ';
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` = ';
query += '`' + parts[1] + '`.`' + key3 + '` ';
t_tab_left.push(parts[1]);
}
}
}
}
}
}
t_tab_left = unique (t_tab_left);
tab_used = add_array(t_tab_left,tab_used);
tab_left = remove_array(t_tab_left,tab_left);
t_tab_left = unique(t_tab_left);
tab_used = add_array(t_tab_left, tab_used);
tab_left = remove_array(t_tab_left, tab_left);
t_tab_left = [];
}
for (k in tab_left) {
quer += " , `" + tab_left[k] + "`";
}
query = quer + query;
from_array = t_array;
return query;
query = quer + query;
from_array = t_array;
return query;
}
/**
@ -609,9 +609,9 @@ function query_from()
* @params add array elements of which are pushed in
* @params arr array in which elemnets are added
*/
function add_array(add,arr)
function add_array(add, arr)
{
for (var i=0; i<add.length; i++) {
for (var i = 0; i < add.length; i++) {
arr.push(add[i]);
}
return arr;
@ -623,12 +623,12 @@ function add_array(add,arr)
* @params arr array from which elements are removed.
*
*/
function remove_array(rem,arr)
function remove_array(rem, arr)
{
for (var i=0; i<rem.length; i++) {
for (var j=0; j<arr.length; j++) {
for (var i = 0; i < rem.length; i++) {
for (var j = 0; j < arr.length; j++) {
if (rem[i] == arr[j]) {
arr.splice(j,1);
arr.splice(j, 1);
}
}
}
@ -645,9 +645,11 @@ function query_groupby()
var i;
var str = "";
for (i = 0; i < history_array.length;i++) {
if (history_array[i].get_type() == "GroupBy") { str +=history_array[i].get_column_name() + ", ";}
if (history_array[i].get_type() == "GroupBy") {
str += history_array[i].get_column_name() + ", ";
}
}
str = str.substr(0,str.length -1);
str = str.substr(0, str.length - 1);
return str;
}
@ -664,16 +666,16 @@ function query_having()
if (history_array[i].get_type() == "Having") {
if (history_array[i].get_obj().get_operator() != 'None') {
and += history_array[i].get_obj().get_operator() + "(" + history_array[i].get_column_name() + " ) " + history_array[i].get_obj().getrelation_operator();
and += " " + history_array[i].get_obj().getquery() + ", " ;
and += " " + history_array[i].get_obj().getquery() + ", ";
} else {
and += history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ", ";
}
}
}
if (and =="(") {
and = "" ;
if (and == "(") {
and = "";
} else {
and = and.substr(0,and.length -2) + ")";
and = and.substr(0, and.length - 2) + ")";
}
return and;
}
@ -687,11 +689,11 @@ function query_having()
function query_orderby()
{
var i;
var str = "" ;
var str = "";
for (i = 0; i < history_array.length;i++) {
if (history_array[i].get_type() == "OrderBy") { str += history_array[i].get_column_name() + " , "; }
}
str = str.substr(0,str.length -1);
str = str.substr(0, str.length - 1);
return str;
}
@ -708,25 +710,26 @@ function query_where()
var or = "(";
for (i = 0; i < history_array.length;i++) {
if (history_array[i].get_type() == "Where") {
if (history_array[i].get_and_or() == 0) {
and += "( " + history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() +" " + history_array[i].get_obj().getquery() + ")"; and += " AND ";
if (history_array[i].get_and_or() === 0) {
and += "( " + history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ")";
and += " AND ";
} else {
or +="( " + history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() +")";
or +=" OR " ;
or += "( " + history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ")";
or += " OR ";
}
}
}
if (or != "(") {
or = or.substring(0,(or.length - 4 )) + ")";
or = or.substring(0, (or.length - 4)) + ")";
} else {
or = "" ;
or = "";
}
if (and !="(") {
and = and.substring(0,(and.length - 5)) + ")";
if (and != "(") {
and = and.substring(0, (and.length - 5)) + ")";
} else {
and = "" ;
and = "";
}
if (or != "" ) {
if (or !== "") {
and = and + " OR " + or + " )";
}
return and;
@ -735,10 +738,10 @@ function query_where()
function check_aggregate(id_this)
{
var i;
for (i = 0;i < history_array.length;i++) {
var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`';
for (i = 0; i < history_array.length; i++) {
var temp = '`' + history_array[i].get_tab() + '`.`' + history_array[i].get_column_name() + '`';
if (temp == id_this && history_array[i].get_type() == "Aggregate") {
return history_array[i].get_obj().get_operator() + '(' + id_this +')';
return history_array[i].get_obj().get_operator() + '(' + id_this + ')';
}
}
return "";
@ -747,10 +750,10 @@ function check_aggregate(id_this)
function check_rename(id_this)
{
var i;
for (i = 0;i < history_array.length;i++) {
var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`';
for (i = 0; i < history_array.length; i++) {
var temp = '`' + history_array[i].get_tab() + '`.`' + history_array[i].get_column_name() + '`';
if (temp == id_this && history_array[i].get_type() == "Rename") {
return " AS `" + history_array[i].get_obj().getrename_to() +"`";
return " AS `" + history_array[i].get_obj().getrename_to() + "`";
}
}
return "";
@ -763,7 +766,7 @@ function gradient(id, level)
box.style.MozOpacity = level;
box.style.KhtmlOpacity = level;
box.style.filter = "alpha(opacity=" + level * 100 + ")";
box.style.display="block";
box.style.display = "block";
return;
}
@ -772,13 +775,13 @@ function fadein(id)
{
var level = 0;
while (level <= 1) {
setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
setTimeout("gradient('" + id + "'," + level + ")", (level * 1000) + 10);
level += 0.01;
}
}
function closebox()
{
document.getElementById('box').style.display='none';
document.getElementById('filter').style.display='none';
document.getElementById('box').style.display = 'none';
document.getElementById('filter').style.display = 'none';
}

View File

@ -7,145 +7,145 @@
/**
*
*/
if (!window.all) // if IE
{
document.attachEvent("onreadystatechange", // document load
function () {
if (document.readyState == "complete") {
var el = document.getElementById("canvas");
var outerHTML = el.outerHTML;
var newEl = document.createElement(outerHTML);
el.parentNode.replaceChild(newEl, el);
el = newEl;
el.getContext = function () {
if (this.cont) {
return this.cont;
}
return this.cont = new PMD_2D(this);
if (!window.all) { // if IE
document.attachEvent(
"onreadystatechange", // document load
function () {
if (document.readyState == "complete") {
var el = document.getElementById("canvas");
var outerHTML = el.outerHTML;
var newEl = document.createElement(outerHTML);
el.parentNode.replaceChild(newEl, el);
el = newEl;
el.getContext = function () {
if (this.cont) {
return this.cont;
}
return this.cont = new PMD_2D(this);
};
el.style.width = el.attributes.width.nodeValue + "px";
el.style.height = el.attributes.height.nodeValue + "px";
}
}
);
//*****************************************************************************************************
function convert_style(str) {
var m = [];
m = str.match(/.*\((\d*),(\d*),(\d*),(\d*)\)/);
for (var i = 1; i <= 3; i++) {
m[i] = (m[i] * 1).toString(16).length < 2 ? '0' + (m[i] * 1).toString(16) : (m[i] * 1).toString(16);
}
return ['#' + m[1] + m[2] + m[3], 1];
}
//------------------------------------------------------------------------------
function PMD_2D(th) {
this.element_ = th;
this.pmd_arr = [];
this.strokeStyle;
this.fillStyle;
this.lineWidth;
this.closePath = function () {
this.pmd_arr.push({type: "close"});
};
el.style.width = el.attributes.width.nodeValue + "px";
el.style.height = el.attributes.height.nodeValue + "px";
}
this.clearRect = function () {
this.element_.innerHTML = "";
this.pmd_arr = [];
};
this.beginPath = function () {
this.pmd_arr = [];
};
this.moveTo = function (aX, aY) {
this.pmd_arr.push({type: "moveTo", x: aX, y: aY});
};
this.lineTo = function (aX, aY) {
this.pmd_arr.push({type: "lineTo", x: aX, y: aY});
};
this.arc = function (aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
if (!aClockwise) {
var t = aStartAngle;
aStartAngle = aEndAngle;
aEndAngle = t;
}
var xStart = aX + (Math.cos(aStartAngle) * aRadius);
var yStart = aY + (Math.sin(aStartAngle) * aRadius);
var xEnd = aX + (Math.cos(aEndAngle) * aRadius);
var yEnd = aY + (Math.sin(aEndAngle) * aRadius);
this.pmd_arr.push({type: "arc", x: aX, y: aY,
radius: aRadius, xStart: xStart, yStart: yStart, xEnd: xEnd, yEnd: yEnd});
};
this.rect = function (aX, aY, aW, aH) {
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
};
this.fillRect = function (aX, aY, aW, aH) {
this.beginPath();
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
this.stroke(true);
};
this.stroke = function (aFill) {
var Str = [];
var a = convert_style(aFill ? this.fillStyle : this.strokeStyle);
var color = a[0];
Str.push('<v:shape',
' fillcolor="', color, '"',
' filled="', Boolean(aFill), '"',
' style="position:absolute;width:10;height:10;"',
' coordorigin="0 0" coordsize="10 10"',
' stroked="', !aFill, '"',
' strokeweight="', this.lineWidth, '"',
' strokecolor="', color, '"',
' path="');
for (var i = 0; i < this.pmd_arr.length; i++) {
var p = this.pmd_arr[i];
if (p.type == "moveTo") {
Str.push(" m ");
Str.push(Math.floor(p.x), ",", Math.floor(p.y));
} else if (p.type == "lineTo") {
Str.push(" l ");
Str.push(Math.floor(p.x), ",", Math.floor(p.y));
} else if (p.type == "close") {
Str.push(" x ");
} else if (p.type == "arc") {
Str.push(" ar ");
Str.push(Math.floor(p.x - p.radius), ",",
Math.floor(p.y - p.radius), " ",
Math.floor(p.x + p.radius), ",",
Math.floor(p.y + p.radius), " ",
Math.floor(p.xStart), ",", Math.floor(p.yStart), " ",
Math.floor(p.xEnd), ",", Math.floor(p.yEnd));
}
}
Str.push(' ">');
Str.push("</v:shape>");
this.element_.insertAdjacentHTML("beforeEnd", Str.join(""));
this.pmd_arr = [];
};
}
);
//*****************************************************************************************************
function convert_style(str) {
var m = [];
m = str.match(/.*\((\d*),(\d*),(\d*),(\d*)\)/);
for (var i = 1; i<=3; i++) {
m[i] = (m[i]*1).toString(16).length < 2 ? '0' + (m[i]*1).toString(16) : (m[i]*1).toString(16);
}
return ['#' + m[1] + m[2] + m[3], 1];
}
//------------------------------------------------------------------------------
function PMD_2D(th) {
this.element_ = th;
this.pmd_arr = [];
this.strokeStyle;
this.fillStyle;
this.lineWidth;
this.closePath = function() {
this.pmd_arr.push({type: "close"});
};
this.clearRect = function() {
this.element_.innerHTML = "";
this.pmd_arr = [];
};
this.beginPath = function() {
this.pmd_arr = [];
};
this.moveTo = function(aX, aY) {
this.pmd_arr.push({type: "moveTo", x: aX, y: aY});
};
this.lineTo = function(aX, aY) {
this.pmd_arr.push({type: "lineTo", x: aX, y: aY});
};
this.arc = function(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
if (!aClockwise) {
var t = aStartAngle;
aStartAngle = aEndAngle;
aEndAngle = t;
}
var xStart = aX + (Math.cos(aStartAngle) * aRadius);
var yStart = aY + (Math.sin(aStartAngle) * aRadius);
var xEnd = aX + (Math.cos(aEndAngle) * aRadius);
var yEnd = aY + (Math.sin(aEndAngle) * aRadius);
this.pmd_arr.push({type: "arc", x: aX, y: aY,
radius: aRadius, xStart: xStart, yStart: yStart, xEnd: xEnd, yEnd: yEnd});
};
this.rect = function(aX, aY, aW, aH) {
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
};
this.fillRect = function(aX, aY, aW, aH) {
this.beginPath();
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
this.stroke(true);
};
this.stroke = function(aFill) {
var Str = [];
var a = convert_style(aFill ? this.fillStyle : this.strokeStyle);
var color = a[0];
Str.push('<v:shape',
' fillcolor="', color, '"',
' filled="', Boolean(aFill), '"',
' style="position:absolute;width:10;height:10;"',
' coordorigin="0 0" coordsize="10 10"',
' stroked="', !aFill, '"',
' strokeweight="', this.lineWidth, '"',
' strokecolor="', color, '"',
' path="');
for (var i = 0; i < this.pmd_arr.length; i++) {
var p = this.pmd_arr[i];
if (p.type == "moveTo") {
Str.push(" m ");
Str.push(Math.floor(p.x), ",",Math.floor(p.y));
} else if (p.type == "lineTo") {
Str.push(" l ");
Str.push(Math.floor(p.x), ",",Math.floor(p.y));
} else if (p.type == "close") {
Str.push(" x ");
} else if (p.type == "arc") {
Str.push(" ar ");
Str.push(Math.floor(p.x - p.radius), ",",
Math.floor(p.y - p.radius), " ",
Math.floor(p.x + p.radius), ",",
Math.floor(p.y + p.radius), " ",
Math.floor(p.xStart), ",", Math.floor(p.yStart), " ",
Math.floor(p.xEnd), ",", Math.floor(p.yEnd));
}
}
Str.push(' ">');
Str.push("</v:shape>");
this.element_.insertAdjacentHTML("beforeEnd", Str.join(""));
this.pmd_arr = [];
}
}
}

View File

@ -5,12 +5,12 @@
var j_tabs, h_tabs, contr, server, db, token;
AJAX.registerTeardown('pmd/init.js', function() {
AJAX.registerTeardown('pmd/init.js', function () {
$(".trigger").unbind('click');
});
AJAX.registerOnload('pmd/init.js', function() {
$(".trigger").click(function() {
AJAX.registerOnload('pmd/init.js', function () {
$(".trigger").click(function () {
$(".panel").toggle("fast");
$(this).toggleClass("active");
return false;

View File

@ -8,21 +8,21 @@
*/
var _change = 0; // variable to track any change in designer layout.
var _staying = 0; // variable to check if the user stayed after seeing the confirmation prompt.
var show_relation_lines = true;
var _change = 0; // variable to track any change in designer layout.
var _staying = 0; // variable to check if the user stayed after seeing the confirmation prompt.
var show_relation_lines = true;
AJAX.registerTeardown('pmd/move.js', function() {
AJAX.registerTeardown('pmd/move.js', function () {
if ($.FullScreen.supported) {
$(document).unbind($.FullScreen.prefix + 'fullscreenchange');
}
});
AJAX.registerOnload('pmd/move.js', function() {
AJAX.registerOnload('pmd/move.js', function () {
$('#page_content').css({'margin-left': '3px'});
$('#exitFullscreen').hide();
if ($.FullScreen.supported) {
$(document).fullScreenChange(function() {
$(document).fullScreenChange(function () {
if (! $.FullScreen.isFullScreen()) {
$('#page_content').removeClass('content_fullscreen')
.css({'width': 'auto', 'height': 'auto'});
@ -41,22 +41,22 @@ AJAX.registerOnload('pmd/move.js', function() {
/*
FIXME: we can't register the beforeonload event because it will persist between pageloads
AJAX.registerOnload('pmd/move.js', function(){
$(window).bind('beforeunload', function() { // onbeforeunload for the frame window.
if (_change == 1 && _staying == 0) {
return PMA_messages['strLeavingDesigner'];
AJAX.registerOnload('pmd/move.js', function (){
$(window).bind('beforeunload', function () { // onbeforeunload for the frame window.
if (_change == 1 && _staying === 0) {
return PMA_messages.strLeavingDesigner;
} else if (_change == 1 && _staying == 1) {
_staying = 0;
}
});
$(window).unload(function() {
$(window).unload(function () {
_change = 0;
});
window.top.onbeforeunload = function() { // onbeforeunload for the browser main window.
if (_change == 1 && _staying == 0) {
window.top.onbeforeunload = function () { // onbeforeunload for the browser main window.
if (_change == 1 && _staying === 0) {
_staying = 1; // Helps if the user stays on the page as there
setTimeout('make_zero();', 100); // is no other way of knowing whether the user stayed or not.
return PMA_messages['strLeavingDesigner'];
return PMA_messages.strLeavingDesigner;
}
};
});*/
@ -112,23 +112,25 @@ var isN4 = document.layers;
if (isIE) {
window.onscroll = General_scroll;
document.onselectstart = function () {return false;};
document.onselectstart = function () {
return false;
};
}
//document.onmouseup = function(){General_scroll_end();}
//document.onmouseup = function (){General_scroll_end();}
function MouseDown(e)
{
var offsetx, offsety;
if (cur_click != null) {
if (cur_click !== null) {
offsetx = isIE ? event.clientX + document.body.scrollLeft : e.pageX;
offsety = isIE ? event.clientY + document.body.scrollTop : e.pageY;
dx = offsetx - parseInt(cur_click.style.left);
dy = offsety - parseInt(cur_click.style.top);
dx = offsetx - parseInt(cur_click.style.left, 10);
dy = offsety - parseInt(cur_click.style.top, 10);
//alert(" dx = " + dx + " dy = " +dy);
document.getElementById("canvas").style.display = 'none';
/*
var left = parseInt(cur_click.style.left);
var top = parseInt(cur_click.style.top);
var left = parseInt(cur_click.style.left, 10);
var top = parseInt(cur_click.style.top, 10);
dx = e.pageX - left;
dy = e.pageY - top;
@ -138,7 +140,7 @@ function MouseDown(e)
}
if (layer_menu_cur_click) {
offsetx = e.pageX;
dx = offsetx - parseInt(document.getElementById("layer_menu").style.width);
dx = offsetx - parseInt(document.getElementById("layer_menu").style.width, 10);
}
}
@ -154,7 +156,7 @@ function MouseMove(e)
//window.status = "X = "+ Glob_X + " Y = "+ Glob_Y;
if (cur_click != null) {
if (cur_click !== null) {
_change = 1;
var mGx = Glob_X - dx;
var mGy = Glob_Y - dy;
@ -184,7 +186,7 @@ function MouseMove(e)
function MouseUp(e)
{
if (cur_click != null) {
if (cur_click !== null) {
document.getElementById("canvas").style.display = 'inline-block';
Re_load();
cur_click.style.zIndex = 1;
@ -209,15 +211,15 @@ function Canvas_pos()
canvas_height = document.getElementById('canvas').height = osn_tab_height - 3;
if (isIE) {
document.getElementById('canvas').style.width = ((osn_tab_width - 3)?(osn_tab_width - 3):0) + 'px';
document.getElementById('canvas').style.height = ((osn_tab_height - 3)?(osn_tab_height - 3):0) + 'px';
document.getElementById('canvas').style.width = ((osn_tab_width - 3) ? (osn_tab_width - 3) : 0) + 'px';
document.getElementById('canvas').style.height = ((osn_tab_height - 3) ? (osn_tab_height - 3) : 0) + 'px';
}
}
function Osn_tab_pos()
{
osn_tab_width = parseInt(document.getElementById('osn_tab').style.width);
osn_tab_height = parseInt(document.getElementById('osn_tab').style.height);
osn_tab_width = parseInt(document.getElementById('osn_tab').style.width, 10);
osn_tab_height = parseInt(document.getElementById('osn_tab').style.height, 10);
}
@ -246,8 +248,8 @@ function Rezize_osn_tab()
var max_X = 0;
var max_Y = 0;
for (var key in j_tabs) {
var k_x = parseInt(document.getElementById(key).style.left) + document.getElementById(key).offsetWidth;
var k_y = parseInt(document.getElementById(key).style.top) + document.getElementById(key).offsetHeight;
var k_x = parseInt(document.getElementById(key).style.left, 10) + document.getElementById(key).offsetWidth;
var k_y = parseInt(document.getElementById(key).style.top, 10) + document.getElementById(key).offsetHeight;
max_X = max_X < k_x ? k_x : max_X;
max_Y = max_Y < k_y ? k_y : max_Y;
}
@ -287,7 +289,7 @@ function Re_load()
// if hide
continue;
}
var x1_left = document.getElementById(key2).offsetLeft+1;
var x1_left = document.getElementById(key2).offsetLeft + 1;
var x1_right = x1_left + document.getElementById(key2).offsetWidth;
var x2_left = document.getElementById(contr[K][key][key2][key3][0]).offsetLeft;
var x2_right = x2_left + document.getElementById(contr[K][key][key2][key3][0]).offsetWidth;
@ -320,7 +322,7 @@ function Re_load()
x2 = x2_right + sm_s;
s_right = 1;
}
if (n == 0) {
if (n === 0) {
x1 = x1_left - sm_s;
x2 = x2_left - sm_s;
s_left = 1;
@ -355,7 +357,13 @@ function Re_load()
+ height_field;
//alert(y1 + ' - ' + key2 + "." + key3);
Line0(x1 - sm_x, y1 - sm_y, x2 - sm_x, y2 - sm_y, getColorByTarget( contr[K][key][key2][key3][0]+'.'+contr[K][key][key2][key3][1] ) );
Line0(
x1 - sm_x,
y1 - sm_y,
x2 - sm_x,
y2 - sm_y,
getColorByTarget(contr[K][key][key2][key3][0] + '.' + contr[K][key][key2][key3][1])
);
}
}
}
@ -492,7 +500,7 @@ function Rect(x1, y1, w, h, color)
//--------------------------- FULLSCREEN -------------------------------------
function Enter_fullscreen()
{
if (! $.FullScreen.isFullScreen()) {
if (! $.FullScreen.isFullScreen()) {
$('#enterFullscreen').hide();
$('#exitFullscreen').show();
$('#page_content')
@ -513,8 +521,8 @@ function Exit_fullscreen()
function Save(url) // (del?) no for pdf
{
for (var key in j_tabs) {
document.getElementById('t_x_' + key + '_').value = parseInt(document.getElementById(key).style.left);
document.getElementById('t_y_' + key + '_').value = parseInt(document.getElementById(key).style.top);
document.getElementById('t_x_' + key + '_').value = parseInt(document.getElementById(key).style.left, 10);
document.getElementById('t_y_' + key + '_').value = parseInt(document.getElementById(key).style.top, 10);
document.getElementById('t_v_' + key + '_').value = document.getElementById('id_tbody_' + key).style.display == 'none' ? 0 : 1;
document.getElementById('t_h_' + key + '_').value = document.getElementById('check_vis_' + key).checked ? 1 : 0;
}
@ -526,8 +534,8 @@ function Get_url_pos()
{
var poststr = '';
for (var key in j_tabs) {
poststr += '&t_x[' + key + ']=' + parseInt(document.getElementById(key).style.left);
poststr += '&t_y[' + key + ']=' + parseInt(document.getElementById(key).style.top);
poststr += '&t_x[' + key + ']=' + parseInt(document.getElementById(key).style.left, 10);
poststr += '&t_y[' + key + ']=' + parseInt(document.getElementById(key).style.top, 10);
poststr += '&t_v[' + key + ']=' + (document.getElementById('id_tbody_' + key).style.display == 'none' ? 0 : 1);
poststr += '&t_h[' + key + ']=' + (document.getElementById('check_vis_' + key).checked ? 1 : 0);
}
@ -537,7 +545,7 @@ function Get_url_pos()
function Save2()
{
_change = 0;
var poststr = 'IS_AJAX=1&server='+server+'&db=' + db + '&token=' + token + '&die_save_pos=1';
var poststr = 'IS_AJAX=1&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=1';
poststr += Get_url_pos();
makeRequest('pmd_save_pos.php', poststr);
}
@ -574,7 +582,7 @@ function Start_relation()
if (!ON_relation) {
document.getElementById('foreign_relation').style.display = '';
ON_relation = 1;
document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectReferencedKey'];
document.getElementById('pmd_hint').innerHTML = PMA_messages.strSelectReferencedKey;
document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('rel_button').className = 'M_butt_Selected_down';
} else {
@ -592,7 +600,7 @@ function Click_field(T, f, PK) // table field
if (!click_field) {
//.style.display=='none' .style.display = 'none'
if (!PK) {
alert(PMA_messages['strPleaseSelectPrimaryOrUniqueKey']);
alert(PMA_messages.strPleaseSelectPrimaryOrUniqueKey);
return;// 0;
}//PK
if (j_tabs[db + '.' + T] != '1') {
@ -600,7 +608,7 @@ function Click_field(T, f, PK) // table field
}
click_field = 1;
link_relation = "T1=" + T + "&F1=" + f;
document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectForeignKey'];
document.getElementById('pmd_hint').innerHTML = PMA_messages.strSelectForeignKey;
} else {
Start_relation(); // hidden hint...
if (j_tabs[db + '.' + T] != '1' || !PK) {
@ -672,7 +680,7 @@ function Small_tab_all(id_this) // max/min all tables
{
if (id_this.alt == "v") {
for (var key in j_tabs) {
if (document.getElementById('id_hide_tbody_'+key).innerHTML == "v") {
if (document.getElementById('id_hide_tbody_' + key).innerHTML == "v") {
Small_tab(key, 0);
}
}
@ -680,7 +688,7 @@ function Small_tab_all(id_this) // max/min all tables
id_this.src = pmaThemeImage + "pmd/rightarrow1.png";
} else {
for (var key in j_tabs) {
if (document.getElementById('id_hide_tbody_'+key).innerHTML != "v") {
if (document.getElementById('id_hide_tbody_' + key).innerHTML != "v") {
Small_tab(key, 0);
}
}
@ -706,12 +714,12 @@ function Relation_lines_invert()
function Small_tab_refresh()
{
for (var key in j_tabs) {
if(document.getElementById('id_hide_tbody_'+key).innerHTML != "v") {
Small_tab(key, 0);
Small_tab(key, 0);
}
}
for (var key in j_tabs) {
if (document.getElementById('id_hide_tbody_' + key).innerHTML != "v") {
Small_tab(key, 0);
Small_tab(key, 0);
}
}
}
function Small_tab(t, re_load)
@ -743,8 +751,13 @@ function Select_tab(t)
}
//----------
var id_t = document.getElementById(t);
window.scrollTo(parseInt(id_t.style.left) - 300, parseInt(id_t.style.top) - 300);
setTimeout(function(){document.getElementById('id_zag_' + t).className = 'tab_zag';}, 800);
window.scrollTo(parseInt(id_t.style.left, 10) - 300, parseInt(id_t.style.top, 10) - 300);
setTimeout(
function () {
document.getElementById('id_zag_' + t).className = 'tab_zag';
},
800
);
}
//------------------------------------------------------------------------------
@ -763,8 +776,8 @@ function Canvas_click(id)
for (key in contr[K]) {
for (key2 in contr[K][key]) {
for (key3 in contr[K][key][key2]) {
if (!document.getElementById("check_vis_"+key2).checked
|| !document.getElementById("check_vis_"+contr[K][key][key2][key3][0]).checked) {
if (!document.getElementById("check_vis_" + key2).checked
|| !document.getElementById("check_vis_" + contr[K][key][key2][key3][0]).checked) {
continue; // if hide
}
var x1_left = document.getElementById(key2).offsetLeft + 1;//document.getElementById(key2+"."+key3).offsetLeft;
@ -800,25 +813,32 @@ function Canvas_click(id)
x2 = x2_right + sm_s;
s_right = 1;
}
if (n == 0) {
if (n === 0) {
x1 = x1_left - sm_s;
x2 = x2_left - sm_s;
s_left = 1;
}
var y1 = document.getElementById(key2).offsetTop + document.getElementById(key2+"."+key3).offsetTop + height_field;
var y1 = document.getElementById(key2).offsetTop + document.getElementById(key2 + "." + key3).offsetTop + height_field;
var y2 = document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
document.getElementById(contr[K][key][key2][key3][0]+"."+contr[K][key][key2][key3][1]).offsetTop + height_field;
document.getElementById(contr[K][key][key2][key3][0] + "." + contr[K][key][key2][key3][1]).offsetTop + height_field;
if (!selected && Local_X > x1 - 10 && Local_X < x1 + 10 && Local_Y > y1 - 7 && Local_Y < y1 + 7) {
Line0(x1 - sm_x, y1 - sm_y, x2 - sm_x, y2 - sm_y, "rgba(255,0,0,1)");
selected = 1; // Rect(x1-sm_x,y1-sm_y,10,10,"rgba(0,255,0,1)");
relation_name = key; //
Key0 = contr[K][key][key2][key3][0];
Key1 = contr[K][key][key2][key3][1];
Key2 = key2; Key3 = key3;
Key2 = key2;
Key3 = key3;
Key = K;
} else {
Line0(x1 - sm_x, y1 - sm_y, x2 - sm_x, y2 - sm_y, getColorByTarget( contr[K][key][key2][key3][0]+'.'+contr[K][key][key2][key3][1] ));
Line0(
x1 - sm_x,
y1 - sm_y,
x2 - sm_x,
y2 - sm_y,
getColorByTarget(contr[K][key][key2][key3][0] + '.' + contr[K][key][key2][key3][1])
);
}
}
}
@ -883,7 +903,7 @@ function in_array_k(x, m)
var b = 0;
for (var u in m) {
if (x == u) {
b=1;
b = 1;
break;
}
}
@ -948,14 +968,12 @@ function General_scroll()
*/
//if (timeoutID)
clearTimeout(timeoutID);
timeoutID = setTimeout
(
function()
{
timeoutID = setTimeout(
function () {
document.getElementById('top_menu').style.left = document.body.scrollLeft + 'px';
document.getElementById('top_menu').style.top = document.body.scrollTop + 'px';
}
,200
},
200
);
}
@ -1029,7 +1047,7 @@ function Start_display_field()
}
if (!ON_display_field) {
ON_display_field = 1;
document.getElementById('pmd_hint').innerHTML = PMA_messages['strChangeDisplay'];
document.getElementById('pmd_hint').innerHTML = PMA_messages.strChangeDisplay;
document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('display_field_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
@ -1045,58 +1063,55 @@ function Start_display_field()
}
//------------------------------------------------------------------------------
var TargetColors = [];
function getColorByTarget( target )
function getColorByTarget(target)
{
var color = ''; //"rgba(0,100,150,1)";
var color = ''; //"rgba(0,100,150,1)";
for (var i in TargetColors) {
if (TargetColors[i][0]==target) {
color = TargetColors[i][1];
break;
}
}
for (var i in TargetColors) {
if (TargetColors[i][0] == target) {
color = TargetColors[i][1];
break;
}
}
if (color.length === 0) {
var i = TargetColors.length + 1;
var d = i % 6;
var j = (i - d) / 6;
j = j % 4;
j++;
var color_case = new Array(
new Array(1, 0, 0),
new Array(0, 1, 0),
new Array(0, 0, 1),
new Array(1, 1, 0),
new Array(1, 0, 1),
new Array(0, 1, 1)
);
var a = color_case[d][0];
var b = color_case[d][1];
var c = color_case[d][2];
var e = (1 - (j - 1) / 6);
if (color.length==0) {
var i = TargetColors.length+1;
var d = i % 6;
var j = (i - d) / 6;
j = j % 4;
j++;
var color_case = new Array(
new Array(1, 0, 0),
new Array(0, 1, 0),
new Array(0, 0, 1),
new Array(1, 1, 0),
new Array(1, 0, 1),
new Array(0, 1, 1)
);
var a = color_case[d][0];
var b = color_case[d][1];
var c = color_case[d][2];
var e = (1 - (j - 1) / 6);
var r = Math.round(a * 200 * e);
var g = Math.round(b * 200 * e);
var b = Math.round(c * 200 * e);
var color = "rgba(" + r + "," + g + "," + b + ",1)";
var r = Math.round(a * 200 * e);
var g = Math.round(b * 200 * e);
var b = Math.round(c * 200 * e);
var color = "rgba("+r+","+g+","+b+",1)";
TargetColors.push(new Array(target, color));
}
TargetColors.push( new Array(target, color) );
}
return color;
return color;
}
function Click_option(id_this,column_name,table_name)
function Click_option(id_this, column_name, table_name)
{
var left = Glob_X - (document.getElementById(id_this).offsetWidth>>1);
document.getElementById(id_this).style.left = left + 'px';
// var top = Glob_Y - document.getElementById(id_this).offsetHeight - 10;
document.getElementById(id_this).style.top = (screen.height / 4) + 'px';
document.getElementById(id_this).style.display = 'block';
document.getElementById('option_col_name').innerHTML = '<strong>' + PMA_messages['strAddOption'] +'"' +column_name+ '"</strong>';
document.getElementById('option_col_name').innerHTML = '<strong>' + PMA_messages.strAddOption + '"' + column_name + '"</strong>';
col_name = column_name;
tab_name = table_name;
}
@ -1106,40 +1121,38 @@ function Close_option()
document.getElementById('pmd_optionse').style.display = 'none';
}
function Select_all(id_this,owner)
function Select_all(id_this, owner)
{
var parent= document.form1;
downer =owner;
var parent = document.form1;
downer = owner;
var i;
var k;
var tab = [];
for (i = 0; i < parent.elements.length; i++) {
if (parent.elements[i].type == "checkbox" && parent.elements[i].id.substring(0,(9 + id_this.length)) == 'select_' + id_this + '._') {
if(document.getElementById('select_all_' + id_this).checked == true) {
if (parent.elements[i].type == "checkbox" && parent.elements[i].id.substring(0, (9 + id_this.length)) == 'select_' + id_this + '._') {
if (document.getElementById('select_all_' + id_this).checked === true) {
parent.elements[i].checked = true;
parent.elements[i].disabled = true;
var temp = '`' + id_this.substring(owner.length +1) + '`.*';
}
else {
parent.elements[i].checked = false;
parent.elements[i].disabled = false;
}
}
}
if (document.getElementById('select_all_' + id_this).checked == true) {
select_field.push('`' + id_this.substring(owner.length +1) + '`.*');
tab = id_this.split(".");
from_array.push(tab[1]);
}
else {
for (i =0; i < select_field.length; i++) {
if (select_field[i] == ('`' + id_this.substring(owner.length +1) + '`.*')) {
select_field.splice(i,1);
var temp = '`' + id_this.substring(owner.length + 1) + '`.*';
} else {
parent.elements[i].checked = false;
parent.elements[i].disabled = false;
}
}
for (k =0 ;k < from_array.length; k++){
if (from_array[k] == id_this){
from_array.splice(k,1);
}
if (document.getElementById('select_all_' + id_this).checked === true) {
select_field.push('`' + id_this.substring(owner.length + 1) + '`.*');
tab = id_this.split(".");
from_array.push(tab[1]);
} else {
for (i = 0; i < select_field.length; i++) {
if (select_field[i] == ('`' + id_this.substring(owner.length + 1) + '`.*')) {
select_field.splice(i, 1);
}
}
for (k = 0; k < from_array.length; k++) {
if (from_array[k] == id_this) {
from_array.splice(k, 1);
break;
}
}
@ -1147,18 +1160,17 @@ function Select_all(id_this,owner)
Re_load();
}
function Table_onover(id_this,val,buil)
function Table_onover(id_this, val, buil)
{
if(!val) {
document.getElementById("id_zag_" + id_this).className="tab_zag_2";
if(buil) {
document.getElementById("id_zag_" + id_this + "_2").className="tab_zag_2";
if (!val) {
document.getElementById("id_zag_" + id_this).className = "tab_zag_2";
if (buil) {
document.getElementById("id_zag_" + id_this + "_2").className = "tab_zag_2";
}
}
else {
document.getElementById("id_zag_" + id_this).className="tab_zag";
if(buil) {
document.getElementById("id_zag_" + id_this + "_2").className="tab_zag";
} else {
document.getElementById("id_zag_" + id_this).className = "tab_zag";
if (buil) {
document.getElementById("id_zag_" + id_this + "_2").className = "tab_zag";
}
}
}
@ -1167,28 +1179,27 @@ function Table_onover(id_this,val,buil)
* In case column is checked it add else it deletes
*
*/
function store_column(id_this,owner,col)
function store_column(id_this, owner, col)
{
var i;
var k;
if (document.getElementById('select_' + owner + '.' + id_this + '._' + col).checked == true) {
select_field.push('`' + id_this + '`.`' + col +'`');
if (document.getElementById('select_' + owner + '.' + id_this + '._' + col).checked === true) {
select_field.push('`' + id_this + '`.`' + col + '`');
from_array.push(id_this);
} else {
for (i = 0; i < select_field.length; i++) {
if (select_field[i] == ('`' + id_this + '`.`' + col + '`')) {
select_field.splice(i, 1);
break;
}
}
for (k = 0; k < from_array.length; k++) {
if (from_array[k] == id_this) {
from_array.splice(k, 1);
break;
}
}
}
else {
for (i = 0; i < select_field.length ;i++) {
if (select_field[i] == ('`' + id_this + '`.`' + col +'`')) {
select_field.splice(i,1);
break;
}
}
for (k = 0 ;k < from_array.length;k++){
if(from_array[k] == id_this){
from_array.splice(k,1);
break;
}
}
}
}
/**
@ -1204,61 +1215,65 @@ function add_object()
var sum = 0;
var init = history_array.length;
if (rel.value != '--') {
if (document.getElementById('Query').value == "") {
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
if (document.getElementById('Query').value === "") {
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty";
document.getElementById('pmd_hint').style.display = 'block';
return;
}
var p = document.getElementById('Query');
var where_obj = new where(rel.value,p.value);//make where object
history_array.push(new history(col_name,where_obj,tab_name,h_tabs[downer + '.' + tab_name],"Where"));
var where_obj = new where(rel.value, p.value);//make where object
history_array.push(new history(col_name, where_obj, tab_name, h_tabs[downer + '.' + tab_name], "Where"));
sum = sum + 1;
rel.value = '--';
p.value = "";
}
if (document.getElementById('new_name').value !="") {
if (document.getElementById('new_name').value !== "") {
var rename_obj = new rename(document.getElementById('new_name').value);//make Rename object
history_array.push(new history(col_name,rename_obj,tab_name,h_tabs[downer + '.' + tab_name],"Rename"));
history_array.push(new history(col_name, rename_obj, tab_name, h_tabs[downer + '.' + tab_name], "Rename"));
sum = sum + 1;
document.getElementById('new_name').value = "" ;
document.getElementById('new_name').value = "";
}
if (document.getElementById('operator').value != '---') {
var aggregate_obj = new aggregate(document.getElementById('operator').value) ;
history_array.push(new history(col_name,aggregate_obj,tab_name,h_tabs[downer + '.' + tab_name],"Aggregate"));
var aggregate_obj = new aggregate(document.getElementById('operator').value);
history_array.push(new history(col_name, aggregate_obj, tab_name, h_tabs[downer + '.' + tab_name], "Aggregate"));
sum = sum + 1;
document.getElementById('operator').value = '---';
//make aggregate operator
}
if (document.getElementById('groupby').checked == true ) {
history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[downer + '.' +tab_name],"GroupBy"));
if (document.getElementById('groupby').checked === true) {
history_array.push(new history(col_name, 'GroupBy', tab_name, h_tabs[downer + '.' + tab_name], "GroupBy"));
sum = sum + 1;
document.getElementById('groupby').checked = false;
//make groupby
}
if (document.getElementById('h_rel_opt').value != '--') {
if (document.getElementById('having').value == "") {
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
if (document.getElementById('having').value === "") {
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty";
document.getElementById('pmd_hint').style.display = 'block';
return;
return;
}
var p = document.getElementById('having');
var where_obj = new having(document.getElementById('h_rel_opt').value,p.value,document.getElementById('h_operator').value);//make where object
history_array.push(new history(col_name,where_obj,tab_name,h_tabs[downer + '.' + tab_name],"Having"));
var where_obj = new having(
document.getElementById('h_rel_opt').value,
p.value,
document.getElementById('h_operator').value
);//make where object
history_array.push(new history(col_name, where_obj, tab_name, h_tabs[downer + '.' + tab_name], "Having"));
sum = sum + 1;
document.getElementById('h_rel_opt').value = '--';
document.getElementById('h_operator').value = '---';
p.value = ""; //make having
}
if (document.getElementById('orderby').checked == true) {
history_array.push(new history(col_name,'OrderBy',tab_name,h_tabs[downer + '.' + tab_name],"OrderBy"));
if (document.getElementById('orderby').checked === true) {
history_array.push(new history(col_name, 'OrderBy', tab_name, h_tabs[downer + '.' + tab_name], "OrderBy"));
sum = sum + 1;
document.getElementById('orderby').checked = false;
//make orderby
}
PMA_ajaxShowMessage($.sprintf(PMA_messages['strObjectsCreated'], sum));
PMA_ajaxShowMessage($.sprintf(PMA_messages.strObjectsCreated, sum));
//output sum new objects created
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(init,history_array.length);
existingDiv.innerHTML = display(init, history_array.length);
Close_option();
panel(0);
}

View File

@ -13,15 +13,15 @@ function update_config()
var conf_do = "binlog_do_db=";
var database_list = '';
if ($('#db_select option:selected').size() == 0) {
if ($('#db_select option:selected').size() === 0) {
$('#rep').text(conf_prefix);
} else if ($('#db_type option:selected').val() == 'all') {
$('#db_select option:selected').each(function() {
$('#db_select option:selected').each(function () {
database_list += conf_ignore + $(this).val() + "\n";
});
$('#rep').text(conf_prefix + database_list);
} else {
$('#db_select option:selected').each(function() {
$('#db_select option:selected').each(function () {
database_list += conf_do + $(this).val() + "\n";
});
$('#rep').text(conf_prefix + database_list);
@ -31,7 +31,7 @@ function update_config()
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('replication.js', function() {
AJAX.registerTeardown('replication.js', function () {
$('#db_type').unbind('change');
$('#db_select').unbind('change');
$('#master_status_href').unbind('click');
@ -43,30 +43,30 @@ AJAX.registerTeardown('replication.js', function() {
$('#db_reset_href').unbind('click');
});
AJAX.registerOnload('replication.js', function() {
AJAX.registerOnload('replication.js', function () {
$('#rep').text(conf_prefix);
$('#db_type').change(update_config);
$('#db_select').change(update_config);
$('#master_status_href').click(function() {
$('#master_status_href').click(function () {
$('#replication_master_section').toggle();
});
$('#master_slaves_href').click(function() {
});
$('#master_slaves_href').click(function () {
$('#replication_slaves_section').toggle();
});
$('#slave_status_href').click(function() {
});
$('#slave_status_href').click(function () {
$('#replication_slave_section').toggle();
});
$('#slave_control_href').click(function() {
});
$('#slave_control_href').click(function () {
$('#slave_control_gui').toggle();
});
$('#slave_errormanagement_href').click(function() {
});
$('#slave_errormanagement_href').click(function () {
$('#slave_errormanagement_gui').toggle();
});
$('#slave_synchronization_href').click(function() {
});
$('#slave_synchronization_href').click(function () {
$('#slave_synchronization_gui').toggle();
});
$('#db_reset_href').click(function() {
});
$('#db_reset_href').click(function () {
$('#db_select option:selected').prop('selected', false);
});
});
});

View File

@ -16,17 +16,17 @@ var RTE = {
object: function (type) {
$.extend(this, RTE.COMMON);
switch (type) {
case 'routine':
$.extend(this, RTE.ROUTINE);
break;
case 'trigger':
// nothing extra yet for triggers
break;
case 'event':
$.extend(this, RTE.EVENT);
break;
default:
break;
case 'routine':
$.extend(this, RTE.ROUTINE);
break;
case 'trigger':
// nothing extra yet for triggers
break;
case 'event':
$.extend(this, RTE.EVENT);
break;
default:
break;
}
},
/**
@ -72,7 +72,7 @@ RTE.COMMON = {
$elm = $('table.rte_table').last().find('input[name=item_name]');
if ($elm.val() === '') {
$elm.focus();
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
$elm = $('table.rte_table').find('textarea[name=item_definition]');
@ -83,7 +83,7 @@ RTE.COMMON = {
else {
$('textarea[name=item_definition]').last().focus();
}
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
// The validation has so far passed, so now
@ -119,17 +119,17 @@ RTE.COMMON = {
* for jQueryUI dialog buttons
*/
var button_options = {};
button_options[PMA_messages['strClose']] = function () {
button_options[PMA_messages.strClose] = function () {
$(this).dialog("close").remove();
};
/**
* Display the dialog to the user
*/
var $ajaxDialog = $('<div>' + data.message + '</div>').dialog({
width: 500,
buttons: button_options,
title: data.title
});
width: 500,
buttons: button_options,
title: data.title
});
// Attach syntax highlited editor to export dialog
/**
* @var $elm jQuery object containing the reference
@ -176,7 +176,7 @@ RTE.COMMON = {
PMA_ajaxRemoveMessage($msg);
// Now define the function that is called when
// the user presses the "Go" button
that.buttonOptions[PMA_messages['strGo']] = function () {
that.buttonOptions[PMA_messages.strGo] = function () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof CodeMirror != 'undefined') {
@ -189,7 +189,7 @@ RTE.COMMON = {
*/
var data = $('form.rte_form').last().serialize();
$msg = PMA_ajaxShowMessage(
PMA_messages['strProcessingRequest']
PMA_messages.strProcessingRequest
);
var url = $('form.rte_form').last().attr('action');
$.post(url, data, function (data) {
@ -290,22 +290,22 @@ RTE.COMMON = {
}); // end $.post()
} // end "if (that.validate())"
}; // end of function that handles the submission of the Editor
that.buttonOptions[PMA_messages['strClose']] = function () {
that.buttonOptions[PMA_messages.strClose] = function () {
$(this).dialog("close");
};
/**
* Display the dialog to the user
*/
that.$ajaxDialog = $('<div>' + data.message + '</div>').dialog({
width: 700,
minWidth: 500,
buttons: that.buttonOptions,
title: data.title,
modal: true,
close: function () {
$(this).remove();
}
});
width: 700,
minWidth: 500,
buttons: that.buttonOptions,
title: data.title,
modal: true,
close: function () {
$(this).remove();
}
});
that.$ajaxDialog.find('input[name=item_name]').focus();
that.$ajaxDialog.find('input.datefield, input.datetimefield').each(function () {
PMA_addDatepicker($(this).css('width', '95%'));
@ -361,7 +361,7 @@ RTE.COMMON = {
* @var msg jQuery object containing the reference to
* the AJAX message shown to the user
*/
var $msg = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) {
if (data.success === true) {
/**
@ -430,7 +430,7 @@ RTE.EVENT = {
$elm = this.$ajaxDialog.find('input[name=item_interval_value]');
if ($elm.val() === '') {
$elm.focus();
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
} else {
@ -438,7 +438,7 @@ RTE.EVENT = {
$elm = this.$ajaxDialog.find('input[name=item_execute_at]');
if ($elm.val() === '') {
$elm.focus();
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
}
@ -516,7 +516,7 @@ RTE.ROUTINE = {
}
});
if (! isSuccess) {
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
this.$ajaxDialog.find('table.routine_params_table').last().find('tr').each(function () {
@ -533,7 +533,7 @@ RTE.ROUTINE = {
}
});
if (! isSuccess) {
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
if (this.$ajaxDialog.find('select[name=item_type]').find(':selected').val() === 'FUNCTION') {
@ -544,7 +544,7 @@ RTE.ROUTINE = {
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR')
&& $returnlen.val() === '') {
$returnlen.focus();
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return false;
}
}
@ -552,7 +552,7 @@ RTE.ROUTINE = {
// A function must contain a RETURN statement in its definition
if (this.$ajaxDialog.find('table.rte_table').find('textarea[name=item_definition]').val().toUpperCase().indexOf('RETURN') < 0) {
this.syntaxHiglighter.focus();
alert(PMA_messages['MissingReturn']);
alert(PMA_messages.MissingReturn);
return false;
}
}
@ -665,13 +665,13 @@ RTE.ROUTINE = {
if (data.dialog) {
// Define the function that is called when
// the user presses the "Go" button
that.buttonOptions[PMA_messages['strGo']] = function () {
that.buttonOptions[PMA_messages.strGo] = function () {
/**
* @var data Form data to be sent in the AJAX request
*/
var data = $('form.rte_form').last().serialize();
$msg = PMA_ajaxShowMessage(
PMA_messages['strProcessingRequest']
PMA_messages.strProcessingRequest
);
$.post('db_routines.php', data, function (data) {
if (data.success === true) {
@ -684,7 +684,7 @@ RTE.ROUTINE = {
}
});
};
that.buttonOptions[PMA_messages['strClose']] = function () {
that.buttonOptions[PMA_messages.strClose] = function () {
$(this).dialog("close");
};
/**
@ -766,7 +766,7 @@ $(function () {
*/
$('a.ajax.drop_anchor').live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object();
var dialog = new RTE.object();
dialog.dropDialog($(this));
}); // end $.live()

View File

@ -11,7 +11,7 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('server_databases.js', function() {
AJAX.registerTeardown('server_databases.js', function () {
$("#dbStatsForm").die('submit');
$('#create_database_form.ajax').die('submit');
});
@ -23,11 +23,11 @@ AJAX.registerTeardown('server_databases.js', function() {
* Drop Databases
*
*/
AJAX.registerOnload('server_databases.js', function() {
AJAX.registerOnload('server_databases.js', function () {
/**
* Attach Event Handler for 'Drop Databases'
*/
$("#dbStatsForm").live('submit', function(event) {
$("#dbStatsForm").live('submit', function (event) {
event.preventDefault();
var $form = $(this);
@ -62,16 +62,16 @@ AJAX.registerOnload('server_databases.js', function() {
$form.prop('action')
+ '?' + $(this).serialize()
+ '&drop_selected_dbs=1&is_js_confirmed=1&ajax_request=true',
function(url) {
function (url) {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest, false);
$.post(url, function(data) {
if (data.success == true) {
$.post(url, function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
var $rowsToRemove = $form.find('tr.removeMe');
var $databasesCount = $('#databases_count');
var newCount = parseInt($databasesCount.text()) - $rowsToRemove.length;
var newCount = parseInt($databasesCount.text(), 10) - $rowsToRemove.length;
$databasesCount.text(newCount);
$rowsToRemove.remove();
@ -82,13 +82,14 @@ AJAX.registerOnload('server_databases.js', function() {
PMA_ajaxShowMessage(data.error, false);
}
}); // end $.post()
}); // end $.PMA_confirm()
}) ; //end of Drop Database action
}
); // end $.PMA_confirm()
}); //end of Drop Database action
/**
* Attach Ajax event handlers for 'Create Database'.
*/
$('#create_database_form.ajax').live('submit', function(event) {
$('#create_database_form.ajax').live('submit', function (event) {
event.preventDefault();
$form = $(this);
@ -96,15 +97,15 @@ AJAX.registerOnload('server_databases.js', function() {
var newDbNameInput = $form.find('input[name=new_db]');
if (newDbNameInput.val() === '') {
newDbNameInput.focus();
alert(PMA_messages['strFormEmpty']);
alert(PMA_messages.strFormEmpty);
return;
}
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
PMA_prepareForAjaxRequest($form);
$.post($form.attr('action'), $form.serialize(), function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
//Append database's row to table
@ -114,7 +115,7 @@ AJAX.registerOnload('server_databases.js', function() {
.PMA_sort_table('.name');
var $databases_count_object = $('#databases_count');
var databases_count = parseInt($databases_count_object.text()) + 1;
var databases_count = parseInt($databases_count_object.text(), 10) + 1;
$databases_count_object.text(databases_count);
PMA_reloadNavigation();
} else {

View File

@ -4,12 +4,12 @@
*/
var pma_theme_image; // filled in server_plugins.php
AJAX.registerOnload('server_plugins.js', function() {
AJAX.registerOnload('server_plugins.js', function () {
// Add tabs
$('#pluginsTabs').tabs({
// Tab persistence
cookie: { name: 'pma_serverStatusTabs', expires: 1 },
show: function(event, ui) {
show: function (event, ui) {
// Fixes line break in the menu bar when the page overflows and scrollbar appears
$('#topmenu').menuResizer('resize');
// 'Plugins' tab is too high due to hiding of 'Modules' by negative left position,
@ -22,7 +22,7 @@ AJAX.registerOnload('server_plugins.js', function() {
// Make columns sortable, but only for tables with more than 1 data row
var $tables = $('#plugins_plugins table:has(tbody tr + tr)');
$tables.tablesorter({
sortList: [[0,0]],
sortList: [[0, 0]],
widgets: ['zebra']
});
$tables.find('thead th')

View File

@ -16,14 +16,14 @@
*/
function checkAddUser(the_form)
{
if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value == '') {
alert(PMA_messages['strHostEmpty']);
if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value === '') {
alert(PMA_messages.strHostEmpty);
the_form.elements['hostname'].focus();
return false;
}
if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value == '') {
alert(PMA_messages['strUserEmpty']);
if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value === '') {
alert(PMA_messages.strUserEmpty);
the_form.elements['username'].focus();
return false;
}
@ -60,9 +60,9 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
.insertAfter($curr_last_row)
.find('input:checkbox')
.attr('id', new_last_row_id)
.val(function() {
.val(function () {
//the insert messes up the &amp;27; part. let's fix it
return $(this).val().replace(/&/,'&amp;');
return $(this).val().replace(/&/, '&amp;');
})
.end()
.find('label')
@ -73,7 +73,7 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
//Let us sort the table alphabetically
$("#usersForm").find('tbody').PMA_sort_table('label');
$("#initials_table").find('td:contains('+new_user_initial+')')
$("#initials_table").find('td:contains(' + new_user_initial + ')')
.html(new_user_initial_string);
//update the checkall checkbox
@ -87,8 +87,8 @@ function addUser($form)
}
//We also need to post the value of the submit button in order to get this to work correctly
$.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $("input[name=adduser_submit]").val(), function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $("input[name=adduser_submit]").val(), function (data) {
if (data.success === true) {
// Refresh navigation, if we created a database with the name
// that is the same as the username of the new user
if ($('#add_user_dialog #createdb-1:checked').length) {
@ -107,7 +107,7 @@ function addUser($form)
//Remove the empty notice div generated due to a NULL query passed to PMA_getMessage()
var $notice_class = $("#result_query").find('.notice');
if ($notice_class.text() == '') {
if ($notice_class.text() === '') {
$notice_class.remove();
}
if ($('#fieldset_add_user a.ajax').attr('name') == 'db_specific') {
@ -121,20 +121,20 @@ function addUser($form)
url = url + "&ajax_request=true&db_specific=true";
/* post request for get the updated userForm table */
$.post($form.attr('action'), url, function(priv_data) {
$.post($form.attr('action'), url, function (priv_data) {
/*Remove the old userForm table*/
if ($('#userFormDiv').length != 0) {
if ($('#userFormDiv').length !== 0) {
$('#userFormDiv').remove();
} else {
$("#usersForm").remove();
}
if (priv_data.success == true) {
if (priv_data.success === true) {
$('<div id="userFormDiv"></div>')
.html(priv_data.user_form)
.insertAfter('#result_query');
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + priv_data.error, false);
}
});
} else {
@ -179,7 +179,7 @@ AJAX.registerTeardown('server_privileges.js', function() {
$('#checkbox_drop_users_db').unbind('click');
});
AJAX.registerOnload('server_privileges.js', function() {
AJAX.registerOnload('server_privileges.js', function () {
/**
* Display a warning if there is already a user by the name entered as the username.
*/
@ -214,16 +214,16 @@ AJAX.registerOnload('server_privileges.js', function() {
* @name add_user_click
*
*/
$("#fieldset_add_user a.ajax").live("click", function(event) {
$("#fieldset_add_user a.ajax").live("click", function (event) {
/** @lends jQuery */
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage();
$.get($(this).attr("href"), {'ajax_request':true}, function(data) {
if (data.success == true) {
$.get($(this).attr("href"), {'ajax_request': true}, function (data) {
if (data.success === true) {
$('#page_content').hide();
var $div = $('#add_user_dialog');
if ($div.length == 0) {
if ($div.length === 0) {
$div = $('<div id="add_user_dialog" style="margin: 0.5em;"></div>')
.insertBefore('#page_content');
} else {
@ -257,13 +257,13 @@ AJAX.registerOnload('server_privileges.js', function() {
* @memberOf jQuery
* @name reload_privileges_click
*/
$("#reload_privileges_anchor.ajax").live("click", function(event) {
$("#reload_privileges_anchor.ajax").live("click", function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage(PMA_messages['strReloadingPrivileges']);
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strReloadingPrivileges);
$.get($(this).attr("href"), {'ajax_request': true}, function(data) {
if (data.success == true) {
$.get($(this).attr("href"), {'ajax_request': true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msgbox);
} else {
PMA_ajaxShowMessage(data.error, false);
@ -279,15 +279,15 @@ AJAX.registerOnload('server_privileges.js', function() {
* @memberOf jQuery
* @name revoke_user_click
*/
$("#fieldset_delete_user_footer #buttonGo.ajax").live('click', function(event) {
$("#fieldset_delete_user_footer #buttonGo.ajax").live('click', function (event) {
event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strRemovingSelectedUsers']);
PMA_ajaxShowMessage(PMA_messages.strRemovingSelectedUsers);
var $form = $("#usersForm");
$.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).val() + "&ajax_request=true", function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).val() + "&ajax_request=true", function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
// Refresh navigation, if we droppped some databases with the name
// that is the same as the username of the deleted user
@ -295,12 +295,12 @@ AJAX.registerOnload('server_privileges.js', function() {
PMA_reloadNavigation();
}
//Remove the revoked user from the users list
$form.find("input:checkbox:checked").parents("tr").slideUp("medium", function() {
$form.find("input:checkbox:checked").parents("tr").slideUp("medium", function () {
var this_user_initial = $(this).find('input:checkbox').val().charAt(0).toUpperCase();
$(this).remove();
//If this is the last user with this_user_initial, remove the link from #initials_table
if ($("#tableuserrights").find('input:checkbox[value^=' + this_user_initial + ']').length == 0) {
if ($("#tableuserrights").find('input:checkbox[value^=' + this_user_initial + ']').length === 0) {
$("#initials_table").find('td > a:contains(' + this_user_initial + ')').parent('td').html(this_user_initial);
}
@ -333,7 +333,7 @@ AJAX.registerOnload('server_privileges.js', function() {
* @memberOf jQuery
* @name edit_user_click
*/
$("a.edit_user_anchor.ajax").live('click', function(event) {
$("a.edit_user_anchor.ajax").live('click', function (event) {
/** @lends jQuery */
event.preventDefault();
@ -345,15 +345,15 @@ AJAX.registerOnload('server_privileges.js', function() {
$.get(
$(this).attr('href'),
{
'ajax_request':true,
'ajax_request': true,
'edit_user_dialog': true,
'token': token
},
function(data) {
if (data.success == true) {
function (data) {
if (data.success === true) {
$('#page_content').hide();
var $div = $('#edit_user_dialog');
if ($div.length == 0) {
if ($div.length === 0) {
$div = $('<div id="edit_user_dialog" style="margin: 0.5em;"></div>')
.insertBefore('#page_content');
} else {
@ -377,7 +377,7 @@ AJAX.registerOnload('server_privileges.js', function() {
* @memberOf jQuery
* @name edit_user_submit
*/
$("#edit_user_dialog").find("form.ajax").live('submit', function(event) {
$("#edit_user_dialog").find("form.ajax").live('submit', function (event) {
/** @lends jQuery */
event.preventDefault();
@ -387,7 +387,7 @@ AJAX.registerOnload('server_privileges.js', function() {
return false;
}
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$t.append('<input type="hidden" name="ajax_request" value="true" />');
@ -401,14 +401,14 @@ AJAX.registerOnload('server_privileges.js', function() {
*/
var curr_submit_value = $t.find('.tblFooters').find('input:submit').val();
// If any option other than 'keep the old one'(option 4) is chosen, we need to remove
// If any option other than 'keep the old one'(option 4) is chosen, we need to remove
// the old one from the table.
var $row_to_remove;
if (curr_submit_name == 'change_copy'
&& $('input[name=mode]:checked', '#fieldset_mode').val() != '4') {
var old_username = $t.find('input[name="old_username"]').val();
var old_hostname = $t.find('input[name="old_hostname"]').val();
$('#usersForm tbody tr').each(function() {
$('#usersForm tbody tr').each(function () {
var $tr = $(this);
if ($tr.find('td:nth-child(2) label').text() == old_username
&& $tr.find('td:nth-child(3)').text() == old_hostname) {
@ -418,8 +418,8 @@ AJAX.registerOnload('server_privileges.js', function() {
});
}
$.post($t.attr('action'), $t.serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function(data) {
if (data.success == true) {
$.post($t.attr('action'), $t.serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function (data) {
if (data.success === true) {
$('#page_content').show();
$("#edit_user_dialog").remove();
@ -432,13 +432,13 @@ AJAX.registerOnload('server_privileges.js', function() {
'margin-top' : '0.5em'
});
var $notice_class = $("#result_query").find('.notice');
if ($notice_class.text() == '') {
if ($notice_class.text() === '') {
$notice_class.remove();
}
} //Show SQL Query that was executed
// Remove the old row if the old user is deleted
if ($row_to_remove != null) {
if ($row_to_remove !== null) {
$row_to_remove.remove();
}
@ -453,7 +453,7 @@ AJAX.registerOnload('server_privileges.js', function() {
// and on the global page when adjusting global privileges,
// but not on the global page when adjusting db-specific privileges.
var reload_privs = false;
if (data.db_specific_privs == false || (db_priv_page == data.db_specific_privs)) {
if (data.db_specific_privs === false || (db_priv_page == data.db_specific_privs)) {
reload_privs = true;
}
if (data.db_wildcard_privs) {
@ -485,22 +485,22 @@ AJAX.registerOnload('server_privileges.js', function() {
* @memberOf jQuery
* @name export_user_click
*/
$("button.mult_submit[value=export]").live('click', function(event) {
$("button.mult_submit[value=export]").live('click', function (event) {
event.preventDefault();
// can't export if no users checked
if ($(this.form).find("input:checked").length == 0) {
if ($(this.form).find("input:checked").length === 0) {
return;
}
var $msgbox = PMA_ajaxShowMessage();
var button_options = {};
button_options[PMA_messages['strClose']] = function() {
button_options[PMA_messages.strClose] = function () {
$(this).dialog("close");
};
$.post(
$(this.form).prop('action'),
$(this.form).serialize() + '&submit_mult=export&ajax_request=true',
function(data) {
if (data.success == true) {
function (data) {
if (data.success === true) {
var $ajaxDialog = $('<div />')
.append(data.message)
.dialog({
@ -545,18 +545,18 @@ AJAX.registerOnload('server_privileges.js', function() {
);
}
$("a.export_user_anchor.ajax").live('click', function(event) {
$("a.export_user_anchor.ajax").live('click', function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage();
/**
* @var button_options Object containing options for jQueryUI dialog buttons
*/
var button_options = {};
button_options[PMA_messages['strClose']] = function() {
button_options[PMA_messages.strClose] = function () {
$(this).dialog("close");
};
$.get($(this).attr('href'), {'ajax_request': true}, function(data) {
if (data.success == true) {
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
if (data.success === true) {
var $ajaxDialog = $('<div />')
.append(data.message)
.dialog({
@ -593,11 +593,11 @@ AJAX.registerOnload('server_privileges.js', function() {
* @name paginate_users_table_click
* @memberOf jQuery
*/
$("#initials_table").find("a.ajax").live('click', function(event) {
$("#initials_table").find("a.ajax").live('click', function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage();
$.get($(this).attr('href'), {'ajax_request' : true}, function(data) {
if (data.success == true) {
$.get($(this).attr('href'), {'ajax_request' : true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msgbox);
// This form is not on screen when first entering Privileges
// if there are more than 50 users
@ -617,10 +617,10 @@ AJAX.registerOnload('server_privileges.js', function() {
* Additional confirmation dialog after clicking
* 'Drop the databases...'
*/
$('#checkbox_drop_users_db').click(function() {
$('#checkbox_drop_users_db').click(function () {
var $this_checkbox = $(this);
if ($this_checkbox.is(':checked')) {
var is_confirmed = confirm(PMA_messages['strDropDatabaseStrongWarning'] + '\n' + $.sprintf(PMA_messages['strDoYouReally'], 'DROP DATABASE'));
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + $.sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
if (! is_confirmed) {
$this_checkbox.prop('checked', false);
}

View File

@ -1,25 +0,0 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @fileoverview functions used in server status pages
* @name Server Status
*/
var pma_token,
url_query,
server_time_diff,
server_os,
is_superuser,
server_db_isLocal;
// Add a tablesorter parser to properly handle thousands seperated numbers and SI prefixes
AJAX.registerOnload('server_status.js', function() {
var $js_data_form = $('#js_data');
pma_token = $js_data_form.find("input[name=pma_token]").val();
url_query = $js_data_form.find("input[name=url_query]").val();
server_time_diff = eval($js_data_form.find("input[name=server_time_diff]").val());
server_os = $js_data_form.find("input[name=server_os]").val();
is_superuser = $js_data_form.find("input[name=is_superuser]").val();
server_db_isLocal = $js_data_form.find("input[name=server_db_isLocal]").val();
});

View File

@ -8,27 +8,27 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('server_status_advisor.js', function() {
AJAX.registerTeardown('server_status_advisor.js', function () {
$('a[href="#openAdvisorInstructions"]').unbind('click');
$('#statustabs_advisor').html('');
$('#advisorDialog').remove();
$('#instructionsDialog').remove();
});
AJAX.registerOnload('server_status_advisor.js', function() {
AJAX.registerOnload('server_status_advisor.js', function () {
/**** Server config advisor ****/
var $dialog = $('<div />').attr('id', 'advisorDialog');
var $instructionsDialog = $('<div />')
.attr('id', 'instructionsDialog')
.html($('#advisorInstructionsDialog').html());
$('a[href="#openAdvisorInstructions"]').click(function() {
$('a[href="#openAdvisorInstructions"]').click(function () {
var dlgBtns = {};
dlgBtns[PMA_messages['strClose']] = function() {
dlgBtns[PMA_messages.strClose] = function () {
$(this).dialog('close');
};
$instructionsDialog.dialog({
title: PMA_messages['strAdvisorSystem'],
title: PMA_messages.strAdvisorSystem,
width: 700,
buttons: dlgBtns
});
@ -53,15 +53,15 @@ AJAX.registerOnload('server_status_advisor.js', function() {
}
if (data.run.fired.length > 0) {
$cnt.append('<p><b>' + PMA_messages['strPerformanceIssues'] + '</b></p>');
$cnt.append('<p><b>' + PMA_messages.strPerformanceIssues + '</b></p>');
$cnt.append('<table class="data" id="rulesFired" border="0"><thead><tr>' +
'<th>' + PMA_messages['strIssuse'] + '</th><th>' + PMA_messages['strRecommendation'] +
'<th>' + PMA_messages.strIssuse + '</th><th>' + PMA_messages.strRecommendation +
'</th></tr></thead><tbody></tbody></table>');
$tbody = $cnt.find('table#rulesFired');
var rc_stripped;
$.each(data.run.fired, function(key, value) {
$.each(data.run.fired, function (key, value) {
// recommendation may contain links, don't show those in overview table (clicking on them redirects the user)
rc_stripped = $.trim($('<div>').html(value.recommendation).text());
$tbody.append($tr = $('<tr class="linkElem noclick ' + (even ? 'even' : 'odd') + '"><td>' +
@ -69,20 +69,20 @@ AJAX.registerOnload('server_status_advisor.js', function() {
even = !even;
$tr.data('rule', value);
$tr.click(function() {
$tr.click(function () {
var rule = $(this).data('rule');
$dialog
.dialog({title: PMA_messages['strRuleDetails']})
.dialog({title: PMA_messages.strRuleDetails})
.html(
'<p><b>' + PMA_messages['strIssuse'] + ':</b><br />' + rule.issue + '</p>' +
'<p><b>' + PMA_messages['strRecommendation'] + ':</b><br />' + rule.recommendation + '</p>' +
'<p><b>' + PMA_messages['strJustification'] + ':</b><br />' + rule.justification + '</p>' +
'<p><b>' + PMA_messages['strFormula'] + ':</b><br />' + rule.formula + '</p>' +
'<p><b>' + PMA_messages['strTest'] + ':</b><br />' + rule.test + '</p>'
'<p><b>' + PMA_messages.strIssuse + ':</b><br />' + rule.issue + '</p>' +
'<p><b>' + PMA_messages.strRecommendation + ':</b><br />' + rule.recommendation + '</p>' +
'<p><b>' + PMA_messages.strJustification + ':</b><br />' + rule.justification + '</p>' +
'<p><b>' + PMA_messages.strFormula + ':</b><br />' + rule.formula + '</p>' +
'<p><b>' + PMA_messages.strTest + ':</b><br />' + rule.test + '</p>'
);
var dlgBtns = {};
dlgBtns[PMA_messages['strClose']] = function() {
dlgBtns[PMA_messages.strClose] = function () {
$(this).dialog('close');
};

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,19 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('server_status_queries.js', function() {
AJAX.registerTeardown('server_status_queries.js', function () {
var queryPieChart = $('#serverstatusquerieschart').data('queryPieChart');
if (queryPieChart) {
queryPieChart.destroy();
}
});
AJAX.registerOnload('server_status_queries.js', function() {
AJAX.registerOnload('server_status_queries.js', function () {
// Build query statistics chart
var cdata = [];
try {
$.each(jQuery.parseJSON($('#serverstatusquerieschart_data').text()), function(key, value) {
cdata.push([key, parseInt(value)]);
$.each(jQuery.parseJSON($('#serverstatusquerieschart_data').text()), function (key, value) {
cdata.push([key, parseInt(value, 10)]);
});
$('#serverstatusquerieschart').data(
'queryPieChart',
@ -34,7 +34,7 @@ AJAX.registerOnload('server_status_queries.js', function() {
PMA_tooltip(
$('table.sortable>thead>tr:first').find('th'),
'th',
PMA_messages['strSortHint']
PMA_messages.strSortHint
);
initTableSorter('statustabs_queries');
});

View File

@ -1,28 +1,28 @@
// TODO: tablesorter shouldn't sort already sorted columns
function initTableSorter(tabid) {
var $table, opts;
switch(tabid) {
case 'statustabs_queries':
$table = $('#serverstatusqueriesdetails');
opts = {
sortList: [[3, 1]],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'fancyNumber' },
2: { sorter: 'fancyNumber' }
}
};
break;
case 'statustabs_allvars':
$table = $('#serverstatusvariables');
opts = {
sortList: [[0, 0]],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'withinSpanNumber' }
}
};
break;
switch (tabid) {
case 'statustabs_queries':
$table = $('#serverstatusqueriesdetails');
opts = {
sortList: [[3, 1]],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'fancyNumber' },
2: { sorter: 'fancyNumber' }
}
};
break;
case 'statustabs_allvars':
$table = $('#serverstatusvariables');
opts = {
sortList: [[0, 0]],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'withinSpanNumber' }
}
};
break;
}
$table.tablesorter(opts);
$table.find('tr:first th')
@ -32,23 +32,33 @@ function initTableSorter(tabid) {
$(function () {
$.tablesorter.addParser({
id: "fancyNumber",
is: function(s) {
return /^[0-9]?[0-9,\.]*\s?(k|M|G|T|%)?$/.test(s);
is: function (s) {
return (/^[0-9]?[0-9,\.]*\s?(k|M|G|T|%)?$/).test(s);
},
format: function(s) {
format: function (s) {
var num = jQuery.tablesorter.formatFloat(
s.replace(PMA_messages['strThousandsSeparator'], '')
.replace(PMA_messages['strDecimalSeparator'], '.')
s.replace(PMA_messages.strThousandsSeparator, '')
.replace(PMA_messages.strDecimalSeparator, '.')
);
var factor = 1;
switch (s.charAt(s.length - 1)) {
case '%': factor = -2; break;
// Todo: Complete this list (as well as in the regexp a few lines up)
case 'k': factor = 3; break;
case 'M': factor = 6; break;
case 'G': factor = 9; break;
case 'T': factor = 12; break;
case '%':
factor = -2;
break;
// Todo: Complete this list (as well as in the regexp a few lines up)
case 'k':
factor = 3;
break;
case 'M':
factor = 6;
break;
case 'G':
factor = 9;
break;
case 'T':
factor = 12;
break;
}
return num * Math.pow(10, factor);
@ -58,10 +68,10 @@ $(function () {
$.tablesorter.addParser({
id: "withinSpanNumber",
is: function(s) {
return /<span class="original"/.test(s);
is: function (s) {
return (/<span class="original"/).test(s);
},
format: function(s, table, html) {
format: function (s, table, html) {
var res = html.innerHTML.match(/<span(\s*style="display:none;"\s*)?\s*class="original">(.*)?<\/span>/);
return (res && res.length >= 3) ? res[2] : 0;
},

View File

@ -8,19 +8,19 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('server_status_variables.js', function() {
AJAX.registerTeardown('server_status_variables.js', function () {
$('#filterAlert').unbind('change');
$('#filterText').unbind('keyup');
$('#filterCategory').unbind('change');
$('#dontFormat').unbind('change');
});
AJAX.registerOnload('server_status_variables.js', function() {
AJAX.registerOnload('server_status_variables.js', function () {
/*** Table sort tooltip ***/
PMA_tooltip(
$('table.sortable>thead>tr:first').find('th'),
'th',
PMA_messages['strSortHint']
PMA_messages.strSortHint
);
initTableSorter('statustabs_allvars');
@ -32,17 +32,17 @@ AJAX.registerOnload('server_status_variables.js', function() {
var text = ''; // Holds filter text
/* 3 Filtering functions */
$('#filterAlert').change(function() {
$('#filterAlert').change(function () {
alertFilter = this.checked;
filterVariables();
});
$('#filterCategory').change(function() {
$('#filterCategory').change(function () {
categoryFilter = $(this).val();
filterVariables();
});
$('#dontFormat').change(function() {
$('#dontFormat').change(function () {
// Hiding the table while changing values speeds up the process a lot
$('#serverstatusvariables').hide();
$('#serverstatusvariables td.value span.original').toggle(this.checked);
@ -50,9 +50,9 @@ AJAX.registerOnload('server_status_variables.js', function() {
$('#serverstatusvariables').show();
}).trigger('change');
$('#filterText').keyup(function(e) {
$('#filterText').keyup(function (e) {
var word = $(this).val().replace(/_/g, ' ');
if (word.length == 0) {
if (word.length === 0) {
textFilter = null;
} else {
textFilter = new RegExp("(^| )" + word, 'i');
@ -71,7 +71,7 @@ AJAX.registerOnload('server_status_variables.js', function() {
}
if (section.length > 1) {
$('#linkSuggestions span').each(function() {
$('#linkSuggestions span').each(function () {
if ($(this).attr('class').indexOf('status_' + section) != -1) {
useful_links++;
$(this).css('display', '');
@ -88,10 +88,10 @@ AJAX.registerOnload('server_status_variables.js', function() {
}
odd_row = false;
$('#serverstatusvariables th.name').each(function() {
if ((textFilter == null || textFilter.exec($(this).text()))
&& (! alertFilter || $(this).next().find('span.attention').length>0)
&& (categoryFilter.length == 0 || $(this).parent().hasClass('s_' + categoryFilter))
$('#serverstatusvariables th.name').each(function () {
if ((textFilter === null || textFilter.exec($(this).text()))
&& (! alertFilter || $(this).next().find('span.attention').length > 0)
&& (categoryFilter.length === 0 || $(this).parent().hasClass('s_' + categoryFilter))
) {
odd_row = ! odd_row;
$(this).parent().css('display', '');

View File

@ -3,21 +3,21 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('server_variables.js', function() {
AJAX.registerTeardown('server_variables.js', function () {
$('#serverVariables .var-row').unbind('hover');
$('#filterText').unbind('keyup');
$('a.editLink').die('click');
$('#serverVariables').find('.var-name').find('a img').remove();
});
AJAX.registerOnload('server_variables.js', function() {
AJAX.registerOnload('server_variables.js', function () {
var $editLink = $('a.editLink');
var $saveLink = $('a.saveLink');
var $cancelLink = $('a.cancelLink');
var $filterField = $('#filterText');
/* Show edit link on hover */
$('#serverVariables').delegate('.var-row', 'hover', function(event) {
$('#serverVariables').delegate('.var-row', 'hover', function (event) {
if (event.type === 'mouseenter') {
var $elm = $(this).find('.var-value');
// Only add edit element if the element is not being edited
@ -38,10 +38,10 @@ AJAX.registerOnload('server_variables.js', function() {
});
/* Event handler for variables filter */
$filterField.keyup(function() {
$filterField.keyup(function () {
var textFilter = null, val = $(this).val();
if (val.length !== 0) {
textFilter = new RegExp("(^| )"+val.replace(/_/g,' '),'i');
textFilter = new RegExp("(^| )" + val.replace(/_/g, ' '), 'i');
}
filterVariables(textFilter);
});
@ -54,9 +54,9 @@ AJAX.registerOnload('server_variables.js', function() {
/* Filters the rows by the user given regexp */
function filterVariables(textFilter) {
var mark_next = false, $row, odd_row = false;
$('#serverVariables .var-row').not('.var-header').each(function() {
$('#serverVariables .var-row').not('.var-header').each(function () {
$row = $(this);
if ( mark_next
if (mark_next
|| textFilter === null
|| textFilter.exec($row.find('.var-name').text())
) {
@ -80,7 +80,7 @@ AJAX.registerOnload('server_variables.js', function() {
/* Allows the user to edit a server variable */
function editVariable(link) {
var $cell = $(link).parent();
var varName = $cell.parent().find('.var-name').text().replace(/ /g,'_');
var varName = $cell.parent().find('.var-name').text().replace(/ /g, '_');
var $mySaveLink = $saveLink.clone().show();
var $myCancelLink = $cancelLink.clone().show();
var $msgbox = PMA_ajaxShowMessage();
@ -90,14 +90,14 @@ AJAX.registerOnload('server_variables.js', function() {
.find('a.editLink')
.remove(); // remove edit link
$mySaveLink.click(function() {
$mySaveLink.click(function () {
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.get($(this).attr('href'), {
ajax_request: true,
type: 'setval',
varName: varName,
varValue: $cell.find('input').val()
}, function(data) {
}, function (data) {
if (data.success) {
$cell
.html(data.variable)
@ -112,7 +112,7 @@ AJAX.registerOnload('server_variables.js', function() {
return false;
});
$myCancelLink.click(function() {
$myCancelLink.click(function () {
$cell
.html($cell.data('content'))
.removeClass('edit');
@ -123,9 +123,9 @@ AJAX.registerOnload('server_variables.js', function() {
ajax_request: true,
type: 'getval',
varName: varName
}, function(data) {
}, function (data) {
if (data.success === true) {
var $editor = $('<div />', {'class':'serverVariableEditor'})
var $editor = $('<div />', {'class': 'serverVariableEditor'})
.append($myCancelLink)
.append(' ')
.append($mySaveLink)
@ -141,7 +141,7 @@ AJAX.registerOnload('server_variables.js', function() {
.html($editor)
.find('input')
.focus()
.keydown(function(event) { // Keyboard shortcuts
.keydown(function (event) { // Keyboard shortcuts
if (event.keyCode === 13) { // Enter key
$mySaveLink.trigger('click');
} else if (event.keyCode === 27) { // Escape key

118
js/sql.js
View File

@ -46,10 +46,10 @@ function getFieldName($this_field)
var left_action_exist = !$('#table_results').find('th:first').hasClass('draggable');
// number of column span for checkbox and Actions
var left_action_skip = left_action_exist ? $('#table_results').find('th:first').attr('colspan') - 1 : 0;
var field_name = $('#table_results').find('thead').find('th:eq('+ (this_field_index - left_action_skip) + ') a').text();
var field_name = $('#table_results').find('thead').find('th:eq(' + (this_field_index - left_action_skip) + ') a').text();
// happens when just one row (headings contain no a)
if ("" == field_name) {
var $heading = $('#table_results').find('thead').find('th:eq('+ (this_field_index - left_action_skip) + ')').children('span');
if (field_name === '') {
var $heading = $('#table_results').find('thead').find('th:eq(' + (this_field_index - left_action_skip) + ')').children('span');
// may contain column comment enclosed in a span - detach it temporarily to read the column name
var $tempColComment = $heading.children().detach();
field_name = $heading.text();
@ -65,7 +65,7 @@ function getFieldName($this_field)
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('sql.js', function() {
AJAX.registerTeardown('sql.js', function () {
$('a.delete_row.ajax').unbind('click');
$('#bookmarkQueryForm').die('submit');
$('input#bkm_label').unbind('keyup');
@ -102,22 +102,22 @@ AJAX.registerTeardown('sql.js', function() {
* @name document.ready
* @memberOf jQuery
*/
AJAX.registerOnload('sql.js', function() {
AJAX.registerOnload('sql.js', function () {
// Delete row from SQL results
$('a.delete_row.ajax').click(function (e) {
e.preventDefault();
var question = $.sprintf(PMA_messages['strDoYouReally'], $(this).closest('td').find('div').text());
var question = $.sprintf(PMA_messages.strDoYouReally, $(this).closest('td').find('div').text());
var $link = $(this);
$link.PMA_confirm(question, $link.attr('href'), function (url) {
$msgbox = PMA_ajaxShowMessage();
$.get(url, {'ajax_request':true, 'is_js_confirmed': true}, function (data) {
$.get(url, {'ajax_request': true, 'is_js_confirmed': true}, function (data) {
if (data.success) {
PMA_ajaxShowMessage(data.message);
$link.closest('tr').remove();
} else {
PMA_ajaxShowMessage(data.error, false);
}
})
});
});
});
@ -135,7 +135,7 @@ AJAX.registerOnload('sql.js', function() {
});
/* Hides the bookmarkoptions checkboxes when the bookmark label is empty */
$('input#bkm_label').keyup(function() {
$('input#bkm_label').keyup(function () {
$('input#id_bkm_all_users, input#id_bkm_replace')
.parent()
.toggle($(this).val().length > 0);
@ -146,7 +146,7 @@ AJAX.registerOnload('sql.js', function() {
* triggered manually everytime the table of results is reloaded
* @memberOf jQuery
*/
$("#sqlqueryresults").live('makegrid', function() {
$("#sqlqueryresults").live('makegrid', function () {
PMA_makegrid($('#table_results')[0]);
});
@ -159,24 +159,24 @@ AJAX.registerOnload('sql.js', function() {
// do not add this link more than once
if (! $('#sqlqueryform').find('a').is('#togglequerybox')) {
$('<a id="togglequerybox"></a>')
.html(PMA_messages['strHideQueryBox'])
.html(PMA_messages.strHideQueryBox)
.appendTo("#sqlqueryform")
// initially hidden because at this point, nothing else
// appears under the link
.hide();
// Attach the toggling of the query box visibility to a click
$("#togglequerybox").bind('click', function() {
$("#togglequerybox").bind('click', function () {
var $link = $(this);
$link.siblings().slideToggle("fast");
if ($link.text() == PMA_messages['strHideQueryBox']) {
$link.text(PMA_messages['strShowQueryBox']);
if ($link.text() == PMA_messages.strHideQueryBox) {
$link.text(PMA_messages.strShowQueryBox);
// cheap trick to add a spacer between the menu tabs
// and "Show query box"; feel free to improve!
$('#togglequerybox_spacer').remove();
$link.before('<br id="togglequerybox_spacer" />');
} else {
$link.text(PMA_messages['strHideQueryBox']);
$link.text(PMA_messages.strHideQueryBox);
}
// avoid default click action
return false;
@ -189,7 +189,7 @@ AJAX.registerOnload('sql.js', function() {
*
* @memberOf jQuery
*/
$("#button_submit_query").live('click', function(event) {
$("#button_submit_query").live('click', function (event) {
var $form = $(this).closest("form");
// the Go button related to query submission was clicked,
// instead of the one related to Bookmarks, so empty the
@ -205,7 +205,7 @@ AJAX.registerOnload('sql.js', function() {
*
* @memberOf jQuery
*/
$("input[name=bookmark_variable]").bind("keypress", function(event) {
$("input[name=bookmark_variable]").bind("keypress", function (event) {
// force the 'Enter Key' to implicitly click the #button_submit_bookmark
var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
if (keycode == 13) { // keycode for enter key
@ -218,9 +218,9 @@ AJAX.registerOnload('sql.js', function() {
// section and hit enter, you expect it to do the
// same action as the Go button in that section.
$("#button_submit_bookmark").click();
return false;
return false;
} else {
return true;
return true;
}
});
@ -231,7 +231,7 @@ AJAX.registerOnload('sql.js', function() {
* @memberOf jQuery
* @name sqlqueryform_submit
*/
$("#sqlqueryform.ajax").live('submit', function(event) {
$("#sqlqueryform.ajax").live('submit', function (event) {
event.preventDefault();
var $form = $(this);
@ -247,8 +247,8 @@ AJAX.registerOnload('sql.js', function() {
PMA_prepareForAjaxRequest($form);
$.post($form.attr('action'), $form.serialize() , function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
// success happens if the query returns rows or not
//
// fade out previous messages, if any
@ -308,19 +308,19 @@ AJAX.registerOnload('sql.js', function() {
});
PMA_reloadNavigation();
}
$sqlqueryresults.show().trigger('makegrid');
$('#togglequerybox').show();
PMA_init_slider();
if (typeof data.action_bookmark == 'undefined') {
if ( $('#sqlqueryform input[name="retain_query_box"]').is(':checked') != true ) {
if ($('#sqlqueryform input[name="retain_query_box"]').is(':checked') !== true) {
if ($("#togglequerybox").siblings(":visible").length > 0) {
$("#togglequerybox").trigger('click');
}
}
}
} else if (data.success == false ) {
} else if (data.success === false) {
// show an error message that stays on screen
$('#sqlqueryform').before(data.error);
$sqlqueryresults.hide();
@ -334,7 +334,7 @@ AJAX.registerOnload('sql.js', function() {
* @memberOf jQuery
* @name paginate_dropdown_change
*/
$("#pageselector").live('change', function(event) {
$("#pageselector").live('change', function (event) {
var $form = $(this).parent("form");
$form.submit();
}); // end Paginate results with Page Selector
@ -344,12 +344,12 @@ AJAX.registerOnload('sql.js', function() {
* @memberOf jQuery
* @name displayOptionsForm_submit
*/
$("#displayOptionsForm.ajax").live('submit', function(event) {
$("#displayOptionsForm.ajax").live('submit', function (event) {
event.preventDefault();
$form = $(this);
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true' , function(data) {
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function (data) {
$("#sqlqueryresults")
.html(data.message)
.trigger('makegrid');
@ -360,7 +360,7 @@ AJAX.registerOnload('sql.js', function() {
/**
* Ajax Event for table row change
* */
$("#resultsForm.ajax .mult_submit[value=edit]").live('click', function(event){
$("#resultsForm.ajax .mult_submit[value=edit]").live('click', function (event) {
event.preventDefault();
/*Check whether atleast one row is selected for change*/
@ -373,28 +373,28 @@ AJAX.registerOnload('sql.js', function() {
*/
var button_options = {};
// in the following function we need to use $(this)
button_options[PMA_messages['strCancel']] = function() {
button_options[PMA_messages.strCancel] = function () {
$(this).dialog('close');
};
var button_options_error = {};
button_options_error[PMA_messages['strOK']] = function() {
button_options_error[PMA_messages.strOK] = function () {
$(this).dialog('close');
};
var $form = $("#resultsForm");
var $msgbox = PMA_ajaxShowMessage();
$.get($form.attr('action'), $form.serialize()+"&ajax_request=true&submit_mult=row_edit", function(data) {
$.get($form.attr('action'), $form.serialize() + "&ajax_request=true&submit_mult=row_edit", function (data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
if (data.success !== undefined && data.success === false) {
$div
.append(data.error)
.dialog({
title: PMA_messages['strChangeTbl'],
title: PMA_messages.strChangeTbl,
height: 230,
width: 900,
open: PMA_verifyColumnsProperties,
close: function(event, ui) {
close: function (event, ui) {
$(this).remove();
},
buttons : button_options_error
@ -403,11 +403,11 @@ AJAX.registerOnload('sql.js', function() {
$div
.append(data.message)
.dialog({
title: PMA_messages['strChangeTbl'],
title: PMA_messages.strChangeTbl,
height: 600,
width: 900,
open: PMA_verifyColumnsProperties,
close: function(event, ui) {
close: function (event, ui) {
$(this).remove();
},
buttons : button_options
@ -421,14 +421,14 @@ AJAX.registerOnload('sql.js', function() {
PMA_ajaxRemoveMessage($msgbox);
}); // end $.get()
} else {
PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']);
PMA_ajaxShowMessage(PMA_messages.strNoRowSelected);
}
});
/**
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
*/
$("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function(event) {
$("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function (event) {
event.preventDefault();
/**
* @var the_form object referring to the insert form
@ -436,10 +436,10 @@ AJAX.registerOnload('sql.js', function() {
var $form = $("#insertForm");
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize(), function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
if ($("#pageselector").length != 0) {
if ($("#pageselector").length !== 0) {
$("#pageselector").trigger('change');
} else {
$("input[name=navig].ajax").trigger('click');
@ -469,7 +469,7 @@ AJAX.registerOnload('sql.js', function() {
* Click action for #buttonYes button in ajax dialog insertForm
*/
$("#buttonYes.ajax").live('click', function(event){
$("#buttonYes.ajax").live('click', function (event) {
event.preventDefault();
/**
* @var the_form object referring to the insert form
@ -480,8 +480,8 @@ AJAX.registerOnload('sql.js', function() {
$("#result_query").remove();
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize() , function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
if (selected_submit_type == "showinsert") {
$("#sqlqueryresults").prepend(data.sql_query);
@ -494,7 +494,7 @@ AJAX.registerOnload('sql.js', function() {
$("#table_results tbody tr" +
", #table_results tbody tr td").removeClass("marked");
} else {
if ($("#pageselector").length != 0) {
if ($("#pageselector").length !== 0) {
$("#pageselector").trigger('change');
} else {
$("input[name=navig].ajax").trigger('click');
@ -535,17 +535,17 @@ function PMA_changeClassForColumn($this_th, newclass, isAddClass)
if (has_big_t) {
th_index--;
}
var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq('+th_index+')');
if (isAddClass == undefined) {
var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq(' + th_index + ')');
if (isAddClass === undefined) {
$tds.toggleClass(newclass);
} else {
$tds.toggleClass(newclass, isAddClass);
}
}
AJAX.registerOnload('sql.js', function() {
AJAX.registerOnload('sql.js', function () {
$('a.browse_foreign').live('click', function(e) {
$('a.browse_foreign').live('click', function (e) {
e.preventDefault();
window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes,resizable=yes');
$anchor = $(this);
@ -555,16 +555,16 @@ AJAX.registerOnload('sql.js', function() {
/**
* vertical column highlighting in horizontal mode when hovering over the column header
*/
$('th.column_heading.pointer').live('hover', function(e) {
$('th.column_heading.pointer').live('hover', function (e) {
PMA_changeClassForColumn($(this), 'hover', e.type == 'mouseenter');
});
});
/**
* vertical column marking in horizontal mode when clicking the column header
*/
$('th.column_heading.marker').live('click', function() {
$('th.column_heading.marker').live('click', function () {
PMA_changeClassForColumn($(this), 'marked');
});
});
/**
* create resizable table
@ -577,15 +577,15 @@ AJAX.registerOnload('sql.js', function() {
*/
function makeProfilingChart()
{
if ($('#profilingchart').length == 0
|| $('#profilingchart').html().length != 0
if ($('#profilingchart').length === 0
|| $('#profilingchart').html().length !== 0
) {
return;
}
var data = [];
$.each(jQuery.parseJSON($('#profilingChartData').html()),function(key,value) {
data.push([key,parseFloat(value)]);
$.each(jQuery.parseJSON($('#profilingChartData').html()), function (key, value) {
data.push([key, parseFloat(value)]);
});
// Remove chart and data divs contents

View File

@ -38,7 +38,7 @@ function nullify(theType, urlField, md5Field, multi_edit)
elts.checked = false;
} else {
var elts_cnt = elts.length;
for (var i = 0; i < elts_cnt; i++ ) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = false;
} // end for
@ -71,14 +71,14 @@ function nullify(theType, urlField, md5Field, multi_edit)
* Start of validation part
*/
//function checks the number of days in febuary
function daysInFebruary (year)
function daysInFebruary(year)
{
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
return (((year % 4 === 0) && (((year % 100 !== 0)) || (year % 400 === 0))) ? 29 : 28);
}
//function to convert single digit to double digit
function fractionReplace(num)
{
num = parseInt(num);
num = parseInt(num, 10);
return num >= 1 && num <= 9 ? '0' + num : '00';
}
@ -89,32 +89,32 @@ function fractionReplace(num)
* 3) 02-12-23
* 4) And instead of using '-' the following punctuations can be used (+,.,*,^,@,/) All these are accepted by mysql as well. Therefore no issues
*/
function isDate(val,tmstmp)
function isDate(val, tmstmp)
{
val = val.replace(/[.|*|^|+|//|@]/g,'-');
val = val.replace(/[.|*|^|+|//|@]/g, '-');
var arrayVal = val.split("-");
for (var a=0;a<arrayVal.length;a++) {
if (arrayVal[a].length==1) {
arrayVal[a]=fractionReplace(arrayVal[a]);
for (var a = 0; a < arrayVal.length; a++) {
if (arrayVal[a].length == 1) {
arrayVal[a] = fractionReplace(arrayVal[a]);
}
}
val=arrayVal.join("-");
var pos=2;
var dtexp=new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
val = arrayVal.join("-");
var pos = 2;
var dtexp = new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
if (val.length == 8) {
pos=0;
pos = 0;
}
if (dtexp.test(val)) {
var month=parseInt(val.substring(pos+3,pos+5));
var day=parseInt(val.substring(pos+6,pos+8));
var year=parseInt(val.substring(0,pos+2));
var month = parseInt(val.substring(pos + 3, pos + 5), 10);
var day = parseInt(val.substring(pos + 6, pos + 8), 10);
var year = parseInt(val.substring(0, pos + 2), 10);
if (month == 2 && day > daysInFebruary(year)) {
return false;
}
if (val.substring(0, pos + 2).length == 2) {
year = parseInt("20" + val.substring(0,pos+2));
year = parseInt("20" + val.substring(0, pos + 2), 10);
}
if (tmstmp == true) {
if (tmstmp === true) {
if (year < 1978) {
return false;
}
@ -166,38 +166,38 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
return true;
}
if (target.name.substring(0,6)=="fields") {
if (target.name.substring(0, 6) == "fields") {
// validate for date time
if (theType=="datetime"||theType=="time"||theType=="date"||theType=="timestamp") {
if (theType == "datetime" || theType == "time" || theType == "date" || theType == "timestamp") {
$this_input.removeClass("invalid_value");
var dt_value = $this_input.val();
if (theType=="date"){
if (theType == "date") {
if (! isDate(dt_value)) {
$this_input.addClass("invalid_value");
return false;
}
} else if (theType=="time") {
} else if (theType == "time") {
if (! isTime(dt_value)) {
$this_input.addClass("invalid_value");
return false;
}
} else if (theType=="datetime"||theType=="timestamp") {
var tmstmp=false;
} else if (theType == "datetime" || theType == "timestamp") {
var tmstmp = false;
if (dt_value == "CURRENT_TIMESTAMP") {
return true;
}
if (theType=="timestamp") {
tmstmp=true;
if (theType == "timestamp") {
tmstmp = true;
}
if (dt_value=="0000-00-00 00:00:00") {
if (dt_value == "0000-00-00 00:00:00") {
return true;
}
var dv=dt_value.indexOf(" ");
if (dv==-1) {
var dv = dt_value.indexOf(" ");
if (dv == -1) {
$this_input.addClass("invalid_value");
return false;
} else {
if (! (isDate(dt_value.substring(0,dv),tmstmp) && isTime(dt_value.substring(dv+1)))) {
if (! (isDate(dt_value.substring(0, dv), tmstmp) && isTime(dt_value.substring(dv + 1)))) {
$this_input.addClass("invalid_value");
return false;
}
@ -205,22 +205,22 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
}
}
//validate for integer type
if (theType.substring(0,3) == "int"){
if (theType.substring(0, 3) == "int") {
$this_input.removeClass("invalid_value");
if (isNaN($this_input.val())){
if (isNaN($this_input.val())) {
$this_input.addClass("invalid_value");
return false;
}
}
}
}
}
/* End of datetime validation*/
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_change.js', function() {
AJAX.registerTeardown('tbl_change.js', function () {
$('span.open_gis_editor').die('click');
$("input[name='gis_data[save]']").die('click');
$('input.checkbox_null').unbind('click');
@ -235,10 +235,10 @@ AJAX.registerTeardown('tbl_change.js', function() {
* Submit Data to be inserted into the table.
* Restart insertion with 'N' rows.
*/
AJAX.registerOnload('tbl_change.js', function() {
AJAX.registerOnload('tbl_change.js', function () {
$.datepicker.initialized = false;
$('span.open_gis_editor').live('click', function(event) {
$('span.open_gis_editor').live('click', function (event) {
event.preventDefault();
var $span = $(this);
@ -264,7 +264,7 @@ AJAX.registerOnload('tbl_change.js', function() {
/**
* Uncheck the null checkbox as geometry data is placed on the input field
*/
$("input[name='gis_data[save]']").live('click', function(event) {
$("input[name='gis_data[save]']").live('click', function (event) {
var input_name = $('form#gis_data_editor_form').find("input[name='input_name']").val();
var $null_checkbox = $("input[name='" + input_name + "']").parents('tr').find('.checkbox_null');
$null_checkbox.prop('checked', false);
@ -276,14 +276,14 @@ AJAX.registerOnload('tbl_change.js', function() {
* "Continue insertion" are handled in the "Continue insertion" code
*
*/
$('input.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()
);
$('input.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()
);
});
@ -301,7 +301,7 @@ AJAX.registerOnload('tbl_change.js', function() {
var value_field = $table.find('input[name="' + auto_increment_column.replace('auto_increment', 'fields') + '"]');
var previous_value = $(prev_value_field).val();
if (previous_value !== undefined) {
if ($(this).val() == 'insert' || $(this).val() == 'insertignore' || $(this).val() == 'showinsert' ) {
if ($(this).val() == 'insert' || $(this).val() == 'insertignore' || $(this).val() == 'showinsert') {
$(value_field).val(0);
} else {
$(value_field).val(previous_value);
@ -313,7 +313,7 @@ AJAX.registerOnload('tbl_change.js', function() {
/**
* Continue Insertion form
*/
$("#insert_rows").live('change', function(event) {
$("#insert_rows").live('change', function (event) {
event.preventDefault();
/**
@ -326,12 +326,12 @@ AJAX.registerOnload('tbl_change.js', function() {
var target_rows = $("#insert_rows").val();
// remove all datepickers
$('input.datefield, input.datetimefield').each(function(){
$('input.datefield, input.datetimefield').each(function () {
$(this).datepicker('destroy');
});
if (curr_rows < target_rows ) {
while( curr_rows < target_rows ) {
if (curr_rows < target_rows) {
while (curr_rows < target_rows) {
/**
* @var $last_row Object referring to the last row
@ -348,7 +348,7 @@ AJAX.registerOnload('tbl_change.js', function() {
.clone()
.insertBefore("#actions_panel")
.find('input[name*=multi_edit],select[name*=multi_edit],textarea[name*=multi_edit]')
.each(function() {
.each(function () {
var $this_element = $(this);
/**
@ -365,7 +365,7 @@ AJAX.registerOnload('tbl_change.js', function() {
/** 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 */
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0]);
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0], 10);
/** calculate next index i.e. 11 */
new_row_index = old_row_index + 1;
@ -389,7 +389,7 @@ AJAX.registerOnload('tbl_change.js', function() {
// will change
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('change', function(e) {
.bind('change', function (e) {
var $changed_element = $(this);
verificationsAfterFieldChange(
$changed_element.data('hashed_field'),
@ -408,35 +408,34 @@ AJAX.registerOnload('tbl_change.js', function() {
// will be clicked
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('click', function(e) {
var $changed_element = $(this);
nullify(
$changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(),
$changed_element.data('hashed_field'),
'[multi_edit][' + $changed_element.data('new_row_index') + ']'
);
.bind('click', function (e) {
var $changed_element = $(this);
nullify(
$changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(),
$changed_element.data('hashed_field'),
'[multi_edit][' + $changed_element.data('new_row_index') + ']'
);
});
}
}) // end each
.end()
.find('.foreign_values_anchor')
.each(function() {
.each(function () {
var $anchor = $(this);
var new_value = 'rownumber=' + new_row_index;
// needs improvement in case something else inside
// the href contains this pattern
var new_href = $anchor.attr('href').replace(/rownumber=\d+/, new_value);
$anchor.attr('href', new_href );
$anchor.attr('href', new_href);
});
//Insert/Clone the ignore checkboxes
if (curr_rows == 1 ) {
if (curr_rows == 1) {
$('<input id="insert_ignore_1" type="checkbox" name="insert_ignore_1" checked="checked" />')
.insertBefore("table.insertRowTable:last")
.after('<label for="insert_ignore_1">' + PMA_messages['strIgnore'] + '</label>');
}
else {
.after('<label for="insert_ignore_1">' + PMA_messages.strIgnore + '</label>');
} else {
/**
* @var $last_checkbox Object reference to the last checkbox in #insertForm
@ -446,13 +445,13 @@ AJAX.registerOnload('tbl_change.js', function() {
/** 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+/));
var last_checkbox_index = parseInt(last_checkbox_name.match(/\d+/), 10);
/** name of new {@link $last_checkbox} */
var new_name = last_checkbox_name.replace(/\d+/,last_checkbox_index+1);
var new_name = last_checkbox_name.replace(/\d+/, last_checkbox_index + 1);
$last_checkbox
.clone()
.attr({'id':new_name, 'name': new_name})
.attr({'id': new_name, 'name': new_name})
.prop('checked', true)
.add('label[for^=insert_ignore]:last')
.clone()
@ -462,28 +461,28 @@ AJAX.registerOnload('tbl_change.js', function() {
}
curr_rows++;
}
// recompute tabindex for text fields and other controls at footer;
// IMO it's not really important to handle the tabindex for
// function and Null
var tabindex = 0;
$('.textfield')
.each(function() {
// recompute tabindex for text fields and other controls at footer;
// IMO it's not really important to handle the tabindex for
// function and Null
var tabindex = 0;
$('.textfield')
.each(function () {
tabindex++;
$(this).attr('tabindex', tabindex);
// update the IDs of textfields to ensure that they are unique
$(this).attr('id', "field_" + tabindex + "_3");
});
$('select.control_at_footer')
.each(function() {
$('select.control_at_footer')
.each(function () {
tabindex++;
$(this).attr('tabindex', tabindex);
});
// Add all the required datepickers back
$('input.datefield, input.datetimefield').each(function(){
PMA_addDatepicker($(this));
// Add all the required datepickers back
$('input.datefield, input.datetimefield').each(function () {
PMA_addDatepicker($(this));
});
} else if ( curr_rows > target_rows) {
while(curr_rows > target_rows) {
} else if (curr_rows > target_rows) {
while (curr_rows > target_rows) {
$("input[id^=insert_ignore]:last")
.nextUntil("fieldset")
.andSelf()
@ -491,5 +490,5 @@ AJAX.registerOnload('tbl_change.js', function() {
curr_rows--;
}
}
})
});
});

View File

@ -9,7 +9,7 @@ var currentSettings = null;
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_chart.js', function() {
AJAX.registerTeardown('tbl_chart.js', function () {
$('input[name="chartType"]').unbind('click');
$('input[name="barStacked"]').unbind('click');
$('input[name="chartTitle"]').unbind('focus').unbind('keyup').unbind('blur');
@ -20,7 +20,7 @@ AJAX.registerTeardown('tbl_chart.js', function() {
$('#resizer').unbind('resizestop');
});
AJAX.registerOnload('tbl_chart.js', function() {
AJAX.registerOnload('tbl_chart.js', function () {
// from jQuery UI
$('#resizer').resizable({
@ -29,7 +29,7 @@ AJAX.registerOnload('tbl_chart.js', function() {
})
.width($('#div_view_options').width() - 50);
$('#resizer').bind('resizestop', function(event, ui) {
$('#resizer').bind('resizestop', function (event, ui) {
// make room so that the handle will still appear
$('#querychart').height($('#resizer').height() * 0.96);
$('#querychart').width($('#resizer').width() * 0.96);
@ -46,12 +46,12 @@ AJAX.registerOnload('tbl_chart.js', function() {
yaxisLabel : $('input[name="yaxis_label"]').val(),
title : $('input[name="chartTitle"]').val(),
stackSeries : false,
mainAxis : parseInt($('select[name="chartXAxis"]').val()),
mainAxis : parseInt($('select[name="chartXAxis"]').val(), 10),
selectedSeries : getSelectedSeries()
};
// handle chart type changes
$('input[name="chartType"]').click(function() {
$('input[name="chartType"]').click(function () {
currentSettings.type = $(this).val();
drawChart();
if ($(this).val() == 'bar' || $(this).val() == 'column'
@ -64,7 +64,7 @@ AJAX.registerOnload('tbl_chart.js', function() {
});
// handle stacking for bar, column and area charts
$('input[name="barStacked"]').click(function() {
$('input[name="barStacked"]').click(function () {
if (this.checked) {
$.extend(true, currentSettings, {stackSeries : true});
} else {
@ -74,16 +74,16 @@ AJAX.registerOnload('tbl_chart.js', function() {
});
// handle changes in chart title
$('input[name="chartTitle"]').focus(function() {
$('input[name="chartTitle"]').focus(function () {
temp_chart_title = $(this).val();
}).keyup(function() {
}).keyup(function () {
var title = $(this).val();
if (title.length == 0) {
if (title.length === 0) {
title = ' ';
}
currentSettings.title = $('input[name="chartTitle"]').val();
drawChart();
}).blur(function() {
}).blur(function () {
if ($(this).val() != temp_chart_title) {
drawChart();
}
@ -91,13 +91,13 @@ AJAX.registerOnload('tbl_chart.js', function() {
var dateTimeCols = [];
var vals = $('input[name="dateTimeCols"]').val().split(' ');
$.each(vals, function(i, v) {
dateTimeCols.push(parseInt(v));
$.each(vals, function (i, v) {
dateTimeCols.push(parseInt(v, 10));
});
// handle changing the x-axis
$('select[name="chartXAxis"]').change(function() {
currentSettings.mainAxis = parseInt($(this).val());
$('select[name="chartXAxis"]').change(function () {
currentSettings.mainAxis = parseInt($(this).val(), 10);
if (dateTimeCols.indexOf(currentSettings.mainAxis) != -1) {
$('span.span_timeline').show();
} else {
@ -114,7 +114,7 @@ AJAX.registerOnload('tbl_chart.js', function() {
});
// handle changing the selected data series
$('select[name="chartSeries"]').change(function() {
$('select[name="chartSeries"]').change(function () {
currentSettings.selectedSeries = getSelectedSeries();
var yaxis_title;
if (currentSettings.selectedSeries.length == 1) {
@ -126,7 +126,7 @@ AJAX.registerOnload('tbl_chart.js', function() {
$('input#radio_line').prop('checked', true);
currentSettings.type = 'line';
}
yaxis_title = PMA_messages['strYValues'];
yaxis_title = PMA_messages.strYValues;
}
$('input[name="yaxis_label"]').val(yaxis_title);
currentSettings.yaxisLabel = yaxis_title;
@ -134,11 +134,11 @@ AJAX.registerOnload('tbl_chart.js', function() {
});
// handle manual changes to the chart axis labels
$('input[name="xaxis_label"]').keyup(function() {
$('input[name="xaxis_label"]').keyup(function () {
currentSettings.xaxisLabel = $(this).val();
drawChart();
});
$('input[name="yaxis_label"]').keyup(function() {
$('input[name="yaxis_label"]').keyup(function () {
currentSettings.yaxisLabel = $(this).val();
drawChart();
});
@ -150,9 +150,9 @@ AJAX.registerOnload('tbl_chart.js', function() {
* Ajax Event handler for 'Go' button click
*
*/
$("#tblchartform").live('submit', function(event) {
if (!checkFormElementInRange(this, 'session_max_rows', PMA_messages['strNotValidRowNumber'], 1)
|| !checkFormElementInRange(this, 'pos', PMA_messages['strNotValidRowNumber'], 0 - 1)) {
$("#tblchartform").live('submit', function (event) {
if (!checkFormElementInRange(this, 'session_max_rows', PMA_messages.strNotValidRowNumber, 1)
|| !checkFormElementInRange(this, 'pos', PMA_messages.strNotValidRowNumber, 0 - 1)) {
return false;
}
@ -165,8 +165,8 @@ $("#tblchartform").live('submit', function(event) {
var $msgbox = PMA_ajaxShowMessage();
PMA_prepareForAjaxRequest($form);
$.post($form.attr('action'), $form.serialize(), function(data) {
if (data.success == true) {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
$('.success').fadeOut();
if (typeof data.chartData != 'undefined') {
chart_data = jQuery.parseJSON(data.chartData);
@ -195,17 +195,17 @@ function drawChart() {
currentSettings.height = $('#resizer').height() - 20;
// todo: a better way using .redraw() ?
if (currentChart != null) {
if (currentChart !== null) {
currentChart.destroy();
}
var columnNames = [];
$('select[name="chartXAxis"] option').each(function() {
$('select[name="chartXAxis"] option').each(function () {
columnNames.push($(this).text());
});
try {
currentChart = PMA_queryChart(chart_data, columnNames, currentSettings);
} catch(err) {
} catch (err) {
PMA_ajaxShowMessage(err.message, false);
}
}
@ -213,8 +213,8 @@ function drawChart() {
function getSelectedSeries() {
var val = $('select[name="chartSeries"]').val() || [];
var ret = [];
$.each(val, function(i, v) {
ret.push(parseInt(v));
$.each(val, function (i, v) {
ret.push(parseInt(v, 10));
});
return ret;
}
@ -223,14 +223,14 @@ function extractDate(dateString) {
var matches, match;
var dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
var dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
matches = dateTimeRegExp.exec(dateString);
if (matches != null && matches.length > 0) {
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2), match.substr(11, 2), match.substr(14, 2), match.substr(17, 2));
} else {
matches = dateRegExp.exec(dateString);
if (matches != null && matches.length > 0) {
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2));
}
@ -239,7 +239,7 @@ function extractDate(dateString) {
}
function PMA_queryChart(data, columnNames, settings) {
if ($('#querychart').length == 0) {
if ($('#querychart').length === 0) {
return;
}
@ -285,22 +285,22 @@ function PMA_queryChart(data, columnNames, settings) {
} else {
dataTable.addColumn(ColumnType.STRING, columnNames[settings.mainAxis]);
}
$.each(settings.selectedSeries, function(index, element) {
$.each(settings.selectedSeries, function (index, element) {
dataTable.addColumn(ColumnType.NUMBER, columnNames[element]);
});
// set data to the data table
var columnsToExtract = [ settings.mainAxis ];
$.each(settings.selectedSeries, function(index, element) {
$.each(settings.selectedSeries, function (index, element) {
columnsToExtract.push(element);
});
var values = [], newRow, row, col;
for ( var i = 0; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
row = data[i];
newRow = [];
for ( var j = 0; j < columnsToExtract.length; j++) {
for (var j = 0; j < columnsToExtract.length; j++) {
col = columnNames[columnsToExtract[j]];
if (j == 0) {
if (j === 0) {
if (settings.type == 'timeline') { // first column is date type
newRow.push(extractDate(row[col]));
} else { // first column is string type

View File

@ -30,7 +30,7 @@ function zoomAndPan()
g.setAttribute('transform', 'translate(' + x + ', ' + y + ') scale(' + scale + ')');
var id;
var circle;
$('circle.vector').each(function() {
$('circle.vector').each(function () {
id = $(this).attr('id');
circle = svg.getElementById(id);
svg.change(circle, {
@ -40,7 +40,7 @@ function zoomAndPan()
});
var line;
$('polyline.vector').each(function() {
$('polyline.vector').each(function () {
id = $(this).attr('id');
line = svg.getElementById(id);
svg.change(line, {
@ -49,7 +49,7 @@ function zoomAndPan()
});
var polygon;
$('path.vector').each(function() {
$('path.vector').each(function () {
id = $(this).attr('id');
polygon = svg.getElementById(id);
svg.change(polygon, {
@ -62,7 +62,7 @@ function zoomAndPan()
* Initially loads either SVG or OSM visualization based on the choice.
*/
function selectVisualization() {
if ($('#choice').prop('checked') != true) {
if ($('#choice').prop('checked') !== true) {
$('#openlayersmap').hide();
} else {
$('#placeholder').hide();
@ -90,7 +90,7 @@ function loadSVG() {
var $placeholder = $('#placeholder');
$placeholder.svg({
onLoad: function(svg_ref) {
onLoad: function (svg_ref) {
svg = svg_ref;
}
});
@ -180,7 +180,7 @@ function getRelativeCoords(e) {
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_gis_visualization.js', function() {
AJAX.registerTeardown('tbl_gis_visualization.js', function () {
$('#choice').die('click');
$('#placeholder').die('mousewheel');
$('svg').die('dragstart');
@ -197,15 +197,15 @@ AJAX.registerTeardown('tbl_gis_visualization.js', function() {
$('.vector').unbind('mousemove').unbind('mouseout');
});
AJAX.registerOnload('tbl_gis_visualization.js', function() {
AJAX.registerOnload('tbl_gis_visualization.js', function () {
// If we are in GIS visualization, initialize it
if ($('table.gis_table').length > 0) {
initGISVisualization();
}
$('#choice').live('click', function() {
if ($(this).prop('checked') == false) {
$('#choice').live('click', function () {
if ($(this).prop('checked') === false) {
$('#placeholder').show();
$('#openlayersmap').hide();
} else {
@ -214,12 +214,12 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
}
});
$('#placeholder').live('mousewheel', function(event, delta) {
$('#placeholder').live('mousewheel', function (event, delta) {
var relCoords = getRelativeCoords(event);
if (delta > 0) {
//zoom in
scale *= zoomFactor;
// zooming in keeping the position under mouse pointer unmoved.
// zooming in keeping the position under mouse pointer unmoved.
x = relCoords.x - (relCoords.x - x) * zoomFactor;
y = relCoords.y - (relCoords.y - y) * zoomFactor;
zoomAndPan();
@ -234,18 +234,20 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
return true;
});
var dragX = 0; var dragY = 0;
$('svg').live('dragstart', function(event, dd) {
var dragX = 0;
var dragY = 0;
$('svg').live('dragstart', function (event, dd) {
$('#placeholder').addClass('placeholderDrag');
dragX = Math.round(dd.offsetX);
dragY = Math.round(dd.offsetY);
});
$('svg').live('mouseup', function(event) {
$('svg').live('mouseup', function (event) {
$('#placeholder').removeClass('placeholderDrag');
});
$('svg').live('drag', function(event, dd) {
$('svg').live('drag', function (event, dd) {
newX = Math.round(dd.offsetX);
x += newX - dragX;
dragX = newX;
@ -255,7 +257,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
zoomAndPan();
});
$('#placeholder').live('dblclick', function(event) {
$('#placeholder').live('dblclick', function (event) {
scale *= zoomFactor;
// zooming in keeping the position under mouse pointer unmoved.
var relCoords = getRelativeCoords(event);
@ -264,7 +266,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
zoomAndPan();
});
$('#zoom_in').live('click', function(e) {
$('#zoom_in').live('click', function (e) {
e.preventDefault();
//zoom in
scale *= zoomFactor;
@ -277,7 +279,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
zoomAndPan();
});
$('#zoom_world').live('click', function(e) {
$('#zoom_world').live('click', function (e) {
e.preventDefault();
scale = 1;
x = defaultX;
@ -285,7 +287,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
zoomAndPan();
});
$('#zoom_out').live('click', function(e) {
$('#zoom_out').live('click', function (e) {
e.preventDefault();
//zoom out
scale /= zoomFactor;
@ -298,37 +300,37 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
zoomAndPan();
});
$('#left_arrow').live('click', function(e) {
$('#left_arrow').live('click', function (e) {
e.preventDefault();
x += 100;
zoomAndPan();
});
$('#right_arrow').live('click', function(e) {
$('#right_arrow').live('click', function (e) {
e.preventDefault();
x -= 100;
zoomAndPan();
});
$('#up_arrow').live('click', function(e) {
$('#up_arrow').live('click', function (e) {
e.preventDefault();
y += 100;
zoomAndPan();
});
$('#down_arrow').live('click', function(e) {
$('#down_arrow').live('click', function (e) {
e.preventDefault();
y -= 100;
zoomAndPan();
});
/**
* Detect the mousemove event and show tooltips.
*/
$('.vector').bind('mousemove', function(event) {
$('.vector').bind('mousemove', function (event) {
var contents = $.trim(escapeHtml($(this).attr('name')));
$("#tooltip").remove();
if (contents != '') {
if (contents !== '') {
$('<div id="tooltip">' + contents + '</div>').css({
position : 'absolute',
top : event.pageY + 10,
@ -344,7 +346,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function() {
/**
* Detect the mouseout event and hide tooltips.
*/
$('.vector').bind('mouseout', function(event) {
$('.vector').bind('mouseout', function (event) {
$("#tooltip").remove();
});
});

View File

@ -8,7 +8,7 @@ function show_hide_clauses($thisDropdown)
// here, one span contains the label and the clause dropdown
// and we have one span for ON DELETE and one for ON UPDATE
//
if ($thisDropdown.val() != '') {
if ($thisDropdown.val() !== '') {
$thisDropdown.parent().nextAll('span').show();
} else {
$thisDropdown.parent().nextAll('span').hide();
@ -18,17 +18,17 @@ function show_hide_clauses($thisDropdown)
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_relation.js', function() {
AJAX.registerTeardown('tbl_relation.js', function () {
$('select.referenced_column_dropdown').unbind('change');
});
AJAX.registerOnload('tbl_relation.js', function() {
AJAX.registerOnload('tbl_relation.js', function () {
// initial display
$('select.referenced_column_dropdown').each(function(index, one_dropdown) {
$('select.referenced_column_dropdown').each(function (index, one_dropdown) {
show_hide_clauses($(one_dropdown));
});
// change
$('select.referenced_column_dropdown').change(function() {
$('select.referenced_column_dropdown').change(function () {
show_hide_clauses($(this));
});
});

View File

@ -16,14 +16,14 @@
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_select.js', function() {
AJAX.registerTeardown('tbl_select.js', function () {
$('#togglesearchformlink').unbind('click');
$("#tbl_search_form.ajax").die('submit');
$('select.geom_func').unbind('change');
$('span.open_search_gis_editor').die('click');
});
AJAX.registerOnload('tbl_select.js', function() {
AJAX.registerOnload('tbl_select.js', function () {
/**
* Prepare a div containing a link, otherwise it's incorrectly displayed
* after a couple of clicks
@ -34,14 +34,14 @@ AJAX.registerOnload('tbl_select.js', function() {
.hide();
$('#togglesearchformlink')
.html(PMA_messages['strShowSearchCriteria'])
.bind('click', function() {
.html(PMA_messages.strShowSearchCriteria)
.bind('click', function () {
var $link = $(this);
$('#tbl_search_form').slideToggle();
if ($link.text() == PMA_messages['strHideSearchCriteria']) {
$link.text(PMA_messages['strShowSearchCriteria']);
if ($link.text() == PMA_messages.strHideSearchCriteria) {
$link.text(PMA_messages.strShowSearchCriteria);
} else {
$link.text(PMA_messages['strHideSearchCriteria']);
$link.text(PMA_messages.strHideSearchCriteria);
}
// avoid default click action
return false;
@ -50,25 +50,26 @@ AJAX.registerOnload('tbl_select.js', function() {
/**
* Ajax event handler for Table Search
*/
$("#tbl_search_form.ajax").live('submit', function(event) {
$("#tbl_search_form.ajax").live('submit', function (event) {
var unaryFunctions = [
'IS NULL',
'IS NULL',
'IS NOT NULL',
"= ''",
"!= ''"];
"!= ''"
];
// jQuery object to reuse
$search_form = $(this);
event.preventDefault();
// empty previous search results while we are waiting for new results
$("#sqlqueryresults").empty();
var $msgbox = PMA_ajaxShowMessage(PMA_messages['strSearching'], false);
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
PMA_prepareForAjaxRequest($search_form);
var values = {};
$search_form.find(':input').each(function() {
$search_form.find(':input').each(function () {
var $input = $(this);
if ($input.attr('type') == 'checkbox' || $input.attr('type') == 'radio') {
if ($input.is(':checked')) {
@ -79,13 +80,13 @@ AJAX.registerOnload('tbl_select.js', function() {
}
});
var columnCount = $('select[name="columnsToDisplay[]"] option').length;
// Submit values only for the columns that have unary column operator or a search criteria
// Submit values only for the columns that have unary column operator or a search criteria
for (var a = 0; a < columnCount; a++) {
if ($.inArray(values['criteriaColumnOperators[' + a + ']'], unaryFunctions) >= 0) {
continue;
}
if (values['criteriaValues[' + a + ']'] == '' || values['criteriaValues[' + a + ']'] == null) {
if (values['criteriaValues[' + a + ']'] === '' || values['criteriaValues[' + a + ']'] === null) {
delete values['criteriaValues[' + a + ']'];
delete values['criteriaColumnOperators[' + a + ']'];
delete values['criteriaColumnNames[' + a + ']'];
@ -94,7 +95,7 @@ AJAX.registerOnload('tbl_select.js', function() {
}
}
// If all columns are selected, use a single parameter to indicate that
if (values['columnsToDisplay[]'] != null) {
if (values['columnsToDisplay[]'] !== null) {
if (values['columnsToDisplay[]'].length == columnCount) {
delete values['columnsToDisplay[]'];
values['displayAllColumns'] = true;
@ -103,10 +104,10 @@ AJAX.registerOnload('tbl_select.js', function() {
values['displayAllColumns'] = true;
}
$.post($search_form.attr('action'), values, function(data) {
$.post($search_form.attr('action'), values, function (data) {
PMA_ajaxRemoveMessage($msgbox);
if (data.success == true) {
if (data.sql_query != null) { // zero rows
if (data.success === true) {
if (typeof data.sql_query !== 'undefined') { // zero rows
$("#sqlqueryresults").html(data.sql_query);
} else { // results found
$("#sqlqueryresults").html(data.message);
@ -118,12 +119,12 @@ AJAX.registerOnload('tbl_select.js', function() {
.hide();
$('#togglesearchformlink')
// always start with the Show message
.text(PMA_messages['strShowSearchCriteria']);
.text(PMA_messages.strShowSearchCriteria);
$('#togglesearchformdiv')
// now it's time to show the div containing the link
.show();
// needed for the display options slider in the results
PMA_init_slider();
PMA_init_slider();
} else {
$("#sqlqueryresults").html(data.error);
}
@ -134,48 +135,48 @@ AJAX.registerOnload('tbl_select.js', function() {
// Initialy hide all the open_gis_editor spans
$('span.open_search_gis_editor').hide();
$('select.geom_func').bind('change', function() {
$('select.geom_func').bind('change', function () {
var $geomFuncSelector = $(this);
var binaryFunctions = [
'Contains',
'Crosses',
'Disjoint',
'Equals',
'Intersects',
'Overlaps',
'Touches',
'Within',
'MBRContains',
'MBRDisjoint',
'MBREquals',
'MBRIntersects',
'MBROverlaps',
'MBRTouches',
'MBRWithin',
'ST_Contains',
'ST_Crosses',
'ST_Disjoint',
'ST_Equals',
'ST_Intersects',
'ST_Overlaps',
'ST_Touches',
'ST_Within'
'Contains',
'Crosses',
'Disjoint',
'Equals',
'Intersects',
'Overlaps',
'Touches',
'Within',
'MBRContains',
'MBRDisjoint',
'MBREquals',
'MBRIntersects',
'MBROverlaps',
'MBRTouches',
'MBRWithin',
'ST_Contains',
'ST_Crosses',
'ST_Disjoint',
'ST_Equals',
'ST_Intersects',
'ST_Overlaps',
'ST_Touches',
'ST_Within'
];
var tempArray = [
'Envelope',
'EndPoint',
'StartPoint',
'ExteriorRing',
'Centroid',
'PointOnSurface'
'Envelope',
'EndPoint',
'StartPoint',
'ExteriorRing',
'Centroid',
'PointOnSurface'
];
var outputGeomFunctions = binaryFunctions.concat(tempArray);
// If the chosen function takes two geomerty objects as parameters
var $operator = $geomFuncSelector.parents('tr').find('td:nth-child(5)').find('select');
if ($.inArray($geomFuncSelector.val(), binaryFunctions) >= 0){
if ($.inArray($geomFuncSelector.val(), binaryFunctions) >= 0) {
$operator.prop('readonly', true);
} else {
$operator.prop('readonly', false);
@ -183,7 +184,7 @@ AJAX.registerOnload('tbl_select.js', function() {
// if the chosen function's output is a geometry, enable GIS editor
var $editorSpan = $geomFuncSelector.parents('tr').find('span.open_search_gis_editor');
if ($.inArray($geomFuncSelector.val(), outputGeomFunctions) >= 0){
if ($.inArray($geomFuncSelector.val(), outputGeomFunctions) >= 0) {
$editorSpan.show();
} else {
$editorSpan.hide();
@ -191,7 +192,7 @@ AJAX.registerOnload('tbl_select.js', function() {
});
$('span.open_search_gis_editor').live('click', function(event) {
$('span.open_search_gis_editor').live('click', function (event) {
event.preventDefault();
var $span = $(this);
@ -201,12 +202,13 @@ AJAX.registerOnload('tbl_select.js', function() {
var field = 'Parameter';
// Column type
var geom_func = $span.parents('tr').find('.geom_func').val();
var type;
if (geom_func == 'Envelope') {
var type = 'polygon';
type = 'polygon';
} else if (geom_func == 'ExteriorRing') {
var type = 'linestring';
type = 'linestring';
} else {
var type = 'point';
type = 'point';
}
// Names of input field and null checkbox
var input_name = $span.parent('td').children("input[type='text']").attr('name');

View File

@ -18,10 +18,29 @@
*
*/
/**
* Reload fields table
*/
function reloadFieldForm(message) {
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize() + "&ajax_request=true", function (form_data) {
var $temp_div = $("<div id='temp_div'><div>").append(form_data.message);
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
$("#addColumns").replaceWith($temp_div.find("#addColumns"));
$('#move_columns_dialog ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
$("#moveColumns").removeClass("move-active");
/* reinitialise the more options in table */
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
setTimeout(function () {
PMA_ajaxShowMessage(message);
}, 500);
});
$('#page_content').show();
}
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_structure.js', function() {
AJAX.registerTeardown('tbl_structure.js', function () {
$("a.change_column_anchor.ajax").die('click');
$("button.change_columns_anchor.ajax, input.change_columns_anchor.ajax").die('click');
$("a.drop_column_anchor.ajax").die('click');
@ -30,12 +49,12 @@ AJAX.registerTeardown('tbl_structure.js', function() {
$(".append_fields_form.ajax").unbind('submit');
});
AJAX.registerOnload('tbl_structure.js', function() {
AJAX.registerOnload('tbl_structure.js', function () {
/**
*Ajax action for submitting the "Column Change" and "Add Column" form
*/
$(".append_fields_form.ajax").bind('submit', function(event) {
$(".append_fields_form.ajax").bind('submit', function (event) {
event.preventDefault();
/**
* @var the_form object referring to the export form
@ -54,13 +73,13 @@ AJAX.registerOnload('tbl_structure.js', function() {
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
PMA_ajaxShowMessage();
$.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function(data) {
if ($("#sqlqueryresults").length != 0) {
$.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function (data) {
if ($("#sqlqueryresults").length !== 0) {
$("#sqlqueryresults").remove();
} else if ($(".error").length != 0) {
} else if ($(".error").length !== 0) {
$(".error").remove();
}
if (data.success == true) {
if (data.success === true) {
$("<div id='sqlqueryresults'></div>").prependTo("#page_content");
$("#sqlqueryresults").html(data.sql_query);
$("#result_query .notice").remove();
@ -82,17 +101,17 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* Attach Event Handler for 'Change Column'
*/
$("a.change_column_anchor.ajax").live('click', function(event) {
$("a.change_column_anchor.ajax").live('click', function (event) {
event.preventDefault();
$('#page_content').hide();
$.get($(this).attr('href'), {'ajax_request': true}, function(data) {
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
if (data.success) {
$('<div id="change_column_dialog"></div>')
.html(data.message)
.insertBefore('#page_content');
PMA_verifyColumnsProperties();
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
});
});
@ -100,7 +119,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* Attach Event Handler for 'Change multiple columns'
*/
$("button.change_columns_anchor.ajax, input.change_columns_anchor.ajax").live('click', function(event) {
$("button.change_columns_anchor.ajax, input.change_columns_anchor.ajax").live('click', function (event) {
event.preventDefault();
$('#page_content').hide();
var $form = $(this).closest('form');
@ -112,7 +131,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
.insertBefore('#page_content');
PMA_verifyColumnsProperties();
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
});
});
@ -120,7 +139,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* Attach Event Handler for 'Drop Column'
*/
$("a.drop_column_anchor.ajax").live('click', function(event) {
$("a.drop_column_anchor.ajax").live('click', function (event) {
event.preventDefault();
/**
* @var curr_table_name String containing the name of the current table
@ -141,11 +160,11 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $.sprintf(PMA_messages['strDoYouReally'], 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` DROP `' + escapeHtml(curr_column_name) + '`;');
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
var $msg = PMA_ajaxShowMessage(PMA_messages['strDroppingColumn'], false);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
if (data.success == true) {
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` DROP `' + escapeHtml(curr_column_name) + '`;');
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingColumn, false);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msg);
if ($('#result_query').length) {
$('#result_query').remove();
@ -158,7 +177,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
toggleRowColors($curr_row.next());
// Adjust the row numbers
for (var $row = $curr_row.next(); $row.length > 0; $row = $row.next()) {
var new_val = parseInt($row.find('td:nth-child(2)').text()) - 1;
var new_val = parseInt($row.find('td:nth-child(2)').text(), 10) - 1;
$row.find('td:nth-child(2)').text(new_val);
}
$after_field_item.remove();
@ -167,16 +186,16 @@ AJAX.registerOnload('tbl_structure.js', function() {
$('#indexes').html(data.indexes_list);
PMA_reloadNavigation();
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); // end $.PMA_confirm()
}) ; //end of Drop Column Anchor action
}); //end of Drop Column Anchor action
/**
* Ajax Event handler for 'Add Primary Key'
*/
$("a.add_primary_key_anchor.ajax").live('click', function(event) {
$("a.add_primary_key_anchor.ajax").live('click', function (event) {
event.preventDefault();
/**
* @var curr_table_name String containing the name of the current table
@ -189,11 +208,11 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $.sprintf(PMA_messages['strDoYouReally'], 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD PRIMARY KEY(`' + escapeHtml(curr_column_name) + '`);');
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
var $msg = PMA_ajaxShowMessage(PMA_messages['strAddingPrimaryKey'], false);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
if (data.success == true) {
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD PRIMARY KEY(`' + escapeHtml(curr_column_name) + '`);');
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
var $msg = PMA_ajaxShowMessage(PMA_messages.strAddingPrimaryKey, false);
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msg);
$(this).remove();
if (typeof data.reload != 'undefined') {
@ -210,7 +229,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
PMA_reloadNavigation();
}
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
}
}); // end $.get()
}); // end $.PMA_confirm()
@ -219,7 +238,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
/**
* Inline move columns
**/
$("#move_columns_anchor").live('click', function(e) {
$("#move_columns_anchor").live('click', function (e) {
e.preventDefault();
if ($(this).hasClass("move-active")) {
@ -232,7 +251,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
*/
var button_options = {};
button_options[PMA_messages['strGo']] = function(event) {
button_options[PMA_messages.strGo] = function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage();
var $this = $(this);
@ -247,7 +266,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
}
$.post($form.prop("action"), serialized + "&ajax_request=true", function (data) {
if (data.success == false) {
if (data.success === false) {
PMA_ajaxRemoveMessage($msgbox);
$this
.clone()
@ -282,7 +301,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
.text($row.index() + 1)
.end()
.removeClass("odd even")
.addClass($row.index() % 2 == 0 ? "odd" : "even");
.addClass($row.index() % 2 === 0 ? "odd" : "even");
}
PMA_ajaxShowMessage(data.message);
$this.dialog('close');
@ -290,12 +309,12 @@ AJAX.registerOnload('tbl_structure.js', function() {
}
});
};
button_options[PMA_messages['strCancel']] = function() {
button_options[PMA_messages.strCancel] = function () {
$(this).dialog('close');
};
var button_options_error = {};
button_options_error[PMA_messages['strOK']] = function() {
button_options_error[PMA_messages.strOK] = function () {
$(this).dialog('close').remove();
};
@ -337,25 +356,6 @@ AJAX.registerOnload('tbl_structure.js', function() {
});
});
/**
* Reload fields table
*/
function reloadFieldForm(message) {
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
var $temp_div = $("<div id='temp_div'><div>").append(form_data.message);
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
$("#addColumns").replaceWith($temp_div.find("#addColumns"));
$('#move_columns_dialog ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
$("#moveColumns").removeClass("move-active");
/* reinitialise the more options in table */
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
setTimeout(function() {
PMA_ajaxShowMessage(message);
}, 500);
});
$('#page_content').show();
}
/**
* This function returns the horizontal space available for the menu in pixels.
* To calculate this value we start we the width of the main panel, then we
@ -378,23 +378,23 @@ function PMA_tbl_structure_menu_resizer_callback() {
pagewidth -= $page.outerWidth(true) - $page.outerWidth();
var columnsWidth = 0;
var $columns = $('#tablestructure').find('tr:eq(1)').find('td,th');
$columns.not(':last').each(function (){
columnsWidth += $(this).outerWidth(true)
$columns.not(':last').each(function () {
columnsWidth += $(this).outerWidth(true);
});
var totalCellSpacing = $('#tablestructure').width();
$columns.each(function (){
$columns.each(function () {
totalCellSpacing -= $(this).outerWidth(true);
});
return pagewidth - columnsWidth - totalCellSpacing - 15; // 15px extra margin
}
/** Handler for "More" dropdown in structure table rows */
AJAX.registerOnload('tbl_structure.js', function() {
AJAX.registerOnload('tbl_structure.js', function () {
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
}
});
AJAX.registerTeardown('tbl_structure.js', function() {
AJAX.registerTeardown('tbl_structure.js', function () {
$('#fieldsForm ul.table-structure-actions').menuResizer('destroy');
});
$(function () {

View File

@ -12,7 +12,7 @@
** Display Help/Info
**/
function displayHelp() {
PMA_ajaxShowMessage(PMA_messages['strDisplayHelp'], 10000);
PMA_ajaxShowMessage(PMA_messages.strDisplayHelp, 10000);
}
/**
@ -20,7 +20,7 @@ function displayHelp() {
** @param array
**/
Array.max = function (array) {
return Math.max.apply( Math, array );
return Math.max.apply(Math, array);
};
/**
@ -28,7 +28,7 @@ Array.max = function (array) {
** @param array
**/
Array.min = function (array) {
return Math.min.apply( Math, array );
return Math.min.apply(Math, array);
};
/**
@ -89,8 +89,8 @@ function getType(field) {
function getCord(arr) {
var newCord = [];
var original = $.extend(true, [], arr);
var arr = jQuery.unique(arr).sort();
$.each(original, function(index, value) {
arr = jQuery.unique(arr).sort();
$.each(original, function (index, value) {
newCord.push(jQuery.inArray(value, arr));
});
return [newCord, arr, original];
@ -100,14 +100,14 @@ function getCord(arr) {
** Scrolls the view to the display section
**/
function scrollToChart() {
var x = $('#dataDisplay').offset().top - 100; // 100 provides buffer in viewport
$('html,body').animate({scrollTop: x}, 500);
var x = $('#dataDisplay').offset().top - 100; // 100 provides buffer in viewport
$('html,body').animate({scrollTop: x}, 500);
}
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_zoom_plot_jqplot.js', function() {
AJAX.registerTeardown('tbl_zoom_plot_jqplot.js', function () {
$('#tableid_0').unbind('change');
$('#tableid_1').unbind('change');
$('#tableid_2').unbind('change');
@ -120,7 +120,7 @@ AJAX.registerTeardown('tbl_zoom_plot_jqplot.js', function() {
$('div#querychart').unbind('jqplotDataClick');
});
AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
var currentChart = null;
var searchedDataKey = null;
@ -143,9 +143,9 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
**/
// first column choice corresponds to the X axis
$('#tableid_0').change(function() {
$('#tableid_0').change(function () {
//AJAX request for field type, collation, operators, and value field
$.post('tbl_zoom_select.php',{
$.post('tbl_zoom_select.php', {
'ajax_request' : true,
'change_tbl_info' : true,
'db' : PMA_commonParams.get('db'),
@ -153,23 +153,23 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'field' : $('#tableid_0').val(),
'it' : 0,
'token' : PMA_commonParams.get('token')
},function(data) {
}, function (data) {
$('#tableFieldsId tr:eq(1) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(1) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(1) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(1) td:eq(3)').html(data.field_value);
xLabel = $('#tableid_0').val();
$('#types_0').val(data.field_type);
xType = data.field_type;
$('#collations_0').val(data.field_collations);
addDateTimePicker();
xLabel = $('#tableid_0').val();
$('#types_0').val(data.field_type);
xType = data.field_type;
$('#collations_0').val(data.field_collations);
addDateTimePicker();
});
});
// second column choice corresponds to the Y axis
$('#tableid_1').change(function() {
$('#tableid_1').change(function () {
//AJAX request for field type, collation, operators, and value field
$.post('tbl_zoom_select.php',{
$.post('tbl_zoom_select.php', {
'ajax_request' : true,
'change_tbl_info' : true,
'db' : PMA_commonParams.get('db'),
@ -177,22 +177,22 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'field' : $('#tableid_1').val(),
'it' : 1,
'token' : PMA_commonParams.get('token')
},function(data) {
}, function (data) {
$('#tableFieldsId tr:eq(3) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(3) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(3) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(3) td:eq(3)').html(data.field_value);
yLabel = $('#tableid_1').val();
$('#types_1').val(data.field_type);
yType = data.field_type;
$('#collations_1').val(data.field_collations);
addDateTimePicker();
yLabel = $('#tableid_1').val();
$('#types_1').val(data.field_type);
yType = data.field_type;
$('#collations_1').val(data.field_collations);
addDateTimePicker();
});
});
$('#tableid_2').change(function() {
$('#tableid_2').change(function () {
//AJAX request for field type, collation, operators, and value field
$.post('tbl_zoom_select.php',{
$.post('tbl_zoom_select.php', {
'ajax_request' : true,
'change_tbl_info' : true,
'db' : PMA_commonParams.get('db'),
@ -200,20 +200,20 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'field' : $('#tableid_2').val(),
'it' : 2,
'token' : PMA_commonParams.get('token')
},function(data) {
}, function (data) {
$('#tableFieldsId tr:eq(6) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(6) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(6) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(6) td:eq(3)').html(data.field_value);
$('#types_2').val(data.field_type);
$('#collations_2').val(data.field_collations);
addDateTimePicker();
$('#types_2').val(data.field_type);
$('#collations_2').val(data.field_collations);
addDateTimePicker();
});
});
$('#tableid_3').change(function() {
$('#tableid_3').change(function () {
//AJAX request for field type, collation, operators, and value field
$.post('tbl_zoom_select.php',{
$.post('tbl_zoom_select.php', {
'ajax_request' : true,
'change_tbl_info' : true,
'db' : PMA_commonParams.get('db'),
@ -221,25 +221,25 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'field' : $('#tableid_3').val(),
'it' : 3,
'token' : PMA_commonParams.get('token')
},function(data) {
}, function (data) {
$('#tableFieldsId tr:eq(8) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(8) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(8) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(8) td:eq(3)').html(data.field_value);
$('#types_3').val(data.field_type);
$('#collations_3').val(data.field_collations);
addDateTimePicker();
$('#types_3').val(data.field_type);
$('#collations_3').val(data.field_collations);
addDateTimePicker();
});
});
/**
* Input form validation
**/
$('#inputFormSubmitId').click(function() {
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0) {
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
$('#inputFormSubmitId').click(function () {
if ($('#tableid_0').get(0).selectedIndex === 0 || $('#tableid_1').get(0).selectedIndex === 0) {
PMA_ajaxShowMessage(PMA_messages.strInputNull);
} else if (xLabel == yLabel) {
PMA_ajaxShowMessage(PMA_messages['strSameInputs']);
PMA_ajaxShowMessage(PMA_messages.strSameInputs);
}
});
@ -253,18 +253,18 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
.hide();
$('#togglesearchformlink')
.html(PMA_messages['strShowSearchCriteria'])
.bind('click', function() {
.html(PMA_messages.strShowSearchCriteria)
.bind('click', function () {
var $link = $(this);
$('#zoom_search_form').slideToggle();
if ($link.text() == PMA_messages['strHideSearchCriteria']) {
$link.text(PMA_messages['strShowSearchCriteria']);
if ($link.text() == PMA_messages.strHideSearchCriteria) {
$link.text(PMA_messages.strShowSearchCriteria);
} else {
$link.text(PMA_messages['strHideSearchCriteria']);
$link.text(PMA_messages.strHideSearchCriteria);
}
// avoid default click action
return false;
});
// avoid default click action
return false;
});
/**
** Set dialog properties for the data display form
@ -273,7 +273,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
/*
* Handle saving of a row in the editor
*/
buttonOptions[PMA_messages['strSave']] = function () {
buttonOptions[PMA_messages.strSave] = function () {
//Find changed values by comparing form values with selectedRow Object
var newValues = {};//Stores the values changed from original
var sqlTypes = {};
@ -285,7 +285,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
var oldVal = selectedRow[key];
var newVal = ($('#edit_fields_null_id_' + it).prop('checked')) ? null : $('#edit_fieldID_' + it).val();
if (newVal instanceof Array) { // when the column is of type SET
newVal = $('#edit_fieldID_' + it).map(function(){
newVal = $('#edit_fieldID_' + it).map(function () {
return $(this).val();
}).get().join(",");
}
@ -348,21 +348,21 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
if (!isEmpty(newValues)) {
var sql_query = 'UPDATE `' + PMA_commonParams.get('table') + '` SET ';
for (key in newValues) {
sql_query += '`' + key + '`=' ;
sql_query += '`' + key + '`=';
var value = newValues[key];
// null
if (value == null) {
if (value === null) {
sql_query += 'NULL, ';
// empty
} else if ($.trim(value) == '') {
} else if ($.trim(value) === '') {
sql_query += "'', ";
// other
} else {
// type explicitly identified
if (sqlTypes[key] != null) {
if (sqlTypes[key] !== null) {
if (sqlTypes[key] == 'bit') {
sql_query += "b'" + value + "', ";
}
@ -386,23 +386,23 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'ajax_request' : true,
'sql_query' : sql_query,
'inline_edit' : false
}, function(data) {
if (data.success == true) {
}, function (data) {
if (data.success === true) {
$('#sqlqueryresults').html(data.sql_query);
$("#sqlqueryresults").trigger('appendAnchor');
} else {
PMA_ajaxShowMessage(data.error, false);
}
}); //End $.post
}); //End $.post
}//End database update
$("#dataDisplay").dialog('close');
};
buttonOptions[PMA_messages['strCancel']] = function () {
buttonOptions[PMA_messages.strCancel] = function () {
$(this).dialog('close');
};
$("#dataDisplay").dialog({
autoOpen: false,
title: PMA_messages['strDataPointContent'],
title: PMA_messages.strDataPointContent,
modal: true,
buttons: buttonOptions,
width: $('#dataDisplay').width() + 80,
@ -418,8 +418,8 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
$("#dataDisplay").find(':input').live('keydown', function (e) {
if (e.which === 13) { // 13 is the ENTER key
e.preventDefault();
if (typeof buttonOptions[PMA_messages['strSave']] === 'function') {
buttonOptions[PMA_messages['strSave']].call();
if (typeof buttonOptions[PMA_messages.strSave] === 'function') {
buttonOptions[PMA_messages.strSave].call();
}
}
});
@ -429,12 +429,12 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
* Generate plot using jqplot
*/
if (searchedData != null) {
if (searchedData !== null) {
$('#zoom_search_form')
.slideToggle()
.hide();
$('#togglesearchformlink')
.text(PMA_messages['strShowSearchCriteria']);
.text(PMA_messages.strShowSearchCriteria);
$('#togglesearchformdiv').show();
var selectedRow;
var colorCodes = ['#FF0000', '#00FFFF', '#0000FF', '#0000A0', '#FF0080', '#800080', '#FFFF00', '#00FF00', '#FF00FF'];
@ -483,7 +483,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
};
// If data label is not set, do not show tooltips
if (dataLabel == '') {
if (dataLabel === '') {
options.highlighter.show = false;
}
@ -507,7 +507,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
// format = '%Y-%m-%d %H:%M';
//}
$.extend(options.axes.xaxis, {
renderer:$.jqplot.DateAxisRenderer,
renderer: $.jqplot.DateAxisRenderer,
tickOptions: {
formatString: format
}
@ -520,14 +520,14 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
format = '%Y-%m-%d';
}
$.extend(options.axes.yaxis, {
renderer:$.jqplot.DateAxisRenderer,
renderer: $.jqplot.DateAxisRenderer,
tickOptions: {
formatString: format
}
});
}
$.each(searchedData, function(key, value) {
$.each(searchedData, function (key, value) {
if (xType == 'numeric') {
var xVal = parseFloat(value[xLabel]);
}
@ -557,21 +557,21 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
currentChart = $.jqplot('querychart', series, options);
currentChart.resetZoom();
$('button.button-reset').click(function(event) {
$('button.button-reset').click(function (event) {
event.preventDefault();
currentChart.resetZoom();
});
$('div#resizer').resizable();
$('div#resizer').bind('resizestop', function(event, ui) {
$('div#resizer').bind('resizestop', function (event, ui) {
// make room so that the handle will still appear
$('div#querychart').height($('div#resizer').height() * 0.96);
$('div#querychart').width($('div#resizer').width() * 0.96);
currentChart.replot( {resetAxes: true})
currentChart.replot({resetAxes: true});
});
$('div#querychart').bind('jqplotDataClick',
function(event, seriesIndex, pointIndex, data) {
function (event, seriesIndex, pointIndex, data) {
searchedDataKey = data[4]; // key from searchedData (global)
var field_id = 0;
var post_params = {
@ -583,14 +583,14 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
'token' : PMA_commonParams.get('token')
};
$.post('tbl_zoom_select.php', post_params, function(data) {
$.post('tbl_zoom_select.php', post_params, function (data) {
// Row is contained in data.row_info,
// now fill the displayResultForm with row values
var key;
for (key in data.row_info) {
$field = $('#edit_fieldID_' + field_id);
$field_null = $('#edit_fields_null_id_' + field_id);
if (data.row_info[key] == null) {
if (data.row_info[key] === null) {
$field_null.prop('checked', true);
$field.val('');
} else {

View File

@ -91,7 +91,7 @@ class PMA_Config
// other settings, independent from config file, comes in
$this->checkSystem();
$this->checkIsHttps();
$this->isHttps();
}
/**
@ -1178,7 +1178,7 @@ class PMA_Config
function set($setting, $value)
{
if (! isset($this->settings[$setting])
|| $this->settings[$setting] != $value
|| $this->settings[$setting] !== $value
) {
$this->settings[$setting] = $value;
$this->set_mtime = time();
@ -1473,16 +1473,6 @@ class PMA_Config
}
}
/**
* check for https
*
* @return void
*/
function checkIsHttps()
{
$this->set('is_https', $this->isHttps());
}
/**
* Checks if protocol is https
*
@ -1494,13 +1484,13 @@ class PMA_Config
*/
public function isHttps()
{
static $is_https = null;
if (null !== $is_https) {
return $is_https;
if (null !== $this->get('is_https')) {
return $this->get('is_https');
}
$url = parse_url($this->get('PmaAbsoluteUri'));
$is_https = null;
if (isset($url['scheme']) && $url['scheme'] == 'https') {
$is_https = true;
@ -1508,6 +1498,8 @@ class PMA_Config
$is_https = false;
}
$this->set('is_https', $is_https);
return $is_https;
}

View File

@ -361,7 +361,7 @@ class PMA_DbQbe
private function _getColumnNamesRow()
{
$html_output = '<tr class="odd noclick">';
$html_output .= '<th>' . __('Column') . ':</th>';
$html_output .= '<th>' . __('Column:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
if (isset($this->_criteriaColumnInsert[$column_index])
@ -403,7 +403,7 @@ class PMA_DbQbe
private function _getSortRow()
{
$html_output = '<tr class="even noclick">';
$html_output .= '<th>' . __('Sort') . ':</th>';
$html_output .= '<th>' . __('Sort:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
if (! empty($this->_criteriaColumnInsert)
@ -465,7 +465,7 @@ class PMA_DbQbe
private function _getShowRow()
{
$html_output = '<tr class="odd noclick">';
$html_output .= '<th>' . __('Show') . ':</th>';
$html_output .= '<th>' . __('Show:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
if (! empty($this->_criteriaColumnInsert)
@ -510,7 +510,7 @@ class PMA_DbQbe
private function _getCriteriaInputboxRow()
{
$html_output = '<tr class="even noclick">';
$html_output .= '<th>' . __('Criteria') . ':</th>';
$html_output .= '<th>' . __('Criteria:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
if (! empty($this->_criteriaColumnInsert)
@ -650,11 +650,11 @@ class PMA_DbQbe
private function _getAndOrColCell($column_number, $selected = null)
{
$html_output = '<td class="center">';
$html_output .= '<strong>' . __('Or') . ':</strong>';
$html_output .= '<strong>' . __('Or:') . '</strong>';
$html_output .= '<input type="radio"'
. ' name="criteriaAndOrColumn[' . $column_number . ']"'
. ' value="or"' . $selected['or'] . ' />';
$html_output .= '&nbsp;&nbsp;<strong>' . __('And') . ':</strong>';
$html_output .= '&nbsp;&nbsp;<strong>' . __('And:') . '</strong>';
$html_output .= '<input type="radio"'
. ' name="criteriaAndOrColumn[' . $column_number . ']"'
. ' value="and"' . $selected['and'] . ' />';
@ -677,7 +677,7 @@ class PMA_DbQbe
private function _getModifyColumnsRow()
{
$html_output = '<tr class="even noclick">';
$html_output .= '<th>' . __('Modify') . ':</th>';
$html_output .= '<th>' . __('Modify:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
if (! empty($this->_criteriaColumnInsert)
@ -734,12 +734,12 @@ class PMA_DbQbe
$html_output .= '<table class="nospacing nopadding">';
$html_output .= '<tr>';
$html_output .= '<td class="' . $GLOBALS['cell_align_right'] . ' nowrap">';
$html_output .= '<small>' . __('Ins') . ':</small>';
$html_output .= '<small>' . __('Ins:') . '</small>';
$html_output .= '<input type="checkbox"'
. ' name="criteriaRowInsert[' . $row_index . ']" />';
$html_output .= '</td>';
$html_output .= '<td class="' . $GLOBALS['cell_align_right'] . '">';
$html_output .= '<strong>' . __('And') . ':</strong>';
$html_output .= '<strong>' . __('And:') . '</strong>';
$html_output .= '</td>';
$html_output .= '<td>';
$html_output .= '<input type="radio"'
@ -749,12 +749,12 @@ class PMA_DbQbe
$html_output .= '</tr>';
$html_output .= '<tr>';
$html_output .= '<td class="' . $GLOBALS['cell_align_right'] . ' nowrap">';
$html_output .= '<small>' . __('Del') . ':</small>';
$html_output .= '<small>' . __('Del:') . '</small>';
$html_output .= '<input type="checkbox"'
. ' name="criteriaRowDelete[' . $row_index . ']" />';
$html_output .= '</td>';
$html_output .= '<td class="' . $GLOBALS['cell_align_right'] . '">';
$html_output .= '<strong>' . __('Or') . ':</strong>';
$html_output .= '<strong>' . __('Or:') . '</strong>';
$html_output .= '</td>';
$html_output .= '<td>';
$html_output .= '<input type="radio"'

View File

@ -900,12 +900,12 @@ class PMA_DisplayResults
. '" />'
. '<input type="submit" name="navig"'
. ' class="ajax"'
. ' value="' . __('Show') . ' :" />'
. __('Start row') . ': ' . "\n"
. ' value="' . __('Show:') . '" />'
. __('Start row:') . ' ' . "\n"
. '<input type="text" name="pos" size="3" value="'
. (($pos_next >= $this->__get('unlim_num_rows')) ? 0 : $pos_next)
. '" class="textfield" onfocus="this.select()" />'
. __('Number of rows') . ': ' . "\n"
. __('Number of rows:') . ' ' . "\n"
. '<input type="text" name="session_max_rows" size="3" value="'
. (($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS)
? $_SESSION['tmp_user_values']['max_rows']
@ -914,7 +914,7 @@ class PMA_DisplayResults
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical and repeat headers)
$additional_fields_html .= __('Mode') . ': ' . "\n";
$additional_fields_html .= __('Mode:') . ' ' . "\n";
$choices = array(
'horizontal' => __('horizontal'),
'horizontalflipped' => __('horizontal (rotated headers)'),

View File

@ -439,6 +439,9 @@ class PMA_Header
*/
public function sendHttpHeaders()
{
$https = $GLOBALS['PMA_Config']->isHttps();
$mapTilesUrls = ' *.tile.openstreetmap.org *.tile.opencyclemap.org';
/**
* Sends http headers
*/
@ -447,7 +450,9 @@ class PMA_Header
header(
"X-Content-Security-Policy: allow 'self';"
. "options inline-script eval-script;"
. "img-src 'self' data:; "
. "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
);
if (PMA_USR_BROWSER_AGENT == 'SAFARI'
&& PMA_USR_BROWSER_VER < '6.0.0'
@ -455,13 +460,18 @@ class PMA_Header
header(
"X-WebKit-CSP: allow 'self';"
. "options inline-script eval-script;"
. "img-src 'self' data:; "
. "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
);
} else {
header(
"X-WebKit-CSP: default-src 'self';"
. "script-src 'self' 'unsafe-inline' 'unsafe-eval';"
. "style-src 'self' 'unsafe-inline'"
. "style-src 'self' 'unsafe-inline';"
. "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
);
}
}

View File

@ -1,5 +1,4 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Output buffering wrapper
*
@ -50,8 +49,8 @@ class PMA_OutputBuffering
} elseif (function_exists('ob_get_level') && ob_get_level() > 0) {
// If output buffering is enabled in php.ini it's not possible to
// add the ob_gzhandler without a warning message from php 4.3.0.
// Being better safe than sorry, check for any existing output handler
// instead of just checking the 'output_buffering' setting.
// Being better safe than sorry, check for any existing output
// handler instead of just checking the 'output_buffering' setting.
$mode = 0;
} else {
$mode = 1;

View File

@ -840,8 +840,8 @@ class PMA_Table
$sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
// If table exists, and 'add drop table' is selected: Drop it!
$drop_query = '';
if (isset($GLOBALS['drop_if_exists'])
&& $GLOBALS['drop_if_exists'] == 'true'
if (isset($_REQUEST['drop_if_exists'])
&& $_REQUEST['drop_if_exists'] == 'true'
) {
if (PMA_Table::isView($target_db, $target_table)) {
$drop_query = 'DROP VIEW';
@ -1161,7 +1161,7 @@ class PMA_Table
if (null !== $new_db && $new_db !== $this->getDbName()) {
// Ensure the target is valid
if (! $GLOBALS['pma']->databases->exists($new_db)) {
$this->errors[] = __('Invalid database') . ': ' . $new_db;
$this->errors[] = __('Invalid database:') . ' ' . $new_db;
return false;
}
} else {
@ -1175,7 +1175,7 @@ class PMA_Table
}
if (! PMA_Table::isValidName($new_name)) {
$this->errors[] = __('Invalid table name') . ': '
$this->errors[] = __('Invalid table name:') . ' '
. $new_table->getFullName();
return false;
}
@ -1575,7 +1575,7 @@ class PMA_Table
/**
* Get all column names which are MySQL reserved words
*
*
* @return array
* @access public
*/
@ -1589,7 +1589,7 @@ class PMA_Table
if (PMA_SQP_isKeyWord($column_name)) {
$return[] = $column_name;
}
}
}
return $return;
}
}

View File

@ -360,7 +360,7 @@ class PMA_Theme_Manager
$theme_preview_path= './themes.php';
$theme_preview_href = '<a href="' . $theme_preview_path . '" target="themes" class="themeselect">';
$select_box .= $theme_preview_href . __('Theme') . '</a>:' . "\n";
$select_box .= $theme_preview_href . __('Theme:') . '</a>' . "\n";
$select_box .= '<select name="set_theme" lang="en" dir="ltr" class="autosubmit">';
foreach ($this->themes as $each_theme_id => $each_theme) {

View File

@ -941,6 +941,9 @@ class PMA_Tracker
if (empty($dbname)) {
return;
}
// Remove null bytes (preg_replace() is vulnerable in some
// PHP versions)
$dbname = str_replace("\0", "", $dbname);
// If we found a valid statement
if (isset($result['identifier'])) {

View File

@ -540,9 +540,11 @@ class PMA_Util
/* Provide consistent URL for testsuite */
return PMA_linkURL('http://docs.phpmyadmin.net/en/latest/' . $url);
} else if (file_exists('doc/html/index.html')) {
return './doc/html/' . $url;
} else if (defined('PMA_SETUP') && file_exists('../doc/html/index.html')) {
return '../doc/html/' . $url;
if (defined('PMA_SETUP')) {
return '../doc/html/' . $url;
} else {
return './doc/html/' . $url;
}
} else {
/* TODO: Should link to correct branch for released versions */
return PMA_linkURL('http://docs.phpmyadmin.net/en/latest/' . $url);
@ -669,7 +671,7 @@ class PMA_Util
}
// ---
// modified to show the help on sql errors
$error_msg .= '<p><strong>' . __('SQL query') . ':</strong>' . "\n";
$error_msg .= '<p><strong>' . __('SQL query:') . '</strong>' . "\n";
if (strstr(strtolower($formatted_sql), 'select')) {
// please show me help to the error on select
$error_msg .= self::showMySQLDocu('SQL-Syntax', 'SELECT');
@ -3959,10 +3961,18 @@ class PMA_Util
public static function analyzeLimitClause($limit_clause)
{
$start_and_length = explode(',', str_ireplace('LIMIT', '', $limit_clause));
return array(
'start' => trim($start_and_length[0]),
'length' => trim($start_and_length[1])
);
$size = count($start_and_length);
if ($size == 1) {
return array(
'start' => '0',
'length' => trim($start_and_length[0])
);
} elseif ($size == 2) {
return array(
'start' => trim($start_and_length[0]),
'length' => trim($start_and_length[1])
);
}
}
/**

View File

@ -651,7 +651,7 @@ if (! isset($cfg['Servers']) || count($cfg['Servers']) == 0) {
&& empty($each_server['host'])
&& empty($each_server['verbose'])
) {
$each_server['verbose'] = __('Server') . $server_index;
$each_server['verbose'] = sprintf(__('Server %d'), $server_index);
}
$new_servers[$server_index] = $each_server;

View File

@ -131,12 +131,10 @@ function PMA_displayInput($path, $name, $type, $value, $description = '',
$value_is_default = true, $opts = null
) {
global $_FormDisplayGroup;
static $base_dir; // Relative path to the root phpMyAdmin folder
static $icons; // An array of IMG tags used further below in the function
$is_setup_script = defined('PMA_SETUP');
if ($base_dir === null) { // if the static variables have not been initialised
$base_dir = $is_setup_script ? '../' : '';
if ($icons === null) { // if the static variables have not been initialised
$icons = array();
// Icon definitions:
// The same indexes will be used in the $icons array.
@ -205,7 +203,7 @@ function PMA_displayInput($path, $name, $type, $value, $description = '',
if (! empty($opts['doc']) || ! empty($opts['wiki'])) {
echo '<span class="doc">';
if (! empty($opts['doc'])) {
echo '<a href="' . $base_dir . $opts['doc']
echo '<a href="' . $opts['doc']
. '" target="documentation">' . $icons['help'] . '</a>';
echo "\n";
}

View File

@ -70,22 +70,22 @@ $strConfigExport_charset_name = __('Character set of the file');
$strConfigExport_codegen_format_name = __('Format');
$strConfigExport_compression_name = __('Compression');
$strConfigExport_csv_columns_name = __('Put columns names in the first row');
$strConfigExport_csv_enclosed_name = __('Columns enclosed by');
$strConfigExport_csv_escaped_name = __('Columns escaped by');
$strConfigExport_csv_null_name = __('Replace NULL by');
$strConfigExport_csv_enclosed_name = __('Columns enclosed with');
$strConfigExport_csv_escaped_name = __('Columns escaped with');
$strConfigExport_csv_null_name = __('Replace NULL with');
$strConfigExport_csv_removeCRLF_name = __('Remove CRLF characters within columns');
$strConfigExport_csv_separator_name = __('Columns terminated by');
$strConfigExport_csv_terminated_name = __('Lines terminated by');
$strConfigExport_csv_separator_name = __('Columns terminated with');
$strConfigExport_csv_terminated_name = __('Lines terminated with');
$strConfigExport_excel_columns_name = __('Put columns names in the first row');
$strConfigExport_excel_edition_name = __('Excel edition');
$strConfigExport_excel_null_name = __('Replace NULL by');
$strConfigExport_excel_null_name = __('Replace NULL with');
$strConfigExport_excel_removeCRLF_name = __('Remove CRLF characters within columns');
$strConfigExport_file_template_database_name = __('Database name template');
$strConfigExport_file_template_server_name = __('Server name template');
$strConfigExport_file_template_table_name = __('Table name template');
$strConfigExport_format_name = __('Format');
$strConfigExport_htmlword_columns_name = __('Put columns names in the first row');
$strConfigExport_htmlword_null_name = __('Replace NULL by');
$strConfigExport_htmlword_null_name = __('Replace NULL with');
$strConfigExport_htmlword_structure_or_data_name = __('Dump table');
$strConfigExport_latex_caption_name = __('Include table caption');
$strConfigExport_latex_columns_name = __('Put columns names in the first row');
@ -94,7 +94,7 @@ $strConfigExport_latex_data_caption_name = __('Table caption');
$strConfigExport_latex_data_continued_caption_name = __('Continued table caption');
$strConfigExport_latex_data_label_name = __('Label key');
$strConfigExport_latex_mime_name = __('MIME type');
$strConfigExport_latex_null_name = __('Replace NULL by');
$strConfigExport_latex_null_name = __('Replace NULL with');
$strConfigExport_latex_relation_name = __('Relations');
$strConfigExport_latex_structure_caption_name = __('Table caption');
$strConfigExport_latex_structure_continued_caption_name = __('Continued table caption');
@ -102,11 +102,11 @@ $strConfigExport_latex_structure_label_name = __('Label key');
$strConfigExport_latex_structure_or_data_name = __('Dump table');
$strConfigExport_method_name = __('Export method');
$strConfigExport_ods_columns_name = __('Put columns names in the first row');
$strConfigExport_ods_null_name = __('Replace NULL by');
$strConfigExport_ods_null_name = __('Replace NULL with');
$strConfigExport_odt_columns_name = __('Put columns names in the first row');
$strConfigExport_odt_comments_name = __('Comments');
$strConfigExport_odt_mime_name = __('MIME type');
$strConfigExport_odt_null_name = __('Replace NULL by');
$strConfigExport_odt_null_name = __('Replace NULL with');
$strConfigExport_odt_relation_name = __('Relations');
$strConfigExport_odt_structure_or_data_name = __('Dump table');
$strConfigExport_onserver_name = __('Save on server');
@ -137,12 +137,12 @@ $strConfigExport_sql_type_name = __('Export type');
$strConfigExport_sql_use_transaction_name = __('Enclose export in a transaction');
$strConfigExport_sql_utc_time_name = __('Export time in UTC');
$strConfigExport_texytext_columns_name = __('Put columns names in the first row');
$strConfigExport_texytext_null_name = __('Replace NULL by');
$strConfigExport_texytext_null_name = __('Replace NULL with');
$strConfigExport_texytext_structure_or_data_name = __('Dump table');
$strConfigExport_xls_columns_name = __('Put columns names in the first row');
$strConfigExport_xls_null_name = __('Replace NULL by');
$strConfigExport_xls_null_name = __('Replace NULL with');
$strConfigExport_xlsx_columns_name = __('Put columns names in the first row');
$strConfigExport_xlsx_null_name = __('Replace NULL by');
$strConfigExport_xlsx_null_name = __('Replace NULL with');
$strConfigForceSSL_desc = __('Force secured connection while using phpMyAdmin');
$strConfigForceSSL_name = __('Force SSL connection');
$strConfigForeignKeyDropdownOrder_desc = __('Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value');
@ -239,20 +239,20 @@ $strConfigIgnoreMultiSubmitErrors_name = __('Ignore multiple statement errors');
$strConfigImport_allow_interrupt_desc = __('Allow interrupt of import in case script detects it is close to time limit. This might be a good way to import large files, however it can break transactions.');
$strConfigImport_allow_interrupt_name = __('Partial import: allow interrupt');
$strConfigImport_charset_name = __('Character set of the file');
$strConfigImport_csv_col_names_name = __('Lines terminated by');
$strConfigImport_csv_enclosed_name = __('Columns enclosed by');
$strConfigImport_csv_escaped_name = __('Columns escaped by');
$strConfigImport_csv_col_names_name = __('Lines terminated with');
$strConfigImport_csv_enclosed_name = __('Columns enclosed with');
$strConfigImport_csv_escaped_name = __('Columns escaped with');
$strConfigImport_csv_ignore_name = __('Do not abort on INSERT error');
$strConfigImport_csv_replace_name = __('Replace table data with file');
$strConfigImport_csv_terminated_name = __('Columns terminated by');
$strConfigImport_csv_terminated_name = __('Columns terminated with');
$strConfigImport_format_desc = __('Default format; be aware that this list depends on location (database, table) and only SQL is always available');
$strConfigImport_format_name = __('Format of imported file');
$strConfigImport_ldi_enclosed_name = __('Columns enclosed by');
$strConfigImport_ldi_escaped_name = __('Columns escaped by');
$strConfigImport_ldi_enclosed_name = __('Columns enclosed with');
$strConfigImport_ldi_escaped_name = __('Columns escaped with');
$strConfigImport_ldi_ignore_name = __('Do not abort on INSERT error');
$strConfigImport_ldi_local_option_name = __('Use LOCAL keyword');
$strConfigImport_ldi_replace_name = __('Replace table data with file');
$strConfigImport_ldi_terminated_name = __('Columns terminated by');
$strConfigImport_ldi_terminated_name = __('Columns terminated with');
$strConfigImport_ods_col_names_name = __('Column names in first row');
$strConfigImport_ods_empty_rows_name = __('Do not import empty rows');
$strConfigImport_ods_recognize_currency_name = __('Import currencies ($5.00 to 5.00)');

View File

@ -432,7 +432,7 @@ function validate_trusted_proxies($path, $values)
$matches = array();
// we catch anything that may (or may not) be an IP
if (!preg_match("/^(.+):(?:[ ]?)\\w+$/", $line, $matches)) {
$result[$path][] = __('Incorrect value') . ': ' . $line;
$result[$path][] = __('Incorrect value:') . ' ' . $line;
continue;
}
// now let's check whether we really have an IP address

View File

@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) {
}
/**
* Get HTML for the Change password dialog
* Get HTML for the Change password dialog
*
* @param string $username username
* @param string $hostname hostname
@ -31,7 +31,7 @@ function PMA_getHtmlForChangePassword($username, $hostname)
$html = '<form method="post" id="change_password_form" '
. 'action="' . $GLOBALS['PMA_PHP_SELF'] . '" '
. 'name="chgPassword" '
. 'name="chgPassword" '
. 'class="ajax" >';
$html .= PMA_generate_common_hidden_inputs();
@ -58,20 +58,20 @@ function PMA_getHtmlForChangePassword($username, $hostname)
. '<input type="radio" name="nopass" value="0" id="nopass_0" '
. 'onclick="document.getElementById(\'text_pma_pw\').focus();" '
. 'checked="checked " />'
. '<label for="nopass_0">' . __('Password') . ':&nbsp;</label>'
. '<label for="nopass_0">' . __('Password:') . '&nbsp;</label>'
. '</td>'
. '<td>'
. '<input type="password" name="pma_pw" id="text_pma_pw" size="10" '
. 'class="textfield"'
. 'class="textfield"'
. $chg_evt_handler . '="nopass[1].checked = true" />'
. '&nbsp;&nbsp;' . __('Re-type') . ':&nbsp;'
. '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;'
. '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" '
. 'class="textfield"'
. $chg_evt_handler . '="nopass[1].checked = true" />'
. '</td>'
. '</tr>'
. '<tr class="vmiddle">'
. '<td>' . __('Password Hashing') . ':'
. '<td>' . __('Password Hashing:')
. '</td>'
. '<td>'
. '<input type="radio" name="pw_hash" id="radio_pw_hash_new" '
@ -84,7 +84,7 @@ function PMA_getHtmlForChangePassword($username, $hostname)
. '<td>'
. '<input type="radio" name="pw_hash" id="radio_pw_hash_old" '
. 'value="old" />'
. '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible')
. '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible')
. '</label>'
. '</td>'
. '</tr>'

View File

@ -18,7 +18,7 @@ if ($is_create_db_priv) {
// The user is allowed to create a db
?>
<form method="post" action="db_create.php" id="create_database_form" class="ajax"><strong>
<?php echo '<label for="text_create_db">'
<?php echo '<label for="text_create_db">'
. PMA_Util::getImage('b_newdb.png')
. " " . __('Create database')
. '</label>&nbsp;'
@ -40,7 +40,7 @@ if ($is_create_db_priv) {
} else {
?>
<!-- db creation no privileges message -->
<strong><?php echo __('Create database') . ':&nbsp;' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
<strong><?php echo __('Create database:') . '&nbsp;' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
<?php
echo '<span class="noPrivileges">'
. PMA_Util::getImage('s_error2.png', '', array('hspace' => 2, 'border' => 0, 'align' => 'middle'))

View File

@ -29,7 +29,7 @@ require_once './libraries/plugin_interface.lib.php';
function PMA_exportCheckboxCheck($str)
{
if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
echo ' checked="checked"';
return ' checked="checked"';
}
}
@ -51,24 +51,28 @@ if (empty($export_list)) {
exit;
}
echo '<form method="post" action="export.php" name="dump" class="disableAjax">';
$html = "";
$html .= '<form method="post" action="export.php" '
. ' name="dump" class="disableAjax">';
if ($export_type == 'server') {
echo PMA_generate_common_hidden_inputs('', '', 1);
$html .= PMA_generate_common_hidden_inputs('', '', 1);
} elseif ($export_type == 'database') {
echo PMA_generate_common_hidden_inputs($db, '', 1);
$html .= PMA_generate_common_hidden_inputs($db, '', 1);
} else {
echo PMA_generate_common_hidden_inputs($db, $table, 1);
$html .= PMA_generate_common_hidden_inputs($db, $table, 1);
}
// just to keep this value for possible next display of this form after saving
// on server
if (isset($single_table)) {
echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
$html .= '<input type="hidden" name="single_table" value="TRUE" />'
. "\n";
}
echo '<input type="hidden" name="export_type" value="' . $export_type . '" />';
echo "\n";
$html .= '<input type="hidden" name="export_type" value="'
. $export_type . '" />';
$html .= "\n";
// If the export method was not set, the default is quick
if (isset($_GET['export_method'])) {
@ -77,30 +81,30 @@ if (isset($_GET['export_method'])) {
$cfg['Export']['method'] = 'quick';
}
// The export method (quick, custom or custom-no-form)
echo '<input type="hidden" name="export_method" value="'
$html .= '<input type="hidden" name="export_method" value="'
. htmlspecialchars($cfg['Export']['method']) . '" />';
if (isset($_GET['sql_query'])) {
echo '<input type="hidden" name="sql_query" value="'
$html .= '<input type="hidden" name="sql_query" value="'
. htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
} elseif (! empty($sql_query)) {
echo '<input type="hidden" name="sql_query" value="'
$html .= '<input type="hidden" name="sql_query" value="'
. htmlspecialchars($sql_query) . '" />' . "\n";
}
echo '<div class="exportoptions" id="header">';
echo '<h2>';
echo PMA_Util::getImage('b_export.png', __('Export'));
$html .= '<div class="exportoptions" id="header">';
$html .= '<h2>';
$html .= PMA_Util::getImage('b_export.png', __('Export'));
if ($export_type == 'server') {
echo __('Exporting databases from the current server');
$html .= __('Exporting databases from the current server');
} elseif ($export_type == 'database') {
printf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
$html .= sprintf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
} else {
printf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
$html .= sprintf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
}
echo '</h2>';
echo '</div>';
$html .= '</h2>';
$html .= '</div>';
if (isset($_GET['quick_or_custom'])) {
$export_method = $_GET['quick_or_custom'];
@ -108,162 +112,163 @@ if (isset($_GET['quick_or_custom'])) {
$export_method = $cfg['Export']['method'];
}
echo '<div class="exportoptions" id="quick_or_custom">';
echo '<h3>' . __('Export Method:') . '</h3>';
echo '<ul>';
echo '<li>';
echo '<input type="radio" name="quick_or_custom" value="quick" '
$html .= '<div class="exportoptions" id="quick_or_custom">';
$html .= '<h3>' . __('Export Method:') . '</h3>';
$html .= '<ul>';
$html .= '<li>';
$html .= '<input type="radio" name="quick_or_custom" value="quick" '
. ' id="radio_quick_export"';
if ($export_method == 'quick' || $export_method == 'quick_no_form') {
echo ' checked="checked"';
$html .= ' checked="checked"';
}
echo ' />';
echo '<label for ="radio_quick_export">';
echo __('Quick - display only the minimal options');
echo '</label>';
echo '</li>';
$html .= ' />';
$html .= '<label for ="radio_quick_export">';
$html .= __('Quick - display only the minimal options');
$html .= '</label>';
$html .= '</li>';
echo '<li>';
echo '<input type="radio" name="quick_or_custom" value="custom" '
$html .= '<li>';
$html .= '<input type="radio" name="quick_or_custom" value="custom" '
. ' id="radio_custom_export"';
if ($export_method == 'custom' || $export_method == 'custom_no_form') {
echo ' checked="checked"';
$html .= ' checked="checked"';
}
echo ' />';
echo '<label for="radio_custom_export">';
echo __('Custom - display all possible options');
echo '</label>';
echo '</li>';
$html .= ' />';
$html .= '<label for="radio_custom_export">';
$html .= __('Custom - display all possible options');
$html .= '</label>';
$html .= '</li>';
echo '</ul>';
echo '</div>';
$html .= '</ul>';
$html .= '</div>';
echo '<div class="exportoptions" id="databases_and_tables">';
$html .= '<div class="exportoptions" id="databases_and_tables">';
if ($export_type == 'server') {
echo '<h3>' . __('Database(s):') . '</h3>';
$html .= '<h3>' . __('Database(s):') . '</h3>';
} else if ($export_type == 'database') {
echo '<h3>' . __('Table(s):') . '</h3>';
$html .= '<h3>' . __('Table(s):') . '</h3>';
}
if (! empty($multi_values)) {
echo $multi_values;
$html .= $multi_values;
}
echo '</div>';
$html .= '</div>';
if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table)) {
echo '<div class="exportoptions" id="rows">';
echo '<h3>' . __('Rows:') . '</h3>';
echo '<ul>';
echo '<li>';
echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0"';
$html .= '<div class="exportoptions" id="rows">';
$html .= '<h3>' . __('Rows:') . '</h3>';
$html .= '<ul>';
$html .= '<li>';
$html .= '<input type="radio" name="allrows" value="0" id="radio_allrows_0"';
if (isset($_GET['allrows']) && $_GET['allrows'] == 0) {
echo ' checked="checked"';
$html .= ' checked="checked"';
}
echo '/>';
echo '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>';
echo '<ul>';
echo '<li>';
echo '<label for="limit_to">' . __('Number of rows:') . '</label>';
echo '<input type="text" id="limit_to" name="limit_to" size="5" value="';
$html .= '/>';
$html .= '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>';
$html .= '<ul>';
$html .= '<li>';
$html .= '<label for="limit_to">' . __('Number of rows:') . '</label>';
$html .= '<input type="text" id="limit_to" name="limit_to" size="5" value="';
if (isset($_GET['limit_to'])) {
echo htmlspecialchars($_GET['limit_to']);
$html .= htmlspecialchars($_GET['limit_to']);
} elseif (isset($unlim_num_rows)) {
echo $unlim_num_rows;
$html .= $unlim_num_rows;
} else {
echo PMA_Table::countRecords($db, $table);
$html .= PMA_Table::countRecords($db, $table);
}
echo '" onfocus="this.select()" />';
echo '</li>';
echo '<li>';
echo '<label for="limit_from">' . __('Row to begin at:') . '</label>';
echo '<input type="text" id="limit_from" name="limit_from" value="';
$html .= '" onfocus="this.select()" />';
$html .= '</li>';
$html .= '<li>';
$html .= '<label for="limit_from">' . __('Row to begin at:') . '</label>';
$html .= '<input type="text" id="limit_from" name="limit_from" value="';
if (isset($_GET['limit_from'])) {
echo htmlspecialchars($_GET['limit_from']);
$html .= htmlspecialchars($_GET['limit_from']);
} else {
echo '0';
$html .= '0';
}
echo '" size="5" onfocus="this.select()" />';
echo '</li>';
echo '</ul>';
echo '</li>';
echo '<li>';
echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1"';
if (isset($_GET['allrows']) && $_GET['allrows'] == 1) {
echo ' checked="checked"';
$html .= '" size="5" onfocus="this.select()" />';
$html .= '</li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li>';
$html .= '<input type="radio" name="allrows" value="1" id="radio_allrows_1"';
if (! isset($_GET['allrows']) || $_GET['allrows'] == 1) {
$html .= ' checked="checked"';
}
echo '/>';
echo ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';
echo '</li>';
echo '</ul>';
echo '</div>';
$html .= '/>';
$html .= ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</div>';
}
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
echo '<div class="exportoptions" id="output_quick_export">';
echo '<h3>' . __('Output:') . '</h3>';
echo '<ul>';
echo '<li>';
echo '<input type="checkbox" name="quick_export_onserver" value="saveit" ';
echo 'id="checkbox_quick_dump_onserver" ';
PMA_exportCheckboxCheck('quick_export_onserver');
echo '/>';
echo '<label for="checkbox_quick_dump_onserver">';
printf(
$html .= '<div class="exportoptions" id="output_quick_export">';
$html .= '<h3>' . __('Output:') . '</h3>';
$html .= '<ul>';
$html .= '<li>';
$html .= '<input type="checkbox" name="quick_export_onserver" value="saveit" ';
$html .= 'id="checkbox_quick_dump_onserver" ';
$html .= PMA_exportCheckboxCheck('quick_export_onserver');
$html .= '/>';
$html .= '<label for="checkbox_quick_dump_onserver">';
$html .= sprintf(
__('Save on server in the directory <b>%s</b>'),
htmlspecialchars(PMA_Util::userDir($cfg['SaveDir']))
);
echo '</label>';
echo '</li>';
echo '<li>';
echo '<input type="checkbox" name="quick_export_onserverover" ';
echo 'value="saveitover" id="checkbox_quick_dump_onserverover" ';
PMA_exportCheckboxCheck('quick_export_onserver_overwrite');
echo '/>';
echo '<label for="checkbox_quick_dump_onserverover">';
echo __('Overwrite existing file(s)');
echo '</label>';
echo '</li>';
echo '</ul>';
echo '</div>';
$html .= '</label>';
$html .= '</li>';
$html .= '<li>';
$html .= '<input type="checkbox" name="quick_export_onserverover" ';
$html .= 'value="saveitover" id="checkbox_quick_dump_onserverover" ';
$html .= PMA_exportCheckboxCheck('quick_export_onserver_overwrite');
$html .= '/>';
$html .= '<label for="checkbox_quick_dump_onserverover">';
$html .= __('Overwrite existing file(s)');
$html .= '</label>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</div>';
}
echo '<div class="exportoptions" id="output">';
echo '<h3>' . __('Output:') . '</h3>';
echo '<ul id="ul_output">';
echo '<li>';
echo '<input type="radio" name="output_format" value="sendit" ';
echo 'id="radio_dump_asfile" ';
$html .= '<div class="exportoptions" id="output">';
$html .= '<h3>' . __('Output:') . '</h3>';
$html .= '<ul id="ul_output">';
$html .= '<li>';
$html .= '<input type="radio" name="output_format" value="sendit" ';
$html .= 'id="radio_dump_asfile" ';
if (!isset($_GET['repopulate'])) {
PMA_exportCheckboxCheck('asfile');
$html .= PMA_exportCheckboxCheck('asfile');
}
echo '/>';
echo '<label for="radio_dump_asfile">' . __('Save output to a file') . '</label>';
echo '<ul id="ul_save_asfile">';
$html .= '/>';
$html .= '<label for="radio_dump_asfile">'
. __('Save output to a file') . '</label>';
$html .= '<ul id="ul_save_asfile">';
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
echo '<li>';
echo '<input type="checkbox" name="onserver" value="saveit" ';
echo 'id="checkbox_dump_onserver" ';
PMA_exportCheckboxCheck('onserver');
echo '/>';
echo '<label for="checkbox_dump_onserver">';
printf(
$html .= '<li>';
$html .= '<input type="checkbox" name="onserver" value="saveit" ';
$html .= 'id="checkbox_dump_onserver" ';
$html .= PMA_exportCheckboxCheck('onserver');
$html .= '/>';
$html .= '<label for="checkbox_dump_onserver">';
$html .= sprintf(
__('Save on server in the directory <b>%s</b>'),
htmlspecialchars(PMA_Util::userDir($cfg['SaveDir']))
);
echo '</label>';
echo '</li>';
echo '<li>';
echo '<input type="checkbox" name="onserverover" value="saveitover"';
echo ' id="checkbox_dump_onserverover" ';
PMA_exportCheckboxCheck('onserver_overwrite');
echo '/>';
echo '<label for="checkbox_dump_onserverover">';
echo __('Overwrite existing file(s)');
echo '</label>';
echo '</li>';
$html .= '</label>';
$html .= '</li>';
$html .= '<li>';
$html .= '<input type="checkbox" name="onserverover" value="saveitover"';
$html .= ' id="checkbox_dump_onserverover" ';
$html .= PMA_exportCheckboxCheck('onserver_overwrite');
$html .= '/>';
$html .= '<label for="checkbox_dump_onserverover">';
$html .= __('Overwrite existing file(s)');
$html .= '</label>';
$html .= '</li>';
}
echo '<li>';
echo '<label for="filename_template" class="desc">';
echo __('File name template:');
$html .= '<li>';
$html .= '<label for="filename_template" class="desc">';
$html .= __('File name template:');
$trans = new PMA_Message;
$trans->addMessage(__('@SERVER@ will become the server name'));
if ($export_type == 'database' || $export_type == 'table') {
@ -290,29 +295,29 @@ $msg->addParam(
);
$msg->addParam('</a>', false);
echo PMA_Util::showHint($msg);
echo '</label>';
echo '<input type="text" name="filename_template" id="filename_template" ';
echo ' value="';
$html .= PMA_Util::showHint($msg);
$html .= '</label>';
$html .= '<input type="text" name="filename_template" id="filename_template" ';
$html .= ' value="';
if (isset($_GET['filename_template'])) {
echo htmlspecialchars($_GET['filename_template']);
$html .= htmlspecialchars($_GET['filename_template']);
} else {
if ($export_type == 'database') {
echo htmlspecialchars(
$html .= htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_db_filename_template',
$GLOBALS['cfg']['Export']['file_template_database']
)
);
} elseif ($export_type == 'table') {
echo htmlspecialchars(
$html .= htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_table_filename_template',
$GLOBALS['cfg']['Export']['file_template_table']
)
);
} else {
echo htmlspecialchars(
$html .= htmlspecialchars(
$GLOBALS['PMA_Config']->getUserValue(
'pma_server_filename_template',
$GLOBALS['cfg']['Export']['file_template_server']
@ -320,36 +325,36 @@ if (isset($_GET['filename_template'])) {
);
}
}
echo '"';
echo '/>';
echo '<input type="checkbox" name="remember_template" ';
echo 'id="checkbox_remember_template" ';
PMA_exportCheckboxCheck('remember_file_template');
echo '/>';
echo '<label for="checkbox_remember_template">';
echo __('use this for future exports');
echo '</label>';
echo '</li>';
$html .= '"';
$html .= '/>';
$html .= '<input type="checkbox" name="remember_template" ';
$html .= 'id="checkbox_remember_template" ';
$html .= PMA_exportCheckboxCheck('remember_file_template');
$html .= '/>';
$html .= '<label for="checkbox_remember_template">';
$html .= __('use this for future exports');
$html .= '</label>';
$html .= '</li>';
// charset of file
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
echo ' <li><label for="select_charset_of_file" class="desc">'
$html .= ' <li><label for="select_charset_of_file" class="desc">'
. __('Character set of the file:') . '</label>' . "\n";
reset($cfg['AvailableCharsets']);
echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
$html .= '<select id="select_charset_of_file" name="charset_of_file" size="1">';
foreach ($cfg['AvailableCharsets'] as $temp_charset) {
echo '<option value="' . $temp_charset . '"';
$html .= '<option value="' . $temp_charset . '"';
if (isset($_GET['charset_of_file'])
&& ($_GET['charset_of_file'] != $temp_charset)
) {
echo '';
$html .= '';
} elseif ((empty($cfg['Export']['charset']) && $temp_charset == 'utf-8')
|| $temp_charset == $cfg['Export']['charset']
) {
echo ' selected="selected"';
$html .= ' selected="selected"';
}
echo '>' . $temp_charset . '</option>';
$html .= '>' . $temp_charset . '</option>';
} // end foreach
echo '</select></li>';
$html .= '</select></li>';
} // end if
if (isset($_GET['compression'])) {
@ -365,79 +370,83 @@ $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
$is_bzip2 = ($cfg['BZipDump'] && @function_exists('bzcompress'));
if ($is_zip || $is_gzip || $is_bzip2) {
echo '<li>';
echo '<label for="compression" class="desc">' . __('Compression:') . '</label>';
echo '<select id="compression" name="compression">';
echo '<option value="none">' . __('None') . '</option>';
$html .= '<li>';
$html .= '<label for="compression" class="desc">'
. __('Compression:') . '</label>';
$html .= '<select id="compression" name="compression">';
$html .= '<option value="none">' . __('None') . '</option>';
if ($is_zip) {
echo '<option value="zip" ';
$html .= '<option value="zip" ';
if ($selected_compression == "zip") {
echo 'selected="selected"';
$html .= 'selected="selected"';
}
echo '>' . __('zipped') . '</option>';
$html .= '>' . __('zipped') . '</option>';
}
if ($is_gzip) {
echo '<option value="gzip" ';
$html .= '<option value="gzip" ';
if ($selected_compression == "gzip") {
echo 'selected="selected"';
$html .= 'selected="selected"';
}
echo '>' . __('gzipped') . '</option>';
$html .= '>' . __('gzipped') . '</option>';
}
if ($is_bzip2) {
echo '<option value="bzip2" ';
$html .= '<option value="bzip2" ';
if ($selected_compression == "bzip2") {
echo 'selected="selected"';
$html .= 'selected="selected"';
}
echo '>' . __('bzipped') . '</option>';
$html .= '>' . __('bzipped') . '</option>';
}
echo '</select>';
echo '</li>';
$html .= '</select>';
$html .= '</li>';
} else {
echo '<input type="hidden" name="compression" value="'
$html .= '<input type="hidden" name="compression" value="'
. htmlspecialchars($selected_compression) . '" />';
}
echo '</ul>';
echo '</li>';
echo '<li>';
echo '<input type="radio" id="radio_view_as_text" name="output_format" '
. 'value="astext" ';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li>';
$html .= '<input type="radio" id="radio_view_as_text" '
. ' name="output_format" value="astext" ';
if (isset($_GET['repopulate']) || $GLOBALS['cfg']['Export']['asfile'] == false) {
echo 'checked="checked"';
$html .= 'checked="checked"';
}
echo '/>';
echo '<label for="radio_view_as_text">'
$html .= '/>';
$html .= '<label for="radio_view_as_text">'
. __('View output as text') . '</label></li>';
echo '</ul>';
echo '</div>';
$html .= '</ul>';
$html .= '</div>';
echo '<div class="exportoptions" id="format">';
echo '<h3>' . __('Format:') . '</h3>';
echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format');
echo '</div>';
$html .= '<div class="exportoptions" id="format">';
$html .= '<h3>' . __('Format:') . '</h3>';
$html .= PMA_pluginGetChoice('Export', 'what', $export_list, 'format');
$html .= '</div>';
echo '<div class="exportoptions" id="format_specific_opts">';
echo '<h3>' . __('Format-specific options:') . '</h3>';
echo '<p class="no_js_msg" id="scroll_to_options_msg">';
echo __('Scroll down to fill in the options for the selected format and ignore the options for other formats.');
echo '</p>';
echo PMA_pluginGetOptions('Export', $export_list);
echo '</div>';
$html .= '<div class="exportoptions" id="format_specific_opts">';
$html .= '<h3>' . __('Format-specific options:') . '</h3>';
$html .= '<p class="no_js_msg" id="scroll_to_options_msg">';
$html .= __('Scroll down to fill in the options for the selected format and ignore the options for other formats.');
$html .= '</p>';
$html .= PMA_pluginGetOptions('Export', $export_list);
$html .= '</div>';
if (function_exists('PMA_set_enc_form')) {
// Encoding setting form appended by Y.Kawada
// Japanese encoding setting
echo '<div class="exportoptions" id="kanji_encoding">';
echo '<h3>' . __('Encoding Conversion:') . '</h3>';
echo PMA_set_enc_form(' ');
echo '</div>';
$html .= '<div class="exportoptions" id="kanji_encoding">';
$html .= '<h3>' . __('Encoding Conversion:') . '</h3>';
$html .= PMA_set_enc_form(' ');
$html .= '</div>';
}
echo '<div class="exportoptions" id="submit">';
$html .= '<div class="exportoptions" id="submit">';
echo PMA_Util::getExternalBug(
$html .= PMA_Util::getExternalBug(
__('SQL compatibility mode'), 'mysql', '50027', '14515'
);
echo '<input type="submit" value="' . __('Go') . '" id="buttonGo" />';
echo '</div>';
echo '</form>';
$html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />';
$html .= '</div>';
$html .= '</form>';
$response = PMA_Response::getInstance();
$response->addHTML($html);

View File

@ -61,7 +61,7 @@ function PMA_printGitRevision()
$committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
$author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
PMA_printListItem(
__('Git revision') . ': '
__('Git revision:') . ' '
. $branch . ',<br /> '
. sprintf(
__('committed on %1$s by %2$s'),

View File

@ -168,7 +168,7 @@ if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") {
echo ' class="ajax"';
?>>
<input type="hidden" name="<?php
echo $_SESSION[$SESSION_KEY]["handler"]::getIdKey();
echo call_user_func($_SESSION[$SESSION_KEY]['handler'] . '::getIdKey');
?>" value="<?php echo $upload_id ; ?>" />
<?php

View File

@ -122,7 +122,10 @@ function PMA_importAjaxStatus($id)
{
header('Content-type: application/json');
echo json_encode(
$_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getUploadStatus($id)
call_user_func(
$_SESSION[$GLOBALS['SESSION_KEY']]['handler'] . '::getUploadStatus',
$id
)
);
}
?>

View File

@ -1182,7 +1182,7 @@ function PMA_getSelectOptionForUpload($vkey, $column)
} elseif (!empty($files)) {
return "<br />\n"
. '<i>' . __('Or') . '</i>' . ' '
. __('web server upload directory') . ':<br />' . "\n"
. __('web server upload directory:') . '<br />' . "\n"
. '<select size="1" name="fields_uploadlocal'
. $vkey . '[' . $column['Field_md5'] . ']">' . "\n"
. '<option value="" selected="selected"></option>' . "\n"
@ -2346,9 +2346,9 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
function PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData(
$db, $table, $column_name, &$extra_data
) {
$extra_data['isNeedToRecheck'] = true;
$sql_for_real_value = 'SELECT '. PMA_Util::backquote($table) . '.'
. PMA_Util::backquote($column_name)
. ' FROM ' . PMA_Util::backquote($db) . '.'
@ -2360,7 +2360,7 @@ function PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData(
} else {
$extra_data['isNeedToRecheck'] = false;
}
}
?>

View File

@ -12,6 +12,7 @@ require_once 'libraries/transformations.lib.php';
$request_params = array(
'clause_is_unique',
'from_prefix',
'goto',
'mult_btn',
'original_sql_query',
@ -24,6 +25,7 @@ $request_params = array(
'sql_query',
'submit_mult',
'table_type',
'to_prefix',
'url_query'
);
@ -481,15 +483,30 @@ if (!empty($submit_mult) && !empty($what)) {
case 'replace_prefix_tbl':
$current = $selected[$i];
$newtablename = preg_replace("/^" . $_POST['from_prefix'] . "/", $_POST['to_prefix'], $current);
$a_query = 'ALTER TABLE ' . PMA_Util::backquote($selected[$i]) . ' RENAME ' . PMA_Util::backquote($newtablename); // CHANGE PREFIX PATTERN
if (substr($current, 0, strlen($from_prefix)) == $from_prefix) {
$newtablename = $to_prefix . substr($current, strlen($from_prefix));
} else {
$newtablename = $current;
}
$a_query = 'ALTER TABLE '
. PMA_Util::backquote($selected[$i])
. ' RENAME '
. PMA_Util::backquote($newtablename) ; // CHANGE PREFIX PATTERN
$run_parts = true;
break;
case 'copy_tbl_change_prefix':
$current = $selected[$i];
$newtablename = preg_replace("/^" . $_POST['from_prefix'] . "/", $_POST['to_prefix'], $current);
$a_query = 'CREATE TABLE ' . PMA_Util::backquote($newtablename) . ' SELECT * FROM ' . PMA_Util::backquote($selected[$i]); // COPY TABLE AND CHANGE PREFIX PATTERN
if (substr($current, 0, strlen($from_prefix)) == $from_prefix) {
$newtablename = $to_prefix . substr($current, strlen($from_prefix));
} else {
$newtablename = $current;
}
$newtablename = $to_prefix . substr($current, strlen($from_prefix));
$a_query = 'CREATE TABLE '
. PMA_Util::backquote($newtablename)
. ' SELECT * FROM '
. PMA_Util::backquote($selected[$i]) ; // COPY TABLE AND CHANGE PREFIX PATTERN
$run_parts = true;
break;

View File

@ -11,6 +11,8 @@ if (! defined('PHPMYADMIN')) {
/**
* Represents a database node in the navigation tree
*
* @package PhpMyAdmin-Navigation
*/
class Node_Database extends Node
{
@ -234,7 +236,7 @@ class Node_Database extends Node
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = " SHOW FULL TABLES FROM ";
@ -277,7 +279,7 @@ class Node_Database extends Node
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = "SHOW FULL TABLES FROM ";
@ -320,7 +322,7 @@ class Node_Database extends Node
$query .= "%'";
}
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::sqlAddSlashes($db);
@ -360,7 +362,7 @@ class Node_Database extends Node
$query .= "%'";
}
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::sqlAddSlashes($db);
@ -399,7 +401,7 @@ class Node_Database extends Node
$query .= "%'";
}
$query .= "ORDER BY `EVENT_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::backquote($db);

View File

@ -33,7 +33,9 @@ class Node_Event_Container extends Node
);
$this->real_name = 'events';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new event', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new event', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_event_add.png', '');
$new->links = array(

View File

@ -33,7 +33,9 @@ class Node_Function_Container extends Node
);
$this->real_name = 'functions';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new function', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new function', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_routine_add.png', '');
$new->links = array(

View File

@ -35,7 +35,9 @@ class Node_Index_Container extends Node
);
$this->real_name = 'indexes';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new index', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new index', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_index_add.png', '');
$new->links = array(

View File

@ -33,7 +33,9 @@ class Node_Procedure_Container extends Node
);
$this->real_name = 'procedures';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new procedure', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new procedure', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_routine_add.png', '');
$new->links = array(

View File

@ -127,7 +127,7 @@ class Node_Table extends Node
$query .= "WHERE `TABLE_NAME`='$table' ";
$query .= "AND `TABLE_SCHEMA`='$db' ";
$query .= "ORDER BY `COLUMN_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::backquote($db);
@ -173,7 +173,7 @@ class Node_Table extends Node
$query .= "WHERE `EVENT_OBJECT_SCHEMA`='$db' ";
$query .= "AND `EVENT_OBJECT_TABLE`='$table' ";
$query .= "ORDER BY `TRIGGER_NAME` ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::backquote($db);

View File

@ -33,7 +33,9 @@ class Node_Trigger_Container extends Node
);
$this->real_name = 'triggers';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new trigger', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new trigger', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_trigger_add.png', '');
$new->links = array(

View File

@ -33,7 +33,9 @@ class Node_View_Container extends Node
);
$this->real_name = 'views';
$new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new view', 'New'));
$new = PMA_NodeFactory::getInstance(
'Node', _pgettext('Create new view', 'New')
);
$new->isNew = true;
$new->icon = PMA_Util::getImage('b_view_add.png', '');
$new->links = array(

View File

@ -72,7 +72,7 @@ function PMA_getHtmlForRenameDatabase($db)
if ($GLOBALS['cfg']['PropertiesIconic']) {
$html_output .= PMA_Util::getImage('b_edit.png');
}
$html_output .= __('Rename database to') . ':'
$html_output .= __('Rename database to:')
. '</legend>';
$html_output .= '<input id="new_db_name" type="text" name="newname" '
@ -172,7 +172,7 @@ function PMA_getHtmlForCopyDatabase($db)
if ($GLOBALS['cfg']['PropertiesIconic']) {
$html_output .= PMA_Util::getImage('b_edit.png');
}
$html_output .= __('Copy database to') . ':'
$html_output .= __('Copy database to:')
. '</legend>'
. '<input type="text" name="newname" size="30" '
. 'class="textfield" value="" /><br />'
@ -541,11 +541,11 @@ function PMA_handleTheViews($views, $move, $db)
$_error = false;
// temporarily force to add DROP IF EXIST to CREATE VIEW query,
// to remove stand-in VIEW that was created earlier
// ( $GLOBALS['drop_if_exists'] is used in moveCopy() )
if (isset($GLOBALS['drop_if_exists'])) {
$temp_drop_if_exists = $GLOBALS['drop_if_exists'];
// ( $_REQUEST['drop_if_exists'] is used in moveCopy() )
if (isset($_REQUEST['drop_if_exists'])) {
$temp_drop_if_exists = $_REQUEST['drop_if_exists'];
}
$GLOBALS['drop_if_exists'] = 'true';
$_REQUEST['drop_if_exists'] = 'true';
foreach ($views as $view) {
$copying_succeeded = PMA_Table::moveCopy(
@ -556,10 +556,10 @@ function PMA_handleTheViews($views, $move, $db)
break;
}
}
unset($GLOBALS['drop_if_exists']);
unset($_REQUEST['drop_if_exists']);
if (isset($temp_drop_if_exists)) {
// restore previous value
$GLOBALS['drop_if_exists'] = $temp_drop_if_exists;
$_REQUEST['drop_if_exists'] = $temp_drop_if_exists;
}
return $_error;
}
@ -625,7 +625,7 @@ function PMA_getHtmlForOrderTheTable($columns)
. 'value="' . htmlspecialchars($fieldname['Field']) . '">'
. htmlspecialchars($fieldname['Field']) . '</option>' . "\n";
}
$html_output .= '</select> ' . __('(singly)')
$html_output .= '</select> ' . __('(singly)') . ' '
. '<select name="order_order">'
. '<option value="asc">' . __('Ascending') . '</option>'
. '<option value="desc">' . __('Descending') . '</option>'

View File

@ -44,6 +44,8 @@ abstract class TransformationsPlugin extends PluginObserver
*
* @return void
*/
abstract public function applyTransformation($buffer, $options = array(), $meta = '');
abstract public function applyTransformation(
$buffer, $options = array(), $meta = ''
);
}
?>

View File

@ -77,8 +77,8 @@ class AuthenticationCookie extends AuthenticationPlugin
$login_link = '<br /><br />[ ' .
sprintf(
'<a href="%s" class="ajax login-link">%s</a>',
$GLOBALS['cfg']['PmaAbsoluteUri'],
'<a href="%s" class="ajax login-link">%s</a>',
$GLOBALS['cfg']['PmaAbsoluteUri'],
__('Log in')
)
. ' ]';
@ -222,7 +222,7 @@ class AuthenticationCookie extends AuthenticationPlugin
</div>';
if (count($GLOBALS['cfg']['Servers']) > 1) {
echo '<div class="item">
<label for="select_server">' . __('Server Choice') .':</label>
<label for="select_server">' . __('Server Choice:') .'</label>
<select name="server" id="select_server"';
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
echo ' onchange="document.forms[\'login_form\'].'

View File

@ -118,17 +118,17 @@ class ExportLatex extends ExportPlugin
// create primary items and add them to the group
$leaf = new TextPropertyItem();
$leaf->setName("structure_caption");
$leaf->setText(__('Table caption'));
$leaf->setText(__('Table caption:'));
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("structure_continued_caption");
$leaf->setText(__('Table caption (continued)'));
$leaf->setText(__('Table caption (continued):'));
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("structure_label");
$leaf->setText(__('Label key'));
$leaf->setText(__('Label key:'));
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['relation'])) {
@ -159,21 +159,21 @@ class ExportLatex extends ExportPlugin
// create primary items and add them to the group
$leaf = new BoolPropertyItem();
$leaf->setName("columns");
$leaf->setText(__('Put columns names in the first row'));
$leaf->setText(__('Put columns names in the first row:'));
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("data_caption");
$leaf->setText(__('Table caption'));
$leaf->setText(__('Table caption:'));
$leaf->setDoc('faq6-27');
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("data_continued_caption");
$leaf->setText(__('Table caption (continued)'));
$leaf->setText(__('Table caption (continued):'));
$leaf->setDoc('faq6-27');
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("data_label");
$leaf->setText(__('Label key'));
$leaf->setText(__('Label key:'));
$leaf->setDoc('faq6-27');
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
@ -215,15 +215,15 @@ class ExportLatex extends ExportPlugin
. '% version ' . PMA_VERSION . $crlf
. '% http://www.phpmyadmin.net' . $crlf
. '%' . $crlf
. '% ' . __('Host') . ': ' . $cfg['Server']['host'];
. '% ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
. '% ' . __('Generation Time') . ': '
. '% ' . __('Generation Time:') . ' '
. PMA_Util::localisedDate() . $crlf
. '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
. '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
. '% ' . __('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . $crlf
. '% ' . __('PHP Version:') . ' ' . phpversion() . $crlf;
return PMA_exportOutputHandler($head);
}
@ -248,7 +248,7 @@ class ExportLatex extends ExportPlugin
{
global $crlf;
$head = '% ' . $crlf
. '% ' . __('Database') . ': ' . '\'' . $db . '\'' . $crlf
. '% ' . __('Database:') . ' ' . '\'' . $db . '\'' . $crlf
. '% ' . $crlf;
return PMA_exportOutputHandler($head);
}
@ -298,7 +298,7 @@ class ExportLatex extends ExportPlugin
}
unset($i);
$buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table
$buffer = $crlf . '%' . $crlf . '% ' . __('Data:') . ' ' . $table
. $crlf . '%' . $crlf . ' \\begin{longtable}{|';
for ($index = 0; $index < $columns_cnt; $index++) {
@ -482,7 +482,7 @@ class ExportLatex extends ExportPlugin
/**
* Displays the table structure
*/
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' ' . $table
. $crlf . '%' . $crlf . ' \\begin{longtable}{';
if (! PMA_exportOutputHandler($buffer)) {
return false;

View File

@ -86,7 +86,7 @@ class ExportMediawiki extends ExportPlugin
// export table headers
$leaf = new BoolPropertyItem();
$leaf->setName("caption");
$leaf->setName("headers");
$leaf->setText(__('Export table headers'));
$generalOptions->addProperty($leaf);
//add the main group to the root group
@ -361,4 +361,4 @@ class ExportMediawiki extends ExportPlugin
return "\n";
}
}
?>
?>

View File

@ -598,20 +598,20 @@ class ExportSql extends ExportPlugin
. $this->_exportComment('version ' . PMA_VERSION)
. $this->_exportComment('http://www.phpmyadmin.net')
. $this->_exportComment();
$host_string = __('Host') . ': ' . $cfg['Server']['host'];
$host_string = __('Host:') . ' ' . $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$host_string .= ':' . $cfg['Server']['port'];
}
$head .= $this->_exportComment($host_string);
$head .=
$this->_exportComment(
__('Generation Time') . ': '
__('Generation Time:') . ' '
. PMA_Util::localisedDate()
)
. $this->_exportComment(
__('Server version') . ': ' . PMA_MYSQL_STR_VERSION
__('Server version:') . ' ' . PMA_MYSQL_STR_VERSION
)
. $this->_exportComment(__('PHP Version') . ': ' . phpversion())
. $this->_exportComment(__('PHP Version:') . ' ' . phpversion())
. $this->_possibleCRLF();
if (isset($GLOBALS['sql_header_comment'])
@ -757,7 +757,7 @@ class ExportSql extends ExportPlugin
}
$head = $this->_exportComment()
. $this->_exportComment(
__('Database') . ': '
__('Database:') . ' '
. (isset($GLOBALS['sql_backquotes'])
? PMA_Util::backquoteCompat($db, $compat)
: '\'' . $db . '\'')
@ -943,7 +943,7 @@ class ExportSql extends ExportPlugin
&& ! empty($tmpres['Create_time'])
) {
$schema_create .= $this->_exportComment(
__('Creation') . ': '
__('Creation:') . ' '
. PMA_Util::localisedDate(
strtotime($tmpres['Create_time'])
)
@ -956,7 +956,7 @@ class ExportSql extends ExportPlugin
&& ! empty($tmpres['Update_time'])
) {
$schema_create .= $this->_exportComment(
__('Last update') . ': '
__('Last update:') . ' '
. PMA_Util::localisedDate(
strtotime($tmpres['Update_time'])
)
@ -969,7 +969,7 @@ class ExportSql extends ExportPlugin
&& ! empty($tmpres['Check_time'])
) {
$schema_create .= $this->_exportComment(
__('Last check') . ': '
__('Last check:') . ' '
. PMA_Util::localisedDate(
strtotime($tmpres['Check_time'])
)
@ -1542,7 +1542,7 @@ class ExportSql extends ExportPlugin
$head = $this->_possibleCRLF()
. $this->_exportComment()
. $this->_exportComment('VIEW ' . ' ' . $formatted_table_name)
. $this->_exportComment(__('Data') . ': ' . __('None'))
. $this->_exportComment(__('Data:') . ' ' . __('None'))
. $this->_exportComment()
. $this->_possibleCRLF();
@ -1873,4 +1873,4 @@ class ExportSql extends ExportPlugin
return true;
} // end of the 'exportData()' function
}
}

View File

@ -188,15 +188,15 @@ class ExportXml extends ExportPlugin
. '- version ' . PMA_VERSION . $crlf
. '- http://www.phpmyadmin.net' . $crlf
. '-' . $crlf
. '- ' . __('Host') . ': ' . $cfg['Server']['host'];
. '- ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
. '- ' . __('Generation Time') . ': '
. '- ' . __('Generation Time:') . ' '
. PMA_Util::localisedDate() . $crlf
. '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
. '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
. '- ' . __('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . $crlf
. '- ' . __('PHP Version:') . ' ' . phpversion() . $crlf
. '-->' . $crlf . $crlf;
$head .= '<pma_xml_export version="1.0"'
@ -387,7 +387,7 @@ class ExportXml extends ExportPlugin
&& $GLOBALS['xml_export_contents']
) {
$head = ' <!--' . $crlf
. ' - ' . __('Database') . ': ' . '\'' . $db . '\'' . $crlf
. ' - ' . __('Database:') . ' ' . '\'' . $db . '\'' . $crlf
. ' -->' . $crlf
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;

View File

@ -112,8 +112,8 @@ class PMA_ExportPdf extends PMA_PDF
$this->Cell(
0,
$this->FontSizePt,
__('Database') . ': ' . $this->currentDb . ', '
. __('Table') . ': ' . $this->currentTable,
__('Database:') . ' ' . $this->currentDb . ', '
. __('Table:') . ' ' . $this->currentTable,
0, 1, 'L'
);
$l = ($this->lMargin);

View File

@ -0,0 +1,91 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Super class of CSV import plugins for phpMyAdmin
*
* @package PhpMyAdmin-Import
* @subpackage CSV
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the import interface */
require_once 'libraries/plugins/ImportPlugin.class.php';
/**
* Super class of the import plugins for the CSV format
*
* @package PhpMyAdmin-Import
* @subpackage CSV
*/
abstract class AbstractImportCsv extends ImportPlugin
{
/**
* Sets the import plugin properties.
* Called in the constructor.
*
* @return object OptionsPropertyMainGroup object of the plugin
*/
protected function setProperties()
{
$props = 'libraries/properties/';
include_once "$props/plugins/ImportPluginProperties.class.php";
include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
include_once "$props/options/items/BoolPropertyItem.class.php";
include_once "$props/options/items/TextPropertyItem.class.php";
$importPluginProperties = new ImportPluginProperties();
$importPluginProperties->setOptionsText(__('Options'));
// create the root group that will be the options field for
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup();
$importSpecificOptions->setName("Format Specific Options");
// general options main group
$generalOptions = new OptionsPropertyMainGroup();
$generalOptions->setName("general_opts");
// create common items and add them to the group
$leaf = new BoolPropertyItem();
$leaf->setName("replace");
$leaf->setText(__('Replace table data with file'));
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("terminated");
$leaf->setText(__('Columns separated with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("enclosed");
$leaf->setText(__('Columns enclosed with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("escaped");
$leaf->setText(__('Columns escaped with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("new_line");
$leaf->setText(__('Lines terminated with:'));
$leaf->setSize(2);
$generalOptions->addProperty($leaf);
// add the main group to the root group
$importSpecificOptions->addProperty($generalOptions);
// set the options for the import plugin property item
$importPluginProperties->setOptions($importSpecificOptions);
$this->properties = $importPluginProperties;
return $generalOptions;
}
}
?>

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
}
/* Get the import interface */
require_once 'libraries/plugins/ImportPlugin.class.php';
require_once 'libraries/plugins/import/AbstractImportCsv.class.php';
/**
* Handles the import for the CSV format
@ -20,7 +20,7 @@ require_once 'libraries/plugins/ImportPlugin.class.php';
* @package PhpMyAdmin-Import
* @subpackage CSV
*/
class ImportCsv extends ImportPlugin
class ImportCsv extends AbstractImportCsv
{
/**
* Whether to analyze tables
@ -51,55 +51,9 @@ class ImportCsv extends ImportPlugin
$this->_setAnalyze(true);
}
$props = 'libraries/properties/';
include_once "$props/plugins/ImportPluginProperties.class.php";
include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
include_once "$props/options/items/BoolPropertyItem.class.php";
include_once "$props/options/items/TextPropertyItem.class.php";
$importPluginProperties = new ImportPluginProperties();
$importPluginProperties->setText('CSV');
$importPluginProperties->setExtension('csv');
$importPluginProperties->setOptionsText(__('Options'));
// create the root group that will be the options field for
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup();
$importSpecificOptions->setName("Format Specific Options");
// general options main group
$generalOptions = new OptionsPropertyMainGroup();
$generalOptions->setName("general_opts");
// create primary items and add them to the group
$leaf = new BoolPropertyItem();
$leaf->setName("replace");
$leaf->setText(__('Replace table data with file'));
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("terminated");
$leaf->setText(__('Columns separated with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("enclosed");
$leaf->setText(__('Columns enclosed with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("escaped");
$leaf->setText(__('Columns escaped with:'));
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem();
$leaf->setName("new_line");
$leaf->setText(__('Lines terminated with:'));
$leaf->setSize(2);
$generalOptions->addProperty($leaf);
$generalOptions = parent::setProperties();
$this->properties->setText('CSV');
$this->properties->setExtension('csv');
if ($GLOBALS['plugin_param'] !== 'table') {
$leaf = new BoolPropertyItem();
@ -129,13 +83,6 @@ class ImportCsv extends ImportPlugin
);
$generalOptions->addProperty($leaf);
}
// add the main group to the root group
$importSpecificOptions->addProperty($generalOptions);
// set the options for the import plugin property item
$importPluginProperties->setOptions($importSpecificOptions);
$this->properties = $importPluginProperties;
}
/**
@ -158,7 +105,7 @@ class ImportCsv extends ImportPlugin
*/
public function doImport()
{
global $db, $csv_terminated, $csv_enclosed, $csv_escaped, $csv_new_line;
global $db, $table, $csv_terminated, $csv_enclosed, $csv_escaped, $csv_new_line;
global $error, $timeout_passed, $finished;
$replacements = array(
@ -176,7 +123,7 @@ class ImportCsv extends ImportPlugin
$message = PMA_Message::error(
__('Invalid parameter for CSV import: %s')
);
$message->addParam(__('Columns terminated by'), false);
$message->addParam(__('Columns terminated with'), false);
$error = true;
$param_error = true;
// The default dialog of MS Excel when generating a CSV produces a
@ -191,21 +138,21 @@ class ImportCsv extends ImportPlugin
$message = PMA_Message::error(
__('Invalid parameter for CSV import: %s')
);
$message->addParam(__('Columns enclosed by'), false);
$message->addParam(__('Columns enclosed with'), false);
$error = true;
$param_error = true;
} elseif (strlen($csv_escaped) != 1) {
$message = PMA_Message::error(
__('Invalid parameter for CSV import: %s')
);
$message->addParam(__('Columns escaped by'), false);
$message->addParam(__('Columns escaped with'), false);
$error = true;
$param_error = true;
} elseif (strlen($csv_new_line) != 1 && $csv_new_line != 'auto') {
$message = PMA_Message::error(
__('Invalid parameter for CSV import: %s')
);
$message->addParam(__('Lines terminated by'), false);
$message->addParam(__('Lines terminated with'), false);
$error = true;
$param_error = true;
}

View File

@ -11,7 +11,7 @@ if (! defined('PHPMYADMIN')) {
}
/* Get the import interface */
require_once 'libraries/plugins/ImportPlugin.class.php';
require_once 'libraries/plugins/import/AbstractImportCsv.class.php';
// We need relations enabled and we work only on database
if ($GLOBALS['plugin_param'] !== 'table') {
@ -25,7 +25,7 @@ if ($GLOBALS['plugin_param'] !== 'table') {
* @package PhpMyAdmin-Import
* @subpackage LDI
*/
class ImportLdi extends ImportPlugin
class ImportLdi extends AbstractImportCsv
{
/**
* Constructor
@ -57,39 +57,24 @@ class ImportLdi extends ImportPlugin
unset($result);
}
$props = 'libraries/properties/';
include_once "$props/plugins/ImportPluginProperties.class.php";
include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
include_once "$props/options/items/BoolPropertyItem.class.php";
include_once "$props/options/items/TextPropertyItem.class.php";
$generalOptions = parent::setProperties();
$this->properties->setText('CSV using LOAD DATA');
$this->properties->setExtension('ldi');
$importPluginProperties = new ImportPluginProperties();
$importPluginProperties->setText('CSV using LOAD DATA');
$importPluginProperties->setExtension('ldi');
$importPluginProperties->setOptionsText(__('Options'));
// create the root group that will be the options field for
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup();
$importSpecificOptions->setName("Format Specific Options");
// general options main group
$generalOptions = new OptionsPropertyMainGroup();
$generalOptions->setName("general_opts");
// create primary items and add them to the group
$leaf = new BoolPropertyItem();
$leaf->setName("replace");
$leaf->setText(__('Replace table data with file'));
$leaf = new TextPropertyItem();
$leaf->setName("columns");
$leaf->setText(__('Column names: '));
$generalOptions->addProperty($leaf);
// add the main group to the root group
$importSpecificOptions->addProperty($generalOptions);
$leaf = new BoolPropertyItem();
$leaf->setName("ignore");
$leaf->setText(__('Do not abort on INSERT error'));
$generalOptions->addProperty($leaf);
// set the options for the import plugin property item
$importPluginProperties->setOptions($importSpecificOptions);
$this->properties = $importPluginProperties;
$leaf = new BoolPropertyItem();
$leaf->setName("local_option");
$leaf->setText(__('Use LOCAL keyword'));
$generalOptions->addProperty($leaf);
}
/**
@ -112,7 +97,7 @@ class ImportLdi extends ImportPlugin
*/
public function doImport()
{
global $finished, $error, $import_file, $compression, $charset_conversion;
global $finished, $error, $import_file, $compression, $charset_conversion, $table;
global $ldi_local_option, $ldi_replace, $ldi_terminated, $ldi_enclosed,
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns;

View File

@ -57,19 +57,19 @@ function PMA_replication_gui_changemaster($submitname)
echo __('Make sure, you have unique server-id in your configuration file (my.cnf). If not, please add the following line into [mysqld] section:') . '<br />';
echo '<pre>server-id=' . time() . '</pre>';
echo ' <div class="item">';
echo ' <label for="text_username">' . __('User name') . ':</label>';
echo ' <label for="text_username">' . __('User name:') . '</label>';
echo ' <input type="text" name="username" id="text_username" maxlength="'. $username_length . '" title="' . __('User name') . '" />';
echo ' </div>';
echo ' <div class="item">';
echo ' <label for="text_pma_pw">' . __('Password') .' :</label>';
echo ' <label for="text_pma_pw">' . __('Password:') .'</label>';
echo ' <input type="password" id="text_pma_pw" name="pma_pw" title="' . __('Password') . '" />';
echo ' </div>';
echo ' <div class="item">';
echo ' <label for="text_hostname">' . __('Host') . ' :</label>';
echo ' <label for="text_hostname">' . __('Host:') . '</label>';
echo ' <input type="text" id="text_hostname" name="hostname" maxlength="' . $hostname_length . '" value="" />';
echo ' </div>';
echo ' <div class="item">';
echo ' <label for="text_port">' . __('Port') . ':</label>';
echo ' <label for="text_port">' . __('Port:') . '</label>';
echo ' <input type="text" id="text_port" name="port" maxlength="6" value="3306" />';
echo ' </div>';
echo ' </fieldset>';
@ -270,13 +270,13 @@ function PMA_replication_gui_master_addslaveuser()
. '<input type="hidden" name="sr_take_action" value="true" />'
. '<div class="item">'
. '<label for="select_pred_username">'
. ' ' . __('User name') . ':'
. ' ' . __('User name:')
. '</label>'
. '<span class="options">'
. ' <select name="pred_username" id="select_pred_username" title="' . __('User name') . '"'
. ' onchange="if (this.value == \'any\') { username.value = \'\'; } else if (this.value == \'userdefined\') { username.focus(); username.select(); }">'
. ' <option value="any"' . ((isset($GLOBALS['pred_username']) && $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '') . '>' . __('Any user') . '</option>'
. ' <option value="userdefined"' . ((! isset($GLOBALS['pred_username']) || $GLOBALS['pred_username'] == 'userdefined') ? ' selected="selected"' : '') . '>' . __('Use text field') . ':</option>'
. ' <option value="userdefined"' . ((! isset($GLOBALS['pred_username']) || $GLOBALS['pred_username'] == 'userdefined') ? ' selected="selected"' : '') . '>' . __('Use text field:') . '</option>'
. ' </select>'
. '</span>'
. '<input type="text" name="username" maxlength="'
@ -290,7 +290,7 @@ function PMA_replication_gui_master_addslaveuser()
. '</div>'
. '<div class="item">'
. '<label for="select_pred_hostname">'
. ' ' . __('Host') . ':'
. ' ' . __('Host:')
. '</label>'
. '<span class="options">'
. ' <select name="pred_hostname" id="select_pred_hostname" title="' . __('Host') . '"';
@ -344,7 +344,7 @@ function PMA_replication_gui_master_addslaveuser()
. ' <option value="userdefined"'
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined')
? ' selected="selected"' : '')
. '>' . __('Use text field') . ':</option>'
. '>' . __('Use text field:') . '</option>'
. ' </select>'
. '</span>'
. '<input type="text" name="hostname" maxlength="'
@ -358,7 +358,7 @@ function PMA_replication_gui_master_addslaveuser()
. '</div>'
. '<div class="item">'
. '<label for="select_pred_password">'
. ' ' . __('Password') . ':'
. ' ' . __('Password:')
. '</label>'
. '<span class="options">'
. ' <select name="pred_password" id="select_pred_password" title="'
@ -369,21 +369,21 @@ function PMA_replication_gui_master_addslaveuser()
echo ' selected="selected"';
}
echo '>' . __('No Password') . '</option>'
. ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . __('Use text field') . ':</option>'
. ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . __('Use text field:') . '</option>'
. ' </select>'
. '</span>'
. '<input type="password" id="text_pma_pw" name="pma_pw" title="' . __('Password') . '" onchange="pred_password.value = \'userdefined\';" />'
. '</div>'
. '<div class="item">'
. '<label for="text_pma_pw2">'
. ' ' . __('Re-type') . ':'
. ' ' . __('Re-type:')
. '</label>'
. '<span class="options">&nbsp;</span>'
. '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . __('Re-type') . '" onchange="pred_password.value = \'userdefined\';" />'
. '</div>'
. '<div class="item">'
. '<label for="button_generate_password">'
. ' ' . __('Generate Password') . ':'
. ' ' . __('Generate Password:')
. '</label>'
. '<span class="options">'
. ' <input type="button" class="button" id="button_generate_password" value="' . __('Generate') . '" onclick="suggestPassword(this.form)" />'

View File

@ -252,7 +252,7 @@ function PMA_EVN_handleEditor()
}
exit;
} else {
$message = __('Error in processing request') . ' : ';
$message = __('Error in processing request:') . ' ';
$message .= sprintf(
PMA_RTE_getWord('not_found'),
htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])),

View File

@ -40,7 +40,7 @@ function PMA_RTE_handleExport($item_name, $export_data)
}
} else {
$_db = htmlspecialchars(PMA_Util::backquote($db));
$response = __('Error in Processing Request') . ' : '
$message = __('Error in processing request:') . ' '
. sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
$response = PMA_message::error($response);
if ($GLOBALS['is_ajax_request'] == true) {

View File

@ -26,7 +26,7 @@ function PMA_RTE_getFooterLinks($docu, $priv, $name)
$retval = "";
$retval .= "<!-- ADD " . $name . " FORM START -->\n";
$retval .= "<fieldset class='left'>\n";
$retval .= " <legend>" . _pgettext('Create new procedure', 'New') . "</legend>\n";
$retval .= "<legend>" . _pgettext('Create new procedure', 'New') . "</legend>\n";
$retval .= " <div class='wrap'>\n";
if (PMA_Util::currentUserHasPrivilege($priv, $db)) {
$retval .= " <a {$ajax_class['add']} ";

View File

@ -461,7 +461,7 @@ function PMA_RTN_handleEditor()
}
exit;
} else {
$message = __('Error in processing request') . ' : ';
$message = __('Error in processing request:') . ' ';
$message .= sprintf(
PMA_RTE_getWord('not_found'),
htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])),
@ -1179,7 +1179,7 @@ function PMA_RTN_getQueryFromRequest()
}
if (! empty($_REQUEST['item_param_opts_text'][$i])) {
if ($GLOBALS['PMA_Types']->getTypeClass($_REQUEST['item_param_type'][$i]) == 'CHAR') {
$params .= ' CHARSET '
$params .= ' CHARSET '
. strtolower($_REQUEST['item_param_opts_text'][$i]);
}
}
@ -1475,7 +1475,7 @@ function PMA_RTN_handleExecute()
// Now deliberately fall through to displaying the routines list
}
} else {
$message = __('Error in processing request') . ' : ';
$message = __('Error in processing request:') . ' ';
$message .= sprintf(
PMA_RTE_getWord('not_found'),
htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])),
@ -1515,7 +1515,7 @@ function PMA_RTN_handleExecute()
}
exit;
} else if (($GLOBALS['is_ajax_request'] == true)) {
$message = __('Error in processing request') . ' : ';
$message = __('Error in processing request:') . ' ';
$message .= sprintf(
PMA_RTE_getWord('not_found'),
htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])),

View File

@ -93,8 +93,8 @@ function PMA_TRI_handleEditor()
)
. '<br />'
. __('MySQL said: ') . PMA_DBI_getError(null);
// We dropped the old item, but were unable to create the new one
// Try to restore the backup query
// We dropped the old item, but were unable to create the
// new one. Try to restore the backup query.
$result = PMA_DBI_try_query($create_item);
if (! $result) {
// OMG, this is really bad! We dropped the query,
@ -227,7 +227,7 @@ function PMA_TRI_handleEditor()
}
exit;
} else {
$message = __('Error in processing request') . ' : ';
$message = __('Error in processing request:') . ' ';
$message .= sprintf(
PMA_RTE_getWord('not_found'),
htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])),

View File

@ -1,5 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Helper functions for RTE
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}

Some files were not shown because too many files have changed in this diff Show More