[vhffs-dev] [1744] Use common file for object deletion. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1744
Author: beuss
Date: 2011-05-15 15:27:12 +0200 (Sun, 15 May 2011)
Log Message:
-----------
Use common file for object deletion.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Object.pm
trunk/vhffs-panel/Makefile.am
trunk/vhffs-panel/templates/group/prefs.tt
trunk/vhffs-panel/templates/object/delete.tt
trunk/vhffs-panel/templates/repository/prefs.tt
trunk/vhffs-panel/templates/svn/prefs.tt
trunk/vhffs-panel/templates/web/prefs.tt
Added Paths:
-----------
trunk/vhffs-panel/object/delete.pl
Removed Paths:
-------------
trunk/vhffs-panel/group/delete.pl
trunk/vhffs-panel/repository/delete.pl
trunk/vhffs-panel/svn/delete.pl
trunk/vhffs-panel/web/delete.pl
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2011-05-15 13:27:12 UTC (rev 1744)
@@ -209,6 +209,15 @@
return $self->{'owner_gid'};
}
+sub get_owner_group {
+ my ($self) = @_;
+
+ $self->{_owner_group} = scalar($self->{db}->selectrow_array('SELECT groupname FROM vhffs_groups WHERE gid = ?', undef, $self->{owner_gid}))
+ unless(exists($self->{_owner_group}));
+
+ return $self->{_owner_group};
+}
+
sub get_type
{
my $self = shift;
Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/Makefile.am 2011-05-15 13:27:12 UTC (rev 1744)
@@ -897,6 +897,7 @@
mysql/delete.pl \
mysql/index.pl \
mysql/prefs.pl \
+ object/delete.pl \
object/upavatar.pl \
object/resubmit.pl \
object/quickdelete.pl \
Deleted: trunk/vhffs-panel/group/delete.pl
===================================================================
--- trunk/vhffs-panel/group/delete.pl 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/group/delete.pl 2011-05-15 13:27:12 UTC (rev 1744)
@@ -1,85 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use utf8;
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Group;
-use Vhffs::Panel::Main;
-
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-
-my $vhffs = $panel->{'vhffs'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $message;
-
-my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
-my $sure = $cgi->param('DELETE');
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-unless( $user->can_delete( $group ) )
-{
- $message = gettext('You\'re not allowed to do this (ACL rights)');
-}
-elsif( $group->get_status != Vhffs::Constants::ACTIVATED )
-{
- $message = gettext( 'This object is not functionnal yet. Please wait creation or moderation.');
-}
-elsif( $sure == 0 )
-{
- $message = gettext( 'This object will NOT be DELETED' );
-}
-else
-{
- $group->set_status( Vhffs::Constants::TO_DELETE );
- # Commit all the changes for the current user
- if( $group->commit < 0 ) {
- $message = gettext('An error occured while updating the project');
- } else {
- my $url = '/panel.pl?msg='.gettext('This group will be deleted');
- $panel->redirect($url);
- }
-}
-
-$panel->render('misc/message.tt', { message => $message, refresh_url => '/group/prefs.pl?group='.$group->get_groupname });
Added: trunk/vhffs-panel/object/delete.pl
===================================================================
--- trunk/vhffs-panel/object/delete.pl (rev 0)
+++ trunk/vhffs-panel/object/delete.pl 2011-05-15 13:27:12 UTC (rev 1744)
@@ -0,0 +1,88 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+
+use utf8;
+use POSIX qw(locale_h);
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $user = $panel->{'user'};
+my $cgi = $panel->{'cgi'};
+my $message;
+
+my $oid = $cgi->param( "oid" );
+my $sure = $cgi->param( "delete" );
+
+my $object = Vhffs::Object::get_by_oid( $vhffs, $oid );
+
+if( ( ! defined $oid ) || ( ! defined $sure ) ) {
+ $message = gettext( 'CGI Error !' );
+} elsif( ! defined $object ) {
+ $message = gettext( 'Cannot retrieve informations about this object' );
+} elsif( !$user->can_delete( $object ) ) {
+ $message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
+} elsif( $sure == 0 ) {
+ $message = gettext( 'This object will NOT be deleted' );
+} else {
+ $object->set_status( Vhffs::Constants::TO_DELETE );
+
+ # Commit all the changes for the current user
+ if( $object->commit < 0 ) {
+ $message = gettext( 'An error occured while deleting this object' );
+ } else {
+ $message = gettext( 'This object will be deleted' );
+ }
+}
+
+my $vars = {
+ message => $message
+};
+
+if( $object->get_type == Vhffs::Constants::TYPE_GROUP ) {
+ $vars->{refresh_url} = '/group/index.pl';
+} else {
+ $vars->{refresh_url} = '/group/view.pl?group='.$object->get_owner_group unless($object->get_type == Vhffs::Constants::TYPE_GROUP);
+}
+
+$panel->render('misc/message.tt', $vars );
Deleted: trunk/vhffs-panel/repository/delete.pl
===================================================================
--- trunk/vhffs-panel/repository/delete.pl 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/repository/delete.pl 2011-05-15 13:27:12 UTC (rev 1744)
@@ -1,82 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use utf8;
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Main;
-use Vhffs::Services::Repository;
-
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-
-my $vhffs = $panel->{'vhffs'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $message;
-
-my $repo_name = $cgi->param( "REPO_NAME" );
-my $sure = $cgi->param( "DELETE" );
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $repo = Vhffs::Services::Repository::get_by_reponame( $vhffs , $repo_name );
-
-if( ( ! defined $repo_name ) || ( ! defined $sure ) ) {
- $message = sprintf( gettext("CGI Error ! %s"), $repo_name );
-} elsif( ! defined $repo ) {
- $message = gettext( "Cannot retrieve informations about this Download repository" );
-} elsif( !$user->can_delete( $repo ) ) {
- $message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
-} elsif( $sure == 0 ) {
- $message = gettext( "This Download repository will NOT be deleted" );
-} else {
- $repo->set_status( Vhffs::Constants::TO_DELETE );
-
- # Commit all the changes for the current user
- if( $repo->commit < 0 ) {
- $message = gettext("An error occured while deleting the Download repository");
- } else {
- $message = gettext("This Download repository will be deleted");
- }
-}
-
-$panel->render('misc/message.tt', { message => $message });
Deleted: trunk/vhffs-panel/svn/delete.pl
===================================================================
--- trunk/vhffs-panel/svn/delete.pl 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/svn/delete.pl 2011-05-15 13:27:12 UTC (rev 1744)
@@ -1,80 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use utf8;
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::Svn;
-
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-
-my $vhffs = $panel->{'vhffs'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $message;
-
-my $repo = $cgi->param( "name" );
-my $sure = $cgi->param( "DELETE" );
-
-my $svn = Vhffs::Services::Svn::get_by_reponame( $vhffs , $repo );
-
-if( ( ! defined $repo ) || ( ! defined $sure ) ) {
- $message = gettext("CGI Error !");
-} elsif( ! defined $svn ) {
- $message = gettext( "Cannot retrieve informations about this repository" );
-} elsif( !$user->can_delete( $svn ) ) {
- $message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
-} elsif( $sure == 0 ) {
- $message = gettext( "This subversion repository will NOT be deleted" );
-} else {
- $svn->set_status( Vhffs::Constants::TO_DELETE );
-
- # Commit all the changes for the current user
- if( $svn->commit < 0 ) {
- $message = gettext("An error occured while deleting the Subversion repository");
- } else {
- $message = gettext("This repository will be deleted");
- }
-}
-
-$panel->render('misc/message.tt', { message => $message } );
Modified: trunk/vhffs-panel/templates/group/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/group/prefs.tt 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/templates/group/prefs.tt 2011-05-15 13:27:12 UTC (rev 1744)
@@ -104,8 +104,7 @@
[% INCLUDE 'object/delete.tt'
type = 'group'
- param_name = 'group'
- param_value = group.get_groupname %]
+ oid = group.get_oid %]
[% IF current_user.is_admin() %]
[% INCLUDE 'admin/object/edit.tt'
Modified: trunk/vhffs-panel/templates/object/delete.tt
===================================================================
--- trunk/vhffs-panel/templates/object/delete.tt 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/templates/object/delete.tt 2011-05-15 13:27:12 UTC (rev 1744)
@@ -1,12 +1,10 @@
[%# Provides delete form for any object, need the following parameters:
- type: type of object, used to generate URLs
- - param_name: name of the hidden field that will be created to
- contain param_value
- - param_value: value to put in the hidden field (object id or unique key)
+ - oid: object ID
%]
<h2>[% 'Delete this object' | i18n | html %]</h2>
-<form method="post" action="/[% type %]/delete.pl" accept-charset="utf-8">
+<form method="post" action="/object/delete.pl" accept-charset="utf-8">
<fieldset class="delete">
<legend>
[% 'Are you SURE you want DELETE this object?' | i18n | html %]
@@ -17,13 +15,13 @@
<p class="warning">[% 'Moreover all associated services will be DESTROYED' | i18n | html %]</p>
[% END %]
<p>
- <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <input type="radio" name="delete" id="DELETE_NO" value="0" checked="checked" />
<label for="DELETE_NO">
[% 'No, I\'m not sure, I prefer to keep this object. All these warnings scare me' | i18n | html %]
</label>
</p>
<p>
- <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <input type="radio" name="delete" id="DELETE_YES" value="1" />
<label for="DELETE_YES">
[% 'Yes I\'m sure of what I do, I do not know the fear' | i18n | html %]
</label>
@@ -31,7 +29,7 @@
</fieldset>
<p class="button" id="buttonDelete">
- <input type="hidden" name="[% param_name | html %]" value="[% param_value | html %]" />
+ <input type="hidden" name="oid" value="[% oid %]" />
<input type="submit" value="[% 'Delete' | i18n | html %]" />
</p>
Modified: trunk/vhffs-panel/templates/repository/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/repository/prefs.tt 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/templates/repository/prefs.tt 2011-05-15 13:27:12 UTC (rev 1744)
@@ -12,8 +12,7 @@
[% INCLUDE 'object/delete.tt'
type = 'repository'
- param_name = 'REPO_NAME'
- param_value = repository.get_name %]
+ oid = repository.get_oid %]
[% IF current_user.is_admin %]
[% INCLUDE 'admin/object/edit.tt'
Modified: trunk/vhffs-panel/templates/svn/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/svn/prefs.tt 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/templates/svn/prefs.tt 2011-05-15 13:27:12 UTC (rev 1744)
@@ -25,8 +25,7 @@
[% INCLUDE 'object/delete.tt'
type = 'svn'
- param_name = 'name'
- param_value = repository.get_reponame %]
+ oid = repository.get_oid %]
[% IF current_user.is_admin %]
[% INCLUDE 'admin/object/edit.tt'
Modified: trunk/vhffs-panel/templates/web/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/web/prefs.tt 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/templates/web/prefs.tt 2011-05-15 13:27:12 UTC (rev 1744)
@@ -23,8 +23,7 @@
[% INCLUDE 'object/delete.tt'
type = 'web'
- param_name = 'name'
- param_value = web.get_servername %]
+ oid = web.get_oid %]
[% IF current_user.is_admin %]
[% INCLUDE 'admin/object/edit.tt'
Deleted: trunk/vhffs-panel/web/delete.pl
===================================================================
--- trunk/vhffs-panel/web/delete.pl 2011-05-14 22:10:35 UTC (rev 1743)
+++ trunk/vhffs-panel/web/delete.pl 2011-05-15 13:27:12 UTC (rev 1744)
@@ -1,90 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use utf8;
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Group;
-use Vhffs::Panel::Main;
-use Vhffs::Services::Web;
-
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-
-my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $message;
-my $owner = $cgi->param("PROJECT_OWNER");
-
-my $delete = $cgi->param("DELETE");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-#We test if the owner exist
-
-my $servername = $cgi->param("name");
-
-my $web = Vhffs::Services::Web::get_by_servername( $vhffs , $servername );
-my $group = Vhffs::Group::get_by_gid( $vhffs , $web->{'owner_gid'} );
-
-if( ! defined( $web ) ) {
- $message = gettext("This web area doesn't exist in VHFFS database");
-} elsif( !$user->can_delete( $web ) ) {
- $message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
-} else {
- if( $delete == 1 ) {
- $web->set_status( Vhffs::Constants::TO_DELETE );
- if( $web->commit < 0 ) {
- $message = gettext("An error occured while applying changes. This web area will NOT be deleted");
- } else {
- $message = gettext("This object will BE DELETED");
- }
- } else {
- $message = gettext("This object will NOT be DELETED");
- }
-}
-
-$panel->render('misc/message.tt', {
- message => $message,
- refresh_url => '/group/view.pl?group='.$group->get_groupname
-});