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

faziophi faziophi@source.lon-capa.org
Tue, 22 Dec 2009 06:02:44 -0000


faziophi		Tue Dec 22 06:02:44 2009 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  -- Adds hackish method to revert back to previous behavior (global preference)
     if none of the new HTML classes are present.  This way, all textareas
     must explicitly be changed for now, and behavior is backwards-compatible.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.255 loncom/interface/lonhtmlcommon.pm:1.256
--- loncom/interface/lonhtmlcommon.pm:1.255	Tue Dec 22 05:33:36 2009
+++ loncom/interface/lonhtmlcommon.pm	Tue Dec 22 06:02:44 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.255 2009/12/22 05:33:36 faziophi Exp $
+# $Id: lonhtmlcommon.pm,v 1.256 2009/12/22 06:02:44 faziophi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1356,9 +1356,34 @@
 			$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting &raquo;</b></a></div>");
 			$("#LC_rt_"+id).click(editorHandler);			
 		});
+		
 	});
 ';
     
+    foreach my $field (@fields) {
+	$output.='
+	
+{
+	$(document).ready(function() {
+		if (!($("#'.$field.'").hasClass("LC_richAlwaysOn"))) {
+			if (!($("#'.$field.'").hasClass("LC_richAlwaysOff"))) {
+				if (!($("#'.$field.'").hasClass("LC_richDetectHtml"))) {
+					if (!($("#'.$field.'").hasClass("LC_richDefaultOn"))) {
+						if (!($("#'.$field.'").hasClass("LC_richDefaultOff"))) {
+							var oFCKeditor = new FCKeditor("'.$field.'");
+							oFCKeditor.Config["CustomConfigurationsPath"] = 
+							"/fckeditor/loncapaconfig.js";    
+							oFCKeditor.ReplaceTextarea();
+							oFCKeditor.Config["AutoDetectLanguage"] = false;
+							oFCKeditor.Config["DefaultLanguage"] = "'.$lang.'";
+						}
+					}
+				}		
+			}
+		}
+    });
+}';
+    }
     $output.="\nwindow.status='Activated Editfields';\n"
             .'// ]]>'."\n"
             .'</script><br />'.