[LON-CAPA-cvs] cvs: rat / lonpage.pm loncom/interface lonhtmlcommon.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 8 22:59:27 EDT 2013


raeburn		Sun Jun  9 02:59:27 2013 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
    /rat	lonpage.pm 
  Log:
  - Support toggle between Rich Text/Plain Text for multiple textareas in 
    a composite page.
    - Add prefix to id in textarea tag with a .page to ensure uniqueness
    - Javascript functions: containsBlockHtml(), startRichEditor(),
      $(document).ready(function() etc only included once. 
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.346 loncom/interface/lonhtmlcommon.pm:1.347
--- loncom/interface/lonhtmlcommon.pm:1.346	Tue Jun  4 23:12:08 2013
+++ loncom/interface/lonhtmlcommon.pm	Sun Jun  9 02:59:04 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.346 2013/06/04 23:12:08 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.347 2013/06/09 02:59:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1259,7 +1259,8 @@
     my ($args) = @_; 
     unless (&htmlareabrowser()) { return ''; }
     my $output='<script type="text/javascript" defer="defer">'."\n"
-              .'// <![CDATA['."\n";
+              .'// <![CDATA['."\n"
+              .'//<!-- BEGIN LON-CAPA Internal'."\n";
     my $lang = &htmlarea_lang();
     my $fullpage = 'false';
     my ($dragmath_prefix,$dragmath_helpicon,$dragmath_whitespace);
@@ -1498,6 +1499,7 @@
 
     }
     $output.="\nwindow.status='Activated Editfields';\n"
+            .'// END LON-CAPA Internal -->'."\n"
             .'// ]]>'."\n"
             .'</script>';
     return $output;
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.100 rat/lonpage.pm:1.101
--- rat/lonpage.pm:1.100	Tue Jan 15 14:14:31 2013
+++ rat/lonpage.pm	Sun Jun  9 02:59:25 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.100 2013/01/15 14:14:31 bisitz Exp $
+# $Id: lonpage.pm,v 1.101 2013/06/09 02:59:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -264,6 +264,7 @@
 			      my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
 			      
 			      my $prefix=$_.'_';
+                              my $idprefix= join('_',($mapid,$resid,''));
                               my %posthash=('request.prefix' => $prefix,
 					    'LONCAPA_INTERNAL_no_discussion' => 'true',
 					    'symb' => $symb);
@@ -369,6 +370,8 @@
                                   }
                                   $output=~
 				      s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
+                                  $output=~
+                                      s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
                                   if ($nuploads) {
                                       $output=~
                                           s/\<(input[^\>]+name=\"\Q$prefix\EHWFILE[^\>]+)\s*id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\)]*)\>/\<$1 id="$prefix$2" $3\>/gsi;
@@ -431,6 +434,12 @@
                           if (($nforms) && ($nuploads)) {
                               $allscript .= &Apache::lonhtmlcommon::file_submissionchk_js(\%turninpaths,\%multiresps);
                           }
+                          if (($nforms) && (&Apache::lonhtmlcommon::htmlareabrowser())) {
+                              my %textarea_args = (
+                                  dragmath => 'math',
+                              );
+                              $allscript .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
+                          }
 # ------------------------------------------------------------------ Start body
 			  $r->print(&Apache::loncommon::start_page(undef,$allscript,
 								   {'force_register' => 1,




More information about the LON-CAPA-cvs mailing list