[LON-CAPA-cvs] cvs: modules /albertel/cse101 cp2.pl

albertel lon-capa-cvs-allow@mail.lon-capa.org
Thu, 10 May 2007 20:02:00 -0000


albertel		Thu May 10 16:02:00 2007 EDT

  Added files:                 
    /modules/albertel/cse101	cp2.pl 
  Log:
  - mass parm assignment
  
  

Index: modules/albertel/cse101/cp2.pl
+++ modules/albertel/cse101/cp2.pl
use strict;
use lib '/home/httpd/lib/perl/';
#use Apache2::compat;
use Apache::lonnet;
use Apache::lonparmset;
use GDBM_File;

my $cdom = 'msu';
my $cnum = '1I19615677db1430amsul1';
my @sectionlist = qw/
001ww 002ww 003db 004ww 005ww 006ww 007ww 008ss 009ss 010db
011ww 012ss 013ww 014ww 015ss 016ss 017ss 018ww 019ww 020ww
021db 022db 023ss 024db 025db 026ss 027ss 028ss 029ss 030ss
031ss 032ss 033ss 034ss 035ss 036ss 037ss 038ss 039ss 040ww
041ww 042ww 043ww 044ww 045ww 046ww 047db 048db 049ss 050ss
051ss 052ss 053ss 054ss 055ss 056ss 057ss 058ss 059ss 060ss
061ss 062ss 063ss 064ww 065ww
/;
my $symb = 'msu/cse101/bridge_tasks/tasks/bt.sequence___(all)';
my $part = '0';
my $parm = 'available';

my $file = &Apache::loncommon::propath($cdom,$cnum).'/resourcedata.db';
if (tie(my %db, 'GDBM_File', $file, &GDBM_WRITER(),0640)) {
    foreach my $sec (@sectionlist) {
	my $key     = join('.',$cdom.'_'.$cnum,'['.$sec.']',$symb,$part,$parm);
	my $type_key= join('.',$key,'type');
	my (undef,$sec_num) = ($sec =~ /(0+)(\d+)/);
	my $value = join(':', map {'week'.$_.'_s'.$sec_num;}(1,3,5,8,10,12,13));
	
	$db{$key}     =$value;
	$db{$type_key}='string_any';
	print("$key -> $value\n");
	print("$type_key \n");
    }
}