]> git.joonet.de Git - adminer.git/commitdiff
Clone row
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Sat, 27 Sep 2008 01:51:14 +0000 (01:51 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Sat, 27 Sep 2008 01:51:14 +0000 (01:51 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@501 7c3ca157-0c34-0410-bff1-cbf682f78f5c

edit.inc.php
index.php
lang/cs.inc.php
select.inc.php
todo.txt

index 3059bb8367c0380033306a89ec561e2fea933b49..053cb64c6b7b96d7fac3d77e0766ee713c4a3804 100644 (file)
@@ -2,12 +2,12 @@
 $where = where($_GET);
 $fields = fields($_GET["edit"]);
 foreach ($fields as $name => $field) {
-       if (isset($_GET["default"]) ? $field["auto_increment"] || preg_match('~text|blob~', $field["type"]) : !isset($field["privileges"][$where ? "update" : "insert"])) {
+       if (isset($_GET["default"]) ? $field["auto_increment"] || preg_match('~text|blob~', $field["type"]) : !isset($field["privileges"][$where && !$_GET["clone"] ? "update" : "insert"])) {
                unset($fields[$name]);
        }
 }
 if ($_POST && !$error) {
-       $location = $SELF . (isset($_GET["default"]) ? "table=" : ($_POST["insert"] ? "edit=" : "select=")) . urlencode($_GET["edit"]);
+       $location = ($_POST["insert"] ? $_SERVER["REQUEST_URI"] : $SELF . (isset($_GET["default"]) ? "table=" : "select=") . urlencode($_GET["edit"]));
        if (isset($_POST["delete"])) {
                query_redirect("DELETE FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1", $location, lang('Item has been deleted.'));
        } else {
@@ -29,7 +29,7 @@ if ($_POST && !$error) {
                }
                if (isset($_GET["default"])) {
                        query_redirect("ALTER TABLE " . idf_escape($_GET["edit"]) . implode(",", $set), $location, lang('Default values has been set.'));
-               } elseif ($where) {
+               } elseif ($where && !$_GET["clone"]) {
                        query_redirect("UPDATE " . idf_escape($_GET["edit"]) . " SET " . implode(", ", $set) . " WHERE " . implode(" AND ", $where) . " LIMIT 1", $location, lang('Item has been updated.'));
                } else {
                        query_redirect("INSERT INTO " . idf_escape($_GET["edit"]) . " SET " . implode(", ", $set), $location, lang('Item has been inserted.'));
@@ -47,7 +47,7 @@ if ($_POST) {
 } elseif ($where) {
        $select = array();
        foreach ($fields as $name => $field) {
-               if (isset($field["privileges"]["select"]) && !preg_match('~binary|blob~', $field["type"])) {
+               if (isset($field["privileges"]["select"]) && !preg_match('~binary|blob~', $field["type"]) && (!$_GET["clone"] || !$field["auto_increment"])) {
                        $select[] = ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "") . idf_escape($name);
                }
        }
@@ -94,8 +94,8 @@ if ($fields) {
 <input type="hidden" name="token" value="<?php echo $token; ?>" />
 <?php if ($fields) { ?>
 <input type="submit" value="<?php echo lang('Save'); ?>" />
-<?php if (!isset($_GET["default"])) { ?><input type="submit" name="insert" value="<?php echo lang('Save and insert next'); ?>" /><?php } ?>
+<?php if (!isset($_GET["default"])) { ?><input type="submit" name="insert" value="<?php echo ($where && !$_GET["clone"] ? lang('Save and continue edit') : lang('Save and insert next')); ?>" /><?php } ?>
 <?php } ?>
-<?php if ($where) { ?> <input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?>');" /><?php } ?>
+<?php if ($where && !$_GET["clone"]) { ?> <input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?>');" /><?php } ?>
 </p>
 </form>
index dc19619f9a60cf450a9d1aa37901ec8a8371064e..fe6f5bfe85cf09e4c581664a6d9b9881814288fd 100644 (file)
--- a/index.php
+++ b/index.php
@@ -159,7 +159,7 @@ if (isset($_GET["download"])) {
                                while ($row = $result->fetch_assoc()) {
                                        echo '<tr class="nowrap"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td align='left'>$row[Engine]</td><td align='left'>$row[Collation]" : '&nbsp;</td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="6">' . lang('View'));
                                        $row["count"] = $mysql->result($mysql->query("SELECT COUNT(*) FROM " . idf_escape($row["Name"])));
-                                       foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "", "Auto_increment" => "", "count" => "select") : array("count" => "select")) as $key => $link) {
+                                       foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "", "Auto_increment" => "") : array()) + array("count" => "select") as $key => $link) {
                                                $num = (strlen($row[$key]) ? number_format($row[$key], 0, '.', lang(',')) : '&nbsp;');
                                                echo '</td><td align="right">' . ($link ? '<a href="' . htmlspecialchars($SELF) . "$link=" . urlencode($row["Name"]) . '">' . "$num</a>" : $num);
                                        }
index 0db862c9658d3ea2a3467f5737c055844878d069..269c450b2d9679abaa1819ac282b7ffbeb4bee76 100644 (file)
@@ -203,4 +203,6 @@ $translations = array(
        'Move to other database' => 'Přesunout do jiné databáze',
        'Move' => 'Přesunout',
        'Engine' => 'Úložiště',
+       'Save and continue edit' => 'Uložit a pokračovat v editaci',
+       'clone' => 'klonovat',
 );
index c38a46d4713b00533912960e948eed4773d9dc5d..6c68e072b840e09d3f42288e01536bf3612709b0 100644 (file)
@@ -236,7 +236,7 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
                                        echo "</tr></thead>\n";
                                }
                                $unique_idf = implode('&amp;', unique_idf($row, $indexes));
-                               echo '<tr class="nowrap">' . (count($select) == count($group) ? '<td><input type="checkbox" name="delete[]" value="' . $unique_idf . '" /> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a></td>' : '');
+                               echo '<tr class="nowrap">' . (count($select) == count($group) ? '<td><input type="checkbox" name="delete[]" value="' . $unique_idf . '" /> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '&amp;clone=1">' . lang('clone') . '</a></td>' : '');
                                foreach ($row as $key => $val) {
                                        if (!isset($val)) {
                                                $val = "<i>NULL</i>";
index 3e08a4dbd6551496823bbfdcf966539afe917cb1..caa61fb9a36e095916e4e057f44556e49877ed54 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,7 +1,6 @@
 Add whisperer to fields with foreign key
 Highlight found fields
 MySQL 5 BIT data type
-Clone row
 Input function results in edit
 Bulk update - leave original, set to value, set to NULL
 Transactions in export
@@ -9,6 +8,7 @@ Compress export and import
 Partitioning (MySQL 5.1)
 Create view and routine options
 Import CSV
+Fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
 ? Execution time in sql.inc.php
 ? Save token also to cookie - for session expiration and login in other window
 ? Save uploaded files after error to session variable instead of hidden field