Start implementing conditional Ajax (in results page)
This commit is contained in:
28
js/sql.js
28
js/sql.js
@@ -172,11 +172,11 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger the appendAnchor event to prepare the first table for inline edit
|
* Trigger the appendAnchor event to prepare the first table for inline edit
|
||||||
*
|
* (see $GLOBALS['cfg']['AjaxEnable'])
|
||||||
* @memberOf jQuery
|
* @memberOf jQuery
|
||||||
* @name sqlqueryresults_trigger
|
* @name sqlqueryresults_trigger
|
||||||
*/
|
*/
|
||||||
$("#sqlqueryresults").trigger('appendAnchor');
|
$("#sqlqueryresults.ajax").trigger('appendAnchor');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the "Show/Hide query box" message to the query input form
|
* Append the "Show/Hide query box" message to the query input form
|
||||||
@@ -264,11 +264,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paginate when we click any of the navigation buttons
|
* Paginate when we click any of the navigation buttons
|
||||||
|
* (only if the element has the ajax class, see $cfg['AjaxEnable'])
|
||||||
* @memberOf jQuery
|
* @memberOf jQuery
|
||||||
* @name paginate_nav_button_click
|
* @name paginate_nav_button_click
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
*/
|
*/
|
||||||
$("input[name=navig]").live('click', function(event) {
|
$("input[name=navig].ajax").live('click', function(event) {
|
||||||
/** @lends jQuery */
|
/** @lends jQuery */
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@@ -293,15 +294,22 @@ $(document).ready(function() {
|
|||||||
* @name paginate_dropdown_change
|
* @name paginate_dropdown_change
|
||||||
*/
|
*/
|
||||||
$("#pageselector").live('change', function(event) {
|
$("#pageselector").live('change', function(event) {
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
PMA_ajaxShowMessage();
|
|
||||||
var $the_form = $(this).parent("form");
|
var $the_form = $(this).parent("form");
|
||||||
|
|
||||||
$.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
|
// see $cfg['AjaxEnable']
|
||||||
$("#sqlqueryresults").html(data);
|
if ($(this).hasClass('ajax')) {
|
||||||
$("#sqlqueryresults").trigger('appendAnchor');
|
event.preventDefault();
|
||||||
}) // end $.post()
|
|
||||||
|
PMA_ajaxShowMessage();
|
||||||
|
|
||||||
|
$.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
|
||||||
|
$("#sqlqueryresults").html(data);
|
||||||
|
$("#sqlqueryresults").trigger('appendAnchor');
|
||||||
|
}) // end $.post()
|
||||||
|
} else {
|
||||||
|
$the_form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
})// end Paginate results with Page Selector
|
})// end Paginate results with Page Selector
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2201,8 +2201,11 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
|
|||||||
$pageNowMinusRange = ($pageNow - $range);
|
$pageNowMinusRange = ($pageNow - $range);
|
||||||
$pageNowPlusRange = ($pageNow + $range);
|
$pageNowPlusRange = ($pageNow + $range);
|
||||||
|
|
||||||
$gotopage = $prompt
|
$gotopage = $prompt . ' <select id="pageselector" ';
|
||||||
. ' <select id="pageselector" name="pos" >' . "\n";
|
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||||
|
$gotopage .= ' class="ajax"';
|
||||||
|
}
|
||||||
|
$gotopage .= ' name="pos" >' . "\n";
|
||||||
if ($nbTotalPage < $showAll) {
|
if ($nbTotalPage < $showAll) {
|
||||||
$pages = range(1, $nbTotalPage);
|
$pages = range(1, $nbTotalPage);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -487,6 +487,13 @@ $cfg['ServerDefault'] = 1;
|
|||||||
/*
|
/*
|
||||||
* Other core phpMyAdmin settings
|
* Other core phpMyAdmin settings
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* whether Ajax behavior is active
|
||||||
|
*
|
||||||
|
* @global boolean $cfg['AjaxEnable']
|
||||||
|
*/
|
||||||
|
$cfg['AjaxEnable'] = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* maximum number of db's displayed in left frame and database list
|
* maximum number of db's displayed in left frame and database list
|
||||||
*
|
*
|
||||||
|
@@ -228,7 +228,7 @@ function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_q
|
|||||||
<input type="hidden" name="pos" value="<?php echo $pos; ?>" />
|
<input type="hidden" name="pos" value="<?php echo $pos; ?>" />
|
||||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||||
<?php echo $input_for_real_end; ?>
|
<?php echo $input_for_real_end; ?>
|
||||||
<input type="submit" name="navig" value="<?php echo $caption_output; ?>"<?php echo $title_output . $onclick; ?> />
|
<input type="submit" name="navig" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : '' ); ?> value="<?php echo $caption_output; ?>"<?php echo $title_output . $onclick; ?> />
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
@@ -303,7 +303,7 @@ onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo
|
|||||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||||
<input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?>" />
|
<input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?>" />
|
||||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||||
<input type="submit" name="navig" value="<?php echo __('Show'); ?> :" />
|
<input type="submit" name="navig" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?> value="<?php echo __('Show'); ?> :" />
|
||||||
<input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
|
<input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
|
||||||
<?php echo __('row(s) starting from row #') . "\n"; ?>
|
<?php echo __('row(s) starting from row #') . "\n"; ?>
|
||||||
<input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
|
<input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
|
||||||
|
12
sql.php
12
sql.php
@@ -730,7 +730,7 @@ if (0 == $num_rows || $is_affected) {
|
|||||||
else {
|
else {
|
||||||
//If we are retrieving the full value of a truncated field or the original
|
//If we are retrieving the full value of a truncated field or the original
|
||||||
// value of a transformed field, show it here and exit
|
// value of a transformed field, show it here and exit
|
||||||
if( $GLOBALS['inline_edit'] == true) {
|
if( $GLOBALS['inline_edit'] == true && $GLOBALS['cfg']['AjaxEnable']) {
|
||||||
$row = PMA_DBI_fetch_row($result);
|
$row = PMA_DBI_fetch_row($result);
|
||||||
$extra_data = array();
|
$extra_data = array();
|
||||||
$extra_data['value'] = $row[0];
|
$extra_data['value'] = $row[0];
|
||||||
@@ -750,7 +750,7 @@ else {
|
|||||||
|
|
||||||
unset($message);
|
unset($message);
|
||||||
|
|
||||||
if( $GLOBALS['is_ajax_request'] != true) {
|
if( ! $GLOBALS['is_ajax_request'] || ! $GLOBALS['cfg']['AjaxEnable']) {
|
||||||
if (strlen($table)) {
|
if (strlen($table)) {
|
||||||
require './libraries/tbl_common.php';
|
require './libraries/tbl_common.php';
|
||||||
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
|
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
|
||||||
@@ -781,9 +781,13 @@ else {
|
|||||||
$fields_cnt = count($fields_meta);
|
$fields_cnt = count($fields_meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $GLOBALS['is_ajax_request'] != true ) {
|
if( ! $GLOBALS['is_ajax_request']) {
|
||||||
//begin the sqlqueryresults div here. container div
|
//begin the sqlqueryresults div here. container div
|
||||||
echo '<div id="sqlqueryresults">';
|
echo '<div id="sqlqueryresults"';
|
||||||
|
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||||
|
echo ' class="ajax"';
|
||||||
|
}
|
||||||
|
echo '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display previous update query (from tbl_replace)
|
// Display previous update query (from tbl_replace)
|
||||||
|
Reference in New Issue
Block a user