[LON-CAPA-cvs] cvs: loncom(version_2_4_X) /homework grades.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 25 Jun 2007 22:23:29 -0000
This is a MIME encoded message
--albertel1182810209
Content-Type: text/plain
albertel Mon Jun 25 18:23:29 2007 EDT
Modified files: (Branch: version_2_4_X)
/loncom/homework grades.pm
Log:
- backport applicable sections of 418
--albertel1182810209
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070625182329.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.399.2.1 loncom/homework/grades.pm:1.399.2.2
--- loncom/homework/grades.pm:1.399.2.1 Wed Jun 13 13:20:12 2007
+++ loncom/homework/grades.pm Mon Jun 25 18:23:27 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.399.2.1 2007/06/13 17:20:12 albertel Exp $
+# $Id: grades.pm,v 1.399.2.2 2007/06/25 22:23:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,6 +94,7 @@
return ();
}
}
+ &Apache::lonenc::check_decrypt(\$symb);
return ($symb);
}
@@ -493,7 +494,7 @@
' }'."\n".
'</script>'."\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="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n".
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n".
@@ -743,7 +744,7 @@
'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" /><br />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n";
if (exists($env{'form.gradingMenu'}) && exists($env{'form.Status'})) {
@@ -1752,7 +1753,7 @@
'<input type="hidden" name="refresh" value="off" />'."\n".
'<input type="hidden" name="studentNo" value="" />'."\n".
'<input type="hidden" name="gradeOpt" value="" />'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" />'."\n".
'<input type="hidden" name="vProb" value="'.$env{'form.vProb'}.'" />'."\n".
'<input type="hidden" name="vAns" value="'.$env{'form.vAns'}.'" />'."\n".
@@ -2169,18 +2170,10 @@
}
my $includemsg = $env{'form.includemsg'.$ctr};
my ($subject,$message,$msgstatus) = ('','','');
- my $restitle = &Apache::lonnet::gettitle($symb);
- my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl',
- $symb,$udom,$uname);
- my ($feedurl,$baseurl,$showsymb,$messagetail);
- $feedurl = &Apache::lonnet::clutter($url);
- if ($encrypturl =~ /^yes$/i) {
- $baseurl = &Apache::lonenc::encrypted($feedurl,1);
- $showsymb = &Apache::lonenc::encrypted($symb,1);
- } else {
- $baseurl = $feedurl;
- $showsymb = $symb;
- }
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my ($feedurl,$showsymb) =
+ &get_feedurl_and_symb($symb,$uname,$udom);
+ my $messagetail;
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/);
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); }
@@ -2193,12 +2186,12 @@
if ($env{'form.withgrades'.$ctr}) {
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
$messagetail = " for <a href=\"".
- $baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>";
+ $feedurl."?symb=$showsymb\">$env{'form.probTitle'}</a>";
}
$msgstatus =
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject,
$message.$messagetail,
- undef,$baseurl,undef,
+ undef,$feedurl,undef,
undef,undef,$showsymb,
$restitle);
$request->print('<br />'.&mt('Sending message to [_1]:[_2]',$uname,$udom).': '.
@@ -2215,26 +2208,16 @@
if ($errorflag eq 'not_allowed') {
$request->print("<span class=\"LC_error\">".&mt('Not allowed to modify grades for [_1]',"$collaborator:$udom")."</span>");
next;
- } else {
- if ($message ne '') {
- $encrypturl=
- &Apache::lonnet::EXT('resource.0.encrypturl',
- $symb,$udom,$collaborator);
- if ($encrypturl =~ /^yes$/i) {
- $baseurl = &Apache::lonenc::encrypted($feedurl,1);
- $showsymb = &Apache::lonenc::encrypted($symb,1);
- } else {
- $baseurl = $feedurl;
- $showsymb = $symb;
- }
- if ($env{'form.withgrades'.$ctr}) {
- $messagetail = " for <a href=\"".
+ } elsif ($message ne '') {
+ my ($baseurl,$showsymb) =
+ &get_feedurl_and_symb($symb,$collaborator,
+ $udom);
+ if ($env{'form.withgrades'.$ctr}) {
+ $messagetail = " for <a href=\"".
$baseurl."?symb=$showsymb\">$env{'form.probTitle'}</a>";
-
- }
- $msgstatus =
- &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle);
}
+ $msgstatus =
+ &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle);
}
}
}
@@ -2588,28 +2571,31 @@
$message .= "<strong>".&Apache::lonnet::gettitle($symb)."</strong><br />";
$message .= ' The returned file(s) are named: '. $file_msg;
$message .= " and can be found in your portfolio space.";
- my $url = (&Apache::lonnet::decode_symb($symb))[2];
- my $feedurl = &Apache::lonnet::clutter($url);
- my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl',
- $symb,$domain,$stuname);
- my ($baseurl,$showsymb);
- if ($encrypturl =~ /^yes$/i) {
- $baseurl = &Apache::lonenc::encrypted($feedurl,1);
- $showsymb = &Apache::lonenc::encrypted($symb,1);
- } else {
- $baseurl = $feedurl;
- $showsymb = $symb;
- }
+ my ($feedurl,$showsymb) =
+ &get_feedurl_and_symb($symb,$domain,$stuname);
my $restitle = &Apache::lonnet::gettitle($symb);
my $msgstatus =
&Apache::lonmsg::user_normal_msg($stuname,$domain,$subject.
' (File Returned) ['.$restitle.']',$message,undef,
- $baseurl,undef,undef,undef,$showsymb,$restitle);
+ $feedurl,undef,undef,undef,$showsymb,$restitle);
}
}
return;
}
+sub get_feedurl_and_symb {
+ my ($symb,$uname,$udom) = @_;
+ my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
+ $url = &Apache::lonnet::clutter($url);
+ my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl',
+ $symb,$udom,$uname);
+ if ($encrypturl =~ /^yes$/i) {
+ &Apache::lonenc::encrypted(\$url,1);
+ &Apache::lonenc::encrypted(\$symb,1);
+ }
+ return ($url,$symb);
+}
+
sub get_submitted_files {
my ($udom,$uname,$partid,$respid,$record) = @_;
my @files;
@@ -2970,7 +2956,7 @@
#beginning of class grading form
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="command" value="editgrades" />'."\n".
'<input type="hidden" name="section" value="'.$env{'form.section'}.'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
@@ -3472,6 +3458,7 @@
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
my $ignore=&mt('Ignore First Line');
+ $symb = &Apache::lonenc::check_encrypt($symb);
$request->print(<<ENDPICK);
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
<h3><span class="LC_info">Uploading Class Grades</span></h3>
@@ -3566,6 +3553,7 @@
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
+ $symb = &Apache::lonenc::check_encrypt($symb);
$result.=<<ENDUPFORM;
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
<input type="hidden" name="symb" value="$symb" />
@@ -3874,7 +3862,7 @@
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n".
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n".
'<input type="hidden" name="command" value="displayPage" />'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n";
$result.=' <b>'.&mt('Use CODE:').' </b>'.
@@ -3998,7 +3986,7 @@
'<input type="hidden" name="student" value="'.$env{'form.student'}.'" />'."\n".
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n".
'<input type="hidden" name="title" value="'.$env{'form.title'}.'" />'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="overRideScore" value="no" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n";
@@ -4370,7 +4358,7 @@
sub defaultFormData {
my ($symb)=@_;
return '
- <input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ <input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n";
}
@@ -5939,7 +5927,7 @@
sub show_grading_menu_form {
my ($symb)=@_;
my $result.='<br /><form action="/adm/grades" method="post">'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
'<input type="hidden" name="command" value="gradingmenu" />'."\n".
'<input type="submit" name="submit" value="Grading Menu" />'."\n".
@@ -6014,7 +6002,7 @@
my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
$result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
- '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
+ '<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
'<input type="hidden" name="handgrade" value="'.$hdgrade.'" />'."\n".
'<input type="hidden" name="probTitle" value="'.$probTitle.'" />'."\n".
'<input type="hidden" name="command" value="" />'."\n".
--albertel1182810209--