[Fusionforge-commits] FusionForge branch master updated. 8fc21ed78af78d327eadea2a196150f4d4de5958

Alain Peyrat aljeux at fusionforge.org
Thu Dec 13 18:12:31 CET 2012


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  8fc21ed78af78d327eadea2a196150f4d4de5958 (commit)
      from  91ab96f2c8b61e18cc1c43875049bcb97d950049 (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 -----------------------------------------------------------------
commit 8fc21ed78af78d327eadea2a196150f4d4de5958
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Thu Dec 13 18:12:16 2012 +0100

    Tracker: redirect on ticket URL after submission and handle more nicely attachement errors (cannot drop ticket, some people may have received an email)

diff --git a/src/common/tracker/actions/tracker.php b/src/common/tracker/actions/tracker.php
index b691525..a73e5b5 100644
--- a/src/common/tracker/actions/tracker.php
+++ b/src/common/tracker/actions/tracker.php
@@ -74,73 +74,68 @@ switch (getStringFromRequest('func')) {
 			exit_error(_('Artifact Could Not Be Created'),'tracker');
 		} elseif (!forge_check_perm ('tracker',$ath->getID(),'submit')) {
 			exit_permission_denied('tracker');
+		}
+
+		if (empty($user_email)) {
+			$user_email=false;
 		} else {
-			if (empty($user_email)) {
-				$user_email=false;
-			} else {
-				if (!validate_email($user_email)) {
-					form_release_key(getStringFromRequest('form_key'));
-					exit_error(_('Invalid Email Address') . htmlspecialchars($user_email),'tracker');
-				}
-			}
-			if ($user_email) {
-				$details = "Anonymous message posted by $user_email\n\n".
-				$details;
-			}
-			if (!$ah->create($summary,$details,$assigned_to,$priority,$extra_fields)) {
+			if (!validate_email($user_email)) {
 				form_release_key(getStringFromRequest('form_key'));
-				exit_error($ah->getErrorMessage(),'tracker');
-			} else {
-				//
-				//	  Attach files to this Artifact.
-				//
-				$ext_feedback = '';
-				for ($i=0; $i<5; $i++) {
-					$f = getUploadedFile("input_file$i");
-					$error = $f['error'];
-					if (isset($error) && $error > 0) {
-						$n = $i+1;
-						if ($error === 1 || $error === 2) {
-							// UPLOAD_ERR_INI_SIZE or UPLOAD_ERR_FORM_SIZE
-							$ext_feedback .= "<br />ERROR: Skipping attachement $n: file is too large.";
-						} elseif ($error === 3) {
-							// UPLOAD_ERR_PARTIAL
-							$ext_feedback .= "<br />ERROR: Skipping attachement $n: transfert interrupted.";
-						}
-						continue;
-					}
-					$file_name = $f['name'];
-					$tmp_name = $f['tmp_name'];
-					$size = $f['size'];
-					$type = $f['type'];
-					if (!is_uploaded_file($tmp_name)) {
-						continue;
+				exit_error(_('Invalid Email Address') . htmlspecialchars($user_email),'tracker');
+			}
+		}
+		if ($user_email) {
+			$details = "Anonymous message posted by $user_email\n\n".$details;
+		}
+
+		if (!$ah->create($summary,$details,$assigned_to,$priority,$extra_fields)) {
+			$error_msg = $ah->getErrorMessage();
+			form_release_key(getStringFromRequest('form_key'));
+			include $gfcommon.'tracker/actions/add.php';
+		} else {
+			$feedback .= sprintf(_('Item %s successfully created'),'[#'.$ah->getID().']');
+			$aid = $ah->getID();
+			//
+			//	  Attach files to this Artifact.
+			//
+			for ($i=0; $i<5; $i++) {
+				$f = getUploadedFile("input_file$i");
+				$error = $f['error'];
+				if (isset($error) && $error > 0) {
+					$n = $i+1;
+					if ($error === 1 || $error === 2) {
+						// UPLOAD_ERR_INI_SIZE or UPLOAD_ERR_FORM_SIZE
+						$error_msg = sprintf(_('Error on attached file %1$d, file is too large (maximum: %2$s).'),
+							$n, ini_get('upload_max_filesize'));
+					} elseif ($error === 3) {
+						// UPLOAD_ERR_PARTIAL
+						$error_msg = sprintf(_('Error on attached file %1$d, transfert interrupted.'), $n);
 					}
+					continue;
+				}
+				$file_name = $f['name'];
+				$tmp_name = $f['tmp_name'];
+				$size = $f['size'];
+				$type = $f['type'];
+				if (!is_uploaded_file($tmp_name)) {
+					continue;
+				}
 
-					$afh=new ArtifactFileHtml($ah);
-					if (!$afh || !is_object($afh)) {
-						$error_msg .= _('Could Not Create File Object');
-					} elseif ($afh->isError()) {
-						$error_msg .= $afh->getErrorMessage();
-					} else {
-						if (!util_check_fileupload($tmp_name)) {
-							form_release_key(getStringFromRequest('form_key'));
-							//delete the artifact
-							$ah->delete(true);
-							exit_error(_('Invalid filename'),'tracker');
-						}
-						if (!$afh->upload($tmp_name,$file_name,$type,' ')) {
-							form_release_key(getStringFromRequest('form_key'));
-							//delete the artifact
-							$ah->delete(true);
-							exit_error(_('Could Not Attach File to Item: '.$afh->getErrorMessage()),'tracker');
-						}
+				$afh=new ArtifactFileHtml($ah);
+				if (!$afh || !is_object($afh)) {
+					$error_msg .= _('Could Not Create File Object');
+				} elseif ($afh->isError()) {
+					$error_msg .= $afh->getErrorMessage();
+				} else {
+					if (!util_check_fileupload($tmp_name)) {
+						$error_msg = _('Invalid filename');
+					}
+					if (!$afh->upload($tmp_name,$file_name,$type,' ')) {
+						$error_msg = _('Could Not Attach File to Item: '.$afh->getErrorMessage());
 					}
 				}
-				$feedback .= sprintf(_('Item %s successfully created'),'[#'.$ah->getID().']');
-				$feedback .= $ext_feedback;
-				include $gfcommon.'tracker/actions/browse.php';
 			}
+			session_redirect('/tracker/?group_id='.$group_id.'&atid='.$atid.'&aid='.$aid);
 		}
 		break;
 	}

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

Summary of changes:
 src/common/tracker/actions/tracker.php |  115 +++++++++++++++-----------------
 1 file changed, 55 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list