File:  [LON-CAPA] / loncom / publisher / Attic / lonconstruct.pm
Revision 1.14: download - view: text, annotated - select for diffs
Sun Sep 21 03:32:06 2003 UTC (20 years, 8 months ago) by taceyjo1
Branches: MAIN
CVS tags: HEAD

Added in the backend code to allow for the edit link (Bug: 2027)

    1: # The LearningOnline Network with CAPA
    2: # Construction Space Page Wrapper for Construction
    3: #
    4: # $Id: lonconstruct.pm,v 1.14 2003/09/21 03:32:06 taceyjo1 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: # (Page Handler
   30: #
   31: # (TeX Content Handler
   32: #
   33: # 05/29/00,05/30 Gerd Kortemeyer)
   34: # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
   35: # 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer)
   36: #
   37: # 11/22,11/23,11/28,
   38: # 03/30/01 Gerd Kortemeyer
   39: package Apache::lonconstruct;
   40: 
   41: 
   42: use strict;
   43: use Apache::Constants qw(:common :http :methods);
   44: use Apache::lonnet;
   45: use Apache::Log ();
   46: use HTML::Entities();
   47: 
   48: my $DEBUG = 0;
   49: =pod
   50: 
   51: =item Debug($request, $message)
   52: 
   53:   If debugging is enabled puts out a debuggin message determined by the
   54:   caller.  The debug message goes to the Apache error log file. Debugging
   55:   is enabled by ssetting the module global DEBUG variable to nonzero (TRUE).
   56: 
   57:  Parameters:
   58: 
   59: =over 4
   60:  
   61: =item $request - The curretn request operation.
   62: 
   63: =item $message - The message to put inthe log file.
   64: 
   65: =back
   66:   
   67:  Returns:
   68:    nothing.
   69: 
   70: =cut
   71: 
   72: sub Debug {
   73:   
   74:   # Marshall the parameters.
   75:   
   76:   my $r       = shift;
   77:   my $log     = $r->log;
   78:   my $message = shift;
   79:   
   80:   # Put out the indicated message butonly if DEBUG is false.
   81:   
   82:   if ($DEBUG) {
   83:     $log->debug($message);
   84:   }
   85: }
   86: 
   87: 
   88: 
   89: 
   90: # ================================================================ Main Handler
   91: 
   92: sub handler {
   93:    my $r=shift;
   94: 
   95: # -------------------------------------------------------------- Build frameset
   96: 
   97:    $r->content_type('text/html');
   98:    $r->send_http_header;
   99:    return OK if $r->header_only;
  100: 
  101:    my $lowerframe=$r->path_info;
  102: 
  103:    &Debug($r, "Initial URL for lower frame: ".$lowerframe);
  104:    $lowerframe=~s/^\//\/\~/;
  105:    &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe);
  106:    $lowerframe= &HTML::Entities::encode($lowerframe);
  107:    &Debug($r, "LOwer frame URL after quote subst: ".$lowerframe);
  108: 
  109: #
  110: # Are we forcing edit mode?
  111: #
  112: 
  113:    &Apache::loncommon::get_unprocessed_cgi
  114:         ($ENV{'QUERY_STRING'},['forceedit']);
  115:    if ($ENV{'form.forceedit'}) {
  116:        $lowerframe.='?editmode=Edit&problemmode=EditXML';
  117:    }	
  118:    &Apache::loncommon::get_unprocessed_cgi
  119:         ($ENV{'QUERY_STRING'},['forceColoredit']);
  120:    if ($ENV{'form.forceColoredit'}) {
  121:        $lowerframe.='?editmode=Edit&problemmode=Edit';
  122:    }
  123: 
  124:    $r->print(<<ENDPAGE);
  125: <html>
  126: <head><title>LON-CAPA Construction Space</title>
  127: <script language="JavaScript">
  128: var lastknownpriv="$lowerframe";
  129: </script>
  130: </head>
  131: <frameset rows="110,*" border="0">
  132: <frame src='/adm/publisher.html'>
  133: <frame src="$lowerframe" name="LONCAPAToBePublished">
  134: </frameset>
  135: </html>
  136: ENDPAGE
  137:    return OK;
  138: }
  139: 1;
  140: __END__
  141: 

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