[Fusionforge-commits] FusionForge branch master updated. 6.0.4-523-gdc6a3f2

Franck Villaume nerville at libremir.placard.fr.eu.org
Tue Jun 14 15:17:24 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  dc6a3f236e9363c5b8cea20b45e459857cf577a6 (commit)
       via  9ee93f4e85f9e0f7695ee95468982add90439772 (commit)
      from  ae0c3699dc26854bc43dfb5c0d9d45d1897ac281 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=dc6a3f236e9363c5b8cea20b45e459857cf577a6

commit dc6a3f236e9363c5b8cea20b45e459857cf577a6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 14 15:16:34 2016 +0200

    FRS: link package release to a existing roadmap created in the tracker module

diff --git a/src/CHANGES b/src/CHANGES
index b83625f..0df330a 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -9,6 +9,7 @@ FusionForge 6.X:
 * Docman: support private directory. (TrivialDev)
 * Docman: support document versioning. (TrivialDev)
 * Docman: support cross ref. forum, documents, task or artifact. (TrivialDev)
+* FRS: link package release to tracker roadmap. (TrivialDev)
 * Plugin AuthBuiltin: add captcha after 3 attempts with the same login [#795] (TrivialDev)
 * Projects Page: add paging system in full_list and tag_cloud subpages (TrivialDev)
 * SearchEngine: support only FTI queries (TrivialDev)
diff --git a/src/common/frs/FRSRelease.class.php b/src/common/frs/FRSRelease.class.php
index 1300fb1..585826e 100644
--- a/src/common/frs/FRSRelease.class.php
+++ b/src/common/frs/FRSRelease.class.php
@@ -1,11 +1,11 @@
 <?php
 /**
- * FusionForge file release system
+ * FusionForge FRS: Release Class
  *
  * Copyright 2002, Tim Perdue/GForge, LLC
  * Copyright 2009, Roland Mas
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014,2016, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -486,6 +486,55 @@ class FRSRelease extends FFError {
 		return true;
 	}
 
+	function isLinkedRoadmapRelease($roadmap_id, $roadmap_release) {
+		$roadmaps = array();
+		$res = db_query_params('SELECT roadmap_id FROM frs_release_tracker_roadmap_link WHERE release_id = $1 and roadmap_release = $2',
+					array($this->getID(), $roadmap_release));
+		if (!$res) {
+			return false;
+		}
+		$roadmaps = util_result_column_to_array($res);
+		return $roadmaps;
+	}
+
+	function deleteLinkedRoadmap($roadmap_id, $roadmap_release) {
+		db_begin();
+		$res = db_query_params('DELETE FROM frs_release_tracker_roadmap_link where roadmap_id = $1 and release_id = $2 and roadmap_release = $3',
+					array($roadmap_id, $this->getID(), $roadmap_release));
+		if (!$res) {
+			$this->setError(_('Error Delete Linked Roadmap')._(': ').db_error());
+			db_rollback();
+			return false;
+		}
+		db_commit();
+		return true;
+	}
+
+	function addLinkedRoadmap($roadmap_id, $roadmap_release) {
+		db_begin();
+		$res = db_query_params('INSERT INTO frs_release_tracker_roadmap_link (roadmap_id, release_id, roadmap_release) VALUES ($1, $2, $3)',
+					array($roadmap_id, $this->getID(), $roadmap_release));
+		if (!$res) {
+			$this->setError(_('Error Adding Linked Roadmap')._(': ').db_error());
+			db_rollback();
+			return false;
+		}
+		db_commit();
+		return true;
+	}
+
+	function getLinkedRoadmaps() {
+		$roadmaps = array();
+		$res = db_query_params('SELECT roadmap_id, roadmap_release FROM frs_release_tracker_roadmap_link WHERE release_id = $1',
+					array($this->getID()));
+		if (!$res) {
+			return false;
+		}
+		while ($arr = db_fetch_array($res)) {
+			$roadmaps[$arr[0]][] = $arr[1];
+		}
+		return $roadmaps;
+	}
 }
 
 // Local Variables:
diff --git a/src/common/frs/actions/linkroadmap.php b/src/common/frs/actions/linkroadmap.php
new file mode 100644
index 0000000..c8cc6ef
--- /dev/null
+++ b/src/common/frs/actions/linkroadmap.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * FusionForge FRS: Link Roadmap Action
+ *
+ * Copyright 2016, 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.
+ */
+
+/* please do not add require here : use www/frs/index.php to add require */
+/* global variables used */
+global $group_id; // id of group
+global $g; // group object
+global $HTML;
+global $feedback; // feedback message
+global $error_msg; // error message
+
+$package_id = getIntFromRequest('package_id');
+if (!forge_check_perm('frs', $package_id, 'release')) {
+	$error_msg = _('FRS Action Denied.');
+	session_redirect('/frs/?group_id='.$group_id);
+}
+
+$frsp = frspackage_get_object($package_id);
+if (!$frsp || !is_object($frsp)) {
+	exit_error(_('Could Not Get FRS Package'), 'frs');
+} elseif ($frsp->isError()) {
+	exit_error($frsp->getErrorMessage(), 'frs');
+}
+
+$release_id = getIntFromRequest('release_id');
+$frsr = frsrelease_get_object($release_id);
+if (!$frsr || !is_object($frsr)) {
+	exit_error(_('Could Not Get FRS Release'), 'frs');
+} elseif ($frsr->isError()) {
+	exit_error($frsr->getErrorMessage(), 'frs');
+}
+
+$roadmap_id = getIntFromRequest('roadmap_id');
+$roadmap_release = trim(getStringFromRequest('roadmap_release'));
+$type = getStringFromRequest('type');
+if ($roadmap_id && (strlen($roadmap_release) > 0)) {
+	switch ($type) {
+		case 'add': {
+			if ($frsr->addLinkedRoadmap($roadmap_id, $roadmap_release)) {
+				$feedback = _('Roadmap successfully linked');
+			} else {
+				$error_msg = _('Failed to link the roadmap');
+			}
+			break;
+		}
+		case 'del': {
+			if ($frsr->deleteLinkedRoadmap($roadmap_id, $roadmap_release)) {
+				$feedback = _('Roadmap successfully linked');
+			} else {
+				$error_msg = _('Failed to link the roadmap');
+			}
+			break;
+		}
+		default: {
+			$warning_msg = _('No action to perform');
+		}
+	}
+}
+
+session_redirect('/frs/?group_id='.$group_id.'&view=editrelease&release_id='.$release_id.'&package_id='.$package_id);
diff --git a/src/common/frs/views/editrelease.php b/src/common/frs/views/editrelease.php
index b587d3e..f2660bf 100644
--- a/src/common/frs/views/editrelease.php
+++ b/src/common/frs/views/editrelease.php
@@ -130,6 +130,7 @@ echo $HTML->openForm(array('enctype' => 'multipart/form-data', 'method' => 'post
 echo html_ao('fieldset');
 echo html_e('legend', array(), '<strong>'._('File Name').'</strong>');
 echo _('Upload a new file')._(': ').'<input type="file" name="userfile" />'.'('._('max upload size')._(': ').human_readable_bytes(util_get_maxuploadfilesize()).')';
+// the following var will be set by different include.
 $content = '';
 if (forge_get_config('use_ftp_uploads')) {
 	include ($gfcommon.'frs/views/useftpuploads.php');
@@ -198,4 +199,11 @@ if(count($files)) {
 }
 
 echo $HTML->jQueryUIconfirmBox('confirmbox1', _('Delete file'), _('You are about to delete permanently this file. Are you sure? This action is definitive.'));
+
+if ($g->usesTracker()) {
+	include $gfcommon.'frs/views/linktrackerroadmap.php';
+}
+
+echo html_e('hr');
+echo html_e('h2', array(), _('Monitoring Information'));
 echo html_e('p', array(), sprintf(ngettext('There is %s user monitoring this package.', 'There are %s users monitoring this package.', $frsp->getMonitorCount()), $frsp->getMonitorCount()));
diff --git a/src/common/frs/views/linktrackerroadmap.php b/src/common/frs/views/linktrackerroadmap.php
new file mode 100644
index 0000000..16f35aa
--- /dev/null
+++ b/src/common/frs/views/linktrackerroadmap.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * FusionForge FRS: Link Tracker Roadmaps to FRS Release
+ *
+ * Copyright 2016, 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.
+ */
+
+/* please do not add require here : use www/frs/index.php to add require */
+/* global variables used */
+global $HTML; // html object
+global $group_id; // id of group
+global $g; // group object
+global $frsr; // FRS release object
+
+echo html_e('hr');
+echo html_e('h2', array(), _('Attach/Detach Roadmaps To This Release'));
+$rf = new RoadmapFactory($g);
+$enabledRoadmaps = $rf->getRoadmaps(true);
+
+if (count($enabledRoadmaps)) {
+	$title_arr = array();
+	//$title_arr[] = html_e('input', array('id' => 'checkallroadactive', 'type' => 'checkbox', 'title' => _('Select / Deselect all roadmaps for massaction'), 'onClick' => 'controllerFRS.checkAll("checkedrelidroadactive", "roadactive")'));
+	$title_arr[] = _('Name');
+	$title_arr[] = _('Actions');
+	echo $HTML->listTableTop($title_arr, array(), '', '', array(), array(), array(array('style' => 'width: 30%')));
+	echo '<tr><td colspan="3" style="padding:0;">';
+	$i = 1;
+	foreach ($enabledRoadmaps as $enabledRoadmap) {
+		$releaseRoadmaps = $enabledRoadmap->getReleases();
+		if (count($releaseRoadmaps)) {
+			foreach ($releaseRoadmaps as $releaseRoadmap) {
+				if ($frsr->isLinkedRoadmapRelease($enabledRoadmap->getID(), $releaseRoadmap)) {
+					$type = 'del';
+					$labelInput = _('Detach this roadmap from this release');
+				} else {
+					$type = 'add';
+					$labelInput = _('Attach this roadmap from this release');
+				}
+				echo $HTML->openForm(array('action' => util_make_uri('/frs/?group_id='.$group_id.'&release_id='.$release_id.'&package_id='.$package_id.'&roadmap_id='.$enabledRoadmap->getID().'&action=linkroadmap&type='.$type), 'method' => 'post', 'id' => 'roadmap'.$enabledRoadmap->getID()));
+				echo $HTML->listTableTop();
+				$cells = array();
+				$inputAttr =
+				//$cells[] = array(html_e('input', array('type' => 'checkbox', 'value' => $enabledRoadmap->getID(), 'class' => 'checkedrelidroadactive', 'title' => _('Select / Deselect this roadmap for massaction'), 'onClick' => 'controllerFRS.checkgeneral("roadactive")')), 'style' => 'width: 2%; padding: 0px;');
+				$cells[] = array($enabledRoadmap->getName().' - '.$releaseRoadmap, 'style' => 'white-space: nowrap; width: 30%');
+				$cells[][] = '<input type="hidden" name="roadmap_release" value="'.$releaseRoadmap.'"><input type="submit" name="submit" value="'.$labelInput.'" />';
+				echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($i, true)), $cells);
+				echo $HTML->listTableBottom();
+				echo $HTML->closeForm();
+				$i++;
+			}
+		}
+	}
+	echo '</td></tr>';
+	echo $HTML->listTableBottom();
+} else {
+	echo $HTML->information(_('No Roadmap available'));
+}
diff --git a/src/common/frs/views/listpackages.php b/src/common/frs/views/listpackages.php
index 8d0452f..488bfac 100644
--- a/src/common/frs/views/listpackages.php
+++ b/src/common/frs/views/listpackages.php
@@ -136,6 +136,25 @@ if (count($FRSPackages) < 1) {
 					echo html_e('div', array('class' => 'frs_release_name_version'), $release_title.html_e('span', array('class' => 'frs-zip-release'), $ziplink, false));
 				}
 
+				// display linked roadmaps if any
+				if ($g->usesTracker()) {
+					$linkedRoadmaps = $FRSPackageRelease->getLinkedRoadmaps();
+					if (count($linkedRoadmaps)) {
+						$urls = '';
+						foreach ($linkedRoadmaps as $linkedRoadmapID => $linkedRoadmap) {
+							$roadmapObject = new Roadmap($g, $linkedRoadmapID);
+							$rnum = 0;
+							foreach ($linkedRoadmap as $linkedRoadmapRelease) {
+								if ($rnum)
+									$urls .= ' || ';
+								$urls .= util_make_link('/tracker/roadmap.php?group_id='.$group_id.'&release='.urlencode($linkedRoadmapRelease), $roadmapObject->getName().' - '.$linkedRoadmapRelease);
+								$rnum++;
+							}
+						}
+						echo html_e('span', array(), html_e('b', array(), _('Linked Roadmaps')._(': ')).$urls, false);
+					}
+				}
+
 				// get the files in this release....
 				$res_files = $FRSPackageRelease->getFiles();
 				$num_files = count($FRSPackageRelease);
diff --git a/src/db/20160612-frs-release-tracker-roadmap-link.sql b/src/db/20160612-frs-release-tracker-roadmap-link.sql
new file mode 100644
index 0000000..4f21376
--- /dev/null
+++ b/src/db/20160612-frs-release-tracker-roadmap-link.sql
@@ -0,0 +1,5 @@
+CREATE TABLE frs_release_tracker_roadmap_link (
+    release_id      integer REFERENCES frs_release ON DELETE CASCADE,
+    roadmap_id      integer REFERENCES roadmap ON DELETE CASCADE,
+    roadmap_release text NOT NULL
+);

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=9ee93f4e85f9e0f7695ee95468982add90439772

commit 9ee93f4e85f9e0f7695ee95468982add90439772
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 14 15:13:56 2016 +0200

    empty line

diff --git a/src/common/frs/actions/addfile.php b/src/common/frs/actions/addfile.php
index e37cfa0..57d9627 100644
--- a/src/common/frs/actions/addfile.php
+++ b/src/common/frs/actions/addfile.php
@@ -31,7 +31,6 @@ global $warning_msg; // warning message
 global $feedback; // feedback message
 global $error_msg; // error message
 
-
 $package_id = getIntFromRequest('package_id');
 if (!forge_check_perm('frs', $package_id, 'file')) {
 	$error_msg = _('FRS Action Denied.');

-----------------------------------------------------------------------

Summary of changes:
 src/CHANGES                                        |  1 +
 src/common/frs/FRSRelease.class.php                | 53 +++++++++++++++-
 src/common/frs/actions/addfile.php                 |  1 -
 .../frs/actions/{addfile.php => linkroadmap.php}   | 56 +++++++++--------
 src/common/frs/views/editrelease.php               |  8 +++
 src/common/frs/views/linktrackerroadmap.php        | 73 ++++++++++++++++++++++
 src/common/frs/views/listpackages.php              | 19 ++++++
 .../20160612-frs-release-tracker-roadmap-link.sql  |  5 ++
 8 files changed, 187 insertions(+), 29 deletions(-)
 copy src/common/frs/actions/{addfile.php => linkroadmap.php} (63%)
 create mode 100644 src/common/frs/views/linktrackerroadmap.php
 create mode 100644 src/db/20160612-frs-release-tracker-roadmap-link.sql


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list