[evolvis-commits] r17654: [#2160] replay r17645:17649 onto the feature branch

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Oct 28 18:14:44 CEST 2011


Author: mirabilos
Date: 2011-10-28 18:14:44 +0200 (Fri, 28 Oct 2011)
New Revision: 17654

Added:
   branches/messer-51-suche/src/common/advanced_search/
   branches/messer-51-suche/src/www/scripts/jquery-tipsy/
   branches/messer-51-suche/src/www/scripts/jquery/
   branches/messer-51-suche/src/www/themes/css/smoothness/
   branches/messer-51-suche/src/www/tracker/search.php
Modified:
   branches/messer-51-suche/src/www/tracker/browse.php
Log:
[#2160] replay r17645:17649 onto the feature branch

Modified: branches/messer-51-suche/src/www/tracker/browse.php
===================================================================
--- branches/messer-51-suche/src/www/tracker/browse.php	2011-10-28 16:13:21 UTC (rev 17653)
+++ branches/messer-51-suche/src/www/tracker/browse.php	2011-10-28 16:14:44 UTC (rev 17654)
@@ -294,14 +294,11 @@
 		$aux_extra_fields = $_extra_fields;
 	}
 	$status_box=$ath->renderSelect ($ath->getCustomStatusField(),$aux_extra_fields[$ath->getCustomStatusField()],false,'',true,_('Any'));
-	/*XXX what a fuckup, this… */
-	$status_box_name = 'extra_fields['.$ath->getCustomStatusField().']';
 } else {
 	if (is_array($_status)) {
 		$_status='';
 	}
 	$status_box = $ath->statusBox('_status',$_status,true,_('Any'));
-	$status_box_name = '_status';
 }
 
 // start of RDFa
@@ -379,10 +376,72 @@
 	echo '<strong>
 	<a href="/tracker/?atid='. $ath->getID().'&group_id='.$group_id.'&func=query">'._('Build Query').'</a></strong>';
 }
+
+/**
+ * New advaced search begins here!
+ */
+?>
+<script>
+	$(function() {
+		function split( val ) {
+			return val.split( / \s*/ );
+		}
+		function extractLast( term ) {
+			return split( term ).pop();
+		}
+
+		$( "#advanced_search" )
+			// don't navigate away from the field on tab when selecting an item
+			.bind( "keydown", function( event ) {
+				if ( event.keyCode === $.ui.keyCode.TAB &&
+						$( this ).data( "autocomplete" ).menu.active ) {
+					event.preventDefault();
+				}
+			})
+			.autocomplete({
+				source: function( request, response ) {
+					$.getJSON( "search.php?tracker_id=<?php echo $_GET['atid'];?>&cur_input=" + request.term, {
+						term: extractLast( request.term )
+					}, response );
+				},
+				search: function() {
+					// custom minLength
+					var term = extractLast( this.value );
+					if ( term.length < 0 ) {
+						return false;
+					}
+				},
+				focus: function() {
+					// prevent value inserted on focus
+					return false;
+				},
+				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( " " );
+					return false;
+				}
+			});
+	});
+	</script>
+<span class="ui-widget">
+	<label for="advanced_search"><?php echo _('Search').':';?> </label>
+	<input id="advanced_search" style="width: 500px;"/>
+	<input id="search" type="button" value="<?php echo _('Search'); ?>"/>
+	<input id="save" type="button" value="<?php echo _('Save'); ?>" />
+</span>
+<?php
+/**
+ * New advaced search ends here!
+ */
 echo '
 	</div>
 	<div class="tabbertab'.($af->query_type == 'custom' ? ' tabbertabdefault' : '').'" title="'._('Simple Filtering and Sorting').'">
-	<form name="headerForm" action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
+	<form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
 	<input type="hidden" name="query_id" value="-1" />
 	<input type="hidden" name="set" value="custom" />
 	<table width="100%" cellspacing="0">
@@ -420,20 +479,6 @@
 	</tr>
 	</table>
 	</form>
-
-	<script type="text/javascript">//<![CDATA[
-
-	function submitForm() {
-		document.headerForm.submit.click();
-	}
-
-	document.headerForm._assigned_to.onchange = submitForm;
-	document.headerForm.elements["'.$status_box_name.'"].onchange = submitForm;
-	document.headerForm._sort_col.onchange = submitForm;
-	document.headerForm._sort_ord.onchange = submitForm;
-
-	//]]></script>
-
 	</div>';
 if ($af->query_type == 'default') {
 	echo '<div class="tabbertab tabbertabdefault" title="'._('Default').'">';

Copied: branches/messer-51-suche/src/www/tracker/search.php (from rev 17649, trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php)
===================================================================
--- branches/messer-51-suche/src/www/tracker/search.php	                        (rev 0)
+++ branches/messer-51-suche/src/www/tracker/search.php	2011-10-28 16:14:44 UTC (rev 17654)
@@ -0,0 +1,22 @@
+<?php
+
+require_once '/usr/share/gforge/common/advanced_search/FusionForgeDFIProvider.class.php';
+require_once '/usr/share/gforge/common/advanced_search/ASInputAnalyzer.class.php';
+//require_once '/usr/share/gforge/common/advanced_search/ASTokenizer.class.php';
+
+//Get the required paramters.
+$params = array();
+$params['tracker_id'] = $_GET['tracker_id'];
+
+$input = $_GET['cur_input'];
+
+$dfiProvider   = new FusionForgeDFIProvider();
+$inputAnalyzer = new ASInputAnalyzer();
+
+$inputAnalyzer->setDFIProvider($dfiProvider);
+ASTokenizer::$DFIProvider = $dfiProvider;
+
+$autoComplete = $inputAnalyzer->analyzeInput($input, $params);
+
+echo json_encode($autoComplete);
+?>



More information about the evolvis-commits mailing list