version 1.10, 2010/01/09 01:07:56
|
version 1.17, 2010/12/05 17:48:54
|
Line 60 my %mandatory;
|
Line 60 my %mandatory;
|
my @development; |
my @development; |
|
|
sub setdefaults { |
sub setdefaults { |
$path='/res/gci/gci'; |
my ($cdom) = @_; |
$version='GCIv2-1-1'; |
if ($cdom eq 'gcitest') { |
$reqnum=15; |
$path='/res/gci/gci'; |
@allprobs=('01','02','37','2004_73','03','04','05','06','07', |
$version='GCIv2-1-1'; |
'08','10', |
$reqnum=15; |
'09', |
@allprobs=('01','02','37','2004_73','03','04','05','06','07', |
'11','12','13','14','15','16','17', |
'08','10', |
'18','69', |
'09', |
'19','20', |
'11','12','13','14','15','16','17', |
'21','22','23','24','25','26','27','28','29','30', |
'18','69', |
'31','32','33','34','35','36','38', |
'19','20', |
'39A','39B', |
'21','22','23','24','25','26','27','28','29','30', |
'40', |
'31','32','33','34','35','36','38', |
'41','42','43','44','45','46','47','48','49','50', |
'39A','39B', |
'51', |
'40', |
'52','57', |
'41','42','43','44','45','46','47','48','49','50', |
'53','54','55','56','58', |
'51', |
'60', |
'52','57', |
'61','62','63','64','65','66','67','68','70', |
'53','54','55','56','58', |
'71'); |
'60', |
@bins = ( ['03','04','06'], |
'61','62','63','64','65','66','67','68','70', |
['07','08','09'], |
'71'); |
['10','12','13','14','15','16','17'], |
@bins = ( ['03','04','06'], |
['18','19','20','21','22','23','24','25'], |
['07','08','09'], |
['26','27','28','30'], |
['10','12','13','14','15','16','17'], |
['32','33','34','35','36'], |
['18','19','20','21','22','23','24','25'], |
['38','39A','39B','40','41','42','43','44','45','46'], |
['26','27','28','30'], |
['47','48','49','50','51','52','53'], |
['32','33','34','35','36'], |
['54','55','56','57','58','60','61','62'], |
['38','39A','39B','40','41','42','43','44','45','46'], |
['63','64','65'], |
['47','48','49','50','51','52','53'], |
['66','67','68','69','70','71']); |
['54','55','56','57','58','60','61','62'], |
@optional = ('05','11','29','31'); |
['63','64','65'], |
@mandcats = ('M1','M2','M3','M4'); |
['66','67','68','69','70','71']); |
@bincats = ('A','B','C','D','E','F','G','H','I','J','K'); |
@optional = ('05','11','29','31'); |
@categories=(@mandcats,@bincats); |
@mandcats = ('M1','M2','M3','M4'); |
%probcat =('01' => 'M1' ,'02' => 'M2' ,'37' => 'M3' ,'2004_73' => 'M4' , |
@bincats = ('A','B','C','D','E','F','G','H','I','J','K'); |
'03' => 'A' ,'04' => 'A','05' => '' ,'06' => 'A' ,'07' => 'B' , |
@categories=(@mandcats,@bincats); |
'08' => 'B' ,'09' => 'B' ,'10' => 'C' ,'11' => '' ,'12' => 'C' , |
%probcat =('01' => 'M1' ,'02' => 'M2' ,'37' => 'M3' ,'2004_73' => 'M4' , |
'13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' , |
'03' => 'A' ,'04' => 'A','05' => '' ,'06' => 'A' ,'07' => 'B' , |
'21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => '' ,'30' => 'E' , |
'08' => 'B' ,'09' => 'B' ,'10' => 'C' ,'11' => '' ,'12' => 'C' , |
'31' => '' ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'38' => 'G' , |
'13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' , |
'39A'=> 'G' ,'39B'=> 'G' , |
'21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => '' ,'30' => 'E' , |
'40' => 'G' , |
'31' => '' ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'38' => 'G' , |
'41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' , |
'39A'=> 'G' ,'39B'=> 'G' , |
'51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' , |
'40' => 'G' , |
'60' => 'I' , |
'41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' , |
'61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' , |
'51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' , |
'71' => 'K'); |
'60' => 'I' , |
%mandatory=('01' => 1 ,'02' => 1,'37' => 1, '2004_73' => 1); |
'61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' , |
@mandprobs = ('01','02','37','2004_73'); |
'71' => 'K'); |
%prereqs=('10' => '08', '57' => '52', '69' => '18'); |
%mandatory=('01' => 1 ,'02' => 1,'37' => 1, '2004_73' => 1); |
foreach my $item (keys(%prereqs)) { |
@mandprobs = ('01','02','37','2004_73'); |
$revreqs{$prereqs{$item}} = $item; |
%prereqs=('10' => '08', '57' => '52', '69' => '18'); |
|
foreach my $item (keys(%prereqs)) { |
|
$revreqs{$prereqs{$item}} = $item; |
|
} |
|
@defchosen=('01','02','03','07','12','18','26','32','37','38','47','54','63','66','2004_73'); |
|
@development = ('001','002','003','004','005','006','007','008','009','010','011','012','013','014','015','016','017','018','019','020','021','022','023','024','025','026','027'); |
} |
} |
@defchosen=('01','02','03','07','12','18','26','32','37','38','47','54','63','66','2004_73'); |
|
@development = ('001','002','003','004','005','006','007','008','009','010','011','012','013','014'); |
|
} |
} |
|
|
sub checkvalid { |
sub checkvalid { |
|
my ($cdom) = @_; |
my %covered=(); |
my %covered=(); |
my %chosenproblems=(); |
my %chosenproblems=(); |
my @errors=(); |
my @errors=(); |
Line 138 sub checkvalid {
|
Line 142 sub checkvalid {
|
foreach my $item (@chosen) { |
foreach my $item (@chosen) { |
if ($prereqs{$item}) { |
if ($prereqs{$item}) { |
unless ($chosenproblems{$prereqs{$item}}) { |
unless ($chosenproblems{$prereqs{$item}}) { |
my $url = &fullurl($item); |
my $url = &fullurl($item,$cdom); |
my $title = &Apache::lonnet::metadata($url,'title'); |
my $title = &Apache::lonnet::metadata($url,'title'); |
my $prerequrl = &fullurl($prereqs{$item}); |
my $prerequrl = &fullurl($prereqs{$item},$cdom); |
my $prereqtitle = &Apache::lonnet::metadata($prerequrl,'title'); |
my $prereqtitle = &Apache::lonnet::metadata($prerequrl,'title'); |
push(@errors,&mt('[_1] requires [_2].',"'$title'","'$prereqtitle'")); |
push(@errors,&mt('[_1] requires [_2].',"'$title'","'$prereqtitle'")); |
} |
} |
Line 150 sub checkvalid {
|
Line 154 sub checkvalid {
|
} |
} |
|
|
sub fullurl { |
sub fullurl { |
my ($item,$catname)=@_; |
my ($item,$cdom,$catname)=@_; |
unless ($item=~/\_/) { $item='_'.$item; } |
if ($cdom eq 'gcitest') { |
if ($catname eq 'development') { |
unless ($item=~/\_/) { $item='_'.$item; } |
return $path.'/pilot/pilot'.$item.'.problem'; |
if ($catname eq 'development') { |
} |
return $path.'/pilot/pilot'.$item.'.problem'; |
return $path.'/'.$version.'/GCI'.$item.'.problem'; |
} |
|
return $path.'/'.$version.'/GCI'.$item.'.problem'; |
|
} |
} |
} |
|
|
sub item_from_url { |
sub item_from_url { |
Line 166 sub item_from_url {
|
Line 172 sub item_from_url {
|
} |
} |
|
|
sub validcheck { |
sub validcheck { |
my ($r)=@_; |
my ($r,$cdom)=@_; |
my @errors=&checkvalid(); |
my @errors=&checkvalid($cdom); |
if ($#errors>-1) { |
if ($#errors>-1) { |
$r->print('<span class="LC_error">'.&mt('Your test is not yet valid.').'</span><p>'.&mt('The following issues must be addressed before you can use the test:').'<ul>'); |
$r->print('<span class="LC_error">'.&mt('Your test is not yet valid.').'</span><p>'.&mt('The following issues must be addressed before you can use the test:').'<ul>'); |
foreach my $message (@errors) { |
foreach my $message (@errors) { |
Line 207 sub listresources {
|
Line 213 sub listresources {
|
'<input type="submit" name="choosetest" value="'.&mt('Next').'"></p>'); |
'<input type="submit" name="choosetest" value="'.&mt('Next').'"></p>'); |
return; |
return; |
} |
} |
if ((!&validcheck($r)) || ($env{'form.concepttest'} eq 'editmyown')) { |
if ((!&validcheck($r,$cdom)) || ($env{'form.concepttest'} eq 'editmyown')) { |
&editor($r,$context,$cdom,$cnum); |
&editor($r,$context,$cdom,$cnum); |
} else { |
} else { |
my $numsub = &get_submissions_count($cdom,$cnum); |
my $numsub = &get_submissions_count($cdom,$cnum); |
Line 219 sub listresources {
|
Line 225 sub listresources {
|
} else { |
} else { |
$r->print('<fieldset><legend>'.&mt('Modify Test').'</legend>'. |
$r->print('<fieldset><legend>'.&mt('Modify Test').'</legend>'. |
&mt('Currently no student submissions have been recorded, so you may modify the contents of the Concept Test.'). |
&mt('Currently no student submissions have been recorded, so you may modify the contents of the Concept Test.'). |
'<br /><form name="changetest" method="post" action="/adm/coursedocs">'. |
'<br /><br /><form name="changetest" method="post" action="/adm/coursedocs">'. |
'<input type="hidden" name="concepttest" value="editmyown" />'. |
'<input type="hidden" name="concepttest" value="editmyown" />'. |
'<input type="submit" name="modifytest" value="'.&mt('Edit Concept Test').'" /></form></fieldset></p>'); |
'<input type="submit" name="modifytest" value="'.&mt('Edit Concept Test').'" /></form></fieldset></p>'); |
} |
} |
my ($crsparms,$ineffect,$parmlev) = ¤t_parms($cdom,$cnum); |
my ($crsparms,$ineffect,$parmlev) = ¤t_parms($cdom,$cnum); |
my $formname = 'datesform'; |
my $formname = 'datesform'; |
my $datebutton = &mt('Save'); |
my $datebutton = &mt('Save'); |
|
my $hide_timezone = 1; |
my $startform = |
my $startform = |
&Apache::lonhtmlcommon::date_setter($formname,'opendate', |
&Apache::lonhtmlcommon::date_setter($formname,'opendate', |
$crsparms->{'opendate'}); |
$crsparms->{'opendate'},'','','', |
|
'','','','','',$hide_timezone); |
my $endform = |
my $endform = |
&Apache::lonhtmlcommon::date_setter($formname,'duedate', |
&Apache::lonhtmlcommon::date_setter($formname,'duedate', |
$crsparms->{'duedate'}); |
$crsparms->{'duedate'},'','','', |
|
'','','','','',$hide_timezone); |
|
my $includeempty = 1; |
|
my $timezone = &Apache::lonlocal::gettimezone(); |
|
my $tzform = &Apache::loncommon::select_timezone('timezone',$timezone, |
|
undef,$includeempty); |
$r->print('<p><fieldset><legend>'.&mt('Test Availability').'</legend>'. |
$r->print('<p><fieldset><legend>'.&mt('Test Availability').'</legend>'. |
&mt('Open and close dates for test items for the concept test are currently set as follows:'). |
&mt('Open and close dates for test items for the concept test are currently set as follows:'). |
'<br />'. |
'<br /><br />'. |
'<form name="'.$formname.'" method="post" '. |
'<form name="'.$formname.'" method="post" '. |
'action="/adm/coursedocs">'. |
'action="/adm/coursedocs">'. |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title(&mt('Time zone')). |
|
$tzform. |
|
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title(&mt('Open date')). |
&Apache::lonhtmlcommon::row_title(&mt('Open date')). |
$startform. |
$startform. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
Line 263 sub editor {
|
Line 279 sub editor {
|
$r->print('<form name="selecteditems" method="post" action="/adm/coursedocs" |
$r->print('<form name="selecteditems" method="post" action="/adm/coursedocs" |
onsubmit="return validTestCheck()">'); |
onsubmit="return validTestCheck()">'); |
$r->print(&mt('Select test items from the numbered bins below and then press [_1]"Store Problem Selection"[_2] at the bottom of the page.','<i>','</i>').'<br />'); |
$r->print(&mt('Select test items from the numbered bins below and then press [_1]"Store Problem Selection"[_2] at the bottom of the page.','<i>','</i>').'<br />'); |
$r->print('<ul>'. |
if ($cdom eq 'gcitest') { |
'<li>'.&mt('Tests will contain a minimum of [_1] questions from the GCI 2 Inventory.',"<b>$reqnum</b>").'</li>'. |
$r->print('<ul>'. |
'<li>'.&mt('Tests must contain [_1]four[_2] mandatory questions and at least one item from each of [_1]eleven[_2] other bins.','<b>','</b>').'</li>'. |
'<li>'.&mt('Tests will contain a minimum of [_1] questions from the GCI 2 Inventory.',"<b>$reqnum</b>").'</li>'. |
'<li>'.&mt('All tests conclude with [_1]two[_2] questions selected by the system (at random) from a pool of development questions being piloted by the GCI team.','<b>','</b>').'</li>'. |
'<li>'.&mt('Tests must contain [_1]four[_2] mandatory questions and at least one item from each of [_1]eleven[_2] other bins.','<b>','</b>').'</li>'. |
'</ul>'); |
'<li>'.&mt('All tests conclude with [_1]two[_2] questions selected by the system (at random) from a pool of development questions being piloted by the GCI team.','<b>','</b>').'</li>'. |
|
'</ul>'); |
|
} |
my $mandleg = &mt('Mandatory Questions'); |
my $mandleg = &mt('Mandatory Questions'); |
$r->print(&display_questions(\@mandprobs,'mandatory',$mandleg,\%chosenitems)); |
$r->print(&display_questions(\@mandprobs,'mandatory',$mandleg,\%chosenitems,$cdom)); |
for (my $i=0; $i<@bins; $i++) { |
for (my $i=0; $i<@bins; $i++) { |
my $num = $i+1; |
my $num = $i+1; |
my $legend = &mt('Bin [_1]',$num); |
my $legend = &mt('Bin [_1]',$num); |
my $catname = 'bin'.$i; |
my $catname = 'bin'.$i; |
$r->print(&display_questions($bins[$i],$catname,$legend,\%chosenitems)); |
$r->print(&display_questions($bins[$i],$catname,$legend,\%chosenitems,$cdom)); |
} |
} |
my $optleg = &mt('Optional Questions'); |
my $optleg = &mt('Optional Questions'); |
$r->print(&display_questions(\@optional,'optional',$optleg,\%chosenitems)); |
$r->print(&display_questions(\@optional,'optional',$optleg,\%chosenitems,$cdom)); |
my $devleg = &mt('Development Questions'); |
my $devleg = &mt('Development Questions'); |
$r->print(&display_questions(\@devitems,'development',$devleg,\%chosenitems)); |
$r->print(&display_questions(\@devitems,'development',$devleg,\%chosenitems,$cdom)); |
$r->print('<input type="hidden" name="phase" value="storemap" />'. |
$r->print('<input type="hidden" name="phase" value="storemap" />'. |
'<input type="hidden" name="context" value="'.$context.'" />'. |
'<input type="hidden" name="context" value="'.$context.'" />'. |
|
'<input type="hidden" name="concepttest" value="'.$env{'form.concepttest'}.'" />'. |
'<input type="submit" value="'.&mt('Store Problem Selection').'" />'. |
'<input type="submit" value="'.&mt('Store Problem Selection').'" />'. |
'</form>'); |
'</form>'); |
&Apache::lonnet::delenv('request.gcicontext'); |
&Apache::lonnet::delenv('request.gcicontext'); |
} |
} |
|
|
sub display_questions { |
sub display_questions { |
my ($questions,$catname,$catlegend,$chosenitems) = @_; |
my ($questions,$catname,$catlegend,$chosenitems,$cdom) = @_; |
return unless((ref($questions) eq 'ARRAY') && (ref($chosenitems) eq 'HASH')); |
return unless((ref($questions) eq 'ARRAY') && (ref($chosenitems) eq 'HASH')); |
my $total = 0; |
my $total = 0; |
foreach my $item (@{$questions}) { |
foreach my $item (@{$questions}) { |
Line 316 sub display_questions {
|
Line 335 sub display_questions {
|
$output .= '<span id="'.$titleid.'">'. |
$output .= '<span id="'.$titleid.'">'. |
'<a href="javascript:showQuestions('."'$fieldid','$titleid'".')">'. |
'<a href="javascript:showQuestions('."'$fieldid','$titleid'".')">'. |
&mt('Show').'</a> ...</span><br />'. |
&mt('Show').'</a> ...</span><br />'. |
'<div id="'.$fieldid.'">'. |
'<div id="'.$fieldid.'" style="display: none">'. |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(); |
&Apache::loncommon::start_data_table_header_row(); |
unless (($catname eq 'development') || ($catname eq 'mandatory')) { |
unless (($catname eq 'development') || ($catname eq 'mandatory')) { |
Line 326 sub display_questions {
|
Line 345 sub display_questions {
|
'</th><th>'.&mt('Preview').'</th>'. |
'</th><th>'.&mt('Preview').'</th>'. |
&Apache::loncommon::end_data_table_header_row(); |
&Apache::loncommon::end_data_table_header_row(); |
foreach my $item (@{$questions}) { |
foreach my $item (@{$questions}) { |
my $url = &fullurl($item,$catname); |
my $url = &fullurl($item,$cdom,$catname); |
my $title = &Apache::lonnet::metadata($url,'title'); |
my $title = &Apache::lonnet::metadata($url,'title'); |
$output .= &Apache::loncommon::start_data_table_row().'<td>'; |
$output .= &Apache::loncommon::start_data_table_row().'<td>'; |
if ($catname eq 'mandatory') { |
if ($catname eq 'mandatory') { |
Line 361 sub display_questions {
|
Line 380 sub display_questions {
|
} |
} |
$output .= '<b>'.$title.'</b></td>'; |
$output .= '<b>'.$title.'</b></td>'; |
my $content=&Apache::lonindexer::showpreview($url); |
my $content=&Apache::lonindexer::showpreview($url); |
|
my $startformtag = '<form name="lonhomework" enctype="multipart/form-data" method="post" action="'.$url.'?inhibitmenu=yes" >'; |
|
my $endtag = '<table><tr><td><input onmouseup="javascript:setSubmittedPart'; |
|
$content =~ s/^\Q$startformtag\E//; |
|
$content =~ s/\Q$endtag\E.+$//s; |
$output .= '<td> '.($content eq '' ? ' ':$content).' </td>'."\n". |
$output .= '<td> '.($content eq '' ? ' ':$content).' </td>'."\n". |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
Line 395 sub evaluate {
|
Line 418 sub evaluate {
|
sub mapread_gci { |
sub mapread_gci { |
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $sequence = &Apache::loncommon::get_citest_map($coursedom); |
return |
return |
&LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/default_1261144274.sequence'); |
&LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.$sequence); |
} |
} |
|
|
sub storemap_gci { |
sub storemap_gci { |
Line 407 sub storemap_gci {
|
Line 431 sub storemap_gci {
|
} |
} |
return ('unauthorized',2) if (($coursedom eq '') || ($coursedom eq '') || |
return ('unauthorized',2) if (($coursedom eq '') || ($coursedom eq '') || |
(!&Apache::lonnet::allowed('mdc',$coursedom.'_'.$coursenum))); |
(!&Apache::lonnet::allowed('mdc',$coursedom.'_'.$coursenum))); |
my ($outtext,$errtext)= |
my $sequence = &Apache::loncommon::get_citest_map($coursedom); |
&LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/default_1261144274.sequence',1); |
my ($outtext,$errtext); |
|
if ($sequence) { |
|
($outtext,$errtext)= |
|
&LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.$sequence,1); |
|
} |
if ($errtext) { return ($errtext,2); } |
if ($errtext) { return ($errtext,2); } |
return ($errtext,0); |
return ($errtext,0); |
} |
} |
|
|
sub chosen_to_map { |
sub chosen_to_map { |
|
my ($cdom) = @_; |
my %chosenproblems=(); |
my %chosenproblems=(); |
foreach my $item (@chosen) { |
foreach my $item (@chosen) { |
$chosenproblems{$item}=1; |
$chosenproblems{$item}=1; |
Line 425 sub chosen_to_map {
|
Line 454 sub chosen_to_map {
|
for (my $idx=0;$idx<=$#allprobs;$idx++) { |
for (my $idx=0;$idx<=$#allprobs;$idx++) { |
$residx=$idx+1; |
$residx=$idx+1; |
if ($chosenproblems{$allprobs[$idx]}) { |
if ($chosenproblems{$allprobs[$idx]}) { |
my $url = &LONCAPA::map::qtunescape(&fullurl($allprobs[$idx])); |
my $url = &LONCAPA::map::qtunescape(&fullurl($allprobs[$idx],$cdom)); |
if (($revreqs{$allprobs[$idx]}) && |
if (($revreqs{$allprobs[$idx]}) && |
($chosenproblems{$revreqs{$allprobs[$idx]}})) { |
($chosenproblems{$revreqs{$allprobs[$idx]}})) { |
my $probnum = '_'.$allprobs[$idx].'_'.$revreqs{$allprobs[$idx]}; |
my $probnum = '_'.$allprobs[$idx].'_'.$revreqs{$allprobs[$idx]}; |
$url = &LONCAPA::map::qtunescape(&fullurl($probnum)); |
$url = &LONCAPA::map::qtunescape(&fullurl($probnum,$cdom)); |
} elsif ($prereqs{$allprobs[$idx]}) { |
} elsif ($prereqs{$allprobs[$idx]}) { |
next; |
next; |
} |
} |
Line 441 sub chosen_to_map {
|
Line 470 sub chosen_to_map {
|
} |
} |
foreach my $devitem (@development) { |
foreach my $devitem (@development) { |
if ($env{'form.pilot'.$devitem}) { |
if ($env{'form.pilot'.$devitem}) { |
my $url = &LONCAPA::map::qtunescape(&fullurl($devitem,'development')); |
my $url = &LONCAPA::map::qtunescape(&fullurl($devitem,$cdom,'development')); |
$residx ++; |
$residx ++; |
push(@LONCAPA::map::order,$residx); |
push(@LONCAPA::map::order,$residx); |
$counter ++; |
$counter ++; |
Line 476 sub store {
|
Line 505 sub store {
|
if ($env{'form.concepttest'} eq 'defchosen') { |
if ($env{'form.concepttest'} eq 'defchosen') { |
@chosen = @defchosen; |
@chosen = @defchosen; |
} |
} |
my @errors=&checkvalid(); |
my @errors=&checkvalid($cdom); |
if (@errors > 0) { |
if (@errors > 0) { |
if (($caller eq 'requestcrs') && ($env{'form.concepttest'} eq 'defchosen')) { |
if (($caller eq 'requestcrs') && ($env{'form.concepttest'} eq 'defchosen')) { |
return &mt('Invalid concept test.'); |
return &mt('Invalid concept test.'); |
Line 514 sub store {
|
Line 543 sub store {
|
} |
} |
|
|
sub load { |
sub load { |
|
my ($cdom) = @_; |
&mapread_gci(); |
&mapread_gci(); |
&map_to_chosen(); |
&map_to_chosen(); |
if (@chosen > 0) { |
if (@chosen > 0) { |
my @errors=&checkvalid(); |
my @errors=&checkvalid($cdom); |
if ($#errors>1) { @chosen=@defchosen; } |
if ($#errors>1) { @chosen=@defchosen; } |
} |
} |
} |
} |
Line 542 sub current_parms {
|
Line 572 sub current_parms {
|
sub store_dates_parms { |
sub store_dates_parms { |
my ($cdom,$cnum) = @_; |
my ($cdom,$cnum) = @_; |
my $topsymb = '___0___uploaded/'.$cdom.'/'.$cnum.'/default.sequence'; |
my $topsymb = '___0___uploaded/'.$cdom.'/'.$cnum.'/default.sequence'; |
|
my $tz_change; |
|
my $timezone = &Apache::lonlocal::gettimezone(); |
|
if ($env{'form.timezone'} ne '') { |
|
if (&Apache::lonlocal::gettimezone($env{'form.timezone'}) ne 'local') { |
|
if ($timezone ne $env{'form.timezone'}) { |
|
$tz_change = 1; |
|
$timezone = $env{'form.timezone'}; |
|
} |
|
} |
|
} |
my ($opendate,$duedate) = |
my ($opendate,$duedate) = |
&Apache::lonuserutils::get_dates_from_form('opendate','duedate'); |
&Apache::lonuserutils::get_dates_from_form('opendate','duedate',$timezone); |
my %dates = ( |
my %dates = ( |
opendate => { |
opendate => { |
value => $opendate, |
value => $opendate, |
Line 561 sub store_dates_parms {
|
Line 601 sub store_dates_parms {
|
'0_'.$date,14,$dates{$date}{'value'}, |
'0_'.$date,14,$dates{$date}{'value'}, |
$dates{$date}{'type'},undef,$cdom); |
$dates{$date}{'type'},undef,$cdom); |
} |
} |
|
if ($tz_change) { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.timezone' => $timezone}); |
|
} |
my $output = &mt('Open and Close dates set for test items').'<ul>'. |
my $output = &mt('Open and Close dates set for test items').'<ul>'. |
'<li>'.&mt('Concept Test Questions open:').' '. |
'<li>'.&mt('Concept Test Questions open:').' '. |
&Apache::lonlocal::locallocaltime($opendate).'</li>'. |
&Apache::lonlocal::locallocaltime($opendate,$timezone).'</li>'. |
'<li>'.&mt('Concept Test Questions close:').' '. |
'<li>'.&mt('Concept Test Questions close:').' '. |
&Apache::lonlocal::locallocaltime($duedate).'</li>'. |
&Apache::lonlocal::locallocaltime($duedate,$timezone).'</li>'. |
'</ul>'; |
'</ul>'; |
return $output; |
return $output; |
} |
} |
Line 577 sub get_submissions_count {
|
Line 620 sub get_submissions_count {
|
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
return $itemserror; |
return $itemserror; |
} |
} |
my @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/default_1261144274.sequence',sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;}); |
my (%resourcetracker,$submissioncount,@allres); |
my (%resourcetracker,$submissioncount); |
my $sequence = &Apache::loncommon::get_citest_map($cdom); |
my %resourcetracker = &Apache::lonnet::dump('nohist_resourcetracker', |
@allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/'.$sequence,sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;}); |
$cdom,$cnum); |
%resourcetracker = &Apache::lonnet::dump('nohist_resourcetracker', |
|
$cdom,$cnum); |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
my $symb = $resource->symb(); |
my $symb = $resource->symb(); |
my @parts = @{$resource->parts()}; |
my @parts = @{$resource->parts()}; |
Line 600 sub get_submissions_count {
|
Line 644 sub get_submissions_count {
|
} |
} |
|
|
sub builder_javascript { |
sub builder_javascript { |
|
my ($cdom) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
show => 'Show', |
show => 'Show', |
hide => 'Hide', |
hide => 'Hide', |
Line 624 function checkPrereqs(caller,item,prereq
|
Line 669 function checkPrereqs(caller,item,prereq
|
foreach my $item (sort(keys(%prereqs))) { |
foreach my $item (sort(keys(%prereqs))) { |
$hasdep .= "'$item',"; |
$hasdep .= "'$item',"; |
$prereq .= "'$prereqs{$item}',"; |
$prereq .= "'$prereqs{$item}',"; |
my $url = &fullurl($item); |
my $url = &fullurl($item,$cdom); |
$hasdeptitle .= "'".&Apache::lonnet::metadata($url,'title')."',"; |
$hasdeptitle .= "'".&Apache::lonnet::metadata($url,'title')."',"; |
my $purl = &fullurl($prereqs{$item}); |
my $purl = &fullurl($prereqs{$item},$cdom); |
$prereqtitle .= "'".&Apache::lonnet::metadata($purl,'title')."',"; |
$prereqtitle .= "'".&Apache::lonnet::metadata($purl,'title')."',"; |
} |
} |
$hasdep =~ s/,$//; |
$hasdep =~ s/,$//; |
Line 671 function hideQuestions(content,title) {
|
Line 716 function hideQuestions(content,title) {
|
return; |
return; |
} |
} |
|
|
function setInitialVisibility() { |
|
if (document.getElementById('GCI_mandatory_q') == null) { |
|
return; |
|
} |
|
document.getElementById('GCI_mandatory_q').style.display = "none"; |
|
document.getElementById('GCI_bin0_q').style.display = "none"; |
|
document.getElementById('GCI_bin1_q').style.display = "none"; |
|
document.getElementById('GCI_bin2_q').style.display = "none"; |
|
document.getElementById('GCI_bin3_q').style.display = "none"; |
|
document.getElementById('GCI_bin4_q').style.display = "none"; |
|
document.getElementById('GCI_bin5_q').style.display = "none"; |
|
document.getElementById('GCI_bin6_q').style.display = "none"; |
|
document.getElementById('GCI_bin7_q').style.display = "none"; |
|
document.getElementById('GCI_bin8_q').style.display = "none"; |
|
document.getElementById('GCI_bin9_q').style.display = "none"; |
|
document.getElementById('GCI_bin10_q').style.display = "none"; |
|
document.getElementById('GCI_optional_q').style.display = "none"; |
|
document.getElementById('GCI_development_q').style.display = "none"; |
|
} |
|
|
|
function countChecked(binname) { |
function countChecked(binname) { |
var count = 0; |
var count = 0; |
for (var i=0; i<document.selecteditems.elements.length; i++) { |
for (var i=0; i<document.selecteditems.elements.length; i++) { |
Line 732 function setDocsPhase() {
|
Line 757 function setDocsPhase() {
|
if (document.choices.concepttest[i].checked) { |
if (document.choices.concepttest[i].checked) { |
if (document.choices.concepttest[i].value == 'defchosen') { |
if (document.choices.concepttest[i].value == 'defchosen') { |
document.choices.phase.value = 'storemap'; |
document.choices.phase.value = 'storemap'; |
alert("Setting value for phase to "+document.choices.phase.value); |
|
|
|
} |
} |
} |
} |
} |
} |