File:  [LON-CAPA] / loncom / homework / daxepage.pm
Revision 1.4: download - view: text, annotated - select for diffs
Sun Feb 14 16:07:13 2016 UTC (8 years, 1 month ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- Include content-type in response headers.

# The LearningOnline Network
# Page with Daxe on the left side and the preview on the right side
#
# $Id: daxepage.pm,v 1.4 2016/02/14 16:07:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
###

package Apache::daxepage;

use Apache::Constants;

sub handler {
    my $request = shift;
    my $uri = $request->uri;
    $uri =~ s/^\/daxepage//;
    &Apache::loncommon::content_type($request,'text/html');
    if ($uri !~ /\.(task|problem|exam|quiz|assess|survey|library|xml|html|htm|xhtml|xhtm)$/) {
        $request->status(406);
        return OK;
    }
    my $result = '';
    $result .= "<!DOCTYPE html>\n";
    $result .= "<html>\n";
    $result .= "<head>\n";
    my $name = $uri;
    $name =~ s/^.*\/([^\/]+)$/$1/;
    $result .= "  <title>LON-CAPA Daxe: $name</title>\n";
    $result .= "  <style>\n";
    $result .= "    body { margin: 0; }\n";
    $result .= "    #daxe { position:absolute; top:0; left:0; width:100%; height:100%; border:none; }\n";
    $result .= "  </style>\n";
    $result .= "</head>\n";
    $result .= "<body>\n";
    my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&amp;file=/daxeopen'.$uri.
        '&amp;save=/daxesave';
    $result .= '  <iframe id="daxe" src="'.$daxeurl.'"></iframe>'."\n";
    $result .= "</body>\n";
    $result .= "</html>\n";
    $request->print($result);
    return OK;
}

1;
__END__

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