--- loncom/interface/lonhtmlcommon.pm 2011/06/03 13:00:39 1.290 +++ loncom/interface/lonhtmlcommon.pm 2011/07/28 03:14:04 1.291 @@ -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.291 2011/07/28 03:14:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2336,6 +2336,247 @@ 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); + 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"; + return <<"ENDSCRIPT"; + + +ENDSCRIPT +} + +############################################## ############################################## # javascript_valid_email