Once upon a time, Terje Bless <
link@pobo...> said:
>
cmadams@hiwa... (Chris Adams) wrote:
> >Would anyone have a problem with me checking these in?
>
> Nope, do please go ahead. Getting comments on the list is
> unlikely right now, but getting comments on a checkin
> (particularly if someone doesn't like it ;D) might have better luck.
Okay, I finally got around to checking in those minor cleanups.
> >If there's interest in my listviews patch, I'll post it separately for
> >review.
>
> Please do. Post it to the tracker on SF.net for, uhm, tracking;
> and on here for discussion / review.
I've added it to the patch tracker:
https://sourceforge.net/tracker/index.php?func=detail&aid=2020668&group_id=1210&atid=301210
I've also included it below to make it easy to discuss specific bits (if
anybody wants to). If I don't hear anything back, I'll assume that
everyone just loves it and I'll check it in. :-)
--
Chris Adams <
cmadams@hiwa...>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
diff -urN cricket-cvs/doc/reference.html cricket-listviews/doc/reference.html
--- cricket-cvs/doc/reference.html 2007-12-07 09:02:22.000000000 -0600
+++ cricket-listviews/doc/reference.html 2007-12-07 09:02:15.000000000 -0600
@@ -1317,6 +1317,12 @@
<tt>view</tt> tag is deprecated.
</p>
</dd>
+ <dt><tt>list-views</tt></dt>
+ <dd>Default value: false
+ <p>
+ Include a list of the available views in the HTML summary.
+ </p>
+ </dd>
<dt><tt>rra</tt></dt>
<dd>Default value: <i>none</i>
<p>
diff -urN cricket-cvs/grapher.cgi cricket-listviews/grapher.cgi
--- cricket-cvs/grapher.cgi 2007-12-07 09:02:22.000000000 -0600
+++ cricket-listviews/grapher.cgi 2007-12-07 09:02:37.000000000 -0600
@@ -239,8 +239,9 @@
# put the view into the target dict, so it's
# there if they want to use it.
- my($view) = lc $gQ->param('view') if defined($gQ->param('view'));
+ my $view = $gQ->param('view');
if (defined($view)) {
+ $view = lc $view;
$targRef->{'auto-view'} = $view;
}
@@ -331,12 +332,27 @@
Error("Failed to get dslist from view name.");
}
+ } elsif (defined ($dslist = $gQ->param('dslist'))) {
+ # Allow arbitrary "views" to be created with dslist
+ $dslist =~ s/\s*,\s*/,/g;
} else {
$dslist = $ttRef->{'ds'};
# squeeze out any extra spaces
$dslist = join(',', split(/\s*,\s*/, $dslist));
}
+ # make a list of the view URLs from the targettype
+ my @viewlinks = ();
+ if ($ttRef->{'list-views'} && $ttRef->{'view'}) {
+ foreach $v (split(/\s*,\s*/, $ttRef->{'view'})) {
+ # Only care about the name
+ $v =~ s/\s*:.*//;
+ my $vurl = makeUrlView($gQ, $v);
+ my $t = "<a href=\"$vurl\">[ $v ]</a>";
+ push @viewlinks, $t;
+ }
+ }
+
# handle multi-targets... if we have a targets attribute,
# get ready to loop on each of it's items
@@ -418,8 +434,13 @@
print "<p><i>Aberrant Behavior Detection:</i><p>\n",
join("<br>\n", @hwlinks);
}
- print "</center></td>\n";
- print "</tr></table>\n";
+ print "</center></td></tr>\n";
+ if (@viewlinks) {
+ print "<tr><td colspan=\"2\"><b>Available views:</b>";
+ print join (" ", @viewlinks);
+ print "</td></tr>\n";
+ }
+ print "</table>\n";
}
if (defined($targRef->{'target-html'})) {
@@ -503,10 +524,7 @@
$gQ->param('ranges', 'h:d:w');
urlTarget($gQ, $thisTarget2);
$gQ->param('inst', $thisInst) if (defined($thisInst));
- if (defined($view)) {
- $gQ->param('view', $view);
- }
- $linkurl = makeUrl($gQ);
+ $linkurl = makeUrlView($gQ, $view);
print "<a href=\"$linkurl\">";
@@ -652,8 +670,13 @@
print "<p><i>Aberrant Behavior Detection:</i><p>\n",
join("<br>\n", @hwlinks);
}
- print "</center></td>\n";
- print "</tr></table>\n";
+ print "</center></td></tr>\n";
+ if (@viewlinks) {
+ print "<tr><td colspan=\"2\"><b>Available views:</b>";
+ print join (" ", @viewlinks);
+ print "</td></tr>\n";
+ }
+ print "</table>\n";
}
}
} else {
@@ -808,10 +831,7 @@
my $viewRef = $ct->configHash($name, 'view', lc $vname);
my $vdesc = $viewRef->{'label'};
$vdesc ||= $vname;
- # put it in just long enough to get a URL out
- $gQ->param('view', $vname);
- my($me) = makeUrl($gQ);
- $gQ->delete('view');
+ my($me) = makeUrlView($gQ, $vname);
$links .= "<a href=\"$me\">[ $vdesc ]</a>\n";
}
@@ -1389,7 +1409,7 @@
}
# things we will need from the params
- my($view) = $gQ->param('view');
+ my $view = $gQ->param('view');
$view = lc $view if defined $view;
# a comma-separated list of data sources
my($dslist);
@@ -2374,6 +2394,22 @@
-path_info=>$gUsePathInfo);
}
+# Return a URL as a text string, based on the current state of the
+# $cgi object (with a specific view)
+sub makeUrlView {
+ my $cgi = shift;
+ my $view = shift;
+ my $oldview = $cgi->param('view');
+ $cgi->param('view', $view);
+ my $url = makeUrl($cgi);
+ if (defined ($oldview)) {
+ $cgi->param('view', $oldview);
+ } else {
+ $cgi->delete('view');
+ }
+ return $url;
+}
+
# Get or set the target from the $cgi object.
sub urlTarget {
my $cgi = shift;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
cricket-developers mailing list
cricket-developers@list...
https://lists.sourceforge.net/lists/listinfo/cricket-developers
opensubscriber is not affiliated with the authors of this message nor responsible for its content.