Remove CodeMirror
- uses other colors than JUSH - not used everywhere (triggers, routines, ...) - Ctrl+Left and similar works bad - missing autocomplete - blocking loader
This commit is contained in:
parent
a833468c0a
commit
a71b99096c
|
@ -4,10 +4,9 @@
|
||||||
* @param string
|
* @param string
|
||||||
* @param mixed array("key" => "link=desc", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
|
* @param mixed array("key" => "link=desc", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
|
||||||
* @param string used after colon in title and heading, will be HTML escaped
|
* @param string used after colon in title and heading, will be HTML escaped
|
||||||
* @param string printed in <head>
|
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "", $head = "") {
|
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
global $LANG, $adminer, $connection, $drivers;
|
global $LANG, $adminer, $connection, $drivers;
|
||||||
header("Content-Type: text/html; charset=utf-8");
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
if ($adminer->headers()) {
|
if ($adminer->headers()) {
|
||||||
|
@ -32,7 +31,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "", $
|
||||||
<link rel="stylesheet" type="text/css" href="adminer.css">
|
<link rel="stylesheet" type="text/css" href="adminer.css">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php echo $head; ?>
|
|
||||||
|
|
||||||
<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
|
<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -113,11 +113,10 @@ function referencable_primary($self) {
|
||||||
* @param int
|
* @param int
|
||||||
* @param int
|
* @param int
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function textarea($name, $value, $rows = 10, $cols = 80, $id = "") {
|
function textarea($name, $value, $rows = 10, $cols = 80) {
|
||||||
echo "<textarea name='$name'" . ($id ? " id='$id'" : "") . " rows='$rows' cols='$cols' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
|
echo "<textarea name='$name' rows='$rows' cols='$cols' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $val) { // not implode() to save memory
|
foreach ($value as $val) { // not implode() to save memory
|
||||||
echo h($val[0]) . "\n\n\n"; // $val == array($query, $time)
|
echo h($val[0]) . "\n\n\n"; // $val == array($query, $time)
|
||||||
|
|
|
@ -14,11 +14,7 @@ if (!$error && $_POST["clear"]) {
|
||||||
redirect(remove_from_uri("history"));
|
redirect(remove_from_uri("history"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$codemirror_path = "../externals/CodeMirror2";
|
page_header(lang('SQL command'), $error);
|
||||||
$codemirror_mode = ($jush == "sql" ? "mysql" : "plsql");
|
|
||||||
$error_lines = array();
|
|
||||||
|
|
||||||
page_header(lang('SQL command'), $error, array(), "", "<link rel='stylesheet' href='$codemirror_path/lib/codemirror.css'>");
|
|
||||||
|
|
||||||
if (!$error && $_POST) {
|
if (!$error && $_POST) {
|
||||||
$fp = false;
|
$fp = false;
|
||||||
|
@ -109,7 +105,6 @@ if (!$error && $_POST) {
|
||||||
if ($connection->error) {
|
if ($connection->error) {
|
||||||
echo ($_POST["only_errors"] ? $print : "");
|
echo ($_POST["only_errors"] ? $print : "");
|
||||||
echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n";
|
echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n";
|
||||||
$error_lines[] = $line + (function_exists('error_line') ? error_line() : 0);
|
|
||||||
$errors[] = " <a href='#sql-$commands'>$commands</a>";
|
$errors[] = " <a href='#sql-$commands'>$commands</a>";
|
||||||
if ($_POST["error_stops"]) {
|
if ($_POST["error_stops"]) {
|
||||||
break 2;
|
break 2;
|
||||||
|
@ -180,8 +175,8 @@ if ($_POST) {
|
||||||
} elseif ($_GET["history"] != "") {
|
} elseif ($_GET["history"] != "") {
|
||||||
$q = $history[$_GET["history"]][0];
|
$q = $history[$_GET["history"]][0];
|
||||||
}
|
}
|
||||||
textarea("query", $q, 20, 80, "query");
|
textarea("query", $q, 20);
|
||||||
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementById('query').focus();</script>\n");
|
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n");
|
||||||
echo "<p>" . (ini_bool("file_uploads")
|
echo "<p>" . (ini_bool("file_uploads")
|
||||||
? lang('File upload') . ': <input type="file" name="sql_file"' . ($_FILES && $_FILES["sql_file"]["error"] != 4 ? '' : ' onchange="this.form[\'only_errors\'].checked = true;"') . '> (< ' . ini_get("upload_max_filesize") . 'B)' // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
|
? lang('File upload') . ': <input type="file" name="sql_file"' . ($_FILES && $_FILES["sql_file"]["error"] != 4 ? '' : ' onchange="this.form[\'only_errors\'].checked = true;"') . '> (< ' . ini_get("upload_max_filesize") . 'B)' // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
|
||||||
: lang('File uploads are disabled.')
|
: lang('File uploads are disabled.')
|
||||||
|
@ -219,12 +214,3 @@ if ($history) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="<?php echo $codemirror_path; ?>/lib/codemirror.js"></script>
|
|
||||||
<script src="<?php echo "$codemirror_path/mode/$codemirror_mode/$codemirror_mode.js"; ?>"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
if (window.CodeMirror) {
|
|
||||||
var codeMirror = CodeMirror.fromTextArea(document.getElementById('query'), { mode: 'text/x-<?php echo $codemirror_mode; ?>' });
|
|
||||||
<?php foreach ($error_lines as $line) { ?>codeMirror.setLineClass(<?php echo $line; ?>, '', 'error');<?php } ?>
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -60,9 +60,6 @@ input[type=image] { vertical-align: middle; }
|
||||||
.rtl #breadcrumb { left: auto; right: 21em; margin: 0 -18px 0 0; }
|
.rtl #breadcrumb { left: auto; right: 21em; margin: 0 -18px 0 0; }
|
||||||
.rtl #lang, .rtl #menu { left: auto; right: 0; }
|
.rtl #lang, .rtl #menu { left: auto; right: 0; }
|
||||||
|
|
||||||
.CodeMirror { border: 1px inset #777; }
|
|
||||||
.CodeMirror .error { background: #fee; }
|
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
#lang, #menu { display: none; }
|
#lang, #menu { display: none; }
|
||||||
#content { margin-left: 1em; }
|
#content { margin-left: 1em; }
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Adminer 3.4.0-dev:
|
Adminer 3.4.0-dev:
|
||||||
Highlight code in SQL command by CodeMirror
|
|
||||||
Link to descending order
|
Link to descending order
|
||||||
Shift+click on checkbox to select consecutive rows
|
Shift+click on checkbox to select consecutive rows
|
||||||
Print current time next to executed SQL queries
|
Print current time next to executed SQL queries
|
||||||
|
|
|
@ -295,7 +295,6 @@ foreach (array("adminer", "editor") as $project) {
|
||||||
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
||||||
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
||||||
$file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
|
$file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
|
||||||
$file = str_replace('"../externals/CodeMirror2"', '($_SERVER["HTTPS"] ? "https" : "http") . "://www.adminer.org/static/CodeMirror2"', $file);
|
|
||||||
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
|
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
|
||||||
$file = php_shrink($file);
|
$file = php_shrink($file);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue