--- loncom/imspackages/imsimport.pm 2010/09/26 02:10:49 1.33
+++ loncom/imspackages/imsimport.pm 2013/09/30 17:42:12 1.45
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: imsimport.pm,v 1.33 2010/09/26 02:10:49 raeburn Exp $
+# $Id: imsimport.pm,v 1.45 2013/09/30 17:42:12 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,7 +29,6 @@ package Apache::imsimport;
use strict;
use Apache::Constants qw(:common :http :methods);
-use Apache::loncacc;
use Apache::loncommon();
use Apache::lonnet;
use Apache::imsprocessor;
@@ -43,7 +42,7 @@ use LONCAPA;
# ---------------------------------------------------------------- Jscript One
sub jscript_one {
- my ($fullpath,$jsref,$formname) = @_;
+ my ($fullpath,$formname) = @_;
my %body_layout = ('rightmargin' => "0",
'leftmargin' => "0",
@@ -66,7 +65,7 @@ sub jscript_one {
nndi => 'Enter the name of the new directory where you will store the contents of your IMS package.',
go => 'Go',
);
- $$jsref = <<"END_OF_ONE";
+ return <<"END_OF_ONE";
function verify() {
if ((document.forms.$formname.newdir.value == '') || (!document.forms.$formname.newdir.value)) {
alert('$lt{'ddir'}')
@@ -101,7 +100,7 @@ function createWin() {
newWindow.document.write("")
newWindow.document.write("")
newWindow.document.write("$fullpath")
- newWindow.document.write("")
+ newWindow.document.write("")
newWindow.document.write("\\n")
newWindow.document.write("")
newWindow.document.write('$end_page')
@@ -115,7 +114,7 @@ END_OF_ONE
# ---------------------------------------------------------------- Jscript Two
sub jscript_two {
- my ($javascript,$user,$dom,$numcrs) = @_;
+ my ($user,$dom,$numcrs) = @_;
my %crsentry = ();
my $course_list;
my $title_list;
@@ -134,7 +133,21 @@ sub jscript_two {
$course_list = '"'.join('","',@crslist).'"';
$$numcrs = @crslist;
- $$javascript = qq#
+ my %lt = &Apache::lonlocal::texthash(
+ sel => 'Please select',
+ impto => 'Import topics only',
+ imptpa => 'Import topics + posts (with author)',
+ imptpn => 'Import topics + posts (no author)',
+ enrst => 'Enroll students only',
+ enrall => 'Enroll all users',
+ notreq => 'Not required',
+ errao => 'You must select one of the additional options when importing Discussion Boards.',
+ errtd => 'You must select a target course when importing Discussion Boards.',
+ errap => 'You must select one of the additional options when importing Enrollment.',
+ errte => 'You must select a target course when importing enrollment information.',
+ errcc => 'You must check at least one Content Type.',
+ );
+ return <<"END_OF_TWO";
function checkCourse() {
courseID_array = new Array($course_list)
@@ -182,7 +195,7 @@ function setCourse(step2Form,call) {
step2Form.targetcourse.length = 0
if (call == 'add') {
step2Form.targetcourse.length = 0
- step2Form.targetcourse.options[0] = new Option("Please Select","0",true,true)
+ step2Form.targetcourse.options[0] = new Option("$lt{'sel'}","0",true,true)
for (var i=0; i 0) {
@@ -235,7 +248,7 @@ function verify(caller) {
totcheck ++
if (opForm.elements[2*i].name == "board") {
if (opForm.elements[2*i+1].selectedIndex == 0) {
- alert("You must select one of the additional options when importing Discussion Boards ")
+ alert("$lt{'errao'}")
return false
}
if (numCrs == 0) {
@@ -244,14 +257,14 @@ function verify(caller) {
}
else {
if (opForm.targetcourse.selectedIndex == 0) {
- alert("You must select a target course when importing Discussion Boards")
+ alert("$lt{'errtd'}")
return false
}
}
}
if (opForm.elements[2*i].name == "users") {
if (opForm.elements[2*i+1].selectedIndex == 0) {
- alert("You must select one of the additional options when importing Enrollment")
+ alert("$lt{'errap'}")
return false
}
if (numCrs == 0) {
@@ -260,7 +273,7 @@ function verify(caller) {
}
else {
if (opForm.targetcourse.selectedIndex == 0) {
- alert("You must select a target course when importing enrollment information")
+ alert("$lt{'errte'}")
return false
}
}
@@ -268,7 +281,7 @@ function verify(caller) {
}
}
if (totcheck == 0) {
- alert("You must check the Checkbox for at least one Content Type");
+ alert("$lt{'errcc'}");
return false
}
return true
@@ -280,23 +293,18 @@ function nextPage(caller) {
}
}
-#;
-
-}
+END_OF_TWO
-# ---------------------------------------------------------------- Jscript Three
-sub jscript_three {
- my $javascript = shift;
}
# ---------------------------------------------------------------- Display One
sub display_one {
- my ($r,$uname,$fn,$fullpath,$formname) = @_;
- $r->print('');
}
# ---------------------------------------------------------------- Display Two
sub display_two {
- my ($r,$zipupload,$areas,$areaname,$cmsmap,$uname,$newdir,$numcrs,$fullpath) = @_;
+ my ($r,$zipupload,$areas,$areaname,$cmsmap,$fn,$numcrs,$fullpath) = @_;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder','source']);
my $cms = $env{'form.source'};
- my $dirname = $env{'form.newdir'};
- my $tempdir = &Apache::imsprocessor::create_tempdir('CSTR',$dirname,'');
+ my $tempdir = &Apache::imsprocessor::create_tempdir('CSTR',$env{'form.newdir'},'');
my $fname = &Apache::imsprocessor::uploadzip('CSTR',$tempdir,$zipupload);
my $unzip_result = '';
my $manifest_result = '';
@@ -340,12 +346,12 @@ sub display_two {
type => 'Content type',
addo => 'Additional options',
chec => 'Check Import first',
- bbus => 'Choose a course to receive bulletin boards and user enrollment',
- list => 'A listing of possible course targets will be displayed if import of bulletin boards and/or enrollment is checked above (step 3). If you do not plan to import either of these content types, there is no need to specify a course.',
+ bbus => 'Choose a course to receive discussion boards and user enrollment',
+ list => 'A listing of possible course targets will be displayed if import of discussion boards and/or enrollment is checked above (step 3). If you do not plan to import either of these content types, there is no need to specify a course.',
chco => 'Choose course:',
nreq => 'Not required',
- yodo => 'You do not have active course coordinator status in any LON-CAPA courses currently, so bulletin boards and enrollment information included in your IMS package will be discarded, regardless of your import choice for these two items above (step 3).',
- ifyo => "If you wish to import bulletin boards and/or user information into LON-CAPA please click 'Exit now' to quit the current IMS import process, and contact your domain coordinator and request a course coordinator role in a LON-CAPA course into which you can upload bulletin boards and/or enroll users.",
+ yodo => 'You do not have active course coordinator status in any LON-CAPA courses currently, so discussion boards and enrollment information included in your IMS package will be discarded, regardless of your import choice for these two items above (step 3).',
+ ifyo => "If you wish to import discussion boards and/or user information into LON-CAPA please click 'Exit now' to quit the current IMS import process, and contact your domain coordinator and request a course coordinator role in a LON-CAPA course into which you can upload discussion boards and/or enroll users.",
impa => 'Import package',
unpa => 'Unpacking of your IMS package failed because an IMS manifest file was not located in the package',
proc => 'Processing of your IMS package failed because the file you uploaded could not be unzipped',
@@ -404,7 +410,7 @@ sub display_two {
$conditions = 'none';
}
- $r->print('