[evolvis-commits] r10076: first part of GUS heavily based on [#833] Grand Unified Search by Dominik Haas↵

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


Author: mirabilos
Date: 2011-02-24 17:37:21 +0100 (Thu, 24 Feb 2011)
New Revision: 10076

Added:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/DocsSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/ForumsSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/FrsSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/NewsSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TasksSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TrackersSearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/DocsHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumsHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/FrsHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/HtmlGroupSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/NewsHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TasksHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TrackersHtmlSearchRenderer.class
Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/include/constants.php
   trunk/gforge_base/evolvisforge-5.1/gforge/common/search/SearchQuery.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ArtifactHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumHtmlSearchRenderer.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/search/index.php
Log:
first part of GUS heavily based on [#833] Grand Unified Search by Dominik Haas


Modified: trunk/gforge_base/evolvisforge-5.1/gforge/common/include/constants.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/include/constants.php	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/include/constants.php	2011-02-24 16:37:21 UTC (rev 10076)
@@ -4,12 +4,18 @@
 
 define('SEARCH__TYPE_IS_ARTIFACT', 'artifact');
 define('SEARCH__TYPE_IS_SOFTWARE', 'soft');
-define('SEARCH__TYPE_IS_FORUM', 'forums');
+define('SEARCH__TYPE_IS_FORUM', 'forum');
 define('SEARCH__TYPE_IS_PEOPLE', 'people');
 define('SEARCH__TYPE_IS_SKILL', 'skill');
-define('SEARCH__TYPE_IS_DOCUMENT', 'document');
+define('SEARCH__TYPE_IS_DOCS', 'docs');
+define('SEARCH__TYPE_IS_TRACKERS', 'trackers');
+define('SEARCH__TYPE_IS_TASKS', 'tasks');
+define('SEARCH__TYPE_IS_FORUMS', 'forums');
+define('SEARCH__TYPE_IS_NEWS', 'news');
+define('SEARCH__TYPE_IS_FRS', 'frs');
 
 define('SEARCH__DEFAULT_ROWS_PER_PAGE', 25);
+define('SEARCH__ALL_SECTIONS', 'all');
 
 /* Mailing lists */
 

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/DocsSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/DocsSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/DocsSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,98 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('common/search/SearchQuery.class');
+
+class DocsSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	* flag if non public items are returned
+	*
+	* @var boolean $showNonPublic
+	*/	
+	var $showNonPublic;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections sections to search in
+	 * @param boolean $showNonPublic flag if private sections are searched too
+	 */
+	function DocsSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {	
+		$this->groupId = $groupId;
+		$this->showNonPublic = $showNonPublic;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+		
+		$this->setSections($sections);
+	}
+
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+		$sql = 'SELECT doc_data.docid, doc_data.title, doc_data.description, doc_groups.groupname'
+			.' FROM doc_data, doc_groups'
+			.' WHERE doc_data.doc_group = doc_groups.doc_group'
+			.' AND doc_data.group_id ='.$this->groupId;
+		if ($this->sections != SEARCH__ALL_SECTIONS) {
+			$sql .= ' AND doc_groups.groupname IN ('.$this->sections.') ';
+		}
+		if ($this->showNonPublic) {
+			$sql .= ' AND doc_data.stateid IN (1, 4, 5)';
+		} else {
+			$sql .= ' AND doc_data.stateid = 1';
+		}
+		$sql .= ' AND (('.$this->getIlikeCondition('title', $this->words).')' 
+			.' OR ('.$this->getIlikeCondition('description', $this->words).'))'
+			.' ORDER BY doc_groups.groupname, doc_data.docid';
+		return $sql;
+	}
+	
+	/**
+	 * getSections - returns the list of available doc groups
+	 *
+	 * @param $groupId int group id
+	 * @param $showNonPublic boolean if we should consider non public sections
+	 */
+	function getSections($groupId, $showNonPublic=false) {
+		$sql = 'SELECT doc_groups.doc_group, doc_groups.groupname FROM doc_groups, doc_data'
+			.' WHERE doc_groups.doc_group = doc_data.doc_group AND doc_groups.group_id = '.$groupId;
+		if ($showNonPublic) {
+			$sql .= ' AND doc_data.stateid IN (1, 4, 5)';
+		} else {
+			$sql .= ' AND doc_data.stateid = 1';
+		}
+		$sql .= ' ORDER BY groupname';
+		
+		$sections = array();
+		$res = db_query($sql);
+		while($data = db_fetch_array($res)) {
+			$sections[$data['doc_group']] = $data['groupname'];
+		}
+		return $sections;
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/ForumsSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/ForumsSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/ForumsSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,114 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('common/search/SearchQuery.class');
+
+class ForumsSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	* flag if non public items are returned
+	*
+	* @var boolean $showNonPublic
+	*/	
+	var $showNonPublic;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections sections to search in
+	 * @param boolean $showNonPublic flag if private sections are searched too
+	 */
+	function ForumsSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+		$this->groupId = $groupId;
+		$this->showNonPublic = $showNonPublic;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+		
+		$this->setSections($sections);
+	}
+
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+		$sql = 'SELECT forum.msg_id, forum.subject, forum.post_date, users.realname, forum_group_list.forum_name '
+			. 'FROM forum, users, forum_group_list '
+			. 'WHERE users.user_id = forum.posted_by '
+			. 'AND forum_group_list.group_forum_id = forum.group_forum_id '
+			. 'AND forum_group_list.is_public <> 9 '			
+			. 'AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = '.$this->groupId.') ';
+		if ($this->sections != SEARCH__ALL_SECTIONS) {
+			$sql .= 'AND forum_group_list.forum_name IN ('.$this->sections.') ';
+		}
+		if (!$this->showNonPublic) {
+			$sql .= 'AND forum_group_list.is_public = 1 ';
+		}
+		$sql .= 'AND (('.$this->getIlikeCondition('forum.body', $this->words).') '
+			. 'OR ('.$this->getIlikeCondition('forum.subject', $this->words).')) '
+			. 'ORDER BY forum_group_list.forum_name, forum.msg_id';
+		
+		return $sql;
+	}
+
+	/**
+	 * getSearchByIdQuery - get the sql query built to get the search results when we are looking for an int
+	 *
+	 * @return string sql query to execute
+	 */	
+	function getSearchByIdQuery() {
+		$sql = 'SELECT msg_id '
+			. 'FROM forum, forum_group_list '
+			. 'WHERE msg_id=\''.$this->searchId.'\' '
+			. 'AND forum_group_list.group_forum_id = forum.group_forum_id '
+			. 'AND group_forum_id=\''.$this->forumId.'\'';
+		if (!$this->showNonPublic) {
+			$sql .= ' AND forum_group_list.is_public = 1';
+		}
+
+		return $sql;
+	}
+	
+	/**
+	 * getSections - returns the list of available forums
+	 *
+	 * @param $groupId int group id
+	 * @param $showNonPublic boolean if we should consider non public sections
+	 */
+	function getSections($groupId, $showNonPublic=false) {
+		$sql = 'SELECT group_forum_id, forum_name FROM forum_group_list WHERE group_id = '.$groupId.' AND is_public <> 9';
+		if (!$showNonPublic) {
+			$sql .= ' AND is_public = 1';
+		}
+		$sql .= ' ORDER BY forum_name';
+		
+		$sections = array();
+		$res = db_query($sql);
+		while($data = db_fetch_array($res)) {
+			$sections[$data['group_forum_id']] = $data['forum_name'];
+		}
+		return $sections;
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/FrsSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/FrsSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/FrsSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,100 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('common/search/SearchQuery.class');
+
+class FrsSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	* flag if non public items are returned
+	*
+	* @var boolean $showNonPublic
+	*/	
+	var $showNonPublic;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections sections to search in
+	 */
+	function FrsSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {	
+		$this->groupId = $groupId;
+		$this->showNonPublic = $showNonPublic;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+		
+		$this->setSections($sections);
+	}
+	
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+		$sql = 'SELECT frs_package.name as package_name, frs_release.name as release_name, frs_release.release_date, frs_release.release_id, users.realname'
+			. ' FROM frs_file, frs_release, users, frs_package'
+			. ' WHERE frs_release.released_by = users.user_id'
+			. ' AND frs_package.package_id = frs_release.package_id'
+			. ' AND frs_file.release_id=frs_release.release_id'
+			. ' AND frs_package.group_id='.$this->groupId;
+		
+		if ($this->sections != SEARCH__ALL_SECTIONS) {
+			$sql .= ' AND frs_package.name IN ('.$this->sections.') ';
+		}
+		if(!$this->showNonPublic) {
+			$sql .= ' AND is_public=1';
+		}
+
+		$sql .= ' AND (('.$this->getIlikeCondition('frs_release.changes', $this->words).')' 
+			. ' OR ('.$this->getIlikeCondition('frs_release.notes', $this->words).')'
+			. ' OR ('.$this->getIlikeCondition('frs_release.name', $this->words).')'
+			. ' OR ('.$this->getIlikeCondition('frs_file.filename', $this->words).'))'
+			. ' ORDER BY frs_package.name, frs_release.name';
+
+		return $sql;
+	}
+	
+	/**
+	 * getSections - returns the list of available forums
+	 *
+	 * @param $groupId int group id
+	 * @param $showNonPublic boolean if we should consider non public sections
+	 */
+	function getSections($groupId, $showNonPublic) {
+		$sql = 'SELECT package_id, name FROM frs_package WHERE group_id = \''.$groupId.'\' ORDER BY name';
+		
+		if(!$showNonPublic) {
+			$sql .= ' AND is_public=1';
+		}
+		$sql .= ' ORDER BY name';
+		
+		$sections = array();
+		$res = db_query($sql);
+		while($data = db_fetch_array($res)) {
+			$sections[$data['package_id']] = $data['name'];
+		}
+		return $sections;
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/NewsSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/NewsSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/NewsSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('common/search/SearchQuery.class');
+
+class NewsSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 */
+	function NewsSearchQuery($words, $offset, $isExact, $groupId) {	
+		$this->groupId = $groupId;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+	}
+
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+		$sql = 'SELECT news_bytes.summary, news_bytes.post_date, news_bytes.forum_id, users.realname'
+			. ' FROM news_bytes, users'
+			. ' WHERE (group_id='.$this->groupId.' AND is_approved <> \'4\' AND news_bytes.submitted_by = users.user_id' 
+			. ' AND (('.$this->getIlikeCondition('summary', $this->words).')' 
+			. ' OR ('.$this->getIlikeCondition('details', $this->words).')))'
+			. ' ORDER BY post_date DESC';
+		return $sql;
+	}
+}
+
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/SearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/SearchQuery.class	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/SearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -60,6 +60,12 @@
 	 * @var boolean $isExact
 	 */
 	 var $isExact = false;
+	/**
+	 * sections to search in
+	 *
+	 * @var array $sections
+	 */	
+	var $sections = SEARCH__ALL_SECTIONS;
 
 	/**
 	 * Constructor
@@ -218,6 +224,22 @@
 	function getWords() {
 		return $this->words;
 	}
+	
+	/**
+	 * setSections - set the sections list
+	 *
+	 * @param $sections mixed array of sections or SEARCH__ALL_SECTIONS
+	 */
+	function setSections($sections) {
+		if(is_array($sections)) {
+			//make a comma separated string from the sections array
+			foreach($sections as $key => $section) 
+				$sections[$key] = '\''.$section.'\'';
+			$this->sections = implode(', ', $sections);
+		} else {
+			$this->sections = $sections;
+		}
+	}
 
 }
 

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TasksSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TasksSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TasksSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,95 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('common/search/SearchQuery.class');
+
+class TasksSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	* flag if non public items are returned
+	*
+	* @var boolean $showNonPublic
+	*/	
+	var $showNonPublic;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections sections to search in
+	 * @param boolean $showNonPublic flag if private sections are searched too
+	 */
+	function TasksSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {	
+		$this->groupId = $groupId;
+		$this->showNonPublic = $showNonPublic;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+				
+		$this->setSections($sections);
+	}
+
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+		$sql = 'SELECT project_task.project_task_id,project_task.summary,project_task.percent_complete,'
+			. ' project_task.start_date,project_task.end_date,users.firstname||\' \'||users.lastname AS realname, project_group_list.project_name, project_group_list.group_project_id ' 
+			. ' FROM project_task, users, project_group_list' 
+			. ' WHERE project_task.created_by = users.user_id'
+			. ' AND project_task.group_project_id = project_group_list.group_project_id '
+			. ' AND project_group_list.group_id  ='.$this->groupId;
+		if ($this->sections != SEARCH__ALL_SECTIONS) {
+			$sql .= 'AND project_group_list.project_name in ('.$this->sections.') ';
+		}
+		if (!$this->showNonPublic) {
+			$sql .= 'AND project_group_list.is_public = 1 ';
+		}
+		$sql .= 'AND(('.$this->getIlikeCondition('summary', $this->words).')' 
+			. ' OR ('.$this->getIlikeCondition('details', $this->words).'))' 
+			. ' ORDER BY project_group_list.project_name, project_task.project_task_id';
+		return $sql;
+	}
+	
+	/**
+	 * getSections - returns the list of available subprojects
+	 *
+	 * @param $groupId int group id
+	 * @param $showNonPublic boolean if we should consider non public sections
+	 */
+	function getSections($groupId, $showNonPublic=false) {
+		$sql = 'SELECT group_project_id, project_name FROM project_group_list WHERE group_id = '.$groupId.'';
+		if (!$showNonPublic) {
+			$sql .= ' AND is_public = 1';
+		}
+		$sql .= ' ORDER BY project_name';
+		
+		$sections = array();
+		$res = db_query($sql);
+		while($data = db_fetch_array($res)) {
+			$sections[$data['group_project_id']] = $data['project_name'];
+		}
+		return $sections;
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TrackersSearchQuery.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TrackersSearchQuery.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/search/TrackersSearchQuery.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('common/search/SearchQuery.class');
+
+class TrackersSearchQuery extends SearchQuery {
+	
+	/**
+	* group id
+	*
+	* @var int $groupId
+	*/
+	var $groupId;
+	
+	/**
+	* flag if non public items are returned
+	*
+	* @var boolean $showNonPublic
+	*/	
+	var $showNonPublic;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections sections to search in
+	 * @param boolean $showNonPublic flag if private sections are searched too
+	 */
+	function TrackersSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+		$this->groupId = $groupId;
+		$this->showNonPublic = $showNonPublic;
+		
+		$this->SearchQuery($words, $offset, $isExact);
+
+		$this->setSections($sections);
+	}
+
+	/**
+	 * getQuery - get the sql query built to get the search results
+	 *
+	 * @return string sql query to execute
+	 */
+	function getQuery() {
+
+		$sql = 'SELECT DISTINCT artifact.artifact_id, artifact.group_artifact_id, artifact.summary, artifact.open_date, users.realname, artifact_group_list.name '
+			. 'FROM artifact LEFT OUTER JOIN artifact_message USING (artifact_id), users, artifact_group_list '
+			. 'WHERE users.user_id = artifact.submitted_by '
+			. 'AND artifact_group_list.group_artifact_id = artifact.group_artifact_id '
+			. 'AND artifact_group_list.group_id = '.$this->groupId.' ';
+		if ($this->sections != SEARCH__ALL_SECTIONS) {
+			$sql .= 'AND artifact_group_list.name in ('.$this->sections.') ';
+		}
+		if (!$this->showNonPublic) {
+			$sql .= 'AND artifact_group_list.is_public = 1 ';
+		}
+		$sql .= 'AND (('.$this->getIlikeCondition('artifact.details', $this->words).') ' 
+			. 'OR ('.$this->getIlikeCondition('artifact.summary', $this->words).') '
+			. 'OR ('.$this->getIlikeCondition('artifact_message.body', $this->words).')) '
+			. 'ORDER BY artifact_group_list.name, artifact.artifact_id';
+
+		return $sql;
+	}
+	
+	/**
+	 * getSections - returns the list of available trackers
+	 *
+	 * @param $groupId int group id
+	 * @param $showNonPublic boolean if we should consider non public sections
+	 */
+	function getSections($groupId, $showNonPublic=false) {
+		$sql = 'SELECT group_artifact_id, name FROM artifact_group_list WHERE group_id = '.$groupId.'';
+		if (!$showNonPublic) {
+			$sql .= ' AND artifact_group_list.is_public = 1';
+		}
+		$sql .= ' ORDER BY name';
+		
+		$sections = array();
+		$res = db_query($sql);
+		while($data = db_fetch_array($res)) {
+			$sections[$data['doc_group']] = $data['groupname'];
+		}
+		return $sections;
+	}
+}
+
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -803,22 +803,27 @@
 		<div align="center" style="font-size:smaller">
 
 		<select name="type_of_search">';
-
-		if ($atid && $group_id) {
-			$group =& group_get_object($group_id);
-			if ($group && is_object($group)) {
-				$ath = new ArtifactTypeHtml($group,$atid);
-				if ($ath && is_object($ath)) {
-				print '
-				<option value="'.SEARCH__TYPE_IS_ARTIFACT.'"'.( $type_of_search == SEARCH__TYPE_IS_ARTIFACT ? ' selected="selected"' : '' ).'>'. $ath->getName() .'</option>';
-				}
+		if($group_id) {
+			$Group =& group_get_object($group_id);
+			if($Group && is_object($Group) && !$Group->isError()) {
+				if ($atid) {
+					$ath = new ArtifactTypeHtml($group,$atid);
+					if ($ath && is_object($ath)) {
+						print '<option value="'.SEARCH__TYPE_IS_ARTIFACT.'"'.( $type_of_search == SEARCH__TYPE_IS_ARTIFACT ? ' selected="selected"' : '' ).'>'. $ath->getName() .'</option>';
+					}
+				} elseif ($forum_id) {
+					print '<option value="'.SEARCH__TYPE_IS_FORUM.'"'.( $type_of_search == SEARCH__TYPE_IS_FORUM ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','forum').'</option>';
+				}/* else if ($group_id && $group_project_id) {
+					print '<option value="task"'. ( $type_of_search == 'tasks' ? ' selected="selected"' : '').'>'.$Language->getText('searchbox','task').'</option>';
+				}*/
+		
+				print '<option value="'.SEARCH__TYPE_IS_TRACKERS.'"'.( $type_of_search == SEARCH__TYPE_IS_TRACKERS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','trackers').'</option>';
+				print '<option value="'.SEARCH__TYPE_IS_FORUMS.'"'.( $type_of_search == SEARCH__TYPE_IS_FORUMS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','forums').'</option>';
+				print '<option value="'.SEARCH__TYPE_IS_TASKS.'"'.( $type_of_search == SEARCH__TYPE_IS_TASKS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','tasks').'</option>';
+				print '<option value="'.SEARCH__TYPE_IS_FRS.'"'.( $type_of_search == SEARCH__TYPE_IS_FRS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','frs').'</option>';
+				print '<option value="'.SEARCH__TYPE_IS_DOCS.'"'.( $type_of_search == SEARCH__TYPE_IS_DOCS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','docs').'</option>';
+				print '<option value="'.SEARCH__TYPE_IS_NEWS.'"'.( $type_of_search == SEARCH__TYPE_IS_NEWS ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','news').'</option>';
 			}
-		} else if ($group_id && $forum_id) {
-			print '
-			<option value="'.SEARCH__TYPE_IS_FORUM.'"'.( $type_of_search == SEARCH__TYPE_IS_FORUM ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','forum').'</option>';
-		} else if ($group_id && $group_project_id) {
-			print '
-			<option value="task"'. ( $type_of_search == 'tasks' ? ' selected="selected"' : '').'>'.$Language->getText('searchbox','task').'</option>';
 		}
 
 		print '

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab	2011-02-24 16:37:21 UTC (rev 10076)
@@ -1,9 +1,10 @@
-#/**#  *
+#/**
 #  * Default message catalog (English)
 #  *
-#  * GForge: Breaking Down the Barriers to Open Source Development
+#  * GForge
 #  * Copyright 1999-2001 (c) VA Linux Systems
-#  * http://sourceforge.net
+#  * Copyright 2002-2004 (c) GForge Team
+#  * http://gforge.org
 #  *
 #  * @version   $Id$
 #  *
@@ -2074,15 +2075,24 @@
 search	artifact_author	Submitted By
 search	artifact_date	Date
 search	artifact_id	#
-search	artifact_summary	Bug Summary
+search	artifact_summary	Summary
+search	docs_id	#
+search	docs_title	Title
+search	docs_description	Description
 search	error_criteria_not_specified	Enter Your Search Words Above
 search	error_invalid_search	Error - Invalid search
 search	error_search_minlength	Search must be at least three characters
 search	forum_author	Author
 search	forum_date	Date
 search	forum_thread	Thread
+search	frs_release_name	Release Name
+search	frs_posted_by	Posted By
+search	frs_post_date	Post Date
 search	group_name	Group Name
 search	group_description	Description
+search	news_summary	Summary 
+search	news_posted_by	Posted By
+search	news_post_date	Post Date
 search	next_results	Next Results
 search	no_matches_found	No matches found for <em>$1</em>
 search	people_real_name	Real Name
@@ -2096,13 +2106,25 @@
 search	skill_title	Title
 search	skill_to	To
 search	skill_type	Type
+search  tasks_id        #
+search	tasks_summary	Summary
+search	tasks_start_date	Start Date
+search	tasks_end_date	End Date
+search	tasks_created_by	Created By
+search	tasks_completed	Completed
 search	title	Search
+searchbox	docs	This project's documents
 searchbox	forum	This forum
+searchbox	forums	This project's forums
+searchbox	frs	This project's releases
+searchbox	news	This project's news
 searchbox	people	People
 searchbox	search	Search
 searchbox	skill	Skill
 searchbox	softwaregroup	Software/Group
 searchbox	task	Tasks
+searchbox	tasks	This project's tasks
+searchbox	trackers	This project's trackers
 sendmessage	about_blurb	In an attempt to reduce spam, we are using this form to send email.<p />Fill it out accurately and completely or the receiver may not be able to respond.<p /><font color="red"><b>IF YOU ARE WRITING FOR HELP:</b> Did you read the site documentation? Did you include your <b>user_id</b> and <b>user_name?</b> If you are writing about a project, include your <b>project id</b> (<b>group_id</b>) and <b>Project Name</b>.</font>
 sendmessage	contact	Contact
 sendmessage	email	Your Email Address

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ArtifactHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ArtifactHtmlSearchRenderer.class	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ArtifactHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -11,19 +11,12 @@
  * @version $Id$
  */
 
-require_once('www/search/include/HtmlSearchRenderer.class');
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
 require_once('common/search/ArtifactSearchQuery.class');
 
-class ArtifactHtmlSearchRenderer extends HtmlSearchRenderer {
+class ArtifactHtmlSearchRenderer extends HtmlGroupSearchRenderer {
 	
 	/**
-	 * group id
-	 *
-	 * @var int $groupId
-	 */
-	var $groupId;
-	
-	/**
 	 * artifact id
 	 *
 	 * @var int $artifactId
@@ -45,7 +38,7 @@
 		
 		$searchQuery = new ArtifactSearchQuery($words, $offset, $isExact, $groupId, $artifactId);
 		
-		$this->HtmlSearchRenderer(SEARCH__TYPE_IS_ARTIFACT, $words, $isExact, $searchQuery);
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_ARTIFACT, $words, $isExact, $searchQuery, $groupId, 'tracker');
 		
 		$this->tableHeaders = array(
 			$this->Language->getText('search', 'artifact_id'),
@@ -54,15 +47,6 @@
 			$this->Language->getText('search', 'artifact_date')
 		);
 	}
-
-	/**
-	 * writeHeader - write the header of the output
-	 * artifact search has a specific header
-	 */
-	function writeHeader() {
-		site_project_header(array('title' => $this->Language->getText('search', 'project_search'), 'group' => $this->groupId, 'pagename' => 'search', 'toptab' => 'tracker'));
-		parent::writeHeader();
-	}
 	
 	/**
 	 * getRows - get the html output for result rows
@@ -97,7 +81,7 @@
 	 * @return string url to previous results page
 	 */
 	function getPreviousResultsUrl() {
-		return parent::getPreviousResultsUrl().'&group_id='.$this->groupId.'&atid='.$this->artifactId;
+		return parent::getPreviousResultsUrl().'&atid='.$this->artifactId;
 	}
 	
 	/**
@@ -106,7 +90,7 @@
 	 * @return string url to next results page
 	 */
 	function getNextResultsUrl() {
-		return parent::getNextResultsUrl().'&group_id='.$this->groupId.'&atid='.$this->artifactId;
+		return parent::getNextResultsUrl().'&atid='.$this->artifactId;
 	}
 	
 	/**

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/DocsHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/DocsHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/DocsHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,90 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/DocsSearchQuery.class');
+			  
+class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function DocsHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+					
+		$searchQuery = new DocsSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
+		
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_DOCS, $words, $isExact, $searchQuery, $groupId, 'docman');
+		
+		$this->tableHeaders = array(
+			' ',
+			$this->Language->getText('search', 'docs_id'),
+			$this->Language->getText('search', 'docs_title'),
+			$this->Language->getText('search', 'docs_description'),
+		);
+	}
+
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+		
+		$return = '';
+		
+		$lastDocGroup = null;
+		
+		$rowColor = 0;
+		for($i = 0; $i < $rowsCount; $i++) {
+			//section changed
+			$currentDocGroup = db_result($result, $i, 'groupname');
+			if ($lastDocGroup != $currentDocGroup) {
+				$return .= '<tr><td colspan="4">'.$currentDocGroup.'</td></tr>';
+				$lastDocGroup = $currentDocGroup;
+				$rowColor = 0;
+			}
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
+				. '<td width="5%"> </td>'
+				. '<td>'.db_result($result, $i, 'docid').'</td>'
+				. '<td><a href="/docman/view.php/'.$this->groupId
+				. '/'.db_result($result, $i, 'docid').'/'.db_result($result, $i, 'title').'">'
+				. html_image('ic/msg.png', '10', '12', array('border' => '0'))
+				. ' '.db_result($result, $i, 'title').'</a></td>'
+				. '<td>'.db_result($result, $i, 'description').'</td></tr>';
+			$rowColor++;
+		}
+		return $return;
+	}
+
+	/**
+	 * getSections - get the array of possible sections to search in
+	 * 
+  	 * @return array sections
+	 */		
+	function getSections($groupId) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		return $this->searchQuery->getSections($groupId, $userIsGroupMember);
+	}
+}
+
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumHtmlSearchRenderer.class	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -11,19 +11,12 @@
  * @version $Id$
  */
 
-require_once('www/search/include/HtmlSearchRenderer.class');
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
 require_once('common/search/ForumSearchQuery.class');
 
-class ForumHtmlSearchRenderer extends HtmlSearchRenderer {
+class ForumHtmlSearchRenderer extends HtmlGroupSearchRenderer {
 	
 	/**
-	 * group id
-	 *
-	 * @var int $groupId
-	 */
-	var $groupId;
-	
-	/**
 	 * forum id
 	 *
 	 * @var int $groupId
@@ -40,12 +33,11 @@
 	 * @param int $forumId forum id
 	 */
 	function ForumHtmlSearchRenderer($words, $offset, $isExact, $groupId, $forumId) {
-		$this->groupId = $groupId;
 		$this->forumId = $forumId;
 		
 		$searchQuery = new ForumSearchQuery($words, $offset, $isExact, $groupId, $forumId);
 		
-		$this->HtmlSearchRenderer(SEARCH__TYPE_IS_FORUM, $words, $isExact, $searchQuery);
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FORUM, $words, $isExact, $searchQuery, $groupId, 'forums');
 		
 		$this->tableHeaders = array(
 			$this->Language->getText('search', 'forum_thread'),
@@ -53,14 +45,6 @@
 			$this->Language->getText('search', 'forum_date')
 		);
 	}
-
-	/**
-	 * writeHeader - write the header of the output
-	 */
-	function writeHeader() {
-		site_project_header(array('title' => $this->Language->getText('search', 'project_search'), 'group' => $this->groupId, 'pagename' => 'search', 'toptab' => 'forums'));
-		parent::writeHeader();
-	}
 	
 	/**
 	 * getRows - get the html output for result rows
@@ -90,7 +74,7 @@
 	 * @return string url to previous results page
 	 */
 	function getPreviousResultsUrl() {
-		return parent::getPreviousResultsUrl().'&group_id='.$this->groupId.'&forum_id='.$this->forumId;
+		return parent::getPreviousResultsUrl().'&forum_id='.$this->forumId;
 	}
 	
 	/**
@@ -99,7 +83,7 @@
 	 * @return string url to next results page
 	 */
 	function getNextResultsUrl() {
-		return parent::getNextResultsUrl().'&group_id='.$this->groupId.'&forum_id='.$this->forumId;
+		return parent::getNextResultsUrl().'&forum_id='.$this->forumId;
 	}
 
 	/**

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumsHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumsHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/ForumsHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,88 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/ForumsSearchQuery.class');
+	
+class ForumsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function ForumsHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		$searchQuery = new ForumsSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
+		
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FORUMS, $words, $isExact, $searchQuery, $groupId, 'forums');
+		
+		$this->tableHeaders = array(
+			'',
+			$this->Language->getText('search', 'forum_thread'),
+			$this->Language->getText('search', 'forum_author'),
+			$this->Language->getText('search', 'forum_date')
+		);
+	}
+
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+
+		$return = '';
+		$rowColor = 0;
+		$lastForumName = null;
+		
+		for($i = 0; $i < $rowsCount; $i++) {
+			//section changed
+			$currentForumName = db_result($result, $i, 'forum_name');
+			if ($lastForumName != $currentForumName) {
+				$return .= '<tr><td colspan="4">'.$currentForumName.'</td></tr>';
+				$lastForumName = $currentForumName;
+				$rowColor = 0;
+			}
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
+						. '<td width="5%"> </td>'
+						. '<td><a href="/forum/message.php?msg_id='. db_result($result, $i, 'msg_id').'">'
+							. html_image('ic/msg.png', '10', '12', array('border' => '0')).' '.db_result($result, $i, 'subject')
+							.'</a></td>'			
+						. '<td width="15%">'.db_result($result, $i, 'realname').'</td>'
+						. '<td width="15%">'.date($dateFormat, db_result($result, $i, 'post_date')).'</td></tr>';
+			$rowColor ++;
+		}
+		return $return;
+	}
+	
+	/**
+	 * getSections - get the array of possible sections to search in
+	 * 
+  	 * @return array sections
+	 */				
+	function getSections($groupId) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		return $this->searchQuery->getSections($groupId, $userIsGroupMember);
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/FrsHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/FrsHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/FrsHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,87 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/FrsSearchQuery.class');
+			  
+class FrsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function FrsHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		$searchQuery = new FrsSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
+		
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FRS, $words, $isExact, $searchQuery, $groupId, 'frs');
+		
+		$this->tableHeaders = array(
+			' ',
+			$this->Language->getText('search', 'frs_release_name'),
+			$this->Language->getText('search', 'frs_posted_by'),
+			$this->Language->getText('search', 'frs_post_date'),
+		);
+	}
+
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+		
+		$return = '';
+		$rowColor = 0;
+		$lastPackage = null;
+		
+		for($i = 0; $i < $rowsCount; $i++) {
+			//section changed
+			$currentPackage = db_result($result, $i, 'package_name');
+			if ($lastPackage != $currentPackage) {
+				$return .= '<tr><td colspan="4">'.$currentPackage.'</td></tr>';
+				$lastPackage = $currentPackage;
+				$rowColor = 0;
+			}
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
+				. '<td width="5%"> </td>'
+				. '<td><a href="/frs/shownotes.php?release_id='.db_result($result, $i, 'release_id').'">'
+				. db_result($result, $i, 'release_name').'</a></td>'
+				. '<td width="15%">'.db_result($result, $i, 'realname').'</td>'
+				. '<td width="15%">'.date($dateFormat,db_result($result,$i, 'release_date')).'</td></tr>';
+			$rowColor ++;
+		}
+		return $return;
+	}
+	
+	/**
+	 * getSections - get the array of possible sections to search in
+	 * 
+  	 * @return array sections
+	 */		
+	function getSections($groupId) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+	
+		return FilesSearchQuery::getSections($groupId, $userIsGroupMember);	
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/HtmlGroupSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/HtmlGroupSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/HtmlGroupSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * GForge Search Engine
+ *
+ * Portions Copyright 1999-2001 (c) VA Linux Systems
+ * The rest Copyright 2004 (c) Guillaume Smet / Open Wide
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('www/search/include/HtmlSearchRenderer.class');
+
+class HtmlGroupSearchRenderer extends HtmlSearchRenderer {
+	
+	/**
+	 * group id
+	 *
+	 * @var int $groupId
+	 */
+	var $groupId;
+	
+	/**
+	 * selected top tab
+	 * @var string $topTab
+	 */
+	var $topTab;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $typeOfSearch type of the search (Software, Forum, People and so on)
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param object $searchQuery SearchQuery instance
+	 * @param int $groupId group id
+	 */
+	function HtmlGroupSearchRenderer($typeOfSearch, $words, $isExact, $searchQuery, $groupId, $topTab = '') {
+		$this->HtmlSearchRenderer($typeOfSearch, $words, $isExact, $searchQuery);
+		$this->groupId = $groupId;
+		$this->topTab = $topTab;
+	}
+	
+	/**
+	 * writeHeader - write the header of the output
+	 */
+	function writeHeader() {
+		site_project_header(array('title' => $this->Language->getText('search', 'title'), 'group' => $this->groupId, 'pagename' => 'search', 'toptab' => $this->topTab));
+		parent::writeHeader();
+	}
+	
+	/**
+	 * getPreviousResultsUrl - get the url to go to see the previous results
+	 *
+	 * @return string url to previous results page
+	 */
+	function getPreviousResultsUrl() {
+		return parent::getPreviousResultsUrl().'&group_id='.$this->groupId;
+	}
+	
+	/**
+	 * getNextResultsUrl - get the url to go to see the next results
+	 *
+	 * @return string url to next results page
+	 */
+	function getNextResultsUrl() {
+		return parent::getNextResultsUrl().'&group_id='.$this->groupId;
+	}
+
+	/**
+	 * isGroupMember - returns if the logged in user is member of the current group
+	 *
+	 * @param int $groupId group id
+	 */
+	function isGroupMember($groupId) {
+		$Group =& group_get_object($groupId);
+		if($Group && is_object($Group) && !$Group->isError() && session_loggedin()) {
+			$perm =& $Group->getPermission(session_get_user());
+			if($perm && is_object($perm) && $perm->isMember()) {
+				return true;
+			}
+		}
+		return false;		
+	}
+}
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/NewsHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/NewsHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/NewsHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,65 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+ 
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/NewsSearchQuery.class');
+
+class NewsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function NewsHtmlSearchRenderer($words, $offset, $isExact, $groupId) {
+		$this->groupId = $groupId;
+	
+		$searchQuery = new NewsSearchQuery($words, $offset, $isExact, $groupId);
+		
+		//init the searchrendererr
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_NEWS, $words, $isExact, $searchQuery, $groupId, 'news');
+		
+		$this->tableHeaders = array(
+			$this->Language->getText('search', 'news_summary'),
+			$this->Language->getText('search', 'news_posted_by'),
+			$this->Language->getText('search', 'news_post_date'),
+		);
+	}
+	
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+		
+		$return = '';
+		for($i = 0; $i < $rowsCount; $i++) {
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'
+				. '<td><a href="/forum/forum.php?forum_id='. db_result($result, $i, 'forum_id').'">'
+				. html_image('ic/msg.png', '10', '12', array('border' => '0'))
+				. ' '.db_result($result, $i, 'summary').'</a></td>
+				<td width="15%">'.db_result($result, $i, 'realname').'</td>
+				<td width="15%">'.date($dateFormat, db_result($result, $i, 'post_date')).'</td></tr>';
+		}
+		return $return;
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TasksHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TasksHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TasksHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/TasksSearchQuery.class');
+	
+class TasksHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function TasksHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		$searchQuery = new TasksSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
+
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_TASKS, $words, $isExact, $searchQuery, $groupId, 'pm');
+		
+		$this->tableHeaders = array(
+			' ',
+			$this->Language->getText('search', 'tasks_id'),
+			$this->Language->getText('search', 'tasks_summary'),
+			$this->Language->getText('search', 'tasks_start_date'),
+			$this->Language->getText('search', 'tasks_end_date'),
+			$this->Language->getText('search', 'tasks_created_by'),
+			$this->Language->getText('search', 'tasks_completed')
+		);
+	}
+
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */	
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+		
+		$return = '';
+		$rowColor = 0;
+		$lastProjectName = null;
+		
+		for($i = 0; $i < $rowsCount; $i++) {
+			//section changed
+			$currentProjectName = db_result($result, $i, 'project_name');
+			if ($lastProjectName != $currentProjectName) {
+				$return .= '<tr><td colspan="7">'.$currentProjectName.'</td></tr>';
+				$lastProjectName = $currentProjectName;
+				$rowColor = 0;
+			}
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
+						. ' <td width="5%"> </td>'
+						. ' <td>'.db_result($result, $i, 'project_task_id').'</td>'
+						. ' <td>'
+							. '<a href="/pm/task.php?func=detailtask&project_task_id='
+							. db_result($result, $i, 'project_task_id').'&group_id='.$this->groupId
+							. '&group_project_id='.db_result($result, $i, 'group_project_id').'">'
+							. html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '
+							. db_result($result, $i, 'summary').'</a></td>'
+						. ' <td width="15%">'.date($dateFormat, db_result($result, $i, 'start_date')).'</td>'
+						. ' <td width="15%">'.date($dateFormat, db_result($result, $i, 'end_date')).'</td>'
+						. ' <td width="15%">'.db_result($result, $i, 'realname').'</td>'
+						. ' <td width="8%">'.db_result($result, $i, 'percent_complete').' %</td></tr>';
+			$rowColor ++;
+		}
+		return $return;
+	}
+		
+	/**
+	 * getSections - get the array of possible sections to search in
+	 * 
+  	 * @return array sections
+	 */		
+	function getSections($groupId) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		return TasksSearchQuery::getSections($groupId, $userIsGroupMember);		
+	}
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TrackersHtmlSearchRenderer.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TrackersHtmlSearchRenderer.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/include/TrackersHtmlSearchRenderer.class	2011-02-24 16:37:21 UTC (rev 10076)
@@ -0,0 +1,92 @@
+<?php
+/**
+ * GForge Search Engine
+ *
+ * Copyright 2004 (c) Dominik Haas, GForge Team
+ *
+ * http://gforge.org
+ *
+ * @version $Id$
+ */
+
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
+require_once('common/search/TrackersSearchQuery.class');
+	
+class TrackersHtmlSearchRenderer extends HtmlGroupSearchRenderer {
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $words words we are searching for
+	 * @param int $offset offset
+	 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int $groupId group id
+	 * @param array $sections array of all sections to search in (array of strings)
+	 *
+	 */
+	function TrackersHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+			
+		$searchQuery = new TrackersSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
+		
+		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_TRACKERS, $words, $isExact, $searchQuery, $groupId, 'tracker');
+		
+		$this->tableHeaders = array(
+			' ',
+			$this->Language->getText('search', 'artifact_id'),
+			$this->Language->getText('search', 'artifact_summary'),
+			$this->Language->getText('search', 'artifact_author'),
+			$this->Language->getText('search', 'artifact_date')
+		);
+	}
+
+	/**
+	 * getRows - get the html output for result rows
+	 *
+	 * @return string html output
+	 */
+	function getRows() {
+		$rowsCount = $this->searchQuery->getRowsCount();
+		$result =& $this->searchQuery->getResult();
+		$dateFormat = $GLOBALS['sys_datefmt'];
+			
+		$return = '';
+		$rowColor = 0;
+		$lastTracker = null;
+		
+		for($i = 0; $i < $rowsCount; $i++) {
+			//section changed
+			$currentTracker = db_result($result, $i, 'name');
+			if ($lastTracker != $currentTracker) {
+				$return .= '<tr><td colspan="5">'.$currentTracker.'</td></tr>';
+				$lastTracker = $currentTracker;
+				$rowColor = 0;
+			}
+			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
+						. '<td width="5%"> </td>'
+						. '<td>'.db_result($result, $i, 'artifact_id').'</td>'
+						. '<td>'
+							. '<a href="/tracker/?func=detail&group_id='.$this->groupId.'&aid='.db_result($result, $i, 'artifact_id')
+							. '&atid='.db_result($result, $i, 'group_artifact_id').'">'
+							. html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '.db_result($result, $i, 'summary')
+							. '</a></td>'		
+						. '<td width="15%">'.db_result($result, $i, 'realname').'</td>'
+						. '<td width="15%">'.date($dateFormat, db_result($result, $i, 'open_date')).'</td></tr>';
+			$rowColor ++;
+		}
+		return $return;
+	}
+
+	/**
+	 * getSections - get the array of possible sections to search in
+	 * 
+  	 * @return array sections
+	 */		
+	function getSections($groupId) {
+		$userIsGroupMember = $this->isGroupMember($groupId);
+		
+		return $this->searchQuery->getSections($groupId, $userIsGroupMember);
+	}
+}
+
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/search/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/search/index.php	2011-02-24 16:37:20 UTC (rev 10075)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/search/index.php	2011-02-24 16:37:21 UTC (rev 10076)
@@ -60,6 +60,36 @@
 	require('include/SkillHtmlSearchRenderer.class');
 	$searchQuery = new SkillHtmlSearchRenderer($words, $offset, $exact);
 	
+} elseif ($type_of_search == SEARCH__TYPE_IS_DOCS && $group_id) {
+	
+	require('include/DocsHtmlSearchRenderer.class');
+	$searchQuery = new DocsHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
+} elseif ($type_of_search == SEARCH__TYPE_IS_NEWS && $group_id) {
+	
+	require('include/NewsHtmlSearchRenderer.class');
+	$searchQuery = new NewsHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
+} elseif ($type_of_search == SEARCH__TYPE_IS_FORUMS && $group_id) {
+	
+	require('include/ForumsHtmlSearchRenderer.class');
+	$searchQuery = new ForumsHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
+} elseif ($type_of_search == SEARCH__TYPE_IS_TRACKERS && $group_id) {
+	
+	require('include/TrackersHtmlSearchRenderer.class');
+	$searchQuery = new TrackersHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
+} elseif ($type_of_search == SEARCH__TYPE_IS_TASKS && $group_id) {
+	
+	require('include/TasksHtmlSearchRenderer.class');
+	$searchQuery = new TasksHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
+} elseif ($type_of_search == SEARCH__TYPE_IS_FRS && $group_id) {
+	
+	require('include/FrsHtmlSearchRenderer.class');
+	$searchQuery = new FrsHtmlSearchRenderer($words, $offset, $exact, $group_id);
+	
 }
 
 if(isset($searchQuery)) {



More information about the evolvis-commits mailing list