[Rt-commit] rt branch, admin_ui, updated. 2d9e7d64bd2b126e7c3c8bef2fd141200f6a6039
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jan 22 00:16:18 EST 2010
The branch, admin_ui has been updated
via 2d9e7d64bd2b126e7c3c8bef2fd141200f6a6039 (commit)
from bbc4a2e2c04e2a4b55bef630e5fdd4e12a393400 (commit)
Summary of changes:
lib/RT/Action/ConfigMyRT.pm | 39 ++++++++++++++++++++++++++-------------
1 files changed, 26 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 2d9e7d64bd2b126e7c3c8bef2fd141200f6a6039
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jan 22 13:16:01 2010 +0800
fix ConfigMyRT action to work on both /prefs and /admin/global
diff --git a/lib/RT/Action/ConfigMyRT.pm b/lib/RT/Action/ConfigMyRT.pm
index 2f6c581..27f27ba 100644
--- a/lib/RT/Action/ConfigMyRT.pm
+++ b/lib/RT/Action/ConfigMyRT.pm
@@ -79,6 +79,8 @@ sub take_action {
if ( $self->argument_value('reset') && $record_class ne 'RT::System' ) {
$self->record->set_preferences('HomepageSettings', {});
+ Jifty->web->session->set( 'my_rt_portlets',
+ $self->record->attributes->named('HomepageSettings') );
}
else {
if ( $self->argument_value('summary_rows')
@@ -115,6 +117,7 @@ sub take_action {
}
else {
$self->record->set_preferences( 'HomepageSettings' => $content );
+ Jifty->web->session->set( 'my_rt_portlets', $content );
}
}
$self->report_success;
@@ -128,19 +131,29 @@ sub available_values {
my @items =
map { { value => "component-$_", display => $_ } }
sort @{ RT->config->get('homepage_components') };
- my $sys = RT->system;
- for ( $sys->saved_searches ) {
- my ( $desc, $search ) = @$_;
- my $SearchType = $search->content->{'SearchType'} || 'Ticket';
- if ( $SearchType eq 'Ticket' ) {
- push @items, { value => "system-$desc", display => $desc };
- }
- else {
- my $oid =
- ref($sys) . '-' . $sys->id . '-SavedSearch-' . $search->id;
- my $type =
- ( $SearchType eq 'Ticket' ) ? _('Saved Search') : $SearchType;
- push @items, { value => "saved-$oid", display => _($type) . ": $desc" };
+
+ my @objs = RT->system;
+ push @objs, RT::SavedSearches->new()->_privacy_objects
+ if ref $self->record ne 'RT::System' && Jifty->web->current_user->has_right(
+ right => 'LoadSavedSearch',
+ object => RT->system
+ );
+
+ for my $obj (@objs) {
+ for ( $obj->saved_searches ) {
+ my ( $desc, $search ) = @$_;
+ my $SearchType = $search->content->{'SearchType'} || 'Ticket';
+ if ( ref $obj eq 'RT::System' && $SearchType eq 'Ticket' ) {
+ push @items, { value => "system-$desc", display => $desc };
+ }
+ else {
+ my $oid =
+ ref($obj) . '-' . $obj->id . '-SavedSearch-' . $search->id;
+ my $type =
+ ( $SearchType eq 'Ticket' ) ? _('Saved Search') : $SearchType;
+ push @items,
+ { value => "saved-$oid", display => _($type) . ": $desc" };
+ }
}
}
return \@items;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list