Bug 6497: MARC URLs not showing up in OPAC detail page with XSLT off
[koha.git] / rotating_collections / editCollections.pl
blob6289cac42bbb8d4a4c19293ad2b1db031f7ab6b6
1 #!/usr/bin/perl
3 use strict;
4 #use warnings; FIXME - Bug 2505
5 require Exporter;
7 use CGI;
9 use C4::Output;
10 use C4::Auth;
11 use C4::Context;
13 use C4::RotatingCollections;
15 my $query = new CGI;
16 my ($template, $loggedinuser, $cookie)
17 = get_template_and_user({template_name => "rotating_collections/editCollections.tmpl",
18 query => $query,
19 type => "intranet",
20 authnotrequired => 1,
21 flagsrequired => {parameters => 1},
22 debug => 1,
23 });
25 # Create new Collection
26 if ( $query->param('action') eq 'create' ) {
27 my $title = $query->param('title');
28 my $description = $query->param('description');
30 my ( $createdSuccessfully, $errorCode, $errorMessage ) = CreateCollection( $title, $description );
32 $template->param(
33 previousActionCreate => 1,
34 createdTitle => $title,
37 if ( $createdSuccessfully ) {
38 $template->param( createSuccess => 1 );
39 } else {
40 $template->param( createFailure => 1 );
41 $template->param( failureMessage => $errorMessage );
45 ## Delete a club or service
46 elsif ( $query->param('action') eq 'delete' ) {
47 my $colId = $query->param('colId');
48 my ( $success, $errorCode, $errorMessage ) = DeleteCollection( $colId );
50 $template->param( previousActionDelete => 1 );
51 if ( $success ) {
52 $template->param( deleteSuccess => 1 );
53 } else {
54 $template->param( deleteFailure => 1 );
55 $template->param( failureMessage => $errorMessage );
59 ## Edit a club or service: grab data, put in form.
60 elsif ( $query->param('action') eq 'edit' ) {
61 my $colId = $query->param('colId');
62 my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
64 $template->param(
65 previousActionEdit => 1,
66 editColId => $colId,
67 editColTitle => $colTitle,
68 editColDescription => $colDesc,
72 # Update a Club or Service
73 elsif ( $query->param('action') eq 'update' ) {
74 my $colId = $query->param('colId');
75 my $title = $query->param('title');
76 my $description = $query->param('description');
78 my ( $createdSuccessfully, $errorCode, $errorMessage )
79 = UpdateCollection( $colId, $title, $description );
81 $template->param(
82 previousActionUpdate => 1,
83 updatedTitle => $title,
86 if ( $createdSuccessfully ) {
87 $template->param( updateSuccess => 1 );
88 } else {
89 $template->param( updateFailure => 1 );
90 $template->param( failureMessage => $errorMessage );
94 my $collections = GetCollections();
96 $template->param(
97 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
98 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
99 IntranetNav => C4::Context->preference("IntranetNav"),
101 collectionsLoop => $collections,
104 output_html_with_http_headers $query, $cookie, $template->output;