--- loncom/interface/lonhtmlcommon.pm 2011/01/16 22:45:05 1.287 +++ loncom/interface/lonhtmlcommon.pm 2011/10/23 00:27:10 1.294 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.287 2011/01/16 22:45:05 www Exp $ +# $Id: lonhtmlcommon.pm,v 1.294 2011/10/23 00:27:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -72,7 +72,7 @@ sub java_not_enabled { sub coursepreflink { my ($text,$category)=@_; if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { - return '&"').'">'.$text.''; + return '&"').'">'.$text.''; } else { return ''; } @@ -95,7 +95,7 @@ sub direct_parm_link { $filter=&entity_encode($filter); $part=&entity_encode($part); if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) { - return "$linktext"; + return "$linktext"; } else { return $linktext; } @@ -1244,9 +1244,9 @@ sub htmlareaheaders { ENDEDITOR } $s.=(< - - + + + ENDJQUERY return $s; } @@ -1429,6 +1429,11 @@ sub htmlareabrowser { # sub show_return_link { + + unless ($env{'request.course.id'}) { return 0; } + if ($env{'request.noversionuri'}=~m{^/priv/} || + $env{'request.uri'}=~m{^/~}) { return 1; } + if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)}) || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { @@ -1657,7 +1662,7 @@ returns: nothing @html = grep {defined $_ && $_ ne ''} @html; for (@html) { s/align="(right|left)"//; - s/// if $category ne 'advtools'; +# s/// if $category ne 'advtools'; } push @{$tools{$category}}, @html; @@ -2331,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