[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Fri, 13 Oct 2006 17:17:17 -0000
banghart Fri Oct 13 13:17:17 2006 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
Allow instructor to determine order of added metadata fields.
Seems to work, needs interface improvement.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.340 loncom/interface/lonparmset.pm:1.341
--- loncom/interface/lonparmset.pm:1.340 Thu Oct 12 20:20:19 2006
+++ loncom/interface/lonparmset.pm Fri Oct 13 13:17:14 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.340 2006/10/13 00:20:19 banghart Exp $
+# $Id: lonparmset.pm,v 1.341 2006/10/13 17:17:14 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3220,7 +3220,7 @@
my $idx = 1;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
- $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
+ $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata Fields'));
if ($env{'form.storeorder'}) {
my $newpos = $env{'form.newpos'} - 1;
@@ -3228,8 +3228,7 @@
my @neworder = ();
my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
my $i;
-
- if ($newpos>$currentpos) {
+ if ($newpos > $currentpos) {
# moving stuff up
for ($i=0;$i<$currentpos;$i++) {
$neworder[$i]=$oldorder[$i];
@@ -3255,26 +3254,22 @@
}
}
my $ordered_fields = join ",", @neworder;
+ $env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'} = $ordered_fields;
my $put_result = &Apache::lonnet::put('environment',
- {'metadata.addedorder'=>$ordered_fields},$dom,$crs);
-
-
-
-
-
- $r->print($env{'form.currentpos'}.' becomes '.$env{'form.newpos'});
+ {'metadata.addedorder'=>$ordered_fields},$dom,$crs);
}
my $fields = &get_added_meta_fieldnames();
+ my $ordered_fields;
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
if (!@fields_in_order) {
# no order found, pick sorted order then create metadata.addedorder key.
foreach my $key (sort keys %$fields) {
push @fields_in_order, $key;
- my $ordered_fields = join ",", @fields_in_order;
- my $put_result = &Apache::lonnet::put('environment',
- {'metadata.addedorder'=>$ordered_fields},$dom,$crs);
+ $ordered_fields = join ",", @fields_in_order;
}
- }
+ my $put_result = &Apache::lonnet::put('environment',
+ {'metadata.addedorder'=>$ordered_fields},$dom,$crs);
+ }
$r->print('<table>');
my $num_fields = scalar(@fields_in_order);
foreach my $key (@fields_in_order) {
@@ -3296,7 +3291,6 @@
$idx ++;
}
$r->print('</table>');
-
return 'ok';
}
sub addmetafield {