[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm /publisher addid.tab

www www@source.lon-capa.org
Sat, 06 Nov 2010 14:37:30 -0000


www		Sat Nov  6 14:37:30 2010 EDT

  Modified files:              
    /loncom/homework	functionplotresponse.pm 
    /loncom/publisher	addid.tab 
  Log:
  Using existing index-mechanism instead of introducing new 'label'
  
  
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.22 loncom/homework/functionplotresponse.pm:1.23
--- loncom/homework/functionplotresponse.pm:1.22	Mon Nov  1 00:04:09 2010
+++ loncom/homework/functionplotresponse.pm	Sat Nov  6 14:37:24 2010
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: functionplotresponse.pm,v 1.22 2010/11/01 00:04:09 www Exp $
+# $Id: functionplotresponse.pm,v 1.23 2010/11/06 14:37:24 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -363,7 +363,7 @@
 
 
 #
-# <spline label="..." order="1,2,3,4" initx="..." inity="..." scalex="..." scaley="..." />
+# <spline index="..." order="1,2,3,4" initx="..." inity="..." scalex="..." scaley="..." />
 #
 # Unfortunately, GeoGebra seems to want all splines after everything else, so we need to store them
 #
@@ -371,15 +371,19 @@
    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
    my $result='';
    if ($target eq 'web') {
-      my $label=&Apache::lonxml::get_param('label',$parstack,$safeeval);
+      my $label=&Apache::lonxml::get_param('index',$parstack,$safeeval);
       $Apache::functionplotresponse::counter++;
       if ($label=~/\W/) {
-         &Apache::lonxml::warning(&mt('Spline labels should only contain alphanumeric characters.'));
+         &Apache::lonxml::warning(&mt('Spline indices should only contain alphanumeric characters.'));
       }
       $label=~s/\W//gs;
-      unless ($label) { $label='S'.$Apache::functionplotresponse::counter; }
+      unless ($label) { 
+         $label='S'.$Apache::functionplotresponse::counter; 
+      } else {
+         $label='S'.$label;
+      }
       if ($Apache::functionplotresponse::splineorder{$label}) {
-         &Apache::lonxml::error(&mt('Spline labels must be unique.'));
+         &Apache::lonxml::error(&mt('Spline indices must be unique.'));
       }
 
       my $order=&Apache::lonxml::get_param('order',$parstack,$safeeval);
@@ -404,7 +408,7 @@
       $Apache::functionplotresponse::splinescaley{$label}=$sy;
    } elsif ($target eq 'edit') {
         $result=&Apache::edit::tag_start($target,$token,'Spline').
-             &Apache::edit::text_arg('Label:','label',
+             &Apache::edit::text_arg('Index:','index',
                                      $token,'4').'&nbsp;'.
              &Apache::edit::select_arg('Order:','order',
                                   ['2','3','4','5','6','7','8','9'],$token).'&nbsp;'.
@@ -419,7 +423,7 @@
              &Apache::edit::end_row();
   } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
-                                                 $safeeval,'label','order','initx','inity',
+                                                 $safeeval,'index','order','initx','inity',
                                                            'scalex','scaley');
     if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); }
   }
Index: loncom/publisher/addid.tab
diff -u loncom/publisher/addid.tab:1.22 loncom/publisher/addid.tab:1.23
--- loncom/publisher/addid.tab:1.22	Mon Sep 27 22:15:40 2010
+++ loncom/publisher/addid.tab	Sat Nov  6 14:37:29 2010
@@ -33,3 +33,5 @@
 Criteria		id
 Dimension		id
 Question		id
+spline			index
+splinerule		index