[aur-dev] [PATCH] Add confirmation to package deletion from packages page

Loui Chang louipc.ist at gmail.com
Fri Jul 10 09:01:08 EDT 2009


On Sat 27 Jun 2009 12:48 +0800, Callan Barrett wrote:
> Signed-off-by: Callan Barrett <wizzomafizzo at gmail.com>
> ---
>  web/lib/pkgfuncs.inc          |    4 ++++
>  web/template/actions_form.php |    4 +++-
>  2 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
> index a4a2dfc..80775a2 100644
> --- a/web/lib/pkgfuncs.inc
> +++ b/web/lib/pkgfuncs.inc
> @@ -649,6 +649,10 @@ function pkg_delete ($atype, $ids) {
>  		return __("You must be logged in before you can disown packages.");
>  	}
>  
> +	if ($_POST['form_type'] == 'bar' && empty($_POST['confirm_del'])) {
> +	        return __("You need to confirm the deletion of this package.");
> +	}
> +
>  	if (empty($ids)) {
>  		return __("You did not select any packages to delete.");
>  	}
> diff --git a/web/template/actions_form.php b/web/template/actions_form.php
> index de77645..c8a9964 100644
> --- a/web/template/actions_form.php
> +++ b/web/template/actions_form.php
> @@ -1,5 +1,6 @@
>  <div class="pgbox">
>  	<form action="packages.php?ID=<?php echo $row['ID'] ?>" method="post">
> +	        <input type="hidden" name="form_type" value="bar">
>  		<input type='hidden' name='IDs[<?php echo $row['ID'] ?>]' value='1'>
>  		<input type='hidden' name='ID' value="<?php echo $row['ID'] ?>">
>  <?php
> @@ -46,7 +47,8 @@ if ($row["MaintainerUID"] == 0) {
>  			
>  		if ($atype == "Trusted User" || $atype == "Developer") {
>  			echo "<input type='submit' class='button' name='do_Delete'";
> -			echo " value='".__("Delete Packages")."'>\n";
> +			echo " value='".__("Delete Packages")."'>";
> +			echo " <input type='checkbox' name='confirm_del'> <span class='f5'>" . __("Confirm delete?") . "</span>";
>  		}
>  ?>

This seems to break deletion from the package search page via the
Actions combobox. Selecting a package's checkbox should be interpreted
as confirmation in this case.



More information about the aur-dev mailing list