Diff for /loncom/interface/lonblockingmenu.pm between versions 1.19 and 1.29

version 1.19, 2016/10/16 21:49:51 version 1.29, 2021/01/02 21:07:36
Line 116  Outputs: 2 Line 116  Outputs: 2
     $readonly - true if modification of blocking events is prohibited.      $readonly - true if modification of blocking events is prohibited.
   
     $allowed  - true if blocking events information can be shown.      $allowed  - true if blocking events information can be shown.
    
   
 =item &get_timed_items()  =item &get_timed_items()
   
Line 252  Inputs: 8 Line 252  Inputs: 8
       - $blockcount - number of existing blocking events in course        - $blockcount - number of existing blocking events in course
   
       - $readonly - if true, modification not allowed.        - $readonly - if true, modification not allowed.
    
   
 Output: None  Output: None
   
Line 318  Creates web form elements used to select Line 318  Creates web form elements used to select
 items in the course for use in an exam block of type: "Triggered by   items in the course for use in an exam block of type: "Triggered by 
 Activating Timer".  Activating Timer".
   
 Inputs: 7 (three required, last four optional)  Inputs: 8 (four required, last four optional)
    - $intervals - Reference to hash of parameters for timed intervals     - $intervals - Reference to hash of parameters for timed intervals
   
    - $parmcount - numeric ID of current block     - $parmcount - numeric ID of current block
   
    - $navmap - navmaps object     - $navmap - navmaps object
   
      - $context - this will be "accesstimes" if called by lonaccesstimes.pm,
                   or "blocking" if called internally by lonblockingmenu.pm
   
    - $currkey - current interval (where this is a block already using     - $currkey - current interval (where this is a block already using
                 an interval-based trigger).                    an interval-based trigger).  
   
Line 339  Inputs: 7 (three required, last four opt Line 342  Inputs: 7 (three required, last four opt
 Outputs: 1 - $intervalform - web form elements used to select a time interval  Outputs: 1 - $intervalform - web form elements used to select a time interval
   
   
   =item &interval_details()
   
   Creates name/scope of current interval and expandable/collapsible
   showing which interval parameters apply to the current folder/resource
   
   Inputs: 6
   
       - $item - course, map url, or resource symb
   
       - $type - course, map, or resource
   
       - $url  - url of item (null if item is course).
   
       - $navmap - navmaps object
   
       - $intervals - Reference to hash of parameters for timed intervals
   
       - $parmcount - unique ID for current element.
   
   
   Outputs: 2
   
      - $itemname - name/scope of interval (timer) parameter
   
      - $iteminfo - Expandable/collapsible block showing which interval
                    (timer) parameters affect the current folder or resource.
   
   
 =item &trigger_details_toggle()  =item &trigger_details_toggle()
     
 Creates link used to expand item showing information about timer for current  Creates link used to expand item showing information about timer for current
Line 348  Inputs: 1 - $parmcount - numericID of ex Line 379  Inputs: 1 - $parmcount - numericID of ex
   
 Outputs: 1 - returns HTML for link to display contents of information item   Outputs: 1 - returns HTML for link to display contents of information item 
   
   
 =item &show_timer_path()  =item &show_timer_path()
   
 Display hierarchy of names of folders/sub-folders containing the current  Display hierarchy of names of folders/sub-folders containing the current
Line 392  Output: 1 - Javascript (with <script></s Line 424  Output: 1 - Javascript (with <script></s
   
 =item *  for action to take -- add or modify block  =item *  for action to take -- add or modify block
   
 =item *  for display of detailed information about intervals   
   
 =back  =back
   
   
 =back    =item &details_javascript()
   
   Create Javascript to toggle visibility of unordered list item
   containing details about item with timed interval parameter.
   
   Inputs: none
   
   Output: 1 Javascript (with <script></script> tags) for functions used to:
             toggle visibility of unordered list for display of detailed
             information about intervals.
   
   =back
   
 =cut  =cut
   
Line 486  sub handler { Line 527  sub handler {
             $r->print(&Apache::loncourserespicker::create_picker($navmap,              $r->print(&Apache::loncourserespicker::create_picker($navmap,
                                      'examblock','resourceblocks',$crstype,                                       'examblock','resourceblocks',$crstype,
                                      \%blockedmaps,\%blockedresources,                                       \%blockedmaps,\%blockedresources,
                                      $env{'form.block'},'','',undef,$readonly));                                       $env{'form.block'},'','',undef,undef,$readonly));
         } else {          } else {
             $r->print($errormsg);              $r->print($errormsg);
         }          }
Line 520  sub handler { Line 561  sub handler {
         ({href=>'/adm/setblock',          ({href=>'/adm/setblock',
           text=>'Blocking communication/content access'});            text=>'Blocking communication/content access'});
   
     my $js = &blockingmenu_javascript($blockcount);      my $js = &blockingmenu_javascript($blockcount).
                &details_javascript();
   
     $r->print(      $r->print(
         &Apache::loncommon::start_page('Blocking communication/content access',$js).          &Apache::loncommon::start_page('Blocking communication/content access',$js).
Line 536  sub handler { Line 578  sub handler {
     my %lt=&Apache::lonlocal::texthash (      my %lt=&Apache::lonlocal::texthash (
             'cbds' => 'Blocking communication and/or content access during exams',              'cbds' => 'Blocking communication and/or content access during exams',
             'prev' => "For the duration of an exam, or a timed quiz, students in this course can be prevented from:",              'prev' => "For the duration of an exam, or a timed quiz, students in this course can be prevented from:",
               'flow' => "For the duration of an exam, or a timed quiz, event-driven interruptions to a student's workflow can be suppressed:",
             'blca' => "Blocks can potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA $lctype.",              'blca' => "Blocks can potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA $lctype.",
             'pobl' => "Portfolio blocking can impact a student's ability to complete assignments in courses besides your own. Please use this feature wisely.",              'pobl' => "Portfolio blocking can impact a student's ability to complete assignments in courses besides your own. Please use this feature wisely.",
             'actt' => "Action to take:",              'actt' => "Action to take:",
Line 575  sub handler { Line 618  sub handler {
             '<ul>'."\n".              '<ul>'."\n".
             '<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n".              '<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n".
             '<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n".              '<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n".
             '<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n".              '<li>'.&mt('accessing content in LON-CAPA portfolios, blogs, or user information pages').'</li>'."\n".
             '<li>'.&mt("generating printouts of $lctype content").'</li>'.              '<li>'.&mt("generating printouts of $lctype content").'</li>'.
               '<li>'.&mt("displaying the LON-CAPA gradebook in the $lctype").'</li>'.
               '<li>'.&mt("searching $lctype content by keyword").'</li>'.  
             '<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.              '<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.
             '<li>'.&mt("changing user's own password").'</li>'.              '<li>'.&mt("changing user's own password").'</li>'.
             '</ul>'.              '</ul>'.
               $lt{'flow'}.
               '<ul>'."\n".
               '<li>'.&mt("re-initialization of cached course structure, when a change has been made to $lctype content by a Coordinator").'</li>'.
               '<li>'.&mt('display of Critical Messages when navigation arrows used to move to the adjacent resource').'</li>'.
               '</ul>'.
             '<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>'              '<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>'
         );          );
     }      }
   
 # ------------------------ Choose between modifying existing block or adding new  # ------------------------ Choose between modifying existing block or adding new
     $r->print('<form name="blockform" method="post" action="/adm/setblock?action=store">');      $r->print('<form name="blockform" method="post" action="/adm/setblock?action=store">');
       
     unless ($readonly) {       unless ($readonly) {
         if ($blockcount > 0) {          if ($blockcount > 0) {
             $r->print(<<"END");              $r->print(<<"END");
 <div class="LC_left_float">  <div class="LC_left_float">
Line 616  END Line 666  END
         &Apache::loncourserespicker::get_navmap_object($crstype,'examblock');          &Apache::loncourserespicker::get_navmap_object($crstype,'examblock');
   
 # --------------------------------------------- Interface for adding a new block  # --------------------------------------------- Interface for adding a new block
     if ($readonly) {      unless ($readonly) {
         if (!$blockcount) {  
             $r->print($lt{'ncbc'}.'<br />');  
         }  
     } else {  
         &display_addblocker_table($r,$blockcount,\%ltext,\%intervals,          &display_addblocker_table($r,$blockcount,\%ltext,\%intervals,
                                   $navmap,$errormsg);                                    $navmap,$errormsg);
         if ($blockcount > 0) {          if ($blockcount > 0) {
             $r->print('</div>');              $r->print('</div>');
         }          }
     }      }
   
 # ------------------------------------------------ Interface for existing blocks  # ------------------------------------------------ Interface for existing blocks
     if ($blockcount > 0) {      if (!$blockcount) {
           if ($readonly) {
               $r->print($lt{'ncbc'}.'<br />');
           }
       } else {
         &display_blocker_status($r,\%records,\%ltext,\%intervals,          &display_blocker_status($r,\%records,\%ltext,\%intervals,
                                 $navmap,$errormsg,$blockcount,$readonly);                                  $navmap,$errormsg,$blockcount,$readonly);
     }      }
Line 678  sub get_timed_items { Line 727  sub get_timed_items {
     my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom);      my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom);
     if (ref($resourcedata) eq 'HASH') {      if (ref($resourcedata) eq 'HASH') {
         foreach my $key (keys(%{$resourcedata})) {          foreach my $key (keys(%{$resourcedata})) {
             if ($key =~ /^\Q$cid\E(.+)\.0\.interval$/) {              if ($key =~ /^\Q$cid\E(.*)\.0\.interval$/) {
                 my $middle = $1;                  my $middle = $1;
                 if ($middle eq '') {                  if ($middle eq '') {
                     $intervals{'course'}{'all'} = $resourcedata->{$key};                      $intervals{'course'}{'all'} = $resourcedata->{$key};
Line 836  sub blockstore { Line 885  sub blockstore {
                                            &escape($env{'form.title_'.$key})).'<br />';                                             &escape($env{'form.title_'.$key})).'<br />';
                         }                          }
                     }                      }
                       if ($blocktypes->{'alert'} eq 'on') {
                           ($status,$needsrelease) = &check_release_required('alert',$chomemajor,$chomeminor);
                           if ($status eq 'fail') {
                               $blocktypes->{'alert'} = 'off';
                               $output .= '<p class="LC_warning">'.
                                          &mt('Message Alert blocking not allowed for [_1]',
                                              &escape($env{'form.title_'.$key})).'<br />';
                           }
                       }
                       if ($blocktypes->{'reinit'} eq 'on') {
                           ($status,$needsrelease) = &check_release_required('reinit',$chomemajor,$chomeminor);
                           if ($status eq 'fail') {
                               $blocktypes->{'reinit'} = 'off';
                               $output .= '<p class="LC_warning">'.
                                          &mt('Course Re-initialization blocking not allowed for [_1]',
                                              &escape($env{'form.title_'.$key})).'<br />';
                           }
                       }
                 }                  }
                 if ($blockdocs) {                  if ($blockdocs) {
                     ($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor);                      ($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor);
Line 1094  ACT Line 1161  ACT
                       $ltext->{'endd'}.':&nbsp;&nbsp;'.$endform.'</fieldset></td>');                        $ltext->{'endd'}.':&nbsp;&nbsp;'.$endform.'</fieldset></td>');
         } elsif ($record =~ /^firstaccess____(.+)$/) {          } elsif ($record =~ /^firstaccess____(.+)$/) {
             my $item = $1;              my $item = $1;
             my ($itemname,$iteminfo,$skipdetails);  
             my $type = 'map';              my $type = 'map';
             my $url;              my $url;
             if ($item eq 'course') {              if ($item eq 'course') {
Line 1106  ACT Line 1172  ACT
                 $url = $item;                  $url = $item;
             }              }
             $r->print('<td><fieldset><legend>'.$ltext->{'trig'}.'</legend>');              $r->print('<td><fieldset><legend>'.$ltext->{'trig'}.'</legend>');
             if ($type eq 'course') {              my ($itemname,$iteminfo) = &interval_details($item,$type,$url,$navmap,$intervals,$parmcount);
                 $itemname = &mt('Timer for all items in course.');              $r->print(&create_interval_form($intervals,$parmcount,$navmap,'blocking',$item,$jschg,
             } else {  
                 if (&Apache::lonnet::is_on_map($url)) {   
                     if ($type eq 'map') {  
                         if (ref($navmap)) {  
                             my $title;  
                             my $resobj = $navmap->getResourceByUrl($item);  
                             if (ref($resobj)) {   
                                 $title = $resobj->compTitle();  
                             } else {  
                                 $title = &Apache::lonnet::gettitle($item);  
                             }  
                             $itemname = &mt('Timer for all items in folder: [_1]',  
                                             '<span style="font-style:italic">'.  
                                             $title.'</span>');  
                         }  
                     } else {  
                         if (ref($navmap)) {  
                             my $title;  
                             my $resobj = $navmap->getBySymb($item);  
                             if (ref($resobj)) {  
                                 $title = $resobj->compTitle();  
                             } else {  
                                 $title = &Apache::lonnet::gettitle($item);  
                             }  
                             $itemname = &mt('Timer for resource: [_1]',  
                                              '<span style="font-style:italic">'.  
                                              $title.'</span>');  
                         }  
                     }  
                     if (ref($navmap)) {  
                         my $path = &show_timer_path($type,$item);  
                         if ($path) {  
                             $iteminfo  = ' <span style="font-size:90%;">'.  
                                          &mt('(in: [_1])',$path).  
                                          '</span>';  
                         }  
                     }  
                 } else {  
                     $skipdetails = 1;  
                     $itemname = '<span style="LC_warning">'.  
                                 &mt('Timer folder/resource not in course').  
                                 '</span>';    
                 }  
             }  
             if ((!$skipdetails) && (ref($intervals) eq 'HASH')) {  
                 if (ref($intervals->{$type}) eq 'HASH') {  
                     $iteminfo .= &trigger_details_toggle($parmcount).  
                                 '<ul id="trigdetails_'.$parmcount.'" style="display:none">';  
                     if ($type eq 'course') {  
                         foreach my $scope (keys(%{$intervals->{$type}})) {  
                             if ($scope eq 'all') {  
                                 $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',  
                                          &convlim($intervals->{$type}->{$scope})).'</li>';  
                             } elsif ($scope eq 'secgrp') {  
                                 if (ref($intervals->{$type}->{$scope}) eq 'HASH') {  
                                     $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';  
                                     foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {  
                                         $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$item,  
                                                      &convlim($intervals->{$type}->{$scope}->{$item})).  
                                                      '</li>';  
                                     }  
                                     $iteminfo .= '</ul></li>';  
                                 }  
                             } elsif ($scope eq 'users') {  
                                 if (ref($intervals->{$type}->{$scope}) eq 'HASH') {  
                                     $iteminfo .= '<li>'.&mt('Users').'<ul>';   
                                     foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {  
                                         $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',  
                                                      &convlim($item,$intervals->{$type}->{$scope}->{$item})).  
                                                      '</li>';  
                                     }  
                                     $iteminfo .= '</ul></li>';  
                                 }  
                             }  
                         }  
                     } elsif (($type eq 'map') || ($type eq 'resource')) {  
                         if (ref($intervals->{$type}->{$item}) eq 'HASH') {   
                             foreach my $scope (keys(%{$intervals->{$type}->{$item}})) {  
                                 if ($scope eq 'all') {  
                                     $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',  
                                                   &convlim($intervals->{$type}->{$item}->{$scope})).  
                                                   '</li>';  
                                 } elsif ($scope eq 'secgrp') {  
                                     if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {  
                                         $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';  
                                         foreach my $sec (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {  
                                             $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$sec,  
                                                          &convlim($intervals->{$type}->{$item}->{$scope}->{$sec})).  
                                                          '</li>';  
                                         }  
                                         $iteminfo .= '</ul></li>';   
                                     }  
                                 } elsif ($scope eq 'users') {  
                                     if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {  
                                         $iteminfo .= '<li>'.&mt('Users').'<ul>';  
                                         foreach my $user (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {  
                                             $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$user,  
                                                          &convlim($intervals->{$type}->{$item}->{$scope}->{$user})).  
                                                          '</li>';  
                                         }  
                                         $iteminfo .= '</ul></li>';  
                                     }  
                                 }  
                             }  
                         }  
                     }  
                     $iteminfo .= '</ul>';  
                 }  
             }  
             $r->print(&create_interval_form($intervals,$parmcount,$navmap,$item,$jschg,  
                                             $itemname,$iteminfo,$disabled).'</fieldset></td>');                                              $itemname,$iteminfo,$disabled).'</fieldset></td>');
         }          }
         $r->print(<<"END");          $r->print(<<"END");
Line 1281  sub display_addblocker_table { Line 1237  sub display_addblocker_table {
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'exam' => 'e.g., Exam 1',          'exam' => 'e.g., Exam 1',
     );      );
     my $intervalform = &create_interval_form($intervals,$parmcount,$navmap);      my $intervalform = &create_interval_form($intervals,$parmcount,$navmap,'blocking');
     if ($intervalform ne '') {      if ($intervalform ne '') {
         $intervalform = '<fieldset>'.          $intervalform = '<fieldset>'.
                         '<legend>'.$ltext->{'chtr'}.'</legend>'.                          '<legend>'.$ltext->{'chtr'}.'</legend>'.
Line 1405  sub blocker_checkboxes { Line 1361  sub blocker_checkboxes {
 }  }
   
 sub create_interval_form {  sub create_interval_form {
     my ($intervals,$parmcount,$navmap,$currkey,$jschg,$itemname,$iteminfo,$disabled) = @_;      my ($intervals,$parmcount,$navmap,$context,$currkey,$jschg,$itemname,$iteminfo,$disabled) = @_;
     return unless ((ref($intervals) eq 'HASH') && (ref($navmap)));      return unless ((ref($intervals) eq 'HASH') && (ref($navmap)));
     my $intervalform;      my $intervalform;
       my $counter = 0;
     if (keys(%{$intervals}) > 0) {      if (keys(%{$intervals}) > 0) {
         foreach my $type (sort(keys(%{$intervals}))) {          foreach my $type (sort(keys(%{$intervals}))) {
             if ($type eq 'course') {              if ($type eq 'course') {
Line 1427  sub create_interval_form { Line 1384  sub create_interval_form {
                 $intervalform .= '</label>';                  $intervalform .= '</label>';
                 if ($currkey eq 'course') {                  if ($currkey eq 'course') {
                     $intervalform .= $iteminfo;                      $intervalform .= $iteminfo;
                   } elsif ($context eq 'accesstimes') {
                       (undef,$iteminfo) = &interval_details('course',$type,'',$navmap,$intervals,$counter);
                       if ($iteminfo) {
                           $intervalform .= ' '.$iteminfo;
                       }
                 }                  }
                 $intervalform .= '<br />';                  $intervalform .= '<br />';
                   $counter ++;
             } elsif ($type eq 'map') {              } elsif ($type eq 'map') {
                 if (ref($intervals->{$type}) eq 'HASH') {                  if (ref($intervals->{$type}) eq 'HASH') {
                     if (ref($navmap)) {                      if (ref($navmap)) {
Line 1463  sub create_interval_form { Line 1426  sub create_interval_form {
                                 $intervalform .= &mt('Timer for all items in folder: [_1]',                                  $intervalform .= &mt('Timer for all items in folder: [_1]',
                                                      '<i>'.$title.'</i>').                                                       '<i>'.$title.'</i>').
                                                  '</label>'.$path;                                                   '</label>'.$path;
                                   if ($context eq 'accesstimes') {
                                       (undef,$iteminfo) = &interval_details($map,$type,$map,$navmap,$intervals,$counter);
                                       if ($iteminfo) {
                                           $intervalform .= ' '.$iteminfo;
                                       }
                                   }
                             }                              }
                             $intervalform .= '<br />';                              $intervalform .= '<br />';
                               $counter ++;
                         }                          }
                     }                      }
                 }                  }
Line 1491  sub create_interval_form { Line 1461  sub create_interval_form {
                                 my ($title,$path,$hierarchy);                                  my ($title,$path,$hierarchy);
                                 if (ref($resobj)) {                                  if (ref($resobj)) {
                                     $title = $resobj->compTitle();                                      $title = $resobj->compTitle();
                                 } else {                                  }
                                   if ($title eq '') {
                                     $title = &Apache::lonnet::gettitle($resource);                                      $title = &Apache::lonnet::gettitle($resource);
                                 }                                  }
                                 $hierarchy = &show_timer_path($type,$resource,$navmap);                                  $hierarchy = &show_timer_path($type,$resource,$navmap);
Line 1503  sub create_interval_form { Line 1474  sub create_interval_form {
                                 $intervalform .= &mt('Timer for resource: [_1]','<i>'.$title.'</i>').                                  $intervalform .= &mt('Timer for resource: [_1]','<i>'.$title.'</i>').
                                                  '</label>'.                                                   '</label>'.
                                                  $path;                                                   $path;
                                   if ($context eq 'accesstimes') {
                                       if (ref($resobj)) {
                                           my $url = $resobj->src();
                                           if ($url eq '') {
                                               (my $map, my $resid, $url) = &Apache::lonnet::decode_symb($resource);
                                           }
                                           ($itemname,$iteminfo) = &interval_details($resource,$type,$url,$navmap,$intervals,$counter);
                                           $intervalform .= ' '.$iteminfo;
                                       }
                                   }
                             }                              }
                             $intervalform .= '<br />';                              $intervalform .= '<br />';
                               $counter ++;
                         }                          }
                     }                      }
                 }                  }
Line 1532  sub trigger_details_toggle { Line 1514  sub trigger_details_toggle {
            'style="text-decoration: none;"><b>'.&mt('(More ...)').'</b></a></span>';             'style="text-decoration: none;"><b>'.&mt('(More ...)').'</b></a></span>';
 }  }
   
   sub interval_details {
       my ($item,$type,$url,$navmap,$intervals,$parmcount) = @_;
       my ($itemname,$iteminfo,$skipdetails);
       if ($type eq 'course') {
           $itemname = &mt('Timer for all items in course.');
       } else {
           if (&Apache::lonnet::is_on_map($url)) {
               if ($type eq 'map') {
                   if (ref($navmap)) {
                       my $title;
                       my $resobj = $navmap->getResourceByUrl($item);
                       if (ref($resobj)) {
                           $title = $resobj->compTitle();
                       } else {
                           $title = &Apache::lonnet::gettitle($item);
                       }
                       $itemname = &mt('Timer for all items in folder: [_1]',
                                       '<span style="font-style:italic">'.
                                       $title.'</span>');
                   }
               } else {
                   if (ref($navmap)) {
                       my $title;
                       my $resobj = $navmap->getBySymb($item);
                       if (ref($resobj)) {
                           $title = $resobj->compTitle();
                       } else {
                           $title = &Apache::lonnet::gettitle($item);
                       }
                       $itemname = &mt('Timer for resource: [_1]',
                                       '<span style="font-style:italic">'.
                                       $title.'</span>');
                   }
               }
               if (ref($navmap)) {
                   my $path = &show_timer_path($type,$item);
                   if ($path) {
                      $iteminfo  = ' <span style="font-size:90%;">'.
                                     &mt('(in: [_1])',$path).
                                     '</span>';
                   }
               }
           } else {
               $skipdetails = 1;
               $itemname = '<span style="LC_warning">'.
                           &mt('Timer folder/resource not in course').
                           '</span>';
           }
       }
       if ((!$skipdetails) && (ref($intervals) eq 'HASH') && (ref($intervals->{$type}) eq 'HASH')) {
           $iteminfo = &trigger_details_toggle($parmcount).
                       '<ul id="trigdetails_'.$parmcount.'" style="display:none">';
           if ($type eq 'course') {
               foreach my $scope (keys(%{$intervals->{$type}})) {
                   if ($scope eq 'all') {
                       $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',
                                    &convlim($intervals->{$type}->{$scope})).'</li>';
                   } elsif ($scope eq 'secgrp') {
                       if (ref($intervals->{$type}->{$scope}) eq 'HASH') {
                           $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';
                           foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {
                               $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$item,
                                            &convlim($intervals->{$type}->{$scope}->{$item})).
                                            '</li>';
                           }
                           $iteminfo .= '</ul></li>';
                       }
                   } elsif ($scope eq 'users') {
                       if (ref($intervals->{$type}->{$scope}) eq 'HASH') {
                           $iteminfo .= '<li>'.&mt('Users').'<ul>';
                           foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {
                               $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',
                                            &convlim($item,$intervals->{$type}->{$scope}->{$item})).
                                            '</li>';
                           }
                           $iteminfo .= '</ul></li>';
                       }
                   }
               }
           } elsif (($type eq 'map') || ($type eq 'resource')) {
               if (ref($intervals->{$type}->{$item}) eq 'HASH') {
                   foreach my $scope (keys(%{$intervals->{$type}->{$item}})) {
                       if ($scope eq 'all') {
                           $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',
                                        &convlim($intervals->{$type}->{$item}->{$scope})).
                                        '</li>';
                       } elsif ($scope eq 'secgrp') {
                           if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {
                               $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';
                               foreach my $sec (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {
                                   $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$sec,
                                                &convlim($intervals->{$type}->{$item}->{$scope}->{$sec})).
                                               '</li>';
                               }
                               $iteminfo .= '</ul></li>';
                           }
                       } elsif ($scope eq 'users') {
                           if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {
                               $iteminfo .= '<li>'.&mt('Users').'<ul>';
                               foreach my $user (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {
                                   $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$user,
                                                &convlim($intervals->{$type}->{$item}->{$scope}->{$user})).
                                                '</li>';
                               }
                               $iteminfo .= '</ul></li>';
                           }
                       }
                   }
               }
           }
           $iteminfo .= '</ul>';
       }
       return ($itemname,$iteminfo);
   }
   
 sub show_timer_path {  sub show_timer_path {
     my ($type,$item,$navmap) = @_;      my ($type,$item,$navmap) = @_;
     return unless(ref($navmap));      return unless(ref($navmap));
Line 1558  sub blocktype_text { Line 1655  sub blocktype_text {
         'port' => 'Portfolio',          'port' => 'Portfolio',
         'groups' => 'Groups',          'groups' => 'Groups',
         'blogs' => 'Blogs',          'blogs' => 'Blogs',
           'about' => 'User Information',
         'docs' => 'Content',          'docs' => 'Content',
         'printout' => 'Printouts',          'printout' => 'Printouts',
         'passwd' => 'Change Password',          'passwd' => 'Change Password',
           'grades' => 'Gradebook',
           'search' => 'Content Search',
           'alert'  => 'Critical Alert',
           'reinit' => 'Course Re-init',
     );      );
     my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','passwd'];      my $typeorder = ['com','chat','boards','port','groups','blogs','about','printout','docs','grades','search','alert','reinit','passwd'];
     return ($typeorder,\%types);      return ($typeorder,\%types);
 }  }
   
 sub blockingmenu_javascript {  sub blockingmenu_javascript {
     my ($blockcount) = @_;      my ($blockcount) = @_;
     my %lt = &Apache::lonlocal::texthash (  
                                            more => 'More ...',  
                                            less => 'Less ...',  
                                          );  
     return <<ENDSCRIPT;      return <<ENDSCRIPT;
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 1627  function toggleAddModify() { Line 1725  function toggleAddModify() {
     return;      return;
 }  }
   
   // ]]>
   </script>
   ENDSCRIPT
   
   }
   
   sub details_javascript {
       my %lt = &Apache::lonlocal::texthash (
                                              more => 'More ...',
                                              less => 'Less ...',
                                            );
       return <<ENDSCRIPT;
   
   <script type="text/javascript">
   // <![CDATA[
   
 function showTriggerDetails(item) {  function showTriggerDetails(item) {
     document.getElementById('trigdetails_'+item).style.display='block';      document.getElementById('trigdetails_'+item).style.display='block';
     document.getElementById('trigdetails_'+item).style.textAlign='left';      document.getElementById('trigdetails_'+item).style.textAlign='left';

Removed from v.1.19  
changed lines
  Added in v.1.29


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