Diff for /rat/lonwrapper.pm between versions 1.37 and 1.41

version 1.37, 2009/11/24 05:37:35 version 1.41, 2011/11/07 20:06:29
Line 31  package Apache::lonwrapper; Line 31  package Apache::lonwrapper;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::lonnet;  
 use Apache::lonxml();  
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonmenu();  use Apache::lonnet;
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
   
 sub simple_menu {  
 #  
 # Producing the menu buttons  
 #  
     return &Apache::loncommon::start_page('Menu',undef,  
   {'only_body' => 1,  
    'bgcolor'   => '#FFFFFF',}).  
  &Apache::lonmenu::menubuttons(1,'web',1).  
  &Apache::loncommon::end_page();  
 }  
   
   
 sub wrapper {  sub wrapper {
     my ($topurl,$bottomurl) = @_;      my $url = shift;
   
     my %layout = ('border' => 0);  
     if ($env{'environment.remote'} eq 'off') {  
         if (($env{'request.course.id'}) &&  
             (&Apache::lonnet::allowed('opa',$env{'request.course.id'}.  
              ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) {  
             $layout{'rows'} = "135,*";  
         } else {  
             $layout{'rows'} = "100,*";  
         }  
     } else {  
  $layout{'rows'} = "1,*";  
  $topurl = "/adm/rat/empty.html";  
     }  
   
     my $start_page =   
  &Apache::loncommon::start_page(undef,undef,  
        {'force_register' => 1,  
  'frameset'       => 1,  
  'add_entries'    => \%layout, });  
   
     my $end_page =       my $startpage =  Apache::loncommon::start_page('Menu',undef,
  &Apache::loncommon::end_page({'frameset' => 1});    { 'force_register' =>1, 'bgcolor'   => '#FFFFFF',}) ;
           my $endpage =  Apache::loncommon::end_page();
     foreach my $url ($topurl,$bottomurl) {  
  if ($url !~ /^https?\:/) {      my $script = Apache::lonhtmlcommon::scripttag(<<SCRIPT );
     $url = &Apache::lonenc::check_encrypt($url);      \$(document).ready( function() {
  }          \$(window).unbind('resize').resize(function(){
     }              var header = \$('.LC_head_subbox')[0] ?  \$('.LC_head_subbox') 
 #                                                    :  \$('#LC_breadcrumbs');
 # frame-based rendering for graphical interface              var pos = header.height() + header.position().top + 5;
 #              \$('.LC_iframecontainer').css('top', pos);
     my $result =<<ENDDOCUMENT;          });
 $start_page      });
 test      window.onload = function(){  \$(window).trigger('resize') }; 
 <frame src="$topurl" />  SCRIPT
 <frame src="$bottomurl" />  
 $end_page      # javascript will position the iframe if window was resized (or zoomed)
 ENDDOCUMENT      return <<ENDFRAME;
       $startpage
     return $result;      $script
       <div class="LC_iframecontainer">
           <iframe src="$url">No iframe support!</iframe>
       </div>
       $endpage
   ENDFRAME
 }  }
   
 sub handler {  sub handler {
Line 102  sub handler { Line 72  sub handler {
   
     return OK if $r->header_only;      return OK if $r->header_only;
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      my $url = $r->uri;
     ['wrapperdisplay']);      my $is_ext;
     if ($env{'form.wrapperdisplay'} eq 'menu') {  
  $r->print(&simple_menu());      for ($url){
  return OK;          s|^/adm/wrapper||;
           $is_ext = $_ =~ s|^/ext/|http://|;         
           s|http://https://|https://|;
           s|&colon;|:|g;              
     }      }
   
     my $orgurl=$r->uri;  
     my $url=$orgurl;  
     $orgurl.=(($orgurl=~/\?/)?'&':'?').$ENV{'QUERY_STRING'};  
     $orgurl.=(($orgurl=~/\?/)?'&':'?').'wrapperdisplay=menu';  
     $url=~s/^\/adm\/wrapper//;  
     my $is_ext = $url =~ m|^/ext/|;  
     $url=~s{^/ext/}{http://};  
     $url=~s|http://https://|https://|;  
     $url=~s|&colon;|:|g;  
 #  #
 # Actual URL  # Actual URL
 #  #
     if ($url=~/\.(problem|exam|quiz|assess|survey|form|library)$/) {      if ($url=~/$LONCAPA::assess_re/) {
 #  #
 # This is uploaded homework  # This is uploaded homework
 #  #
  $env{'request.state'}='uploaded';          $env{'request.state'}='uploaded';
  &Apache::lonhomework::renderpage($r,$url);          &Apache::lonhomework::renderpage($r,$url);
     } else {      } else {
 #  #
 # This is not homework  # This is not homework
 #  #
  if ($is_ext) {          if ($is_ext) {
     $ENV{'QUERY_STRING'}=~s/(^|\&)symb=[^\&]*/$1/;              $ENV{'QUERY_STRING'} =~ s/(^|\&)symb=[^\&]*/$1/;
             $ENV{'QUERY_STRING'} =~ s/\&$//;                $ENV{'QUERY_STRING'} =~ s/\&$//;  
  }          }
   
         unless ($ENV{'QUERY_STRING'} eq '') {          unless ($ENV{'QUERY_STRING'} eq '') {
     $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'};              $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'};
         }          }
  # reappend the query arguments  
  $r->print(&wrapper($orgurl,$url));          # encrypt url if not external
           &Apache::lonenc::check_encrypt(\$url) if $url !~ /^https?\:/ ;
   
           $r->print( wrapper($url) );
   
     } # not just the menu      } # not just the menu
       
     return OK;      return OK;
 } # handler  } # handler
   
Line 164  described at http://www.lon-capa.org. Line 134  described at http://www.lon-capa.org.
   
 =over  =over
   
 =item simple_menu()  =item wrapper($url)
   
 =item wrapper()  Wraps $url in an iframe and generates a page for it.
   Returns markup for the entire page.
   
 =item handler()  =item handler()
   

Removed from v.1.37  
changed lines
  Added in v.1.41


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.