Patch #705899 from Alexis Soulard
This commit is contained in:
@@ -6,6 +6,9 @@ $Id$
|
|||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
2003-04-06 Garvin Hicking <me@supergarv.de>
|
2003-04-06 Garvin Hicking <me@supergarv.de>
|
||||||
|
* tbl_query_box.php, libraries/functions.js: Patch #705899 included.
|
||||||
|
Now multiple fields can be inserted at cursor position (Mozilla/IE)
|
||||||
|
in the sql query textarea. Thanks to Alexis Soulard (alexis_soulard)
|
||||||
* header.inc.php3, footer.inc.php3, libraries/common.lib.php3,
|
* header.inc.php3, footer.inc.php3, libraries/common.lib.php3,
|
||||||
libraries/relation.lib.php3: RFE #715914: Sort query history by
|
libraries/relation.lib.php3: RFE #715914: Sort query history by
|
||||||
(autoincrement) key instead of timevalue. Only save queries in
|
(autoincrement) key instead of timevalue. Only save queries in
|
||||||
|
@@ -636,9 +636,49 @@ function onKeyDownArrowsHandler(e) {
|
|||||||
e.returnValue = false;
|
e.returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts multiple fields.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function insertValueQuery() {
|
||||||
|
var myQuery = document.sqlform.sql_query;
|
||||||
|
var myListBox = document.sqlform.dummy;
|
||||||
|
|
||||||
|
if(myListBox.options.length > 0) {
|
||||||
|
var chaineAj = "";
|
||||||
|
var NbSelect = 0;
|
||||||
|
for(var i=0; i<myListBox.options.length; i++) {
|
||||||
|
if (myListBox.options[i].selected){
|
||||||
|
NbSelect++;
|
||||||
|
if (NbSelect > 1)
|
||||||
|
chaineAj += ", ";
|
||||||
|
chaineAj += myListBox.options[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//IE support
|
||||||
|
if (document.selection) {
|
||||||
|
myQuery.focus();
|
||||||
|
sel = document.selection.createRange();
|
||||||
|
sel.text = chaineAj;
|
||||||
|
document.sqlform.insert.focus();
|
||||||
|
}
|
||||||
|
//MOZILLA/NETSCAPE support
|
||||||
|
else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart == "0") {
|
||||||
|
var startPos = document.sqlform.sql_query.selectionStart;
|
||||||
|
var endPos = document.sqlform.sql_query.selectionEnd;
|
||||||
|
var chaineSql = document.sqlform.sql_query.value;
|
||||||
|
|
||||||
|
myQuery.value = chaineSql.substring(0, startPos) + chaineAj + chaineSql.substring(endPos, chaineSql.length);
|
||||||
|
} else {
|
||||||
|
myQuery.value += chaineAj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* listbox redirection
|
* listbox redirection
|
||||||
*/
|
*/
|
||||||
function goToUrl(selObj, goToLocation){
|
function goToUrl(selObj, goToLocation){
|
||||||
eval("document.location.href = '" + goToLocation + "pos=" + selObj.options[selObj.selectedIndex].value + "'");
|
eval("document.location.href = '" + goToLocation + "pos=" + selObj.options[selObj.selectedIndex].value + "'");
|
||||||
}
|
}
|
||||||
|
@@ -86,35 +86,38 @@ if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$d
|
|||||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||||
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
||||||
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
|
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!isset($is_inside_querywindow) ||
|
if (!isset($is_inside_querywindow) ||
|
||||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
|
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
|
||||||
?>
|
?>
|
||||||
<!-- Query box and bookmark support -->
|
<!-- Query box and bookmark support -->
|
||||||
<li>
|
<a name="querybox"></a>
|
||||||
<a name="querybox"></a>
|
<table cellpadding="1" cellspacing="1">
|
||||||
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . $queryframe_db_list . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?>
|
<tr>
|
||||||
<?php if (isset($table) && $fields_cnt > 0) { ?>
|
<td>
|
||||||
<?php echo $strFields; ?>:
|
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . $queryframe_db_list . (isset($is_inside_querywindow) ? '<br />' : ' ') . PMA_showMySQLDocu('Reference', 'SELECT'); ?>
|
||||||
<select name="dummy" size="1">
|
<br />
|
||||||
<?php
|
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? ceil($cfg['TextareaCols'] * 1.25) : $cfg['TextareaCols'] * 2); ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
|
||||||
echo "\n";
|
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . htmlspecialchars(PMA_backquote($table)) . ' WHERE 1'); ?></textarea>
|
||||||
for ($i = 0 ; $i < $fields_cnt; $i++) {
|
</td>
|
||||||
echo ' '
|
<?php if (isset($table) && $fields_cnt > 0) { ?>
|
||||||
. '<option value="' . PMA_backquote(htmlspecialchars($fields_list[$i])) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
|
<td align="center" valign="top"><?php echo (isset($is_inside_querywindow) ? '<br />' : '') . $strFields; ?>:<br />
|
||||||
}
|
<select name="dummy" size="4" multiple>
|
||||||
?>
|
<?php
|
||||||
</select>
|
echo "\n";
|
||||||
<input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
|
for ($i = 0 ; $i < $fields_cnt; $i++) {
|
||||||
<?php
|
echo ' '
|
||||||
}
|
. '<option value="' . PMA_backquote(htmlspecialchars($fields_list[$i])) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
|
||||||
?>
|
}
|
||||||
<br />
|
?>
|
||||||
<div style="margin-bottom: 5px">
|
</select><br /><br />
|
||||||
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? ceil($cfg['TextareaCols'] * 1.25) : $cfg['TextareaCols'] * 2); ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
|
<input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="insertValueQuery()" />
|
||||||
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . htmlspecialchars(PMA_backquote($table)) . ' WHERE 1'); ?>
|
</td>
|
||||||
</textarea><br />
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />
|
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />
|
||||||
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
|
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
|
||||||
</div>
|
</div>
|
||||||
@@ -245,7 +248,6 @@ if (!isset($is_inside_querywindow) ||
|
|||||||
if (!isset($is_inside_querywindow) || (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'sql' || $querydisplay_tab == 'full' || ($querydisplay_tab == 'history' && $bookmark_go)))) {
|
if (!isset($is_inside_querywindow) || (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'sql' || $querydisplay_tab == 'full' || ($querydisplay_tab == 'history' && $bookmark_go)))) {
|
||||||
?>
|
?>
|
||||||
<input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
|
<input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
|
||||||
</li>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user