[evolvis-commits] r6504: - Optimized task.php

papel at evolvis.org papel at evolvis.org
Thu Apr 1 11:47:26 CEST 2010


Author: papel
Date: 2010-04-01 09:47:25 +0000 (Thu, 01 Apr 2010)
New Revision: 6504

Modified:
   trunk/gforge_base/gforge-4.8.1+evolvis/www/pm/task.php
Log:
- Optimized task.php

Modified: trunk/gforge_base/gforge-4.8.1+evolvis/www/pm/task.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/www/pm/task.php	2010-04-01 09:12:12 UTC (rev 6503)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/www/pm/task.php	2010-04-01 09:47:25 UTC (rev 6504)
@@ -50,25 +50,31 @@
 $parent_id = getIntFromRequest('parent_id');
 
 
-
+function buildView($group_id, $group_project_id, $new_group_project_id) {
+global $g, $pg;
+				 
 if (!$group_id || !$group_project_id) {
 	exit_missing_param();
 }
 
 $g =& group_get_object($group_id);
+				
 if (!$g || !is_object($g)) {
 	exit_no_group();
 } elseif ($g->isError()) {
 	exit_error('Error',$g->getErrorMessage());
-}
-
-$pg = new ProjectGroupHTML($g,$group_project_id);
+} 
+				  
+$pg = new ProjectGroupHTML($g, $new_group_project_id);
 if (!$pg || !is_object($pg)) {
-	exit_error('Error','Could Not Get Factory');
+		exit_error('Error','Could Not Get Factory');
 } elseif ($pg->isError()) {
-	exit_error('Error',$pg->getErrorMessage());
+		exit_error('Error',$pg->getErrorMessage());
+} 
 }
 
+buildView($group_id, $group_project_id, $group_project_id);
+
 /*
 	Figure out which function we're dealing with here
 */
@@ -167,25 +173,8 @@
 				}
 				$feedback=_('Task Updated Successfully');		
 				
-			    if (!$group_id || !$group_project_id) {
-					exit_missing_param();
-				}
+				buildView($group_id, $group_project_id, $new_group_project_id);
 
-				$g =& group_get_object($group_id);
-				
-				if (!$g || !is_object($g)) {
-					exit_no_group();
-				} elseif ($g->isError()) {
-					exit_error('Error',$g->getErrorMessage());
-				} 
-				  
-				$pg = new ProjectGroupHTML($g, $new_group_project_id);
-				if (!$pg || !is_object($pg)) {
-					exit_error('Error','Could Not Get Factory');
-				} elseif ($pg->isError()) {
-					exit_error('Error',$pg->getErrorMessage());
-				} 
-
 				$pt=new ProjectTaskHTML($pg, $project_task_id);
 				if (!$pt|| !is_object($pt)) {
 					exit_error('Error','Could Not Get ProjectTask');




More information about the evolvis-commits mailing list