mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Load long texts for inline-edit by AJAX
Display link to current page only under AJAX
This commit is contained in:
@@ -107,7 +107,7 @@ if ($update) {
|
|||||||
echo "<input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . "')" . (isset($_GET["select"]) ? " && !ajaxForm(this.form, 'delete=1')" : "") . ";\">\n";
|
echo "<input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . "')" . (isset($_GET["select"]) ? " && !ajaxForm(this.form, 'delete=1')" : "") . ";\">\n";
|
||||||
}
|
}
|
||||||
if (isset($_GET["select"])) {
|
if (isset($_GET["select"])) {
|
||||||
echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "' onclick='return !ajax(this.href);'>" . lang('Cancel') . "</a>\n";
|
echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "' onclick='return !ajaxMain(this.href);'>" . lang('Cancel') . "</a>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
@@ -130,7 +130,7 @@ document.getElementById('username').focus();
|
|||||||
*/
|
*/
|
||||||
function selectQuery($query) {
|
function selectQuery($query) {
|
||||||
global $jush;
|
global $jush;
|
||||||
return "<p><a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a> <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
|
return "<p><a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" . (is_ajax() ? " <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>" : "") . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Description of a row in a table
|
/** Description of a row in a table
|
||||||
|
@@ -10,7 +10,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||||||
global $LANG, $HTTPS, $adminer, $connection, $drivers;
|
global $LANG, $HTTPS, $adminer, $connection, $drivers;
|
||||||
header("Content-Type: text/html; charset=utf-8");
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
$adminer->headers();
|
$adminer->headers();
|
||||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
if (!is_ajax()) {
|
||||||
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
||||||
$protocol = ($HTTPS ? "https" : "http");
|
$protocol = ($HTTPS ? "https" : "http");
|
||||||
?>
|
?>
|
||||||
@@ -81,7 +81,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||||||
*/
|
*/
|
||||||
function page_footer($missing = "") {
|
function page_footer($missing = "") {
|
||||||
global $adminer;
|
global $adminer;
|
||||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
if (!is_ajax()) {
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -335,6 +335,13 @@ function auth_url($driver, $server, $username) {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Find whether it is an AJAX request
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function is_ajax() {
|
||||||
|
return ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest");
|
||||||
|
}
|
||||||
|
|
||||||
/** Send Location header and exit
|
/** Send Location header and exit
|
||||||
* @param string null to only set a message
|
* @param string null to only set a message
|
||||||
* @param string
|
* @param string
|
||||||
@@ -346,7 +353,7 @@ function redirect($location, $message = null) {
|
|||||||
$_SESSION["messages"][] = $message;
|
$_SESSION["messages"][] = $message;
|
||||||
}
|
}
|
||||||
if (isset($location)) {
|
if (isset($location)) {
|
||||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
if (!is_ajax()) {
|
||||||
header("Location: " . ($location != "" ? $location : "."));
|
header("Location: " . ($location != "" ? $location : "."));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@@ -235,7 +235,6 @@ $translations = array(
|
|||||||
'Databases have been dropped.' => 'S\'han suprimit les bases de dades.',
|
'Databases have been dropped.' => 'S\'han suprimit les bases de dades.',
|
||||||
'File exists.' => 'El fitxer ja existeix.',
|
'File exists.' => 'El fitxer ja existeix.',
|
||||||
'Double click on a value to modify it.' => 'Fes un doble clic a un valor per modificar-lo.',
|
'Double click on a value to modify it.' => 'Fes un doble clic a un valor per modificar-lo.',
|
||||||
'Increase Text length to modify this value.' => 'Incrementa la Longitud del text per modificar aquest valor.',
|
|
||||||
'Use edit link to modify this value.' => 'Utilitza l\'enllaç d\'edició per modificar aquest valor.',
|
'Use edit link to modify this value.' => 'Utilitza l\'enllaç d\'edició per modificar aquest valor.',
|
||||||
'Alter schema' => 'Modifica l\'esquema',
|
'Alter schema' => 'Modifica l\'esquema',
|
||||||
'Create schema' => 'Crea un esquema',
|
'Create schema' => 'Crea un esquema',
|
||||||
|
@@ -251,7 +251,6 @@ $translations = array(
|
|||||||
|
|
||||||
// selects now support in-place editing
|
// selects now support in-place editing
|
||||||
'Double click on a value to modify it.' => 'Dvojklikněte na políčko, které chcete změnit.',
|
'Double click on a value to modify it.' => 'Dvojklikněte na políčko, které chcete změnit.',
|
||||||
'Increase Text length to modify this value.' => 'Ke změně této hodnoty zvyšte Délku textů.',
|
|
||||||
'Use edit link to modify this value.' => 'Ke změně této hodnoty použijte odkaz upravit.',
|
'Use edit link to modify this value.' => 'Ke změně této hodnoty použijte odkaz upravit.',
|
||||||
|
|
||||||
// PostgreSQL and MS SQL schema support
|
// PostgreSQL and MS SQL schema support
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Typ gelöscht.',
|
'Type has been dropped.' => 'Typ gelöscht.',
|
||||||
'Type has been created.' => 'Typ erstellt.',
|
'Type has been created.' => 'Typ erstellt.',
|
||||||
'Double click on a value to modify it.' => 'Doppelklick zum Bearbeiten des Wertes.',
|
'Double click on a value to modify it.' => 'Doppelklick zum Bearbeiten des Wertes.',
|
||||||
'Increase Text length to modify this value.' => 'Vergrössern Sie die Textlänge um den Wert ändern zu können.',
|
|
||||||
'Use edit link to modify this value.' => 'Benutzen Sie den Link zum editieren dieses Wertes.',
|
'Use edit link to modify this value.' => 'Benutzen Sie den Link zum editieren dieses Wertes.',
|
||||||
'last' => 'letzte',
|
'last' => 'letzte',
|
||||||
'From server' => 'Auf Server',
|
'From server' => 'Auf Server',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Tipo eliminado.',
|
'Type has been dropped.' => 'Tipo eliminado.',
|
||||||
'Type has been created.' => 'Tipo creado.',
|
'Type has been created.' => 'Tipo creado.',
|
||||||
'Double click on a value to modify it.' => 'Doble-clic sobre el valor para editarlo.',
|
'Double click on a value to modify it.' => 'Doble-clic sobre el valor para editarlo.',
|
||||||
'Increase Text length to modify this value.' => 'Aumente el tamaño del campo de texto para modificar este valor.',
|
|
||||||
'Use edit link to modify this value.' => 'Utilice el enlace de modificar para realizar los cambios.',
|
'Use edit link to modify this value.' => 'Utilice el enlace de modificar para realizar los cambios.',
|
||||||
'last' => 'último',
|
'last' => 'último',
|
||||||
'From server' => 'Desde servidor',
|
'From server' => 'Desde servidor',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Tüüp on edukalt kustutatud.',
|
'Type has been dropped.' => 'Tüüp on edukalt kustutatud.',
|
||||||
'Type has been created.' => 'Tüüp on edukalt loodud.',
|
'Type has been created.' => 'Tüüp on edukalt loodud.',
|
||||||
'Double click on a value to modify it.' => 'Väärtuse muutmiseks topelt-kliki sellel.',
|
'Double click on a value to modify it.' => 'Väärtuse muutmiseks topelt-kliki sellel.',
|
||||||
'Increase Text length to modify this value.' => 'Väärtuse muutmiseks suurenda Tekstiveeru pikkust.',
|
|
||||||
'Use edit link to modify this value.' => 'Väärtuse muutmiseks kasuta muutmislinki.',
|
'Use edit link to modify this value.' => 'Väärtuse muutmiseks kasuta muutmislinki.',
|
||||||
'last' => 'viimane',
|
'last' => 'viimane',
|
||||||
'From server' => 'Serverist',
|
'From server' => 'Serverist',
|
||||||
|
@@ -245,7 +245,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Le type a été supprimé.',
|
'Type has been dropped.' => 'Le type a été supprimé.',
|
||||||
'Type has been created.' => 'Le type a été créé.',
|
'Type has been created.' => 'Le type a été créé.',
|
||||||
'Double click on a value to modify it.' => 'Double-cliquez sur une valeur pour la modifier.',
|
'Double click on a value to modify it.' => 'Double-cliquez sur une valeur pour la modifier.',
|
||||||
'Increase Text length to modify this value.' => 'Augmentez la Longueur de texte affiché pour modifier cette valeur.',
|
|
||||||
'Use edit link to modify this value.' => 'Utilisez le lien "modifier" pour modifier cette valeur.',
|
'Use edit link to modify this value.' => 'Utilisez le lien "modifier" pour modifier cette valeur.',
|
||||||
'last' => 'dernière',
|
'last' => 'dernière',
|
||||||
'From server' => 'Depuis le serveur',
|
'From server' => 'Depuis le serveur',
|
||||||
|
@@ -235,7 +235,6 @@ $translations = array(
|
|||||||
'Databases have been dropped.' => 'Adatbázis eldobva.',
|
'Databases have been dropped.' => 'Adatbázis eldobva.',
|
||||||
'File exists.' => 'A fájl létezik.',
|
'File exists.' => 'A fájl létezik.',
|
||||||
'Double click on a value to modify it.' => 'Kattints kétszer az értékre a szerkesztéshez.',
|
'Double click on a value to modify it.' => 'Kattints kétszer az értékre a szerkesztéshez.',
|
||||||
'Increase Text length to modify this value.' => 'Növeld a Szöveg hosszát, hogy módosítani tudd ezt az értéket.',
|
|
||||||
'Use edit link to modify this value.' => 'Használd a szerkesztés hivatkozást ezen érték módosításához.',
|
'Use edit link to modify this value.' => 'Használd a szerkesztés hivatkozást ezen érték módosításához.',
|
||||||
'Alter schema' => 'Séma módosítása',
|
'Alter schema' => 'Séma módosítása',
|
||||||
'Create schema' => 'Séma létrehozása',
|
'Create schema' => 'Séma létrehozása',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Tipo definito dall\'utente eliminato.',
|
'Type has been dropped.' => 'Tipo definito dall\'utente eliminato.',
|
||||||
'Type has been created.' => 'Tipo definito dall\'utente creato.',
|
'Type has been created.' => 'Tipo definito dall\'utente creato.',
|
||||||
'Double click on a value to modify it.' => 'Fai doppio click su un valore per modificarlo.',
|
'Double click on a value to modify it.' => 'Fai doppio click su un valore per modificarlo.',
|
||||||
'Increase Text length to modify this value.' => 'Aumenta la Lunghezza del testo per modificare questo valore.',
|
|
||||||
'Use edit link to modify this value.' => 'Usa il link modifica per modificare questo valore.',
|
'Use edit link to modify this value.' => 'Usa il link modifica per modificare questo valore.',
|
||||||
'last' => 'ultima',
|
'last' => 'ultima',
|
||||||
'From server' => 'Dal server',
|
'From server' => 'Dal server',
|
||||||
|
@@ -247,7 +247,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'ユーザー定義型を削除しました',
|
'Type has been dropped.' => 'ユーザー定義型を削除しました',
|
||||||
'Type has been created.' => 'ユーザー定義型を追加しました',
|
'Type has been created.' => 'ユーザー定義型を追加しました',
|
||||||
'Double click on a value to modify it.' => 'ダブルクリックして編集',
|
'Double click on a value to modify it.' => 'ダブルクリックして編集',
|
||||||
'Increase Text length to modify this value.' => '編集枠を広げる',
|
|
||||||
'Use edit link to modify this value.' => 'リンクを編集する',
|
'Use edit link to modify this value.' => 'リンクを編集する',
|
||||||
'last' => '最終',
|
'last' => '最終',
|
||||||
'From server' => 'サーバーから実行',
|
'From server' => 'サーバーから実行',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Type verwijderd.',
|
'Type has been dropped.' => 'Type verwijderd.',
|
||||||
'Type has been created.' => 'Type aangemaakt.',
|
'Type has been created.' => 'Type aangemaakt.',
|
||||||
'Double click on a value to modify it.' => 'Dubbelklik op een waarde om deze te bewerken.',
|
'Double click on a value to modify it.' => 'Dubbelklik op een waarde om deze te bewerken.',
|
||||||
'Increase Text length to modify this value.' => 'Verhoog de lengte om deze waarde te bewerken.',
|
|
||||||
'Use edit link to modify this value.' => 'Gebruik de link "bewerk" om deze waarde te wijzigen.',
|
'Use edit link to modify this value.' => 'Gebruik de link "bewerk" om deze waarde te wijzigen.',
|
||||||
'last' => 'laatste',
|
'last' => 'laatste',
|
||||||
'From server' => 'Van server',
|
'From server' => 'Van server',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => 'Тип удален.',
|
'Type has been dropped.' => 'Тип удален.',
|
||||||
'Type has been created.' => 'Создан новый тип.',
|
'Type has been created.' => 'Создан новый тип.',
|
||||||
'Double click on a value to modify it.' => 'Кликни два раза по значению, чтобы его изменить.',
|
'Double click on a value to modify it.' => 'Кликни два раза по значению, чтобы его изменить.',
|
||||||
'Increase Text length to modify this value.' => 'Увеличь Длину текста, чтобы изменить это значение.',
|
|
||||||
'Use edit link to modify this value.' => 'Изменить это значение можно с помощью ссылки «изменить».',
|
'Use edit link to modify this value.' => 'Изменить это значение можно с помощью ссылки «изменить».',
|
||||||
'last' => 'последняя',
|
'last' => 'последняя',
|
||||||
'From server' => 'С сервера',
|
'From server' => 'С сервера',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been created.' => 'Typ bol vytvorený.',
|
'Type has been created.' => 'Typ bol vytvorený.',
|
||||||
'Alter type' => 'Pozmeniť typ',
|
'Alter type' => 'Pozmeniť typ',
|
||||||
'Double click on a value to modify it.' => 'Dvojkliknite na políčko, ktoré chcete zmeniť.',
|
'Double click on a value to modify it.' => 'Dvojkliknite na políčko, ktoré chcete zmeniť.',
|
||||||
'Increase Text length to modify this value.' => 'Pre zmenu tejto hodnoty zvýšte Dĺžku textov.',
|
|
||||||
'Use edit link to modify this value.' => 'Pre zmenu tejto hodnoty použite odkaz upraviť.',
|
'Use edit link to modify this value.' => 'Pre zmenu tejto hodnoty použite odkaz upraviť.',
|
||||||
'last' => 'posledný',
|
'last' => 'posledný',
|
||||||
'From server' => 'Zo serveru',
|
'From server' => 'Zo serveru',
|
||||||
|
@@ -236,7 +236,6 @@ $translations = array(
|
|||||||
'Schema has been created.' => 'அமைப்புமுறை உருவாக்கப்பட்டது.',
|
'Schema has been created.' => 'அமைப்புமுறை உருவாக்கப்பட்டது.',
|
||||||
'Schema has been altered.' => 'அமைப்புமுறை மாற்றப்பட்டது.',
|
'Schema has been altered.' => 'அமைப்புமுறை மாற்றப்பட்டது.',
|
||||||
'Double click on a value to modify it.' => 'மதிப்பினை மாற்ற அதன் மீது இருமுறை சொடுக்கவும் (Double click).',
|
'Double click on a value to modify it.' => 'மதிப்பினை மாற்ற அதன் மீது இருமுறை சொடுக்கவும் (Double click).',
|
||||||
'Increase Text length to modify this value.' => 'இந்த மதிப்பினை மாற்ற, டெக்ஸ்ட் நீளத்தினை அதிகரிக்கவும்.',
|
|
||||||
'Use edit link to modify this value.' => 'இந்த மதிப்பினை மாற்ற, தொகுப்பு இணைப்பினை உபயோகிக்கவும்.',
|
'Use edit link to modify this value.' => 'இந்த மதிப்பினை மாற்ற, தொகுப்பு இணைப்பினை உபயோகிக்கவும்.',
|
||||||
'last' => 'கடைசி',
|
'last' => 'கடைசி',
|
||||||
'Sequence has been dropped.' => 'வரிசைமுறை நீக்கப்பட்டது.',
|
'Sequence has been dropped.' => 'வரிசைமுறை நீக்கப்பட்டது.',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => '已刪除類型。',
|
'Type has been dropped.' => '已刪除類型。',
|
||||||
'Type has been created.' => '已建立類型。',
|
'Type has been created.' => '已建立類型。',
|
||||||
'Double click on a value to modify it.' => '雙擊以進行修改。',
|
'Double click on a value to modify it.' => '雙擊以進行修改。',
|
||||||
'Increase Text length to modify this value.' => '增加字串長度來修改。',
|
|
||||||
'Use edit link to modify this value.' => '使用編輯連結來修改。',
|
'Use edit link to modify this value.' => '使用編輯連結來修改。',
|
||||||
'last' => '最後一頁',
|
'last' => '最後一頁',
|
||||||
'From server' => '從伺服器',
|
'From server' => '從伺服器',
|
||||||
|
@@ -246,7 +246,6 @@ $translations = array(
|
|||||||
'Type has been dropped.' => '已丢弃类型。',
|
'Type has been dropped.' => '已丢弃类型。',
|
||||||
'Type has been created.' => '已创建类型。',
|
'Type has been created.' => '已创建类型。',
|
||||||
'Double click on a value to modify it.' => '在值上双击类修改它。',
|
'Double click on a value to modify it.' => '在值上双击类修改它。',
|
||||||
'Increase Text length to modify this value.' => '增加文本长度以修改该值。',
|
|
||||||
'Use edit link to modify this value.' => '使用编辑链接来修改该值。',
|
'Use edit link to modify this value.' => '使用编辑链接来修改该值。',
|
||||||
'last' => '最后',
|
'last' => '最后',
|
||||||
'From server' => '来自服务器',
|
'From server' => '来自服务器',
|
||||||
|
@@ -26,6 +26,14 @@ $limit = $adminer->selectLimitProcess();
|
|||||||
$from = ($select ? implode(", ", $select) : "*") . "\nFROM " . table($TABLE);
|
$from = ($select ? implode(", ", $select) : "*") . "\nFROM " . table($TABLE);
|
||||||
$group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
|
$group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
|
||||||
|
|
||||||
|
if ($_GET["val"] && is_ajax()) {
|
||||||
|
header("Content-Type: text/plain; charset=utf-8");
|
||||||
|
foreach ($_GET["val"] as $unique_idf => $row) {
|
||||||
|
echo $connection->result("SELECT" . limit(idf_escape(key($row)) . " FROM " . table($TABLE), " WHERE " . where_check($unique_idf) . ($where ? " AND " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : ""), 1));
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if ($_POST && !$error) {
|
if ($_POST && !$error) {
|
||||||
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
|
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
|
||||||
$primary = $unselected = null;
|
$primary = $unselected = null;
|
||||||
@@ -254,7 +262,7 @@ if (!$columns) {
|
|||||||
if ($name != "") {
|
if ($name != "") {
|
||||||
$order++;
|
$order++;
|
||||||
$names[$key] = $name;
|
$names[$key] = $name;
|
||||||
echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] == $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '" onclick="return !ajax(this.href);">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
|
echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] == $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '" onclick="return !ajaxMain(this.href);">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
|
||||||
}
|
}
|
||||||
$functions[$key] = $val["fun"];
|
$functions[$key] = $val["fun"];
|
||||||
next($select);
|
next($select);
|
||||||
@@ -336,11 +344,11 @@ if (!$columns) {
|
|||||||
$value = $_POST["val"][$unique_idf][bracket_escape($key)];
|
$value = $_POST["val"][$unique_idf][bracket_escape($key)];
|
||||||
$h_value = h(isset($value) ? $value : $row[$key]);
|
$h_value = h(isset($value) ? $value : $row[$key]);
|
||||||
$long = strpos($val, "<i>...</i>");
|
$long = strpos($val, "<i>...</i>");
|
||||||
$editable = is_utf8($val) && !$long && $rows[$n][$key] == $row[$key] && !$functions[$key];
|
$editable = is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key];
|
||||||
$text = ereg('text|lob', $field["type"]);
|
$text = ereg('text|lob', $field["type"]);
|
||||||
echo (($_GET["modify"] && $editable) || isset($value)
|
echo (($_GET["modify"] && $editable) || isset($value)
|
||||||
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "' onkeydown='return textareaKeydown(this, event);'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
|
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "' onkeydown='return textareaKeydown(this, event);'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
|
||||||
: "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($text ? ", 1" : "") . ")" : "alert('" . h($long ? lang('Increase Text length to modify this value.') : lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
|
: "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($long ? ", 2" : ($text ? ", 1" : "")) . ")" : "alert('" . h(lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -163,36 +163,23 @@ function textareaKeydown(target, event, tab, button) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var ajaxState = 0;
|
|
||||||
var ajaxTimeout;
|
|
||||||
|
|
||||||
/** Create AJAX request
|
/** Create AJAX request
|
||||||
* @param string
|
* @param string
|
||||||
|
* @param function (text)
|
||||||
* @param [string]
|
* @param [string]
|
||||||
* @return XMLHttpRequest or false in case of an error
|
* @return XMLHttpRequest or false in case of an error
|
||||||
*/
|
*/
|
||||||
function ajax(url, data) {
|
function ajax(url, callback, data) {
|
||||||
var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
|
var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
|
||||||
if (xmlhttp) {
|
if (xmlhttp) {
|
||||||
var currentState = ++ajaxState;
|
xmlhttp.open((data === undefined ? 'GET' : 'POST'), url);
|
||||||
clearTimeout(ajaxTimeout);
|
if (data) {
|
||||||
ajaxTimeout = setTimeout(function () {
|
|
||||||
setHtml('main', '<img src="../adminer/static/loader.gif" alt="">');
|
|
||||||
}, 500); // defer displaying loader
|
|
||||||
var method = (data === undefined ? 'GET' : 'POST');
|
|
||||||
xmlhttp.open(method, url);
|
|
||||||
if (method == 'POST') {
|
|
||||||
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
}
|
}
|
||||||
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
xmlhttp.onreadystatechange = function () {
|
xmlhttp.onreadystatechange = function (text) {
|
||||||
if (xmlhttp.readyState == 4 && currentState == ajaxState) {
|
if (xmlhttp.readyState == 4) {
|
||||||
clearTimeout(ajaxTimeout);
|
callback(xmlhttp.responseText);
|
||||||
setHtml('main', xmlhttp.responseText);
|
|
||||||
if (window.jush) {
|
|
||||||
jush.highlight_tag('code');
|
|
||||||
jush.highlight_tag('pre', 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xmlhttp.send(data);
|
xmlhttp.send(data);
|
||||||
@@ -200,6 +187,32 @@ function ajax(url, data) {
|
|||||||
return xmlhttp;
|
return xmlhttp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ajaxState = 0;
|
||||||
|
var ajaxTimeout;
|
||||||
|
|
||||||
|
/** Load content to #main
|
||||||
|
* @param string
|
||||||
|
* @param [string]
|
||||||
|
* @return XMLHttpRequest or false in case of an error
|
||||||
|
*/
|
||||||
|
function ajaxMain(url, data) {
|
||||||
|
var currentState = ++ajaxState;
|
||||||
|
clearTimeout(ajaxTimeout);
|
||||||
|
ajaxTimeout = setTimeout(function () {
|
||||||
|
setHtml('main', '<img src="../adminer/static/loader.gif" alt="">');
|
||||||
|
}, 500); // defer displaying loader
|
||||||
|
return ajax(url, function (text) {
|
||||||
|
if (currentState == ajaxState) {
|
||||||
|
clearTimeout(ajaxTimeout);
|
||||||
|
setHtml('main', text);
|
||||||
|
if (window.jush) {
|
||||||
|
jush.highlight_tag('code');
|
||||||
|
jush.highlight_tag('pre', 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, data);
|
||||||
|
}
|
||||||
|
|
||||||
/** Send form by AJAX GET
|
/** Send form by AJAX GET
|
||||||
* @param HTMLFormElement
|
* @param HTMLFormElement
|
||||||
* @param [string]
|
* @param [string]
|
||||||
@@ -217,9 +230,9 @@ function ajaxForm(form, data) {
|
|||||||
params.push(data);
|
params.push(data);
|
||||||
}
|
}
|
||||||
if (form.method == 'post') {
|
if (form.method == 'post') {
|
||||||
return ajax(form.action || location.href, params.join('&'));
|
return ajaxMain(form.action || location.href, params.join('&'));
|
||||||
} else {
|
} else {
|
||||||
return ajax((form.action || location.pathname) + '?' + params.join('&'));
|
return ajaxMain((form.action || location.pathname) + '?' + params.join('&'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,14 +241,13 @@ function ajaxForm(form, data) {
|
|||||||
/** Display edit field
|
/** Display edit field
|
||||||
* @param HTMLElement
|
* @param HTMLElement
|
||||||
* @param MouseEvent
|
* @param MouseEvent
|
||||||
* @param boolean display textarea instead of input
|
* @param number display textarea instead of input, 2 - load long text
|
||||||
*/
|
*/
|
||||||
function selectDblClick(td, event, text) {
|
function selectDblClick(td, event, text) {
|
||||||
var pos = event.rangeOffset;
|
var pos = event.rangeOffset;
|
||||||
var value = (td.firstChild.firstChild ? td.firstChild.firstChild.data : (td.firstChild.alt ? td.firstChild.alt : td.firstChild.data));
|
var value = (td.firstChild.firstChild ? td.firstChild.firstChild.data : (td.firstChild.alt ? td.firstChild.alt : td.firstChild.data));
|
||||||
var input = document.createElement(text ? 'textarea' : 'input');
|
var input = document.createElement(text ? 'textarea' : 'input');
|
||||||
input.name = td.id;
|
input.name = td.id;
|
||||||
input.value = (value == '\u00A0' || td.getElementsByTagName('i').length ? '' : value); // or i - NULL
|
|
||||||
input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border)
|
input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border)
|
||||||
if (text) {
|
if (text) {
|
||||||
var rows = 1;
|
var rows = 1;
|
||||||
@@ -258,6 +270,12 @@ function selectDblClick(td, event, text) {
|
|||||||
td.innerHTML = '';
|
td.innerHTML = '';
|
||||||
td.appendChild(input);
|
td.appendChild(input);
|
||||||
input.focus();
|
input.focus();
|
||||||
|
if (text == 2) { // long text
|
||||||
|
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (text) {
|
||||||
|
input.value = text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
input.value = (value == '\u00A0' || td.getElementsByTagName('i').length ? '' : value); // or i - NULL
|
||||||
input.selectionStart = pos;
|
input.selectionStart = pos;
|
||||||
input.selectionEnd = pos;
|
input.selectionEnd = pos;
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
|
@@ -62,7 +62,9 @@ document.getElementById('username').focus();
|
|||||||
echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
|
echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
|
||||||
}
|
}
|
||||||
echo "<a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a>\n";
|
echo "<a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a>\n";
|
||||||
echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
|
if (is_ajax()) {
|
||||||
|
echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function backwardKeys($table, $tableName) {
|
function backwardKeys($table, $tableName) {
|
||||||
|
Reference in New Issue
Block a user