1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 09:34:10 +02:00

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:
Jakub Vrana
2012-06-29 18:38:24 -07:00
parent a833468c0a
commit a71b99096c
6 changed files with 6 additions and 28 deletions

View File

@@ -14,11 +14,7 @@ if (!$error && $_POST["clear"]) {
redirect(remove_from_uri("history"));
}
$codemirror_path = "../externals/CodeMirror2";
$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'>");
page_header(lang('SQL command'), $error);
if (!$error && $_POST) {
$fp = false;
@@ -109,7 +105,6 @@ if (!$error && $_POST) {
if ($connection->error) {
echo ($_POST["only_errors"] ? $print : "");
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>";
if ($_POST["error_stops"]) {
break 2;
@@ -180,8 +175,8 @@ if ($_POST) {
} elseif ($_GET["history"] != "") {
$q = $history[$_GET["history"]][0];
}
textarea("query", $q, 20, 80, "query");
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementById('query').focus();</script>\n");
textarea("query", $q, 20);
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n");
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;"') . '> (&lt; ' . 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.')
@@ -219,12 +214,3 @@ if ($history) {
?>
</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>