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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 24 Aug 2004 04:55:50 -0000


albertel		Tue Aug 24 00:55:50 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  - adding in some starts at file management
  - make downloading possible
  - fill in some fields
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.21 loncom/interface/portfolio.pm:1.22
--- loncom/interface/portfolio.pm:1.21	Mon Aug 23 17:16:43 2004
+++ loncom/interface/portfolio.pm	Tue Aug 24 00:55:49 2004
@@ -258,7 +258,14 @@
         '<input type="submit" name="storeupl" value="Upload" />'.
         '</form>';
     $r->print($displayOut);
-	$r->print('</td></tr></table>');	  
+    $r->print('</td></tr><tr><td bgcolor="#ccddaa" align="center">');
+    my $displayOut = '<form method="post">';
+    $displayOut = $displayOut.'<input name="newdir" type="input" />'.
+        '<input type="hidden" name="currentpath" value="'.$currentPath.'" />'.
+        '<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.
+        '</form>';
+    $r->print($displayOut);
+    $r->print('</td></tr></table>');
     my @tree = split (/\//,$currentPath);
     $r->print('<font size="+2">'.makeAnchor('/','/'));
     if (@tree > 1){
@@ -270,15 +277,17 @@
     }
     $r->print('</font>');
     &Apache::lonhtmlcommon::store_recent('portfolio',$currentPath,$currentPath);
-	$r->print('<br /><form method=post action="/adm/portfolio">'.&Apache::lonhtmlcommon::select_recent('portfolio','currentpath',
-'this.form.submit();'));
+    $r->print('<br /><form method=post action="/adm/portfolio">'.
+	      &Apache::lonhtmlcommon::select_recent('portfolio','currentpath',
+						    'this.form.submit();'));
     $r->print("</form>");
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
-            '<tr><th>&nbsp;</th><th>Actions</th><th>Name</th><th>Title</th><th>Status</th><th>Last Modified</th></tr>');
+            '<tr><th>Actions</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
+    my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$currentPath/";
     foreach my $line (@dirList) {
     	#$strip holds directory/file name
     	#$dom 
-    	my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
+    	my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
     	if (($fileName ne '.') && ($fileName ne '..')){
             if ($dirptr&$testdir){
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
@@ -286,12 +295,20 @@
                 $r->print('<td>'.makeAnchor($fileName.'/',$currentPath.$fileName.'/').'</td>'); 
                 $r->print('</tr>'); 
             }else{
-                $r->print('<tr bgcolor="#CCCCFF"><td><img src="'.$iconpath.'unknown.gif"></td>');
-                $r->print('<td>Edit</td>');
-                $r->print('<td>'.$fileName.'</td>'); 
-                $r->print('<td>Title Here</td>');
-                $r->print('<td>Status Here</td>');
-                $r->print('<td>Modified Here</td>');
+                $r->print('<tr bgcolor="#CCCCFF">');
+                $r->print('<td>
+<select name="action">
+  <option value=""></option>
+  <option value="delete">'.&mt("Delete").'</option>
+  <option value="rename">'.&mt("Rename").'</option>
+</select>
+<input type="submit" name="doit" value="Go" />
+</td>');
+                $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
+                $r->print('<td><a href="'.$href_location.$fileName.'">'.
+			  $fileName.'</a></td>'); 
+                $r->print('<td>'.$size.'</td>');
+                $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
                 $r->print('</tr>'); 
             }
         }
@@ -301,7 +318,7 @@
 #   $r->print(displayDirectory($currentPath, $currentFile, @dirList));
 #    $r->print('</td>><td>');
 #   $r->print(displayActions($currentPath, $currentFile, $isEmpty));
-    $r->print('</table>');
+    $r->print('</table></form>');
     $r->print('</blockquote>');
     $r->print("</body>\n</html>\n");
     $r->rflush();