--- loncom/xml/lonxml.pm	2001/08/20 14:53:12	1.119
+++ loncom/xml/lonxml.pm	2001/08/21 17:21:50	1.122
@@ -153,24 +153,45 @@ sub xmlend {
 }
 
 sub tokeninputfield {
-    my $defhost=$Apache::lonnet::perlvar{'lonhostID'};
+    my $defhost=$Apache::lonnet::perlvar{'lonHostID'};
+    $defhost=~tr/a-z/A-Z/;
     return (<<ENDINPUTFIELD)
-<form method="post">
+<script>
+    function updatetoken() {
+	var comp=new Array;
+        var barcode=unescape(document.tokeninput.barcode.value);
+        comp=barcode.split('*');
+        if (typeof(comp[0])!="undefined") {
+	    document.tokeninput.codeone.value=comp[0];
+	}
+        if (typeof(comp[1])!="undefined") {
+	    document.tokeninput.codetwo.value=comp[1];
+	}
+        if (typeof(comp[2])!="undefined") {
+            comp[2]=comp[2].toUpperCase();
+	    document.tokeninput.codethree.value=comp[2];
+	}
+        document.tokeninput.barcode.value='';
+    }  
+</script>
+<form method="post" name="tokeninput">
 <table border="2" bgcolor="#FFFFBB">
 <tr><th>DocID Checkin</th></tr>
 <tr><td>
 <table>
 <tr>
 <td>Scan in Barcode</td>
-<td><input type="text" size="22" name="barcode" /></td>
+<td><input type="text" size="22" name="barcode" 
+onChange="updatetoken()"/></td>
 </tr>
 <tr><td><i>or</i> Type in DocID</td>
 <td>
 <input type="text" size="5" name="codeone" />
-<b><font size+"+2"*</font></b>
+<b><font size="+2">*</font></b>
 <input type="text" size="5" name="codetwo" />
-<b><font size+"+2"*</font></b>
-<input type="text" size="10" name="codethree" value="$defhost" />
+<b><font size="+2">*</font></b>
+<input type="text" size="10" name="codethree" value="$defhost" 
+onChange="this.value=this.value.toUpperCase()" />
 </td></tr>
 </table>
 </td></tr>
@@ -224,7 +245,7 @@ sub printtokenheader {
                '<br />DocID: '.$token.
                '<br />Time: '.localtime().'<hr />';
     } else {
-        return $token;                         
+        return $token;
     }
 }
 
@@ -414,7 +435,6 @@ sub htmlclean {
 
 sub inner_xmlparse {
   my ($target,$stack,$parstack,$pars,$safeeval,$style_for_target)=@_;
-  &Apache::lonxml::debug('Reentrant parser starting, again?');
   my $finaloutput = '';
   my $result;
   my $token;
@@ -717,7 +737,14 @@ sub init_safespace {
 #need to inspect this class of ops
 # $safeeval->deny(":base_orig");
   $safeinit .= ';$external::target="'.$target.'";';
-  $safeinit .= ';$external::randomseed='.&Apache::lonnet::rndseed().';';
+  my $rndseed;
+  if (defined(&Apache::lonhomework::whichuser)) {
+    my ($symb,$courseid,$domain,$name) = &Apache::lonhomework::whichuser();
+    $rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name);
+  } else {
+    $rndseed=&Apache::lonnet::rndseed();
+  }
+  $safeinit .= ';$external::randomseed='.$rndseed.';';
   &Apache::run::run($safeinit,$safeeval);
 }