Diff for /loncom/interface/lonmenu.pm between versions 1.369.2.71.4.6 and 1.369.2.72

version 1.369.2.71.4.6, 2019/02/06 18:52:54 version 1.369.2.72, 2018/09/03 14:30:16
Line 499  sub secondary_menu { Line 499  sub secondary_menu {
                         next if ($item->[2] eq 'mgr' && !$canmgr);                          next if ($item->[2] eq 'mgr' && !$canmgr);
                         next if ($item->[2] eq 'vcg' && !$canviewgrps);                          next if ($item->[2] eq 'vcg' && !$canviewgrps);
                         next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor);                          next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor);
                           next if ($item->[2] eq 'author' && !$author);
                           next if ($item->[2] eq 'cca' && !$canmodifycoauthor);
                         push(@scndsub,$item);                           push(@scndsub,$item); 
                     }                      }
                 }                  }
Line 528  sub secondary_menu { Line 530  sub secondary_menu {
                 } else {                  } else {
                     $$menuitem[0] =~ s{\?register=1}{};                      $$menuitem[0] =~ s{\?register=1}{};
                 }                  }
                   $$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"');
             }              }
             $menu .= &prep_menuitem(\@$menuitem);              $menu .= &prep_menuitem(\@$menuitem);
         }          }
Line 635  sub build_submenu { Line 638  sub build_submenu {
                     next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne ''));                      next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne ''));
                     $href =~ s/\[domain\]/$env{'user.domain'}/g;                      $href =~ s/\[domain\]/$env{'user.domain'}/g;
                     $href =~ s/\[user\]/$env{'user.name'}/g;                      $href =~ s/\[user\]/$env{'user.name'}/g;
                   } elsif (($href =~ m{^/adm/preferences\?}) && ($href =~ /\[returnurl\]/)) {
                       my $returnurl = $ENV{'REQUEST_URI'};
                       if ($ENV{'REQUEST_URI'} =~ m{/adm/preferences\?action=(?:changedomcoord|authorsettings)\&returnurl=([^\&]+)$}) {
                           $returnurl = $1;
                       }
                       if (($returnurl =~ m{^/adm/createuser($|\?action=)}) ||
                           ($returnurl =~ m{^/priv/$match_domain/$match_username}) ||
                           ($returnurl =~ m{^/res(/?$|/$match_domain/$match_username)})) {
                           $returnurl =~ s{\?.*$}{};
                           $returnurl = '&amp;returnurl='.&HTML::Entities::encode($returnurl,'"<>&\'');
                       } else {
                           undef($returnurl);
                       }
                       $href =~ s/\[returnurl\]/$returnurl/;
                 }                  }
                 unless (($href eq '') || ($href =~ /^\#/)) {                  unless (($href eq '') || ($href =~ /^\#/)) {
                     $target = ' target="_top"';                      $target = ' target="_top"';
Line 699  sub innerregister { Line 716  sub innerregister {
         $newmail= 'swmenu.setstatus("you have","messages");';          $newmail= 'swmenu.setstatus("you have","messages");';
     }      }
   
     my ($mapurl,$resurl,$navmap);      my ($mapurl,$resurl);
   
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
 #  
 #course_type:  Course or Community  
 #  
         if ($env{'request.symb'}) {          if ($env{'request.symb'}) {
             my $ignorenull;              ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
             unless ($env{'request.noversionuri'} eq '/adm/navmaps') {  
                 $ignorenull = 1;  
             }  
             my $symb = &Apache::lonnet::symbread('','',$ignorenull);  
             ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb($symb);  
             my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};              my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
   
             my $maptitle = &Apache::lonnet::gettitle($mapurl);              my $maptitle = &Apache::lonnet::gettitle($mapurl);
             my $restitle = &Apache::lonnet::gettitle($symb);              my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
   
             my (@crumbs,@mapcrumbs);  
             if (($env{'request.noversionuri'} ne '/adm/navmaps') && ($mapurl ne '')) {  #SD
                 $navmap = Apache::lonnavmaps::navmap->new();  #course_type only Course and Community?
                 if (ref($navmap)) {  #
                     @mapcrumbs = $navmap->recursed_crumbs($mapurl,$restitle);              my @crumbs;
                 }  
             }  
             unless (($forcereg) &&               unless (($forcereg) && 
                     ($env{'request.noversionuri'} eq '/adm/navmaps') &&                      ($env{'request.noversionuri'} eq '/adm/navmaps') &&
                     ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {                      ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
Line 732  sub innerregister { Line 739  sub innerregister {
                             href  => "Javascript:gopost('/adm/navmaps','')"});                              href  => "Javascript:gopost('/adm/navmaps','')"});
             }              }
             if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {               if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { 
                 if (@mapcrumbs) {                  push(@crumbs, {text  => '...',
                     push(@crumbs,@mapcrumbs);                                 no_mt => 1});
                 } else {  
                     push(@crumbs, {text  => '...',  
                                    no_mt => 1});  
                 }  
             }              }
   
             unless ((@mapcrumbs) || (!$maptitle) || ($maptitle eq 'default.sequence') ||               push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle 
                     ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {                                                         && $maptitle ne 'default.sequence' 
                 push @crumbs, {text => $maptitle, no_mt => 1, href => $mapurl};                                                         && $maptitle ne $coursetitle);
             }  
             if ($restitle && !@mapcrumbs) {              push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
                 push(@crumbs,{text => $restitle, no_mt => 1});  
             }  
             my @tools;              my @tools;
             if ($env{'request.filename'} =~ /\.page$/) {              if ($env{'request.filename'} =~ /\.page$/) {
                 my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();                  my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
Line 981  if ($env{'browser.mobile'}) { Line 982  if ($env{'browser.mobile'}) {
     $is_mobile = 1;      $is_mobile = 1;
 }  }
   
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|ext\.tool)(\?|$)/) {              unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
  if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {   if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
     $menuitems.=(<<ENDREALRES);      $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.png&$swtext{'catalog'}&info[_1]&catalog_info(currentURL,'$is_mobile')&Show Metadata  s&6&3&catalog.png&$swtext{'catalog'}&info[_1]&catalog_info('$is_mobile')&Show Metadata
 ENDREALRES  ENDREALRES
                 }                  }
                 unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||                  unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||
Line 1485  sub prepare_functions { Line 1486  sub prepare_functions {
     }      }
   
     my $editbutton = '';      my $editbutton = '';
     my $viewsrcbutton = '';  
 #  #
 # Determine whether or not to display 'Edit' or 'View Source' icon/button  # Determine whether or not to display 'Edit' icon/button
 #  #
     if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {      if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {
         my $file=&Apache::lonnet::declutter($env{'request.filename'});          my $file=&Apache::lonnet::declutter($env{'request.filename'});
Line 1519  sub prepare_functions { Line 1519  sub prepare_functions {
 #  #
         if (($perms{'mdc'}) &&          if (($perms{'mdc'}) &&
             (($resurl =~ m{^/?public/$cdom/$cnum/syllabus}) ||              (($resurl =~ m{^/?public/$cdom/$cnum/syllabus}) ||
              ($resurl =~ m{^/?uploaded/$cdom/$cnum/portfolio/syllabus/}) ||              ($resurl =~ m{^/?uploaded/$cdom/$cnum/portfolio/syllabus/}))) {
              (($resurl =~ m{^/?uploaded/$cdom/$cnum/default_\d+\.sequence$}) && ($env{'form.navmap'})))) {  
             if ($resurl =~ m{^/}) {              if ($resurl =~ m{^/}) {
                 $cfile = $resurl;                  $cfile = $resurl;
             } else {              } else {
Line 1532  sub prepare_functions { Line 1531  sub prepare_functions {
             } else {              } else {
                 $forceedit = 1;                  $forceedit = 1;
             }              }
             if ($cfile =~ m{^/uploaded/$cdom/$cnum/default_\d+\.sequence$}) {              $editbutton = &get_editbutton($cfile,$home,$switchserver,
                 my $text = 'Edit Folder';                                            $forceedit,$forceview,$forcereg);
                 &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',  
                         "gocmd('/adm/coursedocs','direct')",  
                         'Folder/Page Content');  
                 $editbutton = 1;  
             } else {  
                 $editbutton = &get_editbutton($cfile,$home,$switchserver,  
                                               $forceedit,$forceview,$forcereg);  
             }  
         } elsif (($resurl eq '/adm/extresedit') &&          } elsif (($resurl eq '/adm/extresedit') &&
                  (($env{'form.symb'}) || ($env{'form.folderpath'}))) {                   (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
             ($cfile,$home,$switchserver,$forceedit,$forceview) =              ($cfile,$home,$switchserver,$forceedit,$forceview) =
Line 1570  sub prepare_functions { Line 1561  sub prepare_functions {
                     $editbutton = &get_editbutton($cfile,$home,$switchserver,                      $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                                   $forceedit,$forceview,$forcereg);                                                    $forceedit,$forceview,$forcereg);
                 }                  }
                 if ((($cfile eq '') || (!$editbutton)) &&  
                     ($resurl =~ /$LONCAPA::assess_re/)) {  
                     my $showurl = &Apache::lonnet::clutter($resurl);  
                     if ((&Apache::lonnet::allowed('cre','/')) &&  
                         (&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open')) {  
                         $viewsrcbutton = 1;  
                     } elsif (&Apache::lonnet::allowed('vxc',$env{'request.course.id'})) {  
                         if ($showurl =~ m{^\Q/res/$cdom/\E($match_username)/}) {  
                             my $auname = $1;  
                             if (($env{'request.course.adhocsrcaccess'} ne '') &&  
                                 (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {  
                                 $viewsrcbutton = 1;  
                             } elsif ((&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open') &&  
                                      (&Apache::lonnet::allowed('bre','/'))) {  
                                 $viewsrcbutton = 1;  
                             }  
                         }  
                     }  
                     if ($viewsrcbutton) {  
                         &switch('','',6,1,'pcstr.png','View Source','resource[_2]','open_source()',  
                                 'View source code');  
                     }  
                 }  
             }              }
         }          }
     }      }
Line 1641  sub prepare_functions { Line 1609  sub prepare_functions {
         if (($env{'form.folderpath'} =~ /^supplemental/) &&          if (($env{'form.folderpath'} =~ /^supplemental/) &&
             (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&              (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
             (($resurl =~ m{^/adm/wrapper/ext/}) ||              (($resurl =~ m{^/adm/wrapper/ext/}) ||
              ($resurl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) ||  
              ($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) ||               ($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) ||
              ($resurl eq '/adm/supplemental') ||               ($resurl eq '/adm/supplemental') ||
              ($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) ||               ($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) ||
Line 1666  sub prepare_functions { Line 1633  sub prepare_functions {
         &advtools_crumbs(@inlineremote);          &advtools_crumbs(@inlineremote);
         return $editbutton;          return $editbutton;
     } elsif (($env{'request.registered'}) && (!ref($forbodytag))) {      } elsif (($env{'request.registered'}) && (!ref($forbodytag))) {
         return $editbutton || $viewsrcbutton;          return $editbutton;
     } else {      } else {
         if (ref($bread_crumbs) eq 'ARRAY') {          if (ref($bread_crumbs) eq 'ARRAY') {
             if (@inlineremote > 0) {              if (@inlineremote > 0) {
Line 2148  function toggleCountdown() { Line 2115  function toggleCountdown() {
 END  END
 }  }
   
 # This creates a "done button" for timed events.  The confirmation box is a jQuery  
 # dialog widget. If the interval parameter requires a proctor key for the timed  
 # event to be marked done, there will also be a textbox where that can be entered.  
 # Clicking OK will set the value of LC_interval_done to 'true', and, if needed will  
 # set the value of LC_interval_done_proctorpass to the text entered in that box,  
 # and submit the corresponding form.  
 #  
 # The &zero_time() routine in lonhomework.pm is called when a page is rendered if  
 # LC_interval_done is true.  
 #  
 sub done_button_js {  
     my ($type,$width,$height,$proctor,$donebuttontext) = @_;  
     return unless (($type eq 'map') || ($type eq 'resource'));  
     my %lt = &Apache::lonlocal::texthash(  
                  title    => 'WARNING!',  
                  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.',  
                  resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).',  
                  okdone   => 'Click "OK" if you are completely finished.',  
                  cancel   => 'Click "Cancel" to continue working.',  
                  proctor  => 'Ask a proctor to enter the key, then click "OK" if you are completely finished.',  
                  ok       => 'OK',  
                  exit     => 'Cancel',  
                  key      => 'Key:',  
                  nokey    => 'A proctor key is required',  
     );  
     my $navmap = Apache::lonnavmaps::navmap->new();  
     my ($missing,$tried) = (0,0);  
     if (ref($navmap)) {  
         my @resources=();  
         if ($type eq 'map') {  
             my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});  
             if ($env{'request.symb'} =~ /\.page$/) {  
                 @resources=$navmap->retrieveResources($resurl,sub { $_[0]->is_problem() });  
             } else {  
                 @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() });  
             }  
         } else {  
             my $res = $navmap->getBySymb($env{'request.symb'});  
             if (ref($res)) {  
                 if ($res->is_problem()) {  
                     push(@resources,$res);  
                 }  
             }  
         }  
         foreach my $res (@resources) {  
             if (ref($res->parts()) eq 'ARRAY') {  
                 foreach my $part (@{$res->parts()}) {  
                     if (!$res->tries($part)) {  
                         $missing++;  
                     } else {  
                         $tried++;  
                     }  
                 }  
             }  
         }  
     }  
     if ($missing) {  
         $lt{'miss'} .= '<p class="LC_error">';  
         if ($type eq 'map') {  
             $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing);  
         } else {  
             $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing);  
         }  
         if ($missing > 1) {  
             $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').'</span>';  
         } else {  
             $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'</p>';  
         }  
     }  
     $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"');  
     if ($proctor) {  
         if ($height !~ /^\d+$/) {  
             $height = 400;  
             if ($missing) {  
                 $height += 60;  
             }  
         }  
         if ($width !~ /^\d+$/) {  
             $width = 400;  
             if ($missing) {  
                 $width += 60;  
             }  
         }  
         return <<END;  
 <form method="post" name="LCdoneButton" action="">  
     <input type="hidden" name="LC_interval_done" value="" />  
     <input type="hidden" name="LC_interval_done_proctorpass" value="" />  
     <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>  
 </form>  
   
 <div id="LC_done-confirm" title="$lt{'title'}">  
   <p>$lt{'preamble'} $lt{$type}</p>  
   $lt{'miss'}  
   <p>$lt{'proctor'}</p>  
   <form name="LCdoneButtonProctor" action="">  
     <label>$lt{'key'}<input type="password" name="LC_interval_done_proctorkey" value="" /></label>  
     <input type="submit" tabindex="-1" style="position:absolute; top:-1000px" />  
   </form>  
   <p>$lt{'cancel'}</p>  
 </div>  
   
 <script type="text/javascript">  
 // <![CDATA[  
     \$( "#LC_done-confirm" ).dialog({ autoOpen: false });  
     \$( "#LC_done-confirm-opener" ).on("click", function() {  
         \$( "#LC_done-confirm" ).dialog("open");  
         \$( "#LC_done-confirm" ).dialog({  
             height: $height,  
             width: $width,  
             modal: true,  
             resizable: false,  
             buttons: [  
                 {  
                     text: "$lt{'ok'}",  
                     click: function() {  
                         var proctorkey = \$( '[name="LC_interval_done_proctorkey"]' )[0].value;  
                         if ((proctorkey == '') || (proctorkey == null)) {  
                             alert("$lt{'nokey'}");  
                         } else {  
                             \$( '[name="LC_interval_done"]' )[0].value = 'true';  
                             \$( '[name="LC_interval_done_proctorpass"]' )[0].value = proctorkey;  
                             \$( '[name="LCdoneButton"]' )[0].submit();  
                         }  
                     },  
                 },  
                 {  
                     text: "$lt{'exit'}",  
                     click: function() {  
                         \$("#LC_done-confirm").dialog( "close" );  
                     }  
                 }  
             ],  
             close: function() {  
                 \$( '[name="LC_interval_done_proctorkey"]' )[0].value = '';  
             }  
         });  
         \$( "#LC_done-confirm" ).find( "form" ).on( "submit", function( event ) {  
             event.preventDefault();  
             \$( '[name="LC_interval_done"]' )[0].value = 'true';  
             \$( '[name="LC_interval_done_proctorpass"]' )[0].value = \$( '[name="LC_interval_done_proctorkey"]' )[0].value;  
             \$( '[name="LCdoneButton"]' )[0].submit();  
         });  
 });  
   
 // ]]>  
 </script>  
   
 END  
     } else {  
         if ($height !~ /^\d+$/) {  
             $height = 320;  
             if ($missing) {  
                 $height += 60;  
             }  
         }  
         if ($width !~ /^\d+$/) {  
             $width = 320;  
             if ($missing) {  
                 $width += 60;  
             }  
         }  
         if ($missing) {  
             $lt{'miss'} = '</p>'.$lt{'miss'}.'<p>';  
         }  
         return <<END;  
   
 <form method="post" name="LCdoneButton" action="">  
     <input type="hidden" name="LC_interval_done" value="" />  
     <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>  
 </form>  
   
 <div id="LC_done-confirm" title="$lt{'title'}">  
     <p>$lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}</p>  
 </div>  
   
 <script type="text/javascript">  
 // <![CDATA[  
 \$( "#LC_done-confirm" ).dialog({ autoOpen: false });  
 \$( "#LC_done-confirm-opener" ).click(function() {  
     \$( "#LC_done-confirm" ).dialog( "open" );  
     \$( "#LC_done-confirm" ).dialog({  
       resizable: false,  
       height: $height,  
       width: $width,  
       modal: true,  
       buttons: [  
                  {  
                     text: "$lt{'ok'}",  
                     click: function() {  
                         \$( this ).dialog( "close" );  
                         \$( '[name="LC_interval_done"]' )[0].value = 'true';  
                         \$( '[name="LCdoneButton"]' )[0].submit();  
                     },  
                  },  
                  {  
                      text: "$lt{'exit'}",  
                      click: function() {  
                          \$( this ).dialog( "close" );  
                      },  
                   },  
                ],  
        });  
 });  
 // ]]>  
 </script>  
   
 END  
     }  
 }  
   
 sub utilityfunctions {  sub utilityfunctions {
     my ($httphost) = @_;      my ($httphost) = @_;
     my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));      my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
Line 2497  function golist(url) { Line 2253  function golist(url) {
   
   
   
 function catalog_info(url,isMobile) {  function catalog_info(isMobile) {
     if (isMobile == 1) {      if (isMobile == 1) {
         openMyModal(url+'.meta?modal=1',500,400,'yes');          openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');
     } else {      } else {
         loncatinfo=window.open(url+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');          loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
     }      }
 }  }
   
Line 2544  function open_StoredLinks_Import(rat) { Line 2300  function open_StoredLinks_Import(rat) {
    newWin.focus();     newWin.focus();
 }  }
   
 function open_source() {  
    sourcewin=window.open('/adm/source?inhibitmenu=yes&viewonly=1&filename='+currentURL,'LONsource',  
                          'height=500,width=600,resizable=yes,location=no,menubar=no,toolbar=no,scrollbars=yes');  
 }  
   
 (function (\$) {  (function (\$) {
   \$(document).ready(function () {    \$(document).ready(function () {
     \$.single=function(a){return function(b){a[0]=b;return a}}(\$([1]));      \$.single=function(a){return function(b){a[0]=b;return a}}(\$([1]));
Line 3142  sub countdown_timer { Line 2893  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,$donebuttontext,$proctor,$secret);  
         if (@interval > 1) {          if (@interval > 1) {
             ($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+$interval[0] > time) {
                     $hastimeleft = 1;                      $hastimeleft = 1;
                 }                  }
             }              }
Line 3163  sub countdown_timer { Line 2904  sub countdown_timer {
         if (($duedate && $duedate > time) ||          if (($duedate && $duedate > time) ||
             (!$duedate && $hastimeleft) ||              (!$duedate && $hastimeleft) ||
             ($slot_name ne '' && $slothastime)) {              ($slot_name ne '' && $slothastime)) {
             my ($collapse,$expand,$alttxt,$title,$currdisp,$donebutton);              my ($collapse,$expand,$alttxt,$title,$currdisp);
             if ((@interval > 1 && $hastimeleft) ||              if ((@interval > 1 && $hastimeleft) ||
                 ($type eq 'Task' && $slothastime)) {                  ($type eq 'Task' && $slothastime)) {
                 $currdisp = 'inline';                  $currdisp = 'inline';
                 $collapse = '&#9658;&nbsp;';                  $collapse = '&#9658;&nbsp;';
                 if ((@interval > 1) && ($hastimeleft)) {  
                     if ($usesdone eq 'done') {  
                         $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext);  
                     }  
                 }  
             } else {              } else {
                 $currdisp = 'none';                  $currdisp = 'none';
                 $expand = '&#9668;&nbsp;';                  $expand = '&#9668;&nbsp;';
Line 3183  sub countdown_timer { Line 2919  sub countdown_timer {
             }              }
             my $desc = &mt('Countdown to due date/time');              my $desc = &mt('Countdown to due date/time');
             return <<END;              return <<END;
 $donebutton  
 <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">  <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
 <span id="ddcountcollapse" class="LC_menubuttons_inline_text">  <span id="ddcountcollapse" class="LC_menubuttons_inline_text">
 $collapse  $collapse

Removed from v.1.369.2.71.4.6  
changed lines
  Added in v.1.369.2.72


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