Add a "fullscreen from here" button.
[pr0n] / perl / Sesse / pr0n / Index.pm
1 package Sesse::pr0n::Index;
2 use strict;
3 use warnings;
4
5 use Sesse::pr0n::Common qw(error dberror);
6 use Apache2::Request;
7 use POSIX;
8
9 sub handler {
10         my $r = shift;
11         my $apr = Apache2::Request->new($r);
12         my $dbh = Sesse::pr0n::Common::get_dbh();
13
14         # Find the event
15         $r->uri =~ m#^/([a-zA-Z0-9-]+)/?$#
16                 or error($r, "Could not extract event");
17         my $event = $1;
18
19         # Fix common error: pr0n.sesse.net/event -> pr0n.sesse.net/event/
20         if ($r->uri !~ m#/$#) {
21                 $r->headers_out->{'location'} = "/$event/";
22                 return Apache2::Const::REDIRECT;
23         }
24
25         # Internal? (Ugly?) 
26         if ($r->get_server_name =~ /internal/ || $r->get_server_name =~ /skoyen\.bilder\.knatten\.com/) {
27                 my $user = Sesse::pr0n::Common::check_access($r);
28                 if (!defined($user)) {
29                         return Apache2::Const::OK;
30                 }
31         }
32
33         # Read the appropriate settings from the query string into the settings hash
34         my %defsettings = (
35                 thumbxres => 80,
36                 thumbyres => 64,
37                 xres => -1,
38                 yres => -1,
39                 start => 1,
40                 num => -1,
41                 all => 1,
42                 infobox => 1,
43                 rot => 0,
44                 sel => 0,
45                 fullscreen => 0,
46         );
47         
48         # Any NEF files => default to processing
49         my $ref = $dbh->selectrow_hashref('SELECT * FROM images WHERE event=? AND LOWER(filename) LIKE \'%.nef\' LIMIT 1',
50                 undef, $event)
51                 and $defsettings{'xres'} = $defsettings{'yres'} = undef;
52         
53         # Reduce the front page load when in overload mode.
54         if (Sesse::pr0n::Overload::is_in_overload($r)) {
55                 $defsettings{'num'} = 100;
56         }
57                 
58         my %settings = %defsettings;
59
60         for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen) {
61                 my $val = $apr->param($s);
62                 if (defined($val) && $val =~ /^(\d+)$/) {
63                         $settings{$s} = $val;
64                 }
65                 if (($s eq "num" || $s eq "xres" || $s eq "yres") && defined($val) && $val == -1) {
66                         $settings{$s} = $val;
67                 }
68         }
69
70         my $thumbxres = $settings{'thumbxres'};
71         my $thumbyres = $settings{'thumbyres'};
72         my $xres = $settings{'xres'};
73         my $yres = $settings{'yres'};
74         my $start = $settings{'start'};
75         my $num = $settings{'num'};
76         my $all = $settings{'all'};
77         my $infobox = $settings{'infobox'} ? '' : 'nobox/';
78         my $rot = $settings{'rot'};
79         my $sel = $settings{'sel'};
80
81         if (defined($num) && $num == -1) {
82                 $num = undef;
83         }
84
85         $ref = $dbh->selectrow_hashref('SELECT name,date,EXTRACT(EPOCH FROM last_update) AS last_update FROM events WHERE id=? AND vhost=?',
86                 undef, $event, $r->get_server_name)
87                 or error($r, "Could not find event $event", 404, "File not found");
88
89         my $date = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'date'}));
90         my $name = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'name'}));
91         $r->set_last_modified($ref->{'last_update'});
92                                 
93         # If the client can use cache, do so
94         if ((my $rc = $r->meets_conditions) != Apache2::Const::OK) {
95                 return $rc;
96         }
97         
98         # Count the number of selected images.
99         $ref = $dbh->selectrow_hashref("SELECT COUNT(*) AS num_selected FROM images WHERE event=? AND selected=\'t\'", undef, $event);
100         my $num_selected = $ref->{'num_selected'};
101
102         # Find all images related to this event.
103         my $q;
104         my $where = ($all == 0) ? ' AND selected=\'t\'' : '';
105
106         if (defined($start) && defined($num) && !$settings{'fullscreen'}) {
107                 $q = $dbh->prepare("SELECT *, (date - INTERVAL '6 hours')::date AS day FROM images WHERE event=? $where ORDER BY (date - INTERVAL '6 hours')::date,takenby,date,filename LIMIT $num OFFSET " . ($start-1))
108                         or dberror($r, "prepare()");
109         } else {
110                 $q = $dbh->prepare("SELECT *, (date - INTERVAL '6 hours')::date AS day FROM images WHERE event=? $where ORDER BY (date - INTERVAL '6 hours')::date,takenby,date,filename")
111                         or dberror($r, "prepare()");
112         }
113         $q->execute($event)
114                 or dberror($r, "image enumeration");
115
116         # Print the page itself
117         if ($settings{'fullscreen'}) {
118                 $r->content_type("text/html; charset=utf-8");
119                 Sesse::pr0n::Templates::print_template($r, "fullscreen-header", { title => "$name [$event]" });
120                 while (my $ref = $q->fetchrow_hashref()) {
121                         $r->print("        \"" . $infobox . $ref->{'filename'} . "\",\n");
122                 }
123
124                 my %settings_no_fullscreen = %settings;
125                 $settings_no_fullscreen{'fullscreen'} = 0;
126
127                 my $returnurl = "http://" . $r->get_server_name . "/" . $event . "/" .
128                         Sesse::pr0n::Common::get_query_string(\%settings_no_fullscreen, \%defsettings);
129
130                 # *whistle*
131                 $returnurl =~ s/&/&/g;
132
133                 Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
134                         vhost => $r->get_server_name,
135                         event => $event,
136                         start => $settings{'start'} - 1,
137                         returnurl => $returnurl,
138                         sel => $settings{'sel'},
139                 });
140         } else {
141                 Sesse::pr0n::Common::header($r, "$name [$event]");
142                 Sesse::pr0n::Templates::print_template($r, "date", { date => $date });
143
144                 if (Sesse::pr0n::Overload::is_in_overload($r)) {
145                         Sesse::pr0n::Templates::print_template($r, "overloadmode");
146                 }
147
148                 print_thumbsize($r, $event, \%settings, \%defsettings);
149                 print_viewres($r, $event, \%settings, \%defsettings);
150                 print_pagelimit($r, $event, \%settings, \%defsettings);
151                 print_infobox($r, $event, \%settings, \%defsettings);
152                 print_nextprev($r, $event, \%settings, \%defsettings);
153                 print_selected($r, $event, \%settings, \%defsettings) if ($num_selected > 0);
154                 print_fullscreen($r, $event, \%settings, \%defsettings);
155                 
156                 # Find the equipment used
157                 my $eq = $dbh->prepare('
158                         SELECT 
159                                 TRIM(model.value) AS model,
160                                 coalesce(TRIM(lens_spec.value), TRIM(lens.value)) AS lens,
161                                 COUNT(*) AS num
162                         FROM images i
163                                 LEFT JOIN exif_info model ON i.id=model.image
164                                 LEFT JOIN ( SELECT * FROM exif_info WHERE tag=\'Lens\' ) lens ON i.id=lens.image
165                                 LEFT JOIN ( SELECT * FROM exif_info WHERE tag=\'LensSpec\') lens_spec ON i.id=lens_spec.image
166                         WHERE event=? AND model.tag=\'Model\'
167                         GROUP BY 1,2
168                         ORDER BY 1,2')
169                         or die "Couldn't prepare to find equipment: $!";
170                 $eq->execute($event)
171                         or die "Couldn't find equipment: $!";
172
173                 my @equipment = ();
174                 my %cameras_seen = ();
175                 while (my $ref = $eq->fetchrow_hashref) {
176                         if (!defined($ref->{'lens'}) && exists($cameras_seen{$ref->{'model'}})) {
177                                 #
178                                 # Some compact cameras seem to add lens info sometimes and not at other
179                                 # times; if we have seen a camera with at least one specific lens earlier,
180                                 # just combine entries without a lens with the previous one.
181                                 #
182                                 $equipment[$#equipment]->{'num'} += $ref->{'num'};
183                                 next;
184                         }
185                         push @equipment, $ref;
186                         $cameras_seen{$ref->{'model'}} = 1;
187                 }
188                 $eq->finish;
189
190                 if (scalar @equipment > 0) {
191                         Sesse::pr0n::Templates::print_template($r, "equipment-start");
192                         for my $e (@equipment) {
193                                 my $eqspec = $e->{'model'};
194                                 $eqspec .= ', ' . $e->{'lens'} if (defined($e->{'lens'}));
195
196                                 # This isn't correct for all languages. Fix if we ever need to care. :-)
197                                 if ($e->{'num'} == 1) {
198                                         Sesse::pr0n::Templates::print_template($r, "equipment-item-singular", { eqspec => $eqspec });
199                                 } else {
200                                         Sesse::pr0n::Templates::print_template($r, "equipment-item", { eqspec => $eqspec, num => $e->{'num'} });
201                                 }
202                         }
203                         Sesse::pr0n::Templates::print_template($r, "equipment-end");
204                 }
205
206
207                 my $toclose = 0;
208                 my $lastupl = "";
209                 my $img_num = $start;
210                 
211                 # Print out all thumbnails
212                 if ($rot == 1) {
213                         $r->print("    <form method=\"post\" action=\"/rotate\">\n");
214                         $r->print("      <input type=\"hidden\" name=\"event\" value=\"$event\" />\n");
215         
216                         while (my $ref = $q->fetchrow_hashref()) {
217                                 my $imgsz = "";
218                                 my $takenby = $ref->{'takenby'};
219                                 if (defined($ref->{'day'})) {
220                                          $takenby .= ", " . $ref->{'day'};
221                                 }
222
223                                 if ($takenby ne $lastupl) {
224                                         $lastupl = $takenby;
225                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
226                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
227                                 }
228                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
229                                         my $width = $ref->{'width'};
230                                         my $height = $ref->{'height'};
231                                                 
232                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
233                                         $imgsz = " width=\"$width\" height=\"$height\"";
234                                 }
235
236                                 my $filename = $ref->{'filename'};
237                                 my $uri = $infobox . $filename;
238                                 if (defined($xres) && defined($yres) && $xres != -1) {
239                                         $uri = "${xres}x$yres/$infobox$filename";
240                                 } elsif (defined($xres) && $xres == -1) {
241                                         $uri = "original/$infobox$filename";
242                                 }
243
244                                 $r->print("    <p><a href=\"$uri\"><img src=\"${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
245                                 $r->print("      90 <input type=\"checkbox\" name=\"rot-" .
246                                         $ref->{'id'} . "-90\" />\n");
247                                 $r->print("      180 <input type=\"checkbox\" name=\"rot-" .
248                                         $ref->{'id'} . "-180\" />\n");
249                                 $r->print("      270 <input type=\"checkbox\" name=\"rot-" .
250                                         $ref->{'id'} . "-270\" />\n");
251                                 $r->print("      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
252                                         "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Del <input type=\"checkbox\" name=\"del-" . $ref->{'id'} . "\" /></p>\n");
253                         
254                                 ++$img_num;
255                         }
256                         $r->print("      <input type=\"submit\" value=\"Rotate\" />\n");
257                         $r->print("    </form>\n");
258                 } elsif ($sel == 1) {
259                         $r->print("    <form method=\"post\" action=\"/select\">\n");
260                         $r->print("      <input type=\"hidden\" name=\"event\" value=\"$event\" />\n");
261                         
262                         while (my $ref = $q->fetchrow_hashref()) {
263                                 my $imgsz = "";
264                                 my $takenby = $ref->{'takenby'};
265                                 if (defined($ref->{'day'})) {
266                                          $takenby .= ", " . $ref->{'day'};
267                                 }
268
269                                 if ($takenby ne $lastupl) {
270                                         $lastupl = $takenby;
271                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
272                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
273                                 }
274                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
275                                         my $width = $ref->{'width'};
276                                         my $height = $ref->{'height'};
277                                                 
278                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
279                                         $imgsz = " width=\"$width\" height=\"$height\"";
280                                 }
281
282                                 my $filename = $ref->{'filename'};
283                                 my $uri = $infobox . $filename;
284                                 if (defined($xres) && defined($yres) && $xres != -1) {
285                                         $uri = "${xres}x$yres/$infobox$filename";
286                                 } elsif (defined($xres) && $xres == -1) {
287                                         $uri = "original/$infobox$filename";
288                                 }
289
290                                 my $selected = $ref->{'selected'} ? ' checked="checked"' : '';
291
292                                 $r->print("    <p><a href=\"$uri\"><img src=\"${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
293                                 $r->print("      <input type=\"checkbox\" name=\"sel-" .
294                                         $ref->{'id'} . "\"$selected /></p>\n");
295
296                                 ++$img_num;
297                         }
298                         $r->print("      <input type=\"submit\" value=\"Select\" />\n");
299                         $r->print("    </form>\n");
300                 } else {
301                         while (my $ref = $q->fetchrow_hashref()) {
302                                 my $imgsz = "";
303                                 my $takenby = $ref->{'takenby'};
304                                 if (defined($ref->{'day'})) {
305                                          $takenby .= ", " . $ref->{'day'};
306                                 }
307
308                                 if ($takenby ne $lastupl) {
309                                         $r->print("    </p>\n\n") if ($lastupl ne "");
310                                         $lastupl = $takenby;
311                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
312                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
313                                         $r->print("    <p>\n");
314                                 }
315                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
316                                         my $width = $ref->{'width'};
317                                         my $height = $ref->{'height'};
318                                                 
319                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
320                                         $imgsz = " width=\"$width\" height=\"$height\"";
321                                 }
322
323                                 my $filename = $ref->{'filename'};
324                                 my $uri = $infobox . $filename;
325                                 if (defined($xres) && defined($yres) && $xres != -1) {
326                                         $uri = "${xres}x$yres/$infobox$filename";
327                                 } elsif (defined($xres) && $xres == -1) {
328                                         $uri = "original/$infobox$filename";
329                                 }
330                                 
331                                 $r->print("      <a href=\"$uri\"><img src=\"${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
332                                 
333                                 ++$img_num;
334                         }
335                         $r->print("    </p>\n");
336                 }
337
338                 print_nextprev($r, $event, \%settings, \%defsettings);
339                 Sesse::pr0n::Common::footer($r);
340         }
341
342         return Apache2::Const::OK;
343 }
344
345 sub eq_with_undef {
346         my ($a, $b) = @_;
347         
348         return 1 if (!defined($a) && !defined($b));
349         return 0 unless (defined($a) && defined($b));
350         return ($a eq $b);
351 }
352
353 sub print_changes {
354         my ($r, $event, $template, $settings, $defsettings, $var1, $var2, $alternatives) = @_;
355
356         my $title = Sesse::pr0n::Templates::fetch_template($r, $template);
357         chomp $title;
358         $r->print("    <p>$title:\n");
359
360         for my $a (@$alternatives) {
361                 my $text;
362                 my %newsettings = %$settings;
363
364                 if (ref $a) {
365                         my ($v1, $v2);
366                         ($text, $v1, $v2) = @$a;
367                         
368                         $newsettings{$var1} = $v1;
369                         $newsettings{$var2} = $v2;
370                 } else {
371                         $text = $a;
372
373                         # Parse the current alternative
374                         my ($v1, $v2) = split /x/, $a;
375
376                         $newsettings{$var1} = $v1;
377                         $newsettings{$var2} = $v2;
378                 }
379
380                 $r->print("      ");
381
382                 # Check if these settings are current (print only label)
383                 if (eq_with_undef($settings->{$var1}, $newsettings{$var1}) &&
384                     eq_with_undef($settings->{$var2}, $newsettings{$var2})) {
385                         $r->print($text);
386                 } else {
387                         Sesse::pr0n::Common::print_link($r, $text, "/$event/", \%newsettings, $defsettings);
388                 }
389                 $r->print("\n");
390         }
391         $r->print("    </p>\n");
392 }
393
394 sub print_thumbsize {
395         my ($r, $event, $settings, $defsettings) = @_;
396         my @alternatives = qw(80x64 120x96 160x128 240x192 320x256);
397
398         print_changes($r, $event, 'thumbsize', $settings, $defsettings,
399                       'thumbxres', 'thumbyres', \@alternatives);
400 }
401 sub print_viewres {
402         my ($r, $event, $settings, $defsettings) = @_;
403         my @alternatives = qw(320x256 512x384 640x480 800x600 1024x768 1280x960);
404         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'viewres-unlimited'));
405         chomp (my $original = Sesse::pr0n::Templates::fetch_template($r, 'viewres-original'));
406         push @alternatives, [ $unlimited, undef, undef ];
407         push @alternatives, [ $original, -1, -1 ];
408
409         print_changes($r, $event, 'viewres', $settings, $defsettings,
410                       'xres', 'yres', \@alternatives);
411 }
412
413 sub print_pagelimit {
414         my ($r, $event, $settings, $defsettings) = @_;
415         
416         my $title = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage');
417         chomp $title;
418         $r->print("    <p>$title:\n");
419         
420         # Get choices
421         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage-unlimited'));
422         my @alternatives = qw(10 50 100 500);
423         push @alternatives, $unlimited;
424         
425         for my $num (@alternatives) {
426                 my %newsettings = %$settings;
427
428                 if ($num !~ /^\d+$/) { # unlimited
429                         $newsettings{'num'} = -1;
430                 } else {
431                         $newsettings{'num'} = $num;
432                 }
433
434                 $r->print("      ");
435                 if (eq_with_undef($settings->{'num'}, $newsettings{'num'})) {
436                         $r->print($num);
437                 } else {
438                         Sesse::pr0n::Common::print_link($r, $num, "/$event/", \%newsettings, $defsettings);
439                 }
440                 $r->print("\n");
441         }
442         $r->print("    </p>\n");
443 }
444
445 sub print_infobox {
446         my ($r, $event, $settings, $defsettings) = @_;
447
448         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'infobox'));
449         chomp (my $on = Sesse::pr0n::Templates::fetch_template($r, 'infobox-on'));
450         chomp (my $off = Sesse::pr0n::Templates::fetch_template($r, 'infobox-off'));
451
452         $r->print("    <p>$title:\n");
453
454         my %newsettings = %$settings;
455
456         if ($settings->{'infobox'} == 1) {
457                 $r->print($on);
458         } else {
459                 $newsettings{'infobox'} = 1;
460                 Sesse::pr0n::Common::print_link($r, $on, "/$event/", \%newsettings, $defsettings);
461         }
462
463         $r->print(' ');
464
465         if ($settings->{'infobox'} == 0) {
466                 $r->print($off);
467         } else {
468                 $newsettings{'infobox'} = 0;
469                 Sesse::pr0n::Common::print_link($r, $off, "/$event/", \%newsettings, $defsettings);
470         }
471         
472         $r->print('</p>');
473 }
474
475 sub print_nextprev {
476         my ($r, $event, $settings, $defsettings) = @_;
477         my $start = $settings->{'start'};
478         my $num = $settings->{'num'};
479         my $dbh = Sesse::pr0n::Common::get_dbh();
480
481         $num = undef if (defined($num) && $num == -1);
482         return unless (defined($start) && defined($num));
483
484         # determine total number
485         my $ref = $dbh->selectrow_hashref('SELECT count(*) AS num_images FROM images WHERE event=?',
486                 undef, $event)
487                 or dberror($r, "image enumeration");
488         my $num_images = $ref->{'num_images'};
489
490         return if ($start == 1 && $start + $num >= $num_images);
491
492         my $end = $start + $num - 1;
493         if ($end > $num_images) {
494                 $end = $num_images;
495         }
496
497         $r->print("    <p>\n");
498
499         # Previous
500         if ($start > 1) {
501                 my $newstart = $start - $num;
502                 if ($newstart < 1) {
503                         $newstart = 1;
504                 }
505                 my $newend = $newstart + $num - 1;
506                 if ($newend > $num_images) {
507                         $newend = $num_images;
508                 }
509
510                 my %newsettings = %$settings;
511                 $newsettings{'start'} = $newstart;
512                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'prevpage'));
513                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'prevaccesskey'));
514                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)\n", "/$event/", \%newsettings, $defsettings, $accesskey);
515         }
516
517         # This
518         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'thispage'));
519         $r->print("    $title ($start-$end)\n");
520
521         # Next
522         if ($end < $num_images) {
523                 my $newstart = $start + $num;
524                 my $newend = $newstart + $num - 1;
525                 if ($newend > $num_images) {
526                         $newend = $num_images;
527                 }
528                 
529                 my %newsettings = %$settings;
530                 $newsettings{'start'} = $newstart;
531                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'nextpage'));
532                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'nextaccesskey'));
533                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)", "/$event/", \%newsettings, $defsettings, $accesskey);
534         }
535
536         $r->print("    </p>\n");
537 }
538
539 sub print_selected {
540         my ($r, $event, $settings, $defsettings) = @_;
541
542         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'show'));
543         chomp (my $all = Sesse::pr0n::Templates::fetch_template($r, 'show-all'));
544         chomp (my $sel = Sesse::pr0n::Templates::fetch_template($r, 'show-selected'));
545
546         $r->print("    <p>$title:\n");
547
548         my %newsettings = %$settings;
549
550         if ($settings->{'all'} == 0) {
551                 $r->print($sel);
552         } else {
553                 $newsettings{'all'} = 0;
554                 Sesse::pr0n::Common::print_link($r, $sel, "/$event/", \%newsettings, $defsettings);
555         }
556
557         $r->print(' ');
558
559         if ($settings->{'all'} == 1) {
560                 $r->print($all);
561         } else {
562                 $newsettings{'all'} = 1;
563                 Sesse::pr0n::Common::print_link($r, $all, "/$event/", \%newsettings, $defsettings);
564         }
565         
566         $r->print('</p>');
567 }
568
569 sub print_fullscreen {
570         my ($r, $event, $settings, $defsettings) = @_;
571
572         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen'));
573
574         my %newsettings = %$settings;
575         $newsettings{'fullscreen'} = 1;
576
577         $r->print("    <p>");
578         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
579         $r->print("</p>\n");
580 }
581
582 sub print_fullscreen_fromhere {
583         my ($r, $event, $settings, $defsettings, $start) = @_;
584
585         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen-fromhere'));
586
587         my %newsettings = %$settings;
588         $newsettings{'fullscreen'} = 1;
589         $newsettings{'start'} = $start;
590
591         $r->print("    <p class=\"fsfromhere\">");
592         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
593         $r->print("</p>\n");
594 }
595         
596 1;
597
598