--- loncom/interface/loncommon.pm 2013/11/20 05:11:34 1.1075.2.55 +++ loncom/interface/loncommon.pm 2013/12/13 04:21:21 1.1075.2.56 @@ -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 @@ sub top_nav_help { return <<"END"; $banner_link - $text +$text END } @@ -1724,8 +1724,6 @@ RESIZE =head1 Excel and CSV file utility routines -=over 4 - =cut ############################################################### @@ -1733,6 +1731,8 @@ RESIZE =pod +=over 4 + =item * &csv_translate($text) Translate $text to allow it to be output as a 'comma separated values' @@ -5271,7 +5271,7 @@ sub make_attr_string { } 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 @@ sub headtag { my $result = ''. - &font_settings(); + &font_settings($args); my $inhibitprint = &print_suppression(); @@ -7327,15 +7327,17 @@ ADDMETA Returns neccessary 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.= - ''; + ''."\n"; } return $headerstring; } @@ -7439,8 +7441,8 @@ sub xml_begin { .''; } else { - $output='' - .''; + $output=''."\n" + .''."\n"; } return $output; } @@ -7932,7 +7934,7 @@ sub validate_page { 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 @@ sub start_scrollbox { $nicescroll_js
-
+
END } @@ -10265,7 +10267,6 @@ sub ask_for_embedded_content { return ($output,$counter,$numpathchg); } - =pod =item * clean_path($name) @@ -12056,7 +12057,7 @@ sub cleanup_empty_dirs { =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 @@ sub extract_categories { =pod -=item *&recurse_categories() +=item * &recurse_categories() Recursively used to generate breadcrumb trails for course categories. @@ -13440,7 +13441,7 @@ sub recurse_categories { =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 @@ sub assign_categories_table { =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 @@ sub check_recaptcha { 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/\)/)/g; + $outgoing =~ s/"/"/g; + $outgoing =~ s/'/'/g; + $outgoing =~ s/\$/$/g; + $outgoing =~ s{/}{/}g; + $outgoing =~ s/=/=/g; + $outgoing =~ s/\\/\/g + } + return $outgoing; +} + =pod =back