--- loncom/interface/lonhtmlcommon.pm 2010/01/22 13:54:06 1.182.4.9
+++ loncom/interface/lonhtmlcommon.pm 2010/03/19 22:34:23 1.182.4.13
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.182.4.9 2010/01/22 13:54:06 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.182.4.13 2010/03/19 22:34:23 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,7 +91,7 @@ Successful completion of an operation me
sub confirm_success {
my ($message,$failure)=@_;
if ($failure) {
- return ''."\n"
+ return ''."\n"
.'
'."\n"
.$message."\n"
.''."\n";
@@ -222,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';
@@ -418,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);
@@ -1050,7 +1068,7 @@ sub Increment_PrgWin {
#
my $str;
if ($min == 0 && $sec > 1) {
- $str = '[_2] seconds';
+ $str = '[_1] seconds';
} elsif ($min == 1 && $sec > 1) {
$str = '1 minute [_2] seconds';
} elsif ($min == 1 && $sec < 2) {
@@ -1136,7 +1154,7 @@ sub crumbs {
my $output='';
unless ($noformat) { $output.='
'; }
$output.=''.$prefix.'/';
- if (($env{'user.adv'}) | ($env{'user.author'})) {
+ if (($env{'user.adv'}) || ($env{'user.author'})) {
my $path=$prefix.'/';
foreach my $dir (split('/',$uri)) {
if (! $dir) { next; }
@@ -1272,7 +1290,7 @@ sub htmlareaselectactive {
my @fields=@_;
unless (&htmlareabrowser()) { return ''; }
if (&htmlareablocked()) { return '
'.&enablelink(@fields); }
- my $output='