[LON-CAPA-cvs] cvs: loncom / LONCAPA.pm /interface lonaboutme.pm lonrss.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 09 Dec 2006 23:33:59 -0000


albertel		Sat Dec  9 18:33:59 2006 EDT

  Modified files:              
    /loncom/interface	lonrss.pm lonaboutme.pm 
    /loncom	LONCAPA.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - change the is_course checkign and get both lonaboutme and lonrss to use the same one
  
  
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.31 loncom/interface/lonrss.pm:1.32
--- loncom/interface/lonrss.pm:1.31	Mon Dec  4 17:10:28 2006
+++ loncom/interface/lonrss.pm	Sat Dec  9 18:33:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # RSS Feeder
 #
-# $Id: lonrss.pm,v 1.31 2006/12/04 22:10:28 albertel Exp $
+# $Id: lonrss.pm,v 1.32 2006/12/09 23:33:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -29,7 +29,7 @@
 package Apache::lonrss;
 
 use strict;
-use LONCAPA qw(:DEFAULT :match);
+use LONCAPA;
 use Apache::Constants qw(:common);
 use Apache::loncommon;
 use Apache::lonnet;
@@ -288,7 +288,7 @@
     my $feedname=&feedname($filename);
     my ($displayfeedname,$displayoption)=&displayfeedname($filename,$uname,$udom);
     my ($blocked,$blocktext);
-    if ($uname !~ /^$match_courseid$/) {
+    if (!&Apache::lonnet::is_course($udom,$uname)) {
         ($blocked,$blocktext) = &blocking_blogdisplay($uname,$udom,$html,$filterfeedname);
     }
     if ($html) {
@@ -347,7 +347,7 @@
     } else { # is indeed a user
 # Course or user?
 	my $name='';
-	if ($uname =~ /^$match_courseid$/) {
+	if (&Apache::lonnet::is_course($udom,$uname)) {
 	    my %cenv=&Apache::lonnet::dump('environment',$udom,$uname);
 	    $name=$cenv{'description'};
 	} else {
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.57 loncom/interface/lonaboutme.pm:1.58
--- loncom/interface/lonaboutme.pm:1.57	Mon Oct 23 14:48:46 2006
+++ loncom/interface/lonaboutme.pm	Sat Dec  9 18:33:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.57 2006/10/23 18:48:46 albertel Exp $
+# $Id: lonaboutme.pm,v 1.58 2006/12/09 23:33:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -57,7 +57,7 @@
 					      'No user information available');
         return OK;
     } else {
-        $is_course = &check_for_course($cdom,$cnum);
+        $is_course = &is_course($cdom,$cnum);
     }
 
 # --------------------------------------------------------- The syllabus fields
@@ -629,15 +629,5 @@
     return $output;
 }
 
-sub check_for_course {
-    my ($cdom,$cnum) = @_;
-    my %courses = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,undef,
-                                                undef,'.');
-    if (exists($courses{$cdom.'_'.$cnum})) {
-        return 1;
-    }
-    return 0;
-}
-
 1;
 __END__
Index: loncom/LONCAPA.pm
diff -u loncom/LONCAPA.pm:1.18 loncom/LONCAPA.pm:1.19
--- loncom/LONCAPA.pm:1.18	Wed Dec  6 17:22:36 2006
+++ loncom/LONCAPA.pm	Sat Dec  9 18:33:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Base routines
 #
-# $Id: LONCAPA.pm,v 1.18 2006/12/06 22:22:36 albertel Exp $
+# $Id: LONCAPA.pm,v 1.19 2006/12/09 23:33:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -122,10 +122,6 @@
 
 $match_courseid     = $LONCAPA::courseid_re     = qr{\d[\w\-.]+};
 $match_not_courseid = $LONCAPA::not_courseid_re = qr{[^\w\-.]+};
-sub is_courseid {
-    my ($courseid) = @_;
-    return ($courseid =~ m/^$match_courseid$/);
-}
 
 $match_name         = $LONCAPA::name = qr{$match_username|$match_courseid};
 sub clean_name {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.812 loncom/lonnet/perl/lonnet.pm:1.813
--- loncom/lonnet/perl/lonnet.pm:1.812	Mon Dec  4 11:24:11 2006
+++ loncom/lonnet/perl/lonnet.pm	Sat Dec  9 18:33:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.812 2006/12/04 16:24:11 raeburn Exp $
+# $Id: lonnet.pm,v 1.813 2006/12/09 23:33:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4931,6 +4931,16 @@
     return '/'.$udom.'/'.$uname;
 }
 
+sub is_course {
+    my ($cdom,$cnum) = @_;
+    my %courses = &courseiddump($cdom,'.',1,'.','.',$cnum,undef,
+				undef,'.');
+    if (exists($courses{$cdom.'_'.$cnum})) {
+        return 1;
+    }
+    return 0;
+}
+
 # ---------------------------------------------------------- Assign Custom Role
 
 sub assigncustomrole {