[LON-CAPA-cvs] cvs: rat / lonratsrv.pm loncom/interface loncreatecourse.pm londocs.pm loncom/lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 05 Sep 2002 19:37:00 -0000


www		Thu Sep  5 15:37:00 2002 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm londocs.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonratsrv.pm 
  Log:
  Bug 705 and various small fixes to londocs.pm
  
  
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.12 loncom/interface/loncreatecourse.pm:1.13
--- loncom/interface/loncreatecourse.pm:1.12	Fri Aug 30 20:43:12 2002
+++ loncom/interface/loncreatecourse.pm	Thu Sep  5 15:37:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.12 2002/08/31 00:43:12 www Exp $
+# $Id: loncreatecourse.pm,v 1.13 2002/09/05 19:37:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,6 +45,9 @@
 use Apache::Constants qw(:common :http);
 use Apache::lonnet;
 use Apache::loncommon;
+use Apache::lonratedt;
+use Apache::londocs;
+
 # ===================================================== Phase one: fill-in form
 
 sub print_course_creation_page {
@@ -91,6 +94,13 @@
 <b>Course Title:</b>
 <input type="text" size="50" name="title">
 </p><p>
+<b>Course Home Server:</b>$course_home
+</p><p>
+<b>Course ID/Number (optional)</b>
+<input type="text" size="30" name="crsid">
+</p>
+<h2>Course Content</h2>
+<p>
 <b>Map:</b>
 <input type="text" size="50" name="topmap">
 <a href="javascript:openbrowser('ccrs','topmap')">Browse</a>
@@ -98,15 +108,23 @@
 <b>Do NOT generate as standard course</b> 
 (only check if you know what you are doing):
 <input type="checkbox" name="nonstandard">
-</p><p>
-<b>Course Home Server:</b>$course_home
-</p><p>
-<b>Course ID/Number (optional)</b>
-<input type="text" size="30" name="crsid">
-</p><p>
+</p>
+<p>
+<b>First Resource</b> (standard courses only):
+<input type="radio" name="firstres" value="blank" checked>Blank
+&nbsp;
+<input type="radio" name="firstres" value="syl">Syllabus
+&nbsp;
+<input type="radio" name="firstres" value="nav">Navigate
+</p>
+
+<h2>Assessment Parameters</h2>
+<p>
 <b>Open all assessments: </b>
 <input type="checkbox" name="openall" checked>
-</p><p>
+</p>
+<h2>Messaging</h2>
+<p>
 <b>Set course policy feedback to Course Coordinator: </b>
 <input type="checkbox" name="setpolicy" checked>
 </p><p>
@@ -216,7 +234,27 @@
        $r->print('Opening all assignments: '.&Apache::lonnet::cput
                  ('resourcedata',\%storecontent,$crsudom,$crsunum).'<br>');
    }
-
+#
+# Set first page
+#
+    unless (($ENV{'form.nonstandard'}) || ($ENV{'form.firstres'} eq 'blank')) {
+	$r->print('Setting first resource: ');
+        my ($errtext,$fatal)=
+           &Apache::londocs::mapread($crsunum,$crsudom,'default.sequence');
+        $r->print(($fatal?$errtext:'read ok').' - ');
+        my $title; my $url;
+        if ($ENV{'form.firstres'} eq 'syl') {
+	    $title='Syllabus';
+            $url='/public/'.$crsudom.'/'.$crsunum.'/syllabus';
+        } else {
+            $title='Navigate Contents';
+            $url='/adm/navmaps';
+        }
+        $Apache::lonratedt::resources[1]=$title.':'.$url.':false:start:res';
+        my ($errtext,$fatal)=
+           &Apache::londocs::storemap($crsunum,$crsudom,'default.sequence');
+        $r->print(($fatal?$errtext:'write ok').'<br>');
+  }
 #
 # Make current user course adminstrator
 #
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.19 loncom/interface/londocs.pm:1.20
--- loncom/interface/londocs.pm:1.19	Wed Sep  4 16:33:38 2002
+++ loncom/interface/londocs.pm	Thu Sep  5 15:37:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.19 2002/09/04 20:33:38 www Exp $
+# $Id: londocs.pm,v 1.20 2002/09/05 19:37:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -275,11 +275,11 @@
 <title>The LearningOnline Network with CAPA</title>
 <script>
 $script
-</head>
+</script>
 ENDDOCUMENT
    if ($allowed) {
     $r->print(<<ENDNEWSCRIPT);
-
+<script>
 function makenewfolder(targetform,folderseq) {
     var foldername=prompt('Name of New Folder','New Folder');
     if (foldername) {
@@ -305,7 +305,8 @@
 ENDNEWSCRIPT
   }
 # -------------------------------------------------------------------- Body tag
-  $r->print(&Apache::loncommon::bodytag('Course Documents','',$events));
+  $r->print('</head>'.
+            &Apache::loncommon::bodytag('Course Documents','',$events));
   unless ($showdoc) {
 # --------------------------------------------------------- Standard documents
     if (($standard) && ($allowed) && (!$forcesupplement)) {
@@ -367,9 +368,11 @@
 <input name="newsyl" type="submit" value="Syllabus" />
 </form>
 <form action="/adm/coursedocs" method="post" name="newnav">
+<input type="hidden" name="folder" value="$folder">
+<input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" 
 value="Navigate Content=/adm/navmaps">
-<input name="newsyl" type="submit" value="Navigate Content" />
+<input name="newnav" type="submit" value="Navigate Content" />
 </form>
 <form action="/adm/coursedocs" method="post" name="newaboutme">
 <input type="hidden" name="folder" value="$folder">
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.277 loncom/lonnet/perl/lonnet.pm:1.278
--- loncom/lonnet/perl/lonnet.pm:1.277	Fri Aug 30 16:32:21 2002
+++ loncom/lonnet/perl/lonnet.pm	Thu Sep  5 15:37:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.277 2002/08/30 20:32:21 albertel Exp $
+# $Id: lonnet.pm,v 1.278 2002/09/05 19:37:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2341,6 +2341,7 @@
     unless ($nonstandard) {
 # ------------------------------------------ For standard courses, make top url
         my $mapurl=&clutter($url);
+        if ($mapurl eq '/res/') { $mapurl=''; }
         $ENV{'form.initmap'}=(<<ENDINITMAP);
 <map>
 <resource id="1" type="start"></resource>
Index: rat/lonratsrv.pm
diff -u rat/lonratsrv.pm:1.22 rat/lonratsrv.pm:1.23
--- rat/lonratsrv.pm:1.22	Fri Aug 30 20:42:30 2002
+++ rat/lonratsrv.pm	Thu Sep  5 15:37:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Server for RAT Maps
 #
-# $Id: lonratsrv.pm,v 1.22 2002/08/31 00:42:30 www Exp $
+# $Id: lonratsrv.pm,v 1.23 2002/09/05 19:37:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -218,7 +218,7 @@
         } else {
             $outstr="<map>\n";
         }
-        map {
+        foreach (@tags) {
 	   my @parts=split(/<:>/,$_);
            if ($parts[0] eq 'objcont') {
                my @comp=split(/:/,$parts[$#parts]);
@@ -289,14 +289,13 @@
                $outstr.=' value="'.qtescape($parts[$#parts]).'"></'.
                         $parts[0].">\n";
            }
-        } @tags;
+        }
         $outstr.="</map>\n";
-	if ($fn=~/^\/*uploaded\//) {
+	if ($fn=~/^\/*uploaded\/(\w+)\/(\w+)\//) {
 	    $ENV{'form.output'}=$outstr;
+            my $home=&Apache::lonnet::homeserver($2,$1);
             &Apache::lonnet::finishuserfileupload(
-              $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
-              $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
-              $ENV{'course.'.$ENV{'request.course.id'}.'.home'},
+              $2,$1,$home,
               'output',(split(/\//,$fn))[-1]);
         } else {
           my $fh;