From f0d97a7c7f3587360e20c392505aec2d3e2800f2 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 11 Aug 2012 20:21:03 -0700 Subject: [PATCH] Edit strings with \n in textarea --- adminer/include/functions.inc.php | 10 ++++++++-- adminer/static/functions.js | 1 + changes.txt | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 9e47557d..97d011eb 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -719,8 +719,14 @@ function input($field, $value, $function) { } } elseif (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) { echo ""; - } elseif (ereg('text|lob', $field["type"])) { - echo "'; // 1.2em - line-height + } elseif (($text = ereg('text|lob', $field["type"])) || ereg("\n", $value)) { + if ($text && $jush != "sqlite") { + $attrs .= " cols='50' rows='12'"; + } else { + $rows = min(12, substr_count($value, "\n") + 1); + $attrs .= " cols='30' rows='$rows'" . ($rows == 1 ? " style='height: 1.2em;'" : ""); // 1.2em - line-height + } + echo "" . h($value) . ''; } else { // int(3) is only a display hint $maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)); diff --git a/adminer/static/functions.js b/adminer/static/functions.js index ebf9077d..b731c97d 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -391,6 +391,7 @@ function selectDblClick(td, event, text) { return; } var original = td.innerHTML; + text = text || /\n/.test(original); var input = document.createElement(text ? 'textarea' : 'input'); input.onkeydown = function (event) { if (!event) { diff --git a/changes.txt b/changes.txt index c75bd09b..cf7a5976 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ Adminer 3.5.2-dev: +Edit strings with \n in textarea Style logout button as link Adminer 3.5.1 (released 2012-08-10):