[evolvis-commits] r17647: - Added new advanced search UI to Advanced Queries Tab in Tracker↵ - Implemented IntelliSense↵ - Fixed some Bugs in Advanced Search
messer at evolvis.org
messer at evolvis.org
Fri Oct 28 17:43:20 CEST 2011
Author: messer
Date: 2011-10-28 17:43:20 +0200 (Fri, 28 Oct 2011)
New Revision: 17647
Added:
trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php
Modified:
trunk/gforge_base/evolvisforge-5.1/src/www/tracker/browse.php
Log:
- Added new advanced search UI to Advanced Queries Tab in Tracker
- Implemented IntelliSense
- Fixed some Bugs in Advanced Search
Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/browse.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/browse.php 2011-10-28 15:41:32 UTC (rev 17646)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/browse.php 2011-10-28 15:43:20 UTC (rev 17647)
@@ -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').'">';
Added: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/search.php 2011-10-28 15:43:20 UTC (rev 17647)
@@ -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