[Rt-commit] r6568 - in rt/branches/3.6-RELEASE: . html/Admin/Users
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 1 13:56:26 EST 2006
Author: jesse
Date: Fri Dec 1 13:56:25 2006
New Revision: 6568
Added:
rt/branches/3.6-RELEASE/html/Admin/Users/MyRT.html
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/html/Admin/Elements/UserTabs
Log:
r45293 at pinglin (orig r6503): clkao | 2006-11-22 12:39:59 -0500
Allow editing myrt prefs for individual user.
Modified: rt/branches/3.6-RELEASE/html/Admin/Elements/UserTabs
==============================================================================
--- rt/branches/3.6-RELEASE/html/Admin/Elements/UserTabs (original)
+++ rt/branches/3.6-RELEASE/html/Admin/Elements/UserTabs Fri Dec 1 13:56:25 2006
@@ -64,6 +64,9 @@
History => { title => loc('History'),
path => "Admin/Users/History.html?id=".$id
},
+ 'MyRT' => { title => loc('RT at a glance'),
+ path => "Admin/Users/MyRT.html?id=".$id
+ },
# Scrips => { title => loc('Rights'),
# path => "Admin/Users/Rights.html?id=".$id
# }
Added: rt/branches/3.6-RELEASE/html/Admin/Users/MyRT.html
==============================================================================
--- (empty file)
+++ rt/branches/3.6-RELEASE/html/Admin/Users/MyRT.html Fri Dec 1 13:56:25 2006
@@ -0,0 +1,84 @@
+<& /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 &>
+
+<form method="post" action="MyRT.html">
+<input type="hidden" name="Reset" value="1" />
+<input type="submit" class="button" value="<%loc('Reset to default')%>">
+</form>
+
+<br />
+
+% for my $pane (@panes) {
+<&|/Widgets/TitleBox, title => loc('RT at a glance').': '.loc($pane->{Name}), bodyclass => "" &>
+<& /Widgets/SelectionBox:show, self => $pane, nojs => 1 &></&>
+<br />
+% }
+
+<%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;
+
+</%init>
+<%ARGS>
+$id => undef
+</%ARGS>
More information about the Rt-commit
mailing list