From 904ee0f87e8fd34c6bad99ee36bbd5dd4bca4c34 Mon Sep 17 00:00:00 2001 From: "kiko%async.com.br" Date: Thu, 9 Sep 2004 21:59:41 +0000 Subject: [PATCH] Commiting initial version of fix for bug 251656: Redesign dependency tree, part 1: fix the tree itself. Changes the way bullets are displayed, allow for control-click expansion and contraction, and simplify styling of the links themselves. Still needs some refinement. git-svn-id: svn://10.0.0.236/branches/kiko_UI_20040909-BRANCH@162017 18797224-902f-48f8-a5cc-f745e15eee43 --- .../webtools/bugzilla/css/dependency-tree.css | 89 ++++++++ .../webtools/bugzilla/images/tree-closed.png | Bin 0 -> 99 bytes .../webtools/bugzilla/images/tree-open.png | Bin 0 -> 94 bytes .../webtools/bugzilla/js/expanding-tree.js | 117 +++++++++++ .../webtools/bugzilla/showdependencytree.cgi | 4 +- .../en/default/bug/dependency-tree.html.tmpl | 197 ++++++++---------- .../template/en/default/filterexceptions.pl | 4 +- 7 files changed, 301 insertions(+), 110 deletions(-) create mode 100644 mozilla/webtools/bugzilla/css/dependency-tree.css create mode 100644 mozilla/webtools/bugzilla/images/tree-closed.png create mode 100644 mozilla/webtools/bugzilla/images/tree-open.png create mode 100644 mozilla/webtools/bugzilla/js/expanding-tree.js diff --git a/mozilla/webtools/bugzilla/css/dependency-tree.css b/mozilla/webtools/bugzilla/css/dependency-tree.css new file mode 100644 index 00000000000..69915a6707a --- /dev/null +++ b/mozilla/webtools/bugzilla/css/dependency-tree.css @@ -0,0 +1,89 @@ +/* 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): Christian Reis + */ + +ul.tree { + padding-left: 0em; + margin-left: 1em; + display: block; +} + +ul.tree ul { + padding-top: 3px; + display: block; +} + +ul.tree li { + /* see http://www.kryogenix.org/code/browser/aqlists/ for idea */ + padding-top: 3px; + text-indent: -1.2em; + padding-left: 0.5em; + list-style-type: none; + padding-bottom: 3px; +} + +ul.tree li a.b { + padding-left: 12px; + margin-right: 2px; + text-decoration: none; +} + +ul.tree li a.b_open { + background: url("../images/tree-open.png") center no-repeat; + cursor: pointer; +} + +ul.tree li a.b_closed { + background: url("../images/tree-closed.png") center no-repeat; + cursor: pointer; +} + +.summ_info { + /* change to inline if you would like to see the full bug details + * displayed in the list */ + display: none; + font-size: 75%; +} + +.hint { + font-size: 90%; + margin: 0.2em; + padding: 0.1em; +} + +.hint h3, .hint ul { + margin-top: 0.1em; + margin-bottom: 0.1em; +} + +/* uncomment this if you would like summary text of closed classes to be + * striked through */ +/* +.bz_closed + .summ_text { + text-decoration: line-through; +} +*/ + +/* for styling summaries that are leaves or not */ +.summ, .summ_deep { +} + +.summ_deep { +} diff --git a/mozilla/webtools/bugzilla/images/tree-closed.png b/mozilla/webtools/bugzilla/images/tree-closed.png new file mode 100644 index 0000000000000000000000000000000000000000..69d2ba0ee7348d0a327bb8108dcf1ccbc5d8e52d GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4|3?y&GPYDK6YymzYu0Z<7pC6+4{Vjkj2~QWt tkcwN$2?+@+(i1e;mE9$nH4YtMV9=h*EVEVZ?=GMk22WQ%mvv4FO#mSG81(=E literal 0 HcmV?d00001 diff --git a/mozilla/webtools/bugzilla/images/tree-open.png b/mozilla/webtools/bugzilla/images/tree-open.png new file mode 100644 index 0000000000000000000000000000000000000000..dcc5498a679a99e8038418ddea65894a3bd2aad6 GIT binary patch literal 94 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4|3?y&GPYDK6YymzYu0Z<7pC6+4{VjkjVNVyw okcwN$2?+@++7;bZ%$S)ObVHeKO5HDf0!lM@y85}Sb4q9e0Gy5%=l}o! literal 0 HcmV?d00001 diff --git a/mozilla/webtools/bugzilla/js/expanding-tree.js b/mozilla/webtools/bugzilla/js/expanding-tree.js new file mode 100644 index 00000000000..10b4f11c8a5 --- /dev/null +++ b/mozilla/webtools/bugzilla/js/expanding-tree.js @@ -0,0 +1,117 @@ +/* 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): Mike Shaver + * Christian Reis + */ + +if (!Node) { + /* MSIE doesn't define Node, so provide a compatibility object */ + var Node = { TEXT_NODE: 3 } +} + +function doToggle(node, event) +{ + var deep = event.altKey || event.ctrlKey; + + if (node.nodeType == Node.TEXT_NODE) + node = node.parentNode; + + var toggle = node.nextSibling; + while (toggle && toggle.tagName != "UL") + toggle = toggle.nextSibling; + + if (toggle) { + if (deep) { + var direction = toggleDisplay(toggle, node); + changeChildren(toggle, direction); + } else { + toggleDisplay(toggle, node); + } + } + /* avoid problems with default actions on links (mozilla's + * ctrl/shift-click defaults, for instance */ + event.preventBubble(); + event.preventDefault(); + return false; +} + +function changeChildren(node, direction) { + var item = node.firstChild; + while (item) { + /* find the LI inside the UL I got */ + while (item && item.tagName != "LI") + item = item.nextSibling; + if (!item) + return; + + /* got it, now find the first A */ + var child = item.firstChild; + while (child && child.tagName != "A") + child = child.nextSibling; + if (!child) { + return + } + var bullet = child; + + /* and check if it has its own sublist */ + var sublist = item.firstChild; + while (sublist && sublist.tagName != "UL") + sublist = sublist.nextSibling; + if (sublist) { + if (direction && isClosed(sublist)) { + openNode(sublist, bullet); + } else if (!direction && !isClosed(sublist)) { + closeNode(sublist, bullet); + } + changeChildren(sublist, direction) + } + item = item.nextSibling; + } +} + +function openNode(node, bullet) +{ + node.style.display = "block"; + bullet.className = "b b_open"; +} + +function closeNode(node, bullet) +{ + node.style.display = "none"; + bullet.className = "b b_closed"; +} + +function isClosed(node) { + /* XXX we should in fact check our *computed* style, not the display + * attribute of the current node, which may be inherited and not + * set. However, this really only matters when changing the default + * appearance of the tree through a parent style. */ + return node.style.display == "none"; +} + +function toggleDisplay(node, bullet) +{ + if (isClosed(node)) { + openNode(node, bullet); + return true; + } + + closeNode(node, bullet); + return false; +} + diff --git a/mozilla/webtools/bugzilla/showdependencytree.cgi b/mozilla/webtools/bugzilla/showdependencytree.cgi index f1a495a6d43..1c2ceba1fa0 100755 --- a/mozilla/webtools/bugzilla/showdependencytree.cgi +++ b/mozilla/webtools/bugzilla/showdependencytree.cgi @@ -67,7 +67,7 @@ if ($maxdepth !~ /^\d+$/) { $maxdepth = 0 }; # have to embed a conditional statement into each query. my $milestone_column = Param('usetargetmilestone') ? "target_milestone" : "''"; -# The greatest depth to which either tree goes. +# Stores the greatest depth to which either tree goes. my $realdepth = 0; # Generate the tree of bugs that this bug depends on and a list of IDs @@ -149,6 +149,7 @@ sub GetBug { if (Bugzilla->user->can_see_bug($id)) { SendSQL("SELECT 1, bug_status, + resolution, short_desc, $milestone_column, assignee.userid, @@ -160,6 +161,7 @@ sub GetBug { ($bug->{'exists'}, $bug->{'status'}, + $bug->{'resolution'}, $bug->{'summary'}, $bug->{'milestone'}, $bug->{'assignee_id'}, diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/dependency-tree.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/dependency-tree.html.tmpl index 0e6b9d1b26e..25e6f0ab9cf 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/dependency-tree.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/dependency-tree.html.tmpl @@ -25,135 +25,121 @@ [% PROCESS global/header.html.tmpl title = "Dependency tree for $terms.Bug $bugid" - h1 = "Dependency tree for $terms.Bug $bugid" + h1 = "Dependency tree for + $terms.Bug $bugid" + javascript_urls = ["js/expanding-tree.js"] + style_urls = ["css/dependency-tree.css"] %] [% PROCESS depthControlToolbar %] -[%# Display the tree of bugs that this bug depends on. %] -

- [% IF hide_resolved %] - Open [% terms.bugs %] - [% ELSE %] - [% terms.Bugs %] - [% END %] - that [% terms.bug %] [%+ bugid %] - depends on

-[% IF dependson_ids.size > 0 %] - ( - [% IF maxdepth -%]Up to [% maxdepth %] level[% "s" IF maxdepth > 1 %] deep | [% END %] - view as [% terms.bug %] list - [% IF canedit && dependson_ids.size > 1 %] - | change several - [% END %]) - [% INCLUDE display_tree tree=dependson_tree bug_id=bugid %] -[% ELSE %] - -

None

-[% END %] +[% INCLUDE tree_section ids=dependson_ids bugid=bugid + tree_name="dependson_tree" text="depends on" %] -[%# Display the tree of bugs that this bug blocks. %] -

- [% IF hide_resolved %] - Open [% terms.bugs %] - [% ELSE %] - [% terms.Bugs %] - [% END %] - that [% terms.bug %] [%+ bugid %] - blocks

-[% IF blocked_ids.size > 0 %] - ( - [% IF maxdepth -%]Up to [% maxdepth %] level[% "s" IF maxdepth > 1 %] deep | [% END %] - view as [% terms.bug %] list - [% IF canedit && blocked_ids.size > 1 %] - | change several - [% END %]) - [% INCLUDE display_tree tree=blocked_tree bug_id=bugid %] -[% ELSE %] - -

None

-[% END %] +[% INCLUDE tree_section ids=blocked_ids bugid=bugid + tree_name="blocked_tree" text = "blocks" %] [% PROCESS depthControlToolbar %] +
+

Usage Hints

+
    +
  • Click on expander icons to expand or contract a portion of the tree. +
  • Control-clicking on expander icons performs a "deep" change:
    + all children [% terms.bugs %] are also expanded or contracted accordingly. +
+
+ [% PROCESS global/footer.html.tmpl %] +[%###########################################################################%] +[%# Tree-drawing blocks #%] +[%###########################################################################%] -[%###########################################################################%] -[%# Block to display a tree #%] -[%###########################################################################%] +[% BLOCK tree_section %] + [%# INTERFACE + # - tree_name: the name of the tree type ("dependson_tree" or "blocks_tree") + # - bugid: the ID of the toplevel bug being displayed + # - ids: a list of bug IDs to be displayed as children + # GLOBALS + # - seen: Maintains a global hash of bugs that have been displayed + #%] + [% global.seen = {} %] + [%# Display the tree of bugs that this bug depends on. %] +

+ [% IF hide_resolved %] + Open [% terms.bugs %] + [% ELSE %] + [% terms.Bugs %] + [%- END %] + that [% terms.bug %] [%+ bugid %] + [% text FILTER html %] +

+ [% IF ids.size > 0 %]([% IF maxdepth -%]Up to [% maxdepth %] level[% "s" IF maxdepth > 1 %] deep | [% END -%]view as [% terms.bug %] list + [% IF canedit && ids.size > 1 %] + | change several + [% END %]) +
    + [% INCLUDE display_tree tree=$tree_name bugid=bugid %] +
+ Total [% terms.bugs %] displayed: [% ids.size %] +

+ [% ELSE %] +

None

+ [% END %] +[% END %] [% BLOCK display_tree %] -[% tree.$bug_id.seen = 1 %] -
    - [% FOREACH dep_id = tree.$bug_id.dependencies %] - [% dep = tree.$dep_id %] -
  • - [% "" - IF dep.dependencies.size > 0 && !dep.seen %] - [% isclosed = !dep.open %] - [% FILTER closed(isclosed) %] - [% dep_id %] - [[% IF dep.milestone %][% dep.milestone FILTER html %], [% END %] - [% dep.assignee_email FILTER html %]] - - [% IF dep.seen %] - This [% terms.bug %] appears elsewhere in this tree. - [% ELSE %] - [% dep.summary FILTER html %]. + [%# INTERFACE + # - bugid: the ID of the bug being displayed + # - tree: a hash of bug objects + #%] + [% bug = tree.$bugid %] +
  • [%- INCLUDE bullet bugid=bugid bug=bug -%][%- INCLUDE buglink bug=bug bugid=bugid %] + [% IF global.seen.$bugid %] + (*) + [% ELSIF bug.dependencies.size %] +
      + [% FOREACH depid = bug.dependencies %] + [% INCLUDE display_tree bugid=depid %] [% END %] - [% END %] - [% INCLUDE display_tree bug_id=dep_id - IF dep.dependencies.size > 0 && !dep.seen %] - +
    + [% END %] +
  • + [% global.seen.$bugid = 1 %] +[% END %] + +[% BLOCK bullet %] + [% IF bug.dependencies.size > 0 && ! global.seen.$bugid %] + [% extra_class = " b_open" %] + [% extra_args = 'href="#" onclick="return doToggle(this, event)"' %] [% END %] -
+   +[% END %] + +[% BLOCK buglink %] + [% isclosed = !bug.open %] + [% FILTER closed(isclosed) -%][% terms.bug %] [%+ bugid %][% END %]: [%+ bug.summary FILTER html %][[% INCLUDE buginfo %]] +[% END %] + +[% BLOCK buginfo %] + [% bug.status FILTER html %] + [%+ bug.resolution FILTER html %]; assigned to [% bug.assignee_email FILTER html %]; + [% "Target: " _ bug.milestone IF bug.milestone %] [% END %] [%###########################################################################%] [%# Block for depth control toolbar #%] [%###########################################################################%] - [% BLOCK depthControlToolbar %] - +
[%# Hide/show resolved button Swaps text depending on the state of hide_resolved %] diff --git a/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl b/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl index c1921a9083b..5450db980de 100644 --- a/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl +++ b/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl @@ -323,10 +323,8 @@ 'bug/dependency-tree.html.tmpl' => [ 'bugid', 'maxdepth', - 'dependson_ids.join(",")', - 'blocked_ids.join(",")', - 'dep_id', 'hide_resolved', + 'ids.join(",")', 'maxdepth + 1', 'maxdepth > 0 && maxdepth <= realdepth ? maxdepth : ""', 'maxdepth == 1 ? 1
-
[% IF maxdepth %] @@ -162,7 +148,7 @@ function listToggle(event) -
+
@@ -228,8 +214,7 @@ function listToggle(event) [% END %] = realdepth %] - %]> + [% "disabled" IF realdepth < 2 || !maxdepth || maxdepth >= realdepth %]>