--- loncom/xml/lonxml.pm 2010/03/10 21:26:10 1.506 +++ loncom/xml/lonxml.pm 2010/03/21 18:32:02 1.507 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.506 2010/03/10 21:26:10 droeschl Exp $ +# $Id: lonxml.pm,v 1.507 2010/03/21 18:32:02 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -222,101 +222,6 @@ sub xmlend { return $discussion; } -sub tokeninputfield { - my $defhost=$Apache::lonnet::perlvar{'lonHostID'}; - $defhost=~tr/a-z/A-Z/; - return (<<ENDINPUTFIELD) -<script type="text/javascript"> - 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" action=""> -<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" -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> -<input type="text" size="5" name="codetwo" /> -<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> -<tr><td><input type="submit" value="Check in DocID" /></td></tr> -</table> -</form> -ENDINPUTFIELD -} - -sub maketoken { - my ($symb,$tuname,$tudom,$tcrsid)=@_; - unless ($symb) { - $symb=&Apache::lonnet::symbread(); - } - unless ($tuname) { - $tuname=$env{'user.name'}; - $tudom=$env{'user.domain'}; - $tcrsid=$env{'request.course.id'}; - } - - return &Apache::lonnet::checkout($symb,$tuname,$tudom,$tcrsid); -} - -sub printtokenheader { - my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_; - unless ($token) { return ''; } - - my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser(); - unless ($tsymb) { - $tsymb=$symb; - } - unless ($tuname) { - $tuname=$name; - $tudom=$domain; - $tcrsid=$courseid; - } - - my $plainname=&Apache::loncommon::plainname($tuname,$tudom); - - if ($target eq 'web') { - my %idhash=&Apache::lonnet::idrget($tudom,($tuname)); - return - '<img align="right" src="/cgi-bin/barcode.png?encode='.$token.'" />'. - &mt('Checked out for').' '.$plainname. - '<br />'.&mt('User').': '.$tuname.' at '.$tudom. - '<br />'.&mt('ID').': '.$idhash{$tuname}. - '<br />'.&mt('CourseID').': '.$tcrsid. - '<br />'.&mt('Course').': '.$env{'course.'.$tcrsid.'.description'}. - '<br />'.&mt('DocID').': '.$token. - '<br />'.&mt('Time').': '.&Apache::lonlocal::locallocaltime().'<hr />'; - } else { - return $token; - } -} - sub printalltags { my $temp; foreach $temp (sort keys %Apache::lonxml::alltags) {