Conditional Ajax for db Structure and Tracking
This commit is contained in:
@@ -266,7 +266,11 @@ foreach ($tables as $keyname => $each_table) {
|
|||||||
|
|
||||||
if (! $db_is_information_schema) {
|
if (! $db_is_information_schema) {
|
||||||
if (! empty($each_table['TABLE_ROWS'])) {
|
if (! empty($each_table['TABLE_ROWS'])) {
|
||||||
$empty_table = '<a class="truncate_table_anchor" href="sql.php?' . $tbl_url_query
|
$empty_table = '<a ';
|
||||||
|
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||||
|
$empty_table .= 'class="truncate_table_anchor"';
|
||||||
|
}
|
||||||
|
$empty_table .= ' href="sql.php?' . $tbl_url_query
|
||||||
. '&sql_query=';
|
. '&sql_query=';
|
||||||
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
|
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
|
||||||
. '&message_to_show='
|
. '&message_to_show='
|
||||||
@@ -355,7 +359,7 @@ foreach ($tables as $keyname => $each_table) {
|
|||||||
<?php echo $titles['Insert']; ?></a></td>
|
<?php echo $titles['Insert']; ?></a></td>
|
||||||
<td align="center"><?php echo $empty_table; ?></td>
|
<td align="center"><?php echo $empty_table; ?></td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a class="drop_table_anchor" href="sql.php?<?php echo $tbl_url_query;
|
<a <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'class="drop_table_anchor"' : ''); ?> href="sql.php?<?php echo $tbl_url_query;
|
||||||
?>&reload=1&purge=1&sql_query=<?php
|
?>&reload=1&purge=1&sql_query=<?php
|
||||||
echo urlencode($drop_query); ?>&message_to_show=<?php
|
echo urlencode($drop_query); ?>&message_to_show=<?php
|
||||||
echo urlencode($drop_message); ?>" >
|
echo urlencode($drop_message); ?>" >
|
||||||
|
@@ -11,6 +11,7 @@ require_once './libraries/common.inc.php';
|
|||||||
|
|
||||||
//Get some js files needed for Ajax requests
|
//Get some js files needed for Ajax requests
|
||||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||||
|
$GLOBALS['js_include'][] = 'db_structure.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we are not in an Ajax request, then do the common work and show the links etc.
|
* If we are not in an Ajax request, then do the common work and show the links etc.
|
||||||
@@ -129,7 +130,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) {
|
|||||||
<td><?php echo $version_data['date_created'];?></td>
|
<td><?php echo $version_data['date_created'];?></td>
|
||||||
<td><?php echo $version_data['date_updated'];?></td>
|
<td><?php echo $version_data['date_updated'];?></td>
|
||||||
<td><?php echo $version_status;?></td>
|
<td><?php echo $version_status;?></td>
|
||||||
<td><a class="drop_tracking_anchor" href="<?php echo $delete_link;?>" ><?php echo $drop_image_or_text; ?></a></td>
|
<td><a <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'class="drop_tracking_anchor"' : ''); ?> href="<?php echo $delete_link;?>" ><?php echo $drop_image_or_text; ?></a></td>
|
||||||
<td> <a href="<?php echo $tmp_link; ?>"><?php echo __('Versions');?></a>
|
<td> <a href="<?php echo $tmp_link; ?>"><?php echo __('Versions');?></a>
|
||||||
| <a href="<?php echo $tmp_link; ?>&report=true&version=<?php echo $version_data['version'];?>"><?php echo __('Tracking report');?></a>
|
| <a href="<?php echo $tmp_link; ?>&report=true&version=<?php echo $version_data['version'];?>"><?php echo __('Tracking report');?></a>
|
||||||
| <a href="<?php echo $tmp_link; ?>&snapshot=true&version=<?php echo $version_data['version'];?>"><?php echo __('Structure snapshot');?></a></td>
|
| <a href="<?php echo $tmp_link; ?>&snapshot=true&version=<?php echo $version_data['version'];?>"><?php echo __('Structure snapshot');?></a></td>
|
||||||
|
@@ -57,6 +57,7 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
* @uses $.PMA_confirm()
|
* @uses $.PMA_confirm()
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
*/
|
*/
|
||||||
$(".truncate_table_anchor").live('click', function(event) {
|
$(".truncate_table_anchor").live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -105,6 +106,7 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
* @uses $.PMA_confirm()
|
* @uses $.PMA_confirm()
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
*/
|
*/
|
||||||
$(".drop_table_anchor").live('click', function(event) {
|
$(".drop_table_anchor").live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -150,6 +152,7 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
* @uses $.PMA_confirm()
|
* @uses $.PMA_confirm()
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
*/
|
*/
|
||||||
$('.drop_event_anchor').live('click', function(event) {
|
$('.drop_event_anchor').live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -188,6 +191,7 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
* @uses $.PMA_confirm()
|
* @uses $.PMA_confirm()
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
*/
|
*/
|
||||||
$('.drop_procedure_anchor').live('click', function(event) {
|
$('.drop_procedure_anchor').live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -217,19 +221,28 @@ $(document).ready(function() {
|
|||||||
}) // end $.PMA_confirm()
|
}) // end $.PMA_confirm()
|
||||||
}) //end Drop Procedure
|
}) //end Drop Procedure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajax Event handler for 'Drop tracking'
|
||||||
|
*
|
||||||
|
* @uses $.PMA_confirm()
|
||||||
|
* @uses PMA_ajaxShowMessage()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
|
*/
|
||||||
$('.drop_tracking_anchor').live('click', function(event) {
|
$('.drop_tracking_anchor').live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
var $anchor = $(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var curr_tracking_row Object containing reference to the current tracked table's row
|
* @var curr_tracking_row Object containing reference to the current tracked table's row
|
||||||
*/
|
*/
|
||||||
var curr_tracking_row = $(this).parents('tr');
|
var curr_tracking_row = $anchor.parents('tr');
|
||||||
/**
|
/**
|
||||||
* @var question String containing the question to be asked for confirmation
|
* @var question String containing the question to be asked for confirmation
|
||||||
*/
|
*/
|
||||||
var question = PMA_messages['strDeleteTrackingData'];
|
var question = PMA_messages['strDeleteTrackingData'];
|
||||||
|
|
||||||
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
|
$anchor.PMA_confirm(question, $anchor.attr('href'), function(url) {
|
||||||
|
|
||||||
PMA_ajaxShowMessage(PMA_messages['strDeletingTrackingData']);
|
PMA_ajaxShowMessage(PMA_messages['strDeletingTrackingData']);
|
||||||
|
|
||||||
|
@@ -25,6 +25,11 @@ if ($events) {
|
|||||||
__('Type'));
|
__('Type'));
|
||||||
$ct=0;
|
$ct=0;
|
||||||
$delimiter = '//';
|
$delimiter = '//';
|
||||||
|
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||||
|
$conditional_class = 'class="drop_event_anchor"';
|
||||||
|
} else {
|
||||||
|
$conditional_class = '';
|
||||||
|
}
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
|
|
||||||
// information_schema (at least in MySQL 5.1.22) does not return
|
// information_schema (at least in MySQL 5.1.22) does not return
|
||||||
@@ -45,7 +50,7 @@ if ($events) {
|
|||||||
($ct%2 == 0) ? 'even' : 'odd',
|
($ct%2 == 0) ? 'even' : 'odd',
|
||||||
$event['EVENT_NAME'],
|
$event['EVENT_NAME'],
|
||||||
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&sql_query=' . urlencode($definition) . '&show_query=1&db_query_force=1&delimiter=' . urlencode($delimiter), $titles['Structure']) : ' ',
|
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&sql_query=' . urlencode($definition) . '&show_query=1&db_query_force=1&delimiter=' . urlencode($delimiter), $titles['Structure']) : ' ',
|
||||||
'<a class="drop_event_anchor" href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
|
'<a ' . $conditional_class . ' href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
|
||||||
$event['EVENT_TYPE']);
|
$event['EVENT_TYPE']);
|
||||||
$ct++;
|
$ct++;
|
||||||
}
|
}
|
||||||
|
@@ -37,6 +37,12 @@ if ($routines) {
|
|||||||
__('Return type'));
|
__('Return type'));
|
||||||
$ct=0;
|
$ct=0;
|
||||||
$delimiter = '//';
|
$delimiter = '//';
|
||||||
|
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||||
|
$conditional_class = 'class="drop_procedure_anchor"';
|
||||||
|
} else {
|
||||||
|
$conditional_class = '';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($routines as $routine) {
|
foreach ($routines as $routine) {
|
||||||
|
|
||||||
// information_schema (at least in MySQL 5.0.45)
|
// information_schema (at least in MySQL 5.0.45)
|
||||||
@@ -64,6 +70,7 @@ if ($routines) {
|
|||||||
} else {
|
} else {
|
||||||
$sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']);
|
$sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo sprintf('<tr class="%s">
|
echo sprintf('<tr class="%s">
|
||||||
<td><input type="hidden" class="drop_procedure_sql" value="%s" /><strong>%s</strong></td>
|
<td><input type="hidden" class="drop_procedure_sql" value="%s" /><strong>%s</strong></td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
@@ -75,7 +82,7 @@ if ($routines) {
|
|||||||
$sqlDropProc,
|
$sqlDropProc,
|
||||||
$routine['ROUTINE_NAME'],
|
$routine['ROUTINE_NAME'],
|
||||||
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&sql_query=' . urlencode($definition) . '&show_query=1&db_query_force=1&delimiter=' . urlencode($delimiter), $titles['Structure']) : ' ',
|
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&sql_query=' . urlencode($definition) . '&show_query=1&db_query_force=1&delimiter=' . urlencode($delimiter), $titles['Structure']) : ' ',
|
||||||
'<a class="drop_procedure_anchor" href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDropProc) . '" >' . $titles['Drop'] . '</a>',
|
'<a ' . $conditional_class . ' href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDropProc) . '" >' . $titles['Drop'] . '</a>',
|
||||||
$routine['ROUTINE_TYPE'],
|
$routine['ROUTINE_TYPE'],
|
||||||
$routine['DTD_IDENTIFIER']);
|
$routine['DTD_IDENTIFIER']);
|
||||||
$ct++;
|
$ct++;
|
||||||
|
Reference in New Issue
Block a user