passing several $vars to template

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

passing several $vars to template

Martin d'Anjou
Hi again,

I have a template which creates many bugs at once. I would like to produce
an output similar to the one you get when you commit changes to several
bugs at once.

I have something like this at the end of my post_bug_tree template
(inspired from post_bug.html.tmpl):

$template->process("bug/create/created_tree.html.tmpl", $vars)

Can someone show me how to pass multiple bugs through $vars to the
template?

Thanks,
Martin

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: passing several $vars to template

Christian Robottom Reis
On Tue, May 31, 2005 at 03:18:35PM -0400, Martin d'Anjou wrote:
> $template->process("bug/create/created_tree.html.tmpl", $vars)
>
> Can someone show me how to pass multiple bugs through $vars to the
> template?

Just have $vars hold a member which is an array of Bug objects, instead
of data on a single bug. I believe summarize_time.cgi does that.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: passing several $vars to template

Martin d'Anjou
> > $template->process("bug/create/created_tree.html.tmpl", $vars)
> >
> > Can someone show me how to pass multiple bugs through $vars to the
> > template?
>
> Just have $vars hold a member which is an array of Bug objects, instead
> of data on a single bug. I believe summarize_time.cgi does that.

Thanks, it worked. Can you please help me some more? Once I get inside the
template, is it possible to create a loop that goes through all the Bug
objects and print a list of messages:

Bug N has been added to the database ...
Bug N+1 has been added to the database ...
Bug N+2 has been added to the database ...
...

I tried the following but it does not work, so I'm digging more into it.  
Is this the right approach for this problem?

[% FOREACH bugitem = bug %]
  [% FOREACH item = bugitem.sentmail %]
    [% PROCESS bug/process/results.html.tmpl
       type = item.type
       id = item.id
       mail = item.mail
     %]
  [% END %]
[% END %]

Thanks,
Martin
PS: my last sent bounced, this is a resend.

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Got it!! passing several $vars to template

Martin d'Anjou
> Thanks, it worked. Can you please help me some more? Once I get inside the
> template, is it possible to create a loop that goes through all the Bug
> objects and print a list of messages:
>
> Bug N has been added to the database ...
> Bug N+1 has been added to the database ...
> Bug N+2 has been added to the database ...
> ...
>
> I tried the following but it does not work, so I'm digging more into it.  
> Is this the right approach for this problem?
>
> [% FOREACH bugitem = bug %]
>   [% FOREACH item = bugitem.sentmail %]
>     [% PROCESS bug/process/results.html.tmpl
>        type = item.type
>        id = item.id
>        mail = item.mail
>      %]
>   [% END %]
> [% END %]
>
> Thanks,
> Martin
> PS: my last sent bounced, this is a resend.

Actually, it is much easier than that... I just noticed that
$vars->{'sendmail'} has one item per bug, so I do not need the outer loop.
To create multiple bugs at once, e.g. create the loop inside the
post_bug.cgi, all I need is to move "$vars->{'sendmail'} = [];" to the
begining of the loop. When I am done the loop, pass $vars along to the
created.html.tmpl template, et voila!

Martin

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Deleting Chart datasets

Martin Kirk
Since I don't seem to be able to edit the search associated with a dataset,
is there a way to delete the dataset from the system so that I can
re-create it correctly? I may just be missing something, but so far I
haven't been able to work out how.

Thanks,

Martin

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Deleting Chart datasets

Gervase Markham
Martin Kirk wrote:
> Since I don't seem to be able to edit the search associated with a
> dataset, is there a way to delete the dataset from the system so that I
> can re-create it correctly? I may just be missing something, but so far
> I haven't been able to work out how.

Not as yet :-(

Gerv
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Deleting Chart datasets

Martin Kirk
At 02/06/2005 22:18, you wrote:
>Martin Kirk wrote:
>>Since I don't seem to be able to edit the search associated with a
>>dataset, is there a way to delete the dataset from the system so that I
>>can re-create it correctly? I may just be missing something, but so far I
>>haven't been able to work out how.
>
>Not as yet :-(

2.20? or later?

Martin

>Gerv





------------------------------------------------------------------------------
   T H E       MARTIN KIRK                     Thames Tower, 37-45 Station Road
  O P E N      Program Director                        Reading, Berks, RG1 1LX
G R O U P                                                      UNITED KINGDOM

E-Mail: [hidden email]
WWW:    www.opengroup.org
Work:   Direct: +44 1463 248921                 Switchboard: +44 118 950 8311
         Fax:    +44 870 133 6521

Mobile: GSM(UK/US/Europe): +44 7740 565783                      ICQ: 82721581

UNIX is a registered trademark of The Open Group in the US and other countries
------------------------------------------------------------------------------

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Deleting Chart datasets

Gervase Markham
Martin Kirk wrote:
> 2.20? or later?

I would be foolish to commit to a date. :-|

Gerv
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Deleting Chart datasets

Martin Kirk
Well, it was worth a try :)

Martin

At 05/06/2005 11:28, Gervase Markham wrote:

>Martin Kirk wrote:
>>2.20? or later?
>
>I would be foolish to commit to a date. :-|
>
>Gerv
>-
>To view or change your list settings, click here:
><http://bugzilla.org/cgi-bin/mj_wwwusr?user=m.kirk@...>
>


------------------------------------------------------------------------------
   T H E       MARTIN KIRK                     Thames Tower, 37-45 Station Road
  O P E N      Program Director                        Reading, Berks, RG1 1LX
G R O U P                                                      UNITED KINGDOM

E-Mail: [hidden email]
WWW:    www.opengroup.org
Work:   Direct: +44 1463 248921                 Switchboard: +44 118 950 8311
         Fax:    +44 870 133 6521

Mobile: GSM(UK/US/Europe): +44 7740 565783                      ICQ: 82721581

UNIX is a registered trademark of The Open Group in the US and other countries
------------------------------------------------------------------------------

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

Re: Deleting Chart datasets

Stuart Donaldson
In reply to this post by Gervase Markham
Gervase Markham wrote:

> Martin Kirk wrote:
>
>> 2.20? or later?
>
>
> I would be foolish to commit to a date. :-|
>

Hmm... wait a minute, is there a date for 2.20?  :-)

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>