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

www lon-capa-cvs@mail.lon-capa.org
Thu, 03 Jun 2004 16:42:02 -0000


www		Thu Jun  3 12:42:02 2004 EDT

  Modified files:              
    /loncom/homework	edit.pm structuretags.pm 
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  Continuing work on HTMLArea.
  
  If it causes segfaults in your Mozilla, set lonhtmlcommon::htmlareabrowser 
  return value to 0.
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.81 loncom/homework/edit.pm:1.82
--- loncom/homework/edit.pm:1.81	Tue Mar 30 03:20:49 2004
+++ loncom/homework/edit.pm	Thu Jun  3 12:42:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.81 2004/03/30 08:20:49 albertel Exp $
+# $Id: edit.pm,v 1.82 2004/06/03 16:42:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,9 +25,7 @@
 #
 # http://www.lon-capa.org/
 #
-# 3/20 Guy
-# 01/10/02 Matthew
-# 03/06/02 Matthew
+
 package Apache::edit; 
 
 use strict;
@@ -486,15 +484,21 @@
 }
 
 sub editfield {
-    my ($tag,$data,$description,$minwidth,$minheight)=@_;
+    my ($tag,$data,$description,$minwidth,$minheight,$usehtmlarea)=@_;
 
     my ($rows,$cols)=&textarea_sizes(\$data);
+    $rows+=3; # make room for HTMLarea
     if ($cols > 80) { $cols = 80; }
     if ($cols < $minwidth ) { $cols = $minwidth; }
     if ($rows < $minheight) { $rows = $minheight; }
     if ($description) { $description="<br />".$description."<br />"; }
+    if ($usehtmlarea) {
+	push @Apache::lonxml::htmlareafields,'homework_edit_'.
+	    $Apache::lonxml::curdepth;
+    }
     return $description."\n".'&nbsp;&nbsp;&nbsp;<textarea rows="'.$rows.
 	'" cols="'.$cols.'" name="homework_edit_'.
+	$Apache::lonxml::curdepth.'" id="homework_edit_'.
 	$Apache::lonxml::curdepth.'">'.
 	&HTML::Entities::encode($data,'<>&"').'</textarea>'."\n";
 }
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.254 loncom/homework/structuretags.pm:1.255
--- loncom/homework/structuretags.pm:1.254	Thu Jun  3 10:28:39 2004
+++ loncom/homework/structuretags.pm	Thu Jun  3 12:42:02 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.254 2004/06/03 14:28:39 www Exp $
+# $Id: structuretags.pm,v 1.255 2004/06/03 16:42:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -201,7 +201,9 @@
 
 sub problem_edit_footer {
     return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
-    <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />';
+    <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'.
+    &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields).
+    "\n</form>\n</body>\n</html>";
 }
 
 sub option {
@@ -1277,7 +1279,7 @@
 		 &Apache::edit::end_row().
                  &Apache::edit::start_spanning_row()."\n"
 		 . &Apache::loncommon::helpLatexCheatsheet () .
-		 &Apache::edit::editfield($token->[1],$text,"",80,4);
+		 &Apache::edit::editfield($token->[1],$text,"",80,8,1);
     }
     if ($target eq 'modified') {
 	$result='<startouttext />'.&Apache::edit::modifiedfield("endouttext",$parser);
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.72 loncom/interface/lonhtmlcommon.pm:1.73
--- loncom/interface/lonhtmlcommon.pm:1.72	Thu Jun  3 10:28:39 2004
+++ loncom/interface/lonhtmlcommon.pm	Thu Jun  3 12:42:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.72 2004/06/03 14:28:39 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.73 2004/06/03 16:42:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -875,13 +875,10 @@
     }
     return (<<ENDHEADERS);
 <script type="text/javascript">
-    _editor_url="/htmlarea/";
-</script>
-<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
-<style type="text/javascript">
 _editor_url='/htmlarea/';
 _editor_lang='$lang';
-</style>
+</script>
+<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
 ENDHEADERS
 }
 
@@ -899,12 +896,13 @@
 # ----------------------------------------- Script to activate only some fields
 
 sub htmlareaselectactive {
+    my @fields=@_;
     if (&htmlareablocked()) { return ''; }
     my $output='<script type="text/javascript" defer="1">';
-    foreach(@_) {
+    foreach(@fields) {
 	$output.="\nHTMLArea.replace('$_');";
     }
-    $output.="\n</script>";
+    $output.="\nwindow.status='Activated Editfields';\n</script>";
     return $output;
 }