File:  [LON-CAPA] / loncom / publisher / Attic / lonconstruct.pm
Revision 1.37: download - view: text, annotated - select for diffs
Mon Apr 12 15:05:51 2010 UTC (14 years, 1 month ago) by droeschl
Branches: MAIN
CVS tags: language_hyphenation_merge, language_hyphenation, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
In process of removing remote control, remote navmap and different icon modes code
- lonconstruct: instead of rendering the construction space sites in a frameset, we
  redirect to the content page. This change keeps all URLs intact. This should be
  solved more elegantly at a later point (e.g. when reworking URLs for multi-domain
  servers)

- mydesk.tab, lonmenu.pm: replaced gotop function call by target="_top" attribute
  to links, also removed gotop function
- added 'Feeds' to primary menu according to 3.0 draft

- loncommon: removed unused/redundand code fragments

    1: # The LearningOnline Network with CAPA
    2: # Construction Space Page Wrapper for Construction
    3: #
    4: # $Id: lonconstruct.pm,v 1.37 2010/04/12 15:05:51 droeschl Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: #
   29: 
   30: 
   31: =pod
   32: 
   33: =head1
   34: 
   35: =head1 NAME
   36: 
   37: Apache::lonconstruct
   38: 
   39: =head1 SYNOPSIS
   40: 
   41: Page wrapper for handling construction space.
   42: 
   43: This is part of the LearningOnline Network with CAPA project
   44: described at http://www.lon-capa.org.
   45: 
   46: 
   47: =item Debug($request, $message)
   48: 
   49:   If debugging is enabled puts out a debuggin message determined by the
   50:   caller.  The debug message goes to the Apache error log file. Debugging
   51:   is enabled by ssetting the module global DEBUG variable to nonzero (TRUE).
   52: 
   53:  Parameters:
   54: 
   55: =over 4
   56:  
   57: =item $request - The curretn request operation.
   58: 
   59: =item $message - The message to put inthe log file.
   60: 
   61: =back
   62:   
   63:  Returns:
   64:    nothing.
   65: 
   66: =cut
   67: 
   68: package Apache::lonconstruct;
   69: 
   70: 
   71: use strict;
   72: use Apache::Constants qw(:common :http :methods);
   73: use Apache::lonnet;
   74: use HTML::Entities();
   75: 
   76: my $DEBUG = 0;
   77: 
   78: 
   79: sub Debug {
   80:     # Put out the indicated message but only if DEBUG is true.
   81:     if ($DEBUG) {
   82: 	my ($r,$message) = @_;
   83: 	$r->log_reason($message);
   84:     }
   85: } 
   86: 
   87: # ================================================================ Main Handler
   88: 
   89: sub handler {
   90:    my $r=shift;
   91: 
   92: # -------------------------------------------------------------- Build frameset
   93: 
   94:    &Apache::loncommon::content_type($r,'text/html');
   95:    $r->send_http_header;
   96:    return OK if $r->header_only;
   97: 
   98:    my $lowerframe=$r->path_info;
   99:    &Debug($r, "Initial URL for lower frame: ".$lowerframe);
  100:    $lowerframe=~s/^\//\/\~/;
  101:    &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe);
  102:    $lowerframe= &HTML::Entities::encode($lowerframe,'<>&"');
  103:    &Debug($r, "Lower frame URL after quote subst: ".$lowerframe);
  104: 
  105: #
  106: # Are we forcing edit mode?
  107: #
  108: 
  109:    &Apache::loncommon::get_unprocessed_cgi
  110:         ($ENV{'QUERY_STRING'},['forceedit']);
  111:    if ($env{'form.forceedit'}) {
  112:        $lowerframe.='?editmode=Edit&problemmode=editxml';
  113:    }	
  114:    &Apache::loncommon::get_unprocessed_cgi
  115:         ($ENV{'QUERY_STRING'},['forceColoredit']);
  116:    if ($env{'form.forceColoredit'}) {
  117:        $lowerframe.='?editmode=Edit&problemmode=edit';
  118:    }
  119: 
  120:    # when the remote control existed we used to force the
  121:    # pages of construction space into a frameset.
  122:    # without remote control, we can elimnate this frameset
  123:    # and redirect to the url of the content frame.
  124:    # This keeps all URLs intact. 
  125:    $r->internal_redirect($lowerframe);
  126:    return OK;
  127: }
  128: 1;
  129: __END__
  130: 

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