--- loncom/interface/lonhtmlcommon.pm 2011/06/03 13:00:39 1.290 +++ loncom/interface/lonhtmlcommon.pm 2011/08/15 12:55:45 1.292 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.290 2011/06/03 13:00:39 www Exp $ +# $Id: lonhtmlcommon.pm,v 1.292 2011/08/15 12:55:45 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2336,6 +2336,251 @@ sub set_form_elements { } ############################################## +############################################## + +sub file_submissionchk_js { + my ($turninpaths,$multiples) = @_; + my $overwritewarn = &mt('File(s) you uploaded for your submission will overwrite existing file(s) submitted for this item').'\\n'. + &mt('Continue submission and overwrite the file(s)?'); + my $delfilewarn = &mt('You have indicated you wish to remove some files previously included in your submission.').'\\n'. + &mt('Continue submission with these files removed?'); + my ($turninpathtext,$multtext,$arrayindexofjs); + if (ref($turninpaths) eq 'HASH') { + foreach my $key (sort(keys(%{$turninpaths}))) { + $turninpathtext .= " if (prefix == '$key') {\n". + " return '$turninpaths->{$key}';\n". + " }\n"; + } + } + $turninpathtext .= " return '';\n"; + if (ref($multiples) eq 'HASH') { + foreach my $key (sort(keys(%{$multiples}))) { + $multtext .= " if (prefix == '$key') {\n". + " return '$multiples->{$key}';\n". + " }\n"; + } + } + $multtext .= " return '';\n"; + + $arrayindexofjs = &Apache::loncommon::javascript_array_indexof() + return <<"ENDSCRIPT"; + + +$arrayindexofjs + +ENDSCRIPT +} + +############################################## ############################################## # javascript_valid_email