[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 07 Dec 2006 23:11:56 -0000


albertel		Thu Dec  7 18:11:56 2006 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - xhtml
  - when editing a .library in CSTR that nest other .librarys wasn't properly detecting whther it should be emitting page haeaders or not
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.370 loncom/homework/structuretags.pm:1.371
--- loncom/homework/structuretags.pm:1.370	Tue Nov 21 05:01:31 2006
+++ loncom/homework/structuretags.pm	Thu Dec  7 18:11:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.370 2006/11/21 10:01:31 foxr Exp $
+# $Id: structuretags.pm,v 1.371 2006/12/07 23:11:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -293,9 +293,9 @@
 	: &mt(' Show All Foils');
 
     if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; }
-    $result.= ' />'.$show_all_foils_text.
+    $result.= ' />'.$show_all_foils_text.'</label>'.
 	&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').
-	'</label><hr />';
+	'<hr />';
     if (!$Apache::lonhomework::parsing_a_task) {
 	$result.="
 <nobr>
@@ -963,7 +963,7 @@
 sub start_library {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my ($result,$form_tag_start);
-    if ($$tagstack[0] eq 'library') {
+    if ($#$tagstack eq 0 && $$tagstack[0] eq 'library') {
 	&init_problem_globals('library');
 	$Apache::lonhomework::type='problem';
     }
@@ -978,7 +978,7 @@
 	$result=$token->[4];
 	$result.=&Apache::edit::handle_insert();
     } elsif (($target eq 'web' || $target eq 'webgrade')
-	     && $$tagstack[0] eq 'library' 
+	     && ($#$tagstack eq 0 && $$tagstack[0] eq 'library')
 	     && $env{'request.state'} eq "construct" ) {
 	my $name=&get_resource_name($parstack,$safeeval);
 	($result,$form_tag_start)=
@@ -996,12 +996,16 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result='';
     if ($target eq 'edit') {
+	&Apache::lonnet::logthis("exit lib");
 	$result=&problem_edit_footer();
-    } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
-	     $env{'request.state'} eq "construct") {
+    } elsif ($target eq 'web' 
+	     && ($#$tagstack eq 0 && $$tagstack[0] eq 'library') 
+	     && $env{'request.state'} eq "construct") {
 	$result.='</form>'.&Apache::loncommon::end_page({'discussion' => 1});
     }
-    if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };
+    if ( $#$tagstack eq 0 && $$tagstack[0] eq 'library') {
+	&reset_problem_globals('library');
+    }
     return $result;
 }