[Rt-commit] rt branch, 4.2/autocomplete-links, updated. rt-4.0.0rc6-178-gebee16f
? sunnavy
sunnavy at bestpractical.com
Tue May 14 11:38:08 EDT 2013
The branch, 4.2/autocomplete-links has been updated
via ebee16f65f433073a9832fb5568a02c430fcecce (commit)
via 61289a6eb61444526cc1a24893cb806bba5d1a79 (commit)
via ea1f59b76bfe82fd47e098e2281c15120bf08e98 (commit)
from c50c221c251a9d0fcdd6bd8e6b63622bd69f0856 (commit)
Summary of changes:
share/html/Elements/EditLinks | 18 +++++++++++++++---
share/html/Helpers/Autocomplete/Tickets | 18 ++++++++----------
2 files changed, 23 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit ea1f59b76bfe82fd47e098e2281c15120bf08e98
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue May 14 23:33:22 2013 +0800
use FromSQL to avoid the not working "ENTRYAGGREGATOR => 'OR'"
see also c50c221
diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index f9cc0e1..6f61766 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -87,21 +87,16 @@ my %fields = %{ RT->Config->Get('TicketAutocompleteFields')
|| { id => 'STARTSWITH', Subject => 'LIKE' } };
my $tickets = RT::Tickets->new( $CurrentUser );
-$tickets->RowsPerPage( $max );
+my @clauses;
while (my ($name, $op) = each %fields) {
$op = 'STARTSWITH'
unless $op =~ /^(?:LIKE|(?:START|END)SWITH|=|!=)$/i;
-
- $tickets->Limit(
- FIELD => $name,
- OPERATOR => $op,
- VALUE => $term,
- ENTRYAGGREGATOR => 'OR',
- SUBCLAUSE => 'autocomplete',
- );
+ push @clauses, qq{$name $op '$term'};
}
-
+my $sql = join ' OR ', @clauses;
+$tickets->FromSQL($sql);
+$tickets->RowsPerPage( $max );
# Exclude tickets we don't want
foreach (split /\s*,\s*/, $exclude) {
$tickets->Limit(FIELD => 'id', VALUE => $_, OPERATOR => '!=');
commit 61289a6eb61444526cc1a24893cb806bba5d1a79
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue May 14 23:35:24 2013 +0800
use \s+ as default delimiter since it's the one we use in EditLinks
diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index 6f61766..5e463c5 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -77,6 +77,9 @@ if ( defined $delim and length $delim ) {
# If the field handles multiple values, pop the last one off
$term = (split $delim, $term)[-1] if $term =~ $delim;
}
+else {
+ $term = (split /\s+/, $term)[-1];
+}
my $CurrentUser = $session{'CurrentUser'};
commit ebee16f65f433073a9832fb5568a02c430fcecce
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue May 14 23:37:30 2013 +0800
enhance autocomplete in EditLinks so we can keep multiple values
diff --git a/share/html/Elements/EditLinks b/share/html/Elements/EditLinks
index 993a98f..69c8642 100755
--- a/share/html/Elements/EditLinks
+++ b/share/html/Elements/EditLinks
@@ -165,9 +165,21 @@
</table>
<script type="text/javascript">
- jQuery(".link_entry").autocomplete({
- source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Tickets"
- });
+ function split( val ) {
+ return val.split( /\s+/ );
+ }
+ var options = {
+ source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Tickets",
+ select: function( event, ui ) {
+ var terms = split( this.value );
+ terms.pop();
+ terms.push( ui.item.value );
+ terms.push( "" );
+ this.value = terms.join( " " );
+ return false;
+ }
+ };
+ jQuery(".link_entry").autocomplete( options );
</script>
<%INIT>
my $id;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list