Diff for /rat/lonwrapper.pm between versions 1.63 and 1.66

version 1.63, 2017/05/10 13:49:21 version 1.66, 2017/12/18 23:23:14
Line 38  use Apache::loncommon(); Line 38  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonextresedit();  use Apache::lonextresedit();
 use Apache::lonexttool();  use Apache::lonexttool();
 use LONCAPA qw(:DEFAULT :match);;  use LONCAPA qw(:DEFAULT :match);
   use HTML::Entities();
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
 sub wrapper {  sub wrapper {
Line 83  sub wrapper { Line 84  sub wrapper {
   
     my $startpage = &Apache::loncommon::start_page('Menu',undef,$args);      my $startpage = &Apache::loncommon::start_page('Menu',undef,$args);
     my $endpage = &Apache::loncommon::end_page();      my $endpage = &Apache::loncommon::end_page();
       
       if (($exttool) && (&Apache::lonnet::EXT('resource.0.gradable'))) {
           my $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
           if ($resource_due) {
               my $time_left = $resource_due - time();
               if ($resource_due && ($time_left > 0)) {
                   $startpage .='
   <script type="text/javascript">
   // <![CDATA['."\n".
                                &Apache::lonhtmlcommon::countdown().'
   // ]]>
   </script>'."\n".
                                 &Apache::lonhtmlcommon::set_due_date($resource_due);
               }
           }
       }
   
     if (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab')) {      if (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab')) {
         my $output = $startpage;          my $output = $startpage;
         if ($is_pdf) {          if ($is_pdf) {
Line 104  sub wrapper { Line 121  sub wrapper {
             if ($linktext eq '') {              if ($linktext eq '') {
                 $linktext = &mt('Launch External Tool');                  $linktext = &mt('Launch External Tool');
             }              }
               $url = &HTML::Entities::encode($url,'"<>&');
             if ($exttool eq 'tab') {              if ($exttool eq 'tab') {
                 $output .= '<div>'.                  $output .= '<div>'.
                            '<a href="'.$url.'" target="LCExternalToolTab" style="padding:0;clear:both;margin:0;border:0">'.                             '<a href="'.$url.'" target="LCExternalToolTab" style="padding:0;clear:both;margin:0;border:0">'.
Line 112  sub wrapper { Line 130  sub wrapper {
             } else {              } else {
                 $output .= <<"ENDLINK";                  $output .= <<"ENDLINK";
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 var windowObjectReference = null;   var windowObjectReference = null; 
 var PreviousUrl;   var PreviousUrl; 
                                                         
Line 128  function openSinglePopup(strUrl) { Line 147  function openSinglePopup(strUrl) {
     };      };
     PreviousUrl = strUrl;      PreviousUrl = strUrl;
 }  }
   // ]]>
 </script>  </script>
 <div>  <div>
 <a href="$url" target="LCExternalToolPopUp" onclick="openSinglePopup(this.href); return false;">  <a href="$url" target="LCExternalToolPopUp" onclick="openSinglePopup(this.href); return false;">
Line 138  ENDLINK Line 158  ENDLINK
             if ($explanation ne '') {              if ($explanation ne '') {
                 $output .= '<div>'.$explanation.'</div>';                  $output .= '<div>'.$explanation.'</div>';
             }              }
               if (&Apache::lonnet::EXT('resource.0.gradable')) {
                   $output .= &Apache::lonfeedback::list_discussion('tool','OPEN');
               }
         } else {          } else {
               my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
             $output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".              $output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".
                        '<iframe src="'.$url.$anchor.'" height="100%" width="100%" frameborder="0">'."\n".                         '<iframe src="'.$dest.'" height="100%" width="100%" frameborder="0">'."\n".
                        "$lt{'noif'} $noiframe\n".                         "$lt{'noif'} $noiframe\n".
                        "</iframe>\n".                         "</iframe>\n".
                        "</div>\n";                         "</div>\n";
Line 179  ENDLINK Line 203  ENDLINK
         window.onload = function(){  \$(window).trigger('resize') };          window.onload = function(){  \$(window).trigger('resize') };
 SCRIPT  SCRIPT
         # javascript will position the iframe if window was resized (or zoomed)          # javascript will position the iframe if window was resized (or zoomed)
           my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
         return <<ENDFRAME;          return <<ENDFRAME;
         $startpage          $startpage
         $script          $script
         <div class="LC_iframecontainer">          <div class="LC_iframecontainer">
             <iframe src="$url$anchor">$lt{'noif'} $noiframe</iframe>              <iframe src="$dest">$lt{'noif'} $noiframe</iframe>
         </div>          </div>
         $endpage          $endpage
 ENDFRAME  ENDFRAME
Line 220  sub handler { Line 245  sub handler {
         my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id','width','height'],          my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id','width','height'],
                                             $cdom,$cnum);                                              $cdom,$cnum);
         if ($toolhash{'id'}) {          if ($toolhash{'id'}) {
             my %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);              my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
             if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') {              if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') {
                 $exttoolremote = $ltitools{$toolhash{'id'}}{'url'};                  $exttoolremote = $ltitools{$toolhash{'id'}}{'url'};
             }              }
Line 339  described at http://www.lon-capa.org. Line 364  described at http://www.lon-capa.org.
   
 =over  =over
   
 =item wrapper($url,$brcrum,$absolute,$is_ext,$is_pdf,$title))  =item wrapper($url,$brcrum,$absolute,$is_ext,$is_pdf,$linktext,$explanation,$title,$width,$height)
   
 =over  =over
   

Removed from v.1.63  
changed lines
  Added in v.1.66


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