--- loncom/interface/lonhtmlcommon.pm 2009/05/16 21:50:52 1.215 +++ loncom/interface/lonhtmlcommon.pm 2010/10/04 19:19:15 1.253.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.215 2009/05/16 21:50:52 droeschl Exp $ +# $Id: lonhtmlcommon.pm,v 1.253.2.3 2010/10/04 19:19:15 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,22 @@ use Apache::lonlocal; use Apache::lonnet; use LONCAPA; + +sub coursepreflink { + my ($text,$category)=@_; + if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { + return ''.$text.''; + } else { + return ''; + } +} + +sub raw_href_to_link { + my ($message)=@_; + $message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/$1<\/tt><\/a>$2/gi; + return $message; +} + ############################################## ############################################## @@ -77,12 +93,12 @@ sub confirm_success { my ($message,$failure)=@_; if ($failure) { return ''."\n" - .' '."\n" + .''.&mt('Error').' '."\n" .$message."\n" .''."\n"; } else { return ''."\n" - .' '."\n" + .''.&mt('OK').' '."\n" .$message."\n" .''."\n"; } @@ -111,7 +127,7 @@ sub dragmath_button { } my $buttontext=&mt('Edit Math'); return <$help_text + $help_text ENDDRAGMATH } @@ -130,11 +146,13 @@ sub dragmath_js { my ($popup) = @_; return < + // ENDDRAGMATHJS @@ -158,10 +176,10 @@ sub authorbombs { $url=&Apache::lonnet::declutter($url); my ($udom,$uname)=($url=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)/}); my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom); - foreach (keys %bombs) { - if ($_=~/^$udom\/$uname\//) { + foreach my $bomb (keys(%bombs)) { + if ($bomb =~ /^$udom\/$uname\//) { return ''. + '">'.&mt('Bomb').''. &Apache::loncommon::help_open_topic('About_Bombs'); } } @@ -220,6 +238,9 @@ sub select_recent { unless ($value =~/^error\:/) { my $escaped = &Apache::loncommon::escape_url($value); &Apache::loncommon::inhibit_menu_check(\$escaped); + if ($area eq 'residx') { + next if ((!&Apache::lonnet::allowed('bre',$value)) && (!&Apache::lonnet::allowed('bro',$value))); + } $return.="\n'; @@ -237,7 +258,7 @@ sub get_recent { # Begin filling return_hash with any 'always_include' option my %time_hash = (); my %return_hash = (); - foreach my $item (keys %recent) { + foreach my $item (keys(%recent)) { my ($thistime,$thisvalue)=(split(/\&/,$recent{$item})); if ($thistime eq 'always_include') { $return_hash{$item} = &unescape($thisvalue); @@ -430,6 +451,7 @@ sub date_setter { my $result = "\n\n"; $result .= < +// ENDJS $result .= ' '; @@ -501,23 +524,23 @@ ENDJS unshift(@Months,'If you can read this an error occurred'); if ($includeempty) { $monthselector.=""; } for(my $m = 1;$m <=$#Months;$m++) { - $monthselector .= qq{