[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm /homework structuretags.pm /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 03 Apr 2003 21:58:09 -0000


albertel		Thu Apr  3 16:58:09 2003 EDT

  Modified files:              
    /loncom/auth	lonacc.pm 
    /loncom/homework	structuretags.pm 
    /loncom/xml	lonxml.pm 
  Log:
  - public users can now submit answers to problems that are published public
  - lonxml includes line numbers when complaing about missing tags
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.41 loncom/auth/lonacc.pm:1.42
--- loncom/auth/lonacc.pm:1.41	Thu Apr  3 11:50:46 2003
+++ loncom/auth/lonacc.pm	Thu Apr  3 16:58:09 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.41 2003/04/03 16:50:46 www Exp $
+# $Id: lonacc.pm,v 1.42 2003/04/03 21:58:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -218,6 +218,9 @@
     if ($requrl=~m|^/public/|
 	|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) {
         &Apache::lonnet::logthis('Granting public access: '.$requrl);
+	my $buffer;
+	$r->read($buffer,$r->header_in('Content-length'));
+	&Apache::loncommon::get_unprocessed_cgi($buffer);
 	$ENV{'user.name'}='public';
         $ENV{'user.domain'}='public';
         $ENV{'request.state'} = "published";
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.163 loncom/homework/structuretags.pm:1.164
--- loncom/homework/structuretags.pm:1.163	Thu Apr  3 16:08:33 2003
+++ loncom/homework/structuretags.pm	Thu Apr  3 16:58:09 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.163 2003/04/03 21:08:33 albertel Exp $
+# $Id: structuretags.pm,v 1.164 2003/04/03 21:58:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -279,7 +279,7 @@
 	$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
 	&Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:");
     }
-    if ($Apache::lonhomework::type eq '') {
+    if ($Apache::lonhomework::type eq '' ) {
 	my $uri=$ENV{'request.uri'};
 	if ($uri=~/\.(\w+)$/) {
 	    $Apache::lonhomework::type=$1;
@@ -323,7 +323,9 @@
 	    $form_tag_start.='<input type="hidden" name="rndseed" value="'.
 		$rndseed.'" />'.
 		    '<input type="submit" name="resetdata"
-                             value="New Problem Variation" />';
+                             value="New Problem Variation" />'.
+		    '<input type="hidden" name="username"
+                             value="'.$ENV{'form.username'}.'" />';
 	}
 	($status,$accessmsg) = &Apache::lonhomework::check_access('0');
 	push (@Apache::inputtags::status,$status);
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.243 loncom/xml/lonxml.pm:1.244
--- loncom/xml/lonxml.pm:1.243	Sun Mar 30 16:58:17 2003
+++ loncom/xml/lonxml.pm	Thu Apr  3 16:58:09 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.243 2003/03/30 21:58:17 www Exp $
+# $Id: lonxml.pm,v 1.244 2003/04/03 21:58:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -401,6 +401,7 @@
  &Apache::inputtags::initialize_inputtags();
  &Apache::outputtags::initialize_outputtags();
  &Apache::edit::initialize_edit();
+
 #
 # do we have a course style file?
 #
@@ -526,10 +527,10 @@
 	while ($token->[1] ne $$stack['-1'] && ($#$stack > -1)) {
 	  my $lasttag=$$stack[-1];
 	  if ($token->[1] =~ /^$lasttag$/i) {
-	    &Apache::lonxml::warning('Using tag &lt;/'.$token->[1].'&gt; as end tag to &lt;'.$$stack[-1].'&gt;');
+	    &Apache::lonxml::warning('Using tag &lt;/'.$token->[1].'&gt; on line '.$token->[3].' as end tag to &lt;'.$$stack[-1].'&gt;');
 	    last;
 	  } else {
-	    &Apache::lonxml::warning('Found tag &lt;/'.$token->[1].'&gt; when looking for &lt;/'.$$stack[-1].'&gt; in file');
+	    &Apache::lonxml::warning('Found tag &lt;/'.$token->[1].'&gt; on line '.$token->[3].' when looking for &lt;/'.$$stack[-1].'&gt; in file');
 	    &end_tag($stack,$parstack,$token);
 	  }
 	}
@@ -1401,10 +1402,16 @@
       $name=$ENV{'form.grade_username'};
     }
   } else {
-    $symb=&Apache::lonnet::symbread();
-    $courseid=$ENV{'request.course.id'};
-    $domain=$ENV{'user.domain'};
-    $name=$ENV{'user.name'};
+      $symb=&Apache::lonnet::symbread();
+      $courseid=$ENV{'request.course.id'};
+      $domain=$ENV{'user.domain'};
+      $name=$ENV{'user.name'};
+      if ($name eq 'public' && $domain eq 'public') {
+	  if (!defined($ENV{'form.username'})) {
+	      $ENV{'form.username'}.=time.rand(10000000);
+	  }
+	  $name.=$ENV{'form.username'};
+      }
   }
   return ($symb,$courseid,$domain,$name);
 }