[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 04 Sep 2003 01:09:05 -0000


www		Wed Sep  3 21:09:05 2003 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Work on display of "Overview"
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.121 loncom/interface/lonparmset.pm:1.122
--- loncom/interface/lonparmset.pm:1.121	Wed Sep  3 17:24:32 2003
+++ loncom/interface/lonparmset.pm	Wed Sep  3 21:09:04 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.121 2003/09/03 21:24:32 www Exp $
+# $Id: lonparmset.pm,v 1.122 2003/09/04 01:09:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1672,7 +1672,6 @@
                              'Set/Modify Course Assessment Parameters');
     my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
     my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
-    my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
     $r->print(<<ENDOVER);
 <html>
 <head>
@@ -1682,8 +1681,43 @@
 <form method="post" action="/adm/parmset" name="overview">
 <input type="hidden" name="overview" value="1" />
 ENDOVER
-    foreach (sort keys %resourcedata) {
-	$r->print($_.' - '.$resourcedata{$_}.'<br />');
+# Read and display
+    my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
+    my $oldsection='';
+    my $oldrealm='';
+    my $oldpart='';
+    foreach my $thiskey (sort keys %resourcedata) {
+	my ($course,$middle,$part,$name)=
+	    ($thiskey=~/^(\w+)\.(.*)\.*([\w\s]+)\.(\w+)$/);
+	unless ($name eq 'type') {
+	    my $section='All Students';
+	    if ($middle=~/^\[(.*)\]\./) {
+		$section='Group/Section: '.$1;
+		$middle=~s/^\[(.*)\]\.//;
+	    }
+	    my $realm='All Resources';
+	    if ($middle=~/^(.+)\_\_\_\(all\)$/) {
+		$realm='Folder/Map: '.$1;
+	    } elsif ($middle) {
+		$realm='Resource: '.$middle;
+	    }
+	    if ($section ne $oldsection) {
+		$r->print("\n<hr /><h1>$section</h1>");
+		$oldsection=$section;
+		$oldrealm='';
+	    }
+	    if ($realm ne $oldrealm) {
+		$r->print("\n<h2>$realm</h2>");
+		$oldrealm=$realm;
+		$oldpart='';
+	    }
+	    if ($part ne $oldpart) {
+		$r->print("\n<h3>Part: $part</h3>");
+		$oldpart=$part;
+	    }
+
+	    $r->print('<br />'.$name.': '.$thiskey.' = '.$resourcedata{$thiskey});
+	}
     }
     $r->print('</form></body></html>');
 }