[LON-CAPA-cvs] cvs: rat / lonwrapper.pm loncom/auth lonacc.pm loncom/interface loncommon.pm lonmenu.pm lonsyllabus.pm
droeschl
droeschl@source.lon-capa.org
Wed, 03 Mar 2010 21:33:20 -0000
This is a MIME encoded message
--droeschl1267652000
Content-Type: text/plain
droeschl Wed Mar 3 21:33:20 2010 EDT
Modified files:
/loncom/auth lonacc.pm
/loncom/interface loncommon.pm lonmenu.pm lonsyllabus.pm
/rat lonwrapper.pm
Log:
- replaced frameset by iframe in lonwrapper
! IE 7 doesn't scale iframe to 100% height, IE 6 and 8 do
! scrolling in Mobile Safari is limited
- added styles for iframe to loncommon
- replaced menubuttons call in lonwrapper by start_page call to make full use of the new header
- removed remote control specific code (RC will be removed shortly)
- replaced code in lonsyllabus with a call to new wrapper routine
- removed subs initlittle and menubutton from lonmenu since they aren't needed anymore
--droeschl1267652000
Content-Type: text/plain
Content-Disposition: attachment; filename="droeschl-20100303213320.txt"
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.130 loncom/auth/lonacc.pm:1.131
--- loncom/auth/lonacc.pm:1.130 Tue Nov 3 03:06:07 2009
+++ loncom/auth/lonacc.pm Wed Mar 3 21:33:10 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.130 2009/11/03 03:06:07 raeburn Exp $
+# $Id: lonacc.pm,v 1.131 2010/03/03 21:33:10 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -417,7 +417,7 @@
my $preserved;
foreach my $pair (split(/&/,$query)) {
my ($name, $value) = split(/=/,$pair);
- unless (($name eq 'symb') || ($name eq 'wrapperdisplay')) {
+ unless ($name eq 'symb') {
$preserved .= $pair.'&';
}
}
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.946 loncom/interface/loncommon.pm:1.947
--- loncom/interface/loncommon.pm:1.946 Wed Mar 3 16:54:03 2010
+++ loncom/interface/loncommon.pm Wed Mar 3 21:33:15 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.946 2010/03/03 16:54:03 raeburn Exp $
+# $Id: loncommon.pm,v 1.947 2010/03/03 21:33:15 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4874,6 +4874,14 @@
return <<END;
+
+/* needed for iframe to allow 100% height in FF */
+body, html {
+ margin: 0;
+ padding: 0 0.5%;
+ height: 99%; /* to avoid scrollbars */
+}
+
body {
font-family: $sans;
line-height:130%;
@@ -4902,6 +4910,20 @@
width:400px;
}
+.LC_iframecontainer {
+ width: 98%;
+ margin: 0;
+ position: fixed;
+ top: 8.5em;
+ bottom: 0;
+}
+
+.LC_iframecontainer iframe{
+ border: none;
+ width: 100%;
+ height: 100%;
+}
+
.LC_filename {
font-family: $mono;
white-space:pre;
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.314 loncom/interface/lonmenu.pm:1.315
--- loncom/interface/lonmenu.pm:1.314 Wed Feb 24 17:38:52 2010
+++ loncom/interface/lonmenu.pm Wed Mar 3 21:33:15 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.314 2010/02/24 17:38:52 droeschl Exp $
+# $Id: lonmenu.pm,v 1.315 2010/03/03 21:33:15 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,15 +109,6 @@
Same as primary_menu() but operates on @secondary_menu.
-=item DEPRECATED: initlittle()
-
-This routine returns a translated hash for the menu items in the top inline
-menu row
-
-=item menubuttons()
-
-This gets called at the top of the body section
-
=item show_return_link()
=item registerurl()
@@ -344,198 +335,6 @@
return "<ul id=\"LC_secondary_menu\">$menu</ul>";
}
-
-#
-# This routine returns a translated hash for the menu items in the top inline menu row
-# Probably should be in mydesk.tab
-
-#SD this sub is deprecated - don't use it
-sub initlittle {
- return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
- 'nav' => 'Course Contents',
- 'main' => 'Main Menu',
- 'roles' => (&Apache::loncommon::show_course()?
- 'Courses':'Roles'),
- 'other' => 'Other Roles',
- 'docs' => 'Course Editor',
- 'exit' => 'Logout',
- 'login' => 'Log In',
- 'launch' => 'Launch Remote Control',
- 'groups' => 'Groups',
- 'gdoc' => 'Community Documents',
- );
-}
-
-#SD this sub is deprecated - don't use it
-#SD functionality is covered by new loncommon::bodytag and primary_menu(), secondary_menu()
-sub menubuttons {
- my $forcereg=shift;
- my $titletable=shift;
-#
-# Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes"
-#
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['inhibitmenu']);
- if (($env{'form.inhibitmenu'} eq 'yes') ||
- ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
-
- if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
-
- my %lt=&initlittle();
- my $navmaps='';
- my $reloadlink='';
- my $docs='';
- my $groups='';
- my $roles='<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';
- my $role_selector;
- my $showgroups=0;
- my ($cnum,$cdom);
-#
-# if the URL is hidden, symbs and the non-versioned version of the URL would be encrypted
-#
- my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
- my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
-
- my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
- $logo = '<a href="/adm/about.html"><img src="'.
- $logo.'" alt="LON-CAPA Logo" class="LC_noBorder" /></a>';
-
- if ($env{'request.state'} eq 'construct') {
-#
-# We are in construction space
-#
- if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
- my $returnurl = $env{'request.filename'};
- $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
- $escurl = &escape($returnurl);
- }
- }
- if ($env{'request.course.id'}) {
-#
-# We are in a course
-#
- $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my %coursegroups;
- my $viewgrps_permission =
- &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
- if (!$viewgrps_permission) {
- %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$cdom,$cnum);
- }
- if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
- $showgroups = 1;
- }
- $role_selector = &roles_selector($cdom,$cnum);
- if ($role_selector) {
- $roles = '<span class="LC_nobreak">'.$role_selector.' <a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></span>';
- }
- }
-
- if ($env{'environment.remote'} eq 'off') {
-# Remote Control is switched off
-# figure out colors
- my %lt=&initlittle();
-
- my $domain=&Apache::loncommon::determinedomain();
- my $function=&Apache::loncommon::get_users_function();
- my $link=&Apache::loncommon::designparm($function.'.link',$domain);
- my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
- my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
- my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
-
- if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
- return (<<ENDINLINEMENU);
- <ol class="LC_primary_menu LC_right">
- <li>$logo</li>
- <li><a href="/adm/roles" target="_top">$lt{'login'}</a></li>
- </ol>
- <hr />
-ENDINLINEMENU
- }
- $roles = '<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';
-# Do we have a NAV link?
- if ($env{'request.course.id'}) {
- my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='.
- $escsymb;
- if ($env{'environment.remotenavmap'} eq 'on') {
- $link="javascript:gonav('".$link."')";
- }
- $navmaps=(<<ENDNAV);
-<li><a href="$link" target="_top">$lt{'nav'}</a></li>
-ENDNAV
- my $is_community =
- (&Apache::loncommon::course_type() eq 'Community');
- if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
- my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'};
- $docs=(<<ENDDOCS);
-<li><a href="/adm/coursedocs" target="_top">$text</a></li>
-ENDDOCS
- }
- if ($showgroups) {
- $groups =(<<ENDGROUPS);
-<li><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></li>
-ENDGROUPS
- }
- if (&show_return_link()) {
- my $escreload=&escape('return:');
- $reloadlink=(<<ENDRELOAD);
-<li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>
-ENDRELOAD
- }
- if ($role_selector) {
- #$roles = '<td>'.$role_selector.'</td><td><a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></td>';
- $role_selector = '<li>'.$role_selector.'</li>';
- }
- }
- if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
- my $escreload=&escape('return:');
- $reloadlink=(<<ENDCRELOAD);
-<li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>
-ENDCRELOAD
- }
- my $reg = $forcereg ? &innerregister($forcereg,$titletable) : '';
- my $form = &serverform();
- my $utility = &utilityfunctions();
-
- #Prepare the message link that indicates the arrival of new mail
- my $messagelink = &Apache::lonmsg::mynewmail() ? "Message (new)" : "Message";
- $messagelink = '<a href="javascript:go(\'/adm/communicate\');">'
- . mt($messagelink) .'</a>';
-
- my $helplink = &Apache::loncommon::top_nav_help('Help');
- return (<<ENDINLINEMENU);
-<script type="text/javascript">
-// <![CDATA[
-// BEGIN LON-CAPA Internal
-$utility
-// ]]>
-</script>
-<ol class="LC_primary_menu LC_right">
- <li>$logo</li>
- <li>$messagelink</li>
- <li>$roles</li>
- <li>$helplink</li>
- <li><a href="/adm/logout" target="_top">$lt{'exit'}</a></li>
-</ol>
-<ul id="LC_secondary_menu">
-<li><a href="/adm/menu" target="_top">$lt{'main'}</a></li>
-$reloadlink
-$navmaps
-$docs
-$groups
-$role_selector
-</ul>
-$form
-<script type="text/javascript">
-// END LON-CAPA Internal
-</script>
-$reg
-ENDINLINEMENU
- } else {
- return '';
- }
-}
-
sub show_return_link {
return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
$env{'request.symb'} eq '')
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.106 loncom/interface/lonsyllabus.pm:1.107
--- loncom/interface/lonsyllabus.pm:1.106 Sun Jan 31 06:03:55 2010
+++ loncom/interface/lonsyllabus.pm Wed Mar 3 21:33:15 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.106 2010/01/31 06:03:55 faziophi Exp $
+# $Id: lonsyllabus.pm,v 1.107 2010/03/03 21:33:15 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -52,7 +52,7 @@
my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
# ------------------------------------------------------------ Get query string
&Apache::loncommon::get_unprocessed_cgi
- ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit','wrapperdisplay']);
+ ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit']);
# ----------------------------------------------------- Is this even a course?
my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);
if ($homeserver eq 'no_host') {
@@ -74,14 +74,8 @@
my $externalsyllabus=$courseenv{'externalsyllabus'};
if ($externalsyllabus=~/\w/) {
-
- if ($env{'form.wrapperdisplay'} eq 'menu') {
- $r->print(&Apache::lonwrapper::simple_menu());
- } else {
- $r->print(&Apache::lonwrapper::wrapper("/public/$cdom/$cnum/syllabus?wrapperdisplay=menu",
- $externalsyllabus));
- }
- return OK;
+ $r->print( Apache::lonwrapper::wrapper($externalsyllabus) );
+ return OK;
}
# ------------------------------ The buck stops here: internal syllabus display
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.37 rat/lonwrapper.pm:1.38
--- rat/lonwrapper.pm:1.37 Tue Nov 24 05:37:35 2009
+++ rat/lonwrapper.pm Wed Mar 3 21:33:20 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Wrapper for external and binary files as standalone resources
#
-# $Id: lonwrapper.pm,v 1.37 2009/11/24 05:37:35 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.38 2010/03/03 21:33:20 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,68 +31,36 @@
use strict;
use Apache::Constants qw(:common);
-use Apache::lonnet;
-use Apache::lonxml();
use Apache::lonenc();
-use Apache::lonmenu();
+use Apache::lonnet;
# ================================================================ 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 {
- my ($topurl,$bottomurl) = @_;
-
- 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 $url = shift;
- my $end_page =
- &Apache::loncommon::end_page({'frameset' => 1});
-
- foreach my $url ($topurl,$bottomurl) {
- if ($url !~ /^https?\:/) {
- $url = &Apache::lonenc::check_encrypt($url);
- }
- }
-#
-# frame-based rendering for graphical interface
-#
- my $result =<<ENDDOCUMENT;
-$start_page
-test
-<frame src="$topurl" />
-<frame src="$bottomurl" />
-$end_page
-ENDDOCUMENT
-
- return $result;
+ my $startpage = Apache::loncommon::start_page('Menu',undef,
+ { 'force_register' =>1, 'bgcolor' => '#FFFFFF',}) ;
+ my $endpage = Apache::loncommon::end_page();
+
+ # javascript will position the iframe if window was resized (or zoomed)
+ return <<ENDFRAME;
+ $startpage
+ <script type="text/javascript">
+ \$(document).ready( function() {
+ \$(window).unbind('resize').resize(function(){
+ var header = \$('#LC_head_subbox')[0] ? \$('#LC_head_subbox') : \$('#LC_breadcrumbs');
+ var pos = header.height() + header.position().top + 5;
+ \$('.iframecontainer').css('top', pos);
+ });
+ });
+ window.onload = function(){ \$(window).trigger('resize') };
+ </script>
+
+ <div class="LC_iframecontainer">
+ <iframe src="$url">No iframe support!</iframe>
+ </div>
+ $endpage
+ENDFRAME
}
sub handler {
@@ -102,22 +70,16 @@
return OK if $r->header_only;
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['wrapperdisplay']);
- if ($env{'form.wrapperdisplay'} eq 'menu') {
- $r->print(&simple_menu());
- return OK;
+ my $url = $r->uri;
+ my $is_ext;
+
+ for ($url){
+ s|^/adm/wrapper||;
+ $is_ext = $_ =~ s|^/ext/|http://|;
+ s|http://https://|https://|;
+ s|:|:|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|:|:|g;
#
# Actual URL
#
@@ -125,22 +87,28 @@
#
# This is uploaded homework
#
- $env{'request.state'}='uploaded';
- &Apache::lonhomework::renderpage($r,$url);
+ $env{'request.state'}='uploaded';
+ &Apache::lonhomework::renderpage($r,$url);
} else {
#
# This is not homework
#
- if ($is_ext) {
- $ENV{'QUERY_STRING'}=~s/(^|\&)symb=[^\&]*/$1/;
+ if ($is_ext) {
+ $ENV{'QUERY_STRING'} =~ s/(^|\&)symb=[^\&]*/$1/;
$ENV{'QUERY_STRING'} =~ s/\&$//;
- }
+ }
+
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
+
return OK;
} # handler
@@ -164,9 +132,10 @@
=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()
--droeschl1267652000--