[Fusionforge-commits] r12372 - in trunk/src/plugins/mantisbt: controler view www www/group

Franck VILLAUME nerville at fusionforge.org
Fri Feb 25 16:45:30 CET 2011


Author: nerville
Date: 2011-02-25 16:45:29 +0100 (Fri, 25 Feb 2011)
New Revision: 12372

Modified:
   trunk/src/plugins/mantisbt/controler/filter.php
   trunk/src/plugins/mantisbt/view/addIssue.php
   trunk/src/plugins/mantisbt/view/jumpToIssue.php
   trunk/src/plugins/mantisbt/view/viewIssues.php
   trunk/src/plugins/mantisbt/www/group/index.php
   trunk/src/plugins/mantisbt/www/index.php
Log:
make it work.... almost

Modified: trunk/src/plugins/mantisbt/controler/filter.php
===================================================================
--- trunk/src/plugins/mantisbt/controler/filter.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/controler/filter.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -1,6 +1,8 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * MantisBT plugin
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * Copyright 2010, Antoine Mercadal - Capgemini
  * http://fusionforge.org
  *
@@ -21,24 +23,30 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-$bugfilter = array ();
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
+global $group_id;
+
+$bugfilter = array();
 $bugfilter['_view_type'] = "advanced";
 
-if ( isset($_POST['sort']) ) {
+if (isset($_POST['sort'])) {
 	$bugfilter['sort'] = $_POST['sort'];
 } else {
 	$bugfilter['sort'] = "last_updated";
 }
-if ( isset($_POST['dir']) ) {
+if (isset($_POST['dir'])) {
 	$bugfilter['dir'] = $_POST['dir'];
 } else {
 	$bugfilter['dir'] = "DESC";
 }
-echo	'<form name="viewissues" id="mainform" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
-if ( isset($_POST['sort']) ) {
+echo	'<form name="viewissues" id="mainform" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'" >';
+if (isset($_POST['sort'])) {
 	echo '<input type="hidden" name="sort" value="'.$_POST['sort'].'" />';
 }
-if ( isset($_POST['dir']) ) {
+if (isset($_POST['dir'])) {
 	echo '<input type="hidden" name="dir" value="'.$_POST['dir'].'" />';
 }
 
@@ -58,7 +66,7 @@
 	foreach ($listStatus as $key => $status){
 		echo '<option value="'.$status->id.'"';
 		if (isset($_POST['projectStatus'])) {
-			$flipped_projectStatus = array_flip($_POST['projectStatus']); 
+			$flipped_projectStatus = array_flip($_POST['projectStatus']);
 			if (isset($flipped_projectStatus[$status->id])) {
 				echo 'selected="selected"';
 			}
@@ -69,10 +77,10 @@
 	echo '</div>';
 
 	if ($type == "group"){
-		$bugfilter['project_id'][] = $idProjetMantis;
+		$bugfilter['project_id'][] = $mantisbtConf['id_mantisbt'];
 		try {
-			$listChild = $clientSOAP->__soapCall('mc_project_get_all_subprojects', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
-			$mantisbtMembers =  $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis, "access" => "ANYBODY"));
+			$listChild = $clientSOAP->__soapCall('mc_project_get_all_subprojects', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
+			$mantisbtMembers =  $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt'], "access" => "ANYBODY"));
 		} catch (SoapFault $soapFault) {
 			echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
 			$errorPage = true;
@@ -80,28 +88,28 @@
 
 		if (!isset($errorPage)) {
 			if ( 0 != sizeof($listChild) ) {
-				echo '<div style="float: left; margin-right: 10px; width: 160px">';    
+				echo '<div style="float: left; margin-right: 10px; width: 160px">';
 				echo '<h4 style="border-bottom: 1px solid #DAE0EA">'. _('Include child projects:') .'</h4>';
 
 				echo '<select name="projectChildId[]" id="projectChildId" multiple style="width: 160px; height: 100px">';
-				foreach ( $listChild as $key => $child ) {
+				foreach ($listChild as $key => $child) {
 					// on en profite pour récupérer tous les membres de tous les projets
 					$mantisbtMembersChild = $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $child, "access" => "ANYBODY"));
-					foreach ( $mantisbtMembersChild as $key => $mantisbtMemberChild ) {
+					foreach ($mantisbtMembersChild as $key => $mantisbtMemberChild) {
 						$found = 0;
-						foreach ($mantisbtMembers as $key => $mantisbtMember ) {
+						foreach ($mantisbtMembers as $key => $mantisbtMember) {
 							if ( $mantisbtMemberChild->id == $mantisbtMember->id )
 								$found = 1;
 						}
 						if (!$found)
 							$mantisbtMembers[] = $mantisbtMemberChild;
 					}
-					$resultGroupNameFusionForge = db_query_params('select groups.group_name from groups,group_mantisbt where groups.group_id = group_mantisbt.id_group and group_mantisbt.id_mantisbt = $1',
+					$resultGroupNameFusionForge = db_query_params('select groups.group_name from groups,plugin_mantisbt where groups.group_id = plugin_mantisbt.id_group and plugin_mantisbt.id_mantisbt = $1',
 											array($child));
 					$rowGroupNameFusionForge = db_fetch_array($resultGroupNameFusionForge);
 					echo '<option value="'.$child.'"';
 					if (isset($_POST['projectChildId'])) {
-						$flipped_projectChildId = array_flip($_POST['projectChildId']); 
+						$flipped_projectChildId = array_flip($_POST['projectChildId']);
 						if (isset($flipped_projectChildId[$child])) {
 							echo 'selected="selected"';
 						}
@@ -114,7 +122,7 @@
 			echo '<div style="float: left; margin-right: 10px; width: 160px">';
 			echo '<h4 style="border-bottom: 1px solid #DAE0EA">'. _('Submitted by:') .'</h3>';
 			echo '<select name="projectReporters[]" id="projectReporters" multiple style="width: 160px; height: 100px">';
-			foreach ($mantisbtMembers as $key => $mantisbtMember ) {
+			foreach ($mantisbtMembers as $key => $mantisbtMember) {
 				echo '<option value="'.$mantisbtMember->id.'"';
 				if (isset($_POST['projectReporters'])) {
 					$flipped_projectReporters = array_flip($_POST['projectReporters']);
@@ -122,7 +130,7 @@
 						echo 'selected="selected"';
 					}
 				}
-				echo '>'.htmlspecialchars($mantisbtMember->real_name,ENT_QUOTES).'</option>';
+				echo '>'.htmlspecialchars($mantisbtMember->name,ENT_QUOTES).'</option>';
 			}
 			echo '</select>';
 			echo '</div>';
@@ -130,7 +138,7 @@
 			echo '<div style="float: left; margin-right: 10px; width: 160px">';
 			echo '<h4 style="border-bottom: 1px solid #DAE0EA">'. _('Assigned to:') .'</h3>';
 			echo '<select name="projectFixers[]" id="projectFixers" multiple style="width: 160px; height: 100px">';
-			foreach ($mantisbtMembers as $key => $mantisbtMember ) {
+			foreach ($mantisbtMembers as $key => $mantisbtMember) {
 				echo '<option value="'.$mantisbtMember->id.'"';
 				if (isset($_POST['projectFixers'])) {
 					$flipped_projectFixers = array_flip($_POST['projectFixers']);
@@ -138,32 +146,32 @@
 						echo 'selected="selected"';
 					}
 				}
-				echo '>'.htmlspecialchars($mantisbtMember->real_name,ENT_QUOTES).'</option>';
+				echo '>'.htmlspecialchars($mantisbtMember->name,ENT_QUOTES).'</option>';
 			}
 			echo '</select>';
 			echo '</div>';
 
-			if ( $_POST['projectChildId'] ) {
-				foreach ( $_POST['projectChildId'] as $key => $child ) {
+			if (isset($_POST['projectChildId'])) {
+				foreach ($_POST['projectChildId'] as $key => $child) {
 					$bugfilter['project_id'][] = $child;
 				}
 			}
 
-			if ( $_POST['projectReporters'] ) {
-				foreach ( $_POST['projectReporters'] as $key => $projectReporter ) {
+			if (isset($_POST['projectReporters'])) {
+				foreach ($_POST['projectReporters'] as $key => $projectReporter) {
 					$bugfilter['reporter_id'][] = $projectReporter;
 				}
 			}
 
-			if ( $_POST['projectFixers'] ) {
-				foreach ( $_POST['projectFixers'] as $key => $projectFixer ) {
+			if (isset($_POST['projectFixers'])) {
+				foreach ($_POST['projectFixers'] as $key => $projectFixer) {
 					$bugfilter['handler_id'][] = $projectFixer;
 				}
 			}
 		}
 	}
-	if ( $_POST['projectStatus'] ) {
-		foreach ( $_POST['projectStatus'] as $key => $statusId ) {
+	if (isset($_POST['projectStatus'])) {
+		foreach ($_POST['projectStatus'] as $key => $statusId) {
 			$bugfilter['show_status'][] = $statusId;
 		}
 	} else {
@@ -189,8 +197,8 @@
 EOT;
 	echo    '</div>';
 	echo '<br/><div style="clear:both;width:100%; text-align: right">'.
-		'<input type="button" value="Reinitialiser" onclick="reinit();"/> '.
-		'<input type="submit" value="Appliquer le filtre" /></div>';
+		'<input type="button" value="'._('Clear filter').'" onclick="reinit();"/> '.
+		'<input type="submit" value="'._('Apply filter').'" /></div>';
 	echo '</form>';
 }
 ?>

Modified: trunk/src/plugins/mantisbt/view/addIssue.php
===================================================================
--- trunk/src/plugins/mantisbt/view/addIssue.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/view/addIssue.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -1,10 +1,10 @@
 <?php
-
 /*
- * Copyright 2010, Capgemini
- * Authors: Franck Villaume - capgemini
- *          Antoine Mercadal - capgemini
+ * MantisBT plugin
  *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2010, Antoine Mercadal - Capgemini
+ *
  * This file is part of FusionForge.
  *
  * FusionForge is free software; you can redistribute it and/or modify
@@ -22,6 +22,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+global $mantisbt;
+global $mantisbtConf;
+global $user;
+global $password;
+global $group_id;
+
 //validate function : to be sure needed informations are set before submit
 print	('
 	<script language="javacript" type="text/javascript">
@@ -39,102 +45,102 @@
 	');
 
 try {
-    /* do not recreate $clientSOAP object if already created by other pages */
-    if (!isset($clientSOAP))
-        $clientSOAP = new SoapClient("http://".forge_get_config('server','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+	/* do not recreate $clientSOAP object if already created by other pages */
+	if (!isset($clientSOAP))
+		$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
 
-    $listCategories = $clientSOAP->__soapCall('mc_project_get_categories', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
-    $listSeverities = $clientSOAP->__soapCall('mc_enum_severities', array("username" => $username, "password" => $password));
-    $listReproducibilities = $clientSOAP->__soapCall('mc_enum_reproducibilities', array("username" => $username, "password" => $password));
-    $listViewStates = $clientSOAP->__soapCall('mc_enum_view_states', array("username" => $username, "password" => $password));
-    $listDevelopers = $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis, "acces" => 25));
-    $listPriorities = $clientSOAP->__soapCall('mc_enum_priorities', array("username" => $username, "password" => $password));
-    $listResolutions= $clientSOAP->__soapCall('mc_enum_resolutions', array("username" => $username, "password" => $password));
-    $listStatus= $clientSOAP->__soapCall('mc_enum_status', array("username" => $username, "password" => $password));
-    $listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
+	$listCategories = $clientSOAP->__soapCall('mc_project_get_categories', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
+	$listSeverities = $clientSOAP->__soapCall('mc_enum_severities', array("username" => $username, "password" => $password));
+	$listReproducibilities = $clientSOAP->__soapCall('mc_enum_reproducibilities', array("username" => $username, "password" => $password));
+	$listViewStates = $clientSOAP->__soapCall('mc_enum_view_states', array("username" => $username, "password" => $password));
+	$listDevelopers = $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt'], "acces" => 25));
+	$listPriorities = $clientSOAP->__soapCall('mc_enum_priorities', array("username" => $username, "password" => $password));
+	$listResolutions= $clientSOAP->__soapCall('mc_enum_resolutions', array("username" => $username, "password" => $password));
+	$listStatus= $clientSOAP->__soapCall('mc_enum_status', array("username" => $username, "password" => $password));
+	$listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
 } catch (SoapFault $soapFault) {
-    echo    '<div class="warning" >Un problème est survenu lors de la récupération des données : '.$soapFault->faultstring.'</div>';
-    $errorPage = true;
+	echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
+	$errorPage = true;
 }
 
 if (!isset($errorPage)){
-    echo 	'<form name="issue" method="POST" action="?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'&idBug='.$defect->id.'&action=addIssue" >';
-    echo	'<table class="innertabs">';
-    echo		'<tr>';
-    echo 			'<td width="16%" class="FullBoxTitle">Catégorie</td>';
-    echo 			'<td width="16%" class="FullBoxTitle">Reproductibilité</td>';
-    echo 			'<td width="16%" class="FullBoxTitle">Sévérité</td>';
-    echo 			'<td width="16%" class="FullBoxTitle">Priorité</td>';
-    echo 			'<td width="16%" class="FullBoxTitle">Assigné à</td>';
-    echo 			'<td width="16%" class="FullBoxTitle">Détecté en</td>';
-    echo		'</tr>';
-    echo		'<tr>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="categorie" class="sirhen">';
-    foreach ($listCategories as $key => $category){
-	    echo				"<option>".$category."</option>";
-    }
-    echo				'</select>';
-    echo			'</td>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="reproductibilite" class="sirhen">';
-    foreach ($listReproducibilities as $key => $reproducibility){
-	    echo				"<option>".$reproducibility->name."</option>";
-    }
-    echo				'</select>';
-    echo			'</td>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="severite" class="sirhen">';
-    foreach ($listSeverities as $key => $severity){
-	    echo				"<option>".$severity->name."</option>";
-    }
-    echo				'</select>';
-    echo			'</td>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="priorite" class="sirhen">';
-    foreach ($listPriorities as $key => $priority){
-	    echo				"<option>".$priority->name."</option>";
-    }
-    echo				'</select>';
-    echo 			'</td>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="handler" class="sirhen">';
-    echo					"<option></option>";
-    foreach ($listDevelopers as $key => $user){
-	    echo				"<option>".$user->name."</option>";
-    }
-    echo				'</select>';
-    echo			'</td>';
-    echo 			'<td class="FullBox">';
-    echo				'<select name="version" class="sirhen">';
-    echo					"<option></option>";
-    foreach ($listVersions as $key => $version){
-	    echo				"<option>".$version->name."</option>";
-    }
-    echo				'</select>';
-    echo			'</td>';
-    echo		'</tr>';
-    echo	'</table>';
-    echo	'<br/>';
-    echo	'<table class="innertabs">';
-    echo		'<tr>';
-    echo 			'<td width="20%" lass="FullBoxTitle">Résumé * <span style="font-weight:normal">(128 caractères max)</span></td>';
-    echo			'<td class="FullBox"><input type="text" name="resume" MAXLENGTH="128" style="width:99%;"></td>';
-    echo		'</tr>';
-    echo		'<tr>';
-    echo 			'<td class="FullBoxTitle">Description *</td>';
-    echo			'<td class="FullBox"><textarea name="description" style="width:99%;" rows="12"></textarea></td>';
-    echo		'</tr>';
-    echo		'<tr>';
-    echo 			'<td class="FullBoxTitle">Informations complémentaires</td>';
-    echo			'<td class="FullBox"><textarea name="informations" style="width:99%;" rows="12"></textarea></td>';
-    echo		'</tr>';
-    echo	'</table>';
-    echo 	'<div align="center">';
-    echo 		'<input type="button" name="submitbutton" value="Soumettre le ticket" onclick="validate();">';
-    echo 		'<input type="button" name="Annuler" value="Annuler" onclick="window.location.href=\'?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'\'">';
-    echo 	'</div>';
-    echo	'* obligatoire';
-    echo 	'</form>';
+	echo 	'<form name="issue" method="POST" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'&action=addIssue" >';
+	echo	'<table class="innertabs">';
+	echo		'<tr>';
+	echo 			'<td width="16%" class="FullBoxTitle">Catégorie</td>';
+	echo 			'<td width="16%" class="FullBoxTitle">Reproductibilité</td>';
+	echo 			'<td width="16%" class="FullBoxTitle">Sévérité</td>';
+	echo 			'<td width="16%" class="FullBoxTitle">Priorité</td>';
+	echo 			'<td width="16%" class="FullBoxTitle">Assigné à</td>';
+	echo 			'<td width="16%" class="FullBoxTitle">Détecté en</td>';
+	echo		'</tr>';
+	echo		'<tr>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="categorie" class="sirhen">';
+	foreach ($listCategories as $key => $category){
+		echo				"<option>".$category."</option>";
+	}
+	echo				'</select>';
+	echo			'</td>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="reproductibilite" class="sirhen">';
+	foreach ($listReproducibilities as $key => $reproducibility){
+		echo				"<option>".$reproducibility->name."</option>";
+	}
+	echo				'</select>';
+	echo			'</td>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="severite" class="sirhen">';
+	foreach ($listSeverities as $key => $severity){
+		echo				"<option>".$severity->name."</option>";
+	}
+	echo				'</select>';
+	echo			'</td>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="priorite" class="sirhen">';
+	foreach ($listPriorities as $key => $priority){
+		echo				"<option>".$priority->name."</option>";
+	}
+	echo				'</select>';
+	echo 			'</td>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="handler" class="sirhen">';
+	echo					"<option></option>";
+	foreach ($listDevelopers as $key => $user){
+		echo				"<option>".$user->name."</option>";
+	}
+	echo				'</select>';
+	echo			'</td>';
+	echo 			'<td class="FullBox">';
+	echo				'<select name="version" class="sirhen">';
+	echo					"<option></option>";
+	foreach ($listVersions as $key => $version){
+		echo				"<option>".$version->name."</option>";
+	}
+	echo				'</select>';
+	echo			'</td>';
+	echo		'</tr>';
+	echo	'</table>';
+	echo	'<br/>';
+	echo	'<table class="innertabs">';
+	echo		'<tr>';
+	echo 			'<td width="20%" lass="FullBoxTitle">Résumé * <span style="font-weight:normal">(128 caractères max)</span></td>';
+	echo			'<td class="FullBox"><input type="text" name="resume" MAXLENGTH="128" style="width:99%;"></td>';
+	echo		'</tr>';
+	echo		'<tr>';
+	echo 			'<td class="FullBoxTitle">Description *</td>';
+	echo			'<td class="FullBox"><textarea name="description" style="width:99%;" rows="12"></textarea></td>';
+	echo		'</tr>';
+	echo		'<tr>';
+	echo 			'<td class="FullBoxTitle">Informations complémentaires</td>';
+	echo			'<td class="FullBox"><textarea name="informations" style="width:99%;" rows="12"></textarea></td>';
+	echo		'</tr>';
+	echo	'</table>';
+	echo 	'<div align="center">';
+	echo 		'<input type="button" name="submitbutton" value="Soumettre le ticket" onclick="validate();">';
+	echo 		'<input type="button" name="Annuler" value="Annuler" onclick="window.location.href=\'?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'\'">';
+	echo 	'</div>';
+	echo	'* '._('Mandatory fields');
+	echo 	'</form>';
 }
 ?>

Modified: trunk/src/plugins/mantisbt/view/jumpToIssue.php
===================================================================
--- trunk/src/plugins/mantisbt/view/jumpToIssue.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/view/jumpToIssue.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -1,9 +1,9 @@
 <?php
-
 /*
- * Copyright 2010, Capgemini
- * Authors: Franck Villaume - capgemini
+ * MantisBT plugin
  *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ *
  * This file is part of FusionForge.
  *
  * FusionForge is free software; you can redistribute it and/or modify
@@ -21,9 +21,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+global $group_id;
+global $mantisbt;
+
 echo '<div style="width:98%; text-align:right; padding:5px;" >';
-echo '<form name="jump" method="post" action="?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'&view=viewIssue">';
-echo '<span>Aller au ticket :</span>';
+echo '<form name="jump" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'&view=viewIssue">';
+echo '<span>'. _('Jump to ticket:'). '</span>';
 echo '<input type="text" name="idBug">';
 echo '<input type="submit" value="Ok" />';
 echo '</form>';

Modified: trunk/src/plugins/mantisbt/view/viewIssues.php
===================================================================
--- trunk/src/plugins/mantisbt/view/viewIssues.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/view/viewIssues.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -1,7 +1,9 @@
 <?php
 /*
+ * MantisBT plugin
+ *
  * Copyright 2009, Fabien Dubois - Capgemini
- * Copyright 2009-2010, Franck Villaume - Capgemini
+ * Copyright 2009-2011, Franck Villaume - Capgemini
  * Copyright 2010, Antoine Mercadal - Capgemini
  * http://fusionforge.org
  *
@@ -34,6 +36,8 @@
 
 global $mantisbt;
 global $mantisbtConf;
+global $username;
+global $password;
 
 global $prioritiesImg, $bugPerPage;
 
@@ -102,7 +106,7 @@
 		if ($type == "user"){
 			$idsBugAll = $clientSOAP->__soapCall('mc_issue_get_filtered_by_user', array("username" => $username, "password" => $password, "filter" => $bugfilter ));
 		} else if ($type == "group"){
-			$idsBugAll = $clientSOAP->__soapCall('mc_project_get_issue_headers', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis,  "page_number" => -1, "per_page" => -1, "filter" => $bugfilter));
+			$idsBugAll = $clientSOAP->__soapCall('mc_project_get_issue_headers', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt'],  "page_number" => -1, "per_page" => -1, "filter" => $bugfilter));
 		}
 	} catch (SoapFault $soapFault) {
 		echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
@@ -124,6 +128,7 @@
 		$indexMin = ($pageActuelle - 1) * $bugPerPage;
 		$indexMax = ($pageActuelle * $bugPerPage) -1;
 		// construction du tableau
+		$listBugAll = array();
 		foreach ($idsBugAll as $defect) {
 			$listBugAll[] = array( "id"=> $defect->id, "idPriority"=> $defect->priority->id,
 						"category"=> $defect->category,"project" => $defect->project->name,
@@ -155,7 +160,7 @@
 		echo	'<tr>';
 		// Priority
 		echo		'<th class="InText" width="2%">';
-		echo			'<form name="filterprority" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="filterprority" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		} else if ($bugfilter['sort'] == "priority" && $bugfilter['dir'] == "DESC") {
@@ -183,7 +188,7 @@
 		echo 		'</th>';
 		// ID
 		echo		'<th class="InText" width="3%">';
-		echo			'<form name="filterid" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="filterid" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		} else if ($bugfilter['sort'] == "id" && $bugfilter['dir'] == "DESC") {
@@ -211,7 +216,7 @@
 		echo 		'</th>';
 		// Catégorie
 		echo		'<th class="InText" width="7%">';
-		echo			'<form name="filtercat" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="filtercat" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "category_id" && $bugfilter['dir'] == "DESC") {
@@ -239,7 +244,7 @@
 		echo 		'</th>';
 		// Projet
 		echo 		'<th class="InText" width="7%">';
-		echo			'<form name="projectid" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="projectid" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "project_id" && $bugfilter['dir'] == "DESC") {
@@ -267,7 +272,7 @@
 		echo 		'</th>';
 		// Sévérité
 		echo 		'<th class="InText" width="7%">';
-		echo			'<form name="severity" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="severity" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "severity" && $bugfilter['dir'] == "DESC") {
@@ -295,7 +300,7 @@
 		echo 		'</th>';
 		// Etat
 		echo 		'<th class="InText" width="15%">';
-		echo			'<form name="statusid" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="statusid" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "status" && $bugfilter['dir'] == "DESC") {
@@ -323,7 +328,7 @@
 		echo 		'</th>';
 		// Mis a jour (date)
 		echo 		'<th class="InText" width="7%">';
-		echo			'<form name="lastupdate" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="lastupdate" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "last_updated" && $bugfilter['dir'] == "DESC") {
@@ -351,7 +356,7 @@
 		echo 		'</th>';
 		// résumé
 		echo 		'<th class="InText" width="29%">';
-		echo			'<form name="summary" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="summary" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "summary" && $bugfilter['dir'] == "DESC") {
@@ -379,7 +384,7 @@
 		echo 		'</th>';
 		// version de détection
 		echo 		'<th class="InText" width="6%">';
-		echo			'<form name="version" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="version" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "version" && $bugfilter['dir'] == "DESC") {
@@ -407,7 +412,7 @@
 		echo 		'</th>';
 		// corrigé en version
 		echo		'<th class="InText" width="6%">';
-		echo			'<form name="fixed" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="fixed" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "fixed_in_version" && $bugfilter['dir'] == "DESC") {
@@ -435,7 +440,7 @@
 		echo 		'</th>';
 		// version cible : Milestone
 		echo		'<th class="InText" width="6%">';
-		echo			'<form name="target" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt">';
+		echo			'<form name="target" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'">';
 		if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "ASC") {
 			echo			'<input type=hidden name="dir" value="DESC"/>';
 		}else if ($bugfilter['sort'] == "target_version" && $bugfilter['dir'] == "DESC") {
@@ -476,7 +481,7 @@
 			}else{
 				echo		'<td class="InText"></td>';
 			}
-			echo		'<td class="InText"><a class="DataLink" href="?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'&idBug='.$bug['id'].'&view=viewIssue">'.sprintf($format,$bug['id']).'</a></td>';
+			echo		'<td class="InText"><a class="DataLink" href="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$bug['id'].'&view=viewIssue">'.sprintf($format,$bug['id']).'</a></td>';
 			echo 		'<td class="InText">'.$bug['category'].'</td>';
 			echo 		'<td class="InText">'.$bug['project'].'</td>';
 			echo 		'<td class="InText">';
@@ -507,7 +512,7 @@
 		// Ajout de ticket
 		if ($type == "group") {
 		?>
-			<p class="notice_title" onclick='$("#expandable_ticket").slideToggle(300);'>Soumettre un ticket</p>
+			<p class="notice_title" onclick='$("#expandable_ticket").slideToggle(300);'><?php echo _('Add a new ticket') ?></p>
 			<div id='expandable_ticket' class="notice_content">
 			<?php include("addIssue.php") ?>
 			</div>
@@ -523,7 +528,7 @@
 			{
 				echo '| <b>'.$i.'</b>';
 			} else {
-				echo '<form style="display:inline" name="page'.$i.'" method="post" action="?type='.$type.'&id='.$id.'&pluginname=mantisbt&page='.$i.'" >';
+				echo '<form style="display:inline" name="page'.$i.'" method="post" action="?type='.$type.'&id='.$group_id.'&pluginname='.$mantisbt->name.'&page='.$i.'" >';
 				echo 	'<input type="hidden" name="sort" value="'.$bugfilter['sort'].'" />';
 				echo 	'<input type="hidden" name="dir" value="'.$bugfilter['dir'].'" />';
 				if ( isset($bugfilter['show_status'])) {

Modified: trunk/src/plugins/mantisbt/www/group/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/group/index.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/www/group/index.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  * Project MantisBT page
  *

Modified: trunk/src/plugins/mantisbt/www/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/index.php	2011-02-25 15:36:28 UTC (rev 12371)
+++ trunk/src/plugins/mantisbt/www/index.php	2011-02-25 15:45:29 UTC (rev 12372)
@@ -76,6 +76,17 @@
 
 		$mantisbtConf = $mantisbt->getMantisBTConf($group_id);
 
+
+		if ($mantisbtConf['id_mantisbt'] === 0) {
+			$warning_msg = _('The mantisbt plugin for this project is not initialized.');
+			session_redirect('/plugins/'.$mantisbt->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&view=init&warning_msg='.urlencode($warning_msg));
+		}
+
+		if (!$mantisbtConf['sync_users']) {
+			$username = $mantisbtConf['soap_user'];
+			$password = $mantisbtConf['soap_password'];
+		}
+
 		switch ($action) {
 			case "updateIssue":
 			case "addNote":
@@ -95,32 +106,26 @@
 		}
 
 		$mantisbt->getHeader('project');
+		// URL analysis
+		$sort = getStringFromRequest('sort');
+		$dir = getStringFromRequest('dir');
+		$action = getStringFromRequest('action');
+		$idBug = getStringFromRequest('idBug');
+		$idNote = getStringFromRequest('idNote');
+		$idAttachment = getStringFromRequest('idAttachment');
+		$actionAttachment = getStringFromRequest('actionAttachment');
+		$page = getStringFromRequest('page');
 
-		if ($mantisbtConf['id_mantisbt'] === 0) {
-			$warning_msg = _('The mantisbt plugin for this project is not initialized.');
-			session_redirect('/plugins/'.$mantisbt->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&view=init&warning_msg='.urlencode($warning_msg));
+		// Si la variable $_GET['page'] existe...
+		if($page != null && $page != ''){
+			$pageActuelle=intval($page);
 		} else {
-			// URL analysis
-			$sort = getStringFromRequest('sort');
-			$dir = getStringFromRequest('dir');
-			$action = getStringFromRequest('action');
-			$idBug = getStringFromRequest('idBug');
-			$idNote = getStringFromRequest('idNote');
-			$idAttachment = getStringFromRequest('idAttachment');
-			$actionAttachment = getStringFromRequest('actionAttachment');
-			$page = getStringFromRequest('page');
+			$pageActuelle=1; // La page actuelle est la n°1
+		}
 
-			// Si la variable $_GET['page'] existe...
-			if($page != null && $page != ''){
-				$pageActuelle=intval($page);
-			} else {
-				$pageActuelle=1; // La page actuelle est la n°1
-			}
-
-			$format = "%07d";
-			// do the job
-			include ($mantisbt->name.'/www/group/index.php');
-		}
+		$format = "%07d";
+		// do the job
+		include ($mantisbt->name.'/www/group/index.php');
 		break;
 	}
 	case 'user': {




More information about the Fusionforge-commits mailing list