[LON-CAPA-cvs] cvs: loncom /xml scripttag.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 17 Jul 2002 18:00:04 -0000


albertel		Wed Jul 17 14:00:04 2002 EDT

  Modified files:              
    /loncom/xml	scripttag.pm 
  Log:
  - actual implemntation of <comment> tag (BUG#258)
  
  
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.73 loncom/xml/scripttag.pm:1.74
--- loncom/xml/scripttag.pm:1.73	Fri May  3 18:28:36 2002
+++ loncom/xml/scripttag.pm	Wed Jul 17 14:00:03 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.73 2002/05/03 22:28:36 albertel Exp $
+# $Id: scripttag.pm,v 1.74 2002/07/17 18:00:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -43,7 +43,7 @@
   &Apache::lonxml::register('Apache::scripttag',
 			    ('script','scriptlib','parserlib','import',
 			     'window','display','storetc','physnet',
-			     'standalone'));
+			     'standalone','comment'));
 }
 
 sub start_script {
@@ -345,6 +345,29 @@
 }
 
 sub end_standalone {
+  return '';
+}
+
+sub start_comment {
+  my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+  my $result='';
+  if ($target eq 'edit') {
+    $result=&Apache::edit::tag_start($target,$token);
+    my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
+    $result.=&Apache::edit::editfield($token->[1],$bodytext,'',40,4)
+  } elsif ( $target eq 'modified') {
+    $result=$token->[4].&Apache::edit::modifiedfield($token);
+  } elsif ( $target eq 'web' || $target eq 'tex' ||
+	    $target eq 'grade' || $target eq 'answer' || $target eq 'meta') {
+    #normally throw away comments
+    my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
+  }
+  return $result;
+}
+
+sub end_comment {
+  my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+  if ($target eq 'edit' ) { return &Apache::edit::end_table(); }
   return '';
 }