[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Thu Dec 12 23:21:21 EST 2013


raeburn		Fri Dec 13 04:21:21 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm 
  Log:
  - For 2.11
    - Backport 1.1159, 1.1160, 1.1161, 1.1162
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.55 loncom/interface/loncommon.pm:1.1075.2.56
--- loncom/interface/loncommon.pm:1.1075.2.55	Wed Nov 20 05:11:34 2013
+++ loncom/interface/loncommon.pm	Fri Dec 13 04:21:21 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.55 2013/11/20 05:11:34 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.56 2013/12/13 04:21:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1362,7 +1362,7 @@
 
     return <<"END";
 $banner_link
- <a href="$link" title="$title">$text</a>
+<a href="$link" title="$title">$text</a>
 END
 }
 
@@ -1724,8 +1724,6 @@
 
 =head1 Excel and CSV file utility routines
 
-=over 4
-
 =cut
 
 ###############################################################
@@ -1733,6 +1731,8 @@
 
 =pod
 
+=over 4
+
 =item * &csv_translate($text) 
 
 Translate $text to allow it to be output as a 'comma separated values' 
@@ -5271,7 +5271,7 @@
     }
 
     my $attr_string;
-    foreach my $attr (keys(%$attr_ref)) {
+    foreach my $attr (sort(keys(%$attr_ref))) {
 	$attr_string .= " $attr=\"".$attr_ref->{$attr}.'" ';
     }
     return $attr_string;
@@ -7262,7 +7262,7 @@
 
     my $result =
 	'<head>'.
-	&font_settings();
+	&font_settings($args);
 
     my $inhibitprint = &print_suppression();
 
@@ -7327,15 +7327,17 @@
 
 Returns neccessary <meta> to set the proper encoding
 
-Inputs: none
+Inputs: optional reference to HASH -- $args passed to &headtag()
 
 =cut
 
 sub font_settings {
+    my ($args) = @_;
     my $headerstring='';
-    if (!$env{'browser.mathml'} && $env{'browser.unicode'}) {
+    if ((!$env{'browser.mathml'} && $env{'browser.unicode'}) ||
+        ((ref($args) eq 'HASH') && ($args->{'browser.unicode'}))) {
 	$headerstring.=
-	    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
+	    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n";
     }
     return $headerstring;
 }
@@ -7439,8 +7441,8 @@
             .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" ' 
 	    .'xmlns="http://www.w3.org/1999/xhtml">';
     } else {
-	$output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
-           .'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
+	$output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n"
+           .'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
     }
     return $output;
 }
@@ -7932,7 +7934,7 @@
 
 
 sub start_scrollbox {
-    my ($outerwidth,$width,$height,$id,$bgcolor,$cursor,$needjsready)=@_;
+    my ($outerwidth,$width,$height,$id,$bgcolor,$cursor,$needjsready) = @_;
     unless ($outerwidth) { $outerwidth='520px'; }
     unless ($width) { $width='500px'; }
     unless ($height) { $height='200px'; }
@@ -7952,7 +7954,7 @@
 $nicescroll_js
 
 <table style="width: $outerwidth; border: 1px solid none;"$table_id><tr><td style="width: $width;$tdcol">
-<div style="overflow:auto; width:$width; height: $height;"$div_id>
+<div style="overflow:auto; width:$width; height:$height;"$div_id>
 END
 }
 
@@ -10265,7 +10267,6 @@
     return ($output,$counter,$numpathchg);
 }
 
-
 =pod
 
 =item * clean_path($name)
@@ -12056,7 +12057,7 @@
 
 =pod
 
-=item &get_folder_hierarchy()
+=item * &get_folder_hierarchy()
 
 Provides hierarchy of names of folders/sub-folders containing the current
 item,
@@ -13369,7 +13370,7 @@
 
 =pod
 
-=item *&recurse_categories()
+=item * &recurse_categories()
 
 Recursively used to generate breadcrumb trails for course categories.
 
@@ -13440,7 +13441,7 @@
 
 =pod
 
-=item *&assign_categories_table()
+=item * &assign_categories_table()
 
 Create a datatable for display of hierarchical categories in a domain,
 with checkboxes to allow a course to be categorized. 
@@ -13517,7 +13518,7 @@
 
 =pod
 
-=item *&assign_category_rows()
+=item * &assign_category_rows()
 
 Create a datatable row for display of nested categories in a domain,
 with checkboxes to allow a course to be categorized,called recursively.
@@ -14894,6 +14895,28 @@
     return $captcha_chk;
 }
 
+sub cleanup_html {
+    my ($incoming) = @_;
+    my $outgoing;
+    if ($incoming ne '') {
+        $outgoing = $incoming;
+        $outgoing =~ s/;/;/g;
+        $outgoing =~ s/\#/#/g;
+        $outgoing =~ s/\&/&/g;
+        $outgoing =~ s/</</g;
+        $outgoing =~ s/>/>/g;
+        $outgoing =~ s/\(/&#040/g;
+        $outgoing =~ s/\)/)/g;
+        $outgoing =~ s/"/"/g;
+        $outgoing =~ s/'/'/g;
+        $outgoing =~ s/\$/$/g;
+        $outgoing =~ s{/}{/}g;
+        $outgoing =~ s/=/=/g;
+        $outgoing =~ s/\\/\/g
+    }
+    return $outgoing;
+}
+
 =pod
 
 =back




More information about the LON-CAPA-cvs mailing list