Merge branch 'master' into DBI_naming_cleanUp
Conflicts: libraries/database_interface.lib.php libraries/db_table_exists.lib.php libraries/relation.lib.php libraries/rte/rte_triggers.lib.php libraries/schema/Dia_Relation_Schema.class.php libraries/schema/Visio_Relation_Schema.class.php tbl_addfield.php
This commit is contained in:
commit
6b1f6ae046
22
.jshintrc
Normal file
22
.jshintrc
Normal 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
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
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
|
||||
- bug #3889 When login fails and error display is active, login data is displayed
|
||||
|
||||
2
README
2
README
@ -1,7 +1,7 @@
|
||||
phpMyAdmin - Readme
|
||||
===================
|
||||
|
||||
Version 4.0.1-dev
|
||||
Version 4.1-dev
|
||||
|
||||
A set of PHP-scripts to manage MySQL over the web.
|
||||
|
||||
|
||||
@ -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="'
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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 />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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
|
||||
|
||||
@ -49,7 +49,7 @@ copyright = u'2012 - 2013, The phpMyAdmin devel team'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '4.0.1-dev'
|
||||
version = '4.1-dev'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ foreach ($gis_types as $gis_type) {
|
||||
}
|
||||
echo '</select>';
|
||||
echo ' ';
|
||||
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'])
|
||||
|
||||
@ -575,7 +575,7 @@ if (strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
|
||||
|
||||
// There was an error?
|
||||
if (isset($my_die)) {
|
||||
foreach ($my_die AS $key => $die) {
|
||||
foreach ($my_die as $key => $die) {
|
||||
PMA_Util::mysqlDie(
|
||||
$die['error'], $die['sql'], '', $err_url, $error
|
||||
);
|
||||
|
||||
20
index.php
20
index.php
@ -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,
|
||||
|
||||
@ -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",
|
||||
|
||||
30
js/ajax.js
30
js/ajax.js
@ -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>',
|
||||
|
||||
172
js/chart.js
172
js/chart.js
@ -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] ]);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
214
js/config.js
214
js/config.js
@ -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,18 @@ 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');
|
||||
var errorCnt;
|
||||
if (isFieldset) {
|
||||
errorCnt = field.find('dl.errors');
|
||||
} else {
|
||||
errorCnt = 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 +354,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);
|
||||
@ -406,16 +409,19 @@ function validate_fieldset(fieldset, isKeyUp, errors)
|
||||
*/
|
||||
function validate_field(field, isKeyUp, errors)
|
||||
{
|
||||
var args, result;
|
||||
field = $(field);
|
||||
var field_id = field.attr('id');
|
||||
errors[field_id] = [];
|
||||
var functions = getFieldValidators(field_id, isKeyUp);
|
||||
for (var i = 0; i < functions.length; i++) {
|
||||
var args = functions[i][1] != null
|
||||
? functions[i][1].slice(0)
|
||||
: [];
|
||||
if (functions[i][1] !== null) {
|
||||
args = functions[i][1].slice(0);
|
||||
} else {
|
||||
args = [];
|
||||
}
|
||||
args.unshift(isKeyUp);
|
||||
var result = functions[i][0].apply(field[0], args);
|
||||
result = functions[i][0].apply(field[0], args);
|
||||
if (result !== true) {
|
||||
if (typeof result == 'string') {
|
||||
result = [result];
|
||||
@ -469,41 +475,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 +540,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 +559,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 +579,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 +603,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;
|
||||
@ -617,7 +627,7 @@ AJAX.registerOnload('config.js', function() {
|
||||
restoreField(field_sel.substr(1));
|
||||
} else {
|
||||
field_sel = href.match(/^[^=]+/)[0];
|
||||
var value = href.match(/=(.+)$/)[1];
|
||||
var value = href.match(/\=(.+)$/)[1];
|
||||
setFieldValue($(field_sel), 'text', value);
|
||||
}
|
||||
$(field_sel).trigger('change');
|
||||
@ -635,7 +645,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 +656,27 @@ 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);
|
||||
var disable_id;
|
||||
if (enable_id.match(/local_storage$/)) {
|
||||
disable_id = enable_id.replace(/local_storage$/, 'text_file');
|
||||
} else {
|
||||
disable_id = 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);
|
||||
});
|
||||
|
||||
// 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 +686,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 +698,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 +727,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 +739,7 @@ function savePrefsToLocalStorage(form)
|
||||
form.hide('fast');
|
||||
form.prev('.click-hide-message').show('fast');
|
||||
},
|
||||
complete: function() {
|
||||
complete: function () {
|
||||
submit.prop('disabled', false);
|
||||
}
|
||||
});
|
||||
@ -738,7 +751,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);
|
||||
}
|
||||
|
||||
@ -749,11 +762,11 @@ 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());
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -766,14 +779,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']);
|
||||
|
||||
461
js/date.js
461
js/date.js
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 $()
|
||||
|
||||
@ -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
|
||||
@ -57,15 +57,16 @@ function PMA_adjustTotals() {
|
||||
|
||||
$allTr.each(function () {
|
||||
var $this = $(this);
|
||||
var i, tmpVal;
|
||||
// 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);
|
||||
}
|
||||
strRows = strRows.replace(/[,.]/g , '');
|
||||
strRows = strRows.replace(/[,.]/g, '');
|
||||
var intRow = parseInt(strRows, 10);
|
||||
if (! isNaN(intRow)) {
|
||||
rowsSum += intRow;
|
||||
@ -79,16 +80,16 @@ function PMA_adjustTotals() {
|
||||
var strOverheadUnit = $.trim($this.find('.tbl_overhead span.unit').text());
|
||||
// Given a value and a unit, such as 100 and KiB, for the table size
|
||||
// and overhead calculate their numeric values in bytes, such as 102400
|
||||
for (var i = 0; i < byteUnits.length; i++) {
|
||||
for (i = 0; i < byteUnits.length; i++) {
|
||||
if (strSizeUnit == byteUnits[i]) {
|
||||
var tmpVal = parseFloat(strSize);
|
||||
tmpVal = parseFloat(strSize);
|
||||
valSize = tmpVal * Math.pow(1024, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < byteUnits.length; i++) {
|
||||
for (i = 0; i < byteUnits.length; i++) {
|
||||
if (strOverheadUnit == byteUnits[i]) {
|
||||
var tmpVal = parseFloat(strOverhead);
|
||||
tmpVal = parseFloat(strOverhead);
|
||||
valOverhead = tmpVal * Math.pow(1024, i);
|
||||
break;
|
||||
}
|
||||
@ -123,13 +124,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 +160,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();
|
||||
|
||||
/**
|
||||
@ -196,16 +197,15 @@ AJAX.registerOnload('db_structure.js', function() {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question =
|
||||
PMA_messages.strTruncateTableStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name));
|
||||
var question = 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);
|
||||
@ -253,20 +253,19 @@ AJAX.registerOnload('db_structure.js', function() {
|
||||
*/
|
||||
var question;
|
||||
if (! is_view) {
|
||||
question =
|
||||
PMA_messages.strDropTableStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, 'DROP TABLE ' + escapeHtml(curr_table_name));
|
||||
question = PMA_messages.strDropTableStrongWarning + ' ' +
|
||||
$.sprintf(PMA_messages.strDoYouReally, 'DROP TABLE ' + escapeHtml(curr_table_name));
|
||||
} else {
|
||||
question =
|
||||
$.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 +273,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 +282,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 +294,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 +312,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 +324,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 +357,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 +368,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;
|
||||
|
||||
30
js/export.js
30
js/export.js
@ -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") {
|
||||
@ -225,7 +225,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* 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")) {
|
||||
enable_dump_some_rows_sub_options();
|
||||
} else {
|
||||
|
||||
1400
js/functions.js
1400
js/functions.js
File diff suppressed because it is too large
Load Diff
@ -119,7 +119,10 @@ function PMA_getImage(image, alternate, attributes) {
|
||||
} else {
|
||||
// it's an image file
|
||||
retval.isSprite = false;
|
||||
retval.attr('src', "<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>" + image);
|
||||
retval.attr(
|
||||
'src',
|
||||
"<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>" + image
|
||||
);
|
||||
}
|
||||
// set all other attrubutes
|
||||
for (var i in attributes) {
|
||||
@ -135,4 +138,4 @@ function PMA_getImage(image, alternate, attributes) {
|
||||
|
||||
return retval;
|
||||
}
|
||||
//
|
||||
//
|
||||
|
||||
@ -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/>';
|
||||
var html = PMA_messages.strPolygon + ' ' + (noOfPolygons + 1) + ':<br/>';
|
||||
html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1"/>'
|
||||
+ '<br/>' + PMA_messages['strOuterRing'] + ':'
|
||||
+ '<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);
|
||||
});
|
||||
});
|
||||
|
||||
28
js/import.js
28
js/import.js
@ -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);
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -21,8 +21,8 @@ AJAX.registerOnload('keyhandler.js', function() {
|
||||
|
||||
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 is_firefox = navigator.userAgent.toLowerCase().indexOf("firefox/") > -1;
|
||||
|
||||
306
js/makegrid.js
306
js/makegrid.js
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 '→';
|
||||
} else {
|
||||
return '←';
|
||||
}
|
||||
} else {
|
||||
if (width == 0) {
|
||||
if (width === 0) {
|
||||
return '←';
|
||||
} else {
|
||||
return '→';
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -22,11 +22,49 @@ 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");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* To display details of obects(where,rename,Having,aggregate,groupby,orderby,having)
|
||||
*
|
||||
* @param index index of history_array where change is to be made
|
||||
*
|
||||
**/
|
||||
|
||||
function detail(index)
|
||||
{
|
||||
var type = history_array[index].get_type();
|
||||
var str;
|
||||
if (type == "Where") {
|
||||
str = 'Where ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
if (type == "Rename") {
|
||||
str = 'Rename ' + history_array[index].get_column_name() + ' To ' + history_array[index].get_obj().getrename_to();
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
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();
|
||||
}
|
||||
if (type == "OrderBy") {
|
||||
str = 'OrderBy ' + history_array[index].get_column_name();
|
||||
}
|
||||
if (type == "Having") {
|
||||
str = 'Having ';
|
||||
if (history_array[index].get_obj().get_operator() != 'None') {
|
||||
str += history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
|
||||
str += history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
} else {
|
||||
str = 'Having ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts history_array[] first,using table name as the key and then generates the HTML code for history tab,
|
||||
* clubbing all objects of same tables together
|
||||
@ -38,17 +76,17 @@ function panel(index)
|
||||
*
|
||||
**/
|
||||
|
||||
function display(init,finit)
|
||||
function display(init, finit)
|
||||
{
|
||||
var str,i,j,k,sto;
|
||||
var str, i, j, k, sto, temp;
|
||||
// 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
|
||||
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 +94,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++) {
|
||||
var temp = history_array[i].get_tab(); //+ '.' + history_array[i].get_obj_no(); for Self JOIN
|
||||
str = ''; // string to store Html code for history tab
|
||||
for (i = 0; i < history_array.length; i++) {
|
||||
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,48 +141,10 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* To display details of obects(where,rename,Having,aggregate,groupby,orderby,having)
|
||||
*
|
||||
* @param index index of history_array where change is to be made
|
||||
*
|
||||
**/
|
||||
|
||||
function detail (index)
|
||||
{
|
||||
var type = history_array[index].get_type();
|
||||
var str;
|
||||
if (type == "Where") {
|
||||
str = 'Where ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
if (type == "Rename") {
|
||||
str = 'Rename ' + history_array[index].get_column_name() + ' To ' + history_array[index].get_obj().getrename_to();
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
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() ;
|
||||
}
|
||||
if (type == "OrderBy") {
|
||||
str = 'OrderBy ' + history_array[index].get_column_name() ;
|
||||
}
|
||||
if (type == "Having") {
|
||||
str = 'Having ';
|
||||
if (history_array[index].get_obj().get_operator() != 'None') {
|
||||
str += history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
|
||||
str += history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
} else {
|
||||
str = 'Having ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes entry in history_array
|
||||
*
|
||||
@ -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,17 @@ 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]) {
|
||||
continue label;
|
||||
var newArray = [];
|
||||
uniquetop:
|
||||
for (var i = 0; i < arrayName.length; i++) {
|
||||
for (var j = 0; j < newArray.length; j++) {
|
||||
if (newArray[j] == arrayName[i]) {
|
||||
continue uniquetop;
|
||||
}
|
||||
}
|
||||
newArray[newArray.length] = arrayName[i];
|
||||
}
|
||||
return newArray;
|
||||
return newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -452,14 +451,285 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function concatenates two array
|
||||
*
|
||||
* @params add array elements of which are pushed in
|
||||
* @params arr array in which elemnets are added
|
||||
*/
|
||||
function add_array(add, arr)
|
||||
{
|
||||
for (var i = 0; i < add.length; i++) {
|
||||
arr.push(add[i]);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/* This fucntion removes all elements present in one array from the other.
|
||||
*
|
||||
* @params rem array from which each element is removed from other array.
|
||||
* @params arr array from which elements are removed.
|
||||
*
|
||||
*/
|
||||
function remove_array(rem, arr)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function builds the groupby clause from history object
|
||||
*
|
||||
*/
|
||||
|
||||
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() + ", ";
|
||||
}
|
||||
}
|
||||
str = str.substr(0, str.length - 1);
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function builds the Having clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_having()
|
||||
{
|
||||
var i;
|
||||
var and = "(";
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
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() + ", ";
|
||||
} else {
|
||||
and += history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (and == "(") {
|
||||
and = "";
|
||||
} else {
|
||||
and = and.substr(0, and.length - 2) + ")";
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function builds the orderby clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_orderby()
|
||||
{
|
||||
var i;
|
||||
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);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function builds the Where clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_where()
|
||||
{
|
||||
var i;
|
||||
var and = "(";
|
||||
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 ";
|
||||
} else {
|
||||
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)) + ")";
|
||||
} else {
|
||||
or = "";
|
||||
}
|
||||
if (and != "(") {
|
||||
and = and.substring(0, (and.length - 5)) + ")";
|
||||
} else {
|
||||
and = "";
|
||||
}
|
||||
if (or !== "") {
|
||||
and = and + " OR " + or + " )";
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
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() + '`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Aggregate") {
|
||||
return history_array[i].get_obj().get_operator() + '(' + id_this + ')';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
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() + '`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Rename") {
|
||||
return " AS `" + history_array[i].get_obj().getrename_to() + "`";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function gradient(id, level)
|
||||
{
|
||||
var box = document.getElementById(id);
|
||||
box.style.opacity = level;
|
||||
box.style.MozOpacity = level;
|
||||
box.style.KhtmlOpacity = level;
|
||||
box.style.filter = "alpha(opacity=" + level * 100 + ")";
|
||||
box.style.display = "block";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function fadein(id)
|
||||
{
|
||||
var level = 0;
|
||||
while (level <= 1) {
|
||||
setTimeout("gradient('" + id + "'," + level + ")", (level * 1000) + 10);
|
||||
level += 0.01;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function builds from clause of query
|
||||
* makes automatic joins.
|
||||
*
|
||||
*
|
||||
*/
|
||||
function query_from()
|
||||
{
|
||||
var i;
|
||||
var tab_left = [];
|
||||
var tab_used = [];
|
||||
var t_tab_used = [];
|
||||
var t_tab_left = [];
|
||||
var temp;
|
||||
var query = "";
|
||||
var quer = "";
|
||||
var parts = [];
|
||||
var t_array = [];
|
||||
t_array = from_array;
|
||||
var K = 0;
|
||||
var k;
|
||||
var key;
|
||||
var key2;
|
||||
var key3;
|
||||
var parts1;
|
||||
for (i = 0; i < history_array.length; i++) {
|
||||
from_array.push(history_array[i].get_tab());
|
||||
}
|
||||
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 (K in contr) {
|
||||
for (key in contr[K]) {// contr name
|
||||
for (key2 in contr[K][key]) {// table name
|
||||
parts = key2.split(".");
|
||||
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) {
|
||||
query += "\n" + 'LEFT JOIN ';
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 = [];
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is the main function for query building.
|
||||
* uses history object details for this.
|
||||
@ -479,306 +749,39 @@ 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;
|
||||
}
|
||||
/**
|
||||
* This function builds from clause of query
|
||||
* makes automatic joins.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
function query_from()
|
||||
{
|
||||
var i;
|
||||
var tab_left = [];
|
||||
var tab_used = [];
|
||||
var t_tab_used = [];
|
||||
var t_tab_left = [];
|
||||
var temp;
|
||||
var query = "";
|
||||
var quer = "";
|
||||
var parts = [];
|
||||
var t_array = [];
|
||||
t_array = from_array;
|
||||
var K = 0;
|
||||
var k;
|
||||
var key;
|
||||
var key2;
|
||||
var key3;
|
||||
var parts1;
|
||||
for (i = 0; i < history_array.length ; i++) {
|
||||
from_array.push(history_array[i].get_tab());
|
||||
}
|
||||
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 (K in contr) {
|
||||
for (key in contr[K]) {// contr name
|
||||
for (key2 in contr[K][key]) {// table name
|
||||
parts = key2.split(".");
|
||||
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) {
|
||||
query += "\n" + 'LEFT JOIN ';
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 = [];
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function concatenates two array
|
||||
*
|
||||
* @params add array elements of which are pushed in
|
||||
* @params arr array in which elemnets are added
|
||||
*/
|
||||
function add_array(add,arr)
|
||||
{
|
||||
for (var i=0; i<add.length; i++) {
|
||||
arr.push(add[i]);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/* This fucntion removes all elements present in one array from the other.
|
||||
*
|
||||
* @params rem array from which each element is removed from other array.
|
||||
* @params arr array from which elements are removed.
|
||||
*
|
||||
*/
|
||||
function remove_array(rem,arr)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function builds the groupby clause from history object
|
||||
*
|
||||
*/
|
||||
|
||||
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() + ", ";}
|
||||
}
|
||||
str = str.substr(0,str.length -1);
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function builds the Having clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_having()
|
||||
{
|
||||
var i;
|
||||
var and = "(";
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
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() + ", " ;
|
||||
} else {
|
||||
and += history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (and =="(") {
|
||||
and = "" ;
|
||||
} else {
|
||||
and = and.substr(0,and.length -2) + ")";
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function builds the orderby clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_orderby()
|
||||
{
|
||||
var i;
|
||||
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);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function builds the Where clause from the history object.
|
||||
*
|
||||
*/
|
||||
|
||||
function query_where()
|
||||
{
|
||||
var i;
|
||||
var and = "(";
|
||||
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 ";
|
||||
} else {
|
||||
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 )) + ")";
|
||||
} else {
|
||||
or = "" ;
|
||||
}
|
||||
if (and !="(") {
|
||||
and = and.substring(0,(and.length - 5)) + ")";
|
||||
} else {
|
||||
and = "" ;
|
||||
}
|
||||
if (or != "" ) {
|
||||
and = and + " OR " + or + " )";
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
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() +'`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Aggregate") {
|
||||
return history_array[i].get_obj().get_operator() + '(' + id_this +')';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
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() +'`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Rename") {
|
||||
return " AS `" + history_array[i].get_obj().getrename_to() +"`";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function gradient(id, level)
|
||||
{
|
||||
var box = document.getElementById(id);
|
||||
box.style.opacity = level;
|
||||
box.style.MozOpacity = level;
|
||||
box.style.KhtmlOpacity = level;
|
||||
box.style.filter = "alpha(opacity=" + level * 100 + ")";
|
||||
box.style.display="block";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function fadein(id)
|
||||
{
|
||||
var level = 0;
|
||||
while (level <= 1) {
|
||||
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';
|
||||
}
|
||||
|
||||
@ -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 = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
369
js/pmd/move.js
369
js/pmd/move.js
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
82
js/rte.js
82
js/rte.js
@ -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()
|
||||
|
||||
|
||||
@ -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);
|
||||
@ -53,25 +53,23 @@ AJAX.registerOnload('server_databases.js', function() {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question =
|
||||
PMA_messages.strDropDatabaseStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, selected_dbs.join('<br />'));
|
||||
var question = PMA_messages.strDropDatabaseStrongWarning + ' ' +
|
||||
$.sprintf(PMA_messages.strDoYouReally, selected_dbs.join('<br />'));
|
||||
|
||||
$(this).PMA_confirm(
|
||||
question,
|
||||
$form.prop('action')
|
||||
+ '?' + $(this).serialize()
|
||||
+ '&drop_selected_dbs=1&is_js_confirmed=1&ajax_request=true',
|
||||
function(url) {
|
||||
$form.prop('action') + '?' + $(this).serialize() +
|
||||
'&drop_selected_dbs=1&is_js_confirmed=1&ajax_request=true',
|
||||
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 +80,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 +95,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 +113,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 {
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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 &27; part. let's fix it
|
||||
return $(this).val().replace(/&/,'&');
|
||||
return $(this).val().replace(/&/, '&');
|
||||
})
|
||||
.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 {
|
||||
@ -165,7 +165,7 @@ function addUser($form)
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_privileges.js', function() {
|
||||
AJAX.registerTeardown('server_privileges.js', function () {
|
||||
$("#fieldset_add_user a.ajax").die("click");
|
||||
$('form[name=usersForm]').unbind('submit');
|
||||
$("#reload_privileges_anchor.ajax").die("click");
|
||||
@ -178,7 +178,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 () {
|
||||
/**
|
||||
* AJAX event handler for 'Add a New User'
|
||||
*
|
||||
@ -188,16 +188,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 {
|
||||
@ -231,13 +231,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);
|
||||
@ -253,15 +253,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
|
||||
@ -269,12 +269,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);
|
||||
}
|
||||
|
||||
@ -307,7 +307,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();
|
||||
|
||||
@ -319,15 +319,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 {
|
||||
@ -351,7 +351,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();
|
||||
|
||||
@ -361,7 +361,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" />');
|
||||
|
||||
@ -375,14 +375,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) {
|
||||
@ -392,8 +392,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();
|
||||
|
||||
@ -406,13 +406,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();
|
||||
}
|
||||
|
||||
@ -427,7 +427,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) {
|
||||
@ -459,22 +459,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({
|
||||
@ -519,18 +519,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({
|
||||
@ -567,11 +567,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
|
||||
@ -591,10 +591,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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
});
|
||||
@ -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
@ -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');
|
||||
});
|
||||
|
||||
@ -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;
|
||||
},
|
||||
|
||||
@ -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', '');
|
||||
|
||||
@ -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
118
js/sql.js
@ -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
|
||||
|
||||
167
js/tbl_change.js
167
js/tbl_change.js
@ -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--;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -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));
|
||||
});
|
||||
});
|
||||
|
||||
118
js/tbl_select.js
118
js/tbl_select.js
@ -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');
|
||||
|
||||
@ -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,7 +49,7 @@ 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
|
||||
@ -79,7 +98,7 @@ 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();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$('#page_content').hide();
|
||||
@ -91,7 +110,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);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -99,7 +118,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();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$('#page_content').hide();
|
||||
@ -126,7 +145,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
|
||||
@ -147,11 +166,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();
|
||||
@ -164,7 +183,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();
|
||||
@ -173,16 +192,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
|
||||
@ -195,11 +214,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') {
|
||||
@ -216,7 +235,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()
|
||||
@ -225,7 +244,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")) {
|
||||
@ -238,7 +257,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);
|
||||
@ -253,7 +272,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()
|
||||
@ -288,7 +307,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');
|
||||
@ -296,12 +315,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();
|
||||
};
|
||||
|
||||
@ -343,25 +362,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
|
||||
@ -384,23 +384,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 () {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -91,7 +91,7 @@ class PMA_Config
|
||||
// other settings, independent from config file, comes in
|
||||
$this->checkSystem();
|
||||
|
||||
$this->checkIsHttps();
|
||||
$this->isHttps();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ class PMA_Config
|
||||
*/
|
||||
function checkSystem()
|
||||
{
|
||||
$this->set('PMA_VERSION', '4.0.1-dev');
|
||||
$this->set('PMA_VERSION', '4.1-dev');
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@ -189,11 +189,11 @@ class PMA_Config
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'OPERA');
|
||||
} elseif (preg_match(
|
||||
'@MSIE ([0-9].[0-9]{1,2})@',
|
||||
'@(MS)?IE ([0-9]{1,2}.[0-9]{1,2})@',
|
||||
$HTTP_USER_AGENT,
|
||||
$log_version
|
||||
)) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'IE');
|
||||
} elseif (preg_match(
|
||||
'@OmniWeb/([0-9].[0-9]{1,2})@',
|
||||
@ -216,9 +216,9 @@ class PMA_Config
|
||||
'@Mozilla/([0-9].[0-9]{1,2})@',
|
||||
$HTTP_USER_AGENT,
|
||||
$log_version)
|
||||
&& preg_match('@Chrome/([0-9]*)@', $HTTP_USER_AGENT, $log_version2)
|
||||
&& preg_match('@Chrome/([0-9.]*)@', $HTTP_USER_AGENT, $log_version2)
|
||||
) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]);
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version2[1]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'CHROME');
|
||||
// newer Safari
|
||||
} elseif (preg_match(
|
||||
@ -242,6 +242,14 @@ class PMA_Config
|
||||
'PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]
|
||||
);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'SAFARI');
|
||||
// Firefox
|
||||
} elseif (! strstr($HTTP_USER_AGENT, 'compatible')
|
||||
&& preg_match('@Firefox/([\w.]+)@', $HTTP_USER_AGENT, $log_version2)
|
||||
) {
|
||||
$this->set(
|
||||
'PMA_USR_BROWSER_VER', $log_version2[1]
|
||||
);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'FIREFOX');
|
||||
} elseif (preg_match('@rv:1.9(.*)Gecko@', $HTTP_USER_AGENT)) {
|
||||
$this->set('PMA_USR_BROWSER_VER', '1.9');
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'GECKO');
|
||||
@ -313,7 +321,7 @@ class PMA_Config
|
||||
$this->set('PMA_IS_WINDOWS', 0);
|
||||
// If PHP_OS is defined then continue
|
||||
if (defined('PHP_OS')) {
|
||||
if (stristr(PHP_OS, 'win')) {
|
||||
if (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) {
|
||||
// Is it some version of Windows
|
||||
$this->set('PMA_IS_WINDOWS', 1);
|
||||
} elseif (stristr(PHP_OS, 'OS/2')) {
|
||||
@ -604,7 +612,7 @@ class PMA_Config
|
||||
} else {
|
||||
$link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/commits/'
|
||||
. $hash;
|
||||
$is_found = $this->checkHTTP($link, !$commit);
|
||||
$is_found = $this->checkHTTP($link, ! $commit);
|
||||
switch($is_found) {
|
||||
case false:
|
||||
$is_remote_commit = false;
|
||||
@ -713,7 +721,7 @@ class PMA_Config
|
||||
}
|
||||
$ch = curl_init($link);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
|
||||
curl_setopt($ch, CURLOPT_NOBODY, !$get_body);
|
||||
curl_setopt($ch, CURLOPT_NOBODY, ! $get_body);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
@ -1163,14 +1171,14 @@ class PMA_Config
|
||||
* sets configuration variable
|
||||
*
|
||||
* @param string $setting configuration option
|
||||
* @param string $value new value for configuration option
|
||||
* @param mixed $value new value for configuration option
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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();
|
||||
@ -1465,16 +1473,6 @@ class PMA_Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check for https
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkIsHttps()
|
||||
{
|
||||
$this->set('is_https', $this->isHttps());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if protocol is https
|
||||
*
|
||||
@ -1486,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;
|
||||
@ -1500,6 +1498,8 @@ class PMA_Config
|
||||
$is_https = false;
|
||||
}
|
||||
|
||||
$this->set('is_https', $is_https);
|
||||
|
||||
return $is_https;
|
||||
}
|
||||
|
||||
|
||||
@ -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 .= ' <strong>' . __('And') . ':</strong>';
|
||||
$html_output .= ' <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"'
|
||||
|
||||
@ -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)'),
|
||||
@ -2656,7 +2656,7 @@ class PMA_DisplayResults
|
||||
|
||||
|
||||
/**
|
||||
* Get the values for one data row
|
||||
* Get the values for one data row
|
||||
*
|
||||
* @param integer &$dt_result the link id associated to the query
|
||||
* which results have to be displayed
|
||||
@ -2696,8 +2696,8 @@ class PMA_DisplayResults
|
||||
|
||||
$row_info = $this->_getRowInfoForSpecialLinks($row, $col_order);
|
||||
|
||||
for ($currentColumn = 0;
|
||||
$currentColumn < $this->__get('fields_cnt');
|
||||
for ($currentColumn = 0;
|
||||
$currentColumn < $this->__get('fields_cnt');
|
||||
++$currentColumn) {
|
||||
|
||||
// assign $i with appropriate column order
|
||||
@ -3462,7 +3462,7 @@ class PMA_DisplayResults
|
||||
|
||||
|
||||
/**
|
||||
* Get the combined classes for a column
|
||||
* Get the combined classes for a column
|
||||
*
|
||||
* @param string $grid_edit_class the class for all editable columns
|
||||
* @param string $not_null_class the class for not null columns
|
||||
@ -4016,7 +4016,7 @@ class PMA_DisplayResults
|
||||
list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
|
||||
|
||||
// Prepares data
|
||||
foreach ($vertical_display['desc'] AS $j => $val) {
|
||||
foreach ($vertical_display['desc'] as $j => $val) {
|
||||
|
||||
// assign appropriate key with current column order
|
||||
$key = $col_order ? $col_order[$j] : $j;
|
||||
@ -4549,7 +4549,7 @@ class PMA_DisplayResults
|
||||
&& empty($analyzed_sql[0]['limit_clause'])
|
||||
) {
|
||||
|
||||
$table_html .= $this->_getPlacedTableNavigatoins(
|
||||
$table_html .= $this->_getPlacedTableNavigations(
|
||||
$pos_next, $pos_prev, self::PLACE_TOP_DIRECTION_DROPDOWN,
|
||||
"\n", $is_innodb
|
||||
);
|
||||
@ -4626,7 +4626,7 @@ class PMA_DisplayResults
|
||||
if (($is_display['nav_bar'] == '1')
|
||||
&& empty($analyzed_sql[0]['limit_clause'])
|
||||
) {
|
||||
$table_html .= $this->_getPlacedTableNavigatoins(
|
||||
$table_html .= $this->_getPlacedTableNavigations(
|
||||
$pos_next, $pos_prev, self::PLACE_BOTTOM_DIRECTION_DROPDOWN,
|
||||
'<br />' . "\n", $is_innodb
|
||||
);
|
||||
@ -5114,7 +5114,7 @@ class PMA_DisplayResults
|
||||
*
|
||||
* @see _getTable()
|
||||
*/
|
||||
private function _getPlacedTableNavigatoins(
|
||||
private function _getPlacedTableNavigations(
|
||||
$pos_next, $pos_prev, $place, $empty_line, $is_innodb
|
||||
) {
|
||||
|
||||
@ -5134,7 +5134,7 @@ class PMA_DisplayResults
|
||||
|
||||
return $navigation_html;
|
||||
|
||||
} // end of the '_getPlacedTableNavigatoins()' function
|
||||
} // end of the '_getPlacedTableNavigations()' function
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -494,7 +494,9 @@ class PMA_Header
|
||||
$dir = $GLOBALS['text_dir'];
|
||||
|
||||
$retval = "<!DOCTYPE HTML>";
|
||||
$retval .= "<html lang='$lang' dir='$dir'>";
|
||||
$retval .= "<html lang='$lang' dir='$dir' class='";
|
||||
$retval .= strtolower(PMA_USR_BROWSER_AGENT) . " ";
|
||||
$retval .= strtolower(PMA_USR_BROWSER_AGENT) . intval(PMA_USR_BROWSER_VER) . "'>";
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
@ -661,7 +661,8 @@ class PMA_Index
|
||||
. '</td>';
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION > 50500
|
||||
&& $column->getSeqInIndex() == 1) {
|
||||
&& $column->getSeqInIndex() == 1
|
||||
) {
|
||||
$r .= '<td ' . $row_span . '>'
|
||||
. htmlspecialchars($index->getComments()) . '</td>';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ class PMA_Theme
|
||||
global $cfg;
|
||||
|
||||
$css_string = '';
|
||||
foreach ($cfg['SQP']['fmtColor'] AS $key => $col) {
|
||||
foreach ($cfg['SQP']['fmtColor'] as $key => $col) {
|
||||
$css_string .= $this->buildSQPCssRule('syntax_' . $key, 'color', $col);
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -671,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');
|
||||
|
||||
@ -122,9 +122,9 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
|
||||
. '.' . PMA_Util::backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
|
||||
|
||||
if (!$action_bookmark_all) {
|
||||
if (! $action_bookmark_all) {
|
||||
$query .= ' AND (user = \'' . PMA_Util::sqlAddSlashes($cfgBookmark['user']) . '\'';
|
||||
if (!$exact_user_match) {
|
||||
if (! $exact_user_match) {
|
||||
$query .= ' OR user = \'\'';
|
||||
}
|
||||
$query .= ')';
|
||||
|
||||
@ -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;
|
||||
@ -907,14 +907,14 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
} // end if
|
||||
|
||||
// is root allowed?
|
||||
if (!$cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
|
||||
if (! $cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
|
||||
$allowDeny_forbidden = true;
|
||||
PMA_log_user($cfg['Server']['user'], 'root-denied');
|
||||
$auth_plugin->authFails();
|
||||
}
|
||||
|
||||
// is a login without password allowed?
|
||||
if (!$cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
|
||||
if (! $cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
|
||||
$login_without_password_is_forbidden = true;
|
||||
PMA_log_user($cfg['Server']['user'], 'empty-denied');
|
||||
$auth_plugin->authFails();
|
||||
|
||||
@ -232,8 +232,14 @@ $cfg_db['_validators'] = array(
|
||||
* Additional validators used for user preferences
|
||||
*/
|
||||
$cfg_db['_userValidators'] = array(
|
||||
'MaxDbList' => array(array('validate_upper_bound', 'value:MaxDbList')),
|
||||
'MaxTableList' => array(array('validate_upper_bound', 'value:MaxTableList')),
|
||||
'QueryHistoryMax' => array(array('validate_upper_bound', 'value:QueryHistoryMax'))
|
||||
'MaxDbList' => array(
|
||||
array('validate_upper_bound', 'value:MaxDbList')
|
||||
),
|
||||
'MaxTableList' => array(
|
||||
array('validate_upper_bound', 'value:MaxTableList')
|
||||
),
|
||||
'QueryHistoryMax' => array(
|
||||
array('validate_upper_bound', 'value:QueryHistoryMax')
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
@ -423,7 +423,7 @@ class ConfigFile
|
||||
$dsn = $this->getValue("$path/extension") . '://';
|
||||
if ($this->getValue("$path/auth_type") == 'config') {
|
||||
$dsn .= $this->getValue("$path/user");
|
||||
if (!$this->getValue("$path/nopassword")) {
|
||||
if (! $this->getValue("$path/nopassword")) {
|
||||
$dsn .= ':***';
|
||||
}
|
||||
$dsn .= '@';
|
||||
|
||||
@ -105,7 +105,7 @@ class Form
|
||||
}
|
||||
$keys[] = is_bool($value[$i]) ? (int)$value[$i] : $value[$i];
|
||||
}
|
||||
if (!$has_string_keys) {
|
||||
if (! $has_string_keys) {
|
||||
$value = array_combine($keys, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ class FormDisplay
|
||||
foreach ($errors as $path => $error_list) {
|
||||
$work_path = array_search($path, $this->_systemPaths);
|
||||
// field error
|
||||
if (!$work_path) {
|
||||
if (! $work_path) {
|
||||
// form error, fix path
|
||||
$work_path = $path;
|
||||
}
|
||||
@ -219,7 +219,7 @@ class FormDisplay
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$is_new_server) {
|
||||
if (! $is_new_server) {
|
||||
$this->_validate();
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ class FormDisplay
|
||||
PMA_displayFormBottom();
|
||||
|
||||
// if not already done, send strings used for valdiation to JavaScript
|
||||
if (!$js_lang_sent) {
|
||||
if (! $js_lang_sent) {
|
||||
$js_lang_sent = true;
|
||||
$js_lang = array();
|
||||
foreach ($this->_jsLangStrings as $strName => $strValue) {
|
||||
|
||||
@ -30,7 +30,7 @@ function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = n
|
||||
echo '<input type="hidden" name="tab_hash" value="" />';
|
||||
// we do validation on page refresh when browser remembers field values,
|
||||
// add a field with known value which will be used for checks
|
||||
if (!$has_check_page_refresh) {
|
||||
if (! $has_check_page_refresh) {
|
||||
$has_check_page_refresh = true;
|
||||
echo '<input type="hidden" name="check_page_refresh" '
|
||||
. ' id="check_page_refresh" value="" />' . "\n";
|
||||
@ -350,7 +350,7 @@ function PMA_displayGroupHeader($header_text)
|
||||
global $_FormDisplayGroup;
|
||||
|
||||
$_FormDisplayGroup++;
|
||||
if (!$header_text) {
|
||||
if (! $header_text) {
|
||||
return;
|
||||
}
|
||||
$colspan = defined('PMA_SETUP')
|
||||
|
||||
@ -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)');
|
||||
|
||||
@ -114,10 +114,10 @@ function PMA_config_validate($validator_id, &$values, $isPostSource)
|
||||
if (is_array($r)) {
|
||||
foreach ($r as $key => $error_list) {
|
||||
// skip empty values if $isPostSource is false
|
||||
if (!$isPostSource && empty($error_list)) {
|
||||
if (! $isPostSource && empty($error_list)) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($result[$key])) {
|
||||
if (! isset($result[$key])) {
|
||||
$result[$key] = array();
|
||||
}
|
||||
$result[$key] = array_merge($result[$key], (array)$error_list);
|
||||
@ -210,7 +210,7 @@ function test_db_connection(
|
||||
if ($extension == 'drizzle') {
|
||||
while (1) {
|
||||
$drizzle = @drizzle_create();
|
||||
if (!$drizzle) {
|
||||
if (! $drizzle) {
|
||||
$error = __('Could not initialize Drizzle connection library');
|
||||
break;
|
||||
}
|
||||
@ -219,7 +219,7 @@ function test_db_connection(
|
||||
: @drizzle_con_add_tcp(
|
||||
$drizzle, $host, $port, $user, $pass, null, 0
|
||||
);
|
||||
if (!$conn) {
|
||||
if (! $conn) {
|
||||
$error = __('Could not connect to Drizzle server');
|
||||
drizzle_free($drizzle);
|
||||
break;
|
||||
@ -227,7 +227,7 @@ function test_db_connection(
|
||||
// connection object is set up but we have to send some query
|
||||
// to actually connect
|
||||
$res = @drizzle_query($conn, 'SELECT 1');
|
||||
if (!$res) {
|
||||
if (! $res) {
|
||||
$error = __('Could not connect to Drizzle server');
|
||||
} else {
|
||||
drizzle_result_free($res);
|
||||
@ -238,14 +238,14 @@ function test_db_connection(
|
||||
}
|
||||
} else if ($extension == 'mysql') {
|
||||
$conn = @mysql_connect($host . $socket . $port, $user, $pass);
|
||||
if (!$conn) {
|
||||
if (! $conn) {
|
||||
$error = __('Could not connect to MySQL server');
|
||||
} else {
|
||||
mysql_close($conn);
|
||||
}
|
||||
} else {
|
||||
$conn = @mysqli_connect($host, $user, $pass, null, $port, $socket);
|
||||
if (!$conn) {
|
||||
if (! $conn) {
|
||||
$error = __('Could not connect to MySQL server');
|
||||
} else {
|
||||
mysqli_close($conn);
|
||||
@ -299,7 +299,7 @@ function validate_server($path, $values)
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error && $values['Servers/1/auth_type'] == 'config') {
|
||||
if (! $error && $values['Servers/1/auth_type'] == 'config') {
|
||||
$password = $values['Servers/1/nopassword'] ? null
|
||||
: $values['Servers/1/password'];
|
||||
$test = test_db_connection(
|
||||
@ -351,7 +351,7 @@ function validate_pmadb($path, $values)
|
||||
= __('Empty phpMyAdmin control user password while using pmadb');
|
||||
$error = true;
|
||||
}
|
||||
if (!$error) {
|
||||
if (! $error) {
|
||||
$test = test_db_connection(
|
||||
$values['Servers/1/extension'], $values['Servers/1/connect_type'],
|
||||
$values['Servers/1/host'], $values['Servers/1/port'],
|
||||
@ -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
|
||||
@ -474,8 +474,8 @@ function test_number(
|
||||
}
|
||||
|
||||
if (intval($values[$path]) != $values[$path]
|
||||
|| (!$allow_neg && $values[$path] < 0)
|
||||
|| (!$allow_zero && $values[$path] == 0)
|
||||
|| (! $allow_neg && $values[$path] < 0)
|
||||
|| (! $allow_zero && $values[$path] == 0)
|
||||
|| $values[$path] > $max_value
|
||||
) {
|
||||
return $error_string;
|
||||
|
||||
@ -612,7 +612,7 @@ function PMA_DBI_getTablesFull($database, $table = false,
|
||||
$each_tables = apc_fetch($cacheKey);
|
||||
}
|
||||
|
||||
if (!$each_tables) {
|
||||
if (! $each_tables) {
|
||||
$each_tables = PMA_DBI_fetchResult($sql, 'Name', null, $link);
|
||||
}
|
||||
|
||||
@ -855,7 +855,7 @@ function PMA_DBI_getDatabasesFull($database = null, $force_stats = false,
|
||||
* cause MySQL does not support natural ordering, we have to do it afterward
|
||||
*/
|
||||
$limit = '';
|
||||
if (!$GLOBALS['cfg']['NaturalOrder']) {
|
||||
if (! $GLOBALS['cfg']['NaturalOrder']) {
|
||||
if ($limit_count) {
|
||||
$limit = ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
|
||||
}
|
||||
@ -1313,7 +1313,7 @@ function PMA_DBI_getColumns($database, $table, $column = null, $full = false,
|
||||
$has_pk_candidates = true;
|
||||
}
|
||||
}
|
||||
if (!$has_pk && $has_pk_candidates) {
|
||||
if (! $has_pk && $has_pk_candidates) {
|
||||
// check whether we can promote some unique index to PRI
|
||||
$sql = "
|
||||
SELECT i.index_name, p.column_name
|
||||
|
||||
@ -59,7 +59,8 @@ if (empty($is_table)
|
||||
|
||||
if (! $is_table) {
|
||||
$_result = PMA_DBI_tryQuery(
|
||||
'SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\';',
|
||||
'SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true)
|
||||
. '\';',
|
||||
null, PMA_DBI_QUERY_STORE
|
||||
);
|
||||
$is_table = @PMA_DBI_num_rows($_result);
|
||||
|
||||
@ -298,7 +298,7 @@ class PMA_DrizzleResult
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
if (!$this->_columns) {
|
||||
if (! $this->_columns) {
|
||||
$this->_readColumns();
|
||||
}
|
||||
return $this->_columns;
|
||||
@ -324,7 +324,7 @@ class PMA_DrizzleResult
|
||||
*/
|
||||
private function _transformResultRow(&$row, $fetchMode)
|
||||
{
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ class PMA_DrizzleResult
|
||||
{
|
||||
// read column names on first fetch, only buffered results
|
||||
// allow for reading it later
|
||||
if (!$this->_columns) {
|
||||
if (! $this->_columns) {
|
||||
$this->_readColumns();
|
||||
}
|
||||
if ($fetchMode === null) {
|
||||
|
||||
@ -108,14 +108,14 @@ function PMA_DBI_connect($user, $password, $is_controluser = false,
|
||||
$client_flags |= DRIZZLE_CAPABILITIES_SSL;
|
||||
}
|
||||
|
||||
if (!$server) {
|
||||
if (! $server) {
|
||||
$link = @PMA_DBI_real_connect(
|
||||
$drizzle, $cfg['Server']['host'], $server_port, $server_socket, $user,
|
||||
$password, false, $client_flags
|
||||
);
|
||||
// Retry with empty password if we're allowed to
|
||||
if ($link == false && isset($cfg['Server']['nopassword'])
|
||||
&& $cfg['Server']['nopassword'] && !$is_controluser
|
||||
&& $cfg['Server']['nopassword'] && ! $is_controluser
|
||||
) {
|
||||
$link = @PMA_DBI_real_connect(
|
||||
$drizzle, $cfg['Server']['host'], $server_port, $server_socket,
|
||||
|
||||
@ -129,14 +129,14 @@ function PMA_DBI_connect(
|
||||
$client_flags |= MYSQL_CLIENT_SSL;
|
||||
}
|
||||
|
||||
if (!$server) {
|
||||
if (! $server) {
|
||||
$link = PMA_DBI_real_connect(
|
||||
$cfg['Server']['host'] . $server_port . $server_socket,
|
||||
$user, $password, empty($client_flags) ? null : $client_flags
|
||||
);
|
||||
|
||||
// Retry with empty password if we're allowed to
|
||||
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
|
||||
if (empty($link) && $cfg['Server']['nopassword'] && ! $is_controluser) {
|
||||
$link = PMA_DBI_real_connect(
|
||||
$cfg['Server']['host'] . $server_port . $server_socket,
|
||||
$user, '', empty($client_flags) ? null : $client_flags
|
||||
|
||||
@ -161,7 +161,7 @@ function PMA_DBI_connect(
|
||||
$client_flags |= MYSQLI_CLIENT_SSL;
|
||||
}
|
||||
|
||||
if (!$server) {
|
||||
if (! $server) {
|
||||
$return_value = @PMA_DBI_real_connect(
|
||||
$link,
|
||||
$cfg['Server']['host'],
|
||||
@ -175,7 +175,7 @@ function PMA_DBI_connect(
|
||||
// Retry with empty password if we're allowed to
|
||||
if ($return_value == false
|
||||
&& isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword']
|
||||
&& !$is_controluser
|
||||
&& ! $is_controluser
|
||||
) {
|
||||
$return_value = @PMA_DBI_real_connect(
|
||||
$link,
|
||||
|
||||
@ -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') . ': </label>'
|
||||
. '<label for="nopass_0">' . __('Password:') . ' </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" />'
|
||||
. ' ' . __('Re-type') . ': '
|
||||
. ' ' . __('Re-type:') . ' '
|
||||
. '<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>'
|
||||
|
||||
@ -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> '
|
||||
@ -40,7 +40,7 @@ if ($is_create_db_priv) {
|
||||
} else {
|
||||
?>
|
||||
<!-- db creation no privileges message -->
|
||||
<strong><?php echo __('Create database') . ': ' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
|
||||
<strong><?php echo __('Create database:') . ' ' . 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'))
|
||||
|
||||
@ -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,36 @@ 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 +118,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"';
|
||||
$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) {
|
||||
echo ' checked="checked"';
|
||||
$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 +301,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 +331,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 +376,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);
|
||||
|
||||
@ -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'),
|
||||
|
||||
@ -97,8 +97,14 @@ function PMA_GIS_modifyQuery($sql_query, $visualizationSettings)
|
||||
return $modified_query;
|
||||
}
|
||||
|
||||
// Local function to sanitize the expression taken
|
||||
// from the results of PMA_SQP_analyze function.
|
||||
/**
|
||||
* Local function to sanitize the expression taken
|
||||
* from the results of PMA_SQP_analyze function.
|
||||
*
|
||||
* @param aray $select Select to sanitize.
|
||||
*
|
||||
* @return Sanitized string.
|
||||
*/
|
||||
function sanitize($select)
|
||||
{
|
||||
$table_col = $select['table_name'] . "." . $select['column'];
|
||||
|
||||
@ -25,8 +25,10 @@ function PMA_getHtmlForDisplayIndexes()
|
||||
$html_output .= PMA_Index::getView($GLOBALS['table'], $GLOBALS['db']);
|
||||
$html_output .= '<fieldset class="tblFooters" style="text-align: left;">'
|
||||
. '<form action="tbl_indexes.php" method="post">';
|
||||
$html_output .= PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table'])
|
||||
. sprintf(
|
||||
$html_output .= PMA_generate_common_hidden_inputs(
|
||||
$GLOBALS['db'], $GLOBALS['table']
|
||||
);
|
||||
$html_output .= sprintf(
|
||||
__('Create an index on %s columns'),
|
||||
'<input type="text" size="2" name="added_fields" value="1" />'
|
||||
);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -129,7 +129,7 @@ if (! empty($submit_mult)
|
||||
case 'change':
|
||||
PMA_displayHtmlForColumnChange($db, $table, $selected, $action);
|
||||
// execution stops here but PMA_Response correctly finishes
|
||||
// the rendering
|
||||
// the rendering
|
||||
exit;
|
||||
case 'browse':
|
||||
// this should already be handled by tbl_structure.php
|
||||
@ -167,7 +167,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
}
|
||||
$selected_cnt = count($selected);
|
||||
$i = 0;
|
||||
foreach ($selected AS $idx => $sval) {
|
||||
foreach ($selected as $idx => $sval) {
|
||||
switch ($what) {
|
||||
case 'row_delete':
|
||||
$full_query .= 'DELETE FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table)
|
||||
@ -520,7 +520,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
PMA_DBI_select_db($db);
|
||||
}
|
||||
$result = PMA_DBI_query($a_query);
|
||||
|
||||
|
||||
if ($query_type == 'drop_db') {
|
||||
PMA_clearTransformations($selected[$i]);
|
||||
} elseif ($query_type == 'drop_tbl') {
|
||||
@ -528,7 +528,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
} else if ($query_type == 'drop_fld') {
|
||||
PMA_clearTransformations($db, $table, $selected[$i]);
|
||||
}
|
||||
|
||||
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ if (! PMA_Util::cacheExists('mysql_charsets', true)) {
|
||||
}
|
||||
|
||||
sort($mysql_collations_flat, SORT_STRING);
|
||||
foreach ($mysql_collations AS $key => $value) {
|
||||
foreach ($mysql_collations as $key => $value) {
|
||||
sort($mysql_collations[$key], SORT_STRING);
|
||||
reset($mysql_collations[$key]);
|
||||
}
|
||||
|
||||
@ -1031,7 +1031,14 @@ class PMA_NavigationTree
|
||||
$retval .= "<form class='ajax fast_filter'>";
|
||||
$retval .= PMA_getHiddenFields($url_params);
|
||||
$retval .= "<input class='searchClause' name='searchClause'";
|
||||
$retval .= " value='" . __('filter databases by name') . "' />";
|
||||
// allow html5 placeholder attribute
|
||||
$placeholder_key = 'value';
|
||||
if (PMA_USR_BROWSER_AGENT !== 'IE'
|
||||
|| PMA_USR_BROWSER_VER > 9
|
||||
) {
|
||||
$placeholder_key = 'placeholder';
|
||||
}
|
||||
$retval .= " $placeholder_key='" . __('filter databases by name') . "' />";
|
||||
$retval .= "<span title='" . __('Clear Fast Filter') . "'>X</span>";
|
||||
$retval .= "</form>";
|
||||
$retval .= "</li>";
|
||||
@ -1057,7 +1064,14 @@ class PMA_NavigationTree
|
||||
$retval .= "<form class='ajax fast_filter'>";
|
||||
$retval .= PMA_getHiddenFields($url_params);
|
||||
$retval .= "<input class='searchClause' name='searchClause2'";
|
||||
$retval .= " value='" . __('filter items by name') . "' />";
|
||||
// allow html5 placeholder attribute
|
||||
$placeholder_key = 'value';
|
||||
if (PMA_USR_BROWSER_AGENT !== 'IE'
|
||||
|| PMA_USR_BROWSER_VER > 9
|
||||
) {
|
||||
$placeholder_key = 'placeholder';
|
||||
}
|
||||
$retval .= " $placeholder_key='" . __('filter items by name') . "' />";
|
||||
$retval .= "<span title='" . __('Clear Fast Filter') . "'>X</span>";
|
||||
$retval .= "</form>";
|
||||
$retval .= "</li>";
|
||||
|
||||
@ -11,6 +11,8 @@ if (! defined('PHPMYADMIN')) {
|
||||
|
||||
/**
|
||||
* Represents a database node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Database extends Node
|
||||
{
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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 />'
|
||||
@ -1361,11 +1361,11 @@ function PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params)
|
||||
|
||||
$html_output .= '<ul>';
|
||||
|
||||
foreach ($foreign AS $master => $arr) {
|
||||
foreach ($foreign as $master => $arr) {
|
||||
$join_query = 'SELECT '
|
||||
. PMA_Util::backquote($GLOBALS['table']) . '.*'
|
||||
. ' FROM ' . PMA_Util::backquote($GLOBALS['table'])
|
||||
. ' LEFT JOIN '
|
||||
. ' LEFT JOIN '
|
||||
. PMA_Util::backquote($arr['foreign_db'])
|
||||
. '.'
|
||||
. PMA_Util::backquote($arr['foreign_table']);
|
||||
@ -1378,13 +1378,13 @@ function PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params)
|
||||
$join_query .= ' ON '
|
||||
. PMA_Util::backquote($GLOBALS['table']) . '.'
|
||||
. PMA_Util::backquote($master)
|
||||
. ' = '
|
||||
. PMA_Util::backquote($arr['foreign_db'])
|
||||
. ' = '
|
||||
. PMA_Util::backquote($arr['foreign_db'])
|
||||
. '.'
|
||||
. PMA_Util::backquote($foreign_table) . '.'
|
||||
. PMA_Util::backquote($arr['foreign_field'])
|
||||
. ' WHERE '
|
||||
. PMA_Util::backquote($arr['foreign_db'])
|
||||
. PMA_Util::backquote($arr['foreign_db'])
|
||||
. '.'
|
||||
. PMA_Util::backquote($foreign_table) . '.'
|
||||
. PMA_Util::backquote($arr['foreign_field'])
|
||||
|
||||
@ -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 = ''
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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\'].'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user