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

raeburn raeburn at source.lon-capa.org
Mon Jul 1 13:12:34 EDT 2024


raeburn		Mon Jul  1 17:12:34 2024 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonparmset.pm 
  Log:
  - For 2.11
    Backport 1.607, 1.609, 1.610, 1.611
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.522.2.29 loncom/interface/lonparmset.pm:1.522.2.30
--- loncom/interface/lonparmset.pm:1.522.2.29	Mon Jul  1 15:45:44 2024
+++ loncom/interface/lonparmset.pm	Mon Jul  1 17:12:34 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.522.2.29 2024/07/01 15:45:44 raeburn Exp $
+# $Id: lonparmset.pm,v 1.522.2.30 2024/07/01 17:12:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1743,7 +1743,7 @@
 }
 
 sub mapmenu {
-    my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_;
+    my ($r,$allmaps,$pschp,$maptitles,$symbp,$parmlev)=@_;
     my %allmaps_inverted = reverse %$allmaps;
     my $navmap = Apache::lonnavmaps::navmap->new();
     my $tree=[];
@@ -1791,7 +1791,11 @@
         }
     }
 # Show it ...    
-    $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"'));
+    my $rowattr = ' id="mapmenu"';
+    if ($parmlev eq 'general') {
+        $rowattr .= ' style="display:none"';
+    }
+    $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',$rowattr));
     if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) {
         my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
         my $whitespace =
@@ -2469,7 +2473,7 @@
         $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
         &levelmenu($r,\%alllevs,$parmlev);
         $r->print(&Apache::lonhtmlcommon::row_closure());
-        &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
+        &mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev);
         $r->print(&Apache::lonhtmlcommon::row_closure());
         $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));
         &partmenu($r,\%allparts,\@psprt);
@@ -2764,7 +2768,7 @@
 
 #-------------------------------------------- for each map, gather information
             my $mapid;
-               foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
+               foreach $mapid (sort { $a <=> $b } keys(%maplist)) {
                 my $maptitle = $maplist{$mapid};
 
 #-----------------------  loop through ids and get all parameter types for map
@@ -3314,6 +3318,7 @@
         $realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>';
         } elsif ($middle) {
         my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
+        next if (($url =~ /\.(page|sequence)$/) && ($parmlev eq 'full') && ($caller eq 'newoverview'));
         $realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>';
         }
         if ($sortorder eq 'realmstudent') {
@@ -3409,18 +3414,24 @@
 sub date_interval_selector {
     my ($thiskey, $showval, $readonly) = @_;
     my $result;
+    my $currval = $showval;
     foreach my $which (['days', 86400, 31],
                ['hours', 3600, 23],
                ['minutes', 60, 59],
                ['seconds',  1, 59]) {
-    my ($name, $factor, $max) = @{ $which };
-    my $amount = int($showval/$factor);
-    $showval  %= $factor;
-    my %select = ((map {$_ => $_} (0..$max)),
-              'select_form_order' => [0..$max]);
-    $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
-                           \%select,'',$readonly);
-    $result .= ' '.&mt($name);
+        my ($name, $factor, $max) = @{ $which };
+        my $amount = int($showval/$factor);
+        $showval  %= $factor;
+        my %select = ((map {$_ => $_} (0..$max)),
+                      'select_form_order' => [0..$max]);
+        if ($currval eq '') {
+            unshift(@{$select{'select_form_order'}},'');
+            $select{''} = '';
+            $amount = '';
+        }
+        $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
+                                                   \%select,'',$readonly);
+        $result .= ' '.&mt($name);
     }
     unless ($readonly) {
         $result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />';
@@ -3432,15 +3443,20 @@
 sub get_date_interval_from_form {
     my ($key) = @_;
     my $seconds = 0;
+    my $numnotnull = 0;
     foreach my $which (['days', 86400],
                ['hours', 3600],
                ['minutes', 60],
                ['seconds',  1]) {
-    my ($name, $factor) = @{ $which };
-    if (defined($env{'form.'.$name.'_'.$key})) {
-        $seconds += $env{'form.'.$name.'_'.$key} * $factor;
-    }
+        my ($name, $factor) = @{ $which };
+        if (defined($env{'form.'.$name.'_'.$key})) {
+            unless ($env{'form.'.$name.'_'.$key} eq '') {
+                $numnotnull ++;
+                $seconds += $env{'form.'.$name.'_'.$key} * $factor;
+            }
+        }
     }
+    return if (!$numnotnull);
     return $seconds;
 }
 
@@ -3722,10 +3738,8 @@
     $r->print('<div>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
     &levelmenu($r,\%alllevs,$parmlev);
-    if ($parmlev ne 'general') {
-        $r->print(&Apache::lonhtmlcommon::row_closure());
-        &mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp);
-    }
+    $r->print(&Apache::lonhtmlcommon::row_closure());
+    &mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev);
     $r->print(&Apache::lonhtmlcommon::row_closure(1));
     $r->print(&Apache::lonhtmlcommon::end_pick_box());
     $r->print('</div></div>');




More information about the LON-CAPA-cvs mailing list