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

www www@source.lon-capa.org
Thu, 13 Jan 2011 17:44:31 -0000


www		Thu Jan 13 17:44:31 2011 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
    /loncom/interface	lonhtmlcommon.pm lonparmset.pm 
  Log:
  For 3.0: directly jump into relevant parameter screen. Testing with "maxtries"
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.277 loncom/homework/inputtags.pm:1.278
--- loncom/homework/inputtags.pm:1.277	Fri Dec 31 02:40:14 2010
+++ loncom/homework/inputtags.pm	Thu Jan 13 17:44:27 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.277 2010/12/31 02:40:14 raeburn Exp $
+# $Id: inputtags.pm,v 1.278 2011/01/13 17:44:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1409,7 +1409,7 @@
 	    $trystr = '<td><span class="LC_nobreak">'.&mt($tries_text)." $tries";
 	    if ($Apache::lonhomework::parsing_a_task) {
 	    } elsif($env{'request.state'} ne 'construct') {
-		$trystr.="/$maxtries";
+		$trystr.="/".&Apache::lonhtmlcommon::direct_parm_link($maxtries,$env{'request.symb'},'maxtries',$id,$target);
 	    } else {
 		if (defined($Apache::inputtags::params{'maxtries'})) {
 		    $trystr.="/".$Apache::inputtags::params{'maxtries'};
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.285 loncom/interface/lonhtmlcommon.pm:1.286
--- loncom/interface/lonhtmlcommon.pm:1.285	Mon Jan  3 13:10:12 2011
+++ loncom/interface/lonhtmlcommon.pm	Thu Jan 13 17:44:30 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.285 2011/01/03 13:10:12 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.286 2011/01/13 17:44:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,6 +60,7 @@
 use Time::HiRes;
 use Apache::lonlocal;
 use Apache::lonnet;
+use HTML::Entities();
 use LONCAPA;
 
 sub java_not_enabled {
@@ -83,6 +84,22 @@
    return $message;
 }
 
+sub entity_encode {
+    my ($text)=@_;
+    return &HTML::Entities::encode($text, '<>&"');
+}
+
+sub direct_parm_link {
+    my ($linktext,$symb,$filter,$part,$target)=@_;
+    $symb=&entity_encode($symb);
+    $filter=&entity_encode($filter);
+    $part=&entity_encode($part);
+    if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) {
+       return "<a href='/adm/parmset?symb=$symb&filter=$filter&part=$part'>$linktext</a>";
+    } else {
+       return $linktext;
+    }
+}
 ##############################################
 ##############################################
 
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.505 loncom/interface/lonparmset.pm:1.506
--- loncom/interface/lonparmset.pm:1.505	Fri Dec 24 16:48:46 2010
+++ loncom/interface/lonparmset.pm	Thu Jan 13 17:44:30 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.505 2010/12/24 16:48:46 raeburn Exp $
+# $Id: lonparmset.pm,v 1.506 2011/01/13 17:44:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -302,6 +302,7 @@
 use Apache::lonnavmaps;
 use Apache::longroup;
 use Apache::lonrss;
+use HTML::Entities;
 use LONCAPA qw(:DEFAULT :match);
 
 
@@ -890,6 +891,8 @@
                        {'add_entries' => \%loaditems,});
     my $breadcrumbs =
     &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
+    my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
+    my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'});
     $r->print(<<ENDHEAD);
 $start_page
 $breadcrumbs
@@ -898,6 +901,8 @@
 <input type="hidden" value="" name="pres_type" />
 <input type="hidden" value="" name="pres_marker" />
 <input type="hidden" value="1" name="prevvisit" />
+<input type="hidden" value="$escfilter" name="filter" />
+<input type="hidden" value="$escpart" name="part" />
 ENDHEAD
 }
 
@@ -930,7 +935,7 @@
 
     if ($parmlev eq 'full') {
         $r->print('<td style="background-color:'.$defbgtwo.';" align="center">'
-                  .$$part{$which}.'</td>');
+                  .($$part{$which} eq '0'?'0 ('.&mt('default').')':$$part{$which}).'</td>');
     } else {
         $parm=~s|\[.*\]\s||g;
     }
@@ -2020,8 +2025,11 @@
 
     my @pscat=&Apache::loncommon::get_env_multiple('form.pscat');
     my $pschp=$env{'form.pschp'};
+
+
     my @psprt=&Apache::loncommon::get_env_multiple('form.psprt');
     if (!@psprt) { $psprt[0]='0'; }
+    if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; }
 
     my $pssymb='';
     my $parmlev='';
@@ -2331,6 +2339,9 @@
         my $csudom=$env{'user.domain'};
 
         if ($parmlev eq 'full') {
+#
+# This produces the cascading table output of parameters
+#
                my $coursespan=$csec?8:5;
                my $userspan=3;
                if ($cgroup ne '') {
@@ -2338,6 +2349,9 @@
                }
 
                $r->print('<p><table border="2">');
+#
+# This produces the headers
+#
                $r->print('<tr><td colspan="5"></td>');
                $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
                if ($uname) {
@@ -2401,7 +2415,9 @@
                }
 
                $r->print('</tr>');
-
+#
+# Done with the headers
+# 
                my $defbgone='';
                my $defbgtwo='';
                my $defbgthree = '';
@@ -2441,11 +2457,19 @@
                     my %default=();
                     my $uri=&Apache::lonnet::declutter($uris{$rid});
 
+                    my $filter=$env{'form.filter'};
+
                     foreach (&keysplit($keyp{$rid})) {
                         my $tempkeyp = $_;
                         if (grep $_ eq $tempkeyp, @catmarker) {
+                          my $parmname=&Apache::lonnet::metadata($uri,$_.'.name');
+# We may only want certain parameters listed
+                          if ($filter) {
+                             unless ($filter=~/\Q$parmname\E/) { next; }
+                          }
+                          $name{$_}=$parmname;
                           $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
-                          $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
+
                           my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
                           if ($allparms{$name{$_}} ne '') {
                               my $identifier;
@@ -3281,6 +3305,7 @@
 
     my @pscat=&Apache::loncommon::get_env_multiple('form.pscat');
     my $pschp=$env{'form.pschp'};
+
     my @psprt=&Apache::loncommon::get_env_multiple('form.psprt');
     if (!@psprt) { $psprt[0]='0'; }
 
@@ -4614,6 +4639,7 @@
                                              'pres_marker',
                                              'pres_value',
                                              'pres_type',
+                                             'filter','part',
                                              'udom','uname','symb','serial','timebase']);