[LON-CAPA-cvs] cvs: rat / lonpageflip.pm loncom/homework grades.pm loncom/interface loncommon.pm loncoursedata.pm lonfeedback.pm lonmenu.pm lonmeta.pm lonnavmaps.pm lonparmset.pm lonprintout.pm loncom/interface/spreadsheet assesscalc.pm loncom/lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 09 Sep 2003 18:46:28 -0000


This is a MIME encoded message

--www1063133188
Content-Type: text/plain

www		Tue Sep  9 14:46:28 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/interface	loncommon.pm loncoursedata.pm lonfeedback.pm 
                     	lonmenu.pm lonmeta.pm lonnavmaps.pm lonparmset.pm 
                     	lonprintout.pm 
    /loncom/interface/spreadsheet	assesscalc.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonpageflip.pm 
  Log:
  Hiding symb-splitting behind &decode_symb
  
  
--www1063133188
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030909144628.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.135 loncom/homework/grades.pm:1.136
--- loncom/homework/grades.pm:1.135	Thu Aug 21 14:21:39 2003
+++ loncom/homework/grades.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.135 2003/08/21 18:21:39 bowersj2 Exp $
+# $Id: grades.pm,v 1.136 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2851,7 +2851,7 @@
     $request->print($result);
 
     my $navmap = Apache::lonnavmaps::navmap->new();
-    my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'});
+    my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($ENV{'form.page'});
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
 
     my $iterator = $navmap->getIterator($map->map_start(),
@@ -3013,7 +3013,7 @@
     $request->print($result);
 
     my $navmap = Apache::lonnavmaps::navmap->new();
-    my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'});
+    my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $ENV{'form.page'});
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
 
     my $iterator = $navmap->getIterator($map->map_start(),
@@ -3321,7 +3321,7 @@
 
 sub scantron_process_students {
     my ($r) = @_;
-    my (undef,undef,$sequence)=split(/___/,$ENV{'form.selectpage'});
+    my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($ENV{'form.selectpage'});
     my ($symb,$url)=&get_symb_and_url($r);
     if (!$symb) {return '';}
     my $default_form_data=&defaultFormData($symb,$url);
@@ -3607,7 +3607,7 @@
     my $command=$ENV{'form.command'};
     if (!$url) {
 	my ($temp1,$temp2);
-	($temp1,$temp2,$ENV{'form.url'})=split(/___/,$symb);
+	($temp1,$temp2,$ENV{'form.url'})=&Apache::lonnet::decode_symb($symb);
 	$url = $ENV{'form.url'};
     }
     &send_header($request);
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.113 loncom/interface/loncommon.pm:1.114
--- loncom/interface/loncommon.pm:1.113	Tue Aug 26 13:20:45 2003
+++ loncom/interface/loncommon.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.113 2003/08/26 17:20:45 bowersj2 Exp $
+# $Id: loncommon.pm,v 1.114 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1780,7 +1780,7 @@
 
 sub get_student_view {
   my ($symb,$username,$domain,$courseid,$target) = @_;
-  my ($map,$id,$feedurl) = split(/___/,$symb);
+  my ($map,$id,$feedurl) = &Apache::lonnet::decode_symb($symb);
   my (%old,%moreenv);
   my @elements=('symb','courseid','domain','username');
   foreach my $element (@elements) {
@@ -1816,7 +1816,7 @@
 
 sub get_student_answers {
   my ($symb,$username,$domain,$courseid,%form) = @_;
-  my ($map,$id,$feedurl) = split(/___/,$symb);
+  my ($map,$id,$feedurl) = &Apache::lonnet::decode_symb($symb);
   my (%old,%moreenv);
   my @elements=('symb','courseid','domain','username');
   foreach my $element (@elements) {
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.85 loncom/interface/loncoursedata.pm:1.86
--- loncom/interface/loncoursedata.pm:1.85	Wed Aug 27 17:34:24 2003
+++ loncom/interface/loncoursedata.pm	Tue Sep  9 14:46:28 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.85 2003/08/27 21:34:24 matthew Exp $
+# $Id: loncoursedata.pm,v 1.86 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1384,7 +1384,7 @@
     if ($num) {
 	my %storestats=();
 
-        my $urlres=(split(/\_\_\_/,$symb))[2];
+        my $urlres=(&Apache::lonnet::decode_symb($symb))[2];
 
 	$storestats{$courseid.'___'.$urlres.'___timestamp'}=time;       
 	$storestats{$courseid.'___'.$urlres.'___stdno'}=$num;
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.51 loncom/interface/lonfeedback.pm:1.52
--- loncom/interface/lonfeedback.pm:1.51	Wed Sep  3 14:09:50 2003
+++ loncom/interface/lonfeedback.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.51 2003/09/03 18:09:50 albertel Exp $
+# $Id: lonfeedback.pm,v 1.52 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -465,7 +465,7 @@
     my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'};
 
     my ($symb,$idx)=split(/\:\:\:/,$entry);
-    my ($map,$ind,$url)=split(/\_\_\_/,$symb);
+    my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
 
     my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
                      $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
@@ -495,7 +495,7 @@
     my $entry=$ENV{'form.deldisc'};
 
     my ($symb,$idx)=split(/\:\:\:/,$entry);
-    my ($map,$ind,$url)=split(/\_\_\_/,$symb);
+    my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
 
     my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
                      $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
@@ -528,7 +528,7 @@
   unless ($symb) {
       $symb=$ENV{'form.symb'};
       if ($symb) {
-	  my ($map,$id,$url)=split(/\_\_\_/,$symb);
+	  my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb);
           $feedurl=&Apache::lonnet::clutter($url);
       }
   }
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.86 loncom/interface/lonmenu.pm:1.87
--- loncom/interface/lonmenu.pm:1.86	Thu Aug 28 12:43:12 2003
+++ loncom/interface/lonmenu.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.86 2003/08/28 16:43:12 albertel Exp $
+# $Id: lonmenu.pm,v 1.87 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -216,7 +216,7 @@
 	$newmail='<table bgcolor="'.$pgbg.'" border="0" cellspacing="3" cellpadding="3" width="100%"><tr><td bgcolor="'.$tabbg.'">';
     }
     if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) {
-	my ($mapurl,$rid,$resurl)=split(/\_\_\_/,$ENV{'request.symb'});
+	my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'});
         $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
         my $maptitle=&Apache::lonnet::gettitle($mapurl);
 	my $restitle=&Apache::lonnet::gettitle($resurl);
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.33 loncom/interface/lonmeta.pm:1.34
--- loncom/interface/lonmeta.pm:1.33	Tue Jul 15 15:04:31 2003
+++ loncom/interface/lonmeta.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.33 2003/07/15 19:04:31 www Exp $
+# $Id: lonmeta.pm,v 1.34 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,7 +70,7 @@
                    'usage'        => 'cnt'
                    );
     foreach (keys %evaldata) {
-	my ($item,$purl,$cat)=split(/\_\_\_/,$_);
+	my ($item,$purl,$cat)=&Apache::lonnet::decode_symb($_);
 ###	print "\n".$_.' - '.$item.'<br />';
         if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; }
         unless ($listitems{$cat} eq 'app') {
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.225 loncom/interface/lonnavmaps.pm:1.226
--- loncom/interface/lonnavmaps.pm:1.225	Mon Sep  8 18:44:36 2003
+++ loncom/interface/lonnavmaps.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.225 2003/09/08 22:44:36 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.226 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2048,7 +2048,7 @@
     unless ($symb) { return ''; }
     my $result='';
 
-    my ($mapname,$id,$fn)=split(/\_\_\_/,$symb);
+    my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb);
 
 # ----------------------------------------------------- Cascading lookup scheme
     my $rwhat=$what;
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.124 loncom/interface/lonparmset.pm:1.125
--- loncom/interface/lonparmset.pm:1.124	Thu Sep  4 23:47:47 2003
+++ loncom/interface/lonparmset.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.124 2003/09/05 03:47:47 www Exp $
+# $Id: lonparmset.pm,v 1.125 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -948,7 +948,7 @@
         }
         $r->print("</select></td></tr>\n");
     } else {
-        my ($map,$id,$resource)=split(/___/,$pssymb);
+        my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
         $r->print("<tr><td>Specific Resource</td><td>$resource</td>");
         $r->print('<td><input type="submit" name="dis" value="'.$submitmessage.'"></td>');
         $r->print('</tr>');
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.232 loncom/interface/lonprintout.pm:1.233
--- loncom/interface/lonprintout.pm:1.232	Tue Sep  9 09:31:08 2003
+++ loncom/interface/lonprintout.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.232 2003/09/09 13:31:08 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.233 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -531,7 +531,7 @@
 
     my $name_of_resourse = $hash{'title_'.$hash{'ids_'.$ENV{'form.postdata'}}};
     my $symbolic = &Apache::lonnet::symbread($ENV{'form.postdata'});
-    my ($map,$id,$resource)=split(/___/,$symbolic);
+    my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symbolic);
     $map=&Apache::lonnet::clutter($map);
     my $name_of_sequence;
     $name_of_sequence = $hash{'title_'.$hash{'ids_'.$map}};
@@ -846,7 +846,7 @@
 	    &Apache::lonxml::init_counter();
 	    foreach my $curresline (@master_seq)  {
 		if ($curresline=~ m/\.(problem|exam|quiz|assess|survey|form|library)$/) {
-		    my ($map,$id,$res_url) = split(/___/,$curresline);
+		    my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
 		    if (&Apache::lonnet::allowed('bre',$res_url)) {
 			my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,
                                                                         $ENV{'request.course.id'},'tex');
@@ -1118,7 +1118,7 @@
         $subdir = substr($helper->{VARS}->{'filename'},
                          0, rindex($helper->{VARS}->{'filename'}, '/') + 1);
     } else {
-        ($map, $id, $url) = split(/___/, $symb);
+        ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
         $helper->{VARS}->{'postdata'} = Apache::lonnet::clutter($url);
 
         if (!$resourceTitle) { # if the resource doesn't have a title, use the filename
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.19 loncom/interface/spreadsheet/assesscalc.pm:1.20
--- loncom/interface/spreadsheet/assesscalc.pm:1.19	Thu Sep  4 21:57:54 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Tue Sep  9 14:46:28 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.19 2003/09/05 01:57:54 matthew Exp $
+# $Id: assesscalc.pm,v 1.20 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -263,7 +263,7 @@
     my $result='';
     #
     # This should be a 
-    my ($mapname,$id,$fn)=split(/___/,$symb);
+    my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb);
     # Cascading lookup scheme
     my $rwhat=$what;
     $what =~ s/^parameter\_//;
@@ -548,7 +548,7 @@
     my %parameters;   # holds underscored parameters by name
     #
     # Get the metadata fields and determine their proper names
-    my ($symap,$syid,$srcf)=split(/___/,$self->{'symb'});
+    my ($symap,$syid,$srcf)=&Apache::lonnet::decode_symb($self->{'symb'});
     my @Metadata = split(/\,/,&Apache::lonnet::metadata($srcf,'keys'));
     foreach my $parm (@Mandatory_parameters,@Metadata) {
         next if ($parm !~ /^(resource\.|stores|parameter)_/);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.408 loncom/lonnet/perl/lonnet.pm:1.409
--- loncom/lonnet/perl/lonnet.pm:1.408	Tue Sep  2 09:07:51 2003
+++ loncom/lonnet/perl/lonnet.pm	Tue Sep  9 14:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.408 2003/09/02 13:07:51 www Exp $
+# $Id: lonnet.pm,v 1.409 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3410,7 +3410,7 @@
 # ----------------------------------------------------- Cascading lookup scheme
 	    if (!$symbparm) { $symbparm=&symbread(); }
 	    my $symbp=$symbparm;
-	    my $mapp=(split(/\_\_\_/,$symbp))[0];
+	    my $mapp=(&decode_symb($symbp))[0];
 
 	    my $symbparm=$symbp.'.'.$spacequalifierrest;
 	    my $mapparm=$mapp.'___(all).'.$spacequalifierrest;
@@ -3489,7 +3489,7 @@
 	my $filename;
 	if (!$symbparm) { $symbparm=&symbread(); }
 	if ($symbparm) {
-	    $filename=(split(/\_\_\_/,$symbparm))[2];
+	    $filename=(&decode_symb($symbparm))[2];
 	} else {
 	    $filename=$ENV{'request.filename'};
 	}
@@ -3764,7 +3764,7 @@
 	    delete($titlecache{$symb});
 	}
     }
-    my ($map,$resid,$url)=split(/\_\_\_/,$symb);
+    my ($map,$resid,$url)=&decode_symb($symb);
     my $title='';
     my %bighash;
     if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -3810,7 +3810,7 @@
 # direct jump to resource in page or to a sequence - will construct own symbs
     if ($thisfn=~/\.(page|sequence)$/) { return 1; }
 # check URL part
-    my ($map,$resid,$url)=split(/\_\_\_/,$symb);
+    my ($map,$resid,$url)=&decode_symb($symb);
     unless (&symbclean($url) eq &symbclean($thisfn)) { return 0; }
 
     $symb=&symbclean($symb);
@@ -3851,6 +3851,12 @@
     $symb=~s/\.(\d+)\.(\w+)$/\.$2/;
 
     return $symb;
+}
+
+# ---------------------------------------------- Split symb to find map and url
+
+sub decode_symb {
+    return split(/\_\_\_/,shift);
 }
 
 # ------------------------------------------------------ Return symb list entry
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.40 rat/lonpageflip.pm:1.41
--- rat/lonpageflip.pm:1.40	Fri Aug 15 10:49:26 2003
+++ rat/lonpageflip.pm	Tue Sep  9 14:46:28 2003
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.40 2003/08/15 14:49:26 www Exp $
+# $Id: lonpageflip.pm,v 1.41 2003/09/09 18:46:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -201,9 +201,9 @@
          my $newloc;
          if (($last) && (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
                         &GDBM_READER(),0640))) {
-            my ($murl,$fn)=split(/\_\_\_/,$last);
+            my ($murl,$fn)=&Apache::lonnet::decode_symb($last);
             my $id;
-            ($murl,$id,$fn)=split(/\_\_\_/,&Apache::lonnet::symbread($fn));
+            ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn));
 	    $newloc=$hash{'src_'.
                 $hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id};
             unless ($newloc) { $newloc='/adm/noidea.html'; }
@@ -230,7 +230,7 @@
              untie(%hash);
          }
          if ($last) {
-	     $currenturl=&Apache::lonnet::clutter((split(/\_\_\_/,$last))[1]);
+	     $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[1]);
 	 } else {
 	     $r->content_type('text/html');
              $r->header_out(Location => 
@@ -242,7 +242,7 @@
       my $position;
       if ($position=Apache::lonnet::symbread($currenturl)) {
 # ------------------------------------------------------------------------- Yes
-	  my ($startoutmap,$mapnum,$thisurl)=split(/\_\_\_/,$position);
+	  my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position);
           $cachehash{$startoutmap}{$thisurl}=$mapnum;
           $cachehash{$startoutmap}{'last_known'}=
                                        &Apache::lonnet::declutter($currenturl);

--www1063133188--