--- loncom/homework/grades.pm 2002/07/03 21:05:33 1.35
+++ loncom/homework/grades.pm 2002/07/08 21:18:54 1.37
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.35 2002/07/03 21:05:33 ng Exp $
+# $Id: grades.pm,v 1.37 2002/07/08 21:18:54 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -136,9 +136,11 @@ sub listStudents {
Resource: $ENV{'form.url'}
View Problem: no
- yes
- Submissions: last
- all
+ yes
+ Submissions:
+ last sub only
+ last sub & parts info
+ all details
@@ -351,7 +353,7 @@ sub submission {
my ($request,$counter,$total) = @_;
if ($counter == 0) {
- $request->print(<print(<
function updateRadio(radioButton,formtextbox,formsel,wgt) {
var pts = formtextbox.value;
@@ -400,30 +402,236 @@ sub submission {
function keywords(keyform) {
var keywds = keyform.value;
- var nret = prompt("Keywords list, separate by a space or comma. Add/delete to list if desired.",keywds);
+ var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds);
if (nret==null) return;
keyform.value = nret;
return;
}
- function addmsg(msgform) {
- var msg = msgform.value;
- var nret = prompt("Enter the message you wish to send to the student.",msg);
+//===================== Script to add keyword(s) ==================
+ function getSel() {
+ if (document.getSelection) txt = document.getSelection();
+ else if (document.selection) txt = document.selection.createRange().text;
+ else return;
+ var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," ");
+ if (cleantxt=="") {
+ alert("Select a word or group of words from document and then click this link.");
+ return;
+ }
+ var nret = prompt("Add selection to keyword list?",cleantxt);
if (nret==null) return;
- msgform.value = nret;
+ var curlist = document.SCORE.keywords.value;
+ document.SCORE.keywords.value = curlist+" "+nret;
return;
}
- function savedmsg(msgform) {
- var Nmsg = msgform.value;
- var nret = prompt("Number of saved messages = ",Nmsg);
- if (nret==null) return;
- msgform.value = nret;
+//====================== Script for composing message ==============
+ function msgCenter(msgform,usrctr,fullname) {
+ var Nmsg = msgform.savemsgN.value;
+ savedMsgHeader(Nmsg,usrctr,fullname);
+ var subject = msgform.msgsub.value;
+ var rtrchk = eval("document.SCORE.includemsg"+usrctr);
+ var msgchk = rtrchk.value;
+// alert("checked=>"+msgchk);
+ re = /msgsub/;
+ var shwsel = "";
+ if (re.test(msgchk)) { shwsel = "checked" }
+ displaySubject(subject,shwsel);
+ for (var i=1; i<=Nmsg; i++) {
+ var testpt = "savemsg"+i+",";
+ re = /testpt/;
+ shwsel = "";
+ if (re.test(msgchk)) { shwsel = "checked" }
+ var message = eval("document.SCORE.savemsg"+i+".value");
+ displaySavedMsg(i,message,shwsel);
+ }
+ newmsg = eval("document.SCORE.newmsg"+usrctr+".value");
+ shwsel = "";
+ re = /newmsg/;
+ if (re.test(msgchk)) { shwsel = "checked" }
+ newMsg(newmsg,shwsel);
+ msgTail();
+ return;
+ }
+
+function savedMsgHeader(Nmsg,usrctr,fullname) {
+ var height = 30*Nmsg+250;
+ var scrollbar = "no";
+ if (height > 600) {
+ height = 600;
+ scrollbar = "yes";
+ }
+/* if (window.pWin)
+ window.pWin.close(); */
+ pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',width=600,height='+height);
+ pWin.document.write("");
+ pWin.document.write("Message Central");
+
+ pWin.document.write("
-JAVASCRIPT
+SUBJAVASCRIPT
}
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
if ($ENV{'form.student'} eq '') { &moreinfo($request,'Need student login id'); return ''; }
@@ -433,14 +641,14 @@ JAVASCRIPT
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
-#
-# header info
+
+ # header info
if ($counter == 0) {
- $request->print('
Submission Record
');
+ $request->print('
Submission Record
'.
+ ' Resource: '.$url.'');
}
-#
-# option to display problem, only once else it cause problems with the form later since the problem has a form.
+ # option to display problem, only once else it cause problems with the form later since the problem has a form.
if ($ENV{'form.vProb'} eq 'yes' && $counter == 0) {
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
$ENV{'request.course.id'});
@@ -454,59 +662,75 @@ JAVASCRIPT
$result.=' ';
$request->print($result);
}
-#
-# beginning of form
+
+ # beginning of form
if ($counter == 0) {
- my %keyhash = &Apache::lonnet::get
- ('nohist_handgrade',[$symb.'_keywords'],
+ my %keyhash = &Apache::lonnet::dump('nohist_handgrade',
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'};
+ # if the handgrade db has never being initialized then set some default values
+ if ($keyhash{$symb.'_handgrade'} eq '') {
+ $keyhash{$symb.'_keywords'} = '';
+ $keyhash{$symb.'_subject'} = &Apache::lonnet::metadata($url,'title');
+ $keyhash{$loginuser.'_kwclr'} = $keyhash{$loginuser.'_kwclr'} eq '' ? 'red' : $keyhash{$loginuser.'_kwclr'};
+ $keyhash{$loginuser.'_kwsize'} = $keyhash{$loginuser.'_kwsize'} eq '' ? '0' : $keyhash{$loginuser.'_kwsize'};
+ $keyhash{$loginuser.'_kwstyle'} = $keyhash{$loginuser.'_kwstyle'} eq '' ? '' : $keyhash{$loginuser.'_kwstyle'};
+ $keyhash{$symb.'_savemsgN'} = '0';
+ }
$request->print('