Browse Source

Display name of the object in confirmation when dropping it

Jakub Vrana 7 years ago
parent
commit
95d02bb9

+ 1 - 1
adminer/create.inc.php

@@ -198,7 +198,7 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments);
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php } ?>
 
-<?php if ($TABLE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($TABLE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $TABLE"); ?><?php } ?>
 <?php
 if (support("partitioning")) {
 	$partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]);

+ 1 - 1
adminer/database.inc.php

@@ -70,7 +70,7 @@ echo script("focus(qs('#name'));");
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 if (DB != "") {
-	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm() . "\n";
+	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm(lang('Drop') . " " . DB) . "\n";
 } elseif (!$_POST["add_x"] && $_GET["db"] == "") {
 	echo "<input type='image' class='icon' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
 }

+ 1 - 1
adminer/event.inc.php

@@ -47,6 +47,6 @@ if (!$row && $EVENT != "") {
 <p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
-<?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $EVENT"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 1 - 1
adminer/foreign.inc.php

@@ -86,6 +86,6 @@ foreach ($row["source"] as $key => $val) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
 <?php } ?>
-<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $name"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 3 - 2
adminer/include/functions.inc.php

@@ -221,10 +221,11 @@ function select_input($attrs, $options, $value = "", $onchange = "", $placeholde
 
 /** Get onclick confirmation
 * @param string
+* @param string
 * @return string
 */
-function confirm($selector = "qsl('input')") {
-	return script("$selector.onclick = function () { return confirm('" . lang('Are you sure?') . "'); };", "");
+function confirm($message = "", $selector = "qsl('input')") {
+	return script("$selector.onclick = function () { return confirm('" . ($message ? js_escape($message) . ". " : "") . lang('Are you sure?') . "'); };", "");
 }
 
 /** Print header for hidden fieldset (close by </div></fieldset>)

+ 1 - 1
adminer/procedure.inc.php

@@ -49,6 +49,6 @@ if (isset($_GET["function"])) {
 <p><?php textarea("definition", $row["definition"]); ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
-<?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $PROCEDURE"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 1 - 1
adminer/scheme.inc.php

@@ -31,7 +31,7 @@ if (!$row) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 if ($_GET["ns"] != "") {
-	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm() . "\n";
+	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm(lang('Drop') . " $_GET[ns]") . "\n";
 }
 ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">

+ 1 - 1
adminer/sequence.inc.php

@@ -28,7 +28,7 @@ if (!$row) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 if ($SEQUENCE != "") {
-	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm() . "\n";
+	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm(lang('Drop') . " $SEQUENCE") . "\n";
 }
 ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">

+ 1 - 1
adminer/trigger.inc.php

@@ -44,6 +44,6 @@ page_header(($name != "" ? lang('Alter trigger') . ": " . h($name) : lang('Creat
 <p><?php textarea("Statement", $row["Statement"]); ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
-<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $name"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 1 - 1
adminer/type.inc.php

@@ -22,7 +22,7 @@ if (!$row) {
 <p>
 <?php
 if ($TYPE != "") {
-	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm() . "\n";
+	echo "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . confirm(lang('Drop') . " $TYPE") . "\n";
 } else {
 	echo "<input name='name' value='" . h($row['name']) . "' autocapitalize='off'>\n";
 	textarea("as", $row["as"]);

+ 1 - 1
adminer/user.inc.php

@@ -184,6 +184,6 @@ echo "</table>\n";
 ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
-<?php if (isset($_GET["host"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if (isset($_GET["host"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $USER@$_GET[host]"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 1 - 1
adminer/view.inc.php

@@ -53,6 +53,6 @@ page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, a
 <p><?php textarea("select", $row["select"]); ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
-<?php if ($_GET["view"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(); ?><?php } ?>
+<?php if ($TABLE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop') . " $TABLE"); ?><?php } ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>

+ 1 - 0
changes.txt

@@ -1,4 +1,5 @@
 Adminer 4.5.0-dev:
+Display name of the object in confirmation when dropping it
 Display newlines in column comments (bug #573)
 Support current_timestamp() as default of time fields (bug #572)
 Hide window.opener from pages opened in a new window (bug #561)