Lines 154-159
sub httpheaders {
Link Here
|
154 |
} |
154 |
} |
155 |
} |
155 |
} |
156 |
|
156 |
|
|
|
157 |
=head3 url |
158 |
|
159 |
my $url = $uploaded_file->url; |
160 |
|
161 |
Return the URL of the file, proxied by opac-retrieve-file.pl |
162 |
The syspref OPACBaseURL is used to generate this link. |
163 |
|
164 |
=cut |
165 |
|
157 |
sub url { |
166 |
sub url { |
158 |
my ($self) = @_; |
167 |
my ($self) = @_; |
159 |
my $OPACBaseURL = C4::Context->preference('OPACBaseURL'); |
168 |
my $OPACBaseURL = C4::Context->preference('OPACBaseURL'); |
Lines 161-166
sub url {
Link Here
|
161 |
return "$OPACBaseURL/cgi-bin/koha/opac-retrieve-file.pl?id=" . $self->hashvalue; |
170 |
return "$OPACBaseURL/cgi-bin/koha/opac-retrieve-file.pl?id=" . $self->hashvalue; |
162 |
} |
171 |
} |
163 |
|
172 |
|
|
|
173 |
=head3 local_public_path |
174 |
|
175 |
my $local_public_path = $uploaded_file->local_public_path |
176 |
|
177 |
Return the local public path for the uploaded file. |
178 |
It is generated using the upload_public_path config entry. |
179 |
Return If this config entry does not exist. |
180 |
|
181 |
=cut |
182 |
|
164 |
sub local_public_path { |
183 |
sub local_public_path { |
165 |
my ($self) = @_; |
184 |
my ($self) = @_; |
166 |
my $upload_public_path = C4::Context->config('upload_public_path'); |
185 |
my $upload_public_path = C4::Context->config('upload_public_path'); |
Lines 170-181
sub local_public_path {
Link Here
|
170 |
return $filepath; |
189 |
return $filepath; |
171 |
} |
190 |
} |
172 |
|
191 |
|
|
|
192 |
|
193 |
=head3 has_local_public_path |
194 |
|
195 |
my $local_public_path = $uploaded_file->local_public_path |
196 |
|
197 |
Return the local public path for the uploaded file, if exists. |
198 |
|
199 |
=cut |
200 |
|
173 |
sub has_local_public_path { |
201 |
sub has_local_public_path { |
174 |
my ($self) = @_; |
202 |
my ($self) = @_; |
175 |
my $filepath = $self->local_public_path; |
203 |
my $filepath = $self->local_public_path; |
176 |
return $filepath if -e $filepath; |
204 |
return $filepath if -e $filepath; |
177 |
} |
205 |
} |
178 |
|
206 |
|
|
|
207 |
=head3 direct_url |
208 |
|
209 |
my $direct_url = $uploaded_file->direct_url |
210 |
|
211 |
Return the direct url of the file, ie. without using opac-retrieve-file.pl |
212 |
The config entry upload_public_url must be defined. |
213 |
|
214 |
=cut |
215 |
|
179 |
sub direct_url { |
216 |
sub direct_url { |
180 |
my ( $self ) = @_; |
217 |
my ( $self ) = @_; |
181 |
# TODO It could start with '/' and we prefix with OPACBaseURL |
218 |
# TODO It could start with '/' and we prefix with OPACBaseURL |
182 |
- |
|
|