--- modules/gci/londocsgci.pm 2010/09/14 06:23:15 1.12
+++ modules/gci/londocsgci.pm 2010/12/05 17:48:54 1.17
@@ -2,7 +2,7 @@
# Custom Edit Course Routines for Assembly of Valid Concept Tests from
# Geoscience Concept Inventory.
#
-# $Id: londocsgci.pm,v 1.12 2010/09/14 06:23:15 gci Exp $
+# $Id: londocsgci.pm,v 1.17 2010/12/05 17:48:54 gci Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,65 +60,69 @@ my %mandatory;
my @development;
sub setdefaults {
- $path='/res/gci/gci';
- $version='GCIv2-1-1';
- $reqnum=15;
- @allprobs=('01','02','37','2004_73','03','04','05','06','07',
- '08','10',
- '09',
- '11','12','13','14','15','16','17',
- '18','69',
- '19','20',
- '21','22','23','24','25','26','27','28','29','30',
- '31','32','33','34','35','36','38',
- '39A','39B',
- '40',
- '41','42','43','44','45','46','47','48','49','50',
- '51',
- '52','57',
- '53','54','55','56','58',
- '60',
- '61','62','63','64','65','66','67','68','70',
- '71');
- @bins = ( ['03','04','06'],
- ['07','08','09'],
- ['10','12','13','14','15','16','17'],
- ['18','19','20','21','22','23','24','25'],
- ['26','27','28','30'],
- ['32','33','34','35','36'],
- ['38','39A','39B','40','41','42','43','44','45','46'],
- ['47','48','49','50','51','52','53'],
- ['54','55','56','57','58','60','61','62'],
- ['63','64','65'],
- ['66','67','68','69','70','71']);
- @optional = ('05','11','29','31');
- @mandcats = ('M1','M2','M3','M4');
- @bincats = ('A','B','C','D','E','F','G','H','I','J','K');
- @categories=(@mandcats,@bincats);
- %probcat =('01' => 'M1' ,'02' => 'M2' ,'37' => 'M3' ,'2004_73' => 'M4' ,
- '03' => 'A' ,'04' => 'A','05' => '' ,'06' => 'A' ,'07' => 'B' ,
- '08' => 'B' ,'09' => 'B' ,'10' => 'C' ,'11' => '' ,'12' => 'C' ,
- '13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' ,
- '21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => '' ,'30' => 'E' ,
- '31' => '' ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'38' => 'G' ,
- '39A'=> 'G' ,'39B'=> 'G' ,
- '40' => 'G' ,
- '41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' ,
- '51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' ,
- '60' => 'I' ,
- '61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' ,
- '71' => 'K');
- %mandatory=('01' => 1 ,'02' => 1,'37' => 1, '2004_73' => 1);
- @mandprobs = ('01','02','37','2004_73');
- %prereqs=('10' => '08', '57' => '52', '69' => '18');
- foreach my $item (keys(%prereqs)) {
- $revreqs{$prereqs{$item}} = $item;
+ my ($cdom) = @_;
+ if ($cdom eq 'gcitest') {
+ $path='/res/gci/gci';
+ $version='GCIv2-1-1';
+ $reqnum=15;
+ @allprobs=('01','02','37','2004_73','03','04','05','06','07',
+ '08','10',
+ '09',
+ '11','12','13','14','15','16','17',
+ '18','69',
+ '19','20',
+ '21','22','23','24','25','26','27','28','29','30',
+ '31','32','33','34','35','36','38',
+ '39A','39B',
+ '40',
+ '41','42','43','44','45','46','47','48','49','50',
+ '51',
+ '52','57',
+ '53','54','55','56','58',
+ '60',
+ '61','62','63','64','65','66','67','68','70',
+ '71');
+ @bins = ( ['03','04','06'],
+ ['07','08','09'],
+ ['10','12','13','14','15','16','17'],
+ ['18','19','20','21','22','23','24','25'],
+ ['26','27','28','30'],
+ ['32','33','34','35','36'],
+ ['38','39A','39B','40','41','42','43','44','45','46'],
+ ['47','48','49','50','51','52','53'],
+ ['54','55','56','57','58','60','61','62'],
+ ['63','64','65'],
+ ['66','67','68','69','70','71']);
+ @optional = ('05','11','29','31');
+ @mandcats = ('M1','M2','M3','M4');
+ @bincats = ('A','B','C','D','E','F','G','H','I','J','K');
+ @categories=(@mandcats,@bincats);
+ %probcat =('01' => 'M1' ,'02' => 'M2' ,'37' => 'M3' ,'2004_73' => 'M4' ,
+ '03' => 'A' ,'04' => 'A','05' => '' ,'06' => 'A' ,'07' => 'B' ,
+ '08' => 'B' ,'09' => 'B' ,'10' => 'C' ,'11' => '' ,'12' => 'C' ,
+ '13' => 'C' ,'14' => 'C' ,'15' => 'C' ,'16' => 'C' ,'17' => 'C' ,'18' => 'D' ,'19' => 'D' ,'20' => 'D' ,
+ '21' => 'D' ,'22' => 'D' ,'23' => 'D' ,'24' => 'D' ,'25' => 'D' ,'26' => 'E' ,'27' => 'E' ,'28' => 'E' ,'29' => '' ,'30' => 'E' ,
+ '31' => '' ,'32' => 'F' ,'33' => 'F' ,'34' => 'F' ,'35' => 'F' ,'36' => 'F' ,'38' => 'G' ,
+ '39A'=> 'G' ,'39B'=> 'G' ,
+ '40' => 'G' ,
+ '41' => 'G' ,'42' => 'G' ,'43' => 'G' ,'44' => 'G' ,'45' => 'G' ,'46' => 'G' ,'47' => 'H' ,'48' => 'H' ,'49' => 'H' ,'50' => 'H' ,
+ '51' => 'H' ,'52' => 'H' ,'53' => 'H' ,'54' => 'I' ,'55' => 'I' ,'56' => 'I' ,'57' => 'I' ,'58' => 'I' ,
+ '60' => 'I' ,
+ '61' => 'I' ,'62' => 'I' ,'63' => 'J' ,'64' => 'J' ,'65' => 'J' ,'66' => 'K' ,'67' => 'K' ,'68' => 'K' ,'69' => 'K' ,'70' => 'K' ,
+ '71' => 'K');
+ %mandatory=('01' => 1 ,'02' => 1,'37' => 1, '2004_73' => 1);
+ @mandprobs = ('01','02','37','2004_73');
+ %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','015','016','017','018','019','020','021','022');
}
sub checkvalid {
+ my ($cdom) = @_;
my %covered=();
my %chosenproblems=();
my @errors=();
@@ -138,9 +142,9 @@ sub checkvalid {
foreach my $item (@chosen) {
if ($prereqs{$item}) {
unless ($chosenproblems{$prereqs{$item}}) {
- my $url = &fullurl($item);
+ my $url = &fullurl($item,$cdom);
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');
push(@errors,&mt('[_1] requires [_2].',"'$title'","'$prereqtitle'"));
}
@@ -150,12 +154,14 @@ sub checkvalid {
}
sub fullurl {
- my ($item,$catname)=@_;
- unless ($item=~/\_/) { $item='_'.$item; }
- if ($catname eq 'development') {
- return $path.'/pilot/pilot'.$item.'.problem';
- }
- return $path.'/'.$version.'/GCI'.$item.'.problem';
+ my ($item,$cdom,$catname)=@_;
+ if ($cdom eq 'gcitest') {
+ unless ($item=~/\_/) { $item='_'.$item; }
+ if ($catname eq 'development') {
+ return $path.'/pilot/pilot'.$item.'.problem';
+ }
+ return $path.'/'.$version.'/GCI'.$item.'.problem';
+ }
}
sub item_from_url {
@@ -166,8 +172,8 @@ sub item_from_url {
}
sub validcheck {
- my ($r)=@_;
- my @errors=&checkvalid();
+ my ($r,$cdom)=@_;
+ my @errors=&checkvalid($cdom);
if ($#errors>-1) {
$r->print(''.&mt('Your test is not yet valid.').'
'.&mt('The following issues must be addressed before you can use the test:').'
');
foreach my $message (@errors) {
@@ -207,7 +213,7 @@ sub listresources {
'');
return;
}
- if ((!&validcheck($r)) || ($env{'form.concepttest'} eq 'editmyown')) {
+ if ((!&validcheck($r,$cdom)) || ($env{'form.concepttest'} eq 'editmyown')) {
&editor($r,$context,$cdom,$cnum);
} else {
my $numsub = &get_submissions_count($cdom,$cnum);
@@ -219,25 +225,35 @@ sub listresources {
} else {
$r->print('');
}
my ($crsparms,$ineffect,$parmlev) = ¤t_parms($cdom,$cnum);
my $formname = 'datesform';
my $datebutton = &mt('Save');
+ my $hide_timezone = 1;
my $startform =
&Apache::lonhtmlcommon::date_setter($formname,'opendate',
- $crsparms->{'opendate'});
+ $crsparms->{'opendate'},'','','',
+ '','','','','',$hide_timezone);
my $endform =
&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('