--- loncom/homework/externalresponse.pm 2013/09/11 10:25:50 1.24
+++ loncom/homework/externalresponse.pm 2014/12/06 20:08:16 1.29
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# external style responses
#
-# $Id: externalresponse.pm,v 1.24 2013/09/11 10:25:50 kruse Exp $
+# $Id: externalresponse.pm,v 1.29 2014/12/06 20:08:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,6 +38,7 @@ use Apache::lonxml();
use Apache::lonhtmlcommon;
use Apache::loncommon;
use Apache::lonnavmaps;
+use Apache::essayresponse;
use LONCAPA qw(:DEFAULT :match);
BEGIN {
@@ -74,113 +75,75 @@ sub start_externalresponse {
}
} elsif ($target eq 'meta') {
$result=&Apache::response::meta_package_write('externalresponse');
- }
- elsif ($target eq 'web' &&
- $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+ } elsif ($target eq 'web') {
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 $maxfilesize=&Apache::lonnet::EXT("resource.$part".'_'."$id.maxfilesize");
- if (!defined($maxfilesize)) {
- $maxfilesize = 10.0; #FIXME This should become a domain configuration
+ my $coll;
+ if ($Apache::lonhomework::history{"resource.$part.$id.collaborators"} =~ /\S/) {
+ $coll = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"');
}
- if($uploadedfiletypes){
+ if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+ my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators");
+ my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes");
+ $uploadedfiletypes=~s/[^\w\,]//g;
+ my $maxfilesize=&Apache::lonnet::EXT("resource.$part".'_'."$id.maxfilesize");
+ if (!defined($maxfilesize)) {
+ $maxfilesize = 10.0; #FIXME This should become a domain configuration
+ }
my $hiddendraft;
+ if ($uploadedfiletypes) {
if (($Apache::lonhomework::type eq 'survey') ||
($Apache::lonhomework::type eq 'surveycred') ||
($Apache::lonhomework::type eq 'anonsurvey') ||
($Apache::lonhomework::type eq 'anonsurveycred')) {
$hiddendraft = '';
} else {
- my $status_text = &mt('Submission type');
- if ($Apache::lonhomework::history{"resource.$part.award"} eq 'DRAFT') {
- $status_text .= '
'.&mt('(Currently -- draft)');
- }
- $result = &Apache::lonhtmlcommon::row_title($status_text);
- my $closure;
- unless ($ncol || $uploadedfiletypes) {
- $closure = 1;
- }
- $result.=
- '
'.
- ''.
- &Apache::lonhtmlcommon::row_closure($closure);
+ $result = &Apache::essayresponse::draft_row($part,$id,$ncol,$uploadedfiletypes);
}
-
if ($ncol > 0) {
- $result.= &Apache::lonhtmlcommon::row_title(&mt('Collaborators')).
- '
';
- $result .= &Apache::essayresponse::check_collaborators($ncol,$coll) if ($coll =~ /\w+/);
- $result .= &Apache::lonhtmlcommon::row_closure();
+ $result .= &Apache::essayresponse::get_collab_row($part,$id,$coll,$ncol);
}
my $filesfrom = 'both';
my $stuname = &Apache::lonnet::EXT('user.name');
my $studom = &Apache::lonnet::EXT('user.domain');
if (!&Apache::lonnet::usertools_access($stuname,$studom,'portfolio')) {
- $filesfrom = 'uploadonly';
+ $filesfrom = 'uploadonly';
}
$result.=&Apache::inputtags::file_selector($part,$id,$uploadedfiletypes,
- $filesfrom,undef,$maxfilesize);
- if ($result) {
- $result =
- '
'.&mt('Your answer:').' |
---|
'. - $Apache::lonhomework::history{"resource.$part.$id.submission"}. + &HTML::Entities::encode( + $Apache::lonhomework::history{"resource.$part.$id.submission"},'"<>&'). ' |