[pmwiki-users] PmCal Bug?

Gary Spivey gspivey at georgefox.edu
Tue May 2 02:20:55 CDT 2006




> -----Original Message-----
> From: pmwiki-users-bounces at pmichaud.com [mailto:pmwiki-users-
> bounces at pmichaud.com] On Behalf Of Gary Spivey
> Sent: Monday, May 01, 2006 9:52 PM
> To: Chris Cox; pmwiki-users at pmichaud.com
> Subject: Re: [pmwiki-users] PmCal Bug?
> 
> 
> 
> 
> > -----Original Message-----
> > From: pmwiki-users-bounces at pmichaud.com [mailto:pmwiki-users-
> > bounces at pmichaud.com] On Behalf Of Chris Cox
> > Sent: Sunday, April 30, 2006 2:21 PM
> > To: pmwiki-users at pmichaud.com
> > Subject: Re: [pmwiki-users] PmCal Bug?
> >
> > Gary Spivey wrote:
> > >
> > >
> > > When the links for the today button, the current, previous, and
next
> > > months are set, PmCal uses the group to key off of. I am thinking
> that
> > > it should be the pagename.
> > >
> > >
> > >
> > > I have a group called MyGroup which has several pages, including
the
> > > Calendar page. My Calendar page is at MyGroup/Calendar.
> > >
> > >
> > >
> > > I need the PmCal links to point to MyGroup/Calendar?month=####
> rather
> > > than MyGroup?month=###
> > >
> > >
> > >
> > > Is there a reason that these are pointing to the group?
> > >
> > >
> > >
> > > (By the way, I am loving having the PmWiki Calendar - it is making
> > > course calendars very easy for my classes).
> >
> > It is somewhat by design.  Default page name is used for the
> > Group rather than trying to figure that out.
> >
> > Ideally, the PmCalendar markup wants its own group so that
> > it can be present on every page using the GroupHeader or
> > GroupFooter for the (:pmcal:) markup.
> >
> > You can include a PmCalendar on a single page, but as you noticed,
> > there are some things that don't work quite right doing it that
> > way.
> >
> 
> With a couple of very minor tweaks, it works great! What I am doing is
> putting the calendar in multiple groups at a page called
> GroupName/Calendar.
> 
> The central Calendar page does a
> (:pmcal cals=groupa,groupb,groupc :)
> Which includes the Calendars from the various groups. I added a
calpage
> variable that allows one to set the page extension of the included
> calendar. If none is set, it defaults to the groupname, so that you
get
> $cal.$cal (as it currently is). If you want to set the calpage to
> something like 'Calendar' (which is what I do), then you can. Also, I
> added a $PmCal global array that can go in the config.php file. I set
> $PmCal['calpage'] = 'Calendar' and $PmCal['styles'] = 'Calendar' (my
> style name) so that I don't have to set these in all of the individual
> calendars.
> 
> In the GroupFooter, I do a conditional include if the page name has 8
> digits.  This let's me have course pages like ENGE220 with
> ENGE220/Homeworks and ENGE220/Labs and ENGE220/Calendar - which seems
> clean to me.
> 
> Students can put together Calendars from their classes by simply
making
> a
> (:pmcal cals=ENGE220,ENGE250,ENGINEERING:)
> 
> I also added in some RetrieveAuth checks so that calendars and events
> are only displayed to individuals who can read the items themselves.
> This was a simple fix that allows the main calendar to look different
> for different users.
> 
> It is working beautifully.
> 
> Now, it is certainly possible that this might break something for
> others, but I don't know what it would be.
> 
> ----
> This is my Calendar/GroupFooter - for other groups, I simply put
> (:include Calendar/GroupFooter:) in that group's GroupFooter. I am not
> worrying about ACAL's as they aren't edited much - but you could just
do
> the same thing there.
> ----
> (:if match \d\d\d\d\d\d\d\d :)
> (:include Calendar:)
> (:ifend:)
> 
> ----
> 
> Here is my diff ...
> 178,179d177
> <      calpage=           pagename (default=$cal) for included cals.
The
> included link is set to
> <                         ($cal.$calpage)
> 248c246
> <       global $pagename, $MaxIncludes, $HTMLHeaderFmt, $PmCal;
> ---
> >       global $pagename, $MaxIncludes, $HTMLHeaderFmt;
> 270d267
> <               'calpage'=>'',
> 355,356d351
> <       $calpage = isset($_GET['calpage']) ? $_GET['calpage'] :
> $args['calpage'];
> <         $calpage = $calpage ? $calpage : $PmCal['calpage'];
> 413d407
> <         $styles = $styles ? $styles : $PmCal['styles'];
> 649c643
> <
>
$out.="[[$pagename?year=$tyear&amp;month=$tmonth&amp;day=$tday$urladd|";
> ---
> >
> $out.="[[$group?year=$tyear&amp;month=$tmonth&amp;day=$tday$urladd|";
> 657,664c651,652
> <                                    if ($calpage) $linkpage = $cal .
> '.' . $calpage;
> <                                    else          $linkpage = $cal .
> '.' . $cal;
> <                                    if (PageExists($linkpage)) {
> <                                      if (RetrieveAuthPage($linkpage,
> 'read', false)) {
> <                                        $out.="%class='$cl'%";
> <
> $out.=sprintf("[[%s|%s]]\n",$linkpage,$cal);
> <                                      }
> <                                    }
> ---
> >                                       $out.="%class='$cl'%";
> >
> $out.=sprintf("[[%s|%s]]\n",$cal,$cal);
> 687,688c675,676
> <
>
$out.="[[$pagename?month=$prevmonth&amp;day=1&amp;year=$prevyear$urladd|
> $navprevout]] %%";
> <
>
$out.="[[$pagename?month=$month&amp;day=$day&amp;year=$year$urladd|$mt]]
> ";
> ---
> >
>
$out.="[[$group?month=$prevmonth&amp;day=1&amp;year=$prevyear$urladd|$na
> vprevout]] %%";
> >
>
$out.="[[$group?month=$month&amp;day=$day&amp;year=$year$urladd|$mt]]";
> 690c678
> <                        $out.="
>
[[$pagename?month=$nextmonth&amp;day=1&amp;year=$nextyear$urladd|$navnex
> tout]]%%\n";
> ---
> >                        $out.="
>
[[$group?month=$nextmonth&amp;day=1&amp;year=$nextyear$urladd|$navnextou
> t]]%%\n";
> 822c810
> <                                       if (! $skip &&
> PageExists($pmcalincpagename) && (RetrieveAuthPage($pmcalincpagename,
> 'read', false))) {
> ---
> >                                       if (! $skip &&
> PageExists($pmcalincpagename)) {
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users




I messed up in that $styles is an array - I thought it was working and
it wasn't. The styles line should read ...

      if (! $styles[0]) $styles = explode(',',$PmCal['styles']);

This works. What was odd was that I changed the main Calendar to
(:pmcal:) and it still worked. I guess that including the other
calendars picked up their styles somehow. 

-Gary




More information about the pmwiki-users mailing list