[Rt-commit] r15701 - in rt/3.8/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Tue Sep 2 22:12:49 EDT 2008
Author: sartak
Date: Tue Sep 2 22:12:47 2008
New Revision: 15701
Modified:
rt/3.8/trunk/ (props changed)
rt/3.8/trunk/share/html/Dashboards/Queries.html
Log:
r70872 at onn: sartak | 2008-09-02 20:50:26 -0400
Refactor Queries so it can support different kinds of things (to add components)
Modified: rt/3.8/trunk/share/html/Dashboards/Queries.html
==============================================================================
--- rt/3.8/trunk/share/html/Dashboards/Queries.html (original)
+++ rt/3.8/trunk/share/html/Dashboards/Queries.html Tue Sep 2 22:12:47 2008
@@ -98,7 +98,7 @@
# Get the list of queries already in use
for ($Dashboard->SearchIds) {
my ($privacy, $id, $desc) = @$_;
- my $name = "$id-$privacy";
+ my $name = "search-$id-$privacy";
push @selected, $name;
$desc_of{$name} = $desc;
}
@@ -115,7 +115,7 @@
my ($desc, $search) = @$_;
my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
my $privacy = $Dashboard->_build_privacy($object);
- my $name = $search->Id . '-' . $privacy;
+ my $name = 'search-' . $search->Id . '-' . $privacy;
push @items, [$name, $desc];
$desc_of{$name} = $desc;
}
@@ -132,13 +132,20 @@
OnSubmit => sub {
my $self = shift;
+ my @searches;
# transform list of "SearchID-PrivacyObjType-PrivacyObjID"s to
# list of [Privacy, SearchID, Description]s
- my $searches = [ map {
- [ reverse(split /-/, $_, 2), $desc_of{$_} ]
- } @{ $self->{Current} } ];
+ for (@{ $self->{Current} }) {
+ my $item = $_;
+ my $desc = $desc_of{$item};
+ my $type = $1 if $item =~ s/^(\w+)-//;
+
+ if ($type eq 'search') {
+ push @searches, [ reverse(split /-/, $item, 2), $desc ];
+ }
+ }
- my ($ok, $msg) = $Dashboard->Update(Searches => $searches);
+ my ($ok, $msg) = $Dashboard->Update(Searches => \@searches);
if ($ok) {
push @results, loc("Dashboard updated");
More information about the Rt-commit
mailing list