'.
''.
@@ -626,13 +628,13 @@ SUBJAVASCRIPT
#--- javascript for essay type problem --
sub sub_page_kw_js {
my $request = shift;
+ my $iconpath = $request->dir_config('lonIconsURL');
$request->print(<
//===================== Show list of keywords ====================
function keywords(keyform) {
- var keywds = keyform.value;
- var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds);
+ var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keyform.value);
if (nret==null) return;
keyform.value = nret;
@@ -674,6 +676,12 @@ sub sub_page_kw_js {
}
//====================== Script for composing message ==============
+ // preload images
+ img1 = new Image();
+ img1.src = "$iconpath/mailbkgrd.gif";
+ img2 = new Image();
+ img2.src = "$iconpath/mailto.gif";
+
function msgCenter(msgform,usrctr,fullname) {
var Nmsg = msgform.savemsgN.value;
savedMsgHeader(Nmsg,usrctr,fullname);
@@ -701,91 +709,106 @@ sub sub_page_kw_js {
return;
}
+// var pWin = null;
function savedMsgHeader(Nmsg,usrctr,fullname) {
- var height = 50*Nmsg+250;
+ var height = 70*Nmsg+250;
var scrollbar = "no";
if (height > 600) {
height = 600;
scrollbar = "yes";
}
-/* if (window.pWin)
- window.pWin.close(); */
+// if (window.pWin) window.pWin.close();
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height);
- pWin.document.write("");
- pWin.document.write("Message Central ");
-
- pWin.document.write("
@@ -985,6 +1013,9 @@ sub submission {
if ($counter == 0) {
&sub_page_js($request);
&sub_page_kw_js($request);
+ $ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ?
+ &Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'};
+
$request->print(' Submission Record '."\n".
' Problem: '.$ENV{'form.probTitle'}.' '."\n");
@@ -1015,8 +1046,7 @@ sub submission {
$request->print('
';
}
if (scalar(@collaborators > $ncol)) {
$result .= '';
- $result .= 'This student has sumbitted too many '.
+ $result .= 'This student has submitted too many '.
'collaborators. Maximum is '.$ncol;
$result .= '
';
}
@@ -1215,7 +1253,9 @@ KEYWORDS
$result.=' '."\n".
' '.
- 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').' '.
+ 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').' '.
+ ' '."\n".
' (Message will be sent when you click on Save & Next below.)'."\n"
if ($ENV{'form.handgrade'} eq 'yes');
$request->print($result);
@@ -1329,12 +1369,11 @@ sub processHandGrade {
my $ctr = 0;
while ($ctr < $ngrade) {
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr});
- my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
+ my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
if ($errorflag eq 'no_score') {
$ctr++;
next;
}
-
my $includemsg = $ENV{'form.includemsg'.$ctr};
my ($subject,$message,$msgstatus) = ('','','');
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
@@ -1343,7 +1382,11 @@ sub processHandGrade {
foreach (@msgnum) {
$message.=$ENV{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne '');
}
- $message =~ s/\s+/ /g;
+ $message =&Apache::lonfeedback::clear_out_html($message);
+ $message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
+ $message.=" for $ENV{'form.probTitle'} ";
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,
$ENV{'form.msgsub'},$message);
}
@@ -1481,8 +1524,9 @@ sub processHandGrade {
#---- Save the score and award for each student, if changed
sub saveHandGrade {
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
- my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
- my %newrecord;
+ my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
+ my %newrecord = ();
+ my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
@@ -1492,11 +1536,11 @@ sub saveHandGrade {
}
}
} else {
- my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
- $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
- $ENV{'form.RADVAL'.$newflg.'_'.$_});
+ $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
+ $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
+ $ENV{'form.RADVAL'.$newflg.'_'.$_});
return 'no_score' if ($pts eq '' && $ENV{'form.GD_SEL'.$newflg.'_'.$_} eq '');
- my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
+ $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
$ENV{'form.WGT'.$newflg.'_'.$_};
my $partial= $pts/$wgt;
$newrecord{'resource.'.$_.'.awarded'} = $partial
@@ -1519,7 +1563,7 @@ sub saveHandGrade {
&Apache::lonnet::cstore(\%newrecord,$symb,
$ENV{'request.course.id'},$domain,$stuname);
}
- return '';
+ return '',$pts,$wgt;
}
#--------------------------------------------------------------------------------------
@@ -1715,8 +1759,7 @@ sub viewgrades {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n".
- ' '."\n".
+ ' '."\n".
' '."\n";
$result.='Assign Common Grade To ';
@@ -1807,7 +1850,7 @@ sub viewgrades {
#get info for each student
#list all the students - with points and grade status
- my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
+ my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1');
my $ctr = 0;
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom) = split(/:/);
@@ -2018,48 +2061,6 @@ sub split_part_type {
#
#-------------------------- Next few routines handles grading by csv upload
#
-#--- Menu to upload a csv scores ---
-sub upcsvScores_form {
- my ($request) = shift;
- my ($symb,$url)=&get_symb_and_url($request);
- if (!$symb) {return '';}
- my $result =<
- function checkUpload(formname) {
- if (formname.upfile.value == "") {
- alert("Please use the browse button to select a file from your local directory.");
- return false;
- }
- formname.submit();
- if (navigator.appName !="Netscape") {self.close()}; //if netscape if appears to close before submit!!!
- // any suggestion how to get around this??
- }
-
-CSVFORMJS
- $ENV{'form.probTitle'} = &Apache::lonnet::metadata($url,'title');
- $result.=''."\n";
- $result.=''."\n";
- $result.='
'."\n";
- return $result;
-}
-
#--- Javascript to handle csv upload
sub csvupload_javascript_reverse_associate {
return(<
-
-
+
@@ -2323,8 +2323,7 @@ sub pickStudentPage {
@@ -2363,9 +2370,9 @@ LISTJAVASCRIPT
my $result=' '.
'Manual Grading by Page or Sequence ';
- $result.='
+$grading_menu_button
+SCANTRONFORM
+
+ return $result;
+}
+
+sub scantron_configphase {
+ my ($r) = @_;
+ my (undef,undef,$sequence)=split(/___/,$ENV{'form.selectpage'});
+ my $result;
+ my ($symb,$url)=&get_symb_and_url($r);
+ if (!$symb) {return '';}
+ my $default_form_data=&defaultFormData($symb,$url);
+ my $grading_menu_button=&show_grading_menu_form($symb,$url);
+ my $file_selector;
+ $result.= <
+
+ $default_form_data
+
+
+
+
+
+
+ Select a format for the data file.
+
+
+
+
+ Format of data file:
+
+
+
+
+ Filename of scoring office file: $file_selector
+
+
+
+
+
+
+
+
+$grading_menu_button
+SCANTRONFORM
+ #FIXME Needs to present some lines from the file and allow the instructor to specify which columns represent what data, possibly have some nice defaults setup, probably should do a pass through all problems for a student to get an idea of how many questions there are, and homw many lines we'll have,
+ return $result;
+}
+
+sub scantron_process_students {
+ #FIXME
+ # loop through students, {
+ # Check if studnet info valid, if not add line to delay queue
+ # foreach question 'submit' the students answer to the server
+ # through grade target {
+ # generate data to pass back that includes grade recevied
+ # }
+ # }
+ # loop through delay queue {
+ # print out each delayed student with interface to select how
+ # to repair student provided info
+ # Expected errors include
+ # 1 bad/no stuid/username
+ # 2 invalid bubblings
+ # }
+ # if delay queue exists 2 submits one to process delayed students one
+ # to ignore delayed students, possibly saving the delay queue for later
+
+}
+#-------- end of section for handling grading scantron forms -------
+#
+#-------------------------------------------------------------------
+
+
#-------------------------- Menu interface -------------------------
#
#--- Show a Grading Menu button - Calls the next routine ---
@@ -2775,40 +2940,43 @@ sub show_grading_menu_form {
my $result.=''."\n".
' '."\n".
' '."\n".
- ' '."\n".
- ' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n";
return $result;
}
+# -- Retrieve choices for grading form
+sub savedState {
+ my %savedState = ();
+ if ($ENV{'form.saveState'}) {
+ foreach (split(/:/,$ENV{'form.saveState'})) {
+ my ($key,$value) = split(/=/,$_,2);
+ $savedState{$key} = $value;
+ }
+ }
+ return \%savedState;
+}
+
#--- Displays the main menu page -------
sub gradingmenu {
my ($request) = @_;
my ($symb,$url)=&get_symb_and_url($request);
if (!$symb) {return '';}
+ my $probTitle = &Apache::lonnet::gettitle($symb);
$request->print(<
function checkChoice(formname) {
var cmd = formname.command;
- formname.lastCmd.value = radioSelection(formname.command);
- formname.lastSec.value = pullDownSelection(formname.section);
- if (cmd[0].checked || cmd[1].checked || cmd[2].checked) {
- formname.submit();
- }
+ formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+
+ ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.status);
+ if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[4].checked) formname.submit();
- if (cmd[3].checked) {
- var url = "/adm/grades?command=csvform&symb="+formname.symb.value+"&url="+formname.url.value;
- var options = "width=620,height=340,screenx=70,screeny=75,";
- options += "resizable=no,scrollbars=no,status=no,";
- options += "menubar=no,toolbar=no,location=no,directories=no";
- var newWin = window.open(url, "CSVFile", options);
- newWin.focus();
- }
+ if (cmd[3].checked) browseAndUpload();
- if (cmd[4].checked) {
+ if (cmd[5].checked) {
if (!checkReceiptNo(formname,'notOK')) { return false;}
formname.submit();
}
@@ -2825,35 +2993,94 @@ sub gradingmenu {
formname.receipt.focus();
return false;
}
- formname.command[4].checked = true;
+ formname.command[5].checked = true;
return true;
}
function radioSelection(radioButton) {
var selection=null;
- for (var i=0; i 1) {
+ for (var i=0; i 1) {
+ for (var i=0; i");
+ lDoc.write("Browse And Upload ");
+
+ lDoc.write("
GRADINGMENUJS
- my $probTitle = &Apache::lonnet::metadata($ENV{'form.url'},'title');
my $result=' Manual Grading/View Submission '.
''.
- 'Problem: '.$probTitle.' ';
+ 'Problem: '.$probTitle.' '."\n";
my ($partlist,$handgrade) = &response_type($url);
my ($resptype,$hdgrade)=('','no');
for (sort keys(%$handgrade)) {
@@ -2864,11 +3091,14 @@ GRADINGMENUJS
'Type: '.$responsetype.' '.
'Handgrade: '.$handgrade.' ';
}
- $result.='
';
+ $result.='