[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonhtmlcommon.pm

raeburn raeburn@source.lon-capa.org
Fri, 22 Jan 2010 14:24:16 -0000


raeburn		Fri Jan 22 14:24:16 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Backport: 1.247, 1.249, 1.251, 1.253.  
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.182.4.9 loncom/interface/lonhtmlcommon.pm:1.182.4.10
--- loncom/interface/lonhtmlcommon.pm:1.182.4.9	Fri Jan 22 13:54:06 2010
+++ loncom/interface/lonhtmlcommon.pm	Fri Jan 22 14:24:16 2010
@@ -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.10 2010/01/22 14:24:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,6 +62,21 @@
 use Apache::lonnet;
 use LONCAPA;
 
+sub coursepreflink {
+    my ($text,$category)=@_;
+    if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
+        return '<a href="/adm/courseprefs?phase=display&actions='.$category.'">'.$text.'</a>';
+    } else {
+        return '';
+    }
+}
+
+sub raw_href_to_link {
+    my ($message)=@_;
+    $message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi;
+    return $message;
+}
+
 ##############################################
 ##############################################
 
@@ -222,6 +237,9 @@
 	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<option value='$escaped'>".
 		&unescape((split(/\&/,$recent{$value}))[1]).
 		'</option>';
@@ -1136,7 +1154,7 @@
     my $output='';
     unless ($noformat) { $output.='<br /><tt><b>'; }
     $output.='<font size="'.$size.'">'.$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; }