[Rt-commit] r6551 - in rt/branches/3.6-RELEASE: . html/Elements
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 1 13:48:56 EST 2006
Author: jesse
Date: Fri Dec 1 13:48:55 2006
New Revision: 6551
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/html/Elements/ShowSearch
rt/branches/3.6-RELEASE/html/Search/Chart.html
Log:
r45273 at pinglin (orig r6483): clkao | 2006-11-21 14:31:42 -0500
First cut of savable chart.
* Search/Chart.html: build form for saving current chart into
saved search, with type "Chart". This makes the saved search
shows up in MyRT prefs.
* Elements/ShowSearch: when showing a saved search that is not
of type "Ticket", dispatch to different handler.
Modified: rt/branches/3.6-RELEASE/html/Elements/ShowSearch
==============================================================================
--- rt/branches/3.6-RELEASE/html/Elements/ShowSearch (original)
+++ rt/branches/3.6-RELEASE/html/Elements/ShowSearch Fri Dec 1 13:48:55 2006
@@ -65,6 +65,11 @@
$m->out ("Saved Search $SavedSearch not found");
return;
}
+ if ( $SearchArg->{SearchType} ne 'Ticket' ) {
+ # XXX: dispatch to different handler here
+ $m->comp( '/Search/Elements/Chart', %$SearchArg );
+ $m->abort;
+ }
$customize = $RT::WebPath.'/Search/Build.html?'.
$m->comp('/Elements/QueryString',
LoadSavedSearch => $SavedSearch);
Modified: rt/branches/3.6-RELEASE/html/Search/Chart.html
==============================================================================
--- rt/branches/3.6-RELEASE/html/Search/Chart.html (original)
+++ rt/branches/3.6-RELEASE/html/Search/Chart.html Fri Dec 1 13:48:55 2006
@@ -46,12 +46,71 @@
<%args>
$Query => "id > 0"
$PrimaryGroupBy => 'Queue'
+$SecondaryGroupBy => undef
+$ChartStyle => 'bars'
+$Description => undef
+
</%args>
<%init>
my $title = loc("Search results grouped by [_1]", $PrimaryGroupBy);
+my @Objects;
+
+push @Objects, $session{CurrentUser}->UserObj;
+
+my $groups = RT::Groups->new($session{'CurrentUser'});
+
+$groups->LimitToUserDefinedGroups;
+$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
+ Recursively => 1);
+
+push (@Objects, @{$groups->ItemsArrayRef()});
+push @Objects, RT::System->new($session{'CurrentUser'})
+ if $session{'CurrentUser'}->HasRight( Object=> $RT::System,
+ Right => 'SuperUser');
+
+if ( $ARGS{Save} ) {
+ if ( $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 = _load_container_object( $obj_type, $obj_id );
+ warn 'orz';
+ my ( $search_id, $search_msg ) = $container_object->AddAttribute(
+ Name => 'SavedSearch',
+ Description => $Description,
+ Content => {
+ Query => $Query,
+ SearchType => 'Chart',
+ PrimaryGroupBy => $PrimaryGroupBy,
+ SecondaryGroupBy => $SecondaryGroupBy,
+ ChartStyle => $ChartStyle,
+
+ }
+ );
+
+ }
+}
+
</%init>
<& /Elements/Header, Title => $title &>
<& /Ticket/Elements/Tabs, Title => $title &>
<& /Search/Elements/Chart, %ARGS &>
+
+<form method="post" action="Chart.html" name="SaveChart">
+
+<& Elements/SelectSearchObject, Name => 'Owner', Objects => \@Objects &><br />
+
+<&|/l&>Description</&>:<br>
+<font size="-1"><input size="25" name="Description" value="" /></font>
+<input type="hidden" class="hidden" name="Query" value="<%$Query%>" />
+<input type="hidden" class="hidden" name="PrimaryGroupBy" value="<%$PrimaryGroupBy%>" />
+<input type="hidden" class="hidden" name="SecondaryGroupBy" value="<%$SecondaryGroupBy%>" />
+<input type="hidden" class="hidden" name="ChartStyle" value="<%$ChartStyle%>" />
+
+<input type="submit" name="Save" value="<%loc('Save')%>" class="button" />
+</form>
More information about the Rt-commit
mailing list