4 #use warnings; FIXME - Bug 2505
13 use C4
::RotatingCollections
;
16 my ($template, $loggedinuser, $cookie)
17 = get_template_and_user
({template_name
=> "rotating_collections/editCollections.tmpl",
21 flagsrequired
=> {parameters
=> 1},
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 );
33 previousActionCreate
=> 1,
34 createdTitle
=> $title,
37 if ( $createdSuccessfully ) {
38 $template->param( createSuccess
=> 1 );
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 );
52 $template->param( deleteSuccess
=> 1 );
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 );
65 previousActionEdit
=> 1,
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 );
82 previousActionUpdate
=> 1,
83 updatedTitle
=> $title,
86 if ( $createdSuccessfully ) {
87 $template->param( updateSuccess
=> 1 );
89 $template->param( updateFailure
=> 1 );
90 $template->param( failureMessage
=> $errorMessage );
94 my $collections = GetCollections
();
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;