--- loncom/interface/lonhtmlcommon.pm 2009/11/23 14:04:37 1.248
+++ loncom/interface/lonhtmlcommon.pm 2009/12/22 06:02:44 1.256
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.248 2009/11/23 14:04:37 wenzelju Exp $
+# $Id: lonhtmlcommon.pm,v 1.256 2009/12/22 06:02:44 faziophi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,6 +72,12 @@ sub coursepreflink {
}
}
+sub raw_href_to_link {
+ my ($message)=@_;
+ $message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/$1<\/tt><\/a>$2/gi;
+ return $message;
+}
+
##############################################
##############################################
@@ -232,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';
@@ -1127,47 +1136,45 @@ sub r_print {
# ------------------------------------------------------- Puts directory header
sub crumbs {
- my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_;
- if (! defined($size)) {
- $size = '+2';
- }
+ my ($uri,$target,$prefix,$form,$skiplast)=@_;
if ($target) {
$target = ' target="'.
&Apache::loncommon::escape_single($target).'"';
}
- my $output='';
- unless ($noformat) { $output.='
'; }
- $output.=''.$prefix.'/';
- if (($env{'user.adv'}) | ($env{'user.author'})) {
- my $path=$prefix.'/';
- foreach my $dir (split('/',$uri)) {
+ my $output='';
+ $output.=$prefix.'/';
+ if (($env{'user.adv'}) || ($env{'user.author'})) {
+ my $path=$prefix.'/';
+ foreach my $dir (split('/',$uri)) {
if (! $dir) { next; }
$path .= $dir;
- if ($path eq $uri) {
- if ($skiplast) {
- $output.=$dir;
+ if ($path eq $uri) {
+ if ($skiplast) {
+ $output.=$dir;
last;
- }
- } else {
- $path.='/';
- }
+ }
+ } else {
+ $path.='/';
+ }
my $href_path = &HTML::Entities::encode($path,'<>&"');
- &Apache::loncommon::inhibit_menu_check(\$href_path);
- if ($form) {
- my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
- $output.=qq{$dir/};
- } else {
- $output.=qq{$dir/};
- }
- }
+ &Apache::loncommon::inhibit_menu_check(\$href_path);
+ if ($form) {
+ my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
+ $output.=qq{$dir/};
+ } else {
+ $output.=qq{$dir/};
+ }
+ }
} else {
- foreach my $dir (split('/',$uri)) {
+ foreach my $dir (split('/',$uri)) {
if (! $dir) { next; }
- $output.=$dir.'/';
- }
+ $output.=$dir.'/';
+ }
}
if ($uri !~ m|/$|) { $output=~s|/$||; }
- return $output.''.($noformat?'':'
');
+ $output.='';
+
+ return $output;
}
# --------------------- A function that generates a window for the spellchecker
@@ -1234,11 +1241,18 @@ ENDLINK
}
sub htmlareaheaders {
- return if (&htmlareablocked());
- return if (!&htmlareabrowser());
- return (<
-ENDHEADERS
+
+ENDEDITOR
+ }
+ $s.=(<
+
+ENDJQUERY
+ return $s;
}
# ----------------------------------------------------------------- Preferences
@@ -1277,16 +1291,98 @@ sub htmlareaselectactive {
my $output='