From 1e4cfb771d4e0073f8d7392850c923c27a4a0d0c Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Tue, 5 Nov 2002 01:54:15 +0000 Subject: [PATCH] Fix for bug 156548: XUL implementation of duplicates report. git-svn-id: svn://10.0.0.236/trunk@132978 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/CGI.pl | 2 +- mozilla/webtools/bugzilla/checksetup.pl | 6 +- mozilla/webtools/bugzilla/collectstats.pl | 17 ++ mozilla/webtools/bugzilla/css/duplicates.css | 27 ++++ mozilla/webtools/bugzilla/duplicates.cgi | 12 ++ mozilla/webtools/bugzilla/duplicates.xul | 133 +++++++++++++++ mozilla/webtools/bugzilla/js/duplicates.js | 153 ++++++++++++++++++ .../bugzilla/skins/standard/duplicates.css | 27 ++++ .../en/default/reports/duplicates.rdf.tmpl | 51 ++++++ 9 files changed, 426 insertions(+), 2 deletions(-) create mode 100644 mozilla/webtools/bugzilla/css/duplicates.css create mode 100644 mozilla/webtools/bugzilla/duplicates.xul create mode 100644 mozilla/webtools/bugzilla/js/duplicates.js create mode 100644 mozilla/webtools/bugzilla/skins/standard/duplicates.css create mode 100644 mozilla/webtools/bugzilla/template/en/default/reports/duplicates.rdf.tmpl diff --git a/mozilla/webtools/bugzilla/CGI.pl b/mozilla/webtools/bugzilla/CGI.pl index d6dca3a3913..2069d9235f5 100644 --- a/mozilla/webtools/bugzilla/CGI.pl +++ b/mozilla/webtools/bugzilla/CGI.pl @@ -206,7 +206,7 @@ sub get_netaddr { my ($ipaddr) = @_; # Check for a valid IPv4 addr which we know how to parse - if ($ipaddr !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { + if (!$ipaddr || $ipaddr !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { return undef; } diff --git a/mozilla/webtools/bugzilla/checksetup.pl b/mozilla/webtools/bugzilla/checksetup.pl index 3a60a393786..aa91c3a34da 100755 --- a/mozilla/webtools/bugzilla/checksetup.pl +++ b/mozilla/webtools/bugzilla/checksetup.pl @@ -837,8 +837,12 @@ END open HTACCESS, ">data/.htaccess"; print HTACCESS <<'END'; # nothing in this directory is retrievable unless overriden by an .htaccess -# in a subdirectory +# in a subdirectory; the only exception is duplicates.rdf, which is used by +# duplicates.xul and must be loadable over the web deny from all + + allow from all + END close HTACCESS; chmod $fileperm, "data/.htaccess"; diff --git a/mozilla/webtools/bugzilla/collectstats.pl b/mozilla/webtools/bugzilla/collectstats.pl index 8caf92d7788..61e7cf2044e 100755 --- a/mozilla/webtools/bugzilla/collectstats.pl +++ b/mozilla/webtools/bugzilla/collectstats.pl @@ -53,6 +53,23 @@ foreach (@myproducts) { &calculate_dupes(); +# Generate a static RDF file containing the default view of the duplicates data. +open(CGI, "REQUEST_METHOD=GET QUERY_STRING=ctype=rdf ./duplicates.cgi |") + || die "can't fork duplicates.cgi: $!"; +open(RDF, ">data/duplicates.tmp") + || die "can't write to data/duplicates.tmp: $!"; +my $headers_done = 0; +while () { + print RDF if $headers_done; + $headers_done = 1 if $_ eq "\n"; +} +close CGI; +close RDF; +if (-s "data/duplicates.tmp") { + rename("data/duplicates.rdf", "data/duplicates-old.rdf"); + rename("data/duplicates.tmp", "data/duplicates.rdf"); +} + sub check_data_dir { my $dir = shift; diff --git a/mozilla/webtools/bugzilla/css/duplicates.css b/mozilla/webtools/bugzilla/css/duplicates.css new file mode 100644 index 00000000000..aab36fb2a0d --- /dev/null +++ b/mozilla/webtools/bugzilla/css/duplicates.css @@ -0,0 +1,27 @@ +/* The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Bugzilla Bug Tracking System. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): Myk Melez + */ + +treechildren:-moz-tree-cell-text(resolution-FIXED) { + text-decoration: line-through; +} + +treecol#id_column { width: 6em; } +treecol#duplicate_count_column { width: 5em; } +treecol#duplicate_delta_column { width: 5em; } diff --git a/mozilla/webtools/bugzilla/duplicates.cgi b/mozilla/webtools/bugzilla/duplicates.cgi index 643a54423ee..e95d4b02c5a 100755 --- a/mozilla/webtools/bugzilla/duplicates.cgi +++ b/mozilla/webtools/bugzilla/duplicates.cgi @@ -32,6 +32,18 @@ use lib qw(.); require "globals.pl"; require "CGI.pl"; +use vars qw($buffer); + +# Go directly to the XUL version of the duplicates report (duplicates.xul) +# if the user specified ctype=xul. Adds params if they exist, and directs +# the user to a signed copy of the script in duplicates.jar if it exists. +if ($::FORM{'ctype'} eq "xul") { + my $params = CanonicaliseParams($::buffer, ["format", "ctype"]); + print "Location: " . (-e "duplicates.jar" ? "duplicates.jar!/" : "") . + "duplicates.xul" . ($params ? "?$params" : "") . "\n\n"; + exit; +} + # Use global templatisation variables. use vars qw($template $vars); diff --git a/mozilla/webtools/bugzilla/duplicates.xul b/mozilla/webtools/bugzilla/duplicates.xul new file mode 100644 index 00000000000..be647c1887b --- /dev/null +++ b/mozilla/webtools/bugzilla/duplicates.xul @@ -0,0 +1,133 @@ + + + + + + + + + + + +]> + + + + + + + // Code for populating the tree from the RDF data source + // and loading bug reports when the user selects rows in the tree. +