[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm /lonnet/perl lonnet.pm /publisher packages.tab
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 01 Apr 2004 15:12:27 -0000
albertel Thu Apr 1 10:12:27 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
/loncom/publisher packages.tab
/loncom/interface lonparmset.pm
Log:
- sequence parameters are now officially in the metadata for them
- page " " " " " " " " "
- all other resource excpet problems can now have packaged paramaters, adn should pick up <parameter />s
- add some interesting paramaters 'encrypturl' , (the old hidden 'mapalias' and 'randompick') 'contentopen', contentclose'
- encrypturl is commented out for now as gerd works on it
- parmset is modified to look if any resource has a parameter to set
- things needed to do
- wire up contentopen/close
- navmaps probably needs to display the open/close info
- removing the paramater insertion code in lonratedt
- actually test that the randompick/mapalias params are seeable by the things using them
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.482 loncom/lonnet/perl/lonnet.pm:1.483
--- loncom/lonnet/perl/lonnet.pm:1.482 Thu Apr 1 09:55:18 2004
+++ loncom/lonnet/perl/lonnet.pm Thu Apr 1 10:12:26 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.482 2004/04/01 14:55:18 albertel Exp $
+# $Id: lonnet.pm,v 1.483 2004/04/01 15:12:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4076,6 +4076,22 @@
# the next is the end of "start tag"
}
}
+ my ($extension) = ($uri =~ /\.(\w+)$/);
+ foreach my $key (sort(keys(%packagetab))) {
+ #&logthis("extsion1 $extension $key !!");
+ #no specific packages #how's our extension
+ if ($key!~/^extension_\Q$extension\E&/) { next; }
+ &metadata_create_pacakge_def($uri,$key,'extension_'.$extension,
+ \%metathesekeys);
+ }
+ if (!exists($metacache{$uri}->{':packages'})) {
+ foreach my $key (sort(keys(%packagetab))) {
+ #no specific packages well let's get default then
+ if ($key!~/^default&/) { next; }
+ &metadata_create_pacakge_def($uri,$key,'default',
+ \%metathesekeys);
+ }
+ }
# are there custom rights to evaluate
if ($metacache{$uri}->{':copyright'} eq 'custom') {
@@ -4104,6 +4120,30 @@
return $metacache{$uri}->{':'.$what};
}
+sub metadata_create_pacakge_def {
+ my ($uri,$key,$package,$metathesekeys)=@_;
+ my ($pack,$name,$subp)=split(/\&/,$key);
+ if ($subp eq 'default') { next; }
+
+ if (defined($metacache{$uri}->{':packages'})) {
+ $metacache{$uri}->{':packages'}.=','.$package;
+ } else {
+ $metacache{$uri}->{':packages'}=$package;
+ }
+ my $value=$packagetab{$key};
+ my $unikey;
+ $unikey='parameter_0_'.$name;
+ $metacache{$uri}->{':'.$unikey.'.part'}=0;
+ $$metathesekeys{$unikey}=1;
+ unless (defined($metacache{$uri}->{':'.$unikey.'.'.$subp})) {
+ $metacache{$uri}->{':'.$unikey.'.'.$subp}=$value;
+ }
+ if (defined($metacache{$uri}->{':'.$unikey.'.default'})) {
+ $metacache{$uri}->{':'.$unikey}=
+ $metacache{$uri}->{':'.$unikey.'.default'};
+ }
+}
+
sub metadata_generate_part0 {
my ($metadata,$metacache,$uri) = @_;
my %allnames;
@@ -4909,6 +4949,7 @@
open(my $config,"<$perlvar{'lonTabDir'}/packages.tab");
while (my $configline=<$config>) {
+ if ($configline !~ /\S/ || $configline=~/^#/) { next; }
chomp($configline);
my ($short,$plain)=split(/:/,$configline);
my ($pack,$name)=split(/\&/,$short);
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.27 loncom/publisher/packages.tab:1.28
--- loncom/publisher/packages.tab:1.27 Thu Mar 4 13:00:04 2004
+++ loncom/publisher/packages.tab Thu Apr 1 10:12:26 2004
@@ -1,3 +1,5 @@
+#parameters for things with explictic package declarations
+
part&opendate&display:Opening Date
part&opendate&type:date_start
part&duedate&display:Due Date
@@ -24,6 +26,10 @@
part&display&type:string
part_0&hiddenparts&display:List of hidden parts
part_0&hiddenparts&type:string_any
+#part_0&encrypturl&type:string_yesno
+#part_0t&encrypturl&display:Do not show plain URL
+part_0&mapalias&type:string
+part_0&mapalias&display:Resource alias name for conditions
numericalhint&tol&display:Numerical Tolerance
numericalhint&tol&type:tolerance
numericalhint&tol&default:5%
@@ -51,3 +57,35 @@
essayresponse&maxcollaborators&display:Maximum Number of Collaborators
essayresponse&uploadedfiletypes&type:string_fileext
essayresponse&uploadedfiletypes&display:Allowed File Extensions for Uploaded Files
+
+
+#parameters for things by extension
+
+extension_sequence&randompick&type:int_pos
+extension_sequence&randompick&display:Randomly pick number of resources
+extension_sequence&randompickseed&type:int_pos
+extension_sequence&randompickseed&display:Random seed for randomly picking number of resources (optional, only set if you know what you are doing)
+
+extension_page&randompick&type:int_pos
+extension_page&randompick&display:Randomly pick number of resources
+extension_page&randompickseed&type:int_pos
+extension_page&randompickseed&display:Random seed for randomly picking number of resources (optional, only set if you know what you are doing)
+extension_page&contentopen&display:Opening Date
+extension_page&contentopen&type:date_start
+extension_page&contentclose&display:Due Date
+extension_page&contentclose&type:date_end
+#extension_page&encrypturl&type:string_yesno
+#extension_page&encrypturl&display:Do not show plain URL
+
+
+#default parameters for anything that doesn't have any more specific
+#pacakge defintions
+
+default&contentopen&display:Opening Date
+default&contentopen&type:date_start
+default&contentclose&display:Due Date
+default&contentclose&type:date_end
+default&mapalias&type:string
+default&mapalias&display:Resource alias name for conditions
+#default&encrypturl&type:string_yesno
+#default&encrypturl&display:Do not show plain URL
\ No newline at end of file
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.151 loncom/interface/lonparmset.pm:1.152
--- loncom/interface/lonparmset.pm:1.151 Tue Feb 24 18:22:27 2004
+++ loncom/interface/lonparmset.pm Thu Apr 1 10:12:27 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.151 2004/02/24 23:22:27 albertel Exp $
+# $Id: lonparmset.pm,v 1.152 2004/04/01 15:12:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -587,7 +587,8 @@
my $resid=$2;
my $id=$mapid.'.'.$resid;
my $srcf=$$bighash{$_};
- if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+# if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+ if (1) {
$$ids[$#$ids+1]=$id;
$$typep{$id}=$1;
$$keyp{$id}='';
@@ -1151,8 +1152,10 @@
my $rid=$_;
my ($inmapid)=($rid=~/\.(\d+)$/);
- if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) ||
- ($pssymb eq $symbp{$rid})) {
+ if ((!$pssymb &&
+ (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
+ ||
+ ($pssymb && $pssymb eq $symbp{$rid})) {
# ------------------------------------------------------ Entry for one resource
if ($defbgone eq '"E0E099"') {
$defbgone='"E0E0DD"';