version 1.7, 2005/11/08 17:58:35
|
version 1.13, 2008/04/17 15:58:45
|
Line 35 use HTML::Entities();
|
Line 35 use HTML::Entities();
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonupload; |
use Apache::lonupload; |
use File::Basename(); |
use File::Basename(); |
|
use LONCAPA(); |
|
|
# ---------------------------------------------------------------- Display Control |
# ---------------------------------------------------------------- Display Control |
sub display_control { |
sub display_control { |
Line 347 sub jscript_three {
|
Line 348 sub jscript_three {
|
if (exists($env{'form.go'}) ) { |
if (exists($env{'form.go'}) ) { |
$source = $env{'form.go'}; |
$source = $env{'form.go'}; |
} |
} |
|
|
|
my %body_layout = ('rightmargin' => "0", |
|
'leftmargin' => "0", |
|
'marginwidth' => "0", |
|
'topmargin' => "0", |
|
'marginheight' => "0"); |
|
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Create Testbank directory',undef, |
|
{'only_body' => 1, |
|
'add_entries' => \%body_layout, |
|
'js_ready' => 1,}); |
|
my $end_page = |
|
&Apache::loncommon::end_page({'js_ready' => 1,}); |
$$jsref = <<"END_OF_ONE"; |
$$jsref = <<"END_OF_ONE"; |
function verify() { |
function verify() { |
if ((document.forms.dataForm.newdir.value == '') || (!document.forms.dataForm.newdir.value)) { |
if ((document.forms.dataForm.newdir.value == '') || (!document.forms.dataForm.newdir.value)) { |
Line 371 function createWin() {
|
Line 386 function createWin() {
|
document.dataForm.newdir.value = ""; |
document.dataForm.newdir.value = ""; |
newWindow = window.open("","CreateDir","HEIGHT=400,WIDTH=750,scrollbars=yes") |
newWindow = window.open("","CreateDir","HEIGHT=400,WIDTH=750,scrollbars=yes") |
newWindow.document.open() |
newWindow.document.open() |
newWindow.document.write("<html><head><title>Create Testbank directory</title><meta http-equiv='pragma' content='no-cache'>\\n") |
newWindow.document.write('$start_page') |
newWindow.document.write("</head><body bgcolor='#CCFFDD' topmargin='0' leftmargin='0' marginheight='0'marginwidth='0' rightmargin='0'>\\n") |
|
newWindow.document.write("<img border='0' src='/adm/lonInterFace/author.jpg' alt='[Author Header]'>\\n") |
newWindow.document.write("<img border='0' src='/adm/lonInterFace/author.jpg' alt='[Author Header]'>\\n") |
newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='430' bgcolor='#CCFFDD'>\\n") |
newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='430' bgcolor='#CCFFDD'>\\n") |
newWindow.document.write("<tr><td width='2'> </td><td width='3'> </td>\\n") |
newWindow.document.write("<tr><td width='2'> </td><td width='3'> </td>\\n") |
newWindow.document.write("<td><h3>Location: <tt>$fullpath</tt></h3><h3>New Directory</h3></td></tr>\\n") |
newWindow.document.write("<td><h3>Location: <tt>$fullpath</tt></h3><h3>New Directory</h3></td></tr>\\n") |
newWindow.document.write("<tr><td width='2'> </td><td width='3'> </td>\\n") |
newWindow.document.write("<tr><td width='2'> </td><td width='3'> </td>\\n") |
newWindow.document.write("<td><form name='fileaction' action='/adm/cfile' method='post'>\\n") |
newWindow.document.write("<td><form name='fileaction' action='/adm/cfile' method='post'>\\n") |
newWindow.document.write("<font face='arial,helvetica,sans-serif'>Enter the name of the new directory where you will store the converted testbank questions<br /><br />") |
newWindow.document.write("<font face='arial,helvetica,sans-serif'>Enter the name of the new directory where you will save the converted testbank questions<br /><br />") |
newWindow.document.write("<input type='hidden' name='filename' value='$fullpath'>") |
newWindow.document.write("<input type='hidden' name='filename' value='$fullpath'>") |
newWindow.document.write("<input type='hidden' name='action' value='newdir'>") |
newWindow.document.write("<input type='hidden' name='action' value='newdir'>") |
newWindow.document.write("<input type='hidden' name='callingmode' value='testbank'>") |
newWindow.document.write("<input type='hidden' name='callingmode' value='testbank'>") |
newWindow.document.write("$fullpath<input type='text' name='newfilename' value=''/>") |
newWindow.document.write("$fullpath<input type='text' name='newfilename' value=''/>") |
newWindow.document.write("<input type='button' value='Go' onClick='document.fileaction.submit();' />") |
newWindow.document.write("<input type='button' value='Go' onClick='document.fileaction.submit();' />") |
newWindow.document.write("</td></tr>\\n") |
newWindow.document.write("</td></tr>\\n") |
newWindow.document.write("</table></body></html>") |
newWindow.document.write("</table>") |
|
newWindow.document.write('$end_page') |
newWindow.document.close() |
newWindow.document.close() |
newWindow.focus() |
newWindow.focus() |
} |
} |
Line 455 Five steps are involved in the import pr
|
Line 470 Five steps are involved in the import pr
|
$r->print(qq|</li> |
$r->print(qq|</li> |
<li>Provide information about the question format - i.e., question numbering style, and the number of blocks of questions of each question type.</li> |
<li>Provide information about the question format - i.e., question numbering style, and the number of blocks of questions of each question type.</li> |
<li>Provide information about the questions in each block, including question type, start and end question numbers for each block, and foil labelling style and answer format where required.</li> |
<li>Provide information about the questions in each block, including question type, start and end question numbers for each block, and foil labelling style and answer format where required.</li> |
<li>Create a new directory where you will store the converted testbank questions.</li> |
<li>Create a new directory where you will save the converted testbank questions.</li> |
<li>Complete the import of questions to the selected pool.</li> |
<li>Complete the import of questions to the selected pool.</li> |
</ol> |
</ol> |
</font> |
</font> |
Line 1015 END_OF_ONE
|
Line 1030 END_OF_ONE
|
<td width='30' align='top'><img src='/res/adm/pages/bl_step4.gif'> |
<td width='30' align='top'><img src='/res/adm/pages/bl_step4.gif'> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font size='+1' face='arial,helvetica,sans-serif'><b>Create a directory to store your testbank questions.</b></font> |
<font size='+1' face='arial,helvetica,sans-serif'><b>Create a directory to save your testbank questions.</b></font> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 1025 END_OF_ONE
|
Line 1040 END_OF_ONE
|
<td> </td> |
<td> </td> |
<td> |
<td> |
<font face='Arial,Helvetica,sans-serif'> |
<font face='Arial,Helvetica,sans-serif'> |
Please choose a destination LON-CAPA directory in which to store your uploaded questions. |
Please choose a destination LON-CAPA directory in which to save your uploaded questions. |
<input type="button" name="createdir" value="Create Directory" onClick="javascript:createWin()"><input type="hidden" name="newdir" value=""></font></td> |
<input type="button" name="createdir" value="Create Directory" onClick="javascript:createWin()"><input type="hidden" name="newdir" value=""></font></td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 1340 END_OF_BLOCK
|
Line 1355 END_OF_BLOCK
|
</tr> |
</tr> |
</table> |
</table> |
</form> |
</form> |
</body> |
|
</html> |
|
END_OF_FAIL |
END_OF_FAIL |
return; |
return; |
} |
} |
Line 1653 sub create_ess {
|
Line 1666 sub create_ess {
|
<textfield></textfield> |
<textfield></textfield> |
</essayresponse> |
</essayresponse> |
<postanswerdate> |
<postanswerdate> |
|
<startouttext /> |
$answertxt |
$answertxt |
|
<endouttext /> |
</postanswerdate> |
</postanswerdate> |
</problem>|; |
</problem>|; |
} elsif ($qtype eq "TF") { |
} elsif ($qtype eq "TF") { |
Line 1699 sub handler {
|
Line 1714 sub handler {
|
my $javascript = ''; |
my $javascript = ''; |
my $page_name = ''; |
my $page_name = ''; |
my $current_page = ''; |
my $current_page = ''; |
my $loadentries = ''; |
|
my $qcount = ''; |
my $qcount = ''; |
# |
# |
# phase two: re-attach user |
# phase two: re-attach user |
Line 1725 sub handler {
|
Line 1739 sub handler {
|
$fn=$env{'form.filename'}; |
$fn=$env{'form.filename'}; |
$fn=~s/^http\:\/\/[^\/]+\///; |
$fn=~s/^http\:\/\/[^\/]+\///; |
$fn=~s/^\///; |
$fn=~s/^\///; |
$fn=~s/(\~|priv\/)(\w+)//; |
$fn=~s{(~|priv/)($LONCAPA::username_re)}{}; |
$fn=~s/\/+/\//g; |
$fn=~s/\/+/\//g; |
} else { |
} else { |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
Line 1741 sub handler {
|
Line 1755 sub handler {
|
my $dirpath = '/home/'.$uname.'/public_html'; |
my $dirpath = '/home/'.$uname.'/public_html'; |
|
|
my @text = (); |
my @text = (); |
my $loadentries = ''; |
|
if ($env{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
if (-e "$dirpath$fn") { |
if (-e "$dirpath$fn") { |
open(TESTBANK,"<$dirpath$fn"); |
open(TESTBANK,"<$dirpath$fn"); |
Line 1756 sub handler {
|
Line 1769 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
|
my %loadentries; |
if ($env{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
$current_page = &display_control(); |
$current_page = &display_control(); |
my @PAGES = ('Welcome','Blocks','Format','Target','Confirmation'); |
my @PAGES = ('Welcome','Blocks','Format','Target','Confirmation'); |
$page_name = $PAGES[$current_page]; |
$page_name = $PAGES[$current_page]; |
|
|
if ($page_name eq 'Blocks') { |
if ($page_name eq 'Blocks') { |
$loadentries = 'onLoad= "setElements()"'; |
$loadentries{'onload'} = "setElements()"; |
&jscript_one(\$javascript); |
&jscript_one(\$javascript); |
} elsif ($page_name eq 'Format') { |
} elsif ($page_name eq 'Format') { |
$qcount = question_count($env{'form.qnumformat'},\@text); |
$qcount = question_count($env{'form.qnumformat'},\@text); |
&jscript_two(\$javascript,$qcount); |
&jscript_two(\$javascript,$qcount); |
} elsif ($page_name eq 'Target') { |
} elsif ($page_name eq 'Target') { |
if ($env{'form.go'} eq "PreviousPage") { |
if ($env{'form.go'} eq "PreviousPage") { |
$loadentries = 'onLoad = "setElements()"'; |
$loadentries{'onload'} = "setElements()"; |
} |
} |
&jscript_three($fullpath,\$javascript); |
&jscript_three($fullpath,\$javascript); |
} elsif ($page_name eq 'Confirmation') { |
} elsif ($page_name eq 'Confirmation') { |
&jscript_four(\$javascript,$fullpath); |
&jscript_four(\$javascript,$fullpath); |
} |
} |
} |
} |
|
|
|
$javascript = "<script type=\"text/javascript\">\n//<!--\n". |
|
$javascript."\n// --></script>\n"; |
|
|
|
$r->print(&Apache::loncommon::start_page('Upload testbank questions to Construction Space', |
|
$javascript, |
|
{'add_entries' => \%loadentries})); |
|
|
$r->print("<html><head><title>LON-CAPA Construction Space</title><script type=\"text/javascript\">\n//<!--\n$javascript\n// --></script>\n</head>"); |
|
|
|
$r->print(&Apache::loncommon::bodytag('Upload testbank questions to Construction Space',undef,$loadentries)); |
|
|
|
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
$r->print('<h3><font color=red>'.&mt('Co-Author').': '.$uname. |
$r->print('<h3><font color=red>'.&mt('Co-Author').': '.$uname. |
&mt(' at ').$udom.'</font></h3>'); |
&mt(' at ').$udom.'</font></h3>'); |
Line 1805 sub handler {
|
Line 1822 sub handler {
|
} else { |
} else { |
&Apache::lonupload::phaseone($r,$fn,$uname,$udom,'testbank'); |
&Apache::lonupload::phaseone($r,$fn,$uname,$udom,'testbank'); |
} |
} |
$r->print('</body></html>'); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
1; |
1; |