[evolvis-commits] r9428: Backed out deletion of project_summary(); it' s referenced from export/projhtml. php↵

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Feb 24 17:24:46 CET 2011


Author: mirabilos
Date: 2011-02-24 17:24:45 +0100 (Thu, 24 Feb 2011)
New Revision: 9428

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/project_summary.php
Log:
Backed out deletion of project_summary(); it's referenced from export/projhtml.php


Modified: trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 16:24:44 UTC (rev 9427)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 16:24:45 UTC (rev 9428)
@@ -2,7 +2,6 @@
 	* SQL optimization: Replaced a 'select *' with a 'select count(*)'
 	in Forum.class.  Modified query in project_summary.php to limit columns
 	returned to those used.
-	* Trimmed a large unused function - project_summary() - from project_summary.php.
 
 2004-03-08  Tom Copeland <tom at infoether.com>
 	* SQL optimization: Replaced 'select *' occurrences in User.class

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/project_summary.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/project_summary.php	2011-02-24 16:24:44 UTC (rev 9427)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/project_summary.php	2011-02-24 16:24:45 UTC (rev 9428)
@@ -83,4 +83,186 @@
 function project_get_public_forum_message_count($group_id) {
 	return project_getaggvalue($group_id, 'fmsg');
 }
+
+/**
+ * project_summary() - Build a project summary box that projects can insert into their project pages
+ *
+ * @param		int		The group ID
+ * @param		string	How to return the results.
+ * @param		bool	Whether to return the results within an HTML table or not
+ */
+function project_summary($group_id,$mode,$no_table) {
+	global $Language;
+	if (!$group_id) {
+		return 'Error - No Group ID';
+	}
+	if (!$mode) {
+		$mode='full';
+	}
+
+	$project =& group_get_object($group_id);
+	// ################## forums
+
+	if (!$project || !is_object($project)) {
+		return 'Could Not Create Project Object';
+	} elseif ($project->isError()) {
+		return $project->getErrorMessage();
+	}
+
+	if (!$no_table) {
+		$return .= '
+
+		<table border=0 width="100%"><tr><td bgcolor="#EAECEF">';
+	}
+
+	// ################## ArtifactTypes
+
+	$return .= '<a href="/tracker/?group_id='.$group_id.'">';
+	$return .= html_image("ic/tracker20g.png",'20','20',array('alt'=>'Tracker'));
+	$return .= ' Tracker</a>';
+
+	if ($mode != 'compact') {
+		$result=db_query("SELECT agl.*,aca.count,aca.open_count
+		FROM artifact_group_list agl
+		LEFT JOIN artifact_counts_agg aca USING (group_artifact_id) 
+		WHERE agl.group_id='$group_id'
+		AND agl.is_public=1
+		ORDER BY group_artifact_id ASC");
+
+		$rows = db_numrows($result);
+	
+		if (!$result || $rows < 1) {
+			$return .= '<br /><em>'.$Language->getText('project_home','no_trackers').'</em>';
+		} else {
+			for ($j = 0; $j < $rows; $j++) {
+				$return .= '<p>
+				 - <a href="/tracker/?atid='. db_result($result, $j, 'group_artifact_id') .
+				'&group_id='.$group_id.'&func=browse">'. db_result($result, $j, 'name') .'</a>
+				( <strong>'. db_result($result, $j, 'open_count') .' '.$Language->getText('general','open').'  / '. db_result($result, $j, 'count') . $Language->getText('general','total').' </strong> )<br />'.
+				db_result($result, $j, 'description') . '</p>';
+			}   
+		}
+	}
+
+	// ##################### Doc Manager
+
+	if ($project->usesForum()) {
+		$return .= '
+
+			<HR SIZE="1" NoShade>';
+		$return .= '<a href="/forum/?group_id='.$group_id.'">';
+		$return .= html_image("ic/forum20g.png","20","20",array("border"=>"0","ALT"=>"Forums"));
+		$return .= ' Forums</a>';
+
+		if ($mode != 'compact') {
+			$return .= " ( <strong>". project_get_public_forum_message_count($group_id) ."</strong> messages in ";
+			$return .= "<strong>". project_get_public_forum_count($group_id) ."</strong> forums )\n";
+		}
+	}
+
+	// ##################### Doc Manager
+
+	if ($project->usesDocman()) {
+		$return .= '
+
+			<hr size="1" noshade="noshade" />';
+		$return .= '<a href="/docman/?group_id='.$group_id.'">';
+		$return .= html_image("ic/docman16b.png","20","20",array("border"=>"0","alt"=>"Docs"));
+		$return .= ' Doc Manager</a>';
+	}
+
+	// ##################### Mailing lists
+
+	if ($project->usesMail()) {
+		$return .= '
+
+			<hr size="1" noshade="noshade" />';
+		$return .= '<a href="/mail/?group_id='.$group_id.'">';
+		$return .= html_image("ic/mail16b.png","20","20",array("border"=>"0","alt"=>"Mail Lists"));
+		$return .= ' Mailing Lists</a>';
+
+		if ($mode != 'compact') {
+			$return .= " ( <strong>". project_get_mail_list_count($group_id) ."</strong> public lists )";
+		}
+	}
+
+	// ##################### Task Manager 
+
+	if ($project->usesPm()) {
+		$return .= '
+
+			<HR SIZE="1" NoShade>';
+		$return .= '<a href="/pm/?group_id='.$group_id.'">';
+		$return .= html_image("ic/taskman20g.png","20","20",array("border"=>"0","ALT"=>"Tasks"));
+		$return .= ' Task Manager</a>';
+
+		if ($mode != 'compact') {
+			//get a list of publicly available projects
+			$sql="SELECT * FROM project_group_list WHERE group_id='$group_id' AND is_public=1";
+			$result = db_query ($sql);
+			$rows = db_numrows($result);
+			if (!$result || $rows < 1) {
+				$return .= '<br /><em>There are no public subprojects available</em>';
+			} else {
+				for ($j = 0; $j < $rows; $j++) {
+					$return .= '
+					<br />   - <a href="/pm/task.php?group_project_id='.db_result($result, $j, 'group_project_id').
+					'&group_id='.$group_id.'&func=browse">'.db_result($result, $j, 'project_name').'</a>';
+				}
+				db_free_result($result);
+			}
+		}
+	}
+
+	// ######################### Surveys 
+
+	if ($project->usesSurvey()) {
+		$return .= '
+
+			<hr size="1" noshade="noshade" />';
+		$return .= '<a href="/survey/?group_id='.$group_id.'">';
+		$return .= html_image("ic/survey16b.png","20","20",array("border"=>"0","alt"=>"Surveys"));
+		$return .= " Surveys</a>";
+		if ($mode != 'compact') {
+			$return .= ' ( <strong>'. project_get_survey_count($group_id) .'</strong> surveys )';
+		}
+	}
+
+	// ######################### CVS 
+
+	if ($project->usesCVS()) {
+		$return .= '
+
+			<HR SIZE="1" NoShade>';
+		$return .= '<a href="/scm/?group_id='.$group_id.'">';
+		$return .= html_image("ic/cvs16b.png","20","20",array("border"=>"0","ALT"=>"CVS"));
+		$return .= " CVS Tree</a>";
+
+		if ($mode != 'compact') {
+			$sql = "SELECT SUM(commits) AS commits,SUM(adds) AS adds from stats_cvs_group where group_id='$group_id'";
+			$result = db_query($sql);
+			$return .= ' ( <strong>'.db_result($result,0,0).'</strong> commits, <strong>'.db_result($result,0,1).'</strong> adds )';
+		}
+	}
+
+	// ######################## Released Files
+	
+	if ($project->isActive()) {
+		$return .= '
+
+			<hr size="1" noshade="noshade" />';
+		$return .= '<a href="/project/showfiles.php?group_id='.$group_id.'">';
+		$return .= html_image("ic/ftp16b.png","20","20",array("border"=>"0","alt"=>"FTP"));
+		$return .= " Released Files</a>";
+	}
+
+	if (!$no_table) {
+		$return .= '
+
+		</td></tr></table>';
+	}
+
+	return $return;
+}
+
 ?>



More information about the evolvis-commits mailing list