# The LearningOnline Network with CAPA
# Souce Code handler
#
# $Id: lonsource.pm,v 1.8 2004/07/08 20:17:59 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, $listname) = @_;
my $sourcelink = "http://".$ENV{'SERVER_NAME'}.
"/adm/source/?filename=".$filename."&listname=".$listname;
return $sourcelink;
}
sub stage_2 {
my ($r, $filename, $author, $listname) = @_;
$filename = $filename;
&Apache::loncommon::content_type($r,'text/html');
my ($uname, $udom) = &Apache::loncacc::constructaccess('/~'.$author.'/',$r->dir_config('lonDefDomain'));
$r->send_http_header;
$r->print('
LON-CAPA Move source to construction space');
$r->print(&Apache::loncommon::bodytag('Problem source code moving operation'));
$r->print("Please enter the directory that you would like the source code to go into, a default has also been provided ");
$r->print("Also note, the path is in reference to the root of your construction space, and new directories will be automatically created.
");
$r->print('');
}
sub delete_copy_file {
my ($r, $author_name, $newpath, $filename, $path_to_new_file, $type) = @_;
if($type eq '1') {
$r->print("Cannot delete non-obsolete published file Please
use the code view in previous window to use shared code
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.