Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bug_relationship_graph.php
blobeaddb3989ba0173a5eb8c69904f6cd574cdb42a5
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses core.php
24 * @uses access_api.php
25 * @uses authentication_api.php
26 * @uses bug_api.php
27 * @uses compress_api.php
28 * @uses config_api.php
29 * @uses constant_inc.php
30 * @uses gpc_api.php
31 * @uses helper_api.php
32 * @uses html_api.php
33 * @uses lang_api.php
34 * @uses print_api.php
35 * @uses relationship_graph_api.php
38 require_once( 'core.php' );
39 require_api( 'access_api.php' );
40 require_api( 'authentication_api.php' );
41 require_api( 'bug_api.php' );
42 require_api( 'compress_api.php' );
43 require_api( 'config_api.php' );
44 require_api( 'constant_inc.php' );
45 require_api( 'gpc_api.php' );
46 require_api( 'helper_api.php' );
47 require_api( 'html_api.php' );
48 require_api( 'lang_api.php' );
49 require_api( 'print_api.php' );
50 require_api( 'relationship_graph_api.php' );
52 # If relationship graphs were made disabled, we disallow any access to
53 # this script.
55 auth_ensure_user_authenticated();
57 if ( ON != config_get( 'relationship_graph_enable' ) )
58 access_denied();
60 $f_bug_id = gpc_get_int( 'bug_id' );
61 $f_type = gpc_get_string( 'graph', 'relation' );
62 $f_orientation = gpc_get_string( 'orientation', config_get( 'relationship_graph_orientation' ) );
64 if ( 'relation' == $f_type ) {
65 $t_graph_type = 'relation';
66 $t_graph_relation = true;
67 } else {
68 $t_graph_type = 'dependency';
69 $t_graph_relation = false;
72 if ( 'horizontal' == $f_orientation ) {
73 $t_graph_orientation = 'horizontal';
74 $t_graph_horizontal = true;
75 } else {
76 $t_graph_orientation = 'vertical';
77 $t_graph_horizontal = false;
80 $t_bug = bug_get( $f_bug_id, true );
82 if( $t_bug->project_id != helper_get_current_project() ) {
83 # in case the current project is not the same project of the bug we are viewing...
84 # ... override the current project. This to avoid problems with categories and handlers lists etc.
85 $g_project_override = $t_bug->project_id;
88 access_ensure_bug_level( VIEWER, $f_bug_id );
90 compress_enable();
92 html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
94 <br />
96 <table class="width100" cellspacing="1">
98 <tr>
99 <!-- Title -->
100 <td class="form-title">
101 <?php
102 if ( $t_graph_relation )
103 echo lang_get( 'viewing_bug_relationship_graph_title' );
104 else
105 echo lang_get( 'viewing_bug_dependency_graph_title' );
107 </td>
108 <!-- Links -->
109 <td class="right">
110 <!-- View Issue -->
111 <span class="small"><?php print_bracket_link( 'view.php?id=' . $f_bug_id, lang_get( 'view_issue' ) ) ?></span>
113 <!-- Relation/Dependency Graph Switch -->
114 <span class="small">
115 <?php
116 if ( $t_graph_relation )
117 print_bracket_link( "bug_relationship_graph.php?bug_id=$f_bug_id&graph=dependency", lang_get( 'dependency_graph' ) );
118 else
119 print_bracket_link( "bug_relationship_graph.php?bug_id=$f_bug_id&graph=relation", lang_get( 'relation_graph' ) );
121 </span>
122 <?php
123 if ( !$t_graph_relation ) {
125 <!-- Horizontal/Vertical Switch -->
126 <span class="small">
127 <?php
128 if ( $t_graph_horizontal )
129 print_bracket_link( "bug_relationship_graph.php?bug_id=$f_bug_id&graph=dependency&orientation=vertical", lang_get( 'vertical' ) );
130 else
131 print_bracket_link( "bug_relationship_graph.php?bug_id=$f_bug_id&graph=dependency&orientation=horizontal", lang_get( 'horizontal' ) );
133 </span>
134 <?php
137 </td>
138 </tr>
140 <tr>
141 <!-- Graph -->
142 <td colspan="2">
143 <?php
144 if ( $t_graph_relation )
145 $t_graph = relgraph_generate_rel_graph( $f_bug_id, $t_bug );
146 else
147 $t_graph = relgraph_generate_dep_graph( $f_bug_id, $t_bug, $t_graph_horizontal );
149 relgraph_output_map( $t_graph, 'relationship_graph_map' );
151 <div class="center relationship-graph">
152 <img src="bug_relationship_graph_img.php?bug_id=<?php echo $f_bug_id ?>&amp;graph=<?php echo $t_graph_type ?>&orientation=<?php echo $t_graph_orientation ?>"
153 border="0" usemap="#relationship_graph_map" />
154 </div>
155 </td>
156 </tr>
158 <tr>
159 <!-- Legend -->
160 <td colspan="2">
161 <table class="hide">
162 <tr>
163 <td class="center">
164 <img alt="" src="images/rel_related.png" />
165 <?php echo lang_get( 'related_to' ) ?>
166 </td>
167 <td class="center">
168 <img alt="" src="images/rel_dependant.png" />
169 <?php echo lang_get( 'blocks' ) ?>
170 </td>
171 <td class="center">
172 <img alt="" src="images/rel_duplicate.png" />
173 <?php echo lang_get( 'duplicate_of' ) ?>
174 </td>
175 </tr>
176 </table>
177 </td>
178 </tr>
180 </table>
182 <br />
184 <?php
185 define ( 'BUG_VIEW_INC_ALLOW', true );
186 $_GET['id'] = $f_bug_id;
187 $tpl_fields_config_option = 'bug_view_page_fields';
188 $tpl_show_page_header = false;
189 $tpl_force_readonly = true;
190 $tpl_mantis_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
191 $tpl_file = __FILE__;
193 include( 'bug_view_inc.php' );
194 html_page_bottom();