diff --git a/delete.cgi b/delete.cgi index 862c0b3..8c25db7 100755 --- a/delete.cgi +++ b/delete.cgi @@ -8,7 +8,7 @@ require './virtualmin-git-lib.pl'; &ReadParse(); # Get the domain and repository -my ($repdom) = grep { $_ ne "confirm" && $_ ne "show" } (keys %in); +my $repdom = $in{'rep'}; my ($repname, $id) = split(/\@/, $repdom); my $dom = &virtual_server::get_domain($id); &can_edit_domain($dom) || &error($text{'add_edom'}); @@ -16,47 +16,29 @@ my @reps = &list_reps($dom); my ($rep) = grep { $_->{'rep'} eq $repname } @reps; $rep || &error($text{'delete_erep'}); -my $button = $in{$repdom}; -if ($button eq &entities_to_ascii($text{'delete'})) { - # Deleting repo - if ($in{'confirm'}) { - # Do it! - &delete_rep($dom, $rep); - &webmin_log("delete", "repo", $repname, - { 'dom' => $dom->{'dom'} }); - &redirect("index.cgi?show=$in{'show'}"); - } - else { - # Ask first - &ui_print_header(&virtual_server::domain_in($dom), - $text{'delete_title'}, ""); - - print "
\n"; - my $size = &disk_usage_kb($rep->{'dir'}); - print &ui_form_start("delete.cgi"); - print &ui_hidden($repdom, $in{$repdom}); - print &ui_hidden("show", $in{'show'}); - print &text('delete_rusure', "$repname", - &nice_size($size*1024)),"

\n"; - print &ui_form_end([ [ "confirm", $text{'delete_ok'} ] ]); - print "

\n"; - - &ui_print_footer("index.cgi?show=$in{'show'}", - $text{'index_return'}); - } - } -elsif ($button eq &entities_to_ascii($text{'index_browse'})) { - # Redirect to gitweb - my $proto = $dom->{'ssl'} ? "https" : "http"; - &redirect("$proto://$dom->{'dom'}/git/gitweb.cgi?p=". - &urlize("$rep->{'rep'}.git")); - } -elsif ($button eq &entities_to_ascii($text{'index_help'})) { - # Redirect to help page - &redirect("help.cgi?dom=$dom->{'id'}&rep=".&urlize($rep->{'rep'}). - "&show=".&urlize($in{'show'})); +if ($in{'confirm'}) { + # Do it! + &delete_rep($dom, $rep); + &webmin_log("delete", "repo", $repname, + { 'dom' => $dom->{'dom'} }); + &redirect("index.cgi?show=$in{'show'}"); } else { - &error($text{'delete_emode'}); - } + # Ask first + &ui_print_header(&virtual_server::domain_in($dom), + $text{'delete_title'}, ""); + + print "
\n"; + my $size = &disk_usage_kb($rep->{'dir'}); + print &ui_form_start("delete.cgi"); + print &ui_hidden("rep", $repdom); + print &ui_hidden("action", "delete"); + print &ui_hidden("show", $in{'show'}); + print &text('delete_rusure', "$repname", + &nice_size($size*1024)),"

\n"; + print &ui_form_end([ [ "confirm", $text{'delete_ok'} ] ]); + print "

\n"; + &ui_print_footer("index.cgi?show=$in{'show'}", + $text{'index_return'}); + } diff --git a/index.cgi b/index.cgi index 9b094ba..6dc69f1 100755 --- a/index.cgi +++ b/index.cgi @@ -60,17 +60,16 @@ foreach my $r (@reps) { my $proto = $r->{'dom'}->{'ssl'} ? "https" : "http"; my $url = "$proto://$r->{'dom'}->{'dom'}/git/gitweb.cgi?p=". &urlize("$r->{'rep'}.git"); + my $ur = &urlize($r->{'rep'}."\@".$r->{'dom'}->{'id'}); my @actions = ( - &ui_submit($text{'delete'}, - $r->{'rep'}."\@".$r->{'dom'}->{'id'}), - &ui_submit($text{'index_browse'}, - $r->{'rep'}."\@".$r->{'dom'}->{'id'}, 0, - "onClick='window.open(\"$url\"); return false;'"), - &ui_submit($text{'index_help'}, - $r->{'rep'}."\@".$r->{'dom'}->{'id'}), + &ui_link("delete.cgi?show=$in{'show'}&rep=".$ur, + $text{'delete'}), + &ui_link($url, $text{'index_browse'}, undef, "target=_blank"), + &ui_link("help.cgi?show=$in{'show'}&dom=$r->{'dom'}->{'id'}&". + "rep=$r->{'rep'}", $text{'index_help'}), ); push(@table, [ $r->{'rep'}, $showd ? ( ) : ( $dom ), - $r->{'desc'}, $r->{'dir'}, join(" ", @actions) ]); + $r->{'desc'}, $r->{'dir'}, &ui_links_row(\@actions) ]); } # Show table of repos