[Rt-commit] r4610 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR html/RTIR/Incident

alexmv at bestpractical.com alexmv at bestpractical.com
Wed Mar 1 07:33:43 EST 2006


Author: alexmv
Date: Wed Mar  1 07:33:40 2006
New Revision: 4610

Added:
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html
Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html

Log:
 r9385 at zoq-fot-pik:  chmrr | 2006-03-01 07:33:09 -0500
  * RTFM integration


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	Wed Mar  1 07:33:40 2006
@@ -32,7 +32,7 @@
 
 <& /Elements/ListActions, actions => \@results &>
 
-% if ($id != 'new' && $Ticket->QueueObj->Name ne $QueueObj->Name) {
+% if ($id ne 'new' && $Ticket->QueueObj->Name ne $QueueObj->Name) {
 <%loc("This ticket isn't a [_1].", $Type)%>
 %   $m->abort();
 % }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	Wed Mar  1 07:33:40 2006
@@ -172,7 +172,7 @@
 <& /Widgets/TitleBoxEnd &>
 % }
 
-</td></tr><tr><td colspan="2">
+</td></tr><tr><td valign="top" width="50%">
 
 <& /Widgets/TitleBoxStart, title => loc("Dates"),
     title_href => RT->Config->Get('WebPath') ."/RTIR/Edit.html?id=".$id, 
@@ -186,6 +186,31 @@
 <& /Ticket/Elements/ShowAttachments, Ticket => $TicketObj, Attachments => $attachments &>
 <& /Ticket/Elements/ShowRequestor, Ticket => $TicketObj, DisplayPath => "/RTIR/Display.html" &>
 
+</td><td valign="top" width="50%">
+
+% if ($RT::FM::VERSION) {
+<& /Widgets/TitleBoxStart, title => loc("Articles"),
+    title_href => RT->Config->Get('WebPath') ."/RTIR/Advanced.html?id=".$id, 
+    title_class=> 'inverse',
+    color => "#663366" &>
+
+% if ($TicketObj->CurrentUserHasRight('ModifyTicket')) {
+% my $qs = $m->comp("/Elements/QueryString", "RefersTo-new" => "t:$id", next => "/RTIR/Display.html?id=$id");
+    <table width="100%"><tr><td align="right"><font size="-1">
+        | <a href="<%RT->Config->Get('WebPath')%>/RTFM/Article/PreCreate.html?<% $qs |n%>"><%loc('New')%></a> 
+        | <a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkArticles.html?id=<%$id%>"><%loc("Link")%></a> |
+    </font></td></tr></table>
+% }
+
+<ul>
+% while (my $Link = $TicketObj->RefersTo->Next) {
+% next unless UNIVERSAL::isa($Link->TargetURI->Object, "RT::FM::Article");
+<li><a href="<%$Link->TargetURI->Resolver->HREF%>"><% $Link->TargetURI->Object->Name %></a></li>
+% }
+</ul>
+
+<& /Widgets/TitleBoxEnd &>
+% }
 </td></tr></table>
 
 <& /Ticket/Elements/ShowHistory , 
@@ -213,6 +238,7 @@
     # Blocks or Incedent Reports can have multiple incidents
     my ($Type) = $m->comp( "/RTIR/Elements/Type", TicketObj => $TicketObj );
     unless( $Type eq 'Block' || $Type eq 'Report' ) {
+        # XXX: Can we ever get here?
         my $query = "Queue = 'Incidents' AND HasMember = ". $TicketObj->Id ." AND id != ". $Target->id;
         my $incidents = new RT::Tickets( $session{'CurrentUser'} );
         $incidents->FromSQL( $query );
@@ -286,6 +312,10 @@
             push @results, $DoLinks->( $child, $TicketObj );
         }
     }
+    if ($ARGS{'BulkArticles'}) {
+        my $ref = join " ", map {"a:$_"} @SelectedTickets;
+        push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} );
+    }
 
     unless( $new_ticket ) {
         $ARGS{UpdateAttachments} = delete $session{'Attachments'};
@@ -310,6 +340,7 @@
 
 # If we deleted any links, check if what we deleted from still has children
 if ( $deleted_links ) {
+    # XXX: Can we ever get here?
     my $children = new RT::Tickets( $session{'CurrentUser'} );
     $children->LimitQueue( VALUE => 'Incident Reports' );
     $children->LimitQueue( VALUE => 'Investigations' );

Added: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html
==============================================================================
--- (empty file)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html	Wed Mar  1 07:33:40 2006
@@ -0,0 +1,88 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2002 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+<& /RTIR/Elements/Header, 
+    Title => $title, 
+    Refresh => $session{'tickets_refresh_interval'} &>
+
+<& Elements/LinkTabs, 
+    Ticket => $IncidentObj, 
+    current_subtab => 'RTIR/Incident/LinkArticles.html?id='.$IncidentObj->id,
+    Tab => loc('Link article'),
+    Title => $title,
+&>
+
+<form action="LinkArticles.html" method="get">
+<input type="hidden" name="id" value="<%$id%>" />
+
+Search: <input type="text" name="search" value="<% $search %>" />
+<& /Elements/Submit, Name => "DoSearch", Label => loc("Search") &>
+</form>
+
+<form action="Display.html" method="post">
+<input type="hidden" name="id" value="<%$id%>" />
+<ul>
+% while (my $article = $articles->Next) {
+<li><input type="checkbox" name="SelectedTickets" value="<% $article->id %>" /> 
+<a href="/RTFM/Article/Display.html?id=<% $article->id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></a>
+</li>
+% }
+</ul>
+% if ($search) {
+<& /Elements/Submit, Name => "BulkArticles", Caption => $title, Label => loc("Link") &>
+% }
+</form>
+
+<%INIT>
+my $IncidentObj = LoadTicket($id);
+$ARGS{'id'} = $id = $IncidentObj->id;
+my $title = loc("Link selected articles to Incident #[_1]", $id);
+
+use RT::FM::ArticleCollection;
+my $articles = RT::FM::ArticleCollection->new( $session{'CurrentUser'} );
+if ( $search ) {
+    $articles->LimitCustomField( VALUE => $search,
+                                 ENTRYAGGREGATOR => 'OR',
+                                 OPERATOR => 'LIKE',
+                                 CASESENSITIVE => 0,
+                                 SUBCLAUSE => 'SearchAll' );
+    $articles->Limit( SUBCLAUSE => 'SearchAll',
+                      FIELD => "Name",
+                      VALUE => $search,
+                      ENTRYAGGREGATOR => 'OR',
+                      CASESENSITIVE => 0,
+                      OPERATOR => 'LIKE' );
+    $articles->Limit( SUBCLAUSE => 'SearchAll',
+                      FIELD => "Summary",
+                      VALUE => $search,
+                      ENTRYAGGREGATOR => 'OR',
+                      CASESENSITIVE => 0,
+                      OPERATOR => 'LIKE' );
+}
+</%INIT>
+
+<%ARGS>
+$id          => undef
+$search      => ""
+</%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	Wed Mar  1 07:33:40 2006
@@ -64,13 +64,9 @@
 my $Incident = LoadTicket($id);
 
 if( $ARGS{'Unlink'} ) {
-      # translate the checkbox args to what ProcessTicketLinks expects
-      foreach my $arg (keys %ARGS) {
-          if ($arg =~ /^UpdateTicket(\d+)/) {
-              $ARGS{'DeleteLink-' . $1 . '-MemberOf-'} = 1;
-          }
-      }
-      push @results, ProcessTicketLinks( TicketObj => $Incident, ARGSRef => \%ARGS );
+    # translate the checkbox args to what ProcessTicketLinks expects
+    $ARGS{'DeleteLink-' . $_ . '-MemberOf-'} = 1 for @SelectedTickets;
+    push @results, ProcessTicketLinks( TicketObj => $Incident, ARGSRef => \%ARGS );
 }
 
 unless ($Incident->CurrentUserHasRight('ShowTicket')) {
@@ -101,5 +97,6 @@
 <%ARGS>
 $id => undef
 $Queue => 'Incident Reports'
+ at SelectedTickets => ()
 @States => ()
 </%ARGS>


More information about the Rt-commit mailing list