[Rt-commit] r7039 - rt/branches/3.6-RELEASE/html/Elements

ruz at bestpractical.com ruz at bestpractical.com
Tue Feb 20 19:58:30 EST 2007


Author: ruz
Date: Tue Feb 20 19:58:29 2007
New Revision: 7039

Modified:
   rt/branches/3.6-RELEASE/html/Elements/MyRT

Log:
* backport 'RT at glance with one column' feature from 3.7

Modified: rt/branches/3.6-RELEASE/html/Elements/MyRT
==============================================================================
--- rt/branches/3.6-RELEASE/html/Elements/MyRT	(original)
+++ rt/branches/3.6-RELEASE/html/Elements/MyRT	Tue Feb 20 19:58:29 2007
@@ -45,43 +45,36 @@
 %# END BPS TAGGED BLOCK }}}
 <table border="0" width="100%">
 <tr valign="top">
-<td width="70%" class="boxcontainer">
 
-% for my $portlet (@{$portlets->{body}}) {
-<% $show_cb->( $portlet ) %>
-<br />
-% }
-
-%#GAH!
+<td class="boxcontainer" width="70%" <% $summary? 'width="70%"': '' %>>
+% $show_cb->($_) foreach @$body;
 </td>
-<td class="boxcontainer">
 
-% for my $portlet (@{$portlets->{summary}}) {
-<% $show_cb->( $portlet ) %>
-<br />
+% if ( $summary ) {
+<td class="boxcontainer">
+% $show_cb->($_) foreach @$summary;
+</td>
 % }
 
-</td>
 </tr>
 </table>
 
 <%INIT>
 
-my %allowed_components = map {$_ => 1} @{$RT::HomepageComponents};
-
 my $user = $session{'CurrentUser'}->UserObj;
 unless (exists $session{'my_rt_portlets'}) {
     my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
-    my $portlets; 
-    if ($default_portlets) {
-        $portlets = $default_portlets->Content(); 
-    } else {
-        $portlets = {};
-    }
-    $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $portlets);
+    $session{'my_rt_portlets'} = $user->Preferences(
+        HomepageSettings => $default_portlets? $default_portlets->Content: {},
+    );
 }
 
-my $portlets = $session{'my_rt_portlets'};
+my ($body, $summary) = @{$session{'my_rt_portlets'}}{qw(body summary)};
+unless( $body && @$body ) {
+    $body = $summary || [];
+    $summary = undef;
+}
+$summary = undef unless $summary && @$summary;
 
 my $Rows = $user->Preferences( 'SummaryRows', ( $RT::DefaultSummaryRows || 10 ) );
 


More information about the Rt-commit mailing list