Diff for /loncom/interface/londocs.pm between versions 1.16 and 1.17

version 1.16, 2002/09/04 13:06:20 version 1.17, 2002/09/04 14:50:53
Line 60  sub storemap { Line 60  sub storemap {
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;      my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
       if ($ENV{'form.foldername'}) {
    $r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
       }
     my $errtext='';      my $errtext='';
     my $fatal=0;      my $fatal=0;
     ($errtext,$fatal)=      ($errtext,$fatal)=
           &mapread($coursenum,$coursedom,$folder.'.sequence');            &mapread($coursenum,$coursedom,$folder.'.sequence');
       if ($#Apache::lonratedt::order<1) {
           $Apache::lonratedt::order[0]=1;
           $Apache::lonratedt::resources[1]='';
       }
     if ($fatal) {      if ($fatal) {
    $r->print('<p><font color="red">'.$errtext.'</font></p>');     $r->print('<p><font color="red">'.$errtext.'</font></p>');
     } else {      } else {
Line 84  sub editor { Line 91  sub editor {
               $comment=~s/\</\&lt\;/g;                $comment=~s/\</\&lt\;/g;
               $comment=~s/\>/\&gt\;/g;                $comment=~s/\>/\&gt\;/g;
               $comment=~s/\:/\&colon;/g;                $comment=~s/\:/\&colon;/g;
                 if ($folder=~/^supplemental/) {
     $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
         $ENV{'user.domain'}.'___&&&___'.$comment;
                 }
               my $newidx=$#Apache::lonratedt::resources+1;                my $newidx=$#Apache::lonratedt::resources+1;
               $Apache::lonratedt::resources[$newidx]=                $Apache::lonratedt::resources[$newidx]=
                   $comment.':'.$url.':'.$ext.':normal:res';                    $comment.':'.$url.':'.$ext.':normal:res';
Line 176  END Line 187  END
     if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {      if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {
  $icon=$extension;   $icon=$extension;
     }      }
       my $isfolder=0;
     if ($uploaded) {      if ($uploaded) {
        if ($extension eq 'sequence') {         if ($extension eq 'sequence') {
   $icon='folder_closed';    $icon='folder_closed';
           $url=~/\/(\w+)\.sequence/;            $url=~/\/(\w+)\.sequence/;
           $url='/adm/coursedocs?folder='.$1;            $url='/adm/coursedocs?folder='.$1;
             $isfolder=1;
        } else {         } else {
   $url=&Apache::lonnet::tokenwrapper($url);    $url=&Apache::lonnet::tokenwrapper($url);
        }          } 
     }      }
     $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="/adm/lonIcons/'.  
         $icon.'.gif" border="0"></a></td>';  
 # Title  # Title
     $title=&Apache::lonnet::unescape($title);      $title=&Apache::lonnet::unescape($title);
       my $foldertitle=$title;
     if ($title=~      if ($title=~
  /^(\d+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(.*)$/   /^(\d+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(.*)$/
  ) { $title='<i>'.localtime($1).'</i> '.$2.' at '.$3.': <br>'.   ) { 
  &Apache::lontexconvert::msgtexconverted($4);              $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
               $title='<i>'.localtime($1).'</i> '.
                   &Apache::loncommon::plainname($2,$3).': <br>'.
    $foldertitle;
  }   }
     $line.="<td bgcolor='#FFFFBB'><a href='$url'>$title</a></td>";      if ($isfolder) { $url.='&foldername='.$foldertitle; }
     $line.='</tr>';      $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="/adm/lonIcons/'.
           $icon.'.gif" border="0"></a></td>'.
           "<td bgcolor='#FFFFBB'><a href='$url'>$title</a></td></tr>";
     return $line;      return $line;
 }  }
   
Line 215  sub handler { Line 232  sub handler {
     my $allowed;      my $allowed;
     my $events='';      my $events='';
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
        ['folder','showdoc']);         ['folder','foldername','showdoc']);
     unless ($ENV{'form.showdoc'}) { # got called from remote      unless ($ENV{'form.showdoc'}) { # got called from remote
        $forcestandard=($ENV{'form.folder'}=~/^default_/);         $forcestandard=($ENV{'form.folder'}=~/^default_/);
        $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);         $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
Line 272  function makenewext(targetform) { Line 289  function makenewext(targetform) {
 </head>  </head>
 ENDDOCUMENT  ENDDOCUMENT
 $r->print(&Apache::loncommon::bodytag('Course Documents','',$events));  $r->print(&Apache::loncommon::bodytag('Course Documents','',$events));
 # --------------------------------------------------0------ Standard documents  # --------------------------------------------------------- Standard documents
     if (($standard) && ($allowed) && (!$forcesupplement)) {      if (($standard) && ($allowed) && (!$forcesupplement)) {
        $r->print('<h2>Main Course Documents</h2>');         $r->print('<h2>Main Course Documents</h2>');
        my $folder=$ENV{'form.folder'};         my $folder=$ENV{'form.folder'};
Line 294  File:<br /> Line 311  File:<br />
 Title:<br />   Title:<br /> 
 <input type="text" size="50" name="comment">  <input type="text" size="50" name="comment">
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type="hidden" name="cmd" value="upload_default">  <input type="hidden" name="cmd" value="upload_default">
 <input type="submit" value="Upload Document">  <input type="submit" value="Upload Document">
 </form>  </form>
Line 310  Title:<br /> Line 328  Title:<br />
 </td><td bgcolor="#DDDDDD">  </td><td bgcolor="#DDDDDD">
 <form action="/adm/coursedocs" method="post" name="newfolder">  <form action="/adm/coursedocs" method="post" name="newfolder">
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" value="">  <input type=hidden name="importdetail" value="">
 <input name="newfolder" type="button"  <input name="newfolder" type="button"
 onClick="javascript:makenewfolder(this.form,'$folderseq');"  onClick="javascript:makenewfolder(this.form,'$folderseq');"
Line 317  value="New Folder" /> Line 336  value="New Folder" />
 </form>  </form>
 <form action="/adm/coursedocs" method="post" name="newext">  <form action="/adm/coursedocs" method="post" name="newext">
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" value="">  <input type=hidden name="importdetail" value="">
 <input name="newext" type="button" onClick="javascript:makenewext(this.form);"  <input name="newext" type="button" onClick="javascript:makenewext(this.form);"
 value="External Resource" />  value="External Resource" />
 </form>  </form>
 <form action="/adm/coursedocs" method="post" name="newsyl">  <form action="/adm/coursedocs" method="post" name="newsyl">
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail"   <input type=hidden name="importdetail" 
 value="Syllabus=/public/$coursedom/$coursenum/syllabus">  value="Syllabus=/public/$coursedom/$coursenum/syllabus">
 <input name="newsyl" type="submit" value="Syllabus" />  <input name="newsyl" type="submit" value="Syllabus" />
 </form>  </form>
 <form action="/adm/coursedocs" method="post" name="newsyl">  <form action="/adm/coursedocs" method="post" name="newnav">
 <input type=hidden name="importdetail"   <input type=hidden name="importdetail" 
 value="Navigate Content=/adm/navmaps">  value="Navigate Content=/adm/navmaps">
 <input name="newsyl" type="submit" value="Navigate Content" />  <input name="newsyl" type="submit" value="Navigate Content" />
 </form>  </form>
 <form action="/adm/coursedocs" method="post" name="newaboutme">  <form action="/adm/coursedocs" method="post" name="newaboutme">
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail"   <input type=hidden name="importdetail" 
 value="$plainname=/adm/$udom/$uname/aboutme">  value="$plainname=/adm/$udom/$uname/aboutme">
 <input name="newaboutme" type="submit" value="My Personal Info" />  <input name="newaboutme" type="submit" value="My Personal Info" />
Line 350  ENDFORM Line 372  ENDFORM
        unless ($folder=~/supplemental/) { $folder='supplemental'; }         unless ($folder=~/supplemental/) { $folder='supplemental'; }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);         &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($allowed) {         if ($allowed) {
          my $folderseq=
                     '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
                        '.sequence';
   
           $r->print(<<ENDSUPFORM);            $r->print(<<ENDSUPFORM);
 <h3>Post a new supplemental course document</h3>  <table cellspacing=2><tr>
   <th bgcolor="#DDDDDD">Upload a new supplemental course document</th>
   <th bgcolor="#DDDDDD">Import a published document</th>
   <th bgcolor="#DDDDDD">Special documents</th>
   </tr>
   <tr><td bgcolor="#DDDDDD">
 <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">  <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
 <input type="file" name="uploaddoc" size="50">  <input type="file" name="uploaddoc" size="50">
 <br />Comment:<br />  <br />Comment:<br />
 <textarea cols=50 rows=4 name='comment'>  <textarea cols=50 rows=4 name='comment'>
 </textarea>  </textarea>
 <input type="hidden" name="folder" value="$folder">  <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type="hidden" name="cmd" value="upload_supplemental">  <input type="hidden" name="cmd" value="upload_supplemental">
 <input type="submit" value="Upload Document">  <input type="submit" value="Upload Document">
 </form>  </form>
   </td>
   <td bgcolor="#DDDDDD">
   <form action="/adm/coursedocs" method="post" name="simpleedit">
   <input type="hidden" name="folder" value="$folder">
   <input type=hidden name="importdetail" value="">
   <input type=button onClick=
   "javascript:groupsearch()" value="Search">
   <input type=button onClick=
   "javascript:groupimport();" value="Import">
   </form>
   </td><td bgcolor="#DDDDDD">
   <form action="/adm/coursedocs" method="post" name="newfolder">
   <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
   <input type=hidden name="importdetail" value="">
   <input name="newfolder" type="button"
   onClick="javascript:makenewfolder(this.form,'$folderseq');"
   value="New Folder" />
   </form>
   <form action="/adm/coursedocs" method="post" name="newext">
   <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
   <input type=hidden name="importdetail" value="">
   <input name="newext" type="button" onClick="javascript:makenewext(this.form);"
   value="External Resource" />
   </form>
   <form action="/adm/coursedocs" method="post" name="newsyl">
   <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
   <input type=hidden name="importdetail" 
   value="Syllabus=/public/$coursedom/$coursenum/syllabus">
   <input name="newsyl" type="submit" value="Syllabus" />
   </form>
   <form action="/adm/coursedocs" method="post" name="newaboutme">
   <input type="hidden" name="folder" value="$folder">
   <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
   <input type=hidden name="importdetail" 
   value="$plainname=/adm/$udom/$uname/aboutme">
   <input name="newaboutme" type="submit" value="My Personal Info" />
   </form>
   </td></tr>
   </table>
 ENDSUPFORM  ENDSUPFORM
        }         }
     }      }

Removed from v.1.16  
changed lines
  Added in v.1.17


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