[Fusionforge-commits] r10620 - in trunk/src: common/include www/admin www/people www/people/admin

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Wed Sep 22 12:02:14 CEST 2010


Author: nerville
Date: 2010-09-22 12:02:14 +0200 (Wed, 22 Sep 2010)
New Revision: 10620

Modified:
   trunk/src/common/include/exit.php
   trunk/src/www/admin/index.php
   trunk/src/www/people/admin/index.php
   trunk/src/www/people/createjob.php
   trunk/src/www/people/editjob.php
   trunk/src/www/people/editprofile.php
   trunk/src/www/people/helpwanted-latest.php
   trunk/src/www/people/index.php
   trunk/src/www/people/people_utils.php
   trunk/src/www/people/skills_utils.php
   trunk/src/www/people/viewjob.php
   trunk/src/www/people/viewprofile.php
Log:
exit functions migration

Modified: trunk/src/common/include/exit.php
===================================================================
--- trunk/src/common/include/exit.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/common/include/exit.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -78,18 +78,18 @@
  * @param   string  toptab needed for navigation
  */
 function exit_missing_param($url='',$missing_params=array(),$toptab='') {
+    if (!empty($missing_params)) {
+        $error = _('Missing required parameters : ');
+        foreach ($missing_params as $missing_param) {
+            $error .= $missing_param.' ';
+        }
+    } else {
+        $error = sprintf(_('Missing required parameters.'));
+    }
     if (!empty($url)) {
-        if (!empty($missing_params)) {
-            $error = _('Missing required parameters : ');
-            foreach ($missing_params as $missing_param) {
-                $error .= $missing_param.' ';
-            }
-        } else {
-            $error = sprintf(_('Missing required parameters.'));
-        }
         session_redirect($url.'&error_msg='.urlencode($error));
     } else {
-	    exit_error(_('Missing required parameters.'),$toptab);
+	    exit_error($error,$toptab);
     }
 }
 

Modified: trunk/src/www/admin/index.php
===================================================================
--- trunk/src/www/admin/index.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/admin/index.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -191,6 +191,9 @@
 	}
 	if(forge_get_config('use_project_database')) { ?>
 		<li><a href="database.php"><?php echo _('Project Database Administration'); ?></a></li>
+	<?php } 
+	if(forge_get_config('use_people')) { ?>
+        <li><a href="<?php echo util_make_url ('/people/admin/'); ?>"><?php echo _('Job / Categories Administration'); ?></a></li>
 	<?php } ?>
 </ul>
 <?php }

Modified: trunk/src/www/people/admin/index.php
===================================================================
--- trunk/src/www/people/admin/index.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/admin/index.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,25 +1,25 @@
 <?php
 /**
- * GForge Help Wanted 
+ * Help Wanted 
  *
  * Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
+ * Copyright 2002-2004 (c) GForge Team
  * http://gforge.org/
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * 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 License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * 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 GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -28,7 +28,7 @@
 require_once $gfwww.'people/people_utils.php';
 
 if (!forge_get_config('use_people')) {
-	exit_disabled();
+	exit_disabled('home');
 }
 
 $group_id = getIntFromRequest('group_id');
@@ -44,30 +44,28 @@
 		if (getStringFromRequest('people_cat')) {
 			$cat_name = getStringFromRequest('cat_name');
 			if (!form_key_is_valid(getStringFromRequest('form_key'))) {
-				exit_form_double_submit();
+				exit_form_double_submit('admin');
 			}
 			$result=db_query_params('INSERT INTO people_job_category (name) VALUES ($1)', array($cat_name));
 			if (!$result) {
-				echo db_error();
 				form_release_key(getStringFromRequest("form_key"));
-				$feedback .= ' Error inserting value ';
+				$error_msg .= _(' Error inserting value: ').db_error();
 			}
 
-			$feedback .= ' Category Inserted ';
+			$feedback .= _('Category Inserted');
 
 		} else if (getStringFromRequest('people_skills')) {
 			$skill_name = getStringFromRequest('skill_name');
 			if (!form_key_is_valid(getStringFromRequest('form_key'))) {
-				exit_form_double_submit();
+				exit_form_double_submit('admin');
 			}
 			$result=db_query_params('INSERT INTO people_skill (name) VALUES ($1)', array($skill_name));
 			if (!$result) {
-				echo db_error();
 				form_release_key(getStringFromRequest("form_key"));
-				$feedback .= ' Error inserting value ';
+				$error_msg .= _('Error inserting value: ').db_error();
 			}
 
-			$feedback .= ' Skill Inserted ';
+			$feedback .= _('Skill Inserted');
 		}
 
 	} 
@@ -101,9 +99,8 @@
 		<input type="hidden" name="form_key" value="<?php echo form_generate_key();?>">
 		<h4>New Category Name:</h4>
 		<input type="text" name="cat_name" value="" size="15" maxlength="30" /><br />
+		<div class="warning">Once you add a category, it cannot be deleted</div>
 		<p>
-		<span class="imporant">Once you add a category, it cannot be deleted</span></p>
-		<p>
 		<input type="submit" name="submit" value="SUBMIT"></p>
 		</form></p>
 		<?php
@@ -135,9 +132,8 @@
 		<input type="hidden" name="form_key" value="<?php echo form_generate_key();?>">
 		<h4>New Skill Name:</h4>
 		<input type="text" name="skill_name" value="" size="15" maxlength="30" /><br />
+		<div class="warning">Once you add a skill, it cannot be deleted</div>
 		<p>
-		<span class="important">Once you add a skill, it cannot be deleted</span></p>
-		<p>
 		<input type="submit" name="submit" value="SUBMIT"></p>
 		</form></p>
 		<?php
@@ -162,6 +158,6 @@
 	}
 
 } else {
-	exit_permission_denied();
+	exit_permission_denied('home');
 }
 ?>

Modified: trunk/src/www/people/createjob.php
===================================================================
--- trunk/src/www/people/createjob.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/createjob.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,25 +1,25 @@
 <?php
 /**
- * GForge Help Wanted 
+ * Help Wanted 
  *
  * Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * http://fusionforge.org/
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * 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 License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * 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 GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -29,7 +29,7 @@
 require_once $gfwww.'project/admin/project_admin_utils.php';
 
 if (!forge_get_config('use_people')) {
-	exit_disabled();
+	exit_disabled('home');
 }
 
 $group_id = getIntFromRequest('group_id');
@@ -68,7 +68,7 @@
 	if (!$group_id) {
 		exit_no_group();
 	} else {
-		exit_permission_denied();
+		exit_permission_denied('home');
 	}
 }
 ?>

Modified: trunk/src/www/people/editjob.php
===================================================================
--- trunk/src/www/people/editjob.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/editjob.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -49,10 +49,10 @@
 			create a new job
 		*/
 		if (!$title || !$description || $category_id==100) {
-			exit_missing_param('',array(_('Title'),_('Description'),_('Category')),'home');
+			exit_missing_param('',array(_('Title'),_('Description'),_('Category')),'admin');
 		}
 		if (!form_key_is_valid(getStringFromRequest('form_key'))) {
-			exit_form_double_submit('home');
+			exit_form_double_submit('admin');
 		}
 		$result=db_query_params("INSERT INTO people_job (group_id,created_by,title,description,post_date,status_id,category_id) 
 VALUES ($1, $2, $3, $4, $5, $6, $7)", 
@@ -71,7 +71,7 @@
 		*/
 		if (!$title || !$description || $category_id==100 || $status_id==100 || !$job_id) {
 			//required info
-			exit_missing_param('',array(_('Title'),_('Description'),_('Category'),_('Status'),_('Job')),'home');
+			exit_missing_param('',array(_('Title'),_('Description'),_('Category'),_('Status'),_('Job')),'admin');
 		}
 
 		$result=db_query_params("UPDATE people_job SET title=$1,description=$2,status_id=$3,category_id=$4 WHERE job_id=$5 AND group_id=$6",
@@ -88,7 +88,7 @@
 		*/
 		if ($skill_id == "xyxy" || $skill_level_id==100 || $skill_year_id==100  || !$job_id) {
 			//required info
-			exit_missing_param('',array(_('Skill'),_('Skill Level'),_('Skill Year'),_('Job')),'home');
+			exit_missing_param('',array(_('Skill'),_('Skill Level'),_('Skill Year'),_('Job')),'admin');
 		}
 
 		if (people_verify_job_group($job_id,$group_id)) {
@@ -104,7 +104,7 @@
 		*/
 		if ($skill_level_id==100 || $skill_year_id==100  || !$job_id || !$job_inventory_id) {
 			//required info
-			exit_missing_param('',array(_('Skill Level'),_('Skill Year'),_('Job'),_('Job Inventory')),'home');
+			exit_missing_param('',array(_('Skill Level'),_('Skill Year'),_('Job'),_('Job Inventory')),'admin');
 		}
 
 		if (people_verify_job_group($job_id,$group_id)) {
@@ -125,7 +125,7 @@
 		*/
 		if (!$job_id) {
 			//required info
-			exit_missing_param('',array(_('Job')),'home');
+			exit_missing_param('',array(_('Job ID')),'admin');
 		}
 
 		if (people_verify_job_group($job_id,$group_id)) {

Modified: trunk/src/www/people/editprofile.php
===================================================================
--- trunk/src/www/people/editprofile.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/editprofile.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -130,7 +130,7 @@
 		} else {
 			if (getStringFromRequest('confirmMultiEdit')) {
 				if (!form_key_is_valid(getStringFromRequest('form_key'))) {
-					exit_form_double_submit();
+					exit_form_double_submit('my');
 				}
 
 				for($i = 0; $i < $numItems; $i++) {
@@ -232,16 +232,6 @@
 
 	people_header(array('title'=>_('Edit Your Profile')));
 
-	if (!empty($error_msg)) {
-		html_error_top($error_msg);
-	}
-	if (!empty($warning)) {
-		html_warning_top($warning);
-	}
-	if (!empty($feedback)) {
-		html_feedback_top($feedback);
-	}
-		
 	//for security, include group_id
 	$result = db_query_params("SELECT * FROM users WHERE user_id=$1", array(user_getid()));
 

Modified: trunk/src/www/people/helpwanted-latest.php
===================================================================
--- trunk/src/www/people/helpwanted-latest.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/helpwanted-latest.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,25 +1,25 @@
 <?php
 /**
- * GForge Help Wanted 
+ * Help Wanted 
  *
  * Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * http://fusionforge.org/
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * 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 License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * 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 GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -28,7 +28,7 @@
 require_once $gfwww.'people/people_utils.php';
 
 if (!forge_get_config('use_people')) {
-	exit_disabled();
+	exit_disabled('home');
 }
 
 $group_id = getIntFromRequest('group_id');

Modified: trunk/src/www/people/index.php
===================================================================
--- trunk/src/www/people/index.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/index.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,25 +1,25 @@
 <?php
 /**
- * GForge Help Wanted 
+ * Help Wanted 
  *
  * Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * http://fusionforge.org/
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * 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 License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * 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 GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 

Modified: trunk/src/www/people/people_utils.php
===================================================================
--- trunk/src/www/people/people_utils.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/people_utils.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -27,7 +27,6 @@
 function people_header($params) {
 	global $group_id,$job_id,$HTML;
 
-	var_dump($_SERVER);
 	if ($group_id) {
 		$params['toptab']='people';
 		$params['group']=$group_id;
@@ -88,6 +87,7 @@
 
 function people_add_to_skill_inventory($skill_id,$skill_level_id,$skill_year_id) {
 	global $feedback;
+	global $error_msg;
 	if (session_loggedin()) {
 		// check required fields
 		if (!$skill_id || $skill_id == "xyxy") {
@@ -102,10 +102,10 @@
 			if (!$result || db_affected_rows($result) < 1) {
 				$error_msg .= sprintf(_('ERROR inserting into skill inventory: %s'),db_error());
 			} else {
-				$feedback .= _('Added to skill inventory');
+				$feedback .= _('Added to skill inventory ');
 			}
 		} else {
-			$error_msg .= _('ERROR - skill already in your inventory');
+			$error_msg .= _('ERROR - skill already in your inventory ');
 		}
 		}
 	} else {

Modified: trunk/src/www/people/skills_utils.php
===================================================================
--- trunk/src/www/people/skills_utils.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/skills_utils.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,10 +1,25 @@
 <?php
 /**
- *
  * Skills support functions.
- *
+ * 
  * Copyright 2002 (c) Silicon and Software Systems (S3)
+ * 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 License, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 function displayUserSkills($user_id, $allowEdit) {

Modified: trunk/src/www/people/viewjob.php
===================================================================
--- trunk/src/www/people/viewjob.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/viewjob.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -1,25 +1,25 @@
 <?php
 /**
- * GForge Help Wanted 
+ * Help Wanted 
  *
  * Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * http://fusionforge.org/
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * 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 License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * 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 GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -28,7 +28,7 @@
 require_once $gfwww.'people/people_utils.php';
 
 if (!forge_get_config('use_people')) {
-	exit_disabled();
+	exit_disabled('home');
 }
 
 $group_id = getIntFromRequest('group_id');
@@ -52,10 +52,8 @@
 AND people_job.job_id=$1 AND people_job.group_id=$2",
 array($job_id, $group_id));
 	if (!$result || db_numrows($result) < 1) {
+		$error_msg .= _('POSTING fetch FAILED: No such posting for this project :').db_error();
 		people_header(array('title'=>_('View a Job')));
-		echo db_error();
-		$feedback .= _('POSTING fetch FAILED');
-		echo '<h2>'._('No such posting for this project').'</h2>';
 	} else {
 
 		people_header(array('title'=>_('View a Job')));
@@ -104,7 +102,7 @@
 	if (!$group_id) {
 		exit_no_group();
 	} else {
-		exit_error(_('Error'),_('Posting ID not found'));
+		exit_error(_('Posting ID not found'),'home');
 	}
 }
 

Modified: trunk/src/www/people/viewprofile.php
===================================================================
--- trunk/src/www/people/viewprofile.php	2010-09-22 08:53:26 UTC (rev 10619)
+++ trunk/src/www/people/viewprofile.php	2010-09-22 10:02:14 UTC (rev 10620)
@@ -42,16 +42,14 @@
 	/*
 		Fill in the info to create a job
 	*/
-	people_header(array('title'=>_('View a User Profile')));
-
 	//for security, include group_id
 	$result=db_query_params('SELECT * FROM users WHERE user_id=$1', array($user_id));
 	if (!$result || db_numrows($result) < 1) {
-		echo db_error();
-		$feedback .= _('User fetch FAILED');
-		echo '<h2>'._('No Such User').'</h2>';
+		$error_msg .= _('User fetch FAILED : No Such User: ').db_error();
+	    people_header(array('title'=>_('View a User Profile')));
 	} else {
 
+	    people_header(array('title'=>_('View a User Profile')));
 		/*
 			profile set private
 		*/




More information about the Fusionforge-commits mailing list