version 1.271, 2003/08/13 14:23:37
|
version 1.275, 2003/09/11 22:37:54
|
Line 184 sub xmlend {
|
Line 184 sub xmlend {
|
} |
} |
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
my $viewgrades=&Apache::lonnet::allowed('vgr',$crs); |
unless ($symb) { |
unless ($symb) { |
$symb=&Apache::lonnet::symbread(); |
$symb=&Apache::lonnet::symbread(); |
} |
} |
Line 250 sub xmlend {
|
Line 251 sub xmlend {
|
$sender='<i>'.$screenname.'</i>'; |
$sender='<i>'.$screenname.'</i>'; |
} |
} |
} |
} |
$discussion.='<p><b>'.$sender.'</b> ('. |
my $vgrlink; |
|
if ($viewgrades) { |
|
$vgrlink=&Apache::loncommon::submlink('Submissions',$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); |
|
} |
|
$discussion.='<p><b>'.$sender.'</b> '.$vgrlink.' ('. |
localtime($contrib{$idx.':timestamp'}). |
localtime($contrib{$idx.':timestamp'}). |
'):<blockquote>'.$message. |
'):<blockquote>'.$message. |
'</blockquote></p>'; |
'</blockquote></p>'; |
Line 478 sub htmlclean {
|
Line 483 sub htmlclean {
|
} |
} |
|
|
sub latex_special_symbols { |
sub latex_special_symbols { |
my ($current_token,$stack,$parstack,$where)=@_; |
my ($string,$where)=@_; |
if ($where eq 'header') { |
if ($where eq 'header') { |
$current_token =~ s/(\\|_|\^)/ /g; |
$string =~ s/(\\|_|\^)/ /g; |
$current_token =~ s/(\$|%|\#|&|\{|\})/\\$1/g; |
$string =~ s/(\$|%|\#|&|\{|\})/\\$1/g; |
|
$string =~ s/_/ /g; |
} else { |
} else { |
$current_token=~s/\\ /\\char92 /g; |
$string=~s/\\ /\\char92 /g; |
$current_token=~s/\^/\\char94 /g; |
$string=~s/\^/\\char94 /g; |
$current_token=~s/\~/\\char126 /g; |
$string=~s/\~/\\char126 /g; |
$current_token=~s/(&[^A-Za-z\#])/\\$1/g; |
$string=~s/(&[^A-Za-z\#])/\\$1/g; |
$current_token=~s/([^&])\#/$1\\#/g; |
$string=~s/([^&])\#/$1\\#/g; |
$current_token=~s/(\$|_|{|})/\\$1/g; |
$string=~s/(\$|_|{|})/\\$1/g; |
$current_token=~s/\\char92 /\\texttt{\\char92}/g; |
$string=~s/\\char92 /\\texttt{\\char92}/g; |
$current_token=~s/(>|<)/\$$1\$/g; #more or less |
$string=~s/(>|<)/\$$1\$/g; #more or less |
if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit |
if ($string=~m/\d%/) {$string =~ s/(\d)%/$1\\%/g;} #percent after digit |
if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space |
if ($string=~m/\s%/) {$string =~ s/(\s)%/$1\\%/g;} #percent after space |
if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement |
if ($string eq '%.') {$string = '\%.';} #percent at the end of statement |
} |
} |
return $current_token; |
return $string; |
} |
} |
|
|
sub inner_xmlparse { |
sub inner_xmlparse { |
Line 585 sub inner_xmlparse {
|
Line 591 sub inner_xmlparse {
|
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
#Style file definitions should be correct |
#Style file definitions should be correct |
if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { |
if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { |
$result=&latex_special_symbols($result,$stack,$parstack); |
$result=&latex_special_symbols($result); |
} |
} |
} |
} |
|
|
Line 1163 SIMPLECONTENT
|
Line 1169 SIMPLECONTENT
|
return $filecontents; |
return $filecontents; |
} |
} |
|
|
|
sub createnewsty { |
|
my $filecontents=(<<SIMPLECONTENT); |
|
<definetag name=""> |
|
<render> |
|
<web></web> |
|
<tex></tex> |
|
</render> |
|
</definetag> |
|
SIMPLECONTENT |
|
return $filecontents; |
|
} |
|
|
|
|
sub inserteditinfo { |
sub inserteditinfo { |
my ($result,$filecontents)=@_; |
my ($result,$filecontents,$filetype)=@_; |
$filecontents = &HTML::Entities::encode($filecontents); |
$filecontents = &HTML::Entities::encode($filecontents); |
# my $editheader='<a href="#editsection">Edit below</a><hr />'; |
# my $editheader='<a href="#editsection">Edit below</a><hr />'; |
my $xml_help = Apache::loncommon::helpLatexCheatsheet(); |
my $xml_help = ''; |
|
if ($filetype eq 'html') { |
|
$xml_help=Apache::loncommon::helpLatexCheatsheet(); |
|
} |
|
my $cleanbut = ''; |
|
if ($filetype eq 'html') { |
|
$cleanbut='<input type="submit" name="attemptclean" |
|
value="Save and then attempt to clean HTML" />'; |
|
} |
my $titledisplay=&display_title(); |
my $titledisplay=&display_title(); |
my $buttons=(<<BUTTONS); |
my $buttons=(<<BUTTONS); |
<input type="submit" name="attemptclean" |
$cleanbut |
value="Save and then attempt to clean HTML" /> |
|
<input type="submit" name="savethisfile" value="Save this" /> |
<input type="submit" name="savethisfile" value="Save this" /> |
<input type="submit" name="viewmode" value="View" /> |
<input type="submit" name="viewmode" value="View" /> |
BUTTONS |
BUTTONS |
Line 1240 sub handler {
|
Line 1265 sub handler {
|
|
|
|
|
my $file=&Apache::lonnet::filelocation("",$request->uri); |
my $file=&Apache::lonnet::filelocation("",$request->uri); |
|
my $filetype; |
|
if ($file =~ /\.sty$/) { |
|
$filetype='sty'; |
|
} else { |
|
$filetype='html'; |
|
} |
# |
# |
# Edit action? Save file. |
# Edit action? Save file. |
# |
# |
Line 1266 sub handler {
|
Line 1297 sub handler {
|
ENDNOTFOUND |
ENDNOTFOUND |
$filecontents=''; |
$filecontents=''; |
if ($ENV{'request.state'} ne 'published') { |
if ($ENV{'request.state'} ne 'published') { |
$filecontents=&createnewhtml(); |
if ($filetype eq 'sty') { |
|
$filecontents=&createnewsty(); |
|
} else { |
|
$filecontents=&createnewhtml(); |
|
} |
$ENV{'form.editmode'}='Edit'; #force edit mode |
$ENV{'form.editmode'}='Edit'; #force edit mode |
} |
} |
} else { |
} else { |
Line 1294 ENDNOTFOUND
|
Line 1329 ENDNOTFOUND
|
$displayfile=~s/^\/[^\/]*//; |
$displayfile=~s/^\/[^\/]*//; |
$result='<html><body bgcolor="#FFFFFF"><h3>'.$displayfile. |
$result='<html><body bgcolor="#FFFFFF"><h3>'.$displayfile. |
'</h3></body></html>'; |
'</h3></body></html>'; |
$result=&inserteditinfo($result,$filecontents); |
$result=&inserteditinfo($result,$filecontents,$filetype); |
} |
} |
} |
} |
|
if ($filetype eq 'html') { writeallows($request->uri); } |
writeallows($request->uri); |
|
|
|
|
|
$request->print($result); |
$request->print($result); |