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-electronic.tmpl",
41 flagsrequired => {parameters => 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 $edata = get_opac_electronic($id);
55 $template->param($edata);
56 $template->param(id => $edata->{'idelectronic'});
58 $template->param(op => 'add');
61 } elsif ($op eq 'add') {
63 my $title = $cgi->param('title');
64 my $edata = $cgi->param('edata');
65 my $lang = $cgi->param('lang');
66 my $image = $cgi->param('image');
67 my $href = $cgi->param('href');
68 my $section = $cgi->param('section');
69 add_opac_electronic($title, $edata, $lang,$image, $href,$section);
70 print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
72 } elsif ($op eq 'edit') {
74 my $id = $cgi->param('id');
75 my $title = $cgi->param('title');
76 my $edata = $cgi->param('edata');
77 my $lang = $cgi->param('lang');
78 my $image = $cgi->param('image');
79 my $href = $cgi->param('href');
80 my $section = $cgi->param('section');
81 upd_opac_electronic($id, $title, $edata, $lang,$image,$href,$section);
82 print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
84 } elsif ($op eq 'del') {
86 my @ids = $cgi->param('ids');
87 del_opac_electronic(join ",", @ids);
88 print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
93 my $lang = $cgi->param('lang');
95 my ($opac_electronic_count, $opac_electronic) = &get_opac_electronics(undef, $lang);
96 $template->param($lang => 1);
97 $template->param(opac_electronic => $opac_electronic);
98 $template->param(opac_electronic_count => $opac_electronic_count);
102 output_html_with_http_headers $cgi, $cookie, $template->output;