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

raeburn raeburn at source.lon-capa.org
Sat Jun 21 19:36:05 EDT 2014


raeburn		Sat Jun 21 23:36:05 2014 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - Editing HTML file uploaded to Syllabus:
    WYSIWYG editor set to load automatically in this case, so "Edit Math" 
    button needs to be hidden by an onload action.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.547 loncom/xml/lonxml.pm:1.548
--- loncom/xml/lonxml.pm:1.547	Sat Jun 21 20:56:40 2014
+++ loncom/xml/lonxml.pm	Sat Jun 21 23:36:05 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.547 2014/06/21 20:56:40 raeburn Exp $
+# $Id: lonxml.pm,v 1.548 2014/06/21 23:36:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1521,52 +1521,56 @@
       my $xml_help = '';
       my $initialize='';
       my $textarea_id = 'filecont';
-      my ($dragmath_button,$deps_button);
-      my ($add_to_onload, $add_to_onresize);
+      my ($dragmath_button,$deps_button,$context,$cnum,$cdom,$add_to_onload,
+          $add_to_onresize,$init_dragmath);
       $initialize=&Apache::lonhtmlcommon::spellheader();
-      if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) {
-	  my $lang = &Apache::lonhtmlcommon::htmlarea_lang();
-          my %textarea_args = (
-                                fullpage => 'true',
-                                dragmath => 'math',
-                              );
-          $initialize .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); 
+      if ($filetype eq 'html') {
+          if ($env{'request.course.id'}) {
+              $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+              $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+              if ($uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E}) {
+                  $context = 'syllabus';
+              }
+          }
+          if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+	      my $lang = &Apache::lonhtmlcommon::htmlarea_lang();
+              my %textarea_args = (
+                                    fullpage => 'true',
+                                    dragmath => 'math',
+                                  );
+              $initialize .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
+              if ($context eq 'syllabus') {
+                  $init_dragmath = "editmath_visibility('filecont','none')";
+              }
+          }
       }
       $initialize .= (<<FULLPAGE);
 <script type="text/javascript">
 // <![CDATA[
     function initDocument() {
 	resize_textarea('$textarea_id','LC_aftertextarea');
+        $init_dragmath
     }
 // ]]>
 </script>
 FULLPAGE
       my $textareaclass;
       if ($filetype eq 'html') {
-          my $context;
-          if ($env{'request.course.id'}) {
-              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-              if ($uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E}) {
-                  $context = 'syllabus';
-                  $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
-                  $initialize .=
-                      &Apache::lonhtmlcommon::dependencycheck_js(undef,&mt('Syllabus'),
-                                                                 $uri,undef,
-                                                                 "/public/$cdom/$cnum/syllabus").
-                      "\n";
-                  if (&Apache::lonhtmlcommon::htmlareabrowser()) {
-                      $textareaclass = 'class="LC_richDefaultOn"';
-                  }
-              }
-          }
-          unless ($context eq 'syllabus') {
-              if ($symb || $folderpath) {
-                  $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
-                  $initialize .= 
-                      &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
-                                                                 undef,$folderpath,$uri)."\n";
+          if ($context eq 'syllabus') {
+              $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+              $initialize .=
+                  &Apache::lonhtmlcommon::dependencycheck_js(undef,&mt('Syllabus'),
+                                                             $uri,undef,
+                                                             "/public/$cdom/$cnum/syllabus").
+                  "\n";
+              if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+                  $textareaclass = 'class="LC_richDefaultOn"';
               }
+          } elsif ($symb || $folderpath) {
+              $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+              $initialize .= 
+                  &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
+                                                             undef,$folderpath,$uri)."\n";
           }
           $dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>';
           $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');




More information about the LON-CAPA-cvs mailing list