[Rt-commit] r2581 - in rtfm/branches/2.1-TESTING: html/RTFM/Article html/RTFM/Article/Elements lib/RT/FM lib/RT/URI

tla at bestpractical.com tla at bestpractical.com
Sun Apr 3 15:26:15 EDT 2005


Author: tla
Date: Sun Apr  3 15:26:15 2005
New Revision: 2581

Modified:
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks
   rtfm/branches/2.1-TESTING/lib/RT/FM/Article_Overlay.pm
   rtfm/branches/2.1-TESTING/lib/RT/URI/a.pm
Log:
Make article and ticket links work, and display, correctly.


Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html	Sun Apr  3 15:26:15 2005
@@ -37,14 +37,12 @@
                         id => $id,
                         %ARGS &>
 
-                        CUSTOM FIELDS
 <& Elements/EditCustomFields, ArticleObj => $ArticleObj, 
                               CFContent => \%CFContent, 
                               ClassObj => $ClassObj, 
                               id =>$id,
                               %ARGS &>
 
-                              DONE
 <& Elements/EditTopics, ArticleObj => $ArticleObj,
                         ClassObj => $ArticleObj->Id ? $ArticleObj->ClassObj : $ClassObj,
                         %ARGS &>

Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks	Sun Apr  3 15:26:15 2005
@@ -18,7 +18,7 @@
 
 <TABLE>
 <TD VALIGN=TOP>
-<i><&|/l&>Enter Articles or URIs to link Articles to. Separate multiple entries with spaces.</&></i><br>
+<i><&|/l&>Enter articles, tickets, or other URIs to link this article to.  Articles may be specified as "a:###" and tickets may be specified as "t:###", where ### represents the ID of the article or ticket.  Separate multiple entries with spaces.</&></i><br>
 <i><&|/l&>(Check boxes to delete)</&></i><br>
 <TABLE>
 <TR><TD><&|/l&>Refers to</&>:</TD><TD><input name="<%$id%>-RefersTo" value="<%$ARGS{$id.'-RefersTo'}%>"><br>
@@ -30,7 +30,9 @@
 <LI>
 <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
 %     if ($link->TargetURI->IsLocal) {
-<a href="<%$member->Resolver->HREF%>"><%$member->Object->Id%></a>: 
+%       my $type = ref($member->Object);
+%       $type =~ s/^.*::(\w+)$/$1/;
+<a href="<%$member->Resolver->HREF%>"><% loc($type) %> <%$member->Object->Id%></a>: 
 %       if (UNIVERSAL::can($member->Object, 'Name')) {
 <%$member->Object->Name%>
 %       } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
@@ -54,7 +56,9 @@
 <LI>
 <INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-">
 %     if ($link->BaseURI->IsLocal) {
-<a href="<%$member->Resolver->HREF%>"><%$member->Object->Id%></a>: 
+%       my $type = ref($member->Object);
+%       $type =~ s/^.*::(\w+)$/$1/;
+<a href="<%$member->Resolver->HREF%>"><% loc($type) %> <%$member->Object->Id%></a>: 
 %       if (UNIVERSAL::can($member->Object, 'Name')) {
 <%$member->Object->Name%>
 %       } elsif (UNIVERSAL::can($member->Object, 'Subject')) {

Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics	Sun Apr  3 15:26:15 2005
@@ -19,7 +19,7 @@
 % if ($ClassObj->Id) {
 <table>
 <tr>
-<td>Fields in this class:</td>
+<td>Topics in this class:</td>
 <td>
 % }
 

Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks	Sun Apr  3 15:26:15 2005
@@ -28,8 +28,9 @@
 % my $member = $link->TargetURI;
 <LI>
 % if ($link->TargetURI->IsLocal) {
-
-<a href="<%$member->Resolver->HREF%>"><%$member->Object->Id%></a>: 
+% my $type = ref($member->Object);
+% $type =~ s/^.*::(\w+)$/$1/;
+<a href="<%$member->Resolver->HREF%>"><% loc($type) %> <%$member->Object->Id%></a>: 
 % if (UNIVERSAL::can($member->Object, 'Name')) {
 <%$member->Object->Name%>
 % } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
@@ -50,7 +51,7 @@
 % my $member = $link->BaseURI;
 <LI>
 % if ($member->IsLocal) {
-<a href="<%$member->Resolver->HREF%>"><%$member->Object->Id%></a>: 
+<a href="<%$member->Resolver->HREF%>"><% loc($member->Object->ObjectType) %> <%$member->Object->Id%></a>: 
 % if (UNIVERSAL::can($member->Object, 'Name')) {
 <%$member->Object->Name%>
 % } elsif (UNIVERSAL::can($member->Object, 'Subject')) {

Modified: rtfm/branches/2.1-TESTING/lib/RT/FM/Article_Overlay.pm
==============================================================================
--- rtfm/branches/2.1-TESTING/lib/RT/FM/Article_Overlay.pm	(original)
+++ rtfm/branches/2.1-TESTING/lib/RT/FM/Article_Overlay.pm	Sun Apr  3 15:26:15 2005
@@ -350,6 +350,13 @@
         return ( 0, $self->loc("Permission Denied") );
     }
 
+    # Disallow parsing of plain numbers in article links.  If they are
+    # allowed, they default to being tickets instead of articles, which
+    # is counterintuitive.
+    if ($args{'Target'} =~ /^\d+$/) {
+	return ( 0, $self->loc("Cannot add link to plain number") );
+    }
+
     $self->_AddLink(%args);
 }
 

Modified: rtfm/branches/2.1-TESTING/lib/RT/URI/a.pm
==============================================================================
--- rtfm/branches/2.1-TESTING/lib/RT/URI/a.pm	(original)
+++ rtfm/branches/2.1-TESTING/lib/RT/URI/a.pm	Sun Apr  3 15:26:15 2005
@@ -42,8 +42,6 @@
 use_ok("RT::URI::a");
 my $uri = RT::URI::a->new($RT::SystemUser);
 ok(ref($uri), "URI object exists");
-is($uri->LocalURIPrefix, 'fsck.com-rtfm://example.com/article', 
-   "URI has correct local prefix");
 
 my $class = RT::FM::Class->new($RT::SystemUser);
 $class->Create(Name => 'URItest');


More information about the Rt-commit mailing list