Diff for /loncom/homework/grades.pm between versions 1.75 and 1.76

version 1.75, 2003/03/23 08:10:30 version 1.76, 2003/03/24 21:03:54
Line 113  sub response_type { Line 113  sub response_type {
 #--- Dumps the class list with usernames,list of sections,  #--- Dumps the class list with usernames,list of sections,
 #--- section, ids and fullnames for each user.  #--- section, ids and fullnames for each user.
 sub getclasslist {  sub getclasslist {
     my ($getsec,$hideexpired) = @_;      my ($getsec,$filterlist) = @_;
     my $classlist=&Apache::loncoursedata::get_classlist();      my $classlist=&Apache::loncoursedata::get_classlist();
     # Bail out if we were unable to get the classlist      # Bail out if we were unable to get the classlist
     return if (! defined($classlist));      return if (! defined($classlist));
Line 124  sub getclasslist { Line 124  sub getclasslist {
         # the following undefs are for 'domain', and 'username' respectively.          # the following undefs are for 'domain', and 'username' respectively.
  my (undef,undef,$end,$start,$id,$section,$fullname,$status)=   my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
             @{$classlist->{$_}};              @{$classlist->{$_}};
  # still a student?   # filter students according to status selected
  if (($hideexpired) && ($status ne 'Active')) {   if ($filterlist && $ENV{'form.saveStatus'} ne 'Any') {
             delete ($classlist->{$_});      if ($ENV{'form.saveStatus'} ne $status) {
             next;   delete ($classlist->{$_});
         }   next;
       }
    }
  $section = ($section ne '' ? $section : 'no');   $section = ($section ne '' ? $section : 'no');
  if ($getsec eq 'all' || $getsec eq $section) {   if ($getsec eq 'all' || $getsec eq $section) {
             $sections{$section}++;              $sections{$section}++;
Line 209  sub jscriptNform { Line 211  sub jscriptNform {
     $jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n".      $jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n".
  '<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".
  '<input type="hidden" name="url"     value="'.$url.'" />'."\n".   '<input type="hidden" name="url"     value="'.$url.'" />'."\n".
  '<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd" value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n".   '<input type="hidden" name="saveSec" value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub" value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n".
  '<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n".   '<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n".
  '<input type="hidden" name="command" value="submission" />'."\n".   '<input type="hidden" name="command" value="submission" />'."\n".
  '<input type="hidden" name="student" value="" />'."\n".   '<input type="hidden" name="student" value="" />'."\n".
Line 300  sub listStudents { Line 304  sub listStudents {
     $result.='</table>';      $result.='</table>';
   
     my $viewgrade = $ENV{'form.handgrade'} eq 'yes' ? 'View/Grade' : 'View';      my $viewgrade = $ENV{'form.handgrade'} eq 'yes' ? 'View/Grade' : 'View';
       $ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ? 
    &Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'};
   
     $result='<h3><font color="#339933">&nbsp;'.      $result='<h3><font color="#339933">&nbsp;'.
  $viewgrade.   $viewgrade.
Line 355  LISTJAVASCRIPT Line 361  LISTJAVASCRIPT
  '<input type="hidden" name="response"    value="'.$ENV{'form.response'}.'" />'."\n".   '<input type="hidden" name="response"    value="'.$ENV{'form.response'}.'" />'."\n".
  '<input type="hidden" name="handgrade"   value="'.$ENV{'form.handgrade'}.'" /><br />'."\n".   '<input type="hidden" name="handgrade"   value="'.$ENV{'form.handgrade'}.'" /><br />'."\n".
  '<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n".   '<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n".
  '<input type="hidden" name="lastCmd"     value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd"     value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec"     value="'.$ENV{'form.lastSec'}.'" />'."\n".   '<input type="hidden" name="saveSec"     value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub"     value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus"  value="'.$ENV{'form.saveStatus'}.'" />'."\n".
  '<input type="hidden" name="probTitle"   value="'.$ENV{'form.probTitle'}.'" />'."\n".   '<input type="hidden" name="probTitle"   value="'.$ENV{'form.probTitle'}.'" />'."\n".
  '<input type="hidden" name="url"  value="'.$url.'" />'."\n".   '<input type="hidden" name="url"  value="'.$url.'" />'."\n".
  '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
Line 368  LISTJAVASCRIPT Line 376  LISTJAVASCRIPT
  'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".   'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".
  'value="'.$viewgrade.'" />'."\n";   'value="'.$viewgrade.'" />'."\n";
     
     my (undef,undef,$fullname) = &getclasslist($getsec,'0');      my (undef,undef,$fullname) = &getclasslist($getsec,$ENV{'form.showgrading'} eq 'yes' ? '1' : '0');
           
     $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.      $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
  '<table border="0"><tr bgcolor="#e6ffff">'.   '<table border="0"><tr bgcolor="#e6ffff">'.
Line 631  sub sub_page_kw_js { Line 639  sub sub_page_kw_js {
   
 //===================== Show list of keywords ====================  //===================== Show list of keywords ====================
   function keywords(keyform) {    function keywords(keyform) {
     var keywds = keyform.value;      var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keyform.value);
     var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds);  
     if (nret==null) return;      if (nret==null) return;
     keyform.value = nret;      keyform.value = nret;
   
Line 701  sub sub_page_kw_js { Line 708  sub sub_page_kw_js {
     return;      return;
   }    }
   
   //  var pWin = null;
   function savedMsgHeader(Nmsg,usrctr,fullname) {    function savedMsgHeader(Nmsg,usrctr,fullname) {
     var height = 50*Nmsg+250;      var height = 70*Nmsg+250;
     var scrollbar = "no";      var scrollbar = "no";
     if (height > 600) {      if (height > 600) {
  height = 600;   height = 600;
  scrollbar = "yes";   scrollbar = "yes";
     }      }
 /*    if (window.pWin)  //    if (window.pWin) window.pWin.close();
  window.pWin.close(); */  
     pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height);      pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height);
     pWin.document.write("<html><head>");      pWin.focus();
     pWin.document.write("<title>Message Central</title>");      pDoc = pWin.document;
       pDoc.write("<html><head>");
     pWin.document.write("<script language=javascript>");      pDoc.write("<title>Message Central</title>");
     pWin.document.write("function checkInput() {");  
     pWin.document.write("  opener.document.SCORE.msgsub.value = document.msgcenter.msgsub.value;");      pDoc.write("<script language=javascript>");
     pWin.document.write("  var nmsg   = opener.document.SCORE.savemsgN.value;");      pDoc.write("function checkInput() {");
     pWin.document.write("  var usrctr = document.msgcenter.usrctr.value;");      pDoc.write("  opener.document.SCORE.msgsub.value = document.msgcenter.msgsub.value;");
     pWin.document.write("  var newval = eval(\\"opener.document.SCORE.newmsg\\"+usrctr);");      pDoc.write("  var nmsg   = opener.document.SCORE.savemsgN.value;");
     pWin.document.write("  newval.value = document.msgcenter.newmsg.value;");      pDoc.write("  var usrctr = document.msgcenter.usrctr.value;");
       pDoc.write("  var newval = eval(\\"opener.document.SCORE.newmsg\\"+usrctr);");
     pWin.document.write("  var msgchk = \\"\\";");      pDoc.write("  newval.value = document.msgcenter.newmsg.value;");
     pWin.document.write("  if (document.msgcenter.subchk.checked) {");  
     pWin.document.write("     msgchk = \\"msgsub,\\";");      pDoc.write("  var msgchk = \\"\\";");
     pWin.document.write("  }");      pDoc.write("  if (document.msgcenter.subchk.checked) {");
     pWin.document.write(   "for (var i=1; i<=nmsg; i++) {");      pDoc.write("     msgchk = \\"msgsub,\\";");
     pWin.document.write("      var opnmsg = eval(\\"opener.document.SCORE.savemsg\\"+i);");      pDoc.write("  }");
     pWin.document.write("      var frmmsg = eval(\\"document.msgcenter.msg\\"+i);");      pDoc.write(   "for (var i=1; i<=nmsg; i++) {");
     pWin.document.write("      opnmsg.value = frmmsg.value;");      pDoc.write("      var opnmsg = eval(\\"opener.document.SCORE.savemsg\\"+i);");
     pWin.document.write("      var chkbox = eval(\\"document.msgcenter.msgn\\"+i);");      pDoc.write("      var frmmsg = eval(\\"document.msgcenter.msg\\"+i);");
     pWin.document.write("      if (chkbox.checked) {");      pDoc.write("      opnmsg.value = frmmsg.value;");
     pWin.document.write("         msgchk += \\"savemsg\\"+i+\\",\\";");      pDoc.write("      var chkbox = eval(\\"document.msgcenter.msgn\\"+i);");
     pWin.document.write("      }");      pDoc.write("      if (chkbox.checked) {");
     pWin.document.write("  }");      pDoc.write("         msgchk += \\"savemsg\\"+i+\\",\\";");
     pWin.document.write("  if (document.msgcenter.newmsgchk.checked) {");      pDoc.write("      }");
     pWin.document.write("     msgchk += \\"newmsg\\"+usrctr;");      pDoc.write("  }");
     pWin.document.write("  }");      pDoc.write("  if (document.msgcenter.newmsgchk.checked) {");
     pWin.document.write("  var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);");      pDoc.write("     msgchk += \\"newmsg\\"+usrctr;");
     pWin.document.write("  includemsg.value = msgchk;");      pDoc.write("  }");
       pDoc.write("  var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);");
     pWin.document.write("  self.close()");      pDoc.write("  includemsg.value = msgchk;");
   
     pWin.document.write("}");      pDoc.write("  self.close()");
   
     pWin.document.write("<");      pDoc.write("}");
     pWin.document.write("/script>");  
       pDoc.write("<");
     pWin.document.write("</head><body bgcolor=white>");      pDoc.write("/script>");
   
     pWin.document.write("<form action=\\"inactive\\" name=\\"msgcenter\\">");      pDoc.write("</head><body bgcolor=white>");
     pWin.document.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">");  
     pWin.document.write("<font color=\\"green\\" size=+1>&nbsp;Compose Message for \"+fullname+\"</font><br><br>");      pDoc.write("<form action=\\"inactive\\" name=\\"msgcenter\\">");
       pDoc.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">");
     pWin.document.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">");      pDoc.write("<font color=\\"green\\" size=+1>&nbsp;Compose Message for \"+fullname+\"</font><br><br>");
     pWin.document.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">");  
     pWin.document.write("<td><b>Type</b></td><td><b>Include</b></td><td><b>Message</td></tr>");      pDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">");
       pDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">");
       pDoc.write("<td><b>Type</b></td><td><b>Include</b></td><td><b>Message</td></tr>");
 }  }
     function displaySubject(msg,shwsel) {      function displaySubject(msg,shwsel) {
     pWin.document.write("<tr bgcolor=\\"#ffffdd\\">");      pDoc = pWin.document;
     pWin.document.write("<td>Subject</td>");      pDoc.write("<tr bgcolor=\\"#ffffdd\\">");
     pWin.document.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>");      pDoc.write("<td>Subject</td>");
     pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>");      pDoc.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>");
       pDoc.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>");
 }  }
   
   function displaySavedMsg(ctr,msg,shwsel) {    function displaySavedMsg(ctr,msg,shwsel) {
     pWin.document.write("<tr bgcolor=\\"#ffffdd\\">");      pDoc = pWin.document;
     pWin.document.write("<td align=\\"center\\">"+ctr+"</td>");      pDoc.write("<tr bgcolor=\\"#ffffdd\\">");
     pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>");      pDoc.write("<td align=\\"center\\">"+ctr+"</td>");
     pWin.document.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"</textarea></td></tr>");      pDoc.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>");
       pDoc.write("<td><textarea name=\\"msg"+ctr+"\\" cols=\\"60\\" rows=\\"3\\">"+msg+"</textarea></td></tr>");
 }  }
   
   function newMsg(newmsg,shwsel) {    function newMsg(newmsg,shwsel) {
     pWin.document.write("<tr bgcolor=\\"#ffffdd\\">");      pDoc = pWin.document;
     pWin.document.write("<td align=\\"center\\">New</td>");      pDoc.write("<tr bgcolor=\\"#ffffdd\\">");
     pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>");      pDoc.write("<td align=\\"center\\">New</td>");
     pWin.document.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"</textarea></td></tr>");      pDoc.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>");
       pDoc.write("<td><textarea name=\\"newmsg\\" cols=\\"60\\" rows=\\"3\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" >"+newmsg+"</textarea></td></tr>");
 }  }
   
   function msgTail() {    function msgTail() {
     pWin.document.write("</table>");      pDoc = pWin.document;
     pWin.document.write("</td></tr></table>&nbsp;");      pDoc.write("</table>");
     pWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\">&nbsp;&nbsp;");      pDoc.write("</td></tr></table>&nbsp;");
     pWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");      pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\">&nbsp;&nbsp;");
     pWin.document.write("</form>");      pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");
     pWin.document.write("</body></html>");      pDoc.write("</form>");
       pDoc.write("</body></html>");
 }  }
   
 //====================== Script for keyword highlight options ==============  //====================== Script for keyword highlight options ==============
Line 819  sub sub_page_kw_js { Line 832  sub sub_page_kw_js {
     return;      return;
   }    }
   
   //  var hwdWin = null;
   function highlightCentral() {    function highlightCentral() {
   //    if (window.hwdWin) window.hwdWin.close();
     hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx=100,screeny=75');      hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx=100,screeny=75');
     hwdWin.document.write("<html><head>");      hwdWin.focus();
     hwdWin.document.write("<title>Highlight Central</title>");      var hDoc = hwdWin.document;
       hDoc.write("<html><head>");
     hwdWin.document.write("<script language=javascript>");      hDoc.write("<title>Highlight Central</title>");
     hwdWin.document.write("function updateChoice(flag) {");  
     hwdWin.document.write("  opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);");      hDoc.write("<script language=javascript>");
     hwdWin.document.write("  opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);");      hDoc.write("function updateChoice(flag) {");
     hwdWin.document.write("  opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);");      hDoc.write("  opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);");
     hwdWin.document.write("  opener.document.SCORE.refresh.value = \\"on\\";");      hDoc.write("  opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);");
     hwdWin.document.write("  if (opener.document.SCORE.keywords.value!=\\"\\"){");      hDoc.write("  opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);");
     hwdWin.document.write("     opener.document.SCORE.submit();");      hDoc.write("  opener.document.SCORE.refresh.value = \\"on\\";");
     hwdWin.document.write("  }");      hDoc.write("  if (opener.document.SCORE.keywords.value!=\\"\\"){");
     hwdWin.document.write("  self.close()");      hDoc.write("     opener.document.SCORE.submit();");
     hwdWin.document.write("}");      hDoc.write("  }");
       hDoc.write("  self.close()");
     hwdWin.document.write("function radioSelection(radioButton) {");      hDoc.write("}");
     hwdWin.document.write("    var selection=null;");  
     hwdWin.document.write("    for (var i=0; i<radioButton.length; i++) {");      hDoc.write("function radioSelection(radioButton) {");
     hwdWin.document.write("        if (radioButton[i].checked) {");      hDoc.write("    var selection=null;");
     hwdWin.document.write("            selection=radioButton[i].value;");      hDoc.write("    for (var i=0; i<radioButton.length; i++) {");
     hwdWin.document.write("            return selection;");      hDoc.write("        if (radioButton[i].checked) {");
     hwdWin.document.write("        }");      hDoc.write("            selection=radioButton[i].value;");
     hwdWin.document.write("    }");      hDoc.write("            return selection;");
     hwdWin.document.write("}");      hDoc.write("        }");
       hDoc.write("    }");
     hwdWin.document.write("<");      hDoc.write("}");
     hwdWin.document.write("/script>");  
       hDoc.write("<");
     hwdWin.document.write("</head><body bgcolor=white>");      hDoc.write("/script>");
   
     hwdWin.document.write("<form action=\\"inactive\\" name=\\"hlCenter\\">");      hDoc.write("</head><body bgcolor=white>");
     hwdWin.document.write("<font color=\\"green\\" size=+1>&nbsp;Keyword Highlight Options</font><br><br>");  
       hDoc.write("<form action=\\"inactive\\" name=\\"hlCenter\\">");
     hwdWin.document.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">");      hDoc.write("<font color=\\"green\\" size=+1>&nbsp;Keyword Highlight Options</font><br><br>");
     hwdWin.document.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">");  
     hwdWin.document.write("<td><b>Text Color</b></td><td><b>Font Size</b></td><td><b>Font Style</td></tr>");      hDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">");
       hDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">");
       hDoc.write("<td><b>Text Color</b></td><td><b>Font Size</b></td><td><b>Font Style</td></tr>");
   }    }
   
   function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) {     function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { 
     hwdWin.document.write("<tr bgcolor=\\"#ffffdd\\">");      var hDoc = hwdWin.document;
     hwdWin.document.write("<td align=\\"left\\">");      hDoc.write("<tr bgcolor=\\"#ffffdd\\">");
     hwdWin.document.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+">&nbsp;"+clrtxt+"</td>");      hDoc.write("<td align=\\"left\\">");
     hwdWin.document.write("<td align=\\"left\\">");      hDoc.write("<input name=\\"kwdclr\\" type=\\"radio\\" value=\\""+clrval+"\\" "+clrsel+">&nbsp;"+clrtxt+"</td>");
     hwdWin.document.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+">&nbsp;"+sztxt+"</td>");      hDoc.write("<td align=\\"left\\">");
     hwdWin.document.write("<td align=\\"left\\">");      hDoc.write("<input name=\\"kwdsize\\" type=\\"radio\\" value=\\""+szval+"\\" "+szsel+">&nbsp;"+sztxt+"</td>");
     hwdWin.document.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+">&nbsp;"+sytxt+"</td>");      hDoc.write("<td align=\\"left\\">");
     hwdWin.document.write("</tr>");      hDoc.write("<input name=\\"kwdstyle\\" type=\\"radio\\" value=\\""+syval+"\\" "+sysel+">&nbsp;"+sytxt+"</td>");
       hDoc.write("</tr>");
   }    }
   
   function highlightend() {     function highlightend() { 
     hwdWin.document.write("</table>");      var hDoc = hwdWin.document;
     hwdWin.document.write("</td></tr></table>&nbsp;");      hDoc.write("</table>");
     hwdWin.document.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\">&nbsp;&nbsp;");      hDoc.write("</td></tr></table>&nbsp;");
     hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");      hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\">&nbsp;&nbsp;");
     hwdWin.document.write("</form>");      hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");
     hwdWin.document.write("</body></html>");      hDoc.write("</form>");
       hDoc.write("</body></html>");
   }    }
   
 </script>  </script>
Line 985  sub submission { Line 1003  sub submission {
     if ($counter == 0) {      if ($counter == 0) {
  &sub_page_js($request);   &sub_page_js($request);
  &sub_page_kw_js($request);   &sub_page_kw_js($request);
    $ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ? 
       &Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'};
   
  $request->print('<h3>&nbsp;<font color="#339933">Submission Record</font></h3>'."\n".   $request->print('<h3>&nbsp;<font color="#339933">Submission Record</font></h3>'."\n".
  '<font size=+1>&nbsp;<b>Problem: </b>'.$ENV{'form.probTitle'}.'</font>'."\n");   '<font size=+1>&nbsp;<b>Problem: </b>'.$ENV{'form.probTitle'}.'</font>'."\n");
   
Line 1015  sub submission { Line 1036  sub submission {
   
  $request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n".   $request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n".
  '<input type="hidden" name="command"    value="handgrade" />'."\n".   '<input type="hidden" name="command"    value="handgrade" />'."\n".
  '<input type="hidden" name="lastCmd"    value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd"    value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec"    value="'.$ENV{'form.lastSec'}.'" />'."\n".   '<input type="hidden" name="saveSec"    value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub"    value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n".
  '<input type="hidden" name="probTitle"  value="'.$ENV{'form.probTitle'}.'" />'."\n".   '<input type="hidden" name="probTitle"  value="'.$ENV{'form.probTitle'}.'" />'."\n".
  '<input type="hidden" name="refresh"    value="off" />'."\n".   '<input type="hidden" name="refresh"    value="off" />'."\n".
  '<input type="hidden" name="symb"       value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb"       value="'.$symb.'" />'."\n".
Line 1081  KEYWORDS Line 1104  KEYWORDS
     my ($classlist,$fullname);      my ($classlist,$fullname);
     if ($ENV{'form.handgrade'} eq 'yes') {      if ($ENV{'form.handgrade'} eq 'yes') {
  my @col_list;   my @col_list;
  ($classlist,undef,$fullname) = &getclasslist('all','0');   ($classlist,undef,$fullname) = &getclasslist('all',$ENV{'form.showgrading'} eq 'yes' ? '1' : '0');
  for (keys (%$handgrade)) {   for (keys (%$handgrade)) {
     my $ncol = &Apache::lonnet::EXT('resource.'.$_.      my $ncol = &Apache::lonnet::EXT('resource.'.$_.
     '.maxcollaborators',      '.maxcollaborators',
Line 1126  KEYWORDS Line 1149  KEYWORDS
                 }                  }
                 if (scalar(@collaborators > $ncol)) {                  if (scalar(@collaborators > $ncol)) {
                     $result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>';                      $result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>';
                     $result .= 'This student has sumbitted too many '.                      $result .= 'This student has submitted too many '.
                         'collaborators.  Maximum is '.$ncol;                          'collaborators.  Maximum is '.$ncol;
                     $result .= '</td></tr></table>';                      $result .= '</td></tr></table>';
                 }                  }
Line 1715  sub viewgrades { Line 1738  sub viewgrades {
  '<input type="hidden" name="url"     value="'.$url.'" />'."\n".   '<input type="hidden" name="url"     value="'.$url.'" />'."\n".
  '<input type="hidden" name="command" value="editgrades" />'."\n".   '<input type="hidden" name="command" value="editgrades" />'."\n".
  '<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n".   '<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n".
  '<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd" value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n".   '<input type="hidden" name="saveSec" value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub" value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n".
  '<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n";   '<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n";
   
     $result.='<h3>Assign Common Grade To ';      $result.='<h3>Assign Common Grade To ';
Line 1807  sub viewgrades { Line 1832  sub viewgrades {
   
     #get info for each student      #get info for each student
     #list all the students - with points and grade status      #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;      my $ctr = 0;
     foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
  my ($uname,$udom) = split(/:/);   my ($uname,$udom) = split(/:/);
Line 2018  sub split_part_type { Line 2043  sub split_part_type {
 #  #
 #-------------------------- Next few routines handles grading by csv upload  #-------------------------- 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 =<<CSVFORMJS;  
 <script type="text/javascript" language="javascript">  
     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??  
     }  
     </script>  
 CSVFORMJS  
     $ENV{'form.probTitle'} = &Apache::lonnet::gettitle($symb);  
     $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n";  
     $result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n";  
     $result.='&nbsp;<b>Specify a file containing the class scores for problem - '.$ENV{'form.probTitle'}.  
  '.</b></td></tr>'."\n";  
     $result.='<tr bgcolor=#ffffe6><td>'."\n";  
     my $upfile_select=&Apache::loncommon::upfile_select_html();  
     $result.=<<ENDUPFORM;  
 <form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload" target="LONcatInfo">  
 <input type="hidden" name="symb" value="$symb" />  
 <input type="hidden" name="url" value="$url" />  
 <input type="hidden" name="command" value="csvuploadmap" />  
 <input type="hidden" name="probTitle" value="$ENV{'form.probTitle'}" />  
 $upfile_select  
 <br /><input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scores" />&nbsp;  
 <input type="button" value="Cancel" onClick="self.close()">  
   
 </form>  
 ENDUPFORM  
     $result.='</td></tr></table>'."\n";  
     $result.='</td></tr></table>'."\n";  
     return $result;  
 }  
   
 #--- Javascript to handle csv upload  #--- Javascript to handle csv upload
 sub csvupload_javascript_reverse_associate {  sub csvupload_javascript_reverse_associate {
   return(<<ENDPICK);    return(<<ENDPICK);
Line 2175  to this page if the data selected is ins Line 2158  to this page if the data selected is ins
                                        value="$ENV{'form.upfile_associate'}" />                                         value="$ENV{'form.upfile_associate'}" />
 <input type="hidden" name="symb"       value="$symb" />  <input type="hidden" name="symb"       value="$symb" />
 <input type="hidden" name="url"        value="$url" />  <input type="hidden" name="url"        value="$url" />
 <input type="hidden" name="lastCmd"    value="$ENV{'form.lastCmd'}" />  <input type="hidden" name="saveCmd"    value="$ENV{'form.saveCmd'}" />
 <input type="hidden" name="lastSec"    value="$ENV{'form.lastSec'}" />  <input type="hidden" name="saveSec"    value="$ENV{'form.saveSec'}" />
   <input type="hidden" name="saveSub"    value="$ENV{'form.saveSub'}" />
   <input type="hidden" name="saveStatus" value="$ENV{'form.saveStatus'}" />
 <input type="hidden" name="probTitle"  value="$ENV{'form.probTitle'}" />  <input type="hidden" name="probTitle"  value="$ENV{'form.probTitle'}" />
 <input type="hidden" name="command"    value="csvuploadassign" />  <input type="hidden" name="command"    value="csvuploadassign" />
 <hr />  <hr />
Line 2323  sub pickStudentPage { Line 2308  sub pickStudentPage {
 <script type="text/javascript" language="javascript">  <script type="text/javascript" language="javascript">
   
 function checkPickOne(formname) {  function checkPickOne(formname) {
     var user = radioSelection(formname.student);      if (radioSelection(formname.student) == null) {
     if (user == null) {  
  alert("Please select the student you wish to grade.");   alert("Please select the student you wish to grade.");
  return;   return;
     }      }
Line 2336  function checkPickOne(formname) { Line 2320  function checkPickOne(formname) {
   
 function radioSelection(radioButton) {  function radioSelection(radioButton) {
     var selection=null;      var selection=null;
     for (var i=0; i<radioButton.length; i++) {      if (radioButton.length > 1) {
         if (radioButton[i].checked) {   for (var i=0; i<radioButton.length; i++) {
             return radioButton[i].value;      if (radioButton[i].checked) {
         }   return radioButton[i].value;
       }
    }
       } else {
    if (radioButton.checked) return radioButton.value;
     }      }
     return selection;      return selection;
 }  }
       
 function pullDownSelection(selectOne) {  function pullDownSelection(selectOne) {
     var selection=null;      var selection="";
     for (var i=0; i<selectOne.length; i++) {      if (selectOne.length > 1) {
         if (selectOne[i].selected) {   for (var i=0; i<selectOne.length; i++) {
             return selectOne[i].value;      if (selectOne[i].selected) {
         }   return selectOne[i].value;
       }
    }
       } else {
    if (selectOne.selected) return selectOne.value;
     }      }
 }  }
 </script>  </script>
Line 2398  LISTJAVASCRIPT Line 2390  LISTJAVASCRIPT
  '<input type="hidden" name="command" value="displayPage" />'."\n".   '<input type="hidden" name="command" value="displayPage" />'."\n".
  '<input type="hidden" name="url"     value="'.$url.'" />'."\n".   '<input type="hidden" name="url"     value="'.$url.'" />'."\n".
  '<input type="hidden" name="symb"    value="'.$symb.'" />'."<br><br>\n".   '<input type="hidden" name="symb"    value="'.$symb.'" />'."<br><br>\n".
  '<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd" value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n";   '<input type="hidden" name="saveSec" value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub" value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n";
   
     $result.='<br />&nbsp;<input type="button" '.      $result.='<br />&nbsp;<input type="button" '.
  'onClick="javascript:checkPickOne(this.form);"value="Submit" /><br />'."\n";   'onClick="javascript:checkPickOne(this.form);"value="Submit" /><br />'."\n";
   
     $request->print($result);      $request->print($result);
   
     my $studentTable.='&nbsp;<b>Select a Student you wish to grade</b><br>'.      my $studentTable.='&nbsp;<b>Select a student you wish to grade</b><br>'.
  '<table border="0"><tr><td bgcolor="#777777">'.   '<table border="0"><tr><td bgcolor="#777777">'.
  '<table border="0"><tr bgcolor="#e6ffff">'.   '<table border="0"><tr bgcolor="#e6ffff">'.
  '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td>'.   '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td>'.
Line 2414  LISTJAVASCRIPT Line 2408  LISTJAVASCRIPT
  '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td>'.   '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td>'.
  '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td></tr>';   '<td><b>&nbsp;Fullname <font color="#999999">(username)</font></b></td></tr>';
     
     my (undef,undef,$fullname) = &getclasslist($getsec,'0');      my (undef,undef,$fullname) = &getclasslist($getsec,'1');
     my $ptr = 1;      my $ptr = 1;
     foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
  my ($uname,$udom) = split(/:/,$student);   my ($uname,$udom) = split(/:/,$student);
Line 2505  sub displayPage { Line 2499  sub displayPage {
     my $cnum      = $ENV{"course.$ENV{'request.course.id'}.num"};      my $cnum      = $ENV{"course.$ENV{'request.course.id'}.num"};
     my $getsec    = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};      my $getsec    = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
     my $pageTitle = $ENV{'form.page'};      my $pageTitle = $ENV{'form.page'};
     my (undef,undef,$fullname) = &getclasslist($getsec,'0');      my (undef,undef,$fullname) = &getclasslist($getsec,'1');
     my ($uname,$udom) = split(/:/,$ENV{'form.student'});      my ($uname,$udom) = split(/:/,$ENV{'form.student'});
   
     my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';      my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';
Line 2531  sub displayPage { Line 2525  sub displayPage {
  '<input type="hidden" name="title"   value="'.$ENV{'form.title'}.'" />'."\n".   '<input type="hidden" name="title"   value="'.$ENV{'form.title'}.'" />'."\n".
  '<input type="hidden" name="url"     value="'.$url.'" />'."\n".   '<input type="hidden" name="url"     value="'.$url.'" />'."\n".
  '<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".
  '<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd" value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n";   '<input type="hidden" name="saveSec" value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub" value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n";
   
     my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL').      my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL').
  '/check.gif" height="16" border="0" />';   '/check.gif" height="16" border="0" />';
Line 2594  sub displayPage { Line 2590  sub displayPage {
  my @displaySub = ();   my @displaySub = ();
  foreach my $partid (@{$parts}) {   foreach my $partid (@{$parts}) {
     my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;      my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
       next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' && 
        $record{"$version:resource.$partid.solved"} eq '');
     $displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ?       $displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ? 
  '<b>Part:</b> '.$partid.'&nbsp;<b>Submission:</b>&nbsp;'   '<b>Part:</b> '.$partid.'&nbsp;<b>Submission:</b>&nbsp;'
  .$record{$version.':'.$matchKey[0]}.'<br />' : '';   .$record{$version.':'.$matchKey[0]}.'<br />' : '';
Line 2660  sub updateGradeByPage { Line 2658  sub updateGradeByPage {
     my $cnum      = $ENV{"course.$ENV{'request.course.id'}.num"};      my $cnum      = $ENV{"course.$ENV{'request.course.id'}.num"};
     my $getsec    = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};      my $getsec    = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
     my $pageTitle = $ENV{'form.page'};      my $pageTitle = $ENV{'form.page'};
     my (undef,undef,$fullname) = &getclasslist($getsec,'0');      my (undef,undef,$fullname) = &getclasslist($getsec,'1');
     my ($uname,$udom) = split(/:/,$ENV{'form.student'});      my ($uname,$udom) = split(/:/,$ENV{'form.student'});
   
     my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';      my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';
Line 2755  sub updateGradeByPage { Line 2753  sub updateGradeByPage {
     }      }
   
     $studentTable.='</td></tr></table></td></tr></table>';      $studentTable.='</td></tr></table></td></tr></table>';
     $studentTable.=($changeflag == 0 ? 'No score was changed or updated.' :  
     'The scores were changed for '.  
     $changeflag.' problem'.($changeflag == 1 ? '.' : 's.'));  
     $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});      $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});
     $request->print($studentTable);      my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
     'The scores were changed for '.
     $changeflag.' problem'.($changeflag == 1 ? '.' : 's.'));
       $request->print($grademsg.$studentTable);
   
     return '';      return '';
 }  }
Line 2880  sub show_grading_menu_form { Line 2878  sub show_grading_menu_form {
     my $result.='<form action="/adm/grades" method="post">'."\n".      my $result.='<form action="/adm/grades" method="post">'."\n".
  '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
  '<input type="hidden" name="url" value="'.$url.'" />'."\n".   '<input type="hidden" name="url" value="'.$url.'" />'."\n".
  '<input type="hidden" name="lastCmd" value="'.$ENV{'form.lastCmd'}.'" />'."\n".   '<input type="hidden" name="saveCmd" value="'.$ENV{'form.saveCmd'}.'" />'."\n".
  '<input type="hidden" name="lastSec" value="'.$ENV{'form.lastSec'}.'" />'."\n".   '<input type="hidden" name="saveSec" value="'.$ENV{'form.saveSec'}.'" />'."\n".
    '<input type="hidden" name="saveSub" value="'.$ENV{'form.saveSub'}.'" />'."\n".
    '<input type="hidden" name="saveStatus" value="'.$ENV{'form.saveStatus'}.'" />'."\n".
  '<input type="hidden" name="command" value="gradingmenu" />'."\n".   '<input type="hidden" name="command" value="gradingmenu" />'."\n".
  '<input type="submit" name="submit" value="Grading Menu" />'."\n".   '<input type="submit" name="submit" value="Grading Menu" />'."\n".
  '</form>'."\n";   '</form>'."\n";
     return $result;      return $result;
 }  }
   
   
 #--- Displays the main menu page -------  #--- Displays the main menu page -------
 sub gradingmenu {  sub gradingmenu {
     my ($request) = @_;      my ($request) = @_;
     my ($symb,$url)=&get_symb_and_url($request);      my ($symb,$url)=&get_symb_and_url($request);
     if (!$symb) {return '';}      if (!$symb) {return '';}
       my $probTitle = &Apache::lonnet::gettitle($symb);
       my $saveCmd = ($ENV{'form.saveCmd'} eq '' ? 'pickStudentPage' : $ENV{'form.saveCmd'});
       my $saveSec = ($ENV{'form.saveSec'} eq '' ? 'all' : $ENV{'form.saveSec'});
       my $saveSub = ($ENV{'form.saveSub'} eq '' ? 'yes' : $ENV{'form.saveSub'});
       my $saveStatus = ($ENV{'form.saveStatus'} eq '' ? 'Active' : $ENV{'form.saveStatus'});
   
     $request->print(<<GRADINGMENUJS);      $request->print(<<GRADINGMENUJS);
 <script type="text/javascript" language="javascript">  <script type="text/javascript" language="javascript">
     function checkChoice(formname) {      function checkChoice(formname) {
  var cmd = formname.command;   var cmd = formname.command;
  formname.lastCmd.value = radioSelection(formname.command);   formname.saveCmd.value = radioSelection(cmd);
  formname.lastSec.value = pullDownSelection(formname.section);   formname.saveSec.value = pullDownSelection(formname.section);
  if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[4].checked) {   formname.saveSub.value = radioSelection(formname.submitonly);
     formname.submit();   formname.saveStatus.value = pullDownSelection(formname.status);
  }   if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[4].checked) formname.submit();
   
  if (cmd[3].checked) {   if (cmd[3].checked) browseAndUpload();
     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[5].checked) {   if (cmd[5].checked) {
     if (!checkReceiptNo(formname,'notOK')) { return false;}      if (!checkReceiptNo(formname,'notOK')) { return false;}
Line 2930  sub gradingmenu { Line 2929  sub gradingmenu {
     formname.receipt.focus();      formname.receipt.focus();
     return false;      return false;
  }   }
  formname.command[4].checked = true;   formname.command[5].checked = true;
  return true;   return true;
     }      }
   
     function radioSelection(radioButton) {      function radioSelection(radioButton) {
  var selection=null;   var selection=null;
  for (var i=0; i<radioButton.length; i++) {   if (radioButton.length > 1) {
     if (radioButton[i].checked) {      for (var i=0; i<radioButton.length; i++) {
  return radioButton[i].value;   if (radioButton[i].checked) {
       return radioButton[i].value;
    }
     }      }
    } else {
       if (radioButton.checked) return radioButton.value;
  }   }
  return selection;   return selection;
     }      }
   
     function pullDownSelection(selectOne) {      function pullDownSelection(selectOne) {
  var selection="";   var selection="";
  for (var i=0; i<selectOne.length; i++) {   if (selectOne.length > 1) {
     if (selectOne[i].selected) {      for (var i=0; i<selectOne.length; i++) {
  return selectOne[i].value;   if (selectOne[i].selected) {
       return selectOne[i].value;
    }
     }      }
    } else {
       if (selectOne.selected) return selectOne.value;
  }   }
     }      }
   
       function browseAndUpload() {
    bNLoad = window.open('', 'BrowseAndUpload', 'toolbar=no,location=no,scrollbars=no,width=550,height=200,screenx=100,screeny=75');
    bNLoad.focus();
    var lDoc = bNLoad.document;
    lDoc.write("<html><head>");
    lDoc.write("<title>Browse And Upload</title>");
   
    lDoc.write("<script language=javascript>");
    lDoc.write("function checkUpload(formname) {");
   
    lDoc.write("  if (formname.upfile.value == \\"\\") {");
    lDoc.write("     alert(\\"Please use the browse button to select a file from your local directory.\\");");
    lDoc.write("     return false;");
    lDoc.write("   }");
    lDoc.write("   document.gradesupload.submit();");
    lDoc.write("   setTimeout('self.close()',750)"); 
    lDoc.write("}");
   
    lDoc.write("<");
    lDoc.write("/script>");
   
    lDoc.write("</head><body bgcolor=white>");
    lDoc.write("<form method=\\"post\\" enctype=\\"multipart/form-data\\" action=\\"/adm/grades\\" name=\\"gradesupload\\" target=\\"LONcatInfo\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"symb\\"       value=\\"$symb\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"url\\"        value=\\"$url\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"probTitle\\"  value=\\"$probTitle\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"saveCmd\\"    value=\\"csvupload\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"saveSec\\"    value=\\"$saveSec\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"saveSub\\"    value=\\"$saveSub\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"saveStatus\\" value=\\"$saveStatus\\">");
    lDoc.write("<input type=\\"hidden\\" name=\\"command\\"    value=\\"csvuploadmap\\">");
   
    lDoc.write("<font color=\\"green\\" size=+1><b>Specify a file containing the class scores for problem - $probTitle</b></font><br><br>");
   
    lDoc.write("<table border=0 width=100%><tr><td bgcolor=\\"#777777\\">");
    lDoc.write("<table border=0 width=100%><tr bgcolor=\\"#ddffff\\">");
    lDoc.write("<td>");
    lDoc.write("<input type=\\"file\\" name=\\"upfile\\" size=\\"50\\" />");
    lDoc.write("<br />Type: <select name=\\"upfiletype\\">");
           lDoc.write("<option value=\\"csv\\">CSV (comma separated values, spreadsheet)</option>");
           lDoc.write("<option value=\\"space\\">Space separated</option>");
           lDoc.write("<option value=\\"tab\\">Tabulator separated</option>");
           lDoc.write("<option value=\\"xml\\">HTML/XML</option>");
           lDoc.write("</select>");
           lDoc.write("</td></tr></table>");
           lDoc.write("</td></tr></table>&nbsp;");
           lDoc.write("<input type=\\"button\\" value=\\"Upload Scores\\" onClick=\\"javascript:checkUpload(this.form)\\">&nbsp;&nbsp;");
           lDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>");
           lDoc.write("</form>");
           lDoc.write("</body></html>");
     }
 </script>  </script>
 GRADINGMENUJS  GRADINGMENUJS
   
     my $probTitle = &Apache::lonnet::gettitle($ENV{'form.url'});  
     my $result='<h3>&nbsp;<font color="#339933">Manual Grading/View Submission</font></h3>'.      my $result='<h3>&nbsp;<font color="#339933">Manual Grading/View Submission</font></h3>'.
  '<table border="0">'.   '<table border="0">'.
  '<tr><td colspan=3><font size=+1><b>Problem: </b>'.$probTitle.'</font></td></tr>';   '<tr><td colspan=3><font size=+1><b>Problem: </b>'.$probTitle.'</font></td></tr>'."\n";
     my ($partlist,$handgrade) = &response_type($url);      my ($partlist,$handgrade) = &response_type($url);
     my ($resptype,$hdgrade)=('','no');      my ($resptype,$hdgrade)=('','no');
     for (sort keys(%$handgrade)) {      for (sort keys(%$handgrade)) {
Line 2969  GRADINGMENUJS Line 3027  GRADINGMENUJS
     '<td><b>Type: </b>'.$responsetype.'</td>'.      '<td><b>Type: </b>'.$responsetype.'</td>'.
     '<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>';      '<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>';
     }      }
     $result.='</table>';      $result.='</table>'."\n";
   
     my ($classlist,$sections) = &getclasslist('all','0');      my (undef,$sections) = &getclasslist('all','0');
     my $lastCmd = ($ENV{'form.lastCmd'} eq '' ? 'pickStudentPage' : $ENV{'form.lastCmd'});  
     my $lastSec = ($ENV{'form.lastSec'} eq '' ? 'all' : $ENV{'form.lastSec'});  
   
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".      $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
  '<input type="hidden" name="symb"        value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb"        value="'.$symb.'" />'."\n".
Line 2981  GRADINGMENUJS Line 3037  GRADINGMENUJS
  '<input type="hidden" name="response"    value="'.$resptype.'" />'."\n".   '<input type="hidden" name="response"    value="'.$resptype.'" />'."\n".
  '<input type="hidden" name="handgrade"   value="'.$hdgrade.'" />'."\n".   '<input type="hidden" name="handgrade"   value="'.$hdgrade.'" />'."\n".
  '<input type="hidden" name="probTitle"   value="'.$probTitle.'" />'."\n".   '<input type="hidden" name="probTitle"   value="'.$probTitle.'" />'."\n".
  '<input type="hidden" name="lastCmd"     value="" />'."\n".   '<input type="hidden" name="saveCmd"     value="" />'."\n".
  '<input type="hidden" name="lastSec"     value="" />'."\n".   '<input type="hidden" name="saveSec"     value="" />'."\n".
    '<input type="hidden" name="saveSub"     value="" />'."\n".
    '<input type="hidden" name="saveStatus"  value="" />'."\n".
  '<input type="hidden" name="showgrading" value="yes" />'."\n";   '<input type="hidden" name="showgrading" value="yes" />'."\n";
   
     $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n".      $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n".
Line 2993  GRADINGMENUJS Line 3051  GRADINGMENUJS
     $result.='<table width=100% border=0>'.      $result.='<table width=100% border=0>'.
  '<tr bgcolor="#ffffe6" valign="top"><td colspan="2">'.   '<tr bgcolor="#ffffe6" valign="top"><td colspan="2">'.
  '<input type="radio" name="command" value="pickStudentPage" '.   '<input type="radio" name="command" value="pickStudentPage" '.
  ($lastCmd eq 'pickStudentPage' ? 'checked' : '').'> '.   ($saveCmd eq 'pickStudentPage' ? 'checked' : '').'> '.
  'Handgrade/View Submission for a student by page/sequence</td></tr>'."\n".   'Handgrade/View Submission for a student by page/sequence</td></tr>'."\n".
   
  '<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.   '<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
  '<input type="radio" name="command" value="viewgrades" '.   '<input type="radio" name="command" value="viewgrades" '.
  ($lastCmd eq 'viewgrades' ? 'checked' : '').'> '.   ($saveCmd eq 'viewgrades' ? 'checked' : '').'> '.
  'Grade by section or class</td></tr>'."\n".   'Grade by section or class</td></tr>'."\n".
   
  '<tr bgcolor="#ffffe6"valign="top"><td><input type="radio" name="command" value="submission" '.   '<tr bgcolor="#ffffe6"valign="top"><td><input type="radio" name="command" value="submission" '.
  ($lastCmd eq 'submission' ? 'checked' : '').'> '.   ($saveCmd eq 'submission' ? 'checked' : '').'> '.
  ($hdgrade eq 'yes' ? 'View/Grade essay response of' : 'View').   ($hdgrade eq 'yes' ? 'View/Grade essay response of' : 'View').
  ' an individual student </td>'."\n".   ' an individual student </td>'."\n".
  '<td>-->&nbsp;For students who has: '.   '<td>-->&nbsp;For students who has: '.
  '<input type="radio" name="submitonly" value="yes" checked> submitted'.   '<input type="radio" name="submitonly" value="yes" '.
  '<input type="radio" name="submitonly" value="all"> everybody</td></tr>'."\n".   ($saveSub eq 'yes' ? 'checked' : '').' /> submitted'.
    '<input type="radio" name="submitonly" value="all" '.
    ($saveSub eq 'all' ? 'checked' : '').' /> everybody</td></tr>'."\n".
   
  '<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.   '<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
  '<input type="radio" name="command" value="csvupload" '.   '<input type="radio" name="command" value="csvupload" '.
  ($lastCmd eq 'csvupload' ? 'checked' : '').'> '.   ($saveCmd eq 'csvupload' ? 'checked' : '').'> '.
  'Upload scores from file</td></tr>'."\n";   'Upload scores from file</td></tr>'."\n";
   
     $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.      $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
Line 3020  GRADINGMENUJS Line 3080  GRADINGMENUJS
   
     if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) {      if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) {
  $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.   $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
     '<input type="radio" name="command" value="verify" onSelect="javascript:this.form.receipt.focus()" '.      '<input type="radio" name="command" value="verify" onChecked="javascript:this.form.receipt.focus()" '.
     ($lastCmd eq 'verify' ? 'checked' : '').'> '.      ($saveCmd eq 'verify' ? 'checked' : '').'> '.
     'Verify a submission receipt issued by this server</td>'.      'Verify a submission receipt issued by this server</td>'.
     '<td>-->&nbsp;Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}).      '<td>-->&nbsp;Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}).
     '-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'.      '-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')">'.
Line 3029  GRADINGMENUJS Line 3089  GRADINGMENUJS
     }       } 
   
     $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2"><br />'."\n".      $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2"><br />'."\n".
  '&nbsp;Select section:</b> <select name="section">'."\n";   '&nbsp;Select section: <select name="section">'."\n";
     if (ref($sections)) {      if (ref($sections)) {
  foreach (sort (@$sections)) {$result.='<option value="'.$_.'" '.   foreach (sort (@$sections)) {$result.='<option value="'.$_.'" '.
  ($lastSec eq $_ ? 'selected="on"' : '').'>'.$_.'</option>'."\n";}   ($saveSec eq $_ ? 'selected="on"' : '').'>'.$_.'</option>'."\n";}
     }      }
     $result.= '<option value="all" '.($lastSec eq 'all' ? 'selected="on"' : ''). '>all</select> &nbsp; '.      $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> &nbsp; ';
  '<font color="red">(Applies to the first three options only.)</font>'."\n";  
       $result.='Student Status:</b><select name="status">'.
    '<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'.
    '<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'.
    '<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'.
    '</select>';
   
       $result.=' &nbsp; <font color="red">(Applies to the first three options only.)</font>'."\n";
   
     if (ref($sections)) {      if (ref($sections)) {
  $result.='&nbsp;(Section "no" implies the students were not assigned a section.)<br />'    $result.='&nbsp;(Section "no" implies the students were not assigned a section.)<br />' 
     if (grep /no/,@$sections);      if (grep /no/,@$sections);

Removed from v.1.75  
changed lines
  Added in v.1.76


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>