[Rt-commit] r12722 - in rt/branches/3.8-TESTING: . share/html/Elements share/html/Search
alexmv at bestpractical.com
alexmv at bestpractical.com
Wed May 28 17:06:12 EDT 2008
Author: alexmv
Date: Wed May 28 17:06:12 2008
New Revision: 12722
Modified:
rt/branches/3.8-TESTING/ (props changed)
rt/branches/3.8-TESTING/share/html/Elements/Header
rt/branches/3.8-TESTING/share/html/Search/Results.html
rt/branches/3.8-TESTING/share/html/Ticket/Display.html
Log:
r32251 at kohr-ah: chmrr | 2008-05-28 17:02:44 -0400
* Add <link rel="prev" href="..." /> to ticket and search results headers; closing my rt3.fsck.com #6335 from 3.5 years ago
Modified: rt/branches/3.8-TESTING/share/html/Elements/Header
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/Header (original)
+++ rt/branches/3.8-TESTING/share/html/Elements/Header Wed May 28 17:06:12 2008
@@ -61,6 +61,10 @@
<link rel="stylesheet" href="<%RT->Config->Get('WebPath')%>/NoAuth/css/<% RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} ) %>/main.css" type="text/css" media="all" />
<link rel="stylesheet" href="<%RT->Config->Get('WebPath')%>/NoAuth/css/print.css" type="text/css" media="print" />
+% for (keys %{$LinkRel || {}}) {
+ <link rel="<% $_ %>" href="<% RT->Config->Get('WebPath') . $LinkRel->{$_} %>" />
+% }
+
% if ( $RSSAutoDiscovery ) {
<link rel="alternate" href="<%$RSSAutoDiscovery%>" type="application/rss+xml" title="RSS RT Search" />
% }
@@ -122,4 +126,5 @@
$URL => undef
$RSSAutoDiscovery => undef
$onload => undef
+$LinkRel => undef
</%ARGS>
Modified: rt/branches/3.8-TESTING/share/html/Search/Results.html
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Search/Results.html (original)
+++ rt/branches/3.8-TESTING/share/html/Search/Results.html Wed May 28 17:06:12 2008
@@ -46,7 +46,8 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'},
- RSSAutoDiscovery => $RSSFeedURL &>
+ RSSAutoDiscovery => $RSSFeedURL,
+ LinkRel => \%link_rel &>
<& /Ticket/Elements/Tabs,
current_tab => "Search/Results.html".$QueryString,
Title => $title,
@@ -63,7 +64,7 @@
Rows => $Rows,
Page => $Page,
Format => $Format,
- BaseURL => RT->Config->Get('WebPath')."/Search/Results.html?"
+ BaseURL => $BaseURL
&>
% my %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order, HideResults => $HideResults, Page => $Page );
@@ -160,6 +161,23 @@
$session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'};
}
+my %link_rel;
+my $genpage = sub {
+ return $m->comp(
+ '/Elements/QueryString',
+ Query => $Query,
+ Format => $Format,
+ Rows => $Rows,
+ OrderBy => $OrderBy,
+ Order => $Order,
+ Page => shift(@_),
+ );
+};
+my $BaseURL = RT->Config->Get('WebPath')."/Search/Results.html?";
+$link_rel{first} = $BaseURL . $genpage->(1) if $Page > 1;
+$link_rel{prev} = $BaseURL . $genpage->($Page - 1) if $Page > 1;
+$link_rel{next} = $BaseURL . $genpage->($Page + 1) if ($Page * $Rows) < $ticketcount;
+$link_rel{last} = $BaseURL . $genpage->(POSIX::ceil($ticketcount/$Rows)) if ($Page * $Rows) < $ticketcount;
</%INIT>
<%CLEANUP>
$session{'tickets'}->PrepForSerialization();
Modified: rt/branches/3.8-TESTING/share/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Ticket/Display.html (original)
+++ rt/branches/3.8-TESTING/share/html/Ticket/Display.html Wed May 28 17:06:12 2008
@@ -46,7 +46,8 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header,
- Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
+ Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject),
+ LinkRel => \%link_rel &>
<& /Ticket/Elements/Tabs,
Ticket => $TicketObj,
current_tab => 'Ticket/Display.html?id='.$TicketObj->id,
@@ -200,4 +201,12 @@
my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);
+my %link_rel;
+if (defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
+ my $item_map = $session{'tickets'}->ItemMap;
+ $link_rel{first} = "Ticket/Display.html?id=" . $item_map->{first} if $item_map->{$TicketObj->Id}{prev};
+ $link_rel{prev} = "Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{prev} if $item_map->{$TicketObj->Id}{prev};
+ $link_rel{next} = "Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{next} if $item_map->{$TicketObj->Id}{next};
+ $link_rel{last} = "Ticket/Display.html?id=" . $item_map->{last} if $item_map->{$TicketObj->Id}{next};
+}
</%INIT>
More information about the Rt-commit
mailing list