3 # Script to manage the opac news.
5 # CastaƱeda, Carlos Sebastian - seba3c@yahoo.com.ar - Physics Library UNLP Argentina
7 # Copyright 2000-2002 Katipo Communications
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
30 use C4::Interface::CGI::Output;
36 my ($template, $borrowernumber, $cookie)
37 = get_template_and_user({template_name => "admin/koha-news.tmpl",
41 flagsrequired => {management => 1},
45 my $op = $cgi->param('op');
47 if ($op eq 'add_form') {
48 $template->param(add_form => 1);
49 my $id = $cgi->param("id");
53 $template->param(op => 'edit');
54 $new = get_opac_new($id);
55 $template->param($new);
56 $template->param(id => $new->{'idnew'});
58 $template->param(op => 'add');
61 } elsif ($op eq 'add') {
63 my $title = $cgi->param('title');
64 my $new = $cgi->param('new');
65 my $lang = $cgi->param('lang');
67 add_opac_new($title, $new, $lang);
68 print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
70 } elsif ($op eq 'edit') {
72 my $id = $cgi->param('id');
73 my $title = $cgi->param('title');
74 my $new = $cgi->param('new');
75 my $lang = $cgi->param('lang');
77 upd_opac_new($id, $title, $new, $lang);
78 print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
80 } elsif ($op eq 'del') {
81 my @ids = $cgi->param('ids');
82 del_opac_new(join ",", @ids);
83 print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
87 my $lang = $cgi->param('lang');
88 my ($opac_news_count, $opac_news) = &get_opac_news(undef, $lang);
89 $template->param($lang => 1);
90 $template->param(opac_news => $opac_news);
91 $template->param(opac_news_count => $opac_news_count);
95 output_html_with_http_headers $cgi, $cookie, $template->output;