Re: [rt-users] Filtering out Templates by Name

2010-03-04 Thread Kevin Squire
On Thu, 4 Mar 2010 16:07:16 -0500
Kevin Falcone  wrote:

> On Thu, Mar 04, 2010 at 02:46:29PM -0500, Kevin Squire wrote:
> > I am currently revisiting the "Canned-Reply" idea.
> > http://wiki.bestpractical.com/view/CannedReplies
> 
> Is there a reason to use this rather than the RTFM extension?

RTFM (at least up until now) would have been overkill.  We still only
have around 5-10 C.R. for each queue that uses them, (not all our
queues do) but we also have some 5-10 other templates in those queues
(as well as 5 global templates). Having them all in there is making for
some visual noise that our "non-techie" group is complaining about... 
(~15 to 25 options in the dropdown, when they only need to have the
5-10 C.R.) 

...just hoping to smooth some things over for the users.


> 
> If you must use this, you can read the DBIx::SearchBuilder
> documentation for the Limit command and the STARTSWITH option

Thank you SOOO much, that did the trick.. even better then I thought I
could get actually.  I was able to build my SQL query off of the
description field.  Now I can actually remove the "CR - " from the
names of the templates.

For posterity, I just added the line below right before the "OrderBy"
line.

$PrimaryTemplates->Limit(FIELD => 'Description', OPERATOR =>
'STARTSWITH', VALUE => 'Canned Reply');


-- 
http://www.wikiak.org

#
 Associate yourself with men of good quality if you esteem
 your own reputation; for 'tis better to be alone then in bad 
 company.- George Washington, Rules of Civility
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Filtering out Templates by Name

2010-03-04 Thread Jerrad Pierce
> On Thu, Mar 04, 2010 at 02:46:29PM -0500, Kevin Squire wrote:
>> I am currently revisiting the "Canned-Reply" idea.
>> http://wiki.bestpractical.com/view/CannedReplies
>
> Is there a reason to use this rather than the RTFM extension?
It's a much simpler system, but at this point it sounds like he
maybe should be using RTFM.
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Filtering out Templates by Name

2010-03-04 Thread Kevin Falcone
On Thu, Mar 04, 2010 at 02:46:29PM -0500, Kevin Squire wrote:
> I am currently revisiting the "Canned-Reply" idea.
> http://wiki.bestpractical.com/view/CannedReplies

Is there a reason to use this rather than the RTFM extension?

If you must use this, you can read the DBIx::SearchBuilder
documentation for the Limit command and the STARTSWITH option

-kevin

> Those directions make a call to /Admin/Elements/SelectTemplate to get
> the canned replys.  Up to now, I have simply named all our
> templates that will be used for Canned Replys as "CR - $NAME", and
> given the description of "Canned Reply for $DESCRIPTION".
> 
> Well, now our templates and our Canned Replys are getting numerous
> enough (combined with the need for canned Replyes with some non-techy
> users) that I would like to find a way to filter out the templates.
> 
> I copied the original /Admin/Elements/SelectTemplate over to
> /Admin/Elements/SelectCannedReply  and adjusted my Update.html
> callback.  It is calling my new "SelectCannedReply" correctly.  But now
> I don't know how to do the filtering (I don't know perl)
> 
> From the SelectTemplate script:
>   my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'});
>   if ($Queue != 0) {
>   $PrimaryTemplates->LimitToQueue($Queue);
>   $PrimaryTemplates->OrderBy(FIELD => 'Name');
>   }
> 
>   my $OtherTemplates = RT::Templates->new($session{'CurrentUser'});
>   $OtherTemplates->LimitToGlobal($DefaultQueue);
>   $OtherTemplates->OrderBy(FIELD => 'Name');
> 
> I am thinking I can modify/add something to/before/after the
> "OrderBy(FIELD =>" line that would be on the lines of:
> 
>IF (FIELD => 'Name') starts with "CR -"
> 
> but as noted, since I don't know perl, I really don't even know where
> to start on this one.  
> 
> Could someone help get me started?


pgpUwXa28R3Yz.pgp
Description: PGP signature
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Filtering out Templates by Name

2010-03-04 Thread Kevin Squire
I am currently revisiting the "Canned-Reply" idea.
http://wiki.bestpractical.com/view/CannedReplies

Those directions make a call to /Admin/Elements/SelectTemplate to get
the canned replys.  Up to now, I have simply named all our
templates that will be used for Canned Replys as "CR - $NAME", and
given the description of "Canned Reply for $DESCRIPTION".

Well, now our templates and our Canned Replys are getting numerous
enough (combined with the need for canned Replyes with some non-techy
users) that I would like to find a way to filter out the templates.

I copied the original /Admin/Elements/SelectTemplate over to
/Admin/Elements/SelectCannedReply  and adjusted my Update.html
callback.  It is calling my new "SelectCannedReply" correctly.  But now
I don't know how to do the filtering (I don't know perl)

>From the SelectTemplate script:
  my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'});
  if ($Queue != 0) {
  $PrimaryTemplates->LimitToQueue($Queue);
  $PrimaryTemplates->OrderBy(FIELD => 'Name');
  }

  my $OtherTemplates = RT::Templates->new($session{'CurrentUser'});
  $OtherTemplates->LimitToGlobal($DefaultQueue);
  $OtherTemplates->OrderBy(FIELD => 'Name');

I am thinking I can modify/add something to/before/after the
"OrderBy(FIELD =>" line that would be on the lines of:

   IF (FIELD => 'Name') starts with "CR -"

but as noted, since I don't know perl, I really don't even know where
to start on this one.  

Could someone help get me started?
 

-- 
http://www.wikiak.org

#
 Associate yourself with men of good quality if you esteem
 your own reputation; for 'tis better to be alone then in bad 
 company.- George Washington, Rules of Civility
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com