--- loncom/interface/lonhtmlcommon.pm 2011/01/03 13:10:12 1.285 +++ loncom/interface/lonhtmlcommon.pm 2011/01/13 17:44:30 1.286 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.285 2011/01/03 13:10:12 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.286 2011/01/13 17:44:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,6 +60,7 @@ use Time::Local; use Time::HiRes; use Apache::lonlocal; use Apache::lonnet; +use HTML::Entities(); use LONCAPA; sub java_not_enabled { @@ -83,6 +84,22 @@ sub raw_href_to_link { return $message; } +sub entity_encode { + my ($text)=@_; + return &HTML::Entities::encode($text, '<>&"'); +} + +sub direct_parm_link { + my ($linktext,$symb,$filter,$part,$target)=@_; + $symb=&entity_encode($symb); + $filter=&entity_encode($filter); + $part=&entity_encode($part); + if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) { + return "$linktext"; + } else { + return $linktext; + } +} ############################################## ##############################################