[Gbounty-commits] r6 - in trunk: . include www www/include

feri at garage.maemo.org feri at garage.maemo.org
Tue Oct 24 06:04:52 EEST 2006


Author: feri
Date: 2006-10-24 06:04:52 +0300 (Tue, 24 Oct 2006)
New Revision: 6

Modified:
   trunk/ChangeLog
   trunk/include/GbountyPlugin.class
   trunk/www/include/gbounty_dbutils.php
   trunk/www/include/gbounty_display.php
   trunk/www/index.php
Log:
cosmetics

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-10-24 02:41:21 UTC (rev 5)
+++ trunk/ChangeLog	2006-10-24 03:04:52 UTC (rev 6)
@@ -1,6 +1,12 @@
+2006-10-24 06:00 feri (ferenc at maemo.org)
+
+	Use $group_id all over instead of $id (AFAIK it is a sort of
+	convention in GForge)
+
 2006-10-24 05:32 feri (ferenc at maemo.org)
 	   
-	Adding information on how to claim a bounty (garage user or anonymous access)
+	Adding information on how to claim a bounty (garage user or
+	anonymous access)
 	Added 'project' and 'email' to plugin_gbounty_bounties table
 	Implementing delete/reopen of a bounty (admin interface)
 	
@@ -12,6 +18,6 @@
 2006-10-18 06:11 feri (ferenc at maemo.org)
 
 	Some initial functionality added:
-	The plugin is now able to list bounties and also display the detailed
-	information about a selected bounty.
+	The plugin is now able to list bounties and also display the
+	detailed information about a selected bounty.
 	Check out here: https://garage.maemo.org/plugins/gbounty/index.php?type=admin&id=104&pluginname=gbounty

Modified: trunk/include/GbountyPlugin.class
===================================================================
--- trunk/include/GbountyPlugin.class	2006-10-24 02:41:21 UTC (rev 5)
+++ trunk/include/GbountyPlugin.class	2006-10-24 03:04:52 UTC (rev 6)
@@ -43,7 +43,7 @@
 	  }
 	  if ( $project->usesPlugin($this->name) ) {
 		$params['TITLES'][]=$this->text;
-		$params['DIRS'][]='/plugins/gbounty/index.php?type=group&id=' . $group_id . "&pluginname=" . $this->name; 
+		$params['DIRS'][]='/plugins/gbounty/index.php?type=group&group_id=' . $group_id . "&pluginname=" . $this->name; 
 		// we indicate the part we are calling is the project one
 	  }# else {
 	  #	$params['TITLES'][]=$this->text." is [Off]";
@@ -52,7 +52,7 @@
 	} elseif ($hookname == "groupisactivecheckbox") {
 	  //Check if the group is active
 	  //this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
-	  $group = &group_get_object($group_id);
+	  $group = & group_get_object($group_id);
 	  echo "<tr>";
 	  echo "<td>";
 	  echo ' <input type="CHECKBOX" name="use_gbountyplugin" value="1" ';
@@ -122,9 +122,9 @@
 	  global $Language;
 	  // this displays the link in the project admin options page to it's gbounty administration
 	  $group_id = $params['group_id'];
-	  $group = &group_get_object($group_id);
+	  $group = & group_get_object($group_id);
 	  if ( $group->usesPlugin($this->name) ) {
-		echo '<a href="/plugins/gbounty/index.php?id='.$group->getID().'&type=admin&pluginname='.$this->name.'&action=admin">'.$Language->getText('project_admin','gbounty').'</a><br/>';
+		echo '<a href="/plugins/gbounty/index.php?group_id='.$group->getID().'&type=admin&pluginname='.$this->name.'&action=admin">'.$Language->getText('project_admin','gbounty').'</a><br/>';
 	  }
 	}												    
   }

Modified: trunk/www/include/gbounty_dbutils.php
===================================================================
--- trunk/www/include/gbounty_dbutils.php	2006-10-24 02:41:21 UTC (rev 5)
+++ trunk/www/include/gbounty_dbutils.php	2006-10-24 03:04:52 UTC (rev 6)
@@ -46,9 +46,9 @@
  * @return	array	all matching rows 
  *
  */
-function get_open_bounties($gforge_id, $limit='-1') {
-  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE status='0' AND project='".$gforge_id."';";
-  $res = db_query($qry,$limit);
+function get_open_bounties($group_id, $limit='-1') {
+  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE status='0' AND project='".$group_id."';";
+  $res = db_query($qry, $limit);
   return return_result($res);
 }
 
@@ -59,9 +59,9 @@
  * @return	array	all matching rows 
  *
  */
-function get_bounty_details($gforge_id, $id) {
-  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE b.id='".$id."' AND project='".$gforge_id."';";
-  $res = db_query($qry,$limit);
+function get_bounty_details($group_id, $id) {
+  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE b.id='".$id."' AND project='".$group_id."';";
+  $res = db_query($qry, $limit);
   return return_result($res);
 }
 
@@ -70,7 +70,7 @@
  */
 function get_solved_bounties($gforge_id, $limit='-1') {
   $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE status='1' AND project='".$gforge_id."';";
-  $res = db_query($qry,$limit);
+  $res = db_query($qry, $limit);
   return return_result($res);
 }
 
@@ -80,9 +80,9 @@
  * @param	integer	max amount of rows returned
  * @return	array	all matching rows 
  */
-function get_all_bounties($gforge_id, $limit='-1') {
-  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE project='".$gforge_id."';";
-  $res = db_query($qry,$limit);
+function get_all_bounties($group_id, $limit='-1') {
+  $qry = "SELECT * FROM plugin_gbounty_bounties b JOIN plugin_gbounty_details d ON (b.id=d.bounty_id) WHERE project='".$group_id."';";
+  $res = db_query($qry, $limit);
   return return_result($res);
 }
 

Modified: trunk/www/include/gbounty_display.php
===================================================================
--- trunk/www/include/gbounty_display.php	2006-10-24 02:41:21 UTC (rev 5)
+++ trunk/www/include/gbounty_display.php	2006-10-24 03:04:52 UTC (rev 6)
@@ -108,9 +108,6 @@
  *
  */
 function display_bounty_details($Language, $HTML, $bounty, $baseurl, $admin="false") {
-  #echo "<pre>";
-  #print_r($bounty);
-  #echo "</pre>";
   if (!$admin) {
 	echo '<center><a href="'.$baseurl.'">'.$Language->getText('general','backtobrowse').'</a></center>'."\n";
   }

Modified: trunk/www/index.php
===================================================================
--- trunk/www/index.php	2006-10-24 02:41:21 UTC (rev 5)
+++ trunk/www/index.php	2006-10-24 03:04:52 UTC (rev 6)
@@ -15,9 +15,9 @@
 
 // the header that displays for the user portion of the plugin
 function gbounty_Project_Header($params) {                                                                                                                                         
-  global $DOCUMENT_ROOT,$HTML,$id,$Language;                                                                            
+  global $DOCUMENT_ROOT,$HTML,$group_id,$Language;                                                                            
   $params['toptab']='gbounty'; 
-  $params['group']=$id;
+  $params['group']=$group_id;
 
   /*                                                                                                                                                              
    Show horizontal links                                                                                                                                   
@@ -50,11 +50,11 @@
 
 if (!$type) {
   exit_error("Cannot process your request","No TYPE specified"); 
- } elseif (!$id) {
+ } elseif (!$group_id) {
    exit_error("Cannot process your request","No ID specified");
  } else {
   if ($type == 'group') {
-	$group = group_get_object($id);
+	$group = group_get_object($group_id);
 	if ( !$group) {
 	  exit_error("Invalid Project", "Inexistent Project");
 	}
@@ -70,14 +70,14 @@
 	//}
 
 	// other perms checks here...
-	gbounty_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));    
+	gbounty_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($group_id))));    
 
 	// DO THE STUFF FOR THE PROJECT PART HERE
-	$baseurl="?type=".$type."&id=".$id."&pluginname=".$pluginname;
+	$baseurl="?type=".$type."&group_id=".$group_id."&pluginname=".$pluginname;
 
 	switch ($action) {
 	case "getdetail":
-	  $result = get_bounty_details($id, $bounty_id);
+	  $result = get_bounty_details($group_id, $bounty_id);
 	  if ($result) {
 		display_bounty_details($Language, $HTML, $result[0], $baseurl, false);
 		display_claim_info($Language, $HTML, $result[0], $baseurl);
@@ -86,7 +86,7 @@
 	  }
 	  break;
 	default:
-	  $result = get_open_bounties($id);
+	  $result = get_open_bounties($group_id);
 	  if ($result) {
 		browse_bounties($Language, $HTML, $result, $baseurl);
 	  } else {
@@ -96,23 +96,23 @@
 	}
 	
   } elseif ($type == 'user') {
-	$realuser = user_get_object($id);// 
+	$realuser = user_get_object($group_id);
 	if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
 	  exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
 	}
 
-	if ( (!$user) || ($user->getID() != $id)) { 
+	if ( (!$user) || ($user->getID() != $group_id)) { 
 	  // if someone else tried to access the private gbounty part of this user
 	  exit_error("Access Denied", "You cannot access other user's personal $pluginname");
 	}
 
 	gbounty_User_Header(array('title'=>'My '.$pluginname,'pagename'=>"$pluginname",'sectionvals'=>array($realuser->getUnixName())));    
 	// DO THE STUFF FOR THE USER PART HERE
-	$baseurl="?type=".$type."&id=".$id."&pluginname=".$pluginname;
+	$baseurl="?type=".$type."&group_id=".$group_id."&pluginname=".$pluginname;
 
 	switch ($action) {
 	case "getdetail":
-	  $result = get_bounty_details($id, $bounty_id);
+	  $result = get_bounty_details($group_id, $bounty_id);
 	  if ($result) {
 		display_bounty_details($Language, $HTML, $result[0], $baseurl, false);
 		display_claim_info($Language, $HTML, $result[0], $baseurl);
@@ -121,7 +121,7 @@
 	  }
 	  break;
 	default:
-	  $result = get_open_bounties($id);
+	  $result = get_open_bounties($group_id);
 	  if ($result) {
 		browse_bounties($Language, $HTML, $result, $baseurl);
 	  } else {
@@ -130,14 +130,14 @@
 	  break;
 	}
   } elseif ($type == 'admin') {
-	$group = group_get_object($id);
+	$group = group_get_object($group_id);
 	if ( !$group) {
 	  exit_error("Invalid Project", "Inexistent Project");
 	}
 
 	if ( ! ($group->usesPlugin ( $pluginname )) ) {
 	  //check if the group has the gbounty plugin active
-	  exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");			
+	  exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
 	}
 
 	$userperm = $group->getPermission($user);
@@ -148,14 +148,14 @@
 
 	//only project admin can access here
 	if ( $userperm->isAdmin() ) {
-	  gbounty_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));    
+	  gbounty_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($group_id))));    
 
 	  // DO THE STUFF FOR THE PROJECT ADMINISTRATION PART HERE
-	  $baseurl="?type=".$type."&id=".$id."&pluginname=".$pluginname;
+	  $baseurl="?type=".$type."&group_id=".$group_id."&pluginname=".$pluginname;
 
 	  switch ($action) {
 	  case "getdetail":
-		$result = get_bounty_details($id, $bounty_id);
+		$result = get_bounty_details($group_id, $bounty_id);
 		if ($result) {
 		  display_bounty_details($Language, $HTML, $result[0], $baseurl);
 		} else {
@@ -164,14 +164,14 @@
 		break;
 	  case "admin": 
 		echo "<h1>will be ready soon</h1>";
-		$result = get_all_bounties($id);
+		$result = get_all_bounties($group_id);
 		if ($result) {
 		  admin_bounties($Language, $HTML, $result, $baseurl);
 		  switch ($subcmd) {
 		  case "edit":
 			break;
 		  case "delete":
-			$result = get_bounty_details($id, $bounty_id);
+			$result = get_bounty_details($group_id, $bounty_id);
 			delete_bounty($Language, $HTML, $baseurl, $result[0]);
 			break;
 		  case "close":
@@ -204,7 +204,7 @@
 		}
 		break;
 	  default:
-		$result = get_open_bounties($id);
+		$result = get_open_bounties($group_id);
 		if($result) {
 		  browse_bounties($Language, $HTML, $result, $baseurl);
 		}else {



More information about the Gbounty-commits mailing list