12 use C4::RotatingCollections;
15 my ($template, $loggedinuser, $cookie)
16 = get_template_and_user({template_name => "rotating_collections/editCollections.tmpl",
20 flagsrequired => {parameters => 1},
24 # Create new Collection
25 if ( $query->param('action') eq 'create' ) {
26 my $title = $query->param('title');
27 my $description = $query->param('description');
29 my ( $createdSuccessfully, $errorCode, $errorMessage ) = CreateCollection( $title, $description );
32 previousActionCreate => 1,
33 createdTitle => $title,
36 if ( $createdSuccessfully ) {
37 $template->param( createSuccess => 1 );
39 $template->param( createFailure => 1 );
40 $template->param( failureMessage => $errorMessage );
44 ## Delete a club or service
45 elsif ( $query->param('action') eq 'delete' ) {
46 my $colId = $query->param('colId');
47 my ( $success, $errorCode, $errorMessage ) = DeleteCollection( $colId );
49 $template->param( previousActionDelete => 1 );
51 $template->param( deleteSuccess => 1 );
53 $template->param( deleteFailure => 1 );
54 $template->param( failureMessage => $errorMessage );
58 ## Edit a club or service: grab data, put in form.
59 elsif ( $query->param('action') eq 'edit' ) {
60 my $colId = $query->param('colId');
61 my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
64 previousActionEdit => 1,
66 editColTitle => $colTitle,
67 editColDescription => $colDesc,
71 # Update a Club or Service
72 elsif ( $query->param('action') eq 'update' ) {
73 my $colId = $query->param('colId');
74 my $title = $query->param('title');
75 my $description = $query->param('description');
77 my ( $createdSuccessfully, $errorCode, $errorMessage )
78 = UpdateCollection( $colId, $title, $description );
81 previousActionUpdate => 1,
82 updatedTitle => $title,
85 if ( $createdSuccessfully ) {
86 $template->param( updateSuccess => 1 );
88 $template->param( updateFailure => 1 );
89 $template->param( failureMessage => $errorMessage );
93 my $collections = GetCollections();
96 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
97 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
98 IntranetNav => C4::Context->preference("IntranetNav"),
100 collectionsLoop => $collections,
103 output_html_with_http_headers $query, $cookie, $template->output;