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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Jun 2005 15:56:37 -0000


albertel		Tue Jun 28 11:56:37 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - resource table mode ordering of parted parameters was at best random seeming
    so now order it by the base type of the parm
  - stuck in some <label>
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.235 loncom/interface/lonparmset.pm:1.236
--- loncom/interface/lonparmset.pm:1.235	Tue Jun 28 11:28:08 2005
+++ loncom/interface/lonparmset.pm	Tue Jun 28 11:56:35 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.235 2005/06/28 15:28:08 albertel Exp $
+# $Id: lonparmset.pm,v 1.236 2005/06/28 15:56:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1067,6 +1067,18 @@
     } (keys %{$name});
 }
 
+sub keysinorder_bytype {
+    my ($name,$keyorder)=@_;
+    return sort {
+	my $ta=(split('_',$a))[-1];
+	my $tb=(split('_',$b))[-1];
+	if ($$keyorder{'parameter_0_'.$ta} == $$keyorder{'parameter_0_'.$tb}) {
+	    return ($a cmp $b);
+	}
+	$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb};
+    } (keys %{$name});
+}
+
 sub keysindisplayorder {
     my ($name,$keyorder)=@_;
     return sort {
@@ -1076,16 +1088,17 @@
 
 sub sortmenu {
     my ($r,$sortorder)=@_;
-    $r->print('<br /><input type="radio" name="sortorder" value="realmstudent"');
+    $r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"');
     if ($sortorder eq 'realmstudent') {
        $r->print(' checked="on"');
     }
     $r->print(' />'.&mt('Sort by realm first, then student (group/section)'));
-    $r->print('<br /><input type="radio" name="sortorder" value="studentrealm"');
+    $r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"');
     if ($sortorder eq 'studentrealm') {
        $r->print(' checked="on"');
     }
-    $r->print(' />'.&mt('Sort by student (group/section) first, then realm'));
+    $r->print(' />'.&mt('Sort by student (group/section) first, then realm').
+	      '</label>');
 }
 
 sub standardkeyorder {
@@ -1469,7 +1482,7 @@
 
                         $r->print('</font></tt></td>');
 
-                        foreach (&keysinorder(\%name,\%keyorder)) {
+                        foreach (&keysinorder_bytype(\%name,\%keyorder)) {
                             unless ($firstrow) {
                                 $r->print('<tr>');
                             } else {