--- modules/gci/londocsgci.pm 2009/12/21 15:51:29 1.6 +++ modules/gci/londocsgci.pm 2010/01/05 12:36:11 1.8 @@ -2,7 +2,7 @@ # Custom Edit Course Routines for Assembly of Valid Concept Tests from # Geoscience Concept Inventory. # -# $Id: londocsgci.pm,v 1.6 2009/12/21 15:51:29 gci Exp $ +# $Id: londocsgci.pm,v 1.8 2010/01/05 12:36:11 gci Exp $ # # Copyright Michigan State University Board of Trustees # @@ -58,7 +58,6 @@ my @bins; my @optional; my %mandatory; my @development; -my %developmentitems; sub setdefaults { $path='/res/gci/gci'; @@ -116,8 +115,7 @@ sub setdefaults { $revreqs{$prereqs{$item}} = $item; } @defchosen=('01','02','03','07','12','18','26','32','37','38','47','54','63','66','2004_73'); - @development = ('100','101','102'); - %developmentitems = ('100' => 1, '101' => '1', '102' => '1'); + @development = ('001','002','003','004','005','006','007','008','009','010','011','012','013','014'); } sub checkvalid { @@ -152,14 +150,17 @@ sub checkvalid { } sub fullurl { - my ($item)=@_; - unless ($item=~/^\_/) { $item='_'.$item; } + my ($item,$catname)=@_; + unless ($item=~/\_/) { $item='_'.$item; } + if ($catname eq 'development') { + return $path.'/pilot/pilot'.$item.'.problem'; + } return $path.'/'.$version.'/GCI'.$item.'.problem'; } sub item_from_url { my ($url)=@_; - if ($url =~ m{\Q$path\E/\Q$version\E/GCI_([^.]+)\.problem$}) { + if ($url =~ m{\Q$path\E/\Q$version\E/GCI_?([^.]+)\.problem$}) { return $1; } } @@ -309,11 +310,13 @@ sub display_questions { ''.&mt('Preview').''. &Apache::loncommon::end_data_table_header_row(); foreach my $item (@{$questions}) { - my $url = &fullurl($item); + my $url = &fullurl($item,$catname); my $title = &Apache::lonnet::metadata($url,'title'); $output .= &Apache::loncommon::start_data_table_row().''; - if (($catname eq 'mandatory') || ($catname eq 'development')) { + if ($catname eq 'mandatory') { $output .= ''; + } elsif ($catname eq 'development') { + $output .= ''; } else { $output .= '{$item}) { $output .= ' checked="checked"'; } @@ -402,13 +405,14 @@ sub chosen_to_map { @LONCAPA::map::order=(); @LONCAPA::map::resources=(); my $counter = 0; + my $residx; for (my $idx=0;$idx<=$#allprobs;$idx++) { - my $residx=$idx+1; + $residx=$idx+1; if ($chosenproblems{$allprobs[$idx]}) { my $url = &LONCAPA::map::qtunescape(&fullurl($allprobs[$idx])); if (($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)); } elsif ($prereqs{$allprobs[$idx]}) { next; @@ -419,6 +423,16 @@ sub chosen_to_map { $LONCAPA::map::resources[$residx]=join(':', ($name, $url, 'false', 'normal', 'res')); } } + foreach my $devitem (@development) { + if ($env{'form.pilot'.$devitem}) { + my $url = &LONCAPA::map::qtunescape(&fullurl($devitem,'development')); + $residx ++; + push(@LONCAPA::map::order,$residx); + $counter ++; + my $name = &LONCAPA::map::qtunescape('Problem '.$counter); + $LONCAPA::map::resources[$residx]=join(':', ($name, $url, 'false', 'normal', 'res')); + } + } } sub map_to_chosen {