[Rt-commit] r2635 - in rt/branches/PLATANO-EXPERIMENTAL: . etc html
html/Elements html/NoAuth html/Prefs html/Search
html/Search/Elements lib/RT lib/t/regression sbin
jesse at bestpractical.com
jesse at bestpractical.com
Sat Apr 16 02:41:33 EDT 2005
Author: jesse
Date: Sat Apr 16 02:41:28 2005
New Revision: 2635
Added:
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyAdminQueues
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRT
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MySupportQueues
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/QueueSummary
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/RefreshHomepage
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/ShowSearch
rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/class.js
rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/list.js
rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/
rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/MyRT.html
rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Quicksearch.html
rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Search.html
rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SearchesForObject
rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/17custom_search.t (contents, props changed)
Modified:
rt/branches/PLATANO-EXPERIMENTAL/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL/Makefile.in
rt/branches/PLATANO-EXPERIMENTAL/etc/RT_Config.pm.in
rt/branches/PLATANO-EXPERIMENTAL/etc/initialdata
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRequests
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyTickets
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/Quicksearch
rt/branches/PLATANO-EXPERIMENTAL/html/Elements/TitleBoxStart
rt/branches/PLATANO-EXPERIMENTAL/html/Search/Build.html
rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/EditSearches
rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SelectSearchesForObjects
rt/branches/PLATANO-EXPERIMENTAL/html/index.html
rt/branches/PLATANO-EXPERIMENTAL/lib/RT/Attribute_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL/lib/RT/System.pm
rt/branches/PLATANO-EXPERIMENTAL/lib/RT/User_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/06mailgateway.t
rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/07acl.t
rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/08web_cf_access.t
rt/branches/PLATANO-EXPERIMENTAL/sbin/rt-setup-database.in
Log:
r12968 at hualien: jesse | 2005-04-16 02:13:13 -0400
r6370 at hualien: jesse | 2005-03-05 19:28:47 -0500
r6273 at hualien (orig r2277): clkao | 2005-03-05 01:12:50 -0500
* Make regression does not require being root anymore.
* Global pre-defined searches are now attributes of RT::System.
* Users can now override display options for pre-defined searches.
* Users can now configure Quicksearch portlet.
* New portlets: MyAdminQueues, MySupportQueues.
* Users can now configure RT at a glance with pre-defined searches,
allowed components, and saves searches.
* $MyTicketsLength and $MyRequestsLength is no longer needed in RT::Config.
* Clean up Search/Build.html for reduce duplicated code.
* Fix title_right_href in Titlebox.
* Cleanup original Quicksearch to Use QueueSummary for summary portlets.
TODO:
* Saving search for RT::System needs to do 'Saved Search - name' instead
of SavedSearch
r6274 at hualien (orig r2278): clkao | 2005-03-05 09:31:05 -0500
r2397 at ab: clkao | 2005-03-05 22:29:18 +0800
Fix a bug where MyRT gets only one component in a pane.
r6275 at hualien (orig r2279): clkao | 2005-03-05 09:31:25 -0500
Modified: rt/branches/PLATANO-EXPERIMENTAL/Makefile.in
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/Makefile.in (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/Makefile.in Sat Apr 16 02:41:28 2005
@@ -480,7 +480,7 @@
./configure
start-httpd:
- $(PERL) bin/standalone_httpd 80 &
+ $(PERL) bin/standalone_httpd &
apachectl:
$(APACHECTL) stop
Modified: rt/branches/PLATANO-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/etc/RT_Config.pm.in (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/etc/RT_Config.pm.in Sat Apr 16 02:41:28 2005
@@ -273,10 +273,12 @@
Set($WebPath , "");
+Set($WebPort , 80 + ($< * 7274) % 32766 + ($< && 1024));
+
# This is the Scheme, server and port for constructing urls to webrt
# $WebBaseURL doesn't need a trailing /
-Set($WebBaseURL , "http://RT::WebBaseURL.not.configured:80");
+Set($WebBaseURL , "http://RT::WebBaseURL.not.configured:$WebPort");
Set($WebURL , $WebBaseURL . $WebPath . "/");
@@ -364,18 +366,6 @@
Set($MaxInlineBody, 13456);
-# $MyTicketsLength is the length of the owned tickets table on the
-# front page. For some people, the default of 10 isn't big enough
-# to get a feel for how much work needs to be done before you get
-# some time off.
-
-Set($MyTicketsLength, 10);
-
-# $MyRequestsLength is the length of the requested tickets table
-# on the front page.
-
-Set($MyRequestsLength, 10);
-
# @MasonParameters is the list of parameters for the constructor of
# HTML::Mason's Apache or CGI Handler. This is normally only useful
# for debugging, eg. profiling individual components with:
Modified: rt/branches/PLATANO-EXPERIMENTAL/etc/initialdata
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/etc/initialdata (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/etc/initialdata Sat Apr 16 02:41:28 2005
@@ -585,3 +585,44 @@
Right => 'SuperUser', },
);
+
+# Predefined searches
+
+ at Attributes = (
+ { Name => 'Search - My Tickets',
+ Description => '[_1] highest priority tickets I own', # loc
+ Content =>
+ { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus",
+ Query => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
+ OrderBy => 'Priority',
+ Order => 'DESC',
+ SummaryRows => 10, },
+ },
+ { Name => 'Search - My Requests',
+ Description => '[_1] newest unowned tickets', # loc
+ Content =>
+# take care of the loc here for 'Take'
+ { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', QueueName, ExtendedStatus, CreatedRelative, '<A HREF=\"__WebPath__/Ticket/Display.html?Action=Take&id=__id__\">Take</a>/TITLE: ' ",
+
+ Query => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
+ OrderBy => 'Created',
+ Order => 'DESC',
+ SummaryRows => 10, },
+ },
+ { Name => 'My RT',
+ Description => 'My RT',
+ Content =>
+ { main =>
+ [ { type => 'system', name => 'My Tickets' },
+ { type => 'system', name => 'My Requests' },
+ { type => 'component', name => 'QuickCreate'},
+ ],
+ right =>
+ [ { type => 'component', name => 'Quicksearch' },
+ { type => 'component', name => 'MySupportQueues' },
+ { type => 'component', name => 'MyAdminQueues' },
+ { type => 'component', name => 'RefreshHomepage' },
+ ]
+ },
+}
+);
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyAdminQueues
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyAdminQueues Sat Apr 16 02:41:28 2005
@@ -0,0 +1,52 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Elements/TitleBox, title => loc("Queues I administer"), bodyclass => "" &>
+<& /Elements/QueueSummary,
+ cache => 'my_admin_queues',
+ queue_filter => sub { $_->CurrentUserHasRight('AdminQueue') },
+ conditions => [ {cond => "Status = 'new'", name => loc ('new') },
+ {cond => "Status = 'open'", name => loc ('open') }] &>
+</&>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRT
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRT Sat Apr 16 02:41:28 2005
@@ -0,0 +1,103 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+
+<TABLE BORDER=0 WIDTH=100%>
+<TR VALIGN=TOP>
+<TD WIDTH=70% class="boxcontainer">
+
+% for my $portlet (@{$portlets->{main}}) {
+<% _show($portlet) %>
+<BR>
+% }
+
+%#GAH!
+</TD>
+<TD class="boxcontainer">
+
+% for my $portlet (@{$portlets->{right}}) {
+<% _show($portlet) %>
+<BR>
+% }
+
+</TD>
+</TR>
+</TABLE>
+<a href="<%$RT::WebPath%>/Prefs/MyRT.html"><&|/l&>Customize</&></a>
+
+
+<%INIT>
+
+my %allowed_components = map {$_ => 1}
+ qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues RefreshHomepage);
+
+unless (exists $session{'my_rt_portlets'}) {
+ my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('My RT');
+ my $user = $session{'CurrentUser'}->UserObj;
+ $session{'my_rt_portlets'} = $user->Preferences('My RT', $d_portlets->Content);
+}
+
+my $portlets = $session{'my_rt_portlets'};
+
+sub _show {
+ my $entry = shift;
+ my $type = $entry->{type};
+ if ($type eq 'component') {
+ my $name = $entry->{name};
+ # security check etc.
+ $m->comp ($name);
+ }
+ elsif ($type eq 'system') {
+ $m->comp ('/Elements/ShowSearch', Name => $entry->{name});
+ }
+ elsif ($type eq 'saved') {
+ $m->comp ('/Elements/ShowSearch', SavedSearch => $entry->{name});
+ }
+ else {
+ $RT::Logger->error ("unknown portlet type $type");
+ }
+}
+
+</%INIT>
\ No newline at end of file
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRequests
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRequests (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyRequests Sat Apr 16 02:41:28 2005
@@ -43,27 +43,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<&|/Elements/TitleBox,
- title => loc("[_1] newest unowned tickets", $rows),
- title_href => "Search/Results.html".$QueryString &>
-<& /Elements/TicketList,
- Format => "'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', QueueName, ExtendedStatus, CreatedRelative, '<A HREF=\"$RT::WebPath/Ticket/Display.html?Action=Take&id=__id__\">".loc('Take')."</a>/TITLE: ' ",
- Query => $Query,
- OrderBy => 'Created',
- Order => 'DESC',
- ShowNavigation => 0,
- Rows => $rows
- &>
-</&>
-<%init>
-my $rows = $RT::MyRequestsLength;
-
-my $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')";
-
-my $QueryString = '?' . $m->comp('/Elements/QueryString',
- Query => $Query,
- Order => 'DESC',
- OrderBy => 'Priority') if ($Query);
-
-</%init>
+%# DEPRECATED
+<& /Elements/ShowSearch, Name => 'My Requests' &>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MySupportQueues
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MySupportQueues Sat Apr 16 02:41:28 2005
@@ -0,0 +1,52 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Elements/TitleBox, title => loc("My support queues"), bodyclass => "" &>
+<& /Elements/QueueSummary,
+ cache => 'my_support_queues',
+ queue_filter => sub { $_->IsAdminCc($session{'CurrentUser'}->Id) },
+ conditions => [ {cond => "Status = 'new'", name => loc ('new') },
+ {cond => "Status = 'open'", name => loc ('open') }] &>
+</&>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyTickets
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyTickets (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/MyTickets Sat Apr 16 02:41:28 2005
@@ -43,28 +43,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<&|/Elements/TitleBox,
- title => loc('[_1] highest priority tickets I own', $rows),
- title_href => "Search/Results.html".$QueryString &>
-<& /Elements/TicketList,
- Format => "'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus",
-
- Query => $Query,
- OrderBy => 'Priority',
- Order => 'DESC',
- Rows => $rows,
- ShowNavigation => 0
- &>
-</&>
-<%init>
-my $rows = $RT::MyTicketsLength;
-
-my $Query = " Owner = '".$session{'CurrentUser'}->Id."' AND ( Status = 'new' OR Status = 'open')";
-
-my $QueryString = '?' . $m->comp('/Elements/QueryString',
- Query => $Query,
- Order => 'DESC',
- OrderBy => 'Priority') if ($Query);
-
-</%init>
+%# DEPRECATED
+<& /Elements/ShowSearch, Name => 'My Tickets' &>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/QueueSummary
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/QueueSummary Sat Apr 16 02:41:28 2005
@@ -0,0 +1,90 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
+<tr>
+ <th class="collection-as-table" align=left><&|/l&>Queue</&></th>
+% for my $condition (@$conditions) {
+ <th class="collection-as-table" align=right><% $condition->{name} %></th>
+% }
+</tr>
+% my $i;
+% for my $queue (@queues) {
+% $i++;
+% my $queue_cond = "Queue = '$queue->{Name}' AND ";
+% my $all_q = $queue_cond . "(Status = 'open' OR Status = 'new')";
+<TR class="<% $i%2 ? 'oddline' : 'evenline'%>" >
+<td><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$all_q%>&Rows=50" TITLE="<% $queue->{Description} %>"><%$queue->{Name}%></a></TD>
+% for my $condition (@$conditions) {
+% $Tickets->FromSQL($queue_cond.$condition->{cond}),
+<td align="right"><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$queue_cond.$condition->{cond}%>&Rows=50"><% $Tickets->Count %></a></TD>
+% }
+</TR>
+% }
+</TABLE>
+<%INIT>
+my @queues;
+
+if ($cache && exists $session{$cache}) {
+ @queues = @{$session{$cache}};
+}
+else {
+ my $Queues = RT::Queues->new($session{'CurrentUser'});
+ $Queues->UnLimit();
+ @queues = map {
+ { Name => $_->Name, Description => $_->Description,
+ id => $_->Id } }
+ grep $queue_filter->($_), @{$Queues->ItemsArrayRef};
+
+ $session{$cache} = \@queues if $cache;
+}
+
+my $Tickets = RT::Tickets->new($session{'CurrentUser'});
+</%INIT>
+<%ARGS>
+$cache => undef
+$queue_filter => undef
+$conditions => ()
+</%ARGS>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/Quicksearch
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Elements/Quicksearch (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/Quicksearch Sat Apr 16 02:41:28 2005
@@ -43,45 +43,15 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Elements/TitleBoxStart, title => loc("Quick search"), bodyclass => "" &>
-
-<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
-<tr>
- <th class="collection-as-table" align=left><&|/l&>Queue</&></th>
- <th class="collection-as-table" align=right><&|/l&>New</&></th>
- <th class="collection-as-table" align=right><&|/l&>Open</&></th>
-</tr>
-
-<%PERL>
-my $i;
-while (my $queue = $Queues->Next) {
- next unless ($queue->CurrentUserHasRight('ShowTicket'));
-
- my $new_q = "Queue = '".$queue->Name."' AND Status = 'new'";
- my $open_q = "Queue = '".$queue->Name."' AND Status = 'open'";
- my $all_q = "Queue = '".$queue->Name."' AND (Status = 'open' OR Status = 'new')";
-
- $Tickets->FromSQL($open_q);
- my $open = $Tickets->Count();
-
- $Tickets->FromSQL($new_q);
- my $new = $Tickets->Count();
-
-
-
-</%PERL>
-% $i++;
-<TR class="<% $i%2 ? 'oddline' : 'evenline'%>" >
-<td><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$all_q%>&Rows=50" TITLE="<% $queue->Description %>"><%$queue->Name%></a></TD>
-<td align="right"><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$new_q%>&Rows=50"><%$new%></a></TD>
-<td align="right"><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$open_q%>&Rows=50"><%$open%></a></TD>
-</TR>
-% }
-</TABLE>
-<& /Elements/TitleBoxEnd &>
-
+<&|/Elements/TitleBox, title => loc("Quick search"), bodyclass => "",
+ titleright => loc("Customize"), titleright_href => $RT::WebPath.'/Prefs/Quicksearch.html' &>
+<& /Elements/QueueSummary,
+ cache => 'quick_search_queues',
+ queue_filter => sub { $_->CurrentUserHasRight('ShowTicket') && !exists $unwanted->{$_->Name} },
+ conditions => [ {cond => "Status = 'new'", name => loc ('new') },
+ {cond => "Status = 'open'", name => loc ('open') },
+ {cond => "Status = 'stalled'", name => loc ('stalled') }] &>
+</&>
<%INIT>
-my $Queues = RT::Queues->new($session{'CurrentUser'});
-$Queues->UnLimit();
-my $Tickets = RT::Tickets->new($session{'CurrentUser'});
+my $unwanted = $session{'CurrentUser'}->UserObj->Preferences('QuickSearch', {});
</%INIT>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/RefreshHomepage
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/RefreshHomepage Sat Apr 16 02:41:28 2005
@@ -0,0 +1,49 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<form method=get action="<%$RT::WebPath%>/index.html">
+<& /Elements/Refresh, Name => 'HomeRefreshInterval', Default => $session {'home_refresh_interval'} &>
+<div align=right><input type=submit value="<&|/l&>Go!</&>"></div>
+</form>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/ShowSearch
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/ShowSearch Sat Apr 16 02:41:28 2005
@@ -0,0 +1,93 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Elements/TitleBox,
+ title => loc($search->Description, $rows),
+ title_href => "Search/Results.html".$QueryString,
+ titleright => loc('Customize'),
+ titleright_href => $customize &>
+<& /Elements/TicketList, %$SearchArg,
+ Rows => $rows,
+ ShowNavigation => 0
+ &>
+</&>
+<%init>
+my $search;
+my $user = $session{'CurrentUser'}->UserObj;
+my $SearchArg;
+my $customize;
+
+if ($SavedSearch) {
+ my ($container_object, $search_id ) = _parse_saved_search ($SavedSearch);
+ $search = $container_object->Attributes->WithId($search_id);
+ unless ($search->Id && ref ($SearchArg = $search->Content) eq 'HASH') {
+ $m->out ("Saved Search $SavedSearch not found");
+ return;
+ }
+ $customize = $RT::WebPath.'/Search/Build.html?'.
+ $m->comp('/Elements/QueryString',
+ LoadSavedSearch => $SavedSearch);
+}
+else {
+ ($search) = RT::System->new($session{'CurrentUser'})->Attributes->Named('Search - '.$Name);
+ unless ($search->Id) {
+ $m->out ("Predefined search $Name not found");
+ return;
+ }
+ $SearchArg = $user->Preferences($search, $search->Content);
+ $customize = $RT::WebPath.'/Prefs/Search.html?'.$m->comp('/Elements/QueryString', name => ref($search).'-'.$search->Id)
+}
+
+my $rows = $SearchArg->{SummaryRows} || 10;
+$SearchArg->{'Query'} =~ s/__CurrentUser__/$session{'CurrentUser'}->Id/ge;
+$SearchArg->{'Format'} =~ s/__WebPath__/$RT::WebPath/g;
+my $QueryString = '?' . $m->comp('/Elements/QueryString',
+ map { $_ => $SearchArg->{$_} } qw(Query Order OrderBy));
+
+</%init>
+<%ARGS>
+$Name => undef
+$SavedSearch => undef
+</%ARGS>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Elements/TitleBoxStart
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Elements/TitleBoxStart (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Elements/TitleBoxStart Sat Apr 16 02:41:28 2005
@@ -63,7 +63,7 @@
<TH
<%$color && "style=\"color: $color;\""|n%>
<%$class ? "class=\"$class\"": "class=\"titleboxright\""|n%>>
- <span class="titleboxright"><%$titleright ? $titleright : ' ' |n %></span>
+ <span class="titleboxright"><% $titleright_href && "<A $title_class HREF=\"$titleright_href\">"|n%><%$titleright ? $titleright : ' ' |n %><% $titleright_href && "</A>" |n%></span>
</TH>
</TR>
<tr id="element-<%$id%>">
Added: rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/class.js
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/class.js Sat Apr 16 02:41:28 2005
@@ -0,0 +1,15 @@
+/* by TKirby, released under GPL */
+
+ function _ClassSetup(Object) {
+ this.prototype = Object;
+ return this;
+ }
+
+ function Class(name) {
+ var _newclass_;
+ eval("window."+name+" = new Function('this."+name+".apply(this,arguments);');");
+ eval("window."+name+".define = _ClassSetup;");
+ eval("_newclass_ = window."+name+";");
+ return _newclass_;
+ }
+
Added: rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/list.js
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/NoAuth/list.js Sat Apr 16 02:41:28 2005
@@ -0,0 +1,101 @@
+/* by TKirby, released under GPL */
+
+/* Define the "list" Class */
+Class("list").define({
+ name : null,
+ xml : null,
+ sels : null,
+ list : function (src, esrc, name) { this.init(src, esrc, name); },
+ read : function () {
+ var i = 0;
+ if(this.xml.readyState!=4) { setTimeout(this.name+".read()", 100); }
+ else if(this.xml.status!=200) alert("Document not available.");
+ else {
+ var doc = this.xml.responseXML;
+ var nNode = null;
+ if(doc.childNodes[0].nodeName=="parseerror") alert("Parse Error.");
+ doc = doc.getElementsByTagName("list")[0];
+ for(i=0;i<doc.childNodes.length;i++) {
+ if(doc.childNodes[i].childNodes.length>0) {
+ nNode = document.createElement("option");
+ nNode.appendChild(document.createTextNode(doc.childNodes[i].childNodes[0].nodeValue));
+ this.sels[0].appendChild(nNode);
+ }
+ }
+ }
+ },
+
+ init : function (src,esrc,name) {
+ if(!src) return;
+ this.name = name;
+ this.sels = new Array();
+ var i = 0;
+ for(i=0;i<src.childNodes.length;i++) {
+ if(src.childNodes[i].nodeName=="select" || src.childNodes[i].nodeName=="SELECT") {
+ this.sels.push(src.childNodes[i]);
+ } if((src.childNodes[i].nodeName=="input" || src.childNodes[i].nodeName=="INPUT")
+ && (src.childNodes[i].type=="button" || src.childNodes[i].type=="BUTTON")) {
+ if(src.childNodes[i].name=="add") src.childNodes[i].onclick = new Function(this.name+".add();");
+ if(src.childNodes[i].name=="remove")
+ src.childNodes[i].onclick = new Function(this.name+".remove();");
+ if(src.childNodes[i].name=="moveup")
+ src.childNodes[i].onclick = new Function(this.name+".moveup();");
+ if(src.childNodes[i].name=="movedown")
+ src.childNodes[i].onclick = new Function(this.name+".movedown();");
+ } if((src.childNodes[i].nodeName=="input" || src.childNodes[i].nodeName=="INPUT")
+ && (src.childNodes[i].type=="submit" || src.childNodes[i].type=="SUBMIT")) {
+ src.childNodes[i].onclick = new Function(this.name+".selectAll();");
+ }
+ }
+ if (esrc) {
+ this.xml = (window.navigator.appName!="Microsoft Internet Explorer"
+ ?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"));
+ this.xml.open("GET", esrc);
+ this.xml.send("");
+ setTimeout(this.name+".read()", 100);
+ }
+ },
+
+ add : function() {
+ var i, j = 0;
+ var dNode = null;
+ for(i=0;i<this.sels[0].length;i++) if(this.sels[0][i].selected) {
+ for(j=0;j<this.sels[1].length;j++) if(this.sels[1][j].value==this.sels[0][i].value) break;
+ if(j==this.sels[1].length) dNode = this.sels[0][i].cloneNode(true),
+ this.sels[1].appendChild(dNode);
+ }
+ },
+
+ moveup : function() { this.move(-1); },
+ movedown : function() { this.move(1); },
+ move : function(v) {
+ var i = 0;
+ if(v<0) for(i=0;i<this.sels[1].length;i++) this.moveOne(v, i);
+ else if(v>0) for(i=this.sels[1].length-1;i>=0;i--)this.moveOne(v, i);
+ },
+
+ moveOne : function(v, i) {
+ var ins = v + i;
+ if(ins<0 || ins>=this.sels[1].length) return;
+ if(this.sels[1][ins].selected) return;
+ if(this.sels[1][i].selected) {
+ Node = this.sels[1][i];
+ this.sels[1].removeChild(Node);
+ this.sels[1].insertBefore(Node, this.sels[1][ins]);
+ }
+ },
+
+ remove : function() {
+ var i = 0;
+ for(i=this.sels[1].length-1;i>=0;i--) if(this.sels[1][i].selected)
+ this.sels[1].removeChild(this.sels[1][i]);
+ },
+
+ selectAll: function() {
+ var i = 0;
+ for(i=0;i<this.sels[0].length;i++) this.sels[0][i].selected = false;
+ for(i=0;i<this.sels[1].length;i++) this.sels[1][i].selected = true;
+ }
+});
+
+
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/MyRT.html
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/MyRT.html Sat Apr 16 02:41:28 2005
@@ -0,0 +1,162 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => $title &>
+<& /Ticket/Elements/Tabs,
+ current_toptab => '',
+ Title => $title
+&>
+
+<script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/class.js"></script>
+<script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/list.js"></script>
+
+<& /Elements/ListActions, actions => \@actions &>
+<a href="<% $ARGS{'referer'} %>"><&|/l&>Go back</&></a><br>
+
+% for my $pane (@panes) {
+<h2><% $pane %></h2>
+<FORM METHOD="POST" ACTION="MyRT.html" name="MyRT-<% $pane %>" id="MyRT-<% $pane %>">
+<input type="hidden" name="referer" value="<%$ARGS{'referer'}%>">
+List of available items:<br>
+<select name="PortletList" multiple >
+% for (@items) {
+<option value="<% $_->[0] %>"><% $_->[1] %></option>
+% }
+</select>
+<input name="add" type="button" value="->"/>
+<select name="PortletList-<%$pane%>" multiple>
+% for (@{$current_portlets->{$pane}}) {
+<option value="<% $_ %>"><% $item_map{$_} %></option>
+% }
+</select>
+ <input name="moveup" type="button" value="^"/>
+ <input name="movedown" type="button" value="v"/>
+ <input name="remove" type="button" value="X"/>
+ <input name="submit" type="submit" value="submit"/>
+%#<& /Elements/Submit, Caption => loc("Save"), Label => loc('Save'), Name => 'Save' &>
+
+</form>
+% }
+<script type="text/javascript">
+% my $i = 1;
+% for my $pane (@panes) {
+var list<%$i%> = new list(document.getElementById("MyRT-<% $pane %>"), 0, "list<%$i%>");
+% ++$i;
+% }
+</script>
+<%INIT>
+my @actions;
+$ARGS{'referer'} ||= $ENV{'HTTP_REFERER'};
+my $title = loc("Customize").' '.loc("My RT");
+my $user = $session{'CurrentUser'}->UserObj;
+
+unless (exists $session{'my_rt_portlets'}) {
+ my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('My RT');
+ $session{'my_rt_portlets'} = $user->Preferences('My RT', $d_portlets->Content);
+}
+
+my $portlets = $session{'my_rt_portlets'};
+
+my %allowed_components = map {$_ => 1}
+ qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues RefreshHomepage);
+my @items;
+
+push @items, map {["component-$_", $_]} sort keys %allowed_components;
+
+my $sys = RT::System->new($session{'CurrentUser'});
+
+unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
+ Object=> $RT::System )) {
+ return;
+}
+
+my $groups = RT::Groups->new($session{'CurrentUser'});
+$groups->LimitToUserDefinedGroups;
+$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
+ Recursively => 1);
+for my $object ($sys, $user, @{$groups->ItemsArrayRef()}) {
+ for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
+ my ($desc, $search) = @$_;
+ if ($object eq $sys) {
+ push @items, ["system-$desc", $desc],
+ }
+ else {
+ my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id;
+ push @items, ["saved-$oid", "Saved Search: $desc"];
+ }
+ }
+}
+
+my %item_map = map {$_->[0] => $_->[1]} @items;
+
+my @panes = ('main', 'right');
+
+# build
+#if ($ARGS{'Save'}) {
+if ($ARGS{'submit'}) {
+ for my $pane (@panes) {
+ my $this = $ARGS{'PortletList-'.$pane};
+ $this = [$this] unless ref ($this);
+ next unless $ARGS{'PortletList-'.$pane};
+ $portlets->{$pane} =
+ [map { m/(\w+)-(.*)$}/;
+ # XXX: CHECK!
+ { type => $1,
+ name => $2,
+ }} @$this];
+ }
+
+ $user->SetPreferences('My RT', $portlets);
+ push @actions, loc ('Preferences saved.');
+ delete $session{'my_rt_portlets'};
+}
+
+my $current_portlets;
+for my $pane (@panes) {
+ $current_portlets->{$pane}
+ = [map {join('-',@{$_}{qw/type name/})} @{$portlets->{$pane}}];
+}
+
+</%INIT>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Quicksearch.html
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Quicksearch.html Sat Apr 16 02:41:28 2005
@@ -0,0 +1,97 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => $title &>
+<& /Ticket/Elements/Tabs,
+# current_tab => "Search/Build.html".$QueryString,
+ Title => $title
+&>
+<& /Elements/ListActions, actions => \@actions &>
+<a href="<% $ARGS{'referer'} %>"><&|/l&>Go back</&></a><br>
+
+<FORM METHOD="POST" ACTION="Quicksearch.html" NAME="Preferences">
+<input type="hidden" name="referer" value="<%$ARGS{'referer'}%>">
+
+% for my $queue (@queues) {
+<input type=checkbox name="Want-<%$queue->Name%>" value="1"
+% unless ($unwanted->{$queue->Name}) {
+CHECKED
+% }
+><%$queue->Name%>
+<br>
+
+% }
+<& /Elements/Submit, Caption => loc("Save"), Label => loc('Save'), Name => 'Save'&>
+
+</form>
+
+<%INIT>
+my @actions;
+$ARGS{'referer'} ||= $ENV{'HTTP_REFERER'};
+my $title = loc("Customize").' '.loc("Quick search");
+# The queue list is not loaded from cache, so it might be a bit inconsistent
+my $user = $session{'CurrentUser'}->UserObj;
+my $unwanted = $user->Preferences('QuickSearch', {});
+my $Queues = RT::Queues->new($session{'CurrentUser'});
+$Queues->UnLimit;
+my @queues = grep {$_->CurrentUserHasRight('ShowTicket')} @{$Queues->ItemsArrayRef};
+
+if ($ARGS{'Save'}) {
+ for my $queue (@queues) {
+ if ($ARGS{"Want-".$queue->Name}) {
+ delete $unwanted->{$queue->Name};
+ }
+ else {
+ ++$unwanted->{$queue->Name};
+ }
+ }
+
+ $user->SetPreferences('QuickSearch', $unwanted);
+ push @actions, loc ('Preferences saved.');
+ # Let QueueSummary rebuild the cache
+ delete $session{'quick_search_queues'};
+}
+
+</%INIT>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Search.html
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Prefs/Search.html Sat Apr 16 02:41:28 2005
@@ -0,0 +1,95 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => $title &>
+<& /Ticket/Elements/Tabs,
+# current_tab => "Search/Build.html".$QueryString,
+ Title => $title, %$SearchArg
+&>
+<& /Elements/ListActions, actions => \@actions &>
+<a href="<% $ARGS{'referer'} %>"><&|/l&>Go back</&></a><br>
+<FORM METHOD="POST" ACTION="Search.html" NAME="BuildQuery">
+<input type=hidden name=name value="<%$ARGS{name}%>">
+<input type=hidden name=referer value="<%$ARGS{referer}%>">
+<input type=hidden name=Format value="<%$ARGS{Format}%>">
+
+<& /Search/Elements/DisplayOptions, %$SearchArg, %ARGS,
+ AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat &>
+<& /Elements/Submit, Caption => loc("Save"), Label => loc('Save'), Name => 'Save'&>
+
+</FORM>
+
+<%INIT>
+my @actions;
+$ARGS{'referer'} ||= $ENV{'HTTP_REFERER'};
+my $title = loc("Customize").' ';
+
+my @fields = qw(Format Order OrderBy RowsPerPage);
+my ($class, $id) = $ARGS{name} =~ m/^(.*)-(\d+)$/;
+
+Abort('No search specified')
+ unless $class eq 'RT::Attribute';
+
+my $search = $class->new ($session{'CurrentUser'});
+$search->LoadById ($id);
+$title .= loc ($search->Description, 'N');
+my $user = $session{'CurrentUser'}->UserObj;
+my $SearchArg = $user->Preferences($search, $search->Content);
+for (@fields) {
+ $ARGS{$_} = $SearchArg->{$_} unless defined $ARGS{$_};
+}
+my ( $AvailableColumns, $CurrentFormat );
+( $ARGS{Format}, $AvailableColumns, $CurrentFormat ) = $m->comp(
+ '/Search/Elements/BuildFormatString',
+ cfqueues => {}, %ARGS
+);
+
+if ($ARGS{'Save'}) {
+ my $hash = {map { $_ => $ARGS{$_}} @fields};
+ my $pref = $user->SetPreferences ($search, $hash);
+ push @actions, loc ('Preferences saved.');
+}
+
+</%INIT>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Search/Build.html
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Search/Build.html (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Search/Build.html Sat Apr 16 02:41:28 2005
@@ -151,35 +151,51 @@
# Clean unwanted junk from the format
$Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format);
+sub _load_container_object {
+ my ($obj_type, $obj_id) = @_;
+ if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id) {
+ return $session{'CurrentUser'}->UserObj;
+ }
+ elsif ($obj_type eq 'RT::Group') {
+ my $group = RT::Group->new($session{'CurrentUser'});
+ $group->Load($obj_id);
+ return $group;
+ }
+ elsif ($obj_type eq 'RT::System') {
+ # XXX: check hasright
+ return RT::System->new($session{'CurrentUser'});
+ }
+ else {
+# push( @actions, [ loc("error: Invalid object type"), -1 ] );
+ }
+
+}
+
+sub _parse_saved_search {
+ my $spec = shift;
+ if ($spec !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
+# push( @actions, [ loc("error: Invalid argument"), -1 ] );
+ return;
+ }
+ my $obj_type = $1;
+ my $obj_id = $2;
+ my $search_id = $3;
+
+ return (_load_container_object ($obj_type, $obj_id), $search_id);
+}
+
# {{{ If we're asked to delete the current search, make it go away and reset the search parameters
if ( $ARGS{'Delete'} ) {
# We set $SearchId to 'new' above already, so peek into the %ARGS
- if ( $ARGS{'SearchId'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
- my $obj_type = $1;
- my $obj_id = $2;
- my $search_id = $3;
-
- my $container_object;
- if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id )
- {
- $container_object = $session{'CurrentUser'}->UserObj;
- }
- elsif ( $obj_type eq 'RT::Group' ) {
- $container_object = RT::Group->new( $session{'CurrentUser'} );
- $container_object->Load($obj_id);
- }
-
- if ( $container_object->id ) {
-
- # We have the object the entry is an attribute on; delete
- # the entry..
- $container_object->Attributes->DeleteEntry(
- Name => 'SavedSearch',
- id => $search_id
+ my ($container_object, $search_id) = _parse_saved_search ($ARGS{'SearchId'});
+ if ($container_object && $container_object->id) {
+ # We have the object the entry is an attribute on; delete the
+ # entry..
+ $container_object->Attributes->DeleteEntry(
+ Name => 'SavedSearch',
+ id => $search_id
);
- }
-
}
}
@@ -203,25 +219,8 @@
# {{{ if we're asked to load a search, load it.
-if ( $ARGS{'LoadSavedSearch'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
- my $obj_type = $1;
- my $obj_id = $2;
- my $search_id = $3;
-
- # We explicitly list out the available types (user and group) and
- # don't trust user input here
- if ( ( $obj_type eq 'RT::User' )
- && ( $obj_id == $session{'CurrentUser'}->id ) )
- {
- $search =
- $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id);
-
- }
- elsif ( $obj_type eq 'RT::Group' ) {
- my $group = RT::Group->new( $session{'CurrentUser'} );
- $group->Load($obj_id);
- $search = $group->Attributes->WithId($search_id);
- }
+if ( my ($container_object, $search_id ) = _parse_saved_search ($ARGS{'LoadSavedSearch'})) {
+ $search = $container_object->Attributes->WithId($search_id);
# We have a $search and now; import the others
$SearchId = $ARGS{'LoadSavedSearch'};
@@ -775,21 +774,12 @@
}
elsif ( $SearchId eq 'new' && $ARGS{'Owner'} =~ /^(.*?)-(\d+)$/ ) {
-
# We're saving a new search
my $obj_type = $1;
my $obj_id = $2;
# Find out if we're saving on the user, or a group
- my $container_object;
- if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id )
- {
- $container_object = $session{'CurrentUser'}->UserObj;
- }
- elsif ( $obj_type eq 'RT::Group' ) {
- $container_object = RT::Group->new( $session{'CurrentUser'} );
- $container_object->Load($obj_id);
- }
+ my $container_object = _load_container_object ($obj_type, $obj_id);
if ( $container_object->id ) {
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/EditSearches
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/EditSearches (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/EditSearches Sat Apr 16 02:41:28 2005
@@ -92,7 +92,10 @@
$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
Recursively => 1);
- push (@Objects, @{$groups->ItemsArrayRef()});
+push (@Objects, @{$groups->ItemsArrayRef()});
+push @Objects, RT::System->new($session{'CurrentUser'})
+ if $session{'CurrentUser'}->HasRight( Object=> $RT::System,
+ Right => 'SuperUser');
</%INIT>
<%ARGS>
Added: rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SearchesForObject
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SearchesForObject Sat Apr 16 02:41:28 2005
@@ -0,0 +1,63 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Object => undef
+</%args>
+<%init>
+# Returns an array of search objects associated on $Object,
+# in the form of [Description, searchObj]
+my @result;
+while (my $search = $Object->Attributes->Next) {
+ my $desc;
+ if ($search->Name eq 'SavedSearch') {
+ push @result, [$search->Description, $search];
+ }
+ elsif ($search->Name =~ m/^Search - (.*)/) {
+ push @result, [$1, $search];
+ }
+}
+return @result;
+</%init>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SelectSearchesForObjects
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SelectSearchesForObjects (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/Search/Elements/SelectSearchesForObjects Sat Apr 16 02:41:28 2005
@@ -55,9 +55,9 @@
<option value=""></option>
<option value=""><&|/l, $object->Name&>[_1]'s saved searches</&></option>
% }
-% my @searches = $object->Attributes->Named('SavedSearch');
-% foreach my $search (@searches) {
-<option value="<%ref($object)%>-<%$object->id%>-SavedSearch-<%$search->Id%>"> -<%$search->Description||loc('Unnamed search')%></option>
+% foreach ($m->comp("SearchesForObject", Object => $object)) {
+% my ($desc, $search) = @$_;
+<option value="<%ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id%>"> -<%$desc||loc('Unnamed search')%></option>
% }
% }
</select>
Modified: rt/branches/PLATANO-EXPERIMENTAL/html/index.html
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/html/index.html (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/html/index.html Sat Apr 16 02:41:28 2005
@@ -74,29 +74,7 @@
current_toptab => '',
Title=>loc("RT at a glance") &>
<& /Elements/ListActions, actions => \@results &>
-
-
-<div class="right-column">
-<& /Elements/Quicksearch &>
-
-<div class="page-refresh">
-<form method="get" action="<%$RT::WebPath%>/index.html">
-<& /Elements/Refresh, Name => 'HomeRefreshInterval', Default => $session {'home_refresh_interval'} &>
-<input type="submit" value="<&|/l&>Go!</&>" />
-</form>
-</div>
-
-</div>
-
-<& /Elements/MyTickets &>
-<BR>
-<& /Elements/MyRequests &>
-<BR>
-<& /Elements/QuickCreate &>
-
-</TD>
-</TR>
-</TABLE>
+<& /Elements/MyRT &>
<%init>
my @results;
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/RT/Attribute_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/RT/Attribute_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/RT/Attribute_Overlay.pm Sat Apr 16 02:41:28 2005
@@ -312,7 +312,10 @@
my $attr2 = RT::Attribute->new($RT::SystemUser);
$attr2->Load($id);
is ($attr2->SubValue('Format'), 'This is a format');
-
+$attr2->Delete;
+my $attr3 = RT::Attribute->new($RT::SystemUser);
+my ($id) = $attr3->Load($id);
+is ($id, 0);
=end testing
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/RT/System.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/RT/System.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/RT/System.pm Sat Apr 16 02:41:28 2005
@@ -63,7 +63,7 @@
package RT::System;
-use base qw /RT::Base/;
+use base qw /RT::Record/;
use strict;
use RT::ACL;
@@ -132,22 +132,9 @@
return(\%rights);
}
-
-=head2 new
-
-Create a new RT::System object. Really, you should be using $RT::System
-
-=cut
-
-
-sub new {
- my $proto = shift;
- my $class = ref($proto) || $proto;
- my $self = {};
- bless( $self, $class );
-
-
- return ($self);
+sub _Init {
+ my $self = shift;
+ $self->SUPER::_Init (@_) if @_ && $_[0];
}
=head2 id
@@ -184,6 +171,15 @@
return (1);
}
+sub Name {
+ return 'RT System';
+}
+
+sub __Set { 0 }
+sub __Value { 0 }
+sub Create { 0 }
+sub Delete { 0 }
+
eval "require RT::System_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/System_Vendor.pm});
eval "require RT::System_Local";
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/RT/User_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/RT/User_Overlay.pm Sat Apr 16 02:41:28 2005
@@ -1580,6 +1580,50 @@
return ( $self->CurrentUser->HasRight(Right => $right, Object => $RT::System) );
}
+sub _PrefName {
+ my $name = shift;
+ if (ref $name) {
+ $name = ref ($name).'-'.$name->Id;
+ }
+
+ return 'Pref-'.$name;
+}
+
+# {{{ sub Preferences
+
+=head2 Preferences NAME/OBJ DEFAULT
+
+ Obtain user preferences associated with given object or name.
+ Returns DEFAULT if no preferences found. If DEFAULT is a hashref,
+ override the entries with user preferences.
+
+=cut
+
+sub Preferences {
+ my $self = shift;
+ my $name = _PrefName (shift);
+ my $default = shift;
+
+ my $attr = RT::Attribute->new ($self->CurrentUser);
+ $attr->LoadByNameAndObject (Object => $self, Name => $name);
+
+ my $content = $attr->Id ? $attr->Content : undef;
+ if (ref ($content) eq 'HASH') {
+ if (ref ($default) eq 'HASH') {
+ for (keys %$default) {
+ exists $content->{$_} or $content->{$_} = $default->{$_};
+ }
+ }
+ elsif (defined $default) {
+ $RT::Logger->error("Preferences $name for user".$self->Id." is hash but default is not");
+ }
+ return $content;
+ }
+ else {
+ return defined $content ? $content : $default;
+ }
+}
+
# }}}
# {{{ sub _CleanupInvalidDelegations
@@ -1653,6 +1697,30 @@
# }}}
+# {{{ sub SetPreferences
+
+=head2 SetPreferences NAME/OBJ VALUE
+
+ Set user preferences associated with given object or name.
+
+=cut
+
+sub SetPreferences {
+ my $self = shift;
+ my $name = _PrefName (shift);
+ my $value = shift;
+ my $attr = RT::Attribute->new ($self->CurrentUser);
+ $attr->LoadByNameAndObject (Object => $self, Name => $name);
+ if ($attr->Id) {
+ return $attr->SetContent ($value);
+ }
+ else {
+ return $self->AddAttribute ( Name => $name, Content => $value );
+ }
+}
+
+# }}}
+
# {{{ sub _Set
sub _Set {
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/06mailgateway.t (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/06mailgateway.t Sat Apr 16 02:41:28 2005
@@ -51,11 +51,14 @@
=cut
-use Test::More qw/no_plan/;
+use Test::More tests => 57;
use RT;
RT::LoadConfig();
RT::Init();
use RT::I18N;
+no warnings 'once';
+my $url = "http://localhost:".$RT::WebPort.$RT::WebPath."/";
+
# Make sure that when we call the mailgate wrong, it tempfails
ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://this.test.for.non-connection.is.expected.to.generate.an.error"), "Opened the mailgate - The error below is expected - $@");
@@ -74,7 +77,7 @@
# {{{ Test new ticket creation by root who is privileged and superuser
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --debug --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --debug --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: root\@localhost
To: rt\@example.com
@@ -102,7 +105,7 @@
# {{{This is a test of new ticket creation as an unknown user
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist\@example.com
To: rt\@example.com
@@ -138,7 +141,7 @@
ok ($val, "Granted everybody the right to create tickets - $msg");
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist\@example.com
To: rt\@example.com
@@ -171,7 +174,7 @@
#($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
#ok ($val, "Granted everybody the right to create tickets - $msg");
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist-2\@example.com
To: rt\@example.com
@@ -196,7 +199,7 @@
($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'ReplyToTicket');
ok ($val, "Granted everybody the right to reply to tickets - $msg");
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist-2\@example.com
To: rt\@example.com
@@ -222,7 +225,7 @@
#($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
#ok ($val, "Granted everybody the right to create tickets - $msg");
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action comment"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist-3\@example.com
To: rt\@example.com
@@ -247,7 +250,7 @@
($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CommentOnTicket');
ok ($val, "Granted everybody the right to reply to tickets - $msg");
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action comment"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: doesnotexist-3\@example.com
To: rt\@example.com
@@ -288,7 +291,7 @@
Encoding => 'base64');
# Create a ticket with a binary attachment
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
$entity->print(\*MAIL);
@@ -333,7 +336,7 @@
# Grab the binary attachment via the web ui
my $ua = LWP::UserAgent->new();
-my $full_url = "http://localhost".$RT::WebPath."/Ticket/Attachment/".$attachment->TransactionId."/".$attachment->id."/bplogo.gif?&user=root&pass=password";
+my $full_url = "$url/Ticket/Attachment/".$attachment->TransactionId."/".$attachment->id."/bplogo.gif?&user=root&pass=password";
my $r = $ua->get( $full_url);
@@ -346,7 +349,7 @@
# {{{ Simple I18N testing
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: root\@localhost
@@ -380,7 +383,7 @@
ok($unitick->Transactions->First->Attachments->First->Content =~ /$unistring/i, $unitick->Id." appears to be unicode ". $unitick->Transactions->First->Attachments->First->Id);
# supposedly I18N fails on the second message sent in.
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: root\@localhost
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/07acl.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/07acl.t (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/07acl.t Sat Apr 16 02:41:28 2005
@@ -3,7 +3,7 @@
use WWW::Mechanize;
use HTTP::Cookies;
-use Test::More qw/no_plan/;
+use Test::More tests => 26;
use RT;
RT::LoadConfig();
RT::Init();
@@ -27,9 +27,9 @@
$agent->cookie_jar($cookie_jar);
-
+no warnings 'once';
# get the top page
-my $url = "http://localhost".$RT::WebPath."/";
+my $url = "http://localhost:".$RT::WebPort.$RT::WebPath."/";
$agent->get($url);
is ($agent->{'status'}, 200, "Loaded a page - http://localhost".$RT::WebPath);
Modified: rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/08web_cf_access.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/08web_cf_access.t (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/08web_cf_access.t Sat Apr 16 02:41:28 2005
@@ -1,14 +1,16 @@
#!/usr/bin/perl -w
use strict;
-use Test::More qw/no_plan/;
-use RT;
-RT::LoadConfig;
-RT::Init;
+use Test::More tests => 15;
+BEGIN {
+ use RT;
+ RT::LoadConfig;
+ RT::Init;
+}
use Test::WWW::Mechanize;
$RT::WebPath ||= ''; # Shut up a warning
-use constant BaseURL => "http://localhost".$RT::WebPath."/";
+use constant BaseURL => "http://localhost:".$RT::WebPort.$RT::WebPath."/";
use constant ImageFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
use constant ImageFileContent => do {
local $/;
Added: rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/17custom_search.t
==============================================================================
--- (empty file)
+++ rt/branches/PLATANO-EXPERIMENTAL/lib/t/regression/17custom_search.t Sat Apr 16 02:41:28 2005
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+use strict;
+
+use Test::More tests => 10;
+BEGIN {
+ use RT;
+ RT::LoadConfig;
+ RT::Init;
+}
+use Test::WWW::Mechanize;
+
+$RT::WebPath ||= ''; # Shut up a warning
+use constant BaseURL => "http://localhost:".$RT::WebPort.$RT::WebPath."/";
+
+# reset preferences for easier test?
+
+my $t = RT::Ticket->new($RT::SystemUser);
+$t->Create(Subject => 'for custom search', Queue => 'general',
+ Owner => 'root', Requestor => 'customsearch at localhost');
+ok(my $id = $t->id, 'created ticket for custom search');
+
+my $m = Test::WWW::Mechanize->new ( autocheck => 1 );
+isa_ok($m, 'Test::WWW::Mechanize');
+
+$m->get( BaseURL."?user=root;pass=password" );
+$m->content_like(qr/Logout/, 'we did log in');
+
+my $t_link = $m->find_link( text => "for custom search" );
+like ($t_link->url, qr/$id/, 'link to the ticket we created');
+
+$m->content_lacks ('customsearch at localhost', 'requestor not displayed ');
+
+my ($cus_hp, undef, $cus_qs) = $m->find_all_links( text => "Customize" );
+$m->get ($cus_hp);
+$m->content_like (qr'highest priority tickets');
+
+# add Requestor to the fields
+$m->form_name ('BuildQuery');
+# can't use submit form for mutli-valued select as it uses set_fields
+$m->field (SelectDisplayColumns => ['Requestors']);
+$m->click_button (name => 'AddCol') ;
+
+$m->form_name ('BuildQuery');
+$m->click_button (name => 'Save');
+
+$m->follow_link (text => 'Go back') or die;
+$m->content_contains ('customsearch at localhost', 'requestor now displayed ');
+
+
+# now remove Requestor from the fields
+$m->get ($cus_hp);
+
+$m->form_name ('BuildQuery');
+$m->field (CurrentDisplayColumns => 'Requestors');
+$m->click_button (name => 'RemoveCol') ;
+
+$m->form_name ('BuildQuery');
+$m->click_button (name => 'Save');
+
+$m->follow_link (text => 'Go back') or die;
+$m->content_lacks ('customsearch at localhost', 'requestor not displayed ');
+
+
+# try to disable General from quick search
+
+# Note that there's a small problem in the current implementation,
+# since ticked quese are wanted, we do the invesrsion. So any
+# queue added during the quicksearch setting will be unticked.
+my $nlinks = $#{$m->find_all_links( text => "General" )};
+warn $nlinks;
+$m->get ($cus_qs);
+$m->form_name ('Preferences');
+$m->untick('Want-General', '1');
+$m->click_button (name => 'Save');
+
+$m->follow_link (text => 'Go back') or die;
+is ($#{$m->find_all_links( text => "General" )}, $nlinks - 1,
+ 'General gone from quicksearch list');
+
+# get it back
+$m->get ($cus_qs);
+$m->form_name ('Preferences');
+$m->tick('Want-General', '1');
+$m->click_button (name => 'Save');
+
+$m->follow_link (text => 'Go back') or die;
+is ($#{$m->find_all_links( text => "General" )}, $nlinks,
+ 'General back in quicksearch list');
Modified: rt/branches/PLATANO-EXPERIMENTAL/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL/sbin/rt-setup-database.in (original)
+++ rt/branches/PLATANO-EXPERIMENTAL/sbin/rt-setup-database.in Sat Apr 16 02:41:28 2005
@@ -47,7 +47,7 @@
use strict;
use vars qw($PROMPT $VERSION $Handle $Nobody $SystemUser $item);
use vars
- qw(@Groups @Users @ACL @Queues @ScripActions @ScripConditions @Templates @CustomFields @Scrips);
+ qw(@Groups @Users @ACL @Queues @ScripActions @ScripConditions @Templates @CustomFields @Scrips @Attributes);
use lib "@RT_LIB_PATH@";
@@ -615,6 +615,23 @@
}
print "done.\n";
}
+ if (@Attributes) {
+ print "Creating predefined searches...";
+ my $sys = RT::System->new($CurrentUser);
+
+ for $item (@Attributes) {
+ my $obj = delete $item->{Object}; # XXX: make this something loadable
+ $obj ||= $sys;
+ my ( $return, $msg ) = $obj->AddAttribute (%$item);
+ if ($return) {
+ print $return. ".";
+ }
+ else {
+ print "(Error: $msg)\n";
+ }
+ }
+ print "done.\n";
+ }
$RT::Handle->Disconnect() unless ($RT::DatabaseType eq 'SQLite');
print "Done setting up database content.\n";
}
More information about the Rt-commit
mailing list