[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 11 Apr 2005 01:07:26 -0000


raeburn		Sun Apr 10 21:07:26 2005 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Simplify rewriting of $resource->symb for bulletinboards. More use of &wrap_symb() and &dewrapper().
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.158 loncom/interface/lonfeedback.pm:1.159
--- loncom/interface/lonfeedback.pm:1.158	Thu Apr  7 03:34:52 2005
+++ loncom/interface/lonfeedback.pm	Sun Apr 10 21:07:26 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.158 2005/04/07 07:34:52 albertel Exp $
+# $Id: lonfeedback.pm,v 1.159 2005/04/11 01:07:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2866,9 +2866,9 @@
     my @allres=$navmap->retrieveResources();
     foreach my $resource (@allres) {
         if ($resource->hasDiscussion()) {
-            my $ressymb;
-            if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {
-                $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
+            my $ressymb = $resource->symb();
+            if ($resource->symb() =~ m-(___adm/\w+/\w+/)(\d+)(/bulletinboard)$-) {
+                $ressymb = 'bulletin___'.$2.$1.$2.$3;
             } else {
                 $ressymb = $resource->symb();
             }
@@ -3030,13 +3030,11 @@
           'twnp' => 'There are currently no resources or bulletin boards with unread discussion postings.'
       );       
       foreach (@resources) {
-# backward compatibility (bulletin boards used to be 'wrapped')
           my $ressymb=$_;
 	  &Apache::lonenc::check_decrypt(\$ressymb);
+# backward compatibility (bulletin boards used to be 'wrapped')
           if ($ressymb =~ m/bulletin___\d+___/) {
-              unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
-                  $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper/|;
-              }
+              $ressymb = &wrap_symb($ressymb);
           }
           my $lastkey = $ressymb.'_lastread';
           $discinfo{$lastkey} = $env{'form.navtime'};
@@ -3258,9 +3256,7 @@
 	  unless ($symb) { $goahead=0; }
       }
       # backward compatibility (bulletin boards used to be 'wrapped')
-      if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {
-	  $feedurl=~s|^/adm/wrapper||;
-      }
+      &dewrapper(\$feedurl);
       if (!$goahead) {
           # Ambiguous Problem Resource
 	  $r->internal_redirect('/adm/ambiguous');