[bugzilla-gnome-org-extensions] Add a page that shows the full trace.



commit 170640cdfa19f07a187035258dd024ea5bc782c9
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date:   Tue Aug 4 02:25:36 2009 -0500

    Add a page that shows the full trace.

 code/page-before_template.pl               |   28 ++++++++++++++++++++++++++
 lib/TraceParser/Hooks.pm                   |   11 ++++++++++
 template/en/default/pages/trace.html.tmpl  |   30 ++++++++++++++++++++++++++++
 template/en/default/trace/format.html.tmpl |    5 ++-
 4 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/code/page-before_template.pl b/code/page-before_template.pl
new file mode 100644
index 0000000..396b43d
--- /dev/null
+++ b/code/page-before_template.pl
@@ -0,0 +1,28 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# 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 Example Plugin.
+#
+# The Initial Developer of the Original Code is Canonical Ltd.
+# Portions created by Canonical Ltd. are Copyright (C) 2009 
+# Canonical Ltd. All Rights Reserved.
+#
+# Contributor(s):
+#   Max Kanat-Alexander <mkanat bugzilla org>
+
+
+use strict;
+use warnings;
+use Bugzilla;
+use TraceParser::Hooks;
+
+page(%{ Bugzilla->hook_args });
diff --git a/lib/TraceParser/Hooks.pm b/lib/TraceParser/Hooks.pm
index 60e1e22..ae9e62d 100644
--- a/lib/TraceParser/Hooks.pm
+++ b/lib/TraceParser/Hooks.pm
@@ -26,6 +26,7 @@ use TraceParser::Trace;
 
 our @EXPORT = qw(
     linkify_comment
+    page
 );
 
 sub linkify_comment {
@@ -43,4 +44,14 @@ sub linkify_comment {
     push(@$replace, $replacement);
 }
 
+
+sub page {
+    my %params = @_;
+    my ($vars, $page) = @params{qw(vars page_id)};
+    return if $page !~ '^trace\.';
+    my $trace_id = Bugzilla->cgi->param('trace_id');
+    my $trace = TraceParser::Trace->check({ id => $trace_id });
+    $vars->{trace} = $trace;
+}
+
 1;
diff --git a/template/en/default/pages/trace.html.tmpl b/template/en/default/pages/trace.html.tmpl
new file mode 100644
index 0000000..4b302be
--- /dev/null
+++ b/template/en/default/pages/trace.html.tmpl
@@ -0,0 +1,30 @@
+[%#
+  # 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 TraceParser Plugin.
+  #
+  # The Initial Developer of the Original Code is Canonical Ltd.
+  # Portions created by Canonical Ltd. are Copyright (C) 2009
+  # Canonical Ltd. All Rights Reserved.
+  #
+  # Contributor(s):
+  #   Max Kanat-Alexander <mkanat bugzilla org>
+  #%]
+
+[% PROCESS global/header.html.tmpl
+   title = "Trace $trace.id From Bug $trace.bug_id" 
+%]
+
+<table border="0" cellpadding="0" cellspacing="0"><tr><td><div class="trace">
+<pre>[% trace.text FILTER html %]
+</pre></div></td></tr></table>
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/trace/format.html.tmpl b/template/en/default/trace/format.html.tmpl
index ff1bcca..7af617e 100644
--- a/template/en/default/trace/format.html.tmpl
+++ b/template/en/default/trace/format.html.tmpl
@@ -21,8 +21,9 @@
 
 </pre>
 <p class="trace_link" title="See Full Trace">
-  <a href="page.cgi?id=trace.html&id=[% trace.id FILTER url_quote %]">Trace 
-    [% trace.id FILTER html %]</a></p>
+  <a href="page.cgi?id=trace.html&trace_id=
+           [%- trace.id FILTER url_quote %]">Trace
+    [%+ trace.id FILTER html %]</a></p>
 <table border="0" cellpadding="0" cellspacing="0"><tr><td>
 <div class="trace">
   [% IF trace.type.match('Python') %]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]