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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 23 Feb 2007 01:04:06 -0000


This is a MIME encoded message

--albertel1172192646
Content-Type: text/plain

albertel		Thu Feb 22 20:04:06 2007 EDT

  Modified files:              
    /loncom/homework	structuretags.pm bridgetask.pm insertlist.xml 
  Log:
  - text chunks for bridgetask edit like other tags now 
  - enable Edit Mode for tasks
  - mae some nice insert routines that insert good default chunks
  
  
--albertel1172192646
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070222200406.txt"

Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.372 loncom/homework/structuretags.pm:1.373
--- loncom/homework/structuretags.pm:1.372	Sun Dec 10 20:07:07 2006
+++ loncom/homework/structuretags.pm	Thu Feb 22 20:04:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.372 2006/12/11 01:07:07 albertel Exp $
+# $Id: structuretags.pm,v 1.373 2007/02/23 01:04:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -276,9 +276,7 @@
 sub problem_web_to_edit_header {
     my ($rndseed)=@_;
     my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />';
-    if (!$Apache::lonhomework::parsing_a_task) {
-	$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />';
-    }
+    $result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />';
     $result .= '<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />
              <input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" />
              <input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" />
@@ -787,7 +785,6 @@
     }
 
     if ($target eq 'tex') {
-
 	# Figure out the front matter and replace the
 	# INSERTTEXFRONTMATTERHERE in result with it.  note that we do
 	# this in end_problem because whether or not we display due
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.226 loncom/homework/bridgetask.pm:1.227
--- loncom/homework/bridgetask.pm:1.226	Thu Feb 22 16:40:40 2007
+++ loncom/homework/bridgetask.pm	Thu Feb 22 20:04:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.226 2007/02/22 21:40:40 albertel Exp $
+# $Id: bridgetask.pm,v 1.227 2007/02/23 01:04:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1332,9 +1332,7 @@
 	$result.=&Apache::response::meta_stores_write('status','string',
 						      'Bridge Task Status');
     } elsif ($target eq 'edit') {
-	&Apache::structuretags::reset_problem_globals('Task');
-	undef($Apache::lonhomework::parsing_a_task);
-	return ('','no');
+	$result.= &Apache::structuretags::problem_edit_footer();
     }
     &Apache::structuretags::reset_problem_globals('Task');
     undef($Apache::lonhomework::parsing_a_task);
@@ -2078,13 +2076,8 @@
     } elsif ($target eq 'webgrade') {
 	&Apache::lonxml::startredirection();
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/closingparagraph",
-						   $parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/closingparagraph',
-							   $parser);
     }
     return $result;
 }
@@ -2099,6 +2092,14 @@
     return $result;
 }
 
+sub insert_ClosingParagraph {
+    return '
+<ClosingParagraph>
+    <startouttext />
+    <endouttext />
+</ClosingParagraph>';
+}
+
 sub get_dim_id {
     if (@Apache::bridgetask::dimension) {
 	return $Apache::bridgetask::dimension[-1];
@@ -2225,12 +2226,8 @@
     my $dim = &get_dim_id();
 	$dimension{$dim}{'questiontext'}=$text;
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/questiontext",$parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/questiontext',
-							   $parser);
     }
     return $result;
 }
@@ -2239,6 +2236,14 @@
     return '';
 }
 
+sub insert_QuestionText {
+    return '
+<QuestionText>
+    <startouttext />
+    <endouttext />
+</QuestionText>';
+}
+
 sub get_instance {
     my ($dim)=@_;
     my $rand_alg=&Apache::lonnet::get_rand_alg();
@@ -2707,12 +2712,8 @@
 	}
 	
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/introparagraph",$parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/introparagraph',
-							   $parser);
     }
     return $result;
 }
@@ -2724,6 +2725,14 @@
     }
 }
 
+sub insert_IntroParagraph {
+    return '
+<IntroParagraph>
+    <startouttext />
+    <endouttext />
+</IntroParagraph>';
+}
+
 sub start_Instance {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $dim = &get_dim_id();
@@ -2780,12 +2789,8 @@
 	my $instance_id=$Apache::bridgetask::instance{$dim}[-1];
 	$dimension{$dim}{$instance_id.'.text'}=$text;
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/instancetext",$parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/instancetext',
-							   $parser);
     }
     return $result;
 }
@@ -2794,6 +2799,14 @@
     return '';
 }
 
+sub insert_InstanceText {
+    return '
+<InstanceText>
+    <startouttext />
+    <endouttext />
+</InstanceText>';
+}
+
 sub start_Criteria {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result = '';
@@ -2960,6 +2973,15 @@
     } elsif ($target eq 'modified') {
     }
 }
+sub insert_Criteria {
+    return '
+<Criteria>
+    <CriteriaText>
+        <startouttext />
+        <endouttext />
+    </CriteriaText>
+</Criteria>';
+}
 
 sub start_CriteriaText {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
@@ -2967,12 +2989,8 @@
     if ($target eq 'grade' || $target eq 'web' || $target eq 'webgrade') {
 	
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/criteriatext",$parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/criteriatext',
-							   $parser);
     }
     return $result;
 }
@@ -2981,6 +2999,14 @@
     return '';
 }
 
+sub insert_CriteriaText {
+    return '
+<CriteriaText>
+    <startouttext />
+    <endouttext />
+</CriteriaText>';
+}
+
 sub start_GraderNote {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
@@ -2988,12 +3014,8 @@
 	$result = '<div class="LC_GRADING_gradernote"><b>'.
 	    &mt('Note to graders:').'</b>';
     } elsif ($target eq 'edit') {
-	my $bodytext=&Apache::lonxml::get_all_text("/gradernote",$parser);
 	$result = &Apache::edit::tag_start($target,$token);
-	$result.= &Apache::edit::editfield($token->[1],$bodytext,'',80,4);
     } elsif ($target eq 'modified') {
-	$result = $token->[4].&Apache::edit::modifiedfield('/gradernote',
-							   $parser);
     } elsif ($target eq 'web' || $target eq 'grade') {
 	my $note=&Apache::lonxml::get_all_text('/gradernote',$parser,$style); 
     }
@@ -3009,6 +3031,13 @@
     return;
 }
 
+sub insert_GraderNote {
+    return '
+<GraderNote>
+    <startouttext />
+    <endouttext />
+</GraderNote>';
+}
 
 
 sub proctor_validation_screen {
Index: loncom/homework/insertlist.xml
diff -u loncom/homework/insertlist.xml:1.3 loncom/homework/insertlist.xml:1.4
--- loncom/homework/insertlist.xml:1.3	Sat Feb 17 20:59:35 2007
+++ loncom/homework/insertlist.xml	Thu Feb 22 20:04:05 2007
@@ -591,16 +591,16 @@
                 <allow>IntroParagraph,Setup,Question,Criteria,ClosingParagraph</allow>
 	</tag>
 	<tag name="IntroParagraph">
-		<description>Introductory Text</description>
+		<description>Introductory Information</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <allow></allow>
+		<insert_sub>Apache::bridgetask::insert_IntroParagraph</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
 	</tag>
 	<tag name="ClosingParagraph">
-		<description>Closing Text</description>
+		<description>Closing Information</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <allow></allow>
+		<insert_sub>Apache::bridgetask::insert_ClosingParagraph</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
 	</tag>
 
 	<tag name="Question">
@@ -610,10 +610,11 @@
                 <allow>Instance,QuestionText,Question,Criteria</allow>
 	</tag>
 	<tag name="QuestionText">
-		<description>Question Text</description>
+		<description>Question Information</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <!-- allowed by edit not supportted yet
+		<insert_sub>Apache::bridgetask::insert_QuestionText</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
+                <!-- allowed but edit not supportted yet
                      <allow>Question,Criteria</allow>-->
 	</tag>
 	<tag name="Setup">
@@ -629,27 +630,27 @@
                 <allow>InstanceText,Criteria</allow>
 	</tag>
 	<tag name="InstanceText">
-		<description>Text for the Instance</description>
+		<description>Information for the Instance</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <allow></allow>
+		<insert_sub>Apache::bridgetask::insert_InstanceText</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
 	</tag>
 	<tag name="Criteria">
 		<description>Question Criteria</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
+		<insert_sub>Apache::bridgetask::insert_Criteria</insert_sub>
                 <allow>GraderNote,CriteriaText</allow>
 	</tag>
 	<tag name="CriteriaText">
-		<description>Criteria Text</description>
+		<description>Criteria Information</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <allow></allow>
+		<insert_sub>Apache::bridgetask::insert_CriteriaText</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
 	</tag>
 	<tag name="GraderNote">
 		<description>Text to display to Grader</description>
 		<color>#FFFFFF</color>
-		<insert_sub>default</insert_sub>
-                <allow></allow>
+		<insert_sub>Apache::bridgetask::insert_GraderNote</insert_sub>
+		<allow>block,display,gnuplot,img,import,organicstructure,parserlib,problemtype,randomlabel,randomlist,script,scriptlib,startouttext,tex,web,while,window</allow>
 	</tag>
 </insertlist>

--albertel1172192646--