[Fusionforge-commits] r10224 - trunk/src/www/search/include/renderers

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Mon Jul 12 18:28:08 CEST 2010


Author: aljeux
Date: 2010-07-12 18:28:08 +0200 (Mon, 12 Jul 2010)
New Revision: 10224

Modified:
   trunk/src/www/search/include/renderers/AdvancedSearchHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/ForumHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/ForumsHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/FullProjectHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/HtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/NewsHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/PeopleHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/ProjectHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/SearchRenderer.class.php
   trunk/src/www/search/include/renderers/TasksHtmlSearchRenderer.class.php
   trunk/src/www/search/include/renderers/TrackersHtmlSearchRenderer.class.php
Log:
Search: Clean up code & misc minor changes.

Modified: trunk/src/www/search/include/renderers/AdvancedSearchHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/AdvancedSearchHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/AdvancedSearchHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -85,7 +85,7 @@
 	 */
 	function writeBody() {
 		if (strlen($this->words) < 3) {
-			echo '<br><h1>'._('Error: Under min length search').'</h1><br />';
+			echo '<div class="error">'._('Error: Under min length search').'</div>';
 		} else {
 			echo $this->getResult();
 		}
@@ -170,7 +170,7 @@
 		if ($title === '')
 			$title = $section;
 		
-		$result .= '<h3><a name="'.$section.'"></a>'.$title.'</h3>';
+		$result .= '<h2><a name="'.$section.'"></a>'.$title.'</h2>';
 		
 		if ($renderer->searchQuery->getRowsCount() > 0) {
 			if ($renderer->searchQuery->getRowsTotalCount() >= $renderer->searchQuery->getRowsPerPage())
@@ -179,9 +179,9 @@
 			$result .= $renderer->getRows();			
 			$result .= $GLOBALS['HTML']->listTableBottom();			
 		} elseif(method_exists($renderer, 'getSections') && (count($renderer->getSections($this->groupId)) == 0)) {
-			$result .= '<p>'.sprintf(_('No matches found - No sections available (check your permissions)'), htmlspecialchars($query['words'])).'</p>';
+			$result .= '<p>'.sprintf(_('No matches found for <em>%s</em> - No sections available (check your permissions)'), $query['words']).'</p>';
 		} else {
-			$result .= '<p>'.sprintf(_('No matches found'), htmlspecialchars($query['words'])).'</p>';
+			$result .= '<p>'.sprintf(_('No matches found for <em>%s</em>'), $query['words']).'</p>';
 		}
 		return $result;
 	}

Modified: trunk/src/www/search/include/renderers/ForumHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/ForumHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/ForumHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -58,7 +58,7 @@
 		$return = '';
 		for($i = 0; $i < $rowsCount; $i++) {
 			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td width="50%"><a href="'.util_make_url ('/forum/message.php?msg_id=' . db_result($result, $i, 'msg_id')).'">'
-				. html_image('ic/msg.png', '10', '12', array('border' => '0'))
+				. html_image('ic/msg.png', '10', '12')
 				. ' '.db_result($result, $i, 'subject').'</a></td>'
 				. '<td width="30%">'.db_result($result, $i, 'realname').'</td>'
 				. '<td width="20%">'.date($dateFormat, db_result($result, $i, 'post_date')).'</td></tr>';

Modified: trunk/src/www/search/include/renderers/ForumsHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/ForumsHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/ForumsHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -63,7 +63,7 @@
 			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
 						. '<td width="5%">&nbsp;</td>'
 						. '<td><a href="'.util_make_url ('/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')
+							. html_image('ic/msg.png', '10', '12').' '.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>';

Modified: trunk/src/www/search/include/renderers/FullProjectHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/FullProjectHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/FullProjectHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -54,7 +54,6 @@
 		$this->groupId = $groupId;
 		$this->words = $words;
 		$this->isExact = $isExact;
-		$searchQuery =& $this->searchQuery;
 		
 		$this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_ADVANCED, $words, $isExact, $searchQuery, $groupId);
 	}
@@ -85,24 +84,24 @@
 	function getResult() {
 		$html = '';
 
-		$Group =& group_get_object($this->groupId);
+		$group =& group_get_object($this->groupId);
 
-		if ($Group->usesForum()) {
+		if ($group->usesForum()) {
 			$forumsRenderer		= new ForumsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
-		if ($Group->usesTracker()) {
+		if ($group->usesTracker()) {
 			$trackersRenderer	= new TrackersHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
-		if ($Group->usesPM()) {
+		if ($group->usesPM()) {
 			$tasksRenderer		= new TasksHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
-		if ($Group->usesDocman()) {
+		if ($group->usesDocman()) {
 			$docsRenderer		= new DocsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
-		if ($Group->usesFRS()) {
+		if ($group->usesFRS()) {
 			$frsRenderer 		= new FrsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
-		if ($Group->usesNews()) {
+		if ($group->usesNews()) {
 			$newsRenderer		= new NewsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId);
 		}
 
@@ -183,9 +182,9 @@
 			$result .= $renderer->getRows();			
 			$result .= $GLOBALS['HTML']->listTableBottom();			
 		} elseif(method_exists($renderer, 'getSections') && (count($renderer->getSections($this->groupId)) == 0)) {
-			$result .= '<p>'.sprintf(_('No matches found - No sections available (check your permissions)'), htmlspecialchars($query['words'])).'</p>';
+			$result .= '<p>'.sprintf(_('No matches found for <em>%s</em> - No sections available (check your permissions)'), $query['words']).'</p>';
 		} else {
-			$result .= '<p>'.sprintf(_('No matches found'), htmlspecialchars($query['words'])).'</p>';
+			$result .= '<p>'.sprintf(_('No matches found for <em>%s</em> '), $query['words']).'</p>';
 		}
 		return $result;
 	}

Modified: trunk/src/www/search/include/renderers/HtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/HtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/HtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -41,7 +41,7 @@
 		$searchQuery =& $this->searchQuery;
 		if($searchQuery->isError()) {
 			$this->writeHeader();
-			echo '<h2>'.$searchQuery->getErrorMessage().'</h2>';
+			echo '<div class="error">'.$searchQuery->getErrorMessage().'</div>';
 			$this->writeFooter();
 		} else {
 			$searchQuery->executeQuery();
@@ -84,14 +84,11 @@
 		$searchQuery =& $this->searchQuery;
 		$query =& $this->query;
 		
-		$html = '';
-		
+		$html = '<h1>'.sprintf(_('Search results for <em>%1$s</em>'), $query['words']).'</h1>';
 		if(!$searchQuery->getResult() || $searchQuery->getRowsCount() < 1) {
-			$html .= '<h2>'.sprintf(_('No matches found for <em>%1$s</em>'), htmlspecialchars($query['words'])).'</h2>';
+			$html .= '<p><strong>'.sprintf(_('No matches found for <em>%1$s</em>'), $query['words']).'</strong></p>';
 			$html .= db_error();
 		} else {
-			$html .= '<h3>'.sprintf(_('Search results for <em>%1$s</em>'), htmlspecialchars($query['words'])).'</h3>';
-		
 			$html .= $GLOBALS['HTML']->listTableTop($this->tableHeaders);
 			$html .= $this->getRows();
 			$html .= $GLOBALS['HTML']->listTableBottom();
@@ -112,14 +109,13 @@
 	function getNavigationPanel() {
 		$searchQuery =& $this->searchQuery;
 		
-		$html = '';
-		$html .= '<br />';
+		$html = '<br />';
 		$html .= '<table class="tablecontent" width="100%" cellpadding="5" cellspacing="0">';
 		$html .= '<tr>';
 		$html .= '<td>';
 		if ($searchQuery->getOffset() != 0) {
 			$html .= '<a href="'.$this->getPreviousResultsUrl().'" class="prev">'
-				. html_image('t2.png', '15', '15', array('border'=>'0','align'=>'middle'))
+				. html_image('t2.png', '15', '15')
 				. ' '._('Previous Results').'</a>';
 		} else {
 			$html .= '&nbsp;';
@@ -128,7 +124,7 @@
 		if ($searchQuery->getRowsTotalCount() > $searchQuery->getRowsCount()) {
 			$html .= '<a href="'.$this->getNextResultsUrl().'" class="next">'
 				._('Next Results').' '
-				. html_image('t.png', '15', '15', array('border'=>'0','align'=>'middle')) . '</a>';
+				. html_image('t.png', '15', '15') . '</a>';
 		} else {
 			$html .= '&nbsp;';
 		}

Modified: trunk/src/www/search/include/renderers/NewsHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/NewsHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/NewsHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -52,7 +52,7 @@
 		for($i = 0; $i < $rowsCount; $i++) {
 			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'
 				. '<td><a href="'.util_make_url ('/forum/forum.php?forum_id='. db_result($result, $i, 'forum_id')).'">'
-				. html_image('ic/msg.png', '10', '12', array('border' => '0'))
+				. html_image('ic/msg.png', '10', '12')
 				. ' '.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>';

Modified: trunk/src/www/search/include/renderers/PeopleHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/PeopleHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/PeopleHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -55,7 +55,7 @@
 		$return = '';
 		for($i = 0; $i < $rowsCount; $i++) {
 			$return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'.
-				'<td width="40%"><a href="'.util_make_url_u (db_result($result, $i, 'user_name'),db_result($result, $i, 'user_id')).'">'.html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '.db_result($result, $i, 'user_name').'</a></td>'.
+				'<td width="40%"><a href="'.util_make_url_u (db_result($result, $i, 'user_name'),db_result($result, $i, 'user_id')).'">'.html_image('ic/msg.png', '10', '12').' '.db_result($result, $i, 'user_name').'</a></td>'.
 				'<td width="60%">'.db_result($result, $i, 'realname').'</td>'.
 				'</tr>';
 		}

Modified: trunk/src/www/search/include/renderers/ProjectHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/ProjectHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/ProjectHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -29,7 +29,7 @@
 		$this->HtmlSearchRenderer(SEARCH__TYPE_IS_SOFTWARE, $words, $isExact, $searchQuery);
 		
 		$this->tableHeaders = array(
-			_('Group Name'),
+			_('Project Name'),
 			_('Description')
 		);
 	}
@@ -62,7 +62,7 @@
 			}		
 			$return .= '<tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i).'>'
 				.'<td width="30%"><a href="'.util_make_url('/'.$what.'/'.db_result($result, $i, 'unix_group_name').'/').'">'
-				.html_image('ic/msg.png', '10', '12', array('border'=>'0'))
+				.html_image('ic/msg.png', '10', '12')
 				.' '.$this->highlightTargetWords(db_result($result, $i, 'group_name')).'</a></td>'
 				.'<td width="70%">'.$this->highlightTargetWords(db_result($result, $i, 'short_description')).'</td></tr>';
 		}

Modified: trunk/src/www/search/include/renderers/SearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/SearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/SearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -27,11 +27,7 @@
 	function SearchRenderer($typeOfSearch, $words, $isExact, $searchQuery) {
 		$this->query['typeOfSearch'] = $typeOfSearch;
 		$this->query['isExact'] = $isExact;
-		if (get_magic_quotes_gpc()) {
-			$this->query['words'] = stripslashes($words);
-		}else{
-			$this->query['words'] = $words;
-		}
+		$this->query['words'] = $words;
 		
 		$this->searchQuery = $searchQuery;
 	}

Modified: trunk/src/www/search/include/renderers/TasksHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/TasksHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/TasksHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -68,7 +68,7 @@
 						. ' <td>'.db_result($result, $i, 'project_task_id').'</td>'
 						. ' <td>'
 							. '<a href="'.util_make_url ('/pm/task.php?func=detailtask&amp;project_task_id=' . db_result($result, $i, 'project_task_id').'&amp;group_id='.$this->groupId . '&amp;group_project_id='.db_result($result, $i, 'group_project_id')).'">'
-							. html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '
+							. html_image('ic/msg.png', '10', '12').' '
 							. 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>'

Modified: trunk/src/www/search/include/renderers/TrackersHtmlSearchRenderer.class.php
===================================================================
--- trunk/src/www/search/include/renderers/TrackersHtmlSearchRenderer.class.php	2010-07-12 16:28:03 UTC (rev 10223)
+++ trunk/src/www/search/include/renderers/TrackersHtmlSearchRenderer.class.php	2010-07-12 16:28:08 UTC (rev 10224)
@@ -66,7 +66,7 @@
 						. '<td>'.db_result($result, $i, 'artifact_id').'</td>'
 						. '<td>'
 							. '<a href="'.util_make_url ('/tracker/?func=detail&amp;group_id='.$this->groupId.'&amp;aid='.db_result($result, $i, 'artifact_id') . '&amp;atid='.db_result($result, $i, 'group_artifact_id')).'">'
-							. html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '.db_result($result, $i, 'summary')
+							. html_image('ic/msg.png', '10', '12').' '.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>';




More information about the Fusionforge-commits mailing list