[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 22 Jun 2007 23:45:21 -0000
This is a MIME encoded message
--albertel1182555921
Content-Type: text/plain
albertel Fri Jun 22 19:45:21 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
- TA's don't get unenced urls, but can do grading, need to support enc symbs in grading interface
--albertel1182555921
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070622194521.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.417 loncom/homework/grades.pm:1.418
--- loncom/homework/grades.pm:1.417 Fri Jun 22 18:50:30 2007
+++ loncom/homework/grades.pm Fri Jun 22 19:45:19 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.417 2007/06/22 22:50:30 albertel Exp $
+# $Id: grades.pm,v 1.418 2007/06/22 23:45:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -93,6 +93,7 @@
return ();
}
}
+ &Apache::lonenc::check_decrypt(\$symb);
return ($symb);
}
@@ -492,7 +493,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".
@@ -742,7 +743,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'})) {
@@ -1751,7 +1752,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".
@@ -2168,18 +2169,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'); }
@@ -2192,12 +2185,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).': '.
@@ -2214,26 +2207,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);
}
}
}
@@ -2587,28 +2570,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;
@@ -2969,7 +2955,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".
@@ -3471,6 +3457,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>
@@ -3565,6 +3552,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" />
@@ -3873,7 +3861,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>'.
@@ -3997,7 +3985,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";
@@ -4369,7 +4357,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";
}
@@ -5938,7 +5926,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".
@@ -6013,7 +6001,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".
@@ -6224,7 +6212,7 @@
my $pincorrect=&mt("Percentage points for incorrect solution");
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
('iclicker' => 'i>clicker'));
-
+ $symb = &Apache::lonenc::check_encrypt($symb);
$result.=<<ENDUPFORM;
<script type="text/javascript">
function sanitycheck() {
@@ -6349,6 +6337,7 @@
# Were able to get all the info needed, now analyze the file
$result.=&Apache::loncommon::studentbrowser_javascript();
+ $symb = &Apache::lonenc::check_encrypt($symb);
my $heading=&mt('Scanning clicker file');
$result.=(<<ENDHEADER);
<br /><table width="100%" border="0"><tr><td bgcolor="#777777">
--albertel1182555921--