include jquery in page, move view to div
[HTML5TV.git] / bin / calendar.pl
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use lib 'lib';
7 use HTML5TV::hCalendar;
8 use File::Slurp;
9
10 my $html = qq|<!DOCTYPE html>
11 <html>
12
13 <head>
14 <meta charset="utf-8" />
15
16 <link rel="icon" type="image/png" href="media/favicon.png">
17
18 <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
19
20 <script src="js/jqueryhcal/jqueryhcal.js" type="text/javascript"></script>
21 <link rel="stylesheet" type="text/css" href="js/jqueryhcal/jqueryhcal.css" />
22
23 <link rel="stylesheet" type="text/css" href="hcalendar.css" />
24
25 <title>HTML5TV all media available</title>
26
27 </head>
28
29 <body>
30
31 <div id="jhCalendar"></div> 
32
33 |;
34
35 my $vevents;
36
37 foreach my $path ( glob 'media/*/hCalendar.html' ) {
38         next if $path =~ m{_editing};
39         warn "+ $path\n";
40
41         my $hcal = HTML5TV::hCalendar->new( $path );
42
43         my $media = (split(/\//, $path))[1];
44
45         if ( ! -e "www/$media.html" ) {
46                 warn "NO www/$media.html $!";
47                 next;
48         }
49
50         $vevents->{ $hcal->dtstart_iso } = $hcal->as_HTML(
51                 [ 'div',
52                         [ 'a', { href => "$media.html", title => 'watch video', class => 'watch' },
53                                 [ 'img', { src => 'media/favicon.png', border => 0 } ],
54                         ]
55                 ]
56         );
57 }
58
59 $html .= join("\n", map { $vevents->{$_} } sort keys %$vevents );
60
61 $html .= qq|
62
63 </body>
64 </html>
65
66 |;
67
68 write_file 'www/calendar.html', $html;