[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface lonpickcode.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 24 Apr 2004 08:31:57 -0000
albertel Sat Apr 24 04:31:57 2004 EDT
Modified files:
/loncom/interface lonpickcode.pm
/loncom/homework grades.pm
Log:
-pickcode seems to work correctly now
-radio buttons in the selecting a CODE phase work nicely
Index: loncom/interface/lonpickcode.pm
diff -u loncom/interface/lonpickcode.pm:1.1 loncom/interface/lonpickcode.pm:1.2
--- loncom/interface/lonpickcode.pm:1.1 Thu Apr 22 18:57:53 2004
+++ loncom/interface/lonpickcode.pm Sat Apr 24 04:31:57 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a CODE from the list of possible CODEs
#
-# $Id: lonpickcode.pm,v 1.1 2004/04/22 22:57:53 albertel Exp $
+# $Id: lonpickcode.pm,v 1.2 2004/04/24 08:31:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,8 +94,7 @@
'form','scantron_format',
'scantron_CODElist']);
- if (!
- ($ENV{'request.course.id'}) &&
+ if (!($ENV{'request.course.id'}) &&
(&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) {
$r->print('<body>Access not allowed.</body>');
return OK;
@@ -104,12 +103,12 @@
$r->print(&Apache::loncommon::bodytag("Selecting a CODE"));
$r->print(<<ENDSCRIPT);
<script>
-function gochoose(uname,udom) {
- opener.document.$ENV{'form.form'}.$ENV{'form.unameelement'}.value=uname;
- var slct=opener.document.$ENV{'form.form'}.$ENV{'form.udomelement'};
+function gochoose(newcode) {
+ opener.document.$ENV{'form.form'}.scan_CODE_selectedvalue.value=newcode;
+ var slct=opener.document.$ENV{'form.form'}.scan_CODE_resolution;
var i;
for (i=0;i<slct.length;i++) {
- if (slct.options[i].value==udom) { slct.selectedIndex=i; }
+ if (slct[i].value=='use_found') { slct[i].checked=true; }
}
self.close();
}
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.187 loncom/homework/grades.pm:1.188
--- loncom/homework/grades.pm:1.187 Thu Apr 22 18:57:53 2004
+++ loncom/homework/grades.pm Sat Apr 24 04:31:57 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.187 2004/04/22 22:57:53 albertel Exp $
+# $Id: grades.pm,v 1.188 2004/04/24 08:31:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4118,15 +4118,26 @@
$r->print("\n<br /> ");
$r->print("<input type='radio' name='scan_CODE_resolution' value='use_unfound' checked='on' /> Use the CODE <b><tt>".$$scan_record{'scantron.CODE'}."</tt></b> that is was on the paper, ignoring the error.");
$r->print("\n<br />");
+ $r->print(<<ENDSCRIPT);
+<script type="text/javascript">
+function change_radio(field) {
+ var slct=document.scantronupload.scan_CODE_resolution;
+ var i;
+ for (i=0;i<slct.length;i++) {
+ if (slct[i].value==field) { slct[i].checked=true; }
+ }
+}
+</script>
+ENDSCRIPT
my $href="/adm/pickcode?".
"form=".&Apache::lonnet::escape("scantronupload").
"&scantron_format=".&Apache::lonnet::escape($ENV{'form.scantron_format'}).
"&scantron_CODElist=".&Apache::lonnet::escape($ENV{'form.scantron_CODElist'}).
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}).
"&scantron_selectfile=".&Apache::lonnet::escape($ENV{'form.scantron_selectfile'});
- $r->print("<input type='radio' name='scan_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it. Selected CODE is <input type='text' size='8' name='scan_CODE_selectedvalue' />");
+ $r->print("<input type='radio' name='scan_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it. Selected CODE is <input readonly='true' type='text' size='8' name='scan_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />");
$r->print("\n<br />");
- $r->print("<input type='radio' name='scan_CODE_resolution' value='use_typed' /> Use <input type='text' size='8' name='scan_CODE_newvalue' /> as the CODE.");
+ $r->print("<input type='radio' name='scan_CODE_resolution' value='use_typed' /> Use <input type='text' size='8' name='scan_CODE_newvalue' onfocus=\"javascript:change_radio('use_typed')\" onkeypress=\"javascript:change_radio('use_typed')\" /> as the CODE.");
$r->print("\n<br /><br />");
} elsif ($error eq 'doublebubble') {
#FIXME Need to print out who this is along with the paper info