Diff for /loncom/interface/lonmenu.pm between versions 1.444 and 1.448

version 1.444, 2016/04/04 17:24:05 version 1.448, 2016/05/13 22:48:05
Line 124  dropdown list when mouse hovers over top Line 124  dropdown list when mouse hovers over top
 (no hover psuedo class) via LC_hoverable class for <li> tag for top-  (no hover psuedo class) via LC_hoverable class for <li> tag for top-
 level item, which employs jQuery to handle behavior on mouseover.  level item, which employs jQuery to handle behavior on mouseover.
   
 Inputs: 4 - (a) link and (b) target for anchor href in top level item,  Inputs: 6 - (a) link and (b) target for anchor href in top level item,
             (c) title for text wrapped by anchor tag in top level item.              (c) title for text wrapped by anchor tag in top level item,
             (d) reference to array of arrays of sub-menu items.              (d) reference to array of arrays of sub-menu items,
               (e) boolean to indicate whether to call &mt() to translate 
                   name of menu item,
               (f) optional class for <li> element in primary menu, for which
                   sub menu is being generated.
   
  The underlying datastructure used in (d) contains data from mydesk.tab.   The underlying datastructure used in (d) contains data from mydesk.tab.
  It consists of an array which has an array for each item appearing in   It consists of an array which has an array for each item appearing in
Line 534  sub secondary_menu { Line 538  sub secondary_menu {
 }  }
   
 sub create_submenu {  sub create_submenu {
     my ($link,$target,$title,$submenu,$translate) = @_;      my ($link,$target,$title,$submenu,$translate,$addclass) = @_;
     return unless (ref($submenu) eq 'ARRAY');      return unless (ref($submenu) eq 'ARRAY');
     my $disptarget;      my $disptarget;
     if ($target ne '') {      if ($target ne '') {
         $disptarget = ' target="'.$target.'"';          $disptarget = ' target="'.$target.'"';
     }      }
     my $menu = '<li class="LC_hoverable">'.      my $menu = '<li class="LC_hoverable '.$addclass.'">'.
                '<a href="'.$link.'"'.$disptarget.'>'.                 '<a href="'.$link.'"'.$disptarget.'>'.
                '<span class="LC_nobreak">'.$title.                 '<span class="LC_nobreak">'.$title.
                '<span class="LC_fontsize_small" style="font-weight:normal;">'.                 '<span class="LC_fontsize_small" style="font-weight:normal;">'.
Line 560  sub create_submenu { Line 564  sub create_submenu {
 # see perldoc create_submenu documentation for further information  # see perldoc create_submenu documentation for further information
 sub build_submenu {  sub build_submenu {
     my ($target, $submenu, $translate, $first_level) = @_;       my ($target, $submenu, $translate, $first_level) = @_; 
     if (!defined(@{$submenu})) {      unless (@{$submenu}) {
         return '';          return '';
     }      }
   
Line 947  ENDMENUITEMS Line 951  ENDMENUITEMS
                 }                  }
             }              }
         }          }
           my $showprogress;
           if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) {
               $showprogress = &placement_progress();
           }
   
    my $addremote=0;
    foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
   
     my $addremote=0;  
     foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }  
     if ($addremote) {      if ($addremote) {
         my $countdown;          my $countdown;
         if ($env{'request.filename'} =~ /\.page$/) {          if ($env{'request.filename'} =~ /\.page$/) {
Line 969  ENDMENUITEMS Line 978  ENDMENUITEMS
             if ($countdown) {              if ($countdown) {
                 &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);                  &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
             }              }
               if ($showprogress) {
                   &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress);
               }
         } else {          } else {
             my @tools = @inlineremote[93,91,81,82,83];              my @tools = @inlineremote[93,91,81,82,83];
             if ($countdown) {              if ($countdown) {
Line 987  ENDMENUITEMS Line 999  ENDMENUITEMS
             }              }
             &advtools_crumbs(@inlineremote);              &advtools_crumbs(@inlineremote);
         }          }
       } else {
           if ($showprogress) {
               &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress);
           }
     }      }
     my ($topic_help,$topic_help_text);      my ($topic_help,$topic_help_text);
     if ($is_const_dir == 2) {      if ($is_const_dir == 2) {
Line 1618  END Line 1634  END
 # LC_interval_done is true.  # LC_interval_done is true.
 #  #
 sub done_button_js {  sub done_button_js {
     my ($type,$width,$height,$proctor) = @_;      my ($type,$width,$height,$proctor,$donebuttontext) = @_;
     return unless (($type eq 'map') || ($type eq 'resource'));      return unless (($type eq 'map') || ($type eq 'resource'));
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  title    => 'WARNING!',                   title    => 'WARNING!',
                  button   => 'Done',  
                  preamble => 'You are trying to end this timed event early.',                   preamble => 'You are trying to end this timed event early.',
                  map      => 'Confirming that you are done will cause the time to expire and prevent you from changing any answers in the current folder.',                   map      => 'Confirming that you are done will cause the time to expire and prevent you from changing any answers in the current folder.',
                  resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).',                    resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).', 
Line 1699  sub done_button_js { Line 1714  sub done_button_js {
 <form method="post" name="LCdoneButton" action="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
     <input type="hidden" name="LC_interval_done_proctorpass" value="" />      <input type="hidden" name="LC_interval_done_proctorpass" value="" />
     <button id="LC_done-confirm-opener" type="button">$lt{'button'}</button>      <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>
 </form>  </form>
   
 <div id="LC_done-confirm" title="$lt{'title'}">  <div id="LC_done-confirm" title="$lt{'title'}">
Line 2485  sub countdown_timer { Line 2500  sub countdown_timer {
         }          }
         my $duedate = &Apache::lonnet::EXT("resource.0.duedate");          my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
         my @interval=&Apache::lonnet::EXT("resource.0.interval");          my @interval=&Apache::lonnet::EXT("resource.0.interval");
         my ($timelimit,$usesdone,$proctor,$secret);          my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret);
         if (@interval > 1) {          if (@interval > 1) {
             ($timelimit,$usesdone,$proctor,$secret) = split(/_/,$interval[0]);               ($timelimit,my $donesuffix) = split(/_/,$interval[0],2);
               if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) {
                   $usesdone = 'done';
                   $donebuttontext = $1;
                   (undef,$proctor,$secret) = split(/_/,$2);
               } elsif ($donesuffix =~ /^done(|_.+)$/) {
                   $donebuttontext = &mt('Done');
                   ($usesdone,$proctor,$secret) = split(/_/,$donesuffix);
               }
             my $first_access=&Apache::lonnet::get_first_access($interval[1]);              my $first_access=&Apache::lonnet::get_first_access($interval[1]);
             if ($first_access > 0) {              if ($first_access > 0) {
                 if ($first_access+$timelimit > time) {                  if ($first_access+$timelimit > time) {
Line 2505  sub countdown_timer { Line 2528  sub countdown_timer {
                 $collapse = '&#9658;&nbsp;';                  $collapse = '&#9658;&nbsp;';
                 if ((@interval > 1) && ($hastimeleft)) {                  if ((@interval > 1) && ($hastimeleft)) {
                     if ($usesdone eq 'done') {                      if ($usesdone eq 'done') {
                         $donebutton = &done_button_js($interval[1],'','',$proctor);                          $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext);
                     }                      }
                 }                  }
             } else {              } else {
Line 2534  END Line 2557  END
     return;      return;
 }  }
   
   sub placement_progress {
       my ($totalpoints,$incomplete) = &Apache::lonplacementtest::check_completion(undef,undef,1);
       my $complete = 100 - $incomplete;
       return '<span class="LC_placement_prog">'.
              &mt('Test is [_1]% complete',$complete).'</span>';
   }
   
 # ================================================================ Main Program  # ================================================================ Main Program
   
 BEGIN {  BEGIN {

Removed from v.1.444  
changed lines
  Added in v.1.448


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