version 1.25, 2009/11/30 16:53:54
|
version 1.31, 2011/10/23 01:27:34
|
Line 88 function createWin() {
|
Line 88 function createWin() {
|
newWindow.document.write("<input type='hidden' name='filename' value='$webpath' />") |
newWindow.document.write("<input type='hidden' name='filename' value='$webpath' />") |
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("<input type='hidden' name='inhibitmenu' value='yes' />") |
newWindow.document.write("$webpath<input type='text' name='newfilename' value='' />") |
newWindow.document.write("$webpath<input type='text' name='newfilename' value='' />") |
newWindow.document.write("<input type='button' value='$lt{'go'}' onClick='document.fileaction.submit();' /></form>") |
newWindow.document.write("<input type='button' value='$lt{'go'}' onClick='document.fileaction.submit();' /></form>") |
newWindow.document.write('$end_page') |
newWindow.document.write('$end_page') |
Line 1329 sub create_mcq {
|
Line 1330 sub create_mcq {
|
my $numfoils = scalar(@{$qstnref}) - 1; |
my $numfoils = scalar(@{$qstnref}) - 1; |
my $datestamp = localtime; |
my $datestamp = localtime; |
my $numansrs = scalar(@{$answerref}); |
my $numansrs = scalar(@{$answerref}); |
my $output = '<problem> |
my $output = '<problem>'; |
|
if ($qtype eq 'MC') { |
|
$output .= "\n".'<parameter name="maxtries" type="int_pos" default="2" description="Maximum Number of Tries" />'; |
|
} |
|
$output .= ' |
<startouttext />'; |
<startouttext />'; |
if ($res eq 'application/rtf' || $res eq 'text/html') { |
if ($res eq 'application/rtf' || $res eq 'text/html') { |
if ($header ne '') { |
if ($header ne '') { |
Line 1769 sub build_image_url {
|
Line 1774 sub build_image_url {
|
} |
} |
|
|
sub print_header { |
sub print_header { |
my ($uname,$udom,$javascript,$loadentries,$title) = @_; |
my ($uname,$udom,$javascript,$loadentries,$title,$current_page,$pagesref, |
|
$namesref) = @_; |
|
my $brcrum = [{'href' => &Apache::loncommon::authorspace(), |
|
'text' => 'Construction Space'}]; |
|
if ($env{'form.phase'} eq 'three') { |
|
if (ref($pagesref) eq 'ARRAY') { |
|
for (my $i=0; $i<$current_page; $i++) { |
|
my $goback = 1 + $i - $current_page; |
|
if (ref($namesref) eq 'HASH') { |
|
if ($namesref->{$pagesref->[$i]} ne '') { |
|
if (ref($brcrum) eq 'ARRAY') { |
|
my $text = $namesref->{$pagesref->[$i]}; |
|
my $href; |
|
if ($goback == -1) { |
|
$href = 'javascript:backPage();'; |
|
} else { |
|
$href = 'javascript:history.go('.$goback.')'; |
|
} |
|
push(@{$brcrum}, {'href' => $href, |
|
'text' => $text}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
my $output = &Apache::loncommon::start_page($title,$javascript, |
my $output = &Apache::loncommon::start_page($title,$javascript, |
{'add_entries' => $loadentries}); |
{'bread_crumbs' => $brcrum, |
|
'add_entries' => $loadentries}); |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
$output .= '<p class="LC_warning">' |
$output .= '<p class="LC_info">' |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
.'</p>'; |
.'</p>'; |
} |
} |
Line 1822 sub handler {
|
Line 1853 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
my ($filename,$pathname) = &File::Basename::fileparse($fn); |
my ($filename,$pathname) = &File::Basename::fileparse($fn); |
my $webpath = '/priv/'.$uname.$pathname; |
my $webpath = '/priv/'.$udom.'/'.$uname.$pathname; |
my $urlpath = '/~'.$uname.$pathname; |
my $dirpath = $r->dir_config('lonDocRoot').$webpath; |
my $dirpath = '/home/'.$uname.'/public_html'.$pathname; |
my ($res,$subdir,$badfile,$textref,$header,$css,$js,%loadentries,@pages,%names); |
my ($res,$subdir,$badfile,$textref,$header,$css,$js,%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'); |
@pages = ('Welcome','Blocks','Format','Target','Confirmation'); |
|
%names = ( |
|
Welcome => 'Testbank Format', |
|
Blocks => 'Classification', |
|
Format => 'Selection', |
|
Target => 'Result' |
|
); |
$page_name = $pages[$current_page]; |
$page_name = $pages[$current_page]; |
if ($env{'form.timestamp'} eq '') { |
if ($env{'form.timestamp'} eq '') { |
$env{'form.timestamp'} = time; |
$env{'form.timestamp'} = time; |
Line 1840 sub handler {
|
Line 1876 sub handler {
|
} |
} |
} |
} |
($res,$badfile,$textref,$header,$css,$js) = |
($res,$badfile,$textref,$header,$css,$js) = |
&parse_datafile($r,$uname,$filename,$pathname,$dirpath,$urlpath, |
&parse_datafile($r,$uname,$filename,$pathname,$dirpath,$webpath, |
$page_name,$subdir,$env{'form.timestamp'}); |
$page_name,$subdir,$env{'form.timestamp'}); |
if ($page_name eq 'Welcome') { |
if ($page_name eq 'Welcome') { |
&jscript_zero($webpath,\$javascript); |
&jscript_zero($webpath,\$javascript); |
Line 1872 sub handler {
|
Line 1908 sub handler {
|
} |
} |
} |
} |
|
|
$r->print(&print_header($uname,$udom,$javascript,\%loadentries,$title)); |
$r->print(&print_header($uname,$udom,$javascript,\%loadentries,$title, |
|
$current_page,\@pages,\%names)); |
|
|
if ($env{'form.phase'} eq 'three') { |
if (($env{'form.phase'} eq 'four') || ($env{'form.phase'} eq 'three')) { |
if ($env{'form.action'} eq 'upload_embedded') { |
if ($env{'form.phase'} eq 'four') { |
$r->print(&Apache::lonupload::phasethree($r,$fn,$uname,$udom,'testbank')); |
$r->print(&Apache::lonupload::phasefour($r,$fn,$uname,$udom,'testbank')); |
|
my $current_page = 0; |
|
my $js; |
|
&jscript_zero($webpath,\$js); |
|
$js = '<script type="text/javascript">'."\n$js\n".'</script>'; |
|
$r->print($js); |
|
&display_zero($r,$uname,$fn,$current_page,$webpath); |
|
} elsif ($env{'form.phase'} eq 'three') { |
|
if ($env{'form.action'} eq 'upload_embedded') { |
|
my ($result,$flag) = |
|
&Apache::lonupload::phasethree($r,$fn,$uname,$udom,'testbank'); |
|
$r->print($result); |
|
if ($flag eq 'modify_orightml') { |
|
undef($page_name); |
|
$r->print('<form name="testbankForm" method="post" action="/adm/testbank">'. |
|
&page_footer('',$uname,$fn).'</form>'); |
|
} |
|
} |
} |
} |
if ($badfile) { |
if ($badfile) { |
&file_error($r,$uname,$fn,$current_page,$webpath,$res); |
&file_error($r,$uname,$fn,$current_page,$webpath,$res); |
} else { |
} else { |
&display_zero ($r,$uname,$fn,$current_page,$webpath) if $page_name eq 'Welcome'; |
&display_zero ($r,$uname,$fn,$current_page,$webpath) if $page_name eq 'Welcome'; |
&display_one ($r,$uname,$fn,$current_page,$textref,$header) if $page_name eq 'Blocks'; |
&display_one ($r,$uname,$fn,$current_page,$textref,$header) if $page_name eq 'Blocks'; |
&display_two ($r,$uname,$fn,$current_page,$textref,$header,$qcount) if $page_name eq 'Format'; |
&display_two ($r,$uname,$fn,$current_page,$textref,$header,$qcount) if $page_name eq 'Format'; |
&display_three ($r,$uname,$fn,$current_page,$textref,$res,$header,$urlpath,$qcount) if $page_name eq 'Target'; |
&display_three ($r,$uname,$fn,$current_page,$textref,$res,$header,$webpath,$qcount) if $page_name eq 'Target'; |
&final_display ($r,$uname,$fn,$current_page,$textref,$res,$header,$css,$js,$webpath,$dirpath,$subdir) if $page_name eq 'Confirmation'; |
&final_display ($r,$uname,$fn,$current_page,$textref,$res,$header,$css,$js,$webpath,$dirpath,$subdir) if $page_name eq 'Confirmation'; |
} |
} |
} elsif ($env{'form.phase'} eq 'two') { |
} elsif ($env{'form.phase'} eq 'two') { |