[evolvis-commits] r17762: [#2160] messer-suche pending merges:↵ Thorsten Glaser 2011-12-02 fix: disable sysdebug, this is JSON not XHTML↵ Thorsten Glaser 2011-12-02 fix an i18n fuckup of mine↵ Thorsten Glaser 2011-12-02 bring back the span as div (maybe this is the problem? nope. still…)↵ Thorsten Glaser 2011-12-02 fix passing tracker_id to DFI↵ Thorsten Glaser 2011-12-02 fix oops, $param isn’t $this->param

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Dec 2 18:07:21 CET 2011


Author: mirabilos
Date: 2011-12-02 18:07:21 +0100 (Fri, 02 Dec 2011)
New Revision: 17762

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/ASFusionForgeParser.class.php
   trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/AdvancedSearch.class.php
   trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php
Log:
[#2160] messer-suche pending merges:
  Thorsten Glaser 2011-12-02 fix: disable sysdebug, this is JSON not XHTML
    Thorsten Glaser 2011-12-02 fix an i18n fuckup of mine
    Thorsten Glaser 2011-12-02 bring back the span as div (maybe this is the problem? nope. still…)
    Thorsten Glaser 2011-12-02 fix passing tracker_id to DFI
    Thorsten Glaser 2011-12-02 fix oops, $param isn’t $this->param


Modified: trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/ASFusionForgeParser.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/ASFusionForgeParser.class.php	2011-12-02 17:07:17 UTC (rev 17761)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/ASFusionForgeParser.class.php	2011-12-02 17:07:21 UTC (rev 17762)
@@ -42,8 +42,10 @@
 		$curTokenPointer   = 0;
 		$bDone             = false;
 
+		$params['tracker_id'] = $this->parameters['tracker_id'];
+
 		//First tokenize the input string.
-		$this->tokens = ASTokenizer::tokenize($inputString, $this->params);
+		$this->tokens = ASTokenizer::tokenize($inputString, $params);
 
 		if($this->tokens === false) {
 			return null;
@@ -53,7 +55,6 @@
 		$selectsql = 'SELECT DISTINCT ON (group_artifact_id, artifact_id) artifact_vw.* FROM artifact_vw';
 		$wheresql  = ' WHERE group_artifact_id=$'.$paramcount++.' AND';
 
-		$params[] = $this->parameters['tracker_id'];
 		$curToken = $this->tokens[0];
 
 		//Check if the first token is an DFI. If not return an error.
@@ -94,7 +95,7 @@
 					$params[] = $field_id;
 
 					// Hack: Determine the type of the element to get the right search query.
-					$res = db_query_params ('SELECT field_type FROM artifact_extra_field_list WHERE extra_field_id=$1', array($field_id));
+					$res = db_query_params('SELECT field_type FROM artifact_extra_field_list WHERE extra_field_id=$1', array($field_id));
 					$type = db_result($res,0,'field_type');
 
 					//Get the next token. This has to be an operator!
@@ -258,7 +259,7 @@
 			}
 		}
 
-		$result = db_query_params ('SELECT * FROM (' . $selectsql . $wheresql . ') AS Artifacts;',
+		$result = db_query_params('SELECT * FROM (' . $selectsql . $wheresql . ') AS Artifacts;',
 					   $params);
 		$rows = db_numrows($result);
 
@@ -318,61 +319,61 @@
 		if($curType === EASToken::AS_OP_EQUALS) {
 			//Get the next token. This has to be the data!
 			$curTokenPointer ++;
-			$curToken = $this->tokens [$curTokenPointer];
-			$curType = $curToken->getType ();
+			$curToken = $this->tokens[$curTokenPointer];
+			$curType = $curToken->getType();
 
 			$wheresql .= ' '.$field_alias.' = $' . $paramcount ++;
 
 			if($is_date) {
-				$params [] = strtotime($curToken->getData());
+				$params[] = strtotime($curToken->getData());
 			} else {
-				$params [] = $curToken->getData ();
+				$params[] = $curToken->getData();
 			}
 		} else if ($curType === EASToken::AS_OP_NOT) {
 			//Get the next token. This has to be the data!
 			$curTokenPointer ++;
-			$curToken = $this->tokens [$curTokenPointer];
-			$curType = $curToken->getType ();
+			$curToken = $this->tokens[$curTokenPointer];
+			$curType = $curToken->getType();
 
 			$wheresql .= ' '.$field_alias.' != $' . $paramcount ++;
 
 			if($is_date) {
-				$params [] = strtotime($curToken->getData());
+				$params[] = strtotime($curToken->getData());
 			} else {
-				$params [] = $curToken->getData ();
+				$params[] = $curToken->getData();
 			}
 
 		} else if ($curType === EASToken::AS_OP_GREATER) {
 			//Get the next token. This has to be the data!
 			$curTokenPointer ++;
-			$curToken = $this->tokens [$curTokenPointer];
-			$curType = $curToken->getType ();
+			$curToken = $this->tokens[$curTokenPointer];
+			$curType = $curToken->getType();
 
 			$wheresql .= ' '.$field_alias.' > $' . $paramcount ++;
 
 			if($is_date) {
-				$params [] = strtotime($curToken->getData());
+				$params[] = strtotime($curToken->getData());
 			} else {
-				$params [] = $curToken->getData ();
+				$params[] = $curToken->getData();
 			}
 		} else if ($curType === EASToken::AS_OP_LESS) {
 			//Get the next token. This has to be the data!
 			$curTokenPointer ++;
-			$curToken = $this->tokens [$curTokenPointer];
-			$curType = $curToken->getType ();
+			$curToken = $this->tokens[$curTokenPointer];
+			$curType = $curToken->getType();
 
 			$wheresql .= ' '.$field_alias.' < $' . $paramcount ++;
 
 			if($is_date) {
-				$params [] = strtotime($curToken->getData());
+				$params[] = strtotime($curToken->getData());
 			} else {
-				$params [] = $curToken->getData ();
+				$params[] = $curToken->getData();
 			}
 		} else if ($curType === EASToken::AS_OP_LIKE) {
 			//Get the next token. This has to be the data!
 			$curTokenPointer ++;
-			$curToken = $this->tokens [$curTokenPointer];
-			$curType = $curToken->getType ();
+			$curToken = $this->tokens[$curTokenPointer];
+			$curType = $curToken->getType();
 
 			if($is_date) {
 				//Convert unix timestamp to postgres date and then to string.
@@ -382,7 +383,7 @@
 				$wheresql .= ' '.$field_alias.' LIKE $' . $paramcount ++;
 			}
 
-			$params [] = $curToken->getData ();
+			$params[] = $curToken->getData();
 		}
 
 		return $wheresql;

Modified: trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/AdvancedSearch.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/AdvancedSearch.class.php	2011-12-02 17:07:17 UTC (rev 17761)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/advanced_search/AdvancedSearch.class.php	2011-12-02 17:07:21 UTC (rev 17762)
@@ -24,34 +24,35 @@
 
 class AdvancedSearch {
 	public static function renderSearchBar($searchActionUrl, $ajaxRequestUrl, $searchValue, $queryName) {
-		echo "
-<script language=\"JavaScript\" type=\"text/javascript\">//<![CDATA[
+?>
+<script language="JavaScript" type="text/javascript">//<![CDATA[
 	jQuery(function() {
-		function split( val ) {
-			return val.split( / \s*/ );
+		function split(val) {
+			return val.split(/\s*/);
 		}
-		function extractLast( term ) {
-			return split( term ).pop();
+		function extractLast(term) {
+			return split(term).pop();
 		}
 
-		jQuery( \"#advanced_search\" )
+		jQuery("#advanced_search")
 			// don't navigate away from the field on tab when selecting an item
-			.bind( \"keydown\", function( event ) {
-				if ( event.keyCode === jQuery.ui.keyCode.TAB &&
-						jQuery( this ).data( \"autocomplete\" ).menu.active ) {
+			.bind("keydown", function(event) {
+				if (event.keyCode === jQuery.ui.keyCode.TAB &&
+				    jQuery(this).data("autocomplete").menu.active) {
 					event.preventDefault();
 				}
 			})
 			.autocomplete({
-				source: function( request, response ) {
-					jQuery.getJSON( \"$ajaxRequestUrl\" + request.term, {
-						term: extractLast( request.term )
-					}, response );
+				source: function(request, response) {
+					jQuery.getJSON("<?php echo $ajaxRequestUrl; ?>" +
+					    request.term, {
+						term: extractLast(request.term)
+					}, response);
 				},
 				search: function() {
 					// custom minLength
-					var term = extractLast( this.value );
-					if ( term.length < 0 ) {
+					var term = extractLast(this.value);
+					if (term.length < 0) {
 						return false;
 					}
 				},
@@ -59,25 +60,32 @@
 					// prevent value inserted on focus
 					return false;
 				},
-				select: function( event, ui ) {
-					var terms = split( this.value );
+				select: function(event, ui) {
+					var terms = split(this.value);
 					// remove the current input
 					terms.pop();
 					// add the selected item
-					terms.push( ui.item.value );
-					terms.push( \"\" );
-					this.value = terms.join( \" \" );
+					terms.push(ui.item.value);
+					terms.push("");
+					this.value = terms.join(" ");
 					return false;
 				}
 			});
 	});
 //]]></script>
-	<form class=\"ui-widget\" id=\"advanced_search_form\" method=\"post\" action=\"$searchActionUrl\">
-		<input type=\"hidden\" name=\"set\" value=\"advanced\" />
-		<label for=\"advanced_search\"><?php echo _('Search').':';?> </label>
-		<input id=\"advanced_search\" name=\"advanced_search\" style=\"width: 500px; font-size: 12px;\" value=\"$searchValue\"/>
-		<input id=\"search_submit\" name=\"search_submit\" type=\"submit\" value=\""._('Search')."\"/>
-		<input id=\"save_advanced_query\" name=\"save_advanced_query\" type=\"checkbox\" value=\"true\" />"._('Save Query as ')."<input type=\"text\" name=\"save_as\" id=\"save_as\" value=\"$queryName\"/>
-	</form>";
+<div class="ui-widget"><form id="advanced_search_form"
+ method="post" action="<?php echo $searchActionUrl; ?>">
+	<input type="hidden" name="set" value="advanced" />
+	<label for="advanced_search"><?php echo _('Search'); ?>: </label>
+	<input id="advanced_search" name="advanced_search"
+	 style="width: 500px; font-size: 12px;"
+	 value="<?php echo $searchValue; ?>" />
+	<input id="search_submit" name="search_submit" type="submit"
+	 value="<?php echo _('Search'); ?>"/>
+	<input id="save_advanced_query" name="save_advanced_query"
+	 type="checkbox" value="true" /><?php echo _('Save Query as '); ?>
+	<input type="text" name="save_as" id="save_as" value="<?php echo $queryName; ?>" />
+</form></div>
+<?php
 	}
 }

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php	2011-12-02 17:07:17 UTC (rev 17761)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php	2011-12-02 17:07:21 UTC (rev 17762)
@@ -27,6 +27,8 @@
 require_once $gfcommon.'advanced_search/ASInputAnalyzer.class.php';
 require_once $gfcommon.'include/minijson.php';
 
+sysdebug_off("Content-type: text/plain; charset=\"UTF-8\"");
+
 //Get the required paramters.
 $params = array();
 $params['tracker_id'] = $_GET['tracker_id'];



More information about the evolvis-commits mailing list