[LON-CAPA-cvs] cvs: loncom /html/adm/help/tex NavMaps_MarkPosts_Read.tex /interface lonfeedback.pm lonnavmaps.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 09 Jul 2004 23:05:53 -0000


This is a MIME encoded message

--raeburn1089414353
Content-Type: text/plain

raeburn		Fri Jul  9 19:05:53 2004 EDT

  Added files:                 
    /loncom/html/adm/help/tex	NavMaps_MarkPosts_Read.tex 

  Modified files:              
    /loncom/interface	lonnavmaps.pm lonfeedback.pm 
  Log:
  1 - Single click to remove all speech bubbles from NavMap.
  2 - Suppress display of link to open empty folder in NavMap
  
  
--raeburn1089414353
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20040709190553.txt"

Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.265 loncom/interface/lonnavmaps.pm:1.266
--- loncom/interface/lonnavmaps.pm:1.265	Sat Jul  3 16:45:23 2004
+++ loncom/interface/lonnavmaps.pm	Fri Jul  9 19:05:51 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.265 2004/07/03 20:45:23 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.266 2004/07/09 23:05:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -971,7 +971,7 @@
         $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
     }
 
-    if (!$params->{'resource_nolink'} && !$resource->is_sequence()) {
+    if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
         $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>";
     } else {
         $result .= "  $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>";
@@ -1369,9 +1369,41 @@
                 "&here=" . Apache::lonnet::escape($here) . 
                 "\">".&mt('Open All Folders')."</a>";
         }
-        $result .= "<br /><br />\n";
-    }    
+        $result .= "\n";
+    }
 
+    # Check for any unread discussions in all resources.
+    my $totdisc = 0;
+    my $haveDisc = '';
+    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';
+            } else {
+                $ressymb = $resource->symb();
+            }
+            $haveDisc .= $ressymb.':';
+            $totdisc ++;
+        }
+    }
+    if ($totdisc > 0) {
+        $haveDisc =~ s/:$//;
+        my %lt = &Apache::lonlocal::texthash(
+           'mapr' => 'Mark all posts read',
+           );
+        $result .= (<<END);
+&nbsp;&nbsp;&nbsp;<a href="javascript:document.clearbubbles.submit()">$lt{'mapr'}</a>&nbsp;<a href="javascript:void(open('/adm/help/NavMaps_MarkPosts_Read.hlp', 'Help_for_NavMaps_MarkPosts', 'menubar=0,toolbar=1,scrollbars=1,width=350,height=400,resizable=yes'))" title="Online Help"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: NavMaps_MarkPostsLink)" /></a>
+<form name="clearbubbles" method="post" action="/adm/feedback">
+<input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" />
+<input type="hidden" name="navmaps" value="$haveDisc" />
+</form>
+END
+    } else {
+        $result .= '<br />';
+    }
+    $result .= "<br />\n";
     if ($r) {
         $r->print($result);
         $r->rflush();
@@ -1942,7 +1974,7 @@
 # backward compatibility (bulletin boards used to be 'wrapped')
     my $ressymb = $symb;
     if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) {
-        unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
+        unless ($ressymb =~ m|adm/wrapper/adm|) {
             $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
         }
     }
@@ -1950,7 +1982,8 @@
     if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) {
         return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb};
     } else {
-        return $self->{DISCUSSION_TIME}->{$ressymb} >  $self->{LAST_CHECK};
+#        return $self->{DISCUSSION_TIME}->{$ressymb} >  $self->{LAST_CHECK}; # v.1.1 behavior 
+        return $self->{DISCUSSION_TIME}->{$ressymb} >  0; # in 1.2 will display speech bubble icons for all items with posts until marked as read (even if read in v 1.1).
     }
 }
 
@@ -3254,6 +3287,12 @@
     return 0;
 }
 
+sub is_empty_sequence {
+    my $self=shift;
+    my $src = $self->src();
+    return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc());
+}
+
 # Private method: Shells out to the parmval in the nav map, handler parts.
 sub parmval {
     my $self = shift;
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.98 loncom/interface/lonfeedback.pm:1.99
--- loncom/interface/lonfeedback.pm:1.98	Mon Jul  5 18:54:33 2004
+++ loncom/interface/lonfeedback.pm	Fri Jul  9 19:05:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.98 2004/07/05 22:54:33 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.99 2004/07/09 23:05:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -382,7 +382,7 @@
 		    $discussion .= '&previous='.$prevread;
 		}
 		$discussion .='">'.&mt('Chronological View').'</a>&nbsp;&nbsp;</td>';
-	    } 
+	    }
 	    if ($newpostsflag) {
 		if (!$markondisp) {
 		    $discussion .='<td align="right"><a href="/adm/feedback?markread='.$ressymb.'">'.&mt('Mark new posts as read').'</a>&nbsp;&nbsp;';
@@ -1136,8 +1136,55 @@
 # --------------------------- Get query string for limited number of parameters
 
   &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-         ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp','modifydisp','changes']);
-  if ($ENV{'form.modifydisp'}) {
+         ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp','modifydisp','changes','navmaps','navurl']);
+  if ($ENV{'form.navmaps'}) {
+      my %discinfo = ();
+      my @resources = ();
+      if ($ENV{'form.navmaps'} =~ /:/) {
+          @resources = split/:/,$ENV{'form.navmaps'};
+      } else {
+          @resources = ("$ENV{'form.navmaps'}");
+      }
+      my $numitems = @resources;
+      my $feedurl = '/adm/navmaps';
+      if ($ENV{'form.navurl'}) {
+          $feedurl .= '?'.$ENV{'form.navurl'};
+      }
+      my %lt = &Apache::lonlocal::texthash(
+          'mnpa' => 'Marked "New" posts as read in a total of',
+          'robb' => 'resources/bulletin boards.'
+      );       
+      foreach (@resources) {
+# backward compatibility (bulletin boards used to be 'wrapped')
+          my $ressymb=$_;
+          if ($ressymb =~ m/bulletin___\d+___/) {
+              unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
+                  $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper/|;
+              }
+          }
+          my $lastkey = $ressymb.'_lastread';
+          $discinfo{$lastkey} = time;
+      }
+      &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
+      &Apache::loncommon::content_type($r,'text/html');
+      $r->send_http_header;
+      $r->print (<<ENDREDIR);
+<html>
+<head>
+<title>New posts marked as read</title>
+<meta http-equiv="pragma" content="no-cache" />
+<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" />
+</head>
+<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'>
+<img align="right" src="/adm/lonIcons/lonlogos.gif" />
+<b>$lt{'mnpa'} $numitems $lt{'robb'}</b>
+<form name="reldt" action="$feedurl" target="loncapaclient">
+</form>
+</body>
+</html>
+ENDREDIR
+      return OK;
+  } elsif ($ENV{'form.modifydisp'}) {
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
       my $symb=$ENV{'form.modifydisp'};

Index: loncom/html/adm/help/tex/NavMaps_MarkPosts_Read.tex
+++ loncom/html/adm/help/tex/NavMaps_MarkPosts_Read.tex
\label{NavMaps_MarkPosts_Read}

The presence of a \textbf{'Mark all posts read'} link at the  
top of the navigation page indicates that at least 
one bulletin board or resource contains 'New' discussion 
posts. If your course contains folders, use 'Open All Folders'
to assist you in identifying which items contain 'New' posts. 
Speech bubbles adjacent to an item title, indicate 'New'    
posts for that item, can be removed in one of two ways:

(a) Use the \textbf{Mark all posts read} link on the course navigation
page to remove the 'New' label from \textbf{all} posts in your course, and to
remove all speech bubble icons from the navigation page with a single click.

(b) Click each speech bubble in turn to display discussion posts 
for an individual resource or bulletin board. 'New' posts within a single 
discussion cease to be 'New' when marked as read, or when displayed, 
depending on the display settings for the specific discussion. The 
speech bubble will disappear for a specific discussion when there are
no longer any 'New' posts.

--raeburn1089414353--