[LON-CAPA-cvs] cvs: loncom /html/adm/helper newslot.helper

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 18 Nov 2005 16:51:15 -0000


albertel		Fri Nov 18 11:51:15 2005 EDT

  Modified files:              
    /loncom/html/adm/helper	newslot.helper 
  Log:
  - make the fact the changing the name creates a 'clone' exmplianed
  - make the cloning process better 
  
  
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.9 loncom/html/adm/helper/newslot.helper:1.10
--- loncom/html/adm/helper/newslot.helper:1.9	Fri Nov 18 11:26:57 2005
+++ loncom/html/adm/helper/newslot.helper	Fri Nov 18 11:51:13 2005
@@ -7,6 +7,8 @@
 	  if (exists($env{'form.name'}) ||
 	      $env{'form.name'} =~ /\S/) {
 	      $helper->{'VARS'}{'name'}=$env{'form.name'};
+	      $helper->{VARS}{'origname'}=$env{'form.name'};
+	      $helper->{DATA}{copy} = 1;
 	  }
       }
       $helper->{DATA}{origslot} = sub {
@@ -17,7 +19,7 @@
 	  }
 	  my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
 	  my $cdom  = $env{'course.'.$env{'request.course.id'}.'.domain'};
-	  my $name=$helper->{'VARS'}{'name'};
+	  my $name=$helper->{VARS}{'origname'};
 	  my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum);
 	  if (!ref($slot{$name})) { return $default; }
 	  if (!exists($slot{$name}{$which})) { return $default; }
@@ -27,7 +29,7 @@
     <message nextstate="OPTIONAL">
       <message_text>
           Name: <br />&nbsp;&nbsp;&nbsp;
-      </message_text>
+      </message_text>  
     </message>
     <string variable="name" size="30">
       <validator>
@@ -40,6 +42,14 @@
         return $helper->{'VARS'}{'name'};
       </defaultvalue>
     </string>
+    <condition>
+      <clause>$helper->{DATA}{copy}</clause>
+      <message nextstate="OPTIONAL">
+        <message_text>
+	<p>Changing the Name will create a new slot with the new name, and not rename the existing slot.</p>
+        </message_text>  
+      </message>
+    </condition>
     <message>
       <message_text><br />Start time:<br />&nbsp;&nbsp;&nbsp;</message_text>
     </message>