[bugzilla-gnome-org-extensions] Add the traceparser_show_traces setting and its functionality.



commit 9db78f2cd7c1456aa674047fff3b50344fb46367
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date:   Fri Aug 7 20:06:03 2009 -0500

    Add the traceparser_show_traces setting and its functionality.

 code/install-before_final_checks.pl                |    4 +++
 template/en/bug/comments-aftercomments.html.tmpl   |   28 ++++++++++++++++++++
 template/en/default/trace/format.html.tmpl         |    9 +++++-
 .../en/global/setting-descs-settings.none.tmpl     |    1 +
 web/style.css                                      |   18 +++++++++++-
 5 files changed, 57 insertions(+), 3 deletions(-)
---
diff --git a/code/install-before_final_checks.pl b/code/install-before_final_checks.pl
index 736ddb7..ffd37ba 100644
--- a/code/install-before_final_checks.pl
+++ b/code/install-before_final_checks.pl
@@ -24,6 +24,7 @@ use strict;
 use warnings;
 use Bugzilla;
 use Bugzilla::Group;
+use Bugzilla::User::Setting qw(add_setting);
 
 if (!new Bugzilla::Group({ name => 'traceparser_edit' })) {
     Bugzilla::Group->create({
@@ -31,3 +32,6 @@ if (!new Bugzilla::Group({ name => 'traceparser_edit' })) {
         description => 'Can edit properties of traces',
         isbuggroup  => 0 });
 }
+
+add_setting('traceparser_show_traces',
+            ['on', 'off'], 'off');
diff --git a/template/en/bug/comments-aftercomments.html.tmpl 
b/template/en/bug/comments-aftercomments.html.tmpl
new file mode 100644
index 0000000..e82e35c
--- /dev/null
+++ b/template/en/bug/comments-aftercomments.html.tmpl
@@ -0,0 +1,28 @@
+[%#
+  # 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>
+  #%]
+<script type="text/javascript">
+  function traceparser_toggle_trace(link, trace_id) {
+    var trace = document.getElementById('trace_' + trace_id);
+    bz_toggleClass(trace, 'bz_default_hidden');
+    if (link.innerHTML == '+') { link.innerHTML = '&mdash;'; }
+    else { link.innerHTML = '+'; }
+  }
+</script>
diff --git a/template/en/default/trace/format.html.tmpl b/template/en/default/trace/format.html.tmpl
index c9e9449..1c2472b 100644
--- a/template/en/default/trace/format.html.tmpl
+++ b/template/en/default/trace/format.html.tmpl
@@ -20,12 +20,19 @@
   #%]
 
 </pre>
+[% SET show = (user.settings.traceparser_show_traces.value == 'on') %]
 <p class="trace_link" title="See Full Trace">
+  <a class="trace_toggle_box" href="#"
+     title="Expand/Collapse Trace"
+     onclick="traceparser_toggle_trace(this, [% trace.id FILTER html %]); return false;">
+    [%~ IF show %]&mdash;[% ELSE %]+[% END %]</a>
   <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">
+<div class="trace [% ' bz_default_hidden' IF !show %]" 
+     id="trace_[% trace.id FILTER html %]">
   [% IF trace.type.match('Python') %]
     <ul class="frames">
       [% SET thread = trace.stack.threads.0 %]
diff --git a/template/en/global/setting-descs-settings.none.tmpl 
b/template/en/global/setting-descs-settings.none.tmpl
new file mode 100644
index 0000000..53a1b6a
--- /dev/null
+++ b/template/en/global/setting-descs-settings.none.tmpl
@@ -0,0 +1 @@
+[% setting_descs.traceparser_show_traces = 'Always Expand Traces' %]
diff --git a/web/style.css b/web/style.css
index a88fe9f..db8ee92 100644
--- a/web/style.css
+++ b/web/style.css
@@ -1,6 +1,20 @@
 .trace_link {
-    margin-bottom: .5em;
-    margin-top: -.5em;
+  margin-bottom: .5em;
+  margin-top: -.5em;
+}
+
+.trace_link a {
+  vertical-align: middle;
+}
+
+.trace_toggle_box {
+  text-decoration: none;
+  display: inline-block;
+  color: #106;
+  border: 1px solid black;
+  -moz-border-radius: 3px;
+  width: 1.5em;
+  text-align: center;
 }
 
 .thread_description {


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