version 1.370, 2007/06/26 01:20:35
|
version 1.373, 2007/07/13 18:35:20
|
Line 475 sub end_meta {
|
Line 475 sub end_meta {
|
sub start_accessrule { |
sub start_accessrule { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
my $eff=&Apache::lonxml::get_param |
my $eff =&Apache::lonxml::get_param('effect',$parstack,$safeeval,undef,1); |
('effect',$parstack,$safeeval,undef,1); |
my $realm=&Apache::lonxml::get_param('realm', $parstack,$safeeval,undef,1); |
my $realm=&Apache::lonxml::get_param |
my $role =&Apache::lonxml::get_param('role', $parstack,$safeeval,undef,1); |
('realm',$parstack,$safeeval,undef,1); |
my $type =&Apache::lonxml::get_param('type', $parstack,$safeeval,undef,1); |
my $role=&Apache::lonxml::get_param |
|
('role',$parstack,$safeeval,undef,1); |
my ($dom,$crs,$sec,$separator); |
my ($dom,$crs,$sec)=split(/\_/,$realm); |
|
$dom = &LONCAPA::clean_domain($dom); |
|
my $type=&Apache::lonxml::get_param |
|
('type',$parstack,$safeeval,undef,1); |
|
if ($type eq 'user') { |
if ($type eq 'user') { |
|
($dom,$crs,$sec)=split(m{/},$realm); |
$crs = &LONCAPA::clean_username($crs); |
$crs = &LONCAPA::clean_username($crs); |
|
$separator = '/'; |
} else { |
} else { |
|
($dom,$crs,$sec)=split(/\_/,$realm); |
$crs = &LONCAPA::clean_courseid($crs); |
$crs = &LONCAPA::clean_courseid($crs); |
|
$separator = '_'; |
} |
} |
|
$dom = &LONCAPA::clean_domain($dom); |
|
|
$sec =~s/\W//; |
$sec =~s/\W//; |
$realm = $dom; |
$realm = $dom; |
if ($crs =~ /\S/) { $realm .= '_'.$crs; } |
if ($crs =~ /\S/) { $realm .= $separator.$crs; } |
if ($sec =~ /\S/) { $realm .= '_'.$sec; } |
if ($sec =~ /\S/) { $realm .= $separator.$sec; } |
$role=~s/\W//g; |
$role=~s/\W//g; |
|
|
if ($target eq 'web') { |
if ($target eq 'web') { |
Line 2066 sub end_table {
|
Line 2068 sub end_table {
|
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $inmemory = ''; |
my $inmemory = ''; |
my $output = ''; |
my $output = ''; |
my $WARNING=''; |
my $WARNING=''; |
Line 2258 sub end_table {
|
Line 2261 sub end_table {
|
for (my $i=0;$i<=$#fwidth;$i++) { |
for (my $i=0;$i<=$#fwidth;$i++) { |
$current+=$fwidth[$i]; |
$current+=$fwidth[$i]; |
} |
} |
|
if ($current == 0) { |
|
$current = $Apache::londefdef::table[-1]{'width'}; |
|
} |
my $coef=$Apache::londefdef::table[-1]{'width'}/$current; |
my $coef=$Apache::londefdef::table[-1]{'width'}/$current; |
for (my $i=0;$i<=$#fwidth;$i++) { |
for (my $i=0;$i<=$#fwidth;$i++) { |
$fwidth[$i]*=$coef; |
$fwidth[$i]*=$coef; |
Line 2310 sub end_table {
|
Line 2316 sub end_table {
|
# Do the appropriate magic if this has a colspan |
# Do the appropriate magic if this has a colspan |
# |
# |
|
|
|
my $border_char = ""; |
|
if ($border) { |
|
$border_char = "|"; |
|
} |
my $spanwidth = 0; |
my $spanwidth = 0; |
if ($colspan > 1) { |
if ($colspan > 1) { |
for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) { |
for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) { |
Line 2319 sub end_table {
|
Line 2329 sub end_table {
|
$colspan |
$colspan |
."}"; |
."}"; |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
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') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output .= '{|r|}{'; |
$output .= '{'.$border_char.'r'.$border_char.'}{'; |
} |
} |
else { |
else { |
$output .= "{|p{$spanwidth mm}|}{"; |
$output .= '{'.$border_char."p{$spanwidth mm}".$border_char.'}{'; |
} |
} |
|
|
} else { |
} else { |
Line 2340 sub end_table {
|
Line 2350 sub end_table {
|
if ($rowspan > 1) { |
if ($rowspan > 1) { |
if ($colspan == 1) { |
if ($colspan == 1) { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
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; |
$multirow_aligned = 1; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} 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; |
$multirow_aligned = 1; |
} |
} |
} |
} |
Line 2380 sub end_table {
|
Line 2390 sub end_table {
|
# |
# |
if ($colspan == 1 && $rowspan == 1) { |
if ($colspan == 1 && $rowspan == 1) { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
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') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output .= '\multicolumn{1}{|r|}{'; |
$output .= '\multicolumn{1}{'.$border_char.'r'.$border_char.'}{'; |
} |
} |
} |
} |
|
|