[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm /interface lonhtmlcommon.pm /xml lonxml.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 12 Jun 2004 01:09:31 -0000


www		Fri Jun 11 21:09:31 2004 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
    /loncom/interface	lonhtmlcommon.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Bug #3066: spurious "enable/disable htmlarea" link is gone (hopefully)
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.255 loncom/homework/structuretags.pm:1.256
--- loncom/homework/structuretags.pm:1.255	Thu Jun  3 12:42:02 2004
+++ loncom/homework/structuretags.pm	Fri Jun 11 21:09:30 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.255 2004/06/03 16:42:02 www Exp $
+# $Id: structuretags.pm,v 1.256 2004/06/12 01:09:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -84,7 +84,6 @@
 					       $parstack,$parser,$safeeval);
 	$head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target).
 	    &Apache::lonhtmlcommon::htmlareaheaders();
-	@Apache::lonxml::htmlareafields=();
     }
     my $body_tag_start;
     if (!defined($found{'body'})) {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.76 loncom/interface/lonhtmlcommon.pm:1.77
--- loncom/interface/lonhtmlcommon.pm:1.76	Mon Jun  7 21:32:02 2004
+++ loncom/interface/lonhtmlcommon.pm	Fri Jun 11 21:09:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.76 2004/06/08 01:32:02 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.77 2004/06/12 01:09:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -910,42 +910,34 @@
 # ----------------------------------------------------------------- Preferences
 
 sub disablelink {
+    my @fields=@_;
+    if (defined($#fields)) {
+	unless ($#fields>=0) { return ''; }
+    }
     return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
 }
 
 sub enablelink {
+    my @fields=@_;
+    if (defined($#fields)) {
+	unless ($#fields>=0) { return ''; }
+    }
     return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';
 }
 
-# ---------------------------------------------------------- Script to activate
-
-sub htmlareaactive {
-    unless (&htmlareabrowser()) { return ''; }
-    if (&htmlareablocked()) { return '<br />'.&enablelink(); }
-    my $addbuttons=&htmlareaaddbuttons();
-    my $disable=&disablelink();
-    return (<<ENDSCRIPT);
-<script type="text/javascript" defer="1">
-    $addbuttons
-    HTMLArea.replaceAll(config);
-</script><br />
-$disable
-ENDSCRIPT
-}
-
 # ----------------------------------------- Script to activate only some fields
 
 sub htmlareaselectactive {
     my @fields=@_;
     unless (&htmlareabrowser()) { return ''; }
-    if (&htmlareablocked()) { return '<br />'.&enablelink(); }
+    if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); }
     my $output='<script type="text/javascript" defer="1">'.
 	&htmlareaaddbuttons();
     foreach(@fields) {
 	$output.="\nHTMLArea.replace('$_',config);";
     }
     $output.="\nwindow.status='Activated Editfields';\n</script><br />".
-	&disablelink();
+	&disablelink(@fields);
     return $output;
 }
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.324 loncom/xml/lonxml.pm:1.325
--- loncom/xml/lonxml.pm:1.324	Mon Jun  7 17:56:24 2004
+++ loncom/xml/lonxml.pm	Fri Jun 11 21:09:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.324 2004/06/07 21:56:24 albertel Exp $
+# $Id: lonxml.pm,v 1.325 2004/06/12 01:09:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -150,6 +150,7 @@
 
 sub xmlbegin {
   my $output='';
+  @htmlareafields=();
   if ($ENV{'browser.mathml'}) {
       $output='<?xml version="1.0"?>'
             .'<?xml-stylesheet type="text/css" href="/adm/MathML/mathml.css"?>'
@@ -604,6 +605,7 @@
   my ($request,$target)=@_;
   $Apache::lonxml::request=$request;
   $Apache::lonxml::registered = 0;
+  @Apache::lonxml::htmlareafields=();
   $errorcount=0;
   $warningcount=0;
   $Apache::lonxml::default_homework_loaded=0;