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 29ec32712999fc0b1e343a1c2fa1441575f3c7d3 (commit)
from 83153b530d4ef6e2b4ff211cde83979a19238fa8 (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=29ec32712999fc0b1e343a1c2fa1441575f3c7d3
commit 29ec32712999fc0b1e343a1c2fa1441575f3c7d3
Author: Franck Villaume <[email protected]>
Date: Sun Oct 23 16:25:38 2016 +0200
Implement FRSRelease association
diff --git a/src/common/frs/FRSRelease.class.php
b/src/common/frs/FRSRelease.class.php
index 59db39e..658d7f0 100644
--- a/src/common/frs/FRSRelease.class.php
+++ b/src/common/frs/FRSRelease.class.php
@@ -23,7 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-require_once $gfcommon.'include/FFError.class.php';
+require_once $gfcommon.'include/FFObject.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
/**
@@ -71,7 +71,7 @@ function frsrelease_get_object($release_id, $data = array()) {
return $FRSRELEASE_OBJ['_'.$release_id.'_'];
}
-class FRSRelease extends FFError {
+class FRSRelease extends FFObject {
/**
* Associative array of data from db.
@@ -95,7 +95,6 @@ class FRSRelease extends FFError {
* @param array|bool $arr The associative array
of data.
*/
function __construct(&$FRSPackage, $release_id = false, $arr = false) {
- parent::__construct();
if (!$FRSPackage || !is_object($FRSPackage)) {
$this->setError(_('Invalid FRS Package Object'));
return;
@@ -104,9 +103,11 @@ class FRSRelease extends FFError {
$this->setError('FRSRelease:
'.$FRSPackage->getErrorMessage());
return;
}
+
$this->FRSPackage =& $FRSPackage;
if ($release_id) {
+ parent::__construct($release_id, 'FRSRelease');
if (!$arr || !is_array($arr)) {
if (!$this->fetchData($release_id)) {
return;
@@ -119,6 +120,8 @@ class FRSRelease extends FFError {
return;
}
}
+ } else {
+ parent::__construct();
}
}
diff --git a/src/common/frs/actions/addassociation.php
b/src/common/frs/actions/addassociation.php
new file mode 100644
index 0000000..fc0dafe
--- /dev/null
+++ b/src/common/frs/actions/addassociation.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * FusionForge FRS: Add association Action
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2002-2004 (c) GForge Team
+ * Copyright 2012-2014, 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 $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.');
+ session_redirect('/frs/?group_id='.$group_id);
+}
+
+$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');
+}
+
+$newobjectsassociation = getStringFromRequest('newobjectsassociation', '');
+if (strlen($newobjectsassociation) > 0) {
+ if ($frsr->addAssociations($newobjectsassociation)) {
+ $feedback = _('Associated Objects Successfully');
+ } else {
+ $error_msg = $frsr->getErrorMessage();
+ }
+} else {
+ $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/actions/deleteassociation.php
b/src/common/frs/actions/deleteassociation.php
new file mode 100644
index 0000000..99353a9
--- /dev/null
+++ b/src/common/frs/actions/deleteassociation.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * FusionForge FRS: Delete association Action
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2002-2004 (c) GForge Team
+ * Copyright 2012-2014,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 $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.');
+ session_redirect('/frs/?group_id='.$group_id);
+}
+
+$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');
+}
+
+$objectRefId = getStringFromRequest('objectrefid');
+$objectId = getStringFromRequest('objectid');
+$objectType = getStringFromRequest('objecttype');
+$link = getStringFromRequest('link');
+$was_error = false;
+if ($link == 'to') {
+ if (!$frsr->removeAssociationTo($objectId, $objectRefId, $objectType)) {
+ $error_msg = $frsr->getErrorMessage();
+ $was_error = true;
+ }
+} elseif ($link == 'from') {
+ if (!$frsr->removeAssociationFrom($objectId, $objectRefId,
$objectType)) {
+ $error_msg = $frsr->getErrorMessage();
+ $was_error = true;
+ }
+} elseif ($link == 'any') {
+ if (!$frsr->removeAllAssociations()) {
+ $error_msg = $frsr->getErrorMessage();
+ $was_error = true;
+ }
+}
+if (!$was_error) {
+ $feedback = _('Associations removed successfully');
+}
+
+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 a1c4f87..6333797 100644
--- a/src/common/frs/views/editrelease.php
+++ b/src/common/frs/views/editrelease.php
@@ -204,6 +204,16 @@ if ($g->usesTracker()) {
include $gfcommon.'frs/views/linktrackerroadmap.php';
}
+if (forge_get_config('use_object_associations')) {
+ echo html_e('hr');
+ echo html_e('h2', array(), _('Associate Objects To/From This Release'));
+
$frsr->showAssociations('/frs/?action=deleteassociation&group_id='.$group_id.'&package_id='.$package_id.'&release_id='.$release_id);
+ echo $HTML->openForm(array('action' =>
'/frs/?action=addassociation&group_id='.$group_id.'&package_id='.$package_id.'&release_id='.$release_id,
'method' => 'post'));
+ $frsr->showAddAssociations();
+ echo html_e('input', array('type' => 'submit', 'name' => 'submit',
'value' => _('Associate Objects')));
+ echo $HTML->closeForm();
+}
+
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/include/FFObject.class.php
b/src/common/include/FFObject.class.php
index 2961128..e94fd6e 100644
--- a/src/common/include/FFObject.class.php
+++ b/src/common/include/FFObject.class.php
@@ -86,6 +86,9 @@ class FFObject extends FFError {
case 'ArtifactHtml':
return $object->ArtifactType->getID();
break;
+ case 'FRSRelease':
+ return $object->FRSPackage->getID();
+ break;
}
}
@@ -98,6 +101,9 @@ class FFObject extends FFError {
case 'ArtifactHtml':
return $object->ArtifactType->Group->getID();
break;
+ case 'FRSRelease':
+ return $object->FRSPackage->Group->getID();
+ break;
}
}
@@ -110,6 +116,9 @@ class FFObject extends FFError {
case 'ArtifactHtml':
return 'Artifact';
break;
+ case 'FRSRelease':
+ return 'FRSRelease';
+ break;
}
}
@@ -121,6 +130,9 @@ class FFObject extends FFError {
case 'Artifact':
return _artifactid2url($objectId);
break;
+ case 'FRSRelease':
+ return _frsreleaseid2url($objectId);
+ break;
}
}
@@ -133,6 +145,9 @@ class FFObject extends FFError {
case 'ArtifactHtml':
return forge_check_perm('tracker',
$objectRefId, 'read');
break;
+ case 'FRSRelease':
+ return forge_check_perm('frs', $objectRefId,
'file');
+ break;
}
}
@@ -162,6 +177,16 @@ class FFObject extends FFError {
$this->setError(_('Unable to
retrieve object ref')._(': ').$objectRef);
$statusArr[] = false;
}
+ } elseif (preg_match('/^[Rr][0-9]+/',
$objectRef)) {
+ //Artifact Ref.
+ $frsreleaseid = substr($objectRef, 1);
+ $frsreleaseObject =
frsrelease_get_object($frsreleaseid);
+ if (is_object($frsreleaseObject)) {
+ $statusArr[] =
$this->addAssociationTo($frsreleaseObject);
+ } else {
+ $this->setError(_('Unable to
retrieve object ref')._(': ').$objectRef);
+ $statusArr[] = false;
+ }
} else {
$this->setError(_('No associate ref
object found')._(': ').$objectRef);
$statusArr[] = false;
diff --git a/src/www/frs/index.php b/src/www/frs/index.php
index af62a9c..120efd5 100644
--- a/src/www/frs/index.php
+++ b/src/www/frs/index.php
@@ -92,6 +92,7 @@ if
(file_exists(forge_get_config('source_path').'/common/frs/actions/'.$action.'
html_use_jqueryui();
html_use_coolfieldset();
+html_use_tablesorter();
use_javascript('/frs/scripts/FRSController.js');
site_project_header(array('title' => _('Project Filelist for
').$g->getPublicName(), 'group' => $group_id, 'toptab' => 'frs'));
-----------------------------------------------------------------------
Summary of changes:
src/common/frs/FRSRelease.class.php | 9 ++--
.../actions/{addfile.php => addassociation.php} | 35 ++++----------
.../actions/{addfile.php => deleteassociation.php} | 53 +++++++++++-----------
src/common/frs/views/editrelease.php | 10 ++++
src/common/include/FFObject.class.php | 25 ++++++++++
src/www/frs/index.php | 1 +
6 files changed, 78 insertions(+), 55 deletions(-)
copy src/common/frs/actions/{addfile.php => addassociation.php} (64%)
copy src/common/frs/actions/{addfile.php => deleteassociation.php} (62%)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits