[LON-CAPA-cvs] cvs: loncom /homework edit.pm insertlist.xml structuretags.pm /xml lonxml.pm
www
www@source.lon-capa.org
Sat, 05 Jun 2010 19:37:01 -0000
www Sat Jun 5 19:37:01 2010 EDT
Modified files:
/loncom/homework edit.pm insertlist.xml structuretags.pm
/loncom/xml lonxml.pm
Log:
Be able to wrap stuff into a part using colorful editor
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.126 loncom/homework/edit.pm:1.127
--- loncom/homework/edit.pm:1.126 Fri Jun 4 23:03:55 2010
+++ loncom/homework/edit.pm Sat Jun 5 19:36:57 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# edit mode helpers
#
-# $Id: edit.pm,v 1.126 2010/06/04 23:03:55 www Exp $
+# $Id: edit.pm,v 1.127 2010/06/05 19:36:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -592,6 +592,9 @@
</matchresponse>';
}
+sub insert_startpartmarker { return '<startpartmarker />'; }
+sub insert_endpartmarker { return '<endpartmarker />'; }
+
sub insert_displayduedate { return '<displayduedate />'; }
sub insert_displaytitle { return '<displaytitle />'; }
sub insert_hintpart {
Index: loncom/homework/insertlist.xml
diff -u loncom/homework/insertlist.xml:1.16 loncom/homework/insertlist.xml:1.17
--- loncom/homework/insertlist.xml:1.16 Wed Feb 17 15:39:59 2010
+++ loncom/homework/insertlist.xml Sat Jun 5 19:36:57 2010
@@ -461,6 +461,16 @@
<insert_sub>default</insert_sub>
<allow>block,customresponse,display,displayduedate,displaytitle,essayresponse,externalresponse,formularesponse,gnuplot,imageresponse,img,import,matchresponse,mathresponse,notsolved,numericalresponse,optionresponse,organicresponse,organicstructure,parameter,parserlib,postanswerdate,preduedate,problemtype,radiobuttonresponse,randomlabel,randomlist,rankresponse,reactionresponse,script,scriptlib,solved,startouttext,stringresponse,tex,while,window</allow>
</tag>
+ <tag name="startpartmarker">
+ <description>Problem Part: Marker for Start of New Part</description>
+ <color>#F0F0F0</color>
+ <insert_sub>insert_startpartmarker</insert_sub>
+ </tag>
+ <tag name="endpartmarker">
+ <description>Problem Part: Marker for End of New Part</description>
+ <color>#F0F0F0</color>
+ <insert_sub>insert_endpartmarker</insert_sub>
+ </tag>
<tag name="postanswerdate">
<description>After Answer Date Block</description>
<color>#EE9999</color>
@@ -477,7 +487,7 @@
<description>Start of Homework</description>
<color>#FFFFFF</color>
<insert_sub>default</insert_sub>
- <allow>allow,block,customresponse,display,displayduedate,displaytitle,essayresponse,externalresponse,formularesponse,gnuplot,imageresponse,img,import,matchresponse,mathresponse,meta,notsolved,numericalresponse,optionresponse,organicresponse,organicstructure,parameter,parserlib,part,postanswerdate,preduedate,problemtype,radiobuttonresponse,randomlabel,randomlist,rankresponse,reactionresponse,script,scriptlib,solved,startouttext,stringresponse,tex,while,window</allow>
+ <allow>allow,block,customresponse,display,displayduedate,displaytitle,endpartmarker,essayresponse,externalresponse,formularesponse,gnuplot,imageresponse,img,import,matchresponse,mathresponse,meta,notsolved,numericalresponse,optionresponse,organicresponse,organicstructure,parameter,parserlib,part,postanswerdate,preduedate,problemtype,radiobuttonresponse,randomlabel,randomlist,rankresponse,reactionresponse,script,scriptlib,solved,startouttext,startpartmarker,stringresponse,tex,while,window</allow>
</tag>
<tag name="allow">
<description>File Dependencies</dscription>
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.468 loncom/homework/structuretags.pm:1.469
--- loncom/homework/structuretags.pm:1.468 Fri Mar 26 00:49:36 2010
+++ loncom/homework/structuretags.pm Sat Jun 5 19:36:57 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.468 2010/03/26 00:49:36 raeburn Exp $
+# $Id: structuretags.pm,v 1.469 2010/06/05 19:36:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,7 +66,7 @@
use LONCAPA;
BEGIN {
- &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
+ &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startpartmarker','startouttext','endpartmarker','endouttext','simpleeditbutton','definetag'));
}
sub start_web {
@@ -1684,6 +1684,49 @@
return $in_order_show;
}
+
+sub start_startpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result='';
+ if ($target eq 'edit') {
+ $result=&Apache::edit::tag_start($target,$token);
+ $result.=&mt('Marker for the start of a part. Place end marker below to wrap in-between tags into a new part.').'</td></tr>';
+ $result.=&Apache::edit::end_table();
+
+ }
+ return $result;
+}
+
+sub end_startpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my @result;
+ if ($target eq 'edit') { $result[1]='no'; }
+ return @result;
+}
+
+sub start_endpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result='';
+ if ($target eq 'edit') {
+ $result=&Apache::edit::tag_start($target,$token);
+ $result.=&mt('Marker for the end of a part. Place start marker above to wrap in-between tags into a new part.').'</td></tr>';
+ $result.=&Apache::edit::end_table();
+
+ }
+ return $result;
+}
+
+sub end_endpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my @result;
+ if ($target eq 'edit') { $result[1]='no'; }
+ return @result;
+}
+
+
+
+
+
sub start_part {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
if (!$Apache::lonxml::metamode) {
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.508 loncom/xml/lonxml.pm:1.509
--- loncom/xml/lonxml.pm:1.508 Mon May 3 14:43:07 2010
+++ loncom/xml/lonxml.pm Sat Jun 5 19:37:01 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.508 2010/05/03 14:43:07 onken Exp $
+# $Id: lonxml.pm,v 1.509 2010/06/05 19:37:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -476,6 +476,10 @@
}
if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {
$finaloutput=&afterburn($finaloutput);
+ }
+ if ($target eq 'modified') {
+# if modfied, handle startpart and endpart
+ $finaloutput=~s/\<startpartmarker[^\>]*\>(.*)\<endpartmarker[^\>]*\>/<part>$1<\/part>/gs;
}
return $finaloutput;
}