Annotation of loncom/interface/lonsource.pm, revision 1.1
1.1 ! taceyjo1 1: # The LearningOnline Network with CAPA
! 2: # Publication Handler
! 3: #
! 4: # $Id: $
! 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: package Apache::lonsource;
! 32:
! 33: use strict;
! 34: use Apache::lonnet();
! 35: use Apache::loncommon();
! 36: use Apache::lonhtmlcommon();
! 37: use Apache::lonsequence();
! 38: use Apache::Constants qw(:common :http);
! 39: use Apache::lonmeta;
! 40: use Apache::File;
! 41: use Apache::lonlocal;
! 42: use HTML::Entities;
! 43:
! 44: sub make_link {
! 45: my ($filename) = @_;
! 46: my $sourcelink = "http://".$ENV{'SERVER_NAME'}."/adm/source/?filename=".$filename;
! 47:
! 48:
! 49: return $sourcelink;
! 50:
! 51: }
! 52:
! 53: sub stage_2 {
! 54: my ($r, $filename) = @_;
! 55: $r->print("Comming Soon");
! 56: return OK;
! 57: }
! 58:
! 59: sub print_item {
! 60: my ($r, $filename) = @_;
! 61: $filename = "/home/httpd/html".$filename;
! 62: my $file_output = &Apache::lonnet::getfile($filename);
! 63: my ($rows,$cols) = &Apache::edit::textarea_sizes(\$file_output);
! 64: $r->print('<textarea rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'.
! 65: &HTML::Entities::encode($file_output,'<>&"').'</textarea>');
! 66:
! 67: return OK;
! 68:
! 69: }
! 70:
! 71:
! 72: sub handler {
! 73: my $r=shift;
! 74: if($ENV{'form.action'} eq 'stage2') {
! 75: &stage_2($r, $ENV{'form.filename'});
! 76: } else {
! 77: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
! 78: ['filename']);
! 79: return FORBIDDEN if !&Apache::lonnet::allowed('cre',$ENV{'form.filename'})
! 80: &Apache::loncommon::content_type($r,'text/html');
! 81: my $filename = $ENV{'form.filename'};
! 82: $r->send_http_header;
! 83: $r->print(' <form name="copy" action="/adm/source/" target="_parent" method="post">
! 84: <input type="button" value="Close Window" name="close" onClick="window.close()">
! 85: <input type="hidden" name="filename" value="'.$filename.'" />
! 86: <input type="hidden" name="action" value="stage2" />
! 87: <input type="submit" value="Copy to CSTR" />
! 88: </form>');
! 89: $r->print('<hr />');
! 90: &print_item($r, $ENV{'form.filename'});
! 91: }
! 92: return OK;
! 93:
! 94: }
! 95:
! 96:
! 97: 1;
! 98:
! 99:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>