Link Here
|
8 |
# |
8 |
# |
9 |
|
9 |
|
10 |
# Copyright 2003 Katipo Communications |
10 |
# Copyright 2003 Katipo Communications |
|
|
11 |
# Copyright 2014 ByWater Solutions |
11 |
# |
12 |
# |
12 |
# This file is part of Koha. |
13 |
# This file is part of Koha. |
13 |
# |
14 |
# |
Link Here
|
24 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
25 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
25 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
26 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
26 |
|
27 |
|
27 |
use strict; |
28 |
use Modern::Perl; |
28 |
use warnings; |
|
|
29 |
|
29 |
|
30 |
use HTML::Template::Pro; |
30 |
use Template; |
31 |
use C4::Context; |
31 |
use C4::Context; |
32 |
use Time::Local; |
32 |
use Time::Local; |
33 |
use POSIX; |
33 |
use POSIX; |
Link Here
|
36 |
my $file = $ARGV[0]; |
36 |
my $file = $ARGV[0]; |
37 |
my %config = getConf("config"); |
37 |
my %config = getConf("config"); |
38 |
my $outFile = $config{"output"}; |
38 |
my $outFile = $config{"output"}; |
39 |
my $feed = HTML::Template::Pro->new( filename => $config{"tmpl"} ); |
39 |
my $feed = Template->new(); |
40 |
|
40 |
|
41 |
my %channel = getConf("channel"); |
41 |
my %channel = getConf("channel"); |
42 |
$feed->param( CHANNELTITLE => $channel{'title'} ); |
42 |
my %image = getConf("image"); |
43 |
$feed->param( CHANNELLINK => $channel{'link'} ); |
43 |
my $vars = { |
44 |
$feed->param( CHANNELDESC => $channel{'desc'} ); |
44 |
CHANNELTITLE => $channel{'title'}, |
45 |
$feed->param( CHANNELLANG => $channel{'lang'} ); |
45 |
CHANNELLINK => $channel{'link'}, |
46 |
$feed->param( CHANNELLASTBUILD => getDate() ); |
46 |
CHANNELDESC => $channel{'desc'}, |
|
|
47 |
CHANNELLANG => $channel{'lang'}, |
48 |
CHANNELLASTBUILD => getDate(), |
47 |
|
49 |
|
48 |
my %image = getConf("image"); |
50 |
IMAGETITLE => $image{'title'}, |
49 |
$feed->param( IMAGETITLE => $image{'title'} ); |
51 |
IMAGEURL => $image{'url'}, |
50 |
$feed->param( IMAGEURL => $image{'url'} ); |
52 |
IMAGELINK => $image{'link'}, |
51 |
$feed->param( IMAGELINK => $image{'link'} ); |
53 |
IMAGEDESCRIPTION => $image{'description'}, |
52 |
$feed->param( IMAGEDESCRIPTION => $image{'description'} ); |
54 |
IMAGEWIDTH => $image{'width'}, |
53 |
$feed->param( IMAGEWIDTH => $image{'width'} ); |
55 |
IMAGEHEIGHT => $image{'height'}, |
54 |
$feed->param( IMAGEHEIGHT => $image{'height'} ); |
|
|
55 |
|
56 |
|
56 |
# |
57 |
ITEMS => getItems( $config{'query'} ) |
57 |
# handle the items |
58 |
}; |
58 |
# |
|
|
59 |
$feed->param( ITEMS => getItems( $config{'query'} ) ); |
60 |
|
59 |
|
61 |
open( FILE, ">$outFile" ) or die "can't open $outFile"; |
60 |
my $template_path = $config{"tmpl"}; |
62 |
print FILE $feed->output(); |
61 |
open( my $fh, "<", $template_path ) or die "cannot open $template_path : $!"; |
63 |
close FILE; |
62 |
$feed->process( $fh, $vars, $outFile ); |
64 |
|
63 |
|
65 |
sub getDate { |
64 |
sub getDate { |
66 |
|
|
|
67 |
# my $date = localtime(timelocal(localtime)); |
68 |
my $date = strftime( "%a, %d %b %Y %T %Z", localtime ); |
65 |
my $date = strftime( "%a, %d %b %Y %T %Z", localtime ); |
69 |
return $date; |
66 |
return $date; |
70 |
} |
67 |
} |
Link Here
|
80 |
my @line = split( /=/, $_, 2 ); |
77 |
my @line = split( /=/, $_, 2 ); |
81 |
unless ( $line[1] ) { |
78 |
unless ( $line[1] ) { |
82 |
$inSection = 0; |
79 |
$inSection = 0; |
83 |
} else { |
80 |
} |
|
|
81 |
else { |
84 |
my ( $key, $value ) = @line; |
82 |
my ( $key, $value ) = @line; |
85 |
chomp $value; |
83 |
chomp $value; |
86 |
$return{$key} = $value; |
84 |
$return{$key} = $value; |
87 |
} |
85 |
} |
88 |
} else { |
86 |
} |
|
|
87 |
else { |
89 |
if ( $_ eq "$section\n" ) { $inSection = 1 } |
88 |
if ( $_ eq "$section\n" ) { $inSection = 1 } |
90 |
} |
89 |
} |
91 |
} |
90 |
} |
92 |
- |
|
|