version 1.43, 2013/10/10 00:46:50
|
version 1.46, 2023/07/23 01:09:04
|
Line 579 sub display_two {
|
Line 579 sub display_two {
|
my $blocks = $env{'form.blocks'}; |
my $blocks = $env{'form.blocks'}; |
my $qnumformat = $env{'form.qnumformat'}; |
my $qnumformat = $env{'form.qnumformat'}; |
my @types = ("MC","MA","TF","Ess","FIB","Ord"); |
my @types = ("MC","MA","TF","Ess","FIB","Ord"); |
my %typenames = ( |
my %typenames = &Apache::lonlocal::texthash( |
MC => "Multiple Choice", |
MC => "Multiple Choice", |
TF => "True/False", |
TF => "True/False", |
MA => "Multiple Answer", |
MA => "Multiple Answer", |
Line 1508 sub create_mcq {
|
Line 1508 sub create_mcq {
|
if (-e $destdir.$libfile) { |
if (-e $destdir.$libfile) { |
$result = 'exists'; |
$result = 'exists'; |
} else { |
} else { |
if (open(PROB,">$destdir$libfile")) { |
if (open(PROB,">",$destdir.$libfile)) { |
print PROB $output; |
print PROB $output; |
close(PROB); |
close(PROB); |
$result = 'ok'; |
$result = 'ok'; |
Line 1586 sub create_ess {
|
Line 1586 sub create_ess {
|
if (-e $destdir.$libfile) { |
if (-e $destdir.$libfile) { |
$result = 'exists'; |
$result = 'exists'; |
} else { |
} else { |
if (open(PROB,">$destdir$libfile")) { |
if (open(PROB,">",$destdir.$libfile)) { |
print PROB $output; |
print PROB $output; |
close(PROB); |
close(PROB); |
$result = 'ok'; |
$result = 'ok'; |
Line 1617 sub file_error {
|
Line 1617 sub file_error {
|
my ($r,$fn,$current_page,$webpath,$res) = @_; |
my ($r,$fn,$current_page,$webpath,$res) = @_; |
$r->print('<p><form name="display" method="post" action="/adm/testbank">'.&mt('The file you uploaded does not appear to be in the correct format.'). |
$r->print('<p><form name="display" method="post" action="/adm/testbank">'.&mt('The file you uploaded does not appear to be in the correct format.'). |
'</p><p>'.&mt('Extraction of questions is only possible for the following file types:'). |
'</p><p>'.&mt('Extraction of questions is only possible for the following file types:'). |
'<ul><li>'.&mt('plain text').'</li><li>RTF</li><li>HTML</li></ul>'. |
'<ul>'. |
|
'<li>'.&mt('plain text').'</li>'. |
|
'<li>'.&mt('RTF').'</li>'. |
|
'<li>'.&mt('HTML').'</li></ul>'. |
&mt('The file type identified for the file you uploaded is [_1].','<b>'.$res.'</b>').'</p>'); |
&mt('The file type identified for the file you uploaded is [_1].','<b>'.$res.'</b>').'</p>'); |
$r->print(&page_footer($env{'form.newdir'},$fn,$current_page,$webpath,undef,'badfile'). |
$r->print(&page_footer($env{'form.newdir'},$fn,$current_page,$webpath,undef,'badfile'). |
'</form>'); |
'</form>'); |
Line 1633 sub parse_datafile {
|
Line 1636 sub parse_datafile {
|
$res = $mm->checktype_filename($dirpath.$filename); |
$res = $mm->checktype_filename($dirpath.$filename); |
if ($env{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
if ($res eq 'text/plain') { |
if ($res eq 'text/plain') { |
open(TESTBANK,"<$dirpath$filename"); |
open(TESTBANK,"<",$dirpath.$filename); |
@{$text} = <TESTBANK>; |
@{$text} = <TESTBANK>; |
close(TESTBANK); |
close(TESTBANK); |
} elsif ($res eq 'application/rtf') { |
} elsif ($res eq 'application/rtf') { |
Line 1784 sub build_image_url {
|
Line 1787 sub build_image_url {
|
} |
} |
|
|
sub print_header { |
sub print_header { |
my ($uname,$udom,$javascript,$loadentries,$title,$current_page,$pagesref, |
my ($uname,$udom,$javascript,$loadentries,$title,$crumbtext,$crumbhref, |
$namesref) = @_; |
$crsauthor,$current_page,$pagesref,$namesref) = @_; |
my $brcrum = [{'href' => &Apache::loncommon::authorspace("/priv/$udom/$uname/"), |
my $brcrum = [{'href' => $crumbhref), |
'text' => 'Authoring Space'}]; |
'text' => $crumbtext}]; |
if ($env{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
if (ref($pagesref) eq 'ARRAY') { |
if (ref($pagesref) eq 'ARRAY') { |
for (my $i=0; $i<$current_page; $i++) { |
for (my $i=0; $i<$current_page; $i++) { |
Line 1813 sub print_header {
|
Line 1816 sub print_header {
|
my $output = &Apache::loncommon::start_page($title,$javascript, |
my $output = &Apache::loncommon::start_page($title,$javascript, |
{'bread_crumbs' => $brcrum, |
{'bread_crumbs' => $brcrum, |
'add_entries' => $loadentries}); |
'add_entries' => $loadentries}); |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
unless ($crsauthor) { |
$output .= '<p class="LC_info">' |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
$output .= '<p class="LC_info">' |
.'</p>'; |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
|
.'</p>'; |
|
} |
} |
} |
return $output; |
return $output; |
} |
} |
Line 1849 sub handler {
|
Line 1854 sub handler {
|
my $page_name = ''; |
my $page_name = ''; |
my $current_page = ''; |
my $current_page = ''; |
my $qcount = ''; |
my $qcount = ''; |
|
my $crsauthor; |
my $title = 'Upload testbank questions to Authoring Space'; |
my $title = 'Upload testbank questions to Authoring Space'; |
|
my $crumbtext = 'Authoring Space'; |
|
my $crumbhref = &Apache::loncommon::authorspace($fn); |
|
if ($env{'request.course.id'}) { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
if ($crumbhref eq "/priv/$cdom/$cnum/") { |
|
$title = 'Upload testbank questions to Course Authoring Space'; |
|
$crumbtext = 'Course Authoring Space'; |
|
$crsauthor = 1; |
|
} |
|
} |
|
|
# ----------------------------------------------------------- Start page output |
# ----------------------------------------------------------- Start page output |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 1862 sub handler {
|
Line 1879 sub handler {
|
if ($env{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
$current_page = &display_control(); |
$current_page = &display_control(); |
@pages = ('Welcome','Blocks','Format','Target','Confirmation'); |
@pages = ('Welcome','Blocks','Format','Target','Confirmation'); |
%names = ( |
%names = &Apache::lonlocal::texthash( |
Welcome => 'Testbank Format', |
Welcome => 'Testbank Format', |
Blocks => 'Classification', |
Blocks => 'Classification', |
Format => 'Selection', |
Format => 'Selection', |
Line 1911 sub handler {
|
Line 1928 sub handler {
|
} |
} |
|
|
$r->print(&print_header($uname,$udom,$javascript,\%loadentries,$title, |
$r->print(&print_header($uname,$udom,$javascript,\%loadentries,$title, |
$current_page,\@pages,\%names)); |
$crumbtext,$crumbhref,$crsauthor,$current_page, |
|
\@pages,\%names)); |
|
|
if (($env{'form.phase'} eq 'four') || ($env{'form.phase'} eq 'three')) { |
if (($env{'form.phase'} eq 'four') || ($env{'form.phase'} eq 'three')) { |
if ($env{'form.phase'} eq 'four') { |
if ($env{'form.phase'} eq 'four') { |