# Copyright (c) 2003 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: AdmBulletinAttachmentList.pm,v 2.2 2006/10/16 21:08:04 moeller Exp $ package Bivio::Biz::Model::AdmBulletinAttachmentList; use strict; $Bivio::Biz::Model::AdmBulletinAttachmentList::VERSION = sprintf('%d.%02d', q$Revision: 2.2 $ =~ /\d+/g); $_ = $Bivio::Biz::Model::AdmBulletinAttachmentList::VERSION; =head1 NAME Bivio::Biz::Model::AdmBulletinAttachmentList - attachments for current bulletin =head1 RELEASE SCOPE bOP =head1 SYNOPSIS use Bivio::Biz::Model::AdmBulletinAttachmentList; =cut =head1 EXTENDS L =cut use Bivio::Biz::ListModel; @Bivio::Biz::Model::AdmBulletinAttachmentList::ISA = ('Bivio::Biz::ListModel'); =head1 DESCRIPTION C =cut #=IMPORTS use Bivio::HTML; #=VARIABLES =head1 METHODS =cut =for html =head2 format_file_href() : string Returns the href to download the current attachment. =cut sub format_file_href { my($self) = @_; my($req) = $self->get_request; return $req->format_stateless_uri('ADM_BULLETIN_ATTACHMENT') . '/' . Bivio::HTML->escape_uri($self->get('name')) . '?t=' . $req->get('Model.Bulletin')->get('bulletin_id') . '&file=' . $self->get_cursor; } =for html =head2 internal_initialize() : hash_ref B =cut sub internal_initialize { return { version => 1, other => [ { name => 'filename', type => 'String', constraint => 'NONE', }, { name => 'name', type => 'String', constraint => 'NONE', }, ], }; } =for html =head2 internal_load_rows(Bivio::SQL::ListQuery query, string where, array_ref params, Bivio::SQL::ListSupport sql_support) : array_ref Loads the attachment names for the current bulletin. =cut sub internal_load_rows { my($self, @args) = @_; my($result) =[]; my($index) = 0; foreach my $file (@{$self->get_request->get('Model.Bulletin') ->get_attachment_file_names}) { my($name) = $file; $name =~ s/^.*\/\d+-\d+-//; push(@$result, { filename => $file, name => $name, }); } return $result; } #=PRIVATE SUBROUTINES =head1 COPYRIGHT Copyright (c) 2003 bivio Software, Inc. All Rights Reserved. Visit http://www.bivio.biz for more info. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; If not, you may get a copy from: http://www.opensource.org/licenses/lgpl-license.html =head1 VERSION $Id: AdmBulletinAttachmentList.pm,v 2.2 2006/10/16 21:08:04 moeller Exp $ =cut 1;