[pmwiki-users] Fwd: Re: ToDo Recipe

Ben Wilson dausha at gmail.com
Fri Jun 30 13:05:21 CDT 2006


The problem is around here (line316):


 function XToDoCreateToDoItem($pagename) {
    $todo_group = "XToDo{$_POST['todo-group-name']}";
    $todo_group_length = strlen($todo_group);

    Lock(2);

    foreach (ListPages("/^$todo_group\\.\\d{6}$/") as $i) $todo =
max(@$todo, substr($i, $todo_group_length + 1));
    $todo_page_name = sprintf("$todo_group.%06d", @$todo + 1);

XTodo appears to be letting PmWiki do the magic, which is good. Right
after the last line I have here, try dumping the output of the
variables, and post it here:

$pages = ListPages("/^$todo_group\\.\\d{6}$/");
print_r($pages);
print<<<OUTPUT
Group: $todo_group
Page: $todo_page_name
OUTPUT;

Although, it looks like the routine is being a bit too cute. It's
trying to find the highest entry, which is helpful if you delete an
entry. This would probably fix the problem:
    $pages = ListPages("/^$todo_group\\.\\d{6}$/");
    sort($pages);
    $max = split('.', $pages[-1]); # split the last (highest) entry pagename
    $todo_page_name = sprintf("$todo_group.%06d", $max[-1] + 1);

So, after you've posted the output as I asked for above, try adding
these lines at line 318. That might work. You might have to debug this
a bit, as I'm not at a place where I can try this out.

Ben

On 6/30/06, Steve Rowe <think1blue at yahoo.com> wrote:
> Ben,
>
> I took care of the space and that worked.  I'm now
> using your XToDo.php.
>
> I've commented out every other recipe - no change.
>
> Also, I enabled diagnostics.
>
> Lastly, how do I "ensure xtodo knows where the wiki.d
> directory is?"  I looked through XToDo and couldn't
> see a path.  Do I need to add a line to my config.php
> similar to $PubDirUrl=...?
>
> Thanks!
>
> --- Ben Wilson <dausha at gmail.com> wrote:
>
> > The warning message probably reflects a space being
> > inadvertantly
> > printed in the offending file. Look for ?> at the
> > end of the file and
> > remove. That should remedy _that_ problem.
> >
> > Check your configuration to ensure xtodo knows where
> > the wiki.d
> > directory is. It sounds like it's looking in the
> > wrong place to count
> > files, and as a consequence is always starting at 1.
> >
> >  Ben
> >
> > On 6/28/06, Steve Rowe <think1blue at yahoo.com> wrote:
> > > Now this message shows up at the top of every
> > page:
> > >
> > > Warning: Cannot modify header information -
> > headers
> > > already sent by (output started at
> > > E:\BCC\BCC\pmwiki\cookbook\XToDo.php:754) in
> > > E:\BCC\BCC\pmwiki\pmwiki.php on line 870
> > >
> > > When I submit new ToDo's it just shows this:
> > >
> > > Warning: Cannot modify header information -
> > headers
> > > already sent by (output started at
> > > E:\BCC\BCC\pmwiki\cookbook\XToDo.php:754) in
> > > E:\BCC\BCC\pmwiki\cookbook\XToDo.php on line 337
> > >
> > > And when I check the directory still NO
> > > XToDoSite.000002 is created.
> > >
> > > I've changed it back to my old XToDo.php - it
> > doesn't
> > > work, but at least the Warning message is gone.
> > Here
> > > is my code:
> > >
> > > http://www.bethlehemcommunitychurch.com/XToDo.txt
> > >
> > > Here is a summary of the differences I could find:
> > >
> > > 1) Line 262 - yours is commented out:
> > >     #if (empty($selected)) $output[] = "<option
> > > selected></option>\n";
> > >
> > > 2) Line 389 - yours has commented out a line and
> > > replaced it:
> > >     #$notes_text = "(:simplebilling:)\n\n!!
> > Notes";
> > >     $notes_text = "(:xtodobilling:)\n\n!! Notes";
> > >
> > > 3) Lines 445-451 - yours has this added:
> > >
> > >     if (strpos($date_criteria, '..')) {
> > >         list($from, $until) =
> > > preg_split('/\.{2}/',$date_criteria);
> > >             return array(
> > >             strtotime($from),
> > >             strtotime($until)
> > >         );
> > >     }
> > >
> > >
> > > --- Ben Wilson <dausha at gmail.com> wrote:
> > >
> > > > http://www.dausha.net/xtodo.txt
> > > >
> > > > Let me know if this fixes the problem.
> > > >
> > > > On 6/28/06, Steve Rowe <think1blue at yahoo.com>
> > wrote:
> > > > > Ben,
> > > > >
> > > > > That would be great.  Hopefully it works, but
> > at
> > > > the
> > > > > very least it will help me troubleshoot.
> > (Maybe
> > > > XToDo
> > > > > conflicts with another recipe?)
> > > > >
> > > > > --- Ben Wilson <dausha at gmail.com> wrote:
> > > > >
> > > > > > On 6/27/06, Steve Rowe
> > <think1blue at yahoo.com>
> > > > wrote:
> > > > > > > Anybody have any suggestions for why the
> > ToDo
> > > > > > recipe
> > > > > > > is overwriting the XToDoSite.000001 file
> > and
> > > > not
> > > > > > > displaying it in the (:todolist:) ?
> > > > > > >
> > > > > > > Thanks!
> > > > > >
> > > > > > Hmm. I've definitely not encoutered this.
> > Sounds
> > > > > > like there is a
> > > > > > counting function that isn't. If you'd like,
> > I
> > > > can
> > > > > > make the xtodo that
> > > > > > I'm using available from my site. I know it
> > > > works,
> > > > > > having used it just
> > > > > > this past weekend, so maybe it will work.
> > I'm
> > > > > > assuming there's a
> > > > > > version change between your version and the
> > one
> > > > I'm
> > > > > > using.
> > > > > >
> > > > > > --
> > > > > > Ben Wilson
> > > > > > "Democracy: two wolves and a sheep voting on
> > > > what's
> > > > > > for dinner."
> > > > > >
> > > > >
> > > > >
> > > > >
> > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around
> > > > > http://mail.yahoo.com
> > > > >
> > > >
> > > >
> > > > --
> > > > Ben Wilson
> > > > "Democracy: two wolves and a sheep voting on
> > what's
> > > > for dinner."
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> >
> >
> > --
> > Ben Wilson
> > "Democracy: two wolves and a sheep voting on what's
> > for dinner."
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


-- 
Ben Wilson
"Democracy: two wolves and a sheep voting on what's for dinner."




More information about the pmwiki-users mailing list