File: editVersion.php

package info (click to toggle)
fusionforge 5.3.2%2B20141104-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 60,472 kB
  • sloc: php: 271,846; sql: 36,817; python: 14,575; perl: 6,406; sh: 5,980; xml: 4,294; pascal: 1,411; makefile: 911; cpp: 52; awk: 27
file content (102 lines) | stat: -rw-r--r-- 4,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
 * MantisBT plugin
 *
 * Copyright 2010-2011, Franck Villaume - Capgemini
 * Copyright 2012, Franck Villaume - TrivialDev
 * http://fusionforge.org
 *
 * This file is part of FusionForge. FusionForge is free software;
 * you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the Licence, or (at your option)
 * any later version.
 *
 * FusionForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

global $HTML;
global $mantisbt;
global $mantisbtConf;
global $username;
global $password;
global $group_id;
global $group;

$idVersion=getIntFromRequest('idVersion');

try {
	if (!isset($clientSOAP))
		$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));

	// currently this soap call is not included in mantisbt 1.2.x
	//$detailVersion = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "version_id" => $idVersion));
	$arrVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
} catch (SoapFault $soapFault) {
	echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
	$errorPage = true;
}

// select the right version until the soap call is ported.
$detailVersion = array();
foreach ($arrVersions as $key => $currentVersion) {
	if ($currentVersion->id == $idVersion) {
		$detailVersion = $currentVersion;
	}
}

if (!isset($errorPage)){
	echo $HTML->boxTop(_('Version Detail'));
	echo '<form method="POST" action="?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=updateVersion">';
	echo '<table>';
	echo	'<thead>';
	echo	'<tr>';
	echo		'<th>'._('Version').'</th>';
	echo		'<th>'._('Description').'</th>';
	echo		'<th>'._('Target Date').'</th>';
	echo		'<th>'._('Type').'</th>';
	echo	'</tr>';
	echo	'</thead>';
	echo	'<tbody>';
	echo	'<tr>';
	echo		'<td><input type="text" name="version_name" value="'.htmlspecialchars($detailVersion->name,ENT_QUOTES).'" /></td>';
	(isset($detailVersion->description)) ? $description_value = htmlspecialchars($detailVersion->description,ENT_QUOTES) : $description_value = '';
	echo		'<td><input type="text" name="version_description" value="'.$description_value.'" /></td>';
	echo		'<td><input type="text" name="version_date_order" size="32" value="'.strftime("%d/%m/%Y",strtotime($detailVersion->date_order)).'" />(format : DD/MM/YYYY)</td>';
	echo		'<td>';
	echo			'<select name="version_release">';
	if ($detailVersion->released) {
		echo		'<option value="1" selected>'._('Release').'</option>';
		echo		'<option value="0" >'._('Milestone').'</option>';
	} else {
		echo		'<option value="1" >'._('Release').'</option>';
		echo		'<option value="0" selected>'._('Milestone').'</option>';
	}
	echo			'</select>';
	echo		'</td>';
	echo	'</tr>';
	echo	'</tbody>';
	echo '</table>';
// need to be implemented
// 	if ($group->usesPlugin('projects-hierarchy')) {
// 		echo '<input type="checkbox" name="transverse" value="1">'._('Cross version (son included)').'</input>';
// 	}
	echo '<input type="hidden" name="version_id" value="'.$idVersion.'"></input>';
	echo '<input type="hidden" name="version_old_name" value="'.$detailVersion->name.'"></input>';
	echo '<br/>';
	echo '<input type="submit" value="'. _('Update') .'" />';
	echo '</form>';
	echo $HTML->boxBottom();

	echo '<form method="POST" action="?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=deleteVersion">';
	echo '<input type="hidden" name="deleteVersion" value="'.$idVersion.'"></input>';
	echo '<input type="submit" value="'. _('Delete') .'" />';
	echo '</form>';
}