Diff for /loncom/xml/lonxml.pm between versions 1.273 and 1.275

version 1.273, 2003/08/21 15:51:41 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 1164  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 1241  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 1267  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 1295  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);

Removed from v.1.273  
changed lines
  Added in v.1.275


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>