# The LearningOnline Network with CAPA
# Publication Handler
#
# $Id: lonsource.pm,v 1.1 2004/06/12 01:08:11 taceyjo1 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::lonsource;
use strict;
use Apache::lonnet();
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonsequence();
use Apache::Constants qw(:common :http);
use Apache::lonmeta;
use Apache::File;
use Apache::lonlocal;
use HTML::Entities;
sub make_link {
my ($filename) = @_;
my $sourcelink = "http://".$ENV{'SERVER_NAME'}."/adm/source/?filename=".$filename;
return $sourcelink;
}
sub stage_2 {
my ($r, $filename) = @_;
$r->print("Comming Soon");
return OK;
}
sub print_item {
my ($r, $filename) = @_;
$filename = "/home/httpd/html".$filename;
my $file_output = &Apache::lonnet::getfile($filename);
my ($rows,$cols) = &Apache::edit::textarea_sizes(\$file_output);
$r->print('<textarea rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'.
&HTML::Entities::encode($file_output,'<>&"').'</textarea>');
return OK;
}
sub handler {
my $r=shift;
if($ENV{'form.action'} eq 'stage2') {
&stage_2($r, $ENV{'form.filename'});
} else {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['filename']);
return FORBIDDEN if !&Apache::lonnet::allowed('cre',$ENV{'form.filename'})
&Apache::loncommon::content_type($r,'text/html');
my $filename = $ENV{'form.filename'};
$r->send_http_header;
$r->print(' <form name="copy" action="/adm/source/" target="_parent" method="post">
<input type="button" value="Close Window" name="close" onClick="window.close()">
<input type="hidden" name="filename" value="'.$filename.'" />
<input type="hidden" name="action" value="stage2" />
<input type="submit" value="Copy to CSTR" />
</form>');
$r->print('<hr />');
&print_item($r, $ENV{'form.filename'});
}
return OK;
}
1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>