[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 04 Sep 2002 14:50:53 -0000


This is a MIME encoded message

--www1031151053
Content-Type: text/plain

www		Wed Sep  4 10:50:53 2002 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  External resources not implemented yet, rest needs testing.
  
  
--www1031151053
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20020904105053.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.16 loncom/interface/londocs.pm:1.17
--- loncom/interface/londocs.pm:1.16	Wed Sep  4 09:06:20 2002
+++ loncom/interface/londocs.pm	Wed Sep  4 10:50:53 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.16 2002/09/04 13:06:20 www Exp $
+# $Id: londocs.pm,v 1.17 2002/09/04 14:50:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,10 +60,17 @@
 
 sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
+    if ($ENV{'form.foldername'}) {
+	$r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
+    }
     my $errtext='';
     my $fatal=0;
     ($errtext,$fatal)=
           &mapread($coursenum,$coursedom,$folder.'.sequence');
+    if ($#Apache::lonratedt::order<1) {
+       	$Apache::lonratedt::order[0]=1;
+        $Apache::lonratedt::resources[1]='';
+    }
     if ($fatal) {
 	   $r->print('<p><font color="red">'.$errtext.'</font></p>');
     } else {
@@ -84,6 +91,10 @@
               $comment=~s/\</\&lt\;/g;
               $comment=~s/\>/\&gt\;/g;
               $comment=~s/\:/\&colon;/g;
+              if ($folder=~/^supplemental/) {
+		  $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
+		      $ENV{'user.domain'}.'___&&&___'.$comment;
+              }
               my $newidx=$#Apache::lonratedt::resources+1;
               $Apache::lonratedt::resources[$newidx]=
                   $comment.':'.$url.':'.$ext.':normal:res';
@@ -176,26 +187,32 @@
     if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {
 	$icon=$extension;
     }
+    my $isfolder=0;
     if ($uploaded) {
        if ($extension eq 'sequence') {
 	  $icon='folder_closed';
           $url=~/\/(\w+)\.sequence/;
           $url='/adm/coursedocs?folder='.$1;
+          $isfolder=1;
        } else {
 	  $url=&Apache::lonnet::tokenwrapper($url);
        } 
     }
-    $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="/adm/lonIcons/'.
-        $icon.'.gif" border="0"></a></td>';
 # Title
     $title=&Apache::lonnet::unescape($title);
+    my $foldertitle=$title;
     if ($title=~
  /^(\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>";
-    $line.='</tr>';
+    if ($isfolder) { $url.='&foldername='.$foldertitle; }
+    $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;
 }
 
@@ -215,7 +232,7 @@
     my $allowed;
     my $events='';
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-       ['folder','showdoc']);
+       ['folder','foldername','showdoc']);
     unless ($ENV{'form.showdoc'}) { # got called from remote
        $forcestandard=($ENV{'form.folder'}=~/^default_/);
        $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
@@ -272,7 +289,7 @@
 </head>
 ENDDOCUMENT
 $r->print(&Apache::loncommon::bodytag('Course Documents','',$events));
-# --------------------------------------------------0------ Standard documents
+# --------------------------------------------------------- Standard documents
     if (($standard) && ($allowed) && (!$forcesupplement)) {
        $r->print('<h2>Main Course Documents</h2>');
        my $folder=$ENV{'form.folder'};
@@ -294,6 +311,7 @@
 Title:<br /> 
 <input type="text" size="50" name="comment">
 <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="submit" value="Upload Document">
 </form>
@@ -310,6 +328,7 @@
 </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');"
@@ -317,23 +336,26 @@
 </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="newsyl">
+<form action="/adm/coursedocs" method="post" name="newnav">
 <input type=hidden name="importdetail" 
 value="Navigate Content=/adm/navmaps">
 <input name="newsyl" type="submit" value="Navigate Content" />
 </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" />
@@ -350,17 +372,69 @@
        unless ($folder=~/supplemental/) { $folder='supplemental'; }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($allowed) {
+       my $folderseq=
+                  '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
+                     '.sequence';
+
           $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">
 <input type="file" name="uploaddoc" size="50">
 <br />Comment:<br />
 <textarea cols=50 rows=4 name='comment'>
 </textarea>
 <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="submit" value="Upload Document">
 </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
        }
     }

--www1031151053--