--- loncom/interface/lonhtmlcommon.pm 2009/05/20 21:32:53 1.182.4.1 +++ loncom/interface/lonhtmlcommon.pm 2010/02/15 17:02:47 1.182.4.12 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.182.4.1 2009/05/20 21:32:53 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.182.4.12 2010/02/15 17:02:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,21 @@ 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; +} + ############################################## ############################################## @@ -76,13 +91,13 @@ Successful completion of an operation me sub confirm_success { my ($message,$failure)=@_; if ($failure) { - return ''."\n" - .' '."\n" + return ''."\n" + .''.&mt('Error').' '."\n" .$message."\n" .''."\n"; } else { return ''."\n" - .' '."\n" + .''.&mt('OK').' '."\n" .$message."\n" .''."\n"; } @@ -130,11 +145,13 @@ sub dragmath_js { my ($popup) = @_; return < + // ENDDRAGMATHJS @@ -220,6 +237,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'; @@ -416,8 +436,8 @@ sub date_setter { ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($currentvalue); } unless ($wasdefined) { - ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($now); if (($defhour) || ($defmin) || ($defsec)) { + ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($now); $sec=($defsec?$defsec:0); $min=($defmin?$defmin:0); $hour=($defhour?$defhour:0); @@ -430,6 +450,7 @@ sub date_setter { my $result = "\n\n"; $result .= < +// ENDJS $result .= ' '; @@ -501,23 +523,23 @@ ENDJS unshift(@Months,'If you can read this an error occurred'); if ($includeempty) { $monthselector.=""; } for(my $m = 1;$m <=$#Months;$m++) { - $monthselector .= qq{