--- loncom/homework/essayresponse.pm 2005/02/10 22:43:15 1.59
+++ loncom/homework/essayresponse.pm 2010/12/31 02:40:14 1.113
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.59 2005/02/10 22:43:15 banghart Exp $
+# $Id: essayresponse.pm,v 1.113 2010/12/31 02:40:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,8 +29,13 @@
package Apache::essayresponse;
use strict;
use Apache::lonxml();
-use Apache::lonnet();
+use Apache::lonhtmlcommon;
+use Apache::loncommon;
+use Apache::lonnet;
+use Apache::lonnavmaps;
use Apache::lonlocal;
+use LONCAPA qw(:DEFAULT :match);
+
BEGIN {
&Apache::lonxml::register('Apache::essayresponse',('essayresponse'));
@@ -42,55 +47,91 @@ sub start_essayresponse {
my $id = &Apache::response::start_response($parstack,$safeeval);
if ($target eq 'meta') {
$result=&Apache::response::meta_package_write('essayresponse');
- } elsif ($target eq 'web') {
+ } elsif ($target eq 'web' &&
+ $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
my $part= $Apache::inputtags::part;
my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators");
my $coll= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"');
my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes");
$uploadedfiletypes=~s/[^\w\,]//g;
- my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');
- $result='
'.
- ' '.
- &mt('Submit entries below as answer to receive credit').' '. - ' '. - &mt('Save entries below as a draft answer (not submitting them for credit yet)'). - ' |
'.
- 'Collaborators: '. - &mt('(Enter maximum [_1] collaborators using username or username@domain, e.g. smithje or smithje@[_2].)',$ncol,$ENV{'user.domain'}).' '; + $result.= &Apache::lonhtmlcommon::row_title(&mt('Collaborators')). + ' '; $result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/); - $result .=' |
'.&mt('Submit a file: (only one file can be uploaded)').
- ' '. - &mt('Allowed filetypes: [_1]',$uploadedfiletypes).' '. - 'OR: Select Portfolio Files'. - ' '. - ''. - ' '; - if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){ - $result.="Portfolio files previously selected: ".&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"})." "; - } - - if ($uploadedfile) { - my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}; - push (@Apache::lonxml::extlinks,$url); - &Apache::lonnet::allowuploaded('/adm/essayresponse',$url); - my $curfile=' '. - $uploadedfile.''; - $result.=&mt('Currently submitted: [_1]',$curfile); - } else { - $result.=&mt('(Hand in a file you have prepared on your computer)'); - } - $result.=' |
'.&mt('Submitted text'). + '
'.$answer.''; + } + + return '
The following user'. - (scalar(@badcollaborators) > 1 ? 's are' : ' is').' invalid: '. - join(', ',@badcollaborators).'. Please correct. |
'; + if ($numbad == 1) { + $result .= &mt('The following user is invalid:'); + } else { + $result .= &mt('The following [_1] users are invalid:',$numbad); + } + $result .= ' '.join(', ',@badcollaborators).'. '.&mt('Please correct.'). + ' |
'. - 'You have too many collaborators. Please remove '.$toomany.' collaborator'. - ($toomany > 1 ? 's' :'').'. |