[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /auth publiccheck.pm /interface loncommon.pm

droeschl droeschl@source.lon-capa.org
Mon, 26 Oct 2009 18:59:17 -0000


droeschl		Mon Oct 26 18:59:17 2009 EDT

  Modified files:              
    /loncom	loncapa_apache.conf 
    /loncom/auth	publiccheck.pm 
    /loncom/interface	loncommon.pm 
  Log:
  - Bug 6105
  - Added consistent header for publicly accessible pages.
  - Added PerlAccessHandler publiccheck to /adm/coursecatalog to get a clean environment when accessing the page.
  - removed titletable which was not displayed anymore.
  
  
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.188 loncom/loncapa_apache.conf:1.189
--- loncom/loncapa_apache.conf:1.188	Fri Sep 25 13:51:31 2009
+++ loncom/loncapa_apache.conf	Mon Oct 26 18:58:47 2009
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.188 2009/09/25 13:51:31 droeschl Exp $
+## $Id: loncapa_apache.conf,v 1.189 2009/10/26 18:58:47 droeschl Exp $
 ##
 
 #
@@ -1279,6 +1279,7 @@
 <LocationMatch "^/adm/coursecatalog">
 SetHandler perl-script
 PerlHandler Apache::coursecatalog
+PerlAccessHandler      Apache::publiccheck
 ErrorDocument	  500 /adm/errorhandler
 </LocationMatch>
 
Index: loncom/auth/publiccheck.pm
diff -u loncom/auth/publiccheck.pm:1.17 loncom/auth/publiccheck.pm:1.18
--- loncom/auth/publiccheck.pm:1.17	Fri Sep 25 13:51:45 2009
+++ loncom/auth/publiccheck.pm	Mon Oct 26 18:59:02 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: publiccheck.pm,v 1.17 2009/09/25 13:51:45 droeschl Exp $
+# $Id: publiccheck.pm,v 1.18 2009/10/26 18:59:02 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,7 +64,8 @@
 	|| $requrl=~m|^/adm/help/.*\.hlp$|
 	|| $requrl=~m|^/adm/[^/]+/[^/]+/aboutme/portfolio$|
 	|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public') 
-    || $requrl=~m|^/adm/blockingstatus/.*$|) {
+    || $requrl=~m|^/adm/blockingstatus/.*$| 
+    || $requrl eq '/adm/coursecatalog') {
         &process_public($r,$requrl);
         return OK;
     } elsif (&Apache::lonnet::is_portfolio_url($requrl)) {
@@ -81,7 +82,7 @@
     } elsif ($requrl eq '/adm/blockedaccess') {
        &process_public($r,$requrl);
        return OK;
-    } 
+    }
     return DECLINED;
 }
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.902 loncom/interface/loncommon.pm:1.903
--- loncom/interface/loncommon.pm:1.902	Sat Oct 24 03:24:13 2009
+++ loncom/interface/loncommon.pm	Mon Oct 26 18:59:16 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.902 2009/10/24 03:24:13 raeburn Exp $
+# $Id: loncommon.pm,v 1.903 2009/10/26 18:59:16 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4444,48 +4444,44 @@
 
     if ($env{'environment.remote'} eq 'off') {
         # No Remote
-        if ($env{'request.state'} eq 'construct') {
-            $forcereg=1;
-        }
+        if ($no_nav_bar) { return $bodytag; } 
 
-    #    if ($env{'request.state'} eq 'construct') {
-    #        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
-    #    }
+        if ($env{'request.state'} eq 'construct') { $forcereg=1; }
 
-        my $titletable = '<table id="LC_title_bar">'
-                            ."<tr><td> $titleinfo $dc_info</td>"
-                            .'</tr></table>';
+        #    if ($env{'request.state'} eq 'construct') {
+        #        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
+        #    }
 
-        if ($no_nav_bar) {
-            $bodytag .= $titletable;
-        } else {
-            $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
-                <em>$realm</em> $dc_info</div>| unless $env{'form.inhibitmenu'};
+        $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
+            <em>$realm</em> $dc_info</div>| unless $env{'form.inhibitmenu'};
 
-#SD $titletable is obsolete
-#SD            if ($env{'request.state'} eq 'construct') {
-#SD                $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable);
-#SD            } else {
-#SD                $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable;
-#SD            }
-               if (   $env{'form.inhibitmenu'} eq 'yes' 
-                   || $ENV{'REQUEST_URI'} eq '/adm/logout'
-                   || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
-                   
-                   return $bodytag;
-               }
+        if (   $env{'form.inhibitmenu'} eq 'yes' 
+            || $ENV{'REQUEST_URI'} eq '/adm/logout'
+            || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
+
+            return $bodytag;
+        }
+
+        $bodytag .= Apache::lonhtmlcommon::scripttag(
+            Apache::lonmenu::utilityfunctions(), 'start');
 
-               $bodytag .= Apache::lonhtmlcommon::scripttag(
-                                Apache::lonmenu::utilityfunctions(),
-                                'start');
-               $bodytag .= Apache::lonmenu::primary_menu();
-               $bodytag .= Apache::lonmenu::secondary_menu();
-               #SD remove next line
-               #$bodytag .= Apache::lonmenu::menubuttons($forcereg);
-               $bodytag .= Apache::lonmenu::serverform();
-               $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); 
-               $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg;
+        $bodytag .= Apache::lonmenu::primary_menu();
+
+        #don't show menus for public users
+        if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){
+            $bodytag .= Apache::lonmenu::secondary_menu();
+            $bodytag .= Apache::lonmenu::serverform();
+            $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); 
+            $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg;
+        }else{
+            # this is to seperate menu from content when there's no secondary
+            # menu. Especially needed for public accessible ressources.
+            $bodytag .= '<hr style="clear:both" />';
+            $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); 
         }
+
+        #SD testing
+        #$bodytag .= Apache::lonmenu::menubuttons($forcereg);
         return $bodytag;
     }