Diff for /loncom/interface/lonnavmaps.pm between versions 1.397 and 1.398

version 1.397, 2007/01/11 21:09:39 version 1.398, 2007/04/27 17:59:50
Line 85  my %colormap = Line 85  my %colormap =
       $resObj->PARTIALLY_CORRECT      => '#006600'        $resObj->PARTIALLY_CORRECT      => '#006600'
       );        );
 # And a special case in the nav map; what to do when the assignment  # And a special case in the nav map; what to do when the assignment
 # is not yet done and due in less then 24 hours  # is not yet done and due in less than 24 hours
 my $hurryUpColor = "#FF0000";  my $hurryUpColor = "#FF0000";
   
 sub close {  sub close {
Line 238  sub getDescription { Line 238  sub getDescription {
     }      }
 }  }
   
 # Convenience function, so others can use it: Is the problem due in less then  # Convenience function, so others can use it: Is the problem due in less than
 # 24 hours, and still can be done?  # 24 hours, and still can be done?
   
 sub dueInLessThan24Hours {  sub dueInLessThan24Hours {
Line 253  sub dueInLessThan24Hours { Line 253  sub dueInLessThan24Hours {
 }  }
   
 # Convenience function, so others can use it: Is there only one try remaining for the  # Convenience function, so others can use it: Is there only one try remaining for the
 # part, with more then one try to begin with, not due yet and still can be done?  # part, with more than one try to begin with, not due yet and still can be done?
 sub lastTry {  sub lastTry {
     my $res = shift;      my $res = shift;
     my $part = shift;      my $part = shift;
Line 322  sub timeToHumanString { Line 322  sub timeToHumanString {
         my $tense = $inPast ? " ago" : "";          my $tense = $inPast ? " ago" : "";
         my $prefix = $inPast ? "" : "in ";          my $prefix = $inPast ? "" : "in ";
                   
         # Less then a minute          # Less than a minute
         if ( $delta < $minute ) {          if ( $delta < $minute ) {
             if ($delta == 1) { return "${prefix}1 second$tense"; }              if ($delta == 1) { return "${prefix}1 second$tense"; }
             return "$prefix$delta seconds$tense";              return "$prefix$delta seconds$tense";
         }          }
   
         # Less then an hour          # Less than an hour
         if ( $delta < $hour ) {          if ( $delta < $hour ) {
             # If so, use minutes              # If so, use minutes
             my $minutes = floor($delta / 60);              my $minutes = floor($delta / 60);
Line 336  sub timeToHumanString { Line 336  sub timeToHumanString {
             return "$prefix$minutes minutes$tense";              return "$prefix$minutes minutes$tense";
         }          }
                   
         # Is it less then 24 hours away? If so,          # Is it less than 24 hours away? If so,
         # display hours + minutes          # display hours + minutes
         if ( $delta < $hour * 24) {          if ( $delta < $hour * 24) {
             my $hours = floor($delta / $hour);              my $hours = floor($delta / $hour);
Line 362  sub timeToHumanString { Line 362  sub timeToHumanString {
     return $timeStr.&Apache::lonlocal::gettimezone($time);      return $timeStr.&Apache::lonlocal::gettimezone($time);
  }   }
   
         # Less then 5 days away, display day of the week and          # Less than 5 days away, display day of the week and
         # HH:MM          # HH:MM
   
         if ( $delta < $day * 5 ) {          if ( $delta < $day * 5 ) {
Line 427  to compute due to the amount of data tha Line 427  to compute due to the amount of data tha
 processed.  processed.
   
 Apache::lonnavmaps provides an object model for manipulating this  Apache::lonnavmaps provides an object model for manipulating this
 information in a higher-level fashion then directly manipulating   information in a higher-level fashion than directly manipulating 
 the hash. It also provides access to several auxilary functions   the hash. It also provides access to several auxilary functions 
 that aren't necessarily stored in the Big Hash, but are a per-  that aren't necessarily stored in the Big Hash, but are a per-
 resource sort of value, like whether there is any feedback on   resource sort of value, like whether there is any feedback on 
Line 473  Apache::lonnavmaps::render({}). Line 473  Apache::lonnavmaps::render({}).
 =head2 Overview of Columns  =head2 Overview of Columns
   
 The renderer will build an HTML table for the navmap and return  The renderer will build an HTML table for the navmap and return
 it. The table is consists of several columns, and a row for each  it. The table consists of several columns, and a row for each
 resource (or possibly each part). You tell the renderer how many  resource (or possibly each part). You tell the renderer how many
 columns to create and what to place in each column, optionally using  columns to create and what to place in each column, optionally using
 one or more of the prepared columns, and the renderer will assemble  one or more of the prepared columns, and the renderer will assemble
Line 2197  the given map. This is one of the proper Line 2197  the given map. This is one of the proper
   
 # The strategy here is to cache the resource objects, and only construct them  # The strategy here is to cache the resource objects, and only construct them
 # as we use them. The real point is to prevent reading any more from the tied  # as we use them. The real point is to prevent reading any more from the tied
 # hash then we have to, which should hopefully alleviate speed problems.  # hash than we have to, which should hopefully alleviate speed problems.
   
 sub getById {  sub getById {
     my $self = shift;      my $self = shift;
Line 2398  sub parmval_real { Line 2398  sub parmval_real {
 =item * B<getResourceByUrl>(url,multiple):  =item * B<getResourceByUrl>(url,multiple):
   
 Retrieves a resource object by URL of the resource, unless the optional  Retrieves a resource object by URL of the resource, unless the optional
 multiple parameter is included in wahich caes an array of resource   multiple parameter is included in which case an array of resource 
 objects is returned. If passed a resource object, it will simply return    objects is returned. If passed a resource object, it will simply return  
 it, so it is safe to use this method in code like  it, so it is safe to use this method in code like
 "$res = $navmap->getResourceByUrl($res)"  "$res = $navmap->getResourceByUrl($res)"
Line 2433  all matching resources. Line 2433  all matching resources.
   
 =item * B<hasResource>(map, filterFunc, recursive, showall):  =item * B<hasResource>(map, filterFunc, recursive, showall):
   
 Convience method for  Convenience method for
   
  scalar(retrieveResources($map, $filterFunc, $recursive, 1, $showall)) > 0   scalar(retrieveResources($map, $filterFunc, $recursive, 1, $showall)) > 0
   
Line 2667  be the tokens described above. Line 2667  be the tokens described above.
   
 Also note there is some old code floating around that trys to track  Also note there is some old code floating around that trys to track
 the depth of the iterator to see when it's done; do not copy that   the depth of the iterator to see when it's done; do not copy that 
 code. It is difficult to get right and harder to understand then  code. It is difficult to get right and harder to understand than
 this. They should be migrated to this new style.  this. They should be migrated to this new style.
   
 =cut  =cut
Line 2952  sub next { Line 2952  sub next {
     }      }
   
     # Is this the end of a branch? If so, all of the resources examined above      # Is this the end of a branch? If so, all of the resources examined above
     # led to lower levels then the one we are currently at, so we push a END_BRANCH      # led to lower levels than the one we are currently at, so we push a END_BRANCH
     # marker onto the stack so we don't forget.      # marker onto the stack so we don't forget.
     # Example: For the usual A(BC)(DE)F case, when the iterator goes down the      # Example: For the usual A(BC)(DE)F case, when the iterator goes down the
     # BC branch and gets to C, it will see F as the only next resource, but it's      # BC branch and gets to C, it will see F as the only next resource, but it's
Line 3288  X<symb> X<resource, symb> Line 3288  X<symb> X<resource, symb>
 All resources also have B<symb>s, which uniquely identify a resource  All resources also have B<symb>s, which uniquely identify a resource
 in a course. Many internal LON-CAPA functions expect a symb. A symb  in a course. Many internal LON-CAPA functions expect a symb. A symb
 carries along with it the URL of the resource, and the map it appears  carries along with it the URL of the resource, and the map it appears
 in. Symbs are much larger then resource IDs.  in. Symbs are much larger than resource IDs.
   
 =cut  =cut
   
Line 3665  sub map_type { Line 3665  sub map_type {
   
 # These functions will be responsible for returning the CORRECT  # These functions will be responsible for returning the CORRECT
 # VALUE for the parameter, no matter what. So while they may look  # VALUE for the parameter, no matter what. So while they may look
 # like direct calls to parmval, they can be more then that.  # like direct calls to parmval, they can be more than that.
 # So, for instance, the duedate function should use the "duedatetype"  # So, for instance, the duedate function should use the "duedatetype"
 # information, rather then the resource object user.  # information, rather than the resource object user.
   
 =pod  =pod
   

Removed from v.1.397  
changed lines
  Added in v.1.398


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>