--- rat/lonratedt.pm 2004/11/17 20:14:23 1.63 +++ rat/lonratedt.pm 2005/03/23 22:54:18 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.63 2004/11/17 20:14:23 raeburn Exp $ +# $Id: lonratedt.pm,v 1.64 2005/03/23 22:54:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1149,6 +1149,14 @@ sub viewmap { if ($adv) { $r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />'); } + $r->print( '<table border="0" cellspacing="2" cellpadding="4">'. + '<tr bgcolor="#DDDDDD"><th>'.&mt('Type').'</th>'. + '<th>'.&mt('Title in map').'</th>'. + '<th>'.&mt('Filename of resource').'</th>'. + '<th>'.&mt('Link to published resource').'</th>'. + '<th>'.&mt('Link to resource in Construction Space').'</th>'. + '</tr>'); + my @backgroundColors = ("#FFFFFF", "#F6F6F6"); foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) { if (defined($_)) { $idx++; @@ -1157,15 +1165,36 @@ sub viewmap { $title=~s/\&colon\;/\:/g; $url=~s/\&colon\;/\:/g; unless ($title) { $title=(split(/\//,$url))[-1] }; - unless ($title) { $title='<i>Empty</i>'; } + unless ($title) { $title='<i>'.&mt('Empty').'</i>'; } + my $resurl = &Apache::lonratsrv::qtescape($url); + my $resfilepath = $Apache::lonnet::perlvar{'lonDocRoot'}.$resurl; + my $filename; + if ($resurl =~ m#/([^/]+)$#) { + $filename = $1; + } + my $cstrurl = $resurl; + $cstrurl =~ s#^/res/[^/]+/([^/]+)/#/priv/$1/#; + my $bgcol = $idx%2; + $r->print('<tr bgcolor='.$backgroundColors[$bgcol].'><td>'. + '<img src="'.&Apache::loncommon::icon($resfilepath). + '" /></td><td>'.&Apache::lonratsrv::qtescape($title). + '</td><td>'.$filename.'</td><td>'); + if ($url) { + if (-e $resfilepath) { + $r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>'); + } else { + $r->print(&mt('unpublished')); + } + } + $r->print('</td><td>'); if ($url) { - $r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); + $r->print('<a href="'.$cstrurl.'">'. + &mt('Construction space').'</a>'); } - $r->print(&Apache::lonratsrv::qtescape($title)); - if ($url) { $r->print('</a>'); } - $r->print("<br />\n"); + $r->print('</td></tr>'."\n"); } } + $r->print('</table>'); $r->print('</body></html>'); }