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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 14 Apr 2006 21:42:13 -0000


albertel		Fri Apr 14 17:42:13 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm structuretags.pm 
  Log:
  - tasks -> start_page
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.140 loncom/homework/bridgetask.pm:1.141
--- loncom/homework/bridgetask.pm:1.140	Mon Apr 10 18:55:02 2006
+++ loncom/homework/bridgetask.pm	Fri Apr 14 17:42:05 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.140 2006/04/10 22:55:02 albertel Exp $
+# $Id: bridgetask.pm,v 1.141 2006/04/14 21:42:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -375,28 +375,29 @@
     } 
 
     $Apache::lonhomework::parsing_a_task=1;
-    #should get back a <html> or the neccesary stuff to start XML/MathML
-    my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
-	&Apache::structuretags::page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
-    
-    $head_tag_start .= &style($target);
-    $body_tag_start .= '<div class="LC_task">'."\n";
 
+    my $name;
     if ($target eq 'web' || $target eq 'webgrade') {
-	$head_tag_start.='<title>'.
-	    &Apache::structuretags::get_resource_name($parstack,$safeeval).
-	    '</title>';
+	$name = &Apache::structuretags::get_resource_name($parstack,$safeeval);
     }
 
+    #should get back a <html> or the neccesary stuff to start XML/MathML
+    my ($result,$form_tag_start)=
+	&Apache::structuretags::page_start($target,$token,$tagstack,$parstack,
+					   $parser,$safeeval,$name,&style());
+    
+    $result .= '<div class="LC_task">'."\n";
+
+
     if ($target eq 'web' && $env{'request.state'} ne 'construct') {
 	if ($Apache::lonhomework::modifygrades) {
-	    $body_tag_start.='<form name="gradesubmission" method="post" action="';
+	    $result.='<form name="gradesubmission" method="post" action="';
 	    my $uri=$env{'request.uri'};
 	    if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
-	    $body_tag_start.=$uri.'">'.&add_grading_button()."</form>";
+	    $result.=$uri.'">'.&add_grading_button()."</form>";
 	    my $symb=&Apache::lonnet::symbread();
 	    if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
-		$body_tag_start.='<form method="post" name="slotrequest" action="/adm/slotrequest">'.
+		$result.='<form method="post" name="slotrequest" action="/adm/slotrequest">'.
 		    '<input type="hidden" name="symb" value="'.$symb.'" />'.
 		    '<input type="hidden" name="command" value="showslots" />'.
 		    '<input type="submit" name="requestattempt" value="'.
@@ -405,7 +406,7 @@
 		my $target_id = 
 		    &Apache::lonstathelpers::make_target_id({symb => $symb,
 							     part => '0'});
-		$body_tag_start.='<form method="post" name="gradingstatus" action="/adm/statistics">'.
+		$result.='<form method="post" name="gradingstatus" action="/adm/statistics">'.
 		    '<input type="hidden" name="problemchoice" value="'.$target_id.'" />'.
 		    '<input type="hidden" name="reportSelected" value="grading_analysis" />'.
 		    '<input type="submit" name="grading" value="'.
@@ -428,11 +429,10 @@
 	$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.0.solved"}.'";';
 	&Apache::run::run($expression,$safeeval);
 	&Apache::lonxml::debug("Got $status");
-	$body_tag_start.=&add_previous_version_button($status);
+	$result.=&add_previous_version_button($status);
 	if (!&show_task($status,$previous)) {
 	    my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style);
 	    if ( $target eq "web" ) {
-		$result.= $head_tag_start.'</head>'.$body_tag_start;
 		if ($env{'request.state'} eq 'construct') {
 		    $result.=$form_tag_start;
 		}
@@ -497,9 +497,7 @@
 		}
 	    }
 	} elsif ($target eq 'web') {
-	    $result.="$head_tag_start</head>
-              $body_tag_start \n";
-	    
+
 	    $result.=&preserve_grade_info();
 	    $result.=&internal_location();
 	    $result.=$form_tag_start.
@@ -510,9 +508,7 @@
 	      $target eq 'webgrade') {
 	my $webgrade='yes';
 	if ($target eq 'webgrade') {
-	    $result.=$head_tag_start.
-		'</head>'.$body_tag_start.
-		"\n".'<div class="LC_GRADING_task">'."\n".
+	    $result.= "\n".'<div class="LC_GRADING_task">'."\n".
 		'<script type="text/javascript" 
                          src="/res/adm/includes/task_grading.js"></script>';
 	    #$result.='<br />Review'.&show_queue('reviewqueue');
@@ -596,7 +592,7 @@
 	    $result.="\n".'<div id="LC_GRADING_criterialist">';
 	}
     } elsif ($target eq 'edit') {
-	$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.
+	$result.=$form_tag_start.
 	    &Apache::structuretags::problem_edit_header();
 	$Apache::lonxml::warnings_error_header=
 	    &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."<br />";
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.344 loncom/homework/structuretags.pm:1.345
--- loncom/homework/structuretags.pm:1.344	Fri Apr 14 17:09:54 2006
+++ loncom/homework/structuretags.pm	Fri Apr 14 17:42:05 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.344 2006/04/14 21:09:54 albertel Exp $
+# $Id: structuretags.pm,v 1.345 2006/04/14 21:42:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,7 +70,8 @@
 }
 
 sub page_start {
-    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name)=@_;
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name,
+	$extra_head)=@_;
     my %found;
     foreach my $taginside (@$tagstack) {
 	foreach my $taglookedfor ('html','body','form') {
@@ -86,12 +87,11 @@
     }
 
     my %body_args;
-    my $extra_head;
     if (defined($found{'html'})) {
 	$body_args{'skip_phases'}{'head'}=1;
     } else {
 	
-	$extra_head = &Apache::lonhtmlcommon::spellheader();
+	$extra_head .= &Apache::lonhtmlcommon::spellheader();
 
 	my $css_href = &Apache::lonnet::EXT('resource.0.cssfile');
 	if ($css_href =~ /\S/) {