version 1.6, 2005/04/07 06:56:27
|
version 1.10, 2006/04/10 22:30:31
|
Line 30 use strict;
|
Line 30 use strict;
|
use Apache::Constants qw(:common :http :methods); |
use Apache::Constants qw(:common :http :methods); |
use Apache::loncacc; |
use Apache::loncacc; |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::Log(); |
|
use Apache::lonnet; |
use Apache::lonnet; |
use HTML::Entities(); |
use HTML::Entities(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
Line 348 sub jscript_three {
|
Line 347 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 372 function createWin() {
|
Line 385 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") |
Line 387 function createWin() {
|
Line 399 function createWin() {
|
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 1341 END_OF_BLOCK
|
Line 1354 END_OF_BLOCK
|
</tr> |
</tr> |
</table> |
</table> |
</form> |
</form> |
</body> |
|
</html> |
|
END_OF_FAIL |
END_OF_FAIL |
return; |
return; |
} |
} |
Line 1700 sub handler {
|
Line 1711 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 1742 sub handler {
|
Line 1752 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 1757 sub handler {
|
Line 1766 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 1806 sub handler {
|
Line 1819 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; |