--- loncom/publisher/lonupload.pm 2003/11/08 11:11:01 1.23
+++ loncom/publisher/lonupload.pm 2004/03/31 05:24:00 1.26
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Handler to upload files into construction space
#
-# $Id: lonupload.pm,v 1.23 2003/11/08 11:11:01 albertel Exp $
+# $Id: lonupload.pm,v 1.26 2004/03/31 05:24:00 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -79,7 +79,13 @@ sub upfile_store {
sub phaseone {
- my ($r,$fn,$uname,$udom)=@_;
+ my ($r,$fn,$uname,$udom,$mode)=@_;
+ my $action = '/adm/upload';
+ if ($mode eq 'testbank') {
+ $action = '/adm/testbank';
+ } elsif ($mode eq 'imsimport') {
+ $action = '/adm/imsimport';
+ }
$ENV{'form.upfile.filename'}=~s/\\/\//g;
$ENV{'form.upfile.filename'}=~s/^.*\/([^\/]+)$/$1/;
if ($ENV{'form.upfile.filename'}) {
@@ -94,16 +100,31 @@ sub phaseone {
&Debug($r, "Filename for upload: $fn");
if (($fn) && ($fn!~/\/$/)) {
- $r->print('
');
+ "/priv/$uname/".
+ ' ');
+ $r->print(' '.&mt('Please indicate the type of file you are uploading. The possible types of file are as follows:').'
+
+
'.&mt('Regular file:').''.&mt(' A file that requires no special handling during upload. The "Regular file" designation applies to html files, image files etc., as well as to zip, tar or gzip files that you wish to decompress after upload. In the case of a zip/tar/gz file etc., once the file has been uploaded, a "Decompress" link will automatically be displayed adjacent to the name of the file in the display of construction space directory contents. You will be able to decompress this file by clicking the link.').'
+
'.&mt('Testbank file:').''.&mt(' a testbank file containing plain text (ascii) questions and answers, which you plan to convert to LON-CAPA problems. The following question types can be converted: 1 of N multiple choice questions, individual True/False questions, groups of True/False questions, Fill-in-the-blank questions, Ranking questions, and Essay/short answer questions. Specific information about the format of the questions, foils, and correct answers is available ').''.&mt('here').','.&mt(' and is also included in the pages displayed during step-by-step conversion of the testbank. The original testbank file can be removed from your construction space later, once the testbank questions have been converted.').'
+
'.&mt('IMS package').':'.&mt(' a file containing course content from another Course Management System (e.g., Blackboard or ANGEL) packaged according to the IMS 1.1 specification. The original IMS package file can be removed from your construction space later, once the package has been decompressed and the files converted to LON-CAPA sequence, page, problem, or bulletin board files, or stored as html, image or movie files etc., as appropriate.').'
+
+ '.&mt('Choose file type:').'
+
+
+
+');
+ $r->print('');
# Check for bad extension and warn user
if ($fn=~/\.(\w+)$/ &&
(&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
@@ -126,7 +147,14 @@ sub phaseone {
}
sub phasetwo {
- my ($r,$tfn,$uname,$udom)=@_;
+ my ($r,$tfn,$uname,$udom,$mode)=@_;
+ my $action = '/adm/upload';
+ my $returnflag = '';
+ if ($mode eq 'testbank') {
+ $action = '/adm/testbank';
+ } elsif ($mode eq 'imsimport') {
+ $action = '/adm/imsimport';
+ }
my $fn='/priv/'.$uname.'/'.$tfn;
$fn=~s/\/+/\//g;
&Debug($r, "Filename is ".$tfn);
@@ -137,13 +165,13 @@ sub phasetwo {
# target is the full filesystem path of the destination file.
my $base = &File::Basename::basename($fn);
my $path = &File::Basename::dirname($fn);
- $base = &HTML::Entities::encode($base);
+ $base = &HTML::Entities::encode($base,'<>&"');
my $url = $path."/".$base;
&Debug($r, "URL is now ".$url);
my $datatoken=$ENV{'form.datatoken'};
if (($fn) && ($datatoken)) {
if ((-e $target) && ($ENV{'form.override'} ne 'Yes')) {
- $r->print('