]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/forum/Calendar:_listing_multiple_entries_per_day/comment_1_d3dd0b97c63d615e3dee22ceacaa5a30._comment
ikiwiki (3.20140916) unstable; urgency=low
[git.ikiwiki.info.git] / doc / forum / Calendar:_listing_multiple_entries_per_day / comment_1_d3dd0b97c63d615e3dee22ceacaa5a30._comment
1 [[!comment format=mdwn
2  username="https://www.google.com/accounts/o8/id?id=AItOawnXybLxkPMYpP3yw4b_I6IdC3cKTD-xEdU"
3  nickname="Matt"
4  subject="comment 1"
5  date="2011-11-29T00:52:49Z"
6  content="""
7 So I ported the original patch mentioned to the latest Debian version.  Well at least the bits that matter to me.  See below.  
9 In doing so I realized that it does quite work how I imagined it would; instead of generating a dynamic page for a particular day with a list of links it actually fills in the calendar with the details of the posts (making for some ugly formatting).
11 I'm hoping the tag generation pages will give me a clue how to alter this into what I want.
13 <pre>
14 diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
15 index c7d2b7c..c931fe6 100644
16 --- a/IkiWiki/Plugin/calendar.pm
17 +++ b/IkiWiki/Plugin/calendar.pm
18 @@ -75,6 +75,8 @@ sub format_month (@) {   
19         my %params=@_;
21         my %linkcache;
22 +    my @list;
23 +    my $detail = 1;
24         foreach my $p (pagespec_match_list($params{page},
25                                 \"creation_year($params{year}) and creation_month($params{month}) and ($params{pages})\",
26                                 # add presence dependencies to update
27 @@ -88,7 +90,7 @@ sub format_month (@) {   
28                 my $mtag  = sprintf(\"%02d\", $month);
30                 # Only one posting per day is being linked to.
31 -               $linkcache{\"$year/$mtag/$mday\"} = $p;
32 +               $linkcache{\"$year/$mtag/$mday\"}{$p} = $IkiWiki::pagesources{$p};
33         }
35         my $pmonth = $params{month} - 1;   
36 @@ -219,14 +221,38 @@ EOF
37                                 $tag='month-calendar-day-this-day';
38                         }
39                         else {
40 -                               $tag='month-calendar-day-link';
41 +                               if ( $detail == 0 ) {
42 +                                       $tag='month-calendar-day-link';
43 +                               }
44 +                               else{
45 +                                       $tag='month-calendar-day';
46 +                               }
47                         }
48                         $calendar.=qq{\t\t<td class=\"$tag $downame{$wday}\">};
49 -                       $calendar.=htmllink($params{page}, $params{destpage},
50 -                               $linkcache{$key},
51 -                               noimageinline => 1,
52 -                               linktext => $day,
53 -                               title => pagetitle(IkiWiki::basename($linkcache{$key})));
54 +                       if ( $detail == 0 ) {
55 +                               $calendar.=htmllink($params{page}, $params{destpage},
56 +                                               $linkcache{$key},
57 +                                               noimageinline => 1,
58 +                                               linktext => $day,
59 +                                               title => pagetitle(IkiWiki::basename($linkcache{$key})));
60 +                       }
61 +                       else {
62 +                               my $day_label = qq{<span class=\"month-calendar-day-label\">$day</span>};
63 +                               $calendar.=qq{$day_label\n};
64 +                               my $srcpage; my $destpage;
65 +                               while(($srcpage,$destpage) = each(%{$linkcache{$key}})) {
66 +                                       my $title = IkiWiki::basename(pagename($srcpage));
67 +                                       if (exists $pagestate{$srcpage}{meta}{title} ) {
68 +                                               $title = $pagestate{$srcpage}{meta}{title};
69 +                                       }  
70 +                                       $calendar.=qq{\t\t<div class=\"$tag $downame{$wday}\">};
71 +                                       $calendar.=htmllink($params{page}, $params{destpage},
72 +                                                       pagename($destpage),
73 +                                                       linktext => $title);
74 +                                       push @list, pagename($linkcache{$key}{$srcpage});
75 +                                       $calendar.=qq{\t\t</div>};
76 +                               }
77 +                       }
78                         $calendar.=qq{</td>\n};
79                 }
80                 else {
82 </pre>
83 """]]