1 #**************************************************************************
2 # Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu> *
4 # This program is free software; you can redistribute it and/or modify *
5 # it under the terms of the GNU General Public License as published by *
6 # the Free Software Foundation; either version 2 of the License, or *
7 # (at your option) any later version. *
9 # This program is distributed in the hope that it will be useful, *
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 # GNU General Public License for more details. *
14 # You should have received a copy of the GNU General Public License *
15 # along with this program; if not, write to the *
16 # Free Software Foundation, Inc., *
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 #**************************************************************************/
26 $ND::TEMPLATE->param(TITLE => 'Create/Edit Raids');
28 die "You don't have access" unless isBC();
30 my @alliances = alliances();
31 $BODY->param(Alliances => \@alliances);
34 if (param('raid') =~ /^(\d+)$/){
35 my $query = $DBH->prepare(q{SELECT id,tick,waves,message,released_coords FROM raids WHERE id = ?});
36 $raid = $DBH->selectrow_hashref($query,undef,$1);
39 my $groups = $DBH->prepare(q{SELECT g.gid,g.groupname,raid FROM groups g LEFT OUTER JOIN (SELECT gid,raid FROM raid_access WHERE raid = ?) AS ra ON g.gid = ra.gid WHERE g.attack});
40 $groups->execute($raid->{id});
44 while (my $group = $groups->fetchrow_hashref){
46 push @remgroups,{Id => $group->{id}, Name => $group->{groupname}};
48 push @addgroups,{Id => $group->{id}, Name => $group->{groupname}};
51 $BODY->param(RemoveGroups => \@remgroups);
52 $BODY->param(AddGroups => \@addgroups);