The branch, master has been updated via dea96e2e5ad21df2dd1c456457d451e137747e27 (commit) from 3c573fc82e35834646ed861bbc53f55d30db1b4e (commit)
- Log ----------------------------------------------------------------- commit dea96e2e5ad21df2dd1c456457d451e137747e27 Author: Marc Delisle marc@infomarc.info Date: Sat Jan 29 11:15:35 2011 -0500
Conditional Ajax for db Structure and Tracking
-----------------------------------------------------------------------
Summary of changes: db_structure.php | 8 ++++++-- db_tracking.php | 3 ++- js/db_structure.js | 17 +++++++++++++++-- libraries/db_events.inc.php | 7 ++++++- libraries/db_routines.inc.php | 9 ++++++++- 5 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/db_structure.php b/db_structure.php index fb2ecc0..dcce45b 100644 --- a/db_structure.php +++ b/db_structure.php @@ -266,7 +266,11 @@ foreach ($tables as $keyname => $each_table) {
if (! $db_is_information_schema) { 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='; $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) . '&message_to_show=' @@ -355,7 +359,7 @@ foreach ($tables as $keyname => $each_table) { <?php echo $titles['Insert']; ?></a></td> <td align="center"><?php echo $empty_table; ?></td> <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 echo urlencode($drop_query); ?>&message_to_show=<?php echo urlencode($drop_message); ?>" > diff --git a/db_tracking.php b/db_tracking.php index 62f8554..d9a7da3 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -11,6 +11,7 @@ require_once './libraries/common.inc.php';
//Get some js files needed for Ajax requests $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. @@ -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_updated'];?></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> | <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> diff --git a/js/db_structure.js b/js/db_structure.js index 8b529d7..4affd75 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -57,6 +57,7 @@ $(document).ready(function() { * * @uses $.PMA_confirm() * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ $(".truncate_table_anchor").live('click', function(event) { event.preventDefault(); @@ -105,6 +106,7 @@ $(document).ready(function() { * * @uses $.PMA_confirm() * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ $(".drop_table_anchor").live('click', function(event) { event.preventDefault(); @@ -150,6 +152,7 @@ $(document).ready(function() { * * @uses $.PMA_confirm() * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ $('.drop_event_anchor').live('click', function(event) { event.preventDefault(); @@ -188,6 +191,7 @@ $(document).ready(function() { * * @uses $.PMA_confirm() * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ $('.drop_procedure_anchor').live('click', function(event) { event.preventDefault(); @@ -217,19 +221,28 @@ $(document).ready(function() { }) // end $.PMA_confirm() }) //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) { event.preventDefault();
+ var $anchor = $(this); + /** * @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 = 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']);
diff --git a/libraries/db_events.inc.php b/libraries/db_events.inc.php index 82ef51f..6e93299 100644 --- a/libraries/db_events.inc.php +++ b/libraries/db_events.inc.php @@ -25,6 +25,11 @@ if ($events) { __('Type')); $ct=0; $delimiter = '//'; + if ($GLOBALS['cfg']['AjaxEnable']) { + $conditional_class = 'class="drop_event_anchor"'; + } else { + $conditional_class = ''; + } foreach ($events as $event) {
// information_schema (at least in MySQL 5.1.22) does not return @@ -45,7 +50,7 @@ if ($events) { ($ct%2 == 0) ? 'even' : 'odd', $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']) : ' ', - '<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']); $ct++; } diff --git a/libraries/db_routines.inc.php b/libraries/db_routines.inc.php index d898d00..648d80c 100644 --- a/libraries/db_routines.inc.php +++ b/libraries/db_routines.inc.php @@ -37,6 +37,12 @@ if ($routines) { __('Return type')); $ct=0; $delimiter = '//'; + if ($GLOBALS['cfg']['AjaxEnable']) { + $conditional_class = 'class="drop_procedure_anchor"'; + } else { + $conditional_class = ''; + } + foreach ($routines as $routine) {
// information_schema (at least in MySQL 5.0.45) @@ -64,6 +70,7 @@ if ($routines) { } else { $sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']); } + echo sprintf('<tr class="%s"> <td><input type="hidden" class="drop_procedure_sql" value="%s" /><strong>%s</strong></td> <td>%s</td> @@ -75,7 +82,7 @@ if ($routines) { $sqlDropProc, $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']) : ' ', - '<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['DTD_IDENTIFIER']); $ct++;
hooks/post-receive