--- loncom/xml/lonxml.pm 2003/08/13 18:57:28 1.272
+++ loncom/xml/lonxml.pm 2003/09/11 22:37:54 1.275
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.272 2003/08/13 18:57:28 albertel Exp $
+# $Id: lonxml.pm,v 1.275 2003/09/11 22:37:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -184,6 +184,7 @@ sub xmlend {
}
$crs=~s/\_/\//g;
my $seeid=&Apache::lonnet::allowed('rin',$crs);
+ my $viewgrades=&Apache::lonnet::allowed('vgr',$crs);
unless ($symb) {
$symb=&Apache::lonnet::symbread();
}
@@ -250,7 +251,11 @@ sub xmlend {
$sender=''.$screenname.'';
}
}
- $discussion.='
'.$sender.' ('.
+ my $vgrlink;
+ if ($viewgrades) {
+ $vgrlink=&Apache::loncommon::submlink('Submissions',$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);
+ }
+ $discussion.='
'.$sender.' '.$vgrlink.' ('.
localtime($contrib{$idx.':timestamp'}).
'):
'.$message.
'
';
@@ -482,6 +487,7 @@ sub latex_special_symbols {
if ($where eq 'header') {
$string =~ s/(\\|_|\^)/ /g;
$string =~ s/(\$|%|\#|&|\{|\})/\\$1/g;
+ $string =~ s/_/ /g;
} else {
$string=~s/\\ /\\char92 /g;
$string=~s/\^/\\char94 /g;
@@ -1163,16 +1169,35 @@ SIMPLECONTENT
return $filecontents;
}
+sub createnewsty {
+ my $filecontents=(<
+
+
+
+
+
+SIMPLECONTENT
+ return $filecontents;
+}
+
sub inserteditinfo {
- my ($result,$filecontents)=@_;
+ my ($result,$filecontents,$filetype)=@_;
$filecontents = &HTML::Entities::encode($filecontents);
# my $editheader='Edit below
';
- 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='';
+ }
my $titledisplay=&display_title();
my $buttons=(<
+$cleanbut
BUTTONS
@@ -1240,6 +1265,12 @@ sub handler {
my $file=&Apache::lonnet::filelocation("",$request->uri);
+ my $filetype;
+ if ($file =~ /\.sty$/) {
+ $filetype='sty';
+ } else {
+ $filetype='html';
+ }
#
# Edit action? Save file.
#
@@ -1266,7 +1297,11 @@ sub handler {
ENDNOTFOUND
$filecontents='';
if ($ENV{'request.state'} ne 'published') {
- $filecontents=&createnewhtml();
+ if ($filetype eq 'sty') {
+ $filecontents=&createnewsty();
+ } else {
+ $filecontents=&createnewhtml();
+ }
$ENV{'form.editmode'}='Edit'; #force edit mode
}
} else {
@@ -1294,11 +1329,11 @@ ENDNOTFOUND
$displayfile=~s/^\/[^\/]*//;
$result=''.$displayfile.
'
';
- $result=&inserteditinfo($result,$filecontents);
+ $result=&inserteditinfo($result,$filecontents,$filetype);
}
}
-
- writeallows($request->uri);
+ if ($filetype eq 'html') { writeallows($request->uri); }
+
$request->print($result);