The branch, master has been updated
via 485e1736b61773459de8e797d06aac6b16840078 (commit)
from 8dfdcca68b69f30efdee5c8d5d8b38bed508e183 (commit)
- Log -----------------------------------------------------------------
commit 485e1736b61773459de8e797d06aac6b16840078
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sat Jun 12 08:45:24 2010 -0400
make inline editing work for all cases of fmtType
-----------------------------------------------------------------------
Summary of changes:
js/functions.js | 6 +++---
libraries/common.lib.php | 2 +-
libraries/sqlparser.lib.php | 7 +++++++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/js/functions.js b/js/functions.js
index 908ced2..a308018 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1703,13 +1703,13 @@ function changeMIMEType(db, table, reference, mime_type)
*/
$(document).ready(function(){
var $oldText,$db,$table,$token,$sql_query;
- $oldText=$(".syntax").html();
+ $oldText=$(".inner_sql").html();
$("#inline_edit").click(function(){
$db=$("input[name='db']").val();
$table=$("input[name='table']").val();
$token=$("input[name='token']").val();
$sql_query=$("input[name='sql_query']").val();
- $(".syntax").replaceWith("<textarea
name=\"sql_query_edit\" id=\"sql_query_edit\">"+ $sql_query
+"</textarea><input type=\"button\" id=\"btnSave\"
value=\"" + PMA_messages['strGo'] + "\"><input
type=\"button\" id=\"btnDiscard\" value=\"" +
PMA_messages['strCancel'] + "\">");
+ $(".inner_sql").replaceWith("<textarea
name=\"sql_query_edit\" id=\"sql_query_edit\">"+ $sql_query
+"</textarea><input type=\"button\" id=\"btnSave\"
value=\"" + PMA_messages['strGo'] + "\"><input
type=\"button\" id=\"btnDiscard\" value=\"" +
PMA_messages['strCancel'] + "\">");
return false;
});
@@ -1718,7 +1718,7 @@ $(document).ready(function(){
});
$("#btnDiscard").live("click",function(){
- $(".sql").html("<span
class=\"syntax\">"+$oldText+"</span>");
+ $(".sql").html("<span class=\"syntax\"><span
class=\"inner_sql\">"+$oldText+"</span></span>");
});
$('.sqlbutton').click(function(evt){
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index d7333c7..6591715 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -320,7 +320,7 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '')
switch ($cfg['SQP']['fmtType']) {
case 'none':
if ($unparsed_sql != '') {
- $formatted_sql = "<pre>\n" .
PMA_SQP_formatNone(array('raw' => $unparsed_sql)) .
"\n</pre>";
+ $formatted_sql = '<span
class="inner_sql"><pre>' . "\n" .
PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n" .
'</pre></span>';
} else {
$formatted_sql = PMA_SQP_formatNone($parsed_sql);
}
diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php
index 136612f..bb103aa 100644
--- a/libraries/sqlparser.lib.php
+++ b/libraries/sqlparser.lib.php
@@ -2092,6 +2092,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$docu = TRUE;
break;
} // end switch
+ // inner_sql is a span that exists for all cases
+ // of $cfg['SQP']['fmtType'] to make possible a replacement
+ // for inline editing
+ $str .= '<span class="inner_sql">';
$close_docu_link = false;
$indent = 0;
$bracketlevel = 0;
@@ -2578,7 +2582,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$str .= '</a>';
$close_docu_link = false;
}
+ // close inner_sql span
+ $str .= '</span>';
if ($mode=='color') {
+ // close syntax span
$str .= '</span>';
}
hooks/post-receive
--
phpMyAdmin
Show replies by date