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

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


faziophi		Tue Dec 22 06:22:12 2009 EDT

  Modified files:              
    /loncom/interface	lontemplate.pm 
  Log:
  -- Adds new constants designed for <textarea> output:
     RICH_TEXT_ALWAYS_ON, RICH_TEXT_ALWAYS_OFF, RICH_TEXT_DEFAULT_ON,
     RICH_TEXT_DEFAULT_OFF, RICH_TEXT_DETECT_HTML
  -- Adds new methods to generate textareas with one of the above
     rich text editing types, and for the "Save All" submission button
  
  
  
Index: loncom/interface/lontemplate.pm
diff -u loncom/interface/lontemplate.pm:1.41 loncom/interface/lontemplate.pm:1.42
--- loncom/interface/lontemplate.pm:1.41	Thu Dec  3 02:13:28 2009
+++ loncom/interface/lontemplate.pm	Tue Dec 22 06:22:12 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "Template" Functions to generate html output
 #
-# $Id: lontemplate.pm,v 1.41 2009/12/03 02:13:28 www Exp $
+# $Id: lontemplate.pm,v 1.42 2009/12/22 06:22:12 faziophi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -43,6 +43,13 @@
 use Apache::lonmsgdisplay();
 use HTML::Entities();
 
+use constant {
+	RICH_TEXT_ALWAYS_ON => 'LC_richAlwaysOn',
+	RICH_TEXT_ALWAYS_OFF => 'LC_richAlwaysOff',
+	RICH_TEXT_DEFAULT_ON => 'LC_richDefaultOn',
+	RICH_TEXT_DETECT_HTML => 'LC_richDetectHtml',
+	RICH_TEXT_DEFAULT_OFF => 'LC_richDefaultOff'
+};
 
 sub start_columnSection {
 	my ($r) = @_;
@@ -125,4 +132,16 @@
                            &mt('Save All').'" />');
 }
 
+sub print_textarea_template {
+	my ($r, $content, $field, $wysiwyg) = @_;
+	$r->print('<textarea cols="81" rows="6" class="'.$wysiwyg.'" id="'.$field.'" name="'.$field.'">'.
+						  &HTML::Entities::encode($content, '"&<>').
+			'</textarea><br />');
+}
+
+sub print_saveall_template {
+	my ($r) = @_;
+	$r->print('<input type="submit" name="storesyl" value="'.&mt('Save All').'" />');
+}
+
 1;