[LON-CAPA-cvs] cvs: modules /gci londocsgci.pm

gci gci@source.lon-capa.org
Tue, 05 Jan 2010 12:36:12 -0000


gci		Tue Jan  5 12:36:12 2010 EDT

  Modified files:              
    /modules/gci	londocsgci.pm 
  Log:
  - Development questions are now in pilot sub-directory within the gci user's author space.
  
  
Index: modules/gci/londocsgci.pm
diff -u modules/gci/londocsgci.pm:1.7 modules/gci/londocsgci.pm:1.8
--- modules/gci/londocsgci.pm:1.7	Fri Dec 25 00:49:35 2009
+++ modules/gci/londocsgci.pm	Tue Jan  5 12:36:11 2010
@@ -2,7 +2,7 @@
 # Custom Edit Course Routines for Assembly of Valid Concept Tests from
 # Geoscience Concept Inventory. 
 #
-# $Id: londocsgci.pm,v 1.7 2009/12/25 00:49:35 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 @optional;
 my %mandatory;
 my @development;
-my %developmentitems;
 
 sub setdefaults {
    $path='/res/gci/gci';
@@ -116,8 +115,7 @@
         $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,8 +150,11 @@
 }
 
 sub fullurl {
-   my ($item)=@_;
+   my ($item,$catname)=@_;
    unless ($item=~/\_/) { $item='_'.$item; }
+   if ($catname eq 'development') {
+       return $path.'/pilot/pilot'.$item.'.problem';
+   }
    return $path.'/'.$version.'/GCI'.$item.'.problem';
 }
 
@@ -309,11 +310,13 @@
                '</th><th>'.&mt('Preview').'</th>'.
                &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().'<td>';
-        if (($catname eq 'mandatory') || ($catname eq 'development')) {
+        if ($catname eq 'mandatory') {
             $output .= '<input type="hidden" name="item'.$item.'" value="checked" />';
+        } elsif ($catname eq 'development') {
+            $output .= '<input type="hidden" name="pilot'.$item.'" value="checked" />';
         } else {
             $output .= '<input type="checkbox" name="item'.$item.'"';
             if ($chosenitems->{$item}) { $output .= ' checked="checked"'; }
@@ -402,8 +405,9 @@
    @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]}) && 
@@ -419,6 +423,16 @@
 	  $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 {