5 * Copyright 2009, Fabien Dubois - Capgemini
6 * Copyright 2009-2011, Franck Villaume - Capgemini
7 * Copyright 2011, Franck Villaume - TrivialDev
8 * Copyright 2010, Antoine Mercadal - Capgemini
9 * http://fusionforge.org
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 * - for a specific group id
30 * - for a specific user
34 * @todo : remove all css and js
44 global $prioritiesImg, $bugPerPage;
47 /* do not recreate $clientSOAP object if already created by other pages */
51 foreach ($mantisbtConf['url'] as $mantisbtConfUrl) {
52 $clientSOAP = new SoapClient($mantisbtConfUrl."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
53 $idsBugAll = $clientSOAP->__soapCall('mc_issue_get_filtered_by_user', array("username" => $username, "password" => $password));
58 $clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
59 $idsBugAll = $clientSOAP->__soapCall('mc_project_get_issue_headers', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt'], "page_number" => -1, "per_page" => -1));
63 } catch (SoapFault $soapFault) {
64 echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
67 if (!isset($clientSOAP) && !isset($errorPage)) {
68 echo '<div class="warning">'._('No data to retrieve').'</div>';
69 } elseif (!isset($errorPage) && isset($clientSOAP)) {
73 <script type="text/javascript">
74 jQuery(document).ready(function() {
75 jQuery("#expandable_ticket").hide();
80 // recuperation des bugs
83 $listStatus = $clientSOAP->__soapCall('mc_enum_status', array("username" => $username, "password" => $password));
84 $pageActuelle = getIntFromRequest('page');
85 if (empty($pageActuelle)) {
88 // calcul pour la pagination
89 $nombreBugs = count ($idsBugAll);
90 $nombreDePages=ceil($nombreBugs/$bugPerPage);
91 // Si la valeur de $pageActuelle (le numéro de la page) est plus grande que $nombreDePages...
92 if($pageActuelle > $nombreDePages) {
93 $pageActuelle = $nombreDePages;
95 $indexMin = ($pageActuelle - 1) * $bugPerPage;
96 $indexMax = ($pageActuelle * $bugPerPage) -1;
97 // construction du tableau
98 $listBugAll = array();
99 foreach ($idsBugAll as $defect) {
100 foreach ($listStatus as $loopStatus) {
101 if ($loopStatus->id == $defect->status) {
102 $statusname = $loopStatus->name;
105 $listBugAll[] = array( "id"=> $defect->id, "idPriority"=> $defect->priority,
106 "category"=> $defect->category,"project" => $defect->project,
107 "severityId" => $defect->severity, "statusId" => $defect->status,
108 "last_updated" => $defect->last_updated, "status_name" => $statusname,
109 "summary" => htmlspecialchars($defect->summary,ENT_QUOTES), "view_state" => $defect->view_state,
113 if(count($listBugAll) > 0) {
114 foreach ($listBugAll as $key => $defect) {
115 if ( ($indexMin <= $key) && ($indexMax >= $key) ){
116 $listBug[] = $defect;
122 if (!count($listBug)) {
123 echo '<p class="warning">'._('No tickets to display').'</p>';
127 $picto_haut = util_make_url('themes/gforge/images/picto_fleche_haut_marron.png');
128 $picto_bas = util_make_url('themes/gforge/images/picto_fleche_bas_marron.png');
130 include 'jumpToIssue.php';
134 echo '<th width="2%">';
135 // echo '<form name="filterprority" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
136 // if ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "ASC") {
137 // echo '<input type=hidden name="dir" value="DESC"/>';
138 // } elseif ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "DESC") {
139 // echo '<input type="hidden" name="dir" value="ASC"/>';
141 // if ( isset($bugfilter['show_status'])) {
142 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
143 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
146 // if ( isset($bugfilter['project_id'])) {
147 // foreach ($bugfilter['project_id'] as $key => $childId) {
148 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
151 // echo '<input type=hidden name="sort" value="priority" />';
152 // echo '<a href="javascript:document.filterprority.submit();">P';
153 // if ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "ASC" ) {
154 // echo '<img src="'.$picto_haut.'">';
155 // } elseif ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "DESC" ) {
156 // echo '<img src="'.$picto_bas.'">';
163 echo '<th width="3%">';
164 // echo '<form name="filterid" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
165 // if ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "ASC") {
166 // echo '<input type=hidden name="dir" value="DESC"/>';
167 // } elseif ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "DESC") {
168 // echo '<input type="hidden" name="dir" value="ASC"/>';
170 // if ( isset($bugfilter['show_status'])) {
171 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
172 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
175 // if ( isset($bugfilter['project_id'])) {
176 // foreach ($bugfilter['project_id'] as $key => $childId) {
177 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
180 // echo '<input type=hidden name="sort" value="id" />';
181 // echo '<a href="javascript:document.filterid.submit();">ID';
182 // if ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "ASC" ) {
183 // echo '<img src="'.$picto_haut.'">';
184 // }else if ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "DESC" ) {
185 // echo '<img src="'.$picto_bas.'">';
192 echo '<th width="7%">';
193 // echo '<form name="filtercat" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
194 // if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "ASC") {
195 // echo '<input type=hidden name="dir" value="DESC"/>';
196 // }else if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "DESC") {
197 // echo '<input type="hidden" name="dir" value="ASC"/>';
199 // if ( isset($bugfilter['show_status'])) {
200 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
201 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
204 // if ( isset($bugfilter['project_id'])) {
205 // foreach ($bugfilter['project_id'] as $key => $childId) {
206 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
209 // echo '<input type=hidden name="sort" value="category_id" />';
210 // echo '<a href="javascript:document.filtercat.submit();">'._('Category');
211 // if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "ASC" ) {
212 // echo '<img src="'.$picto_haut.'">';
213 // }else if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "DESC" ) {
214 // echo '<img src="'.$picto_bas.'">';
221 echo '<th width="7%">';
222 // echo '<form name="projectid" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
223 // if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "ASC") {
224 // echo '<input type=hidden name="dir" value="DESC"/>';
225 // }else if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "DESC") {
226 // echo '<input type="hidden" name="dir" value="ASC"/>';
228 // if ( isset($bugfilter['show_status'])) {
229 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
230 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
233 // if ( isset($bugfilter['project_id'])) {
234 // foreach ($bugfilter['project_id'] as $key => $childId) {
235 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
238 // echo '<input type=hidden name="sort" value="project_id" />';
239 // echo '<a href="javascript:document.projectid.submit();">'._('Project');
240 // if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "ASC" ) {
241 // echo '<img src="'.$picto_haut.'">';
242 // }else if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "DESC" ) {
243 // echo '<img src="'.$picto_bas.'">';
250 echo '<th width="7%">';
251 // echo '<form name="severity" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
252 // if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "ASC") {
253 // echo '<input type=hidden name="dir" value="DESC"/>';
254 // }else if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "DESC") {
255 // echo '<input type="hidden" name="dir" value="ASC"/>';
257 // if ( isset($bugfilter['show_status'])) {
258 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
259 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
262 // if ( isset($bugfilter['project_id'])) {
263 // foreach ($bugfilter['project_id'] as $key => $childId) {
264 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
267 // echo '<input type=hidden name="sort" value="severity" />';
268 // echo '<a href="javascript:document.severity.submit();">'._('Severity');
269 // if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "ASC" ) {
270 // echo '<img src="'.$picto_haut.'">';
271 // }else if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "DESC" ) {
272 // echo '<img src="'.$picto_bas.'">';
279 echo '<th width="15%">';
280 // echo '<form name="statusid" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
281 // if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "ASC") {
282 // echo '<input type=hidden name="dir" value="DESC"/>';
283 // }else if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "DESC") {
284 // echo '<input type="hidden" name="dir" value="ASC"/>';
286 // if ( isset($bugfilter['show_status'])) {
287 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
288 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
291 // if ( isset($bugfilter['project_id'])) {
292 // foreach ($bugfilter['project_id'] as $key => $childId) {
293 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
296 // echo '<input type=hidden name="sort" value="status" />';
297 // echo '<a href="javascript:document.statusid.submit();">'._('Status');
298 // if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "ASC" ) {
299 // echo '<img src="'.$picto_haut.'">';
300 // }else if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "DESC" ) {
301 // echo '<img src="'.$picto_bas.'">';
308 echo '<th width="7%">';
309 // echo '<form name="lastupdate" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
310 // if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "ASC") {
311 // echo '<input type=hidden name="dir" value="DESC"/>';
312 // }else if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "DESC") {
313 // echo '<input type="hidden" name="dir" value="ASC"/>';
315 // if ( isset($bugfilter['show_status'])) {
316 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
317 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
320 // if ( isset($bugfilter['project_id'])) {
321 // foreach ($bugfilter['project_id'] as $key => $childId) {
322 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
325 // echo '<input type=hidden name="sort" value="last_updated" />';
326 // echo '<a href="javascript:document.lastupdate.submit();">'._('Last update');
327 // if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "ASC" ) {
328 // echo '<img src="'.$picto_haut.'">';
329 // }else if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "DESC" ) {
330 // echo '<img src="'.$picto_bas.'">';
334 echo _('Last update');
337 echo '<th width="29%">';
338 // echo '<form name="summary" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
339 // if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "ASC") {
340 // echo '<input type=hidden name="dir" value="DESC"/>';
341 // }else if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "DESC") {
342 // echo '<input type="hidden" name="dir" value="ASC"/>';
344 // if ( isset($bugfilter['show_status'])) {
345 // foreach ($bugfilter['show_status'] as $key => $childStatus) {
346 // echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
349 // if ( isset($bugfilter['project_id'])) {
350 // foreach ($bugfilter['project_id'] as $key => $childId) {
351 // echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
354 // echo '<input type=hidden name="sort" value="summary" />';
355 // echo '<a href="javascript:document.summary.submit();">'._('Summary');
356 // if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "ASC" ) {
357 // echo '<img src="'.$picto_haut.'">';
358 // }else if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "DESC" ) {
359 // echo '<img src="'.$picto_bas.'">';
365 /* currently informations are missing in header
366 // version de détection
367 echo '<th width="6%">';
368 echo '<form name="version" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
369 if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "ASC") {
370 echo '<input type=hidden name="dir" value="DESC"/>';
371 }else if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "DESC") {
372 echo '<input type="hidden" name="dir" value="ASC"/>';
374 if ( isset($bugfilter['show_status'])) {
375 foreach ($bugfilter['show_status'] as $key => $childStatus) {
376 echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
379 if ( isset($bugfilter['project_id'])) {
380 foreach ($bugfilter['project_id'] as $key => $childId) {
381 echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
384 echo '<input type=hidden name="sort" value="version" />';
385 echo '<a href="javascript:document.version.submit();">'._('Detected in');
386 if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "ASC" ){
387 echo '<img src="'.$picto_haut.'">';
388 }else if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "DESC" ) {
389 echo '<img src="'.$picto_bas.'">';
394 // corrigé en version
395 echo '<th width="6%">';
396 echo '<form name="fixed" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
397 if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "ASC") {
398 echo '<input type=hidden name="dir" value="DESC"/>';
399 }else if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "DESC") {
400 echo '<input type="hidden" name="dir" value="ASC"/>';
402 if ( isset($bugfilter['show_status'])) {
403 foreach ($bugfilter['show_status'] as $key => $childStatus) {
404 echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
407 if ( isset($bugfilter['project_id'])) {
408 foreach ($bugfilter['project_id'] as $key => $childId) {
409 echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
412 echo '<input type=hidden name="sort" value="fixed_in_version" />';
413 echo '<a href="javascript:document.fixed.submit();">'._('Fixed in');
414 if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "ASC" ){
415 echo '<img src="'.$picto_haut.'">';
416 }else if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "DESC" ) {
417 echo '<img src="'.$picto_bas.'">';
422 // version cible : Milestone
423 echo '<th width="6%">';
424 echo '<form name="target" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'">';
425 if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "ASC") {
426 echo '<input type=hidden name="dir" value="DESC"/>';
427 }else if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "DESC") {
428 echo '<input type="hidden" name="dir" value="ASC"/>';
430 if ( isset($bugfilter['show_status'])) {
431 foreach ($bugfilter['show_status'] as $key => $childStatus) {
432 echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
435 if ( isset($bugfilter['project_id'])) {
436 foreach ($bugfilter['project_id'] as $key => $childId) {
437 echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
440 echo '<input type=hidden name="sort" value="target_version" />';
441 echo '<a href="javascript:document.target.submit();">'._('Target');
442 if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "ASC" ){
443 echo '<img src="'.$picto_haut.'">';
444 }else if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "DESC" ) {
445 echo '<img src="'.$picto_bas.'">';
454 foreach($listBug as $key => $bug) {
456 echo '<tr '.$HTML->boxGetAltRowStyle($nbligne).'">';
457 if($prioritiesImg[$bug['idPriority']] != "") {
458 echo '<td><img src="./img/'.$prioritiesImg[$bug['idPriority']].'"></td>';
462 echo '<td><a href="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$bug['id'].'&view=viewIssue">'.sprintf($format,$bug['id']).'</a></td>';
463 echo '<td>'.$bug['category'].'</td>';
464 echo '<td>'.$bug['project'].'</td>';
466 if($bug['severityId'] > 50) {
469 echo $bug['severityId'];
470 if($bug['severityId'] > 50) {
474 echo '<td>'.$bug['status_name'].'</td>';
475 echo '<td>'.strftime("%d/%m/%Y",strtotime($bug['last_updated'])).'</td>';
476 echo '<td>'.$bug['summary'];
477 if ($bug['view_state'] == 50) {
478 echo '<img src="./img/protected.gif">';
482 echo '<td>'.$bug['version'].'</td>';
483 echo '<td>'.$bug['fixed_in_version'].'</td>';
484 echo '<td>'.$bug['target_version'].'</td>';
489 echo "</table><br/>";
494 if ($type == "group" && $editable) {
496 <p class="notice_title" onclick='jQuery("#expandable_ticket").slideToggle(300);'><?php echo _('Add a new ticket') ?></p>
497 <div id='expandable_ticket' class="notice_content">
498 <?php include("addIssue.php") ?>
504 // Creation de la pagination
505 echo '<div align="center">';
506 for($i=1; $i<=$nombreDePages; $i++)
508 if($i==$pageActuelle) //Si il s'agit de la page actuelle...
510 echo '| <b>'.$i.'</b>';
512 echo '<form style="display:inline" name="page'.$i.'" method="post" action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&page='.$i.'" >';
513 echo '<input type="hidden" name="sort" value="'.$bugfilter['sort'].'" />';
514 echo '<input type="hidden" name="dir" value="'.$bugfilter['dir'].'" />';
515 if ( isset($bugfilter['show_status'])) {
516 foreach ($bugfilter['show_status'] as $key => $childStatus) {
517 echo '<input type="hidden" name="projectStatus[]" value="'.$childStatus.'"/>';
520 if ( isset($bugfilter['project_id'])) {
521 foreach ($bugfilter['project_id'] as $key => $childId) {
522 echo '<input type="hidden" name="projectChildId[]" value="'.$childId.'"/>';
525 echo '| <a href="javascript:document.page'.$i.'.submit();">'.$i.'</a>';