<& /Admin/Elements/Header, Title => $title &> <& /Admin/Elements/UserTabs, id => $id, UserObj => $UserObj, current_tab => $current_tab, Title => $title &> <& /Widgets/SelectionBox:header, nojs => 1 &> <& /Elements/ListActions, actions => \@actions &>
% for my $pane (@panes) { <&|/Widgets/TitleBox, title => loc('RT at a glance').': '.loc($pane->{Name}), bodyclass => "" &> <& /Widgets/SelectionBox:show, self => $pane, nojs => 1 &>
% } <%init> my $current_tab = 'Admin/Users/MyRT.html?id='.$id; my $UserObj = new RT::User($session{'CurrentUser'}); $UserObj->Load($id) || Abort("Couldn't load user '$id'"); my $title = loc("RT at a glance for the user [_1]", $UserObj->Name); if ($ARGS{Reset}) { $UserObj->SetPreferences('HomepageSettings', {}); } my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings'); my $portlets = $UserObj->Preferences('HomepageSettings', $default_portlets ? $default_portlets->Content : {}); my %allowed_components = map {$_ => 1} @{$RT::HomepageComponents}; my @items; push @items, map {["component-$_", $_]} sort keys %allowed_components; my $sys = RT::System->new( RT::CurrentUser->new($UserObj) ); my @objs = ($sys); push @objs, RT::SavedSearches->new( RT::CurrentUser->new( $UserObj ) )->_PrivacyObjects; my @actions; for my $object (@objs) { for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) { my ($desc, $search) = @$_; my $SearchType = $search->Content->{'SearchType'} || 'Ticket'; if ($object eq $sys && $SearchType eq 'Ticket') { push @items, ["system-$desc", $desc]; } else { my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id; my $type = ($SearchType eq 'Ticket') ? 'Saved Search' : $SearchType; # loc push @items, ["saved-$oid", loc($type).": $desc"]; } } } my @panes = $m->comp( '/Admin/Elements/ConfigureMyRT', panes => ['body', 'summary'], Action => "MyRT.html?id=$id", items => \@items, current_portlets => $portlets, OnSave => sub { my ( $conf, $pane ) = @_; $UserObj->SetPreferences( 'HomepageSettings', $conf ); push @actions, loc( 'Preferences [_1] for user [_2] .', $pane, $UserObj->Name ); } ); $m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_, nojs => 1 ) for @panes; <%ARGS> $id => undef