[Rt-commit] r2630 - in rtfm/branches/2.1-TESTING: html/RTFM/Article html/RTFM/Article/Elements t

tla at bestpractical.com tla at bestpractical.com
Fri Apr 15 16:00:00 EDT 2005


Author: tla
Date: Fri Apr 15 16:00:00 2005
New Revision: 2630

Added:
   rtfm/branches/2.1-TESTING/t/URI__a.pm.t
Modified:
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html
Log:
RT::URI::a tests; article-wide CF search.  The latter is interface-tested
but not functionality-tested yet.


Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria	Fri Apr 15 16:00:00 2005
@@ -68,6 +68,10 @@
 <&|/l&>Which are referred to by </&> <input type=text size=50 name="ReferredToBy" value="<%$ReferredToBy%>">
 <i><&|/l&>Separate multiple URLs with spaces</&></i>
 
+<br><&|/l&>Article text matches</&>
+<input name="Article~" value="<%$ARGS{'Article~'}%>">
+<&|/l&>and not</&>
+<input name="Article!~" value="<%$ARGS{'Article!~'}%>">
 
 <table>
 %# for each custom field 

Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html	Fri Apr 15 16:00:00 2005
@@ -258,6 +258,35 @@
     }
 }
 
+### Searches for any custom field
+
+if ($ARGS{'Article~'}) {
+    if (ref($ARGS{'Article~'}) eq 'ARRAY') {
+	my @Match = @{$ARGS{'Article~'}};
+	foreach my $value (@Match) {
+	    $articles->LimitCustomField( VALUE => $value,
+					 ENTRYAGGREGATOR => 'OR',
+					 OPERATOR => 'LIKE' );
+	}
+    } else {
+	$articles->LimitCustomField( VALUE => $ARGS{'Article~'},
+				     OPERATOR => 'LIKE' );
+    }
+}
+
+if ($ARGS{'Article!~'}) {
+    if (ref($ARGS{'Article!~'}) eq 'ARRAY') {
+	my @NoMatch = @{$ARGS{'Article!~'}};
+	foreach my $value (@NoMatch) {
+	    $articles->LimitCustomField( VALUE => $value,
+					 ENTRYAGGREGATOR => 'OR',
+					 OPERATOR => 'NOT LIKE' );
+	}
+    } else {
+	$articles->LimitCustomField( VALUE => $ARGS{'Article!~'},
+				     OPERATOR => 'NOT LIKE' );
+    }
+}
 
 foreach my $field qw(Name Summary Class) {
 

Added: rtfm/branches/2.1-TESTING/t/URI__a.pm.t
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/t/URI__a.pm.t	Fri Apr 15 16:00:00 2005
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+use Test::More 'no_plan';
+
+use_ok(RT);
+RT::LoadConfig();
+RT::Init();
+
+use_ok("RT::URI::a");
+my $uri = RT::URI::a->new($RT::SystemUser);
+ok(ref($uri), "URI object exists");
+
+my $class = RT::FM::Class->new($RT::SystemUser);
+$class->Create(Name => 'URItest');
+my $article = RT::FM::Article->new($RT::SystemUser);
+$article->Create(Name => 'Testing URI parsing',
+                 Summary => 'In which this should load',
+                 Class => $class->Id);
+
+
+my $uristr = "a:" . $article->Id;
+$uri->ParseURI($uristr);
+is(ref($uri->Object), "RT::FM::Article", "Object loaded is an article");
+is($uri->Object->Id, $article->Id, "Object loaded has correct ID");
+is($uri->URI, 'fsck.com-rtfm://example.com/article/'.$article->Id, 
+   "URI object has correct URI string");


More information about the Rt-commit mailing list