--- loncom/xml/londefdef.pm 2007/06/26 01:36:48 1.371 +++ loncom/xml/londefdef.pm 2007/07/13 18:35:20 1.373 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.371 2007/06/26 01:36:48 albertel Exp $ +# $Id: londefdef.pm,v 1.373 2007/07/13 18:35:20 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -475,25 +475,27 @@ sub end_meta { sub start_accessrule { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $currentstring = ''; - my $eff=&Apache::lonxml::get_param - ('effect',$parstack,$safeeval,undef,1); - my $realm=&Apache::lonxml::get_param - ('realm',$parstack,$safeeval,undef,1); - my $role=&Apache::lonxml::get_param - ('role',$parstack,$safeeval,undef,1); - my ($dom,$crs,$sec)=split(/\_/,$realm); - $dom = &LONCAPA::clean_domain($dom); - my $type=&Apache::lonxml::get_param - ('type',$parstack,$safeeval,undef,1); + my $eff =&Apache::lonxml::get_param('effect',$parstack,$safeeval,undef,1); + my $realm=&Apache::lonxml::get_param('realm', $parstack,$safeeval,undef,1); + my $role =&Apache::lonxml::get_param('role', $parstack,$safeeval,undef,1); + my $type =&Apache::lonxml::get_param('type', $parstack,$safeeval,undef,1); + + my ($dom,$crs,$sec,$separator); if ($type eq 'user') { + ($dom,$crs,$sec)=split(m{/},$realm); $crs = &LONCAPA::clean_username($crs); + $separator = '/'; } else { + ($dom,$crs,$sec)=split(/\_/,$realm); $crs = &LONCAPA::clean_courseid($crs); + $separator = '_'; } + $dom = &LONCAPA::clean_domain($dom); + $sec =~s/\W//; $realm = $dom; - if ($crs =~ /\S/) { $realm .= '_'.$crs; } - if ($sec =~ /\S/) { $realm .= '_'.$sec; } + if ($crs =~ /\S/) { $realm .= $separator.$crs; } + if ($sec =~ /\S/) { $realm .= $separator.$sec; } $role=~s/\W//g; if ($target eq 'web') { @@ -2066,6 +2068,7 @@ sub end_table { if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { + my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); my $inmemory = ''; my $output = ''; my $WARNING=''; @@ -2313,6 +2316,10 @@ sub end_table { # Do the appropriate magic if this has a colspan # + my $border_char = ""; + if ($border) { + $border_char = "|"; + } my $spanwidth = 0; if ($colspan > 1) { for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) { @@ -2322,12 +2329,12 @@ sub end_table { $colspan ."}"; if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { - $output .= '{|c|}{'; + $output .= '{'.$border_char.'c'.$border_char.'}{'; } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { - $output .= '{|r|}{'; + $output .= '{'.$border_char.'r'.$border_char.'}{'; } else { - $output .= "{|p{$spanwidth mm}|}{"; + $output .= '{'.$border_char."p{$spanwidth mm}".$border_char.'}{'; } } else { @@ -2343,10 +2350,10 @@ sub end_table { if ($rowspan > 1) { if ($colspan == 1) { if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { - $output .= '\multicolumn{1}{|c|}{'; + $output .= '\multicolumn{1}{'.$border_char.'c'.$border_char.'}{'; $multirow_aligned = 1; } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { - $output .= '\multicolumn{1}{|r|}{'; + $output .= '\multicolumn{1}{'.$border_char.'r'.$border_char.'}{'; $multirow_aligned = 1; } } @@ -2383,9 +2390,9 @@ sub end_table { # if ($colspan == 1 && $rowspan == 1) { if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { - $output .= '\multicolumn{1}{|c|}{'; + $output .= '\multicolumn{1}{'.$border_char.'c'.$border_char.'}{'; } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { - $output .= '\multicolumn{1}{|r|}{'; + $output .= '\multicolumn{1}{'.$border_char.'r'.$border_char.'}{'; } }