[Rt-commit] r6827 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.2: .
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jan 26 13:03:34 EST 2007
Author: ruz
Date: Fri Jan 26 13:03:33 2007
New Revision: 6827
Modified:
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/ (props changed)
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/MyRT
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/ShowSearch
Log:
r4303 at cubic-pc (orig r6657): ruz | 2006-12-20 00:22:29 +0300
* add %Override option to html/Elements/ShowSearch
* html/Elements/MyRT should limit results according to user's preferences
Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/MyRT
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/MyRT (original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/MyRT Fri Jan 26 13:03:33 2007
@@ -62,18 +62,19 @@
# XXX: we don't use this, but should.
my %allowed_components = map {$_ => 1} @{RT->Config->Get('HomepageComponents')};
+my $user = $session{'CurrentUser'}->UserObj;
$Portlets ||= $session{'my_rt_portlets'};
unless ( $Portlets ) {
my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
- $Portlets = $session{'my_rt_portlets'} =
- $session{'CurrentUser'}->UserObj->Preferences(
- 'HomepageSettings',
- $default_portlets? $default_portlets->Content: {},
- );
+ $Portlets = $session{'my_rt_portlets'} = $user->Preferences(
+ HomepageSettings => $default_portlets? $default_portlets->Content: {},
+ );
}
my $two_columns = $Portlets->{summary} && @{$Portlets->{summary}};
+my $Rows = $user->Preferences( 'SummaryRows', ( RT->Config->Get('DefaultSummaryRows') || 10 ) );
+
my $show_cb = sub {
my $entry = shift;
my $type = $entry->{type};
@@ -82,9 +83,9 @@
# XXX: security check etc.
$m->comp( $name, %{ $entry->{arguments} || {} } );
} elsif ( $type eq 'system' ) {
- $m->comp( '/Elements/ShowSearch', Name => $name );
+ $m->comp( '/Elements/ShowSearch', Name => $name, Override => { Rows => $Rows } );
} elsif ( $type eq 'saved' ) {
- $m->comp( '/Elements/ShowSearch', SavedSearch => $name );
+ $m->comp( '/Elements/ShowSearch', SavedSearch => $name, Override => { Rows => $Rows } );
} else {
$RT::Logger->error("unknown portlet type '$type'");
}
Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/ShowSearch
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/ShowSearch (original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/html/Elements/ShowSearch Fri Jan 26 13:03:33 2007
@@ -91,11 +91,12 @@
}
$SearchArg = $user->Preferences( $search, $search->Content );
- $SearchArg->{'Rows'} = $user->Preferences('SummaryRows', RT->Config->Get('DefaultSummaryRows'));
$customize = RT->Config->Get('WebPath') . '/Prefs/Search.html?'
. $m->comp( '/Elements/QueryString', name => ref($search) . '-' . $search->Id );
}
+$SearchArg = { %$SearchArg, %Override } if keys %Override;
+
$SearchArg->{'Query'} =~ s/__CurrentUser__/$session{'CurrentUser'}->Id/ge;
$SearchArg->{'Format'} =~ s/__(Web(?:Path|Base|BaseURL))__/RT->Config->Get($1)/ge;
$SearchArg->{'Format'} =~ s/__loc\(["']?(\w+)["']?\)__/loc("$1")/ge;
@@ -111,6 +112,7 @@
</%init>
<%ARGS>
-$Name => undef
+$Name => undef
$SavedSearch => undef
+%Override => ()
</%ARGS>
More information about the Rt-commit
mailing list