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

www lon-capa-cvs@mail.lon-capa.org
Mon, 08 Sep 2003 21:19:44 -0000


www		Mon Sep  8 17:19:44 2003 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Saving my work on "dump course to construction space"
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.75 loncom/interface/londocs.pm:1.76
--- loncom/interface/londocs.pm:1.75	Mon Sep  8 15:21:10 2003
+++ loncom/interface/londocs.pm	Mon Sep  8 17:19:44 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.75 2003/09/08 19:21:10 www Exp $
+# $Id: londocs.pm,v 1.76 2003/09/08 21:19:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -126,14 +126,54 @@
 sub dumpcourse {
     my $r=shift;
     $r->print('<html><head><title>Dump DOCS</title></head>'.
-        &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space'));
+        &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space').
+	      '<form name="dumpdoc" method="post">');
     my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }
-    if ($ENV{'form.authorspace'}) {
+    my $origcrsid=$ENV{'request.course.id'};
+    my %origcrsdata=&Apache::lonnet::coursedescription($origcrsid);
+    if (($ENV{'form.authorspace'}) && ($ENV{'form.authorfolder'}=~/\w/)) {
+# Do the dumping
 	unless ($outhash{'home_'.$ENV{'form.authorspace'}}) { return ''; }
 	my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});
+	my $title=$ENV{'form.authorfolder'};
+
+    } else {
+# Input form
+	unless ($home==1) {
+	    $r->print(
+		      '<h3>Select the Construction Space</h3><select name="authorspace">');
+	}
+	foreach (sort keys %outhash) {
+	    if ($_=~/^home_(.+)$/) {
+		if ($home==1) {
+		    $r->print(
+		  '<input type="hidden" name="authorspace" value="'.$1.'" />');
+		} else {
+		    $r->print('<option value="'.$1.'">'.$_.'</option>');
+		}
+	    }
+	}
+	unless ($home==1) {
+	    $r->print('</select>');
+	}
+	my $title=$origcrsdata{'description'};
+	$title=~s/\s+/\_/gs;
+	$title=~s/\W//gs;
+	$r->print('<h3>Folder in Construction Space</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');
+	&tiehash();
+	foreach (&Apache::loncreatecourse::crsdirlist($origcrsid,'userfiles')) {
+	    $r->print("\n<br />".$_.' '.
+  $hash{'title_'.$hash{
+'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}
+		      );
+	}
+	&untiehash();
+	$r->print(
+  '<input type="submit" name="dumpcourse" value="Dump Course DOCS" /></form>');
     }
 }
+
 
 # Imports the given (name, url) resources into the course
 # coursenum, coursedom, and folder must precede the list