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

raeburn lon-capa-cvs@mail.lon-capa.org
Sun, 03 Dec 2006 05:45:13 -0000


raeburn		Sun Dec  3 00:45:13 2006 EDT

  Modified files:              
    /loncom/interface	lonwhatsnew.pm 
  Log:
  Resource URLs and symbs displayed in handgraded, above threshold and unread discussion tables need to be encrypted, if url encryption was enabled for the resource, and the current user's role does not cause links to be displayed in plain text. 
  
  
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.65 loncom/interface/lonwhatsnew.pm:1.66
--- loncom/interface/lonwhatsnew.pm:1.65	Wed Nov 22 19:15:56 2006
+++ loncom/interface/lonwhatsnew.pm	Sun Dec  3 00:45:13 2006
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.65 2006/11/23 00:15:56 banghart Exp $
+# $Id: lonwhatsnew.pm,v 1.66 2006/12/03 05:45:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -740,6 +740,10 @@
         %{$$ungraded{$symb}} = ();
         %{$$triggered{$symb}} = ();
         $$triggered{$symb}{numparts} = 0;
+        if ($resource->encrypted()) {
+            $$triggered{$symb}{'enclink'} = $resource->link();
+            $$triggered{$symb}{'encsymb'} = $resource->shown_symb();
+        }
         my $title = $resource->compTitle();
         $$res_title{$symb} = $title;
         my $ressymb = $resource->wrap_symb();
@@ -781,6 +785,10 @@
     %{$$unread{$ressymb}} = ();
     $$unread{$ressymb}{'title'} = $title;
     $$unread{$ressymb}{'symb'} = $symb;
+    if ($resource->encrypted()) {
+        $$unread{$ressymb}{'enclink'} = $resource->link();
+        $$unread{$ressymb}{'encsymb'} = $resource->shown_symb();
+    }
     push(@{$newdiscussions}, $ressymb);
     
     $$unread{$ressymb}{'lastpost'} = $resource->last_post_time();
@@ -807,7 +815,11 @@
             if (@ungraded > 0) {
                 $$ungraded{$symb}{count} = scalar(@ungraded);
                 $$ungraded{$symb}{title} = $title;
-                push(@{$tograde}, $symb);
+                if ($resource->encrypted()) {
+                    $$ungraded{$symb}{'enclink'} = $resource->link();
+                    $$ungraded{$symb}{'encsymb'} = $resource->shown_symb();
+                }
+                push(@{$tograde},$symb);
             }
         }
     }
@@ -1145,7 +1157,10 @@
             my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
             my $linkurl=&Apache::lonnet::clutter($url);
             $linkurl .= '?symb='.&escape($res);
-                                                                               
+            if ($$ungraded{$res}{'enclink'}) {
+                $linkurl = 
+                    $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};
+            } 
             $r->print('<tr bgcolor="'.$rowColor.'"><td><a href="'.$linkurl.'"><small>'.$$ungraded{$res}{title}.'</small></a></td><td align="right"><small>'.$$ungraded{$res}{count}.'</small></td></tr>');
             $rowNum ++;
         }
@@ -1215,6 +1230,10 @@
                 $rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"';
             }
             $linkurl .= '?symb='.&escape($res);
+            if ($$triggered{$res}{'enclink'}) {
+                $linkurl = 
+                  $$triggered{$res}{'enclink'}.'?symb='.$$triggered{$res}{'encsymb'};
+            }
             my $css_class = $row%2?'LC_odd_row':'';
             $r->print('<tr class="'.$css_class.'">'.
 		      '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.
@@ -1305,9 +1324,13 @@
             my $forum_title = $$unread{$ressymb}{'title'};
             my $type = 'Resource';
             my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
+            my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb};
             if ($feedurl =~ /bulletinboard/) {
                 $type = 'Bulletin Board';
             }
+            if ($$unread{$ressymb}{'enclink'}) {
+                $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};
+            }
             if ($rowNum %2 == 1) {
                 $rowColor = $rowColor1;
             } else {
@@ -1315,7 +1338,7 @@
             }
             my $lastpost = &Apache::lonnavmaps::timeToHumanString(
                                                $$unread{$ressymb}{'lastpost'});
-            $r->print('<tr bgcolor="'.$rowColor.'"><td><small><a href="'.$feedurl.'?symb='.$$unread{$ressymb}{symb}.'">'.$forum_title.'</a>&nbsp;</td><td><small>'.$type.'&nbsp;</small></td>');
+            $r->print('<tr bgcolor="'.$rowColor.'"><td><small><a href="'.$disclink.'">'.$forum_title.'</a>&nbsp;</td><td><small>'.$type.'&nbsp;</small></td>');
             if ($countunread eq 'on') {
                 my $unreadnum = $$unread{$ressymb}{'unreadcount'};
                 $r->print('<td><small>'.$lastpost.'<small></td><td align="right">'.