--- loncom/xml/lonxml.pm 2003/08/21 15:51:41 1.273
+++ 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.273 2003/08/21 15:51:41 sakharuk 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.
'
';
@@ -1164,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
@@ -1241,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.
#
@@ -1267,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 {
@@ -1295,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);