[Rt-commit] rtir branch, 4.2/rss-feed-reader, repushed
Aaron Trevena
ast at bestpractical.com
Fri Mar 20 07:32:15 EDT 2020
The branch 4.2/rss-feed-reader was deleted and repushed:
was fc69f0276690f4c88b722ba4b61db51cd88a1d14
now 60487edf210085a894a742aead3ba2dca5633b6b
1: fc69f027 ! 1: 60487edf Added external feeds to tools to create incidents from RSS
@@ -8,15 +8,6 @@
diff --git a/Makefile.PL b/Makefile.PL
--- a/Makefile.PL
+++ b/Makefile.PL
-@@
- all_from('lib/RT/IR.pm');
-
- # update README and docs/UPGRADING
--requires_rt('4.6.0');
-+requires_rt('4.2.0');
- rt_too_new('4.8.0',"\nThis version of RTIR is only compatible with RT 4.6.x and you are using RT %s\n");
-
- # XXX: This should be reported by M::I::RTx
@@
# queries parsing
requires('Parse::BooleanLogic');
@@ -99,13 +90,23 @@
+% my $i = 0;
+% if ($FeedName) {
+% my $feed = $ExternalFeeds->fetch_rss_feed($FeedName);
-+ <h2><% $feed->{Title} %></h2>
-+ <% $feed->{Description} %> <i>updated <% $feed->{PubDate} || $feed->{LastBuildDate} || '-'%></i>
-+ <table cellspacing="0" class="collection-as-table">
++<&|/Widgets/TitleBox,
++ title => $feed->{Title},
++ class => "fullwidth",
++ bodyclass => "",
++&>
++<div class="table-responsive">
++ <% $feed->{Description} %>
++% if ( $feed->{PubDate} || $feed->{LastBuildDate}) {
++ <i>updated <% $feed->{PubDate} || $feed->{LastBuildDate} || '-'%></i>
++% }
++ <table cellspacing="0" class="table collection collection-as-table">
+ <tr class="collection-as-table">
+ <th class="collection-as-table"><&|/l&>Name</&></th>
-+ <th class="collection-as-table" colspan="2"><&|/l&>Description</&></th>
-+ </tr>
++ <th class="collection-as-table"><&|/l&>Created</&></th>
++ <th class="collection-as-table"><% loc('Create a new [_1]', $ticket_type) %></th>
++</tr>
++<tbody class="list-item">
+% foreach my $item (@{ $feed->{items} }) {
+% my $GeneratedSubject = sprintf('Incident from RSS feed %s : %s', $feed->{Title}, $item->{Title});
+% my $GeneratedMessage = join("\n",
@@ -113,35 +114,42 @@
+% sprintf('Source : %s on %s', $item->{Link} , $item->{PubDate} || $item->{LastBuildDate} || '-'),
+% $item->{Description} || '' );
+ <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
-+ <td class="collection-as-table"><% $item->{Title} %></td>
-+ <td class="collection-as-table">
++ <td class="collection-as-table align-text-top"><strong><% $item->{Title} %></strong> <a href="<% $item->{Link} %>" target="_New_<% $i %>"><% $item->{Link} %></a> </td>
++ <td class="collection-as-table align-text-top"><i><% $item->{PubDate} || $item->{LastBuildDate} %></i></td>
++ <td class="collection-as-table align-text-top">
+ <form action="<% $CreateURI %>" name="CreateIncident-<% $i %>" id="CreateIncident-<% $i %>" method="post">
+ <input type="hidden" value="<% $GeneratedSubject %>" name="Subject">
+ <input type="hidden" value="<% $GeneratedMessage %>" name="Content">
-+ <&|/l_unsafe, $ticket_type,
-+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
++ <& /RTIR/Elements/SelectRTIRQueue,
+ Name => 'Queue',
+ ShowNullOption => 0,
+ Lifecycle => $Lifecycle,
+ LimitToConstituency => 1,
-+ Constituency => $m->{'RTIR_ConstituencyFilter'})
-+ &>Create a new [_1] in the queue [_2]</&>
++ Constituency => $m->{'RTIR_ConstituencyFilter'} &>
+ <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $ticket_type) &>
+ </form>
+ </td>
-+ <td class="collection-as-table"> </td>
+ </tr>
-+ <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
-+ <td class="collection-as-table" colspan="3"><% substr($item->{Description}, 0, 1024) %></td>
++
++
++ <tr class="<% $i%2 ? 'oddline' : 'evenline' %>">
++ <td class="collection-as-table" colspan="3"><small><% $item->{Description} %></small></td>
+ </tr>
-+% $i++;
++% $i++;
+% }
++</tbody>
+</table>
++</div>
++</&>
+% }
+% else {
-+<h2>RSS Feeds</h2>
-+<table cellspacing="0" class="collection-as-table">
-+<tr class="collection-as-table">
++<&|/Widgets/TitleBox,
++ title => loc("RSS"),
++ class => "fullwidth",
++ bodyclass => ""
++&>
++<table border="0" cellspacing="0" cellpadding="1" width="100%" class="table queue-summary">
++<tr>
+<th class="collection-as-table"><&|/l&>Name</&></th>
+<th class="collection-as-table"><&|/l&>Description</&></th>
+</tr>
@@ -153,6 +161,7 @@
+% $i++;
+% }
+</table>
++</&>
+% }
+<%INIT>
+use URI::Escape;
@@ -161,12 +170,11 @@
+my $ExternalFeeds = new RT::IR::ExternalFeeds;
+my $Lifecycle = 'incidents';
+my $ticket_type = lc RT::IR::TicketType( Lifecycle => $Lifecycle );
-+my $title = 'External Feeds';
++my $title = loc('External Feeds');
+</%INIT>
+<%ARGS>
+$FeedName => undef
+</%ARGS>
-+
diff --git a/lib/RT/IR/ExternalFeeds.pm b/lib/RT/IR/ExternalFeeds.pm
new file mode 100644
More information about the rt-commit
mailing list