\E)/
$1$idprefix$2$3$4/g;
+ $output=~
+ s/(\Q
)/$1$idprefix$2$3$4/g;
+ if ($nuploads) {
+ $output=~
+ s/\<(input[^\>]+name=\"\Q$prefix\EHWFILE[^\>]+)\s*id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\)]*)\>/\<$1 id="$prefix$2" $3\>/gsi;
+ ($turninpaths{$prefix},$multiresps{$prefix}) =
+ &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
+ if ($turninparent eq '') {
+ $turninparent = $turninpaths{$prefix};
+ $turninparent =~ s{(/[^/]+)$}{};
+ }
+ }
+ $output=~
+ s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
}
$thisdir=~s/\/[^\/]*$//;
foreach (@rlinks) {
- unless (($_=~/^http:\/\//i) ||
+ unless (($_=~/^https?\:\/\//i) ||
($_=~/^\//) ||
($_=~/^javascript:/i) ||
($_=~/^mailto:/i) ||
@@ -470,7 +422,7 @@ sub handler {
# ------------------------------------------------------------------ Build page
# ---------------------------------------------------------------- Send headers
- unless ($target eq 'tex') {
+ unless (($target eq 'tex') || ($target eq 'tex_answer')) {
if ($isxml) {
&Apache::loncommon::content_type($r,'text/xml');
} else {
@@ -484,28 +436,50 @@ sub handler {
$allscript.
"\n\n";
}
+ if (($nforms) && ($nuploads)) {
+ $allscript .= &Apache::lonhtmlcommon::file_submissionchk_js(\%turninpaths,\%multiresps);
+ }
+ if (($nforms) && (&Apache::lonhtmlcommon::htmlareabrowser())) {
+ my %textarea_args = (
+ dragmath => 'math',
+ );
+ $allscript .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
+ }
# ------------------------------------------------------------------ Start body
$r->print(&Apache::loncommon::start_page(undef,$allscript,
{'force_register' => 1,
'bgcolor' => '#ffffff',}));
# ------------------------------------------------------------------ Start form
if ($nforms) {
- $r->print('');
}
- unless ($target eq 'tex') {
+ unless (($target eq 'tex') || ($target eq 'tex_answer')) {
$r->print(&Apache::loncommon::end_page({'discussion'
=> 1,}));
} else {
@@ -632,10 +614,6 @@ sub handler {
sub get_buttons {
my ($hash,$rid) = @_;
- # which icons do we use?
- my $extension='png';
- if ($env{'environment.icons'} eq 'classic') { $extension='gif'; }
-
my $metainfo = '';
my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});
my ($mapid,$resid)=split(/\./,$rid);
@@ -647,20 +625,28 @@ sub get_buttons {
$esrc=&Apache::lonenc::encrypted($esrc);
}
if ($hash->{'src_'.$rid} !~ m-^/uploaded/-
+ && $hash->{'src_'.$rid} !~ m{^https?://}
&& !$env{'request.enc'}
&& ($env{'request.role.adv'}
|| !$hash->{'encrypted_'.$rid})) {
$metainfo .=''.
''.
- ''.
+ ''.
'';
}
- $metainfo .= ''.
- ''.
- '';
- if (($hash->{'src_'.$rid}=~/\.(problem|exam|quiz|assess|survey|form)$/) &&
+ if (($hash->{'src_'.$rid} !~ m{^/uploaded/}) &&
+ ($hash->{'src_'.$rid} !~ m{^https?://})) {
+ $metainfo .= ''.
+ ''.
+ '';
+ }
+ if (($hash->{'src_'.$rid}=~/$LONCAPA::assess_re/) &&
($hash->{'src_'.$rid} !~ m-^/uploaded/-)) {
if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
@@ -668,12 +654,16 @@ sub get_buttons {
''.
'&command=submission">'.
- ''.
+ ''.
''.
''.
'&command=gradingmenu">'.
- ''.
+ ''.
'';
}
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
@@ -681,10 +671,32 @@ sub get_buttons {
''.
'" >'.
- ''.
+ ''.
'';
}
}
+ if (($env{'request.course.id'}) && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $file=&Apache::lonnet::declutter($hash->{'src_'.$rid});
+ my ($cfile,$home,$switchserver,$forceedit,$forceview) =
+ &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb);
+ if ($cfile ne '') {
+ my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
+ $forceedit,1,$symb,undef,
+ &escape($env{'form.title'}));
+ if ($jscall) {
+ my $icon = 'pcstr.png';
+ my $label = &mt('Edit');
+ my $title = &mt('Edit this resource');
+ my $pic = '';
+ $metainfo .= ' '.$pic.'';
+ }
+ }
+ }
return $metainfo;
}
@@ -692,6 +704,104 @@ sub get_buttons {
__END__
+=head1 NAME
+
+Apache::lonpage - Page Handler
+
+=head1 SYNOPSIS
+
+Invoked by /etc/httpd/conf/srm.conf:
+
+
+ SetHandler perl-script
+ PerlHandler Apache::lonpage
+
+
+=head1 INTRODUCTION
+
+This module renders a .page resource.
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+=head1 HANDLER SUBROUTINE
+
+This routine is called by Apache and mod_perl.
+
+=over 4
+
+=item *
+
+set document type for header only
+
+=item *
+
+tie db file
+
+=item *
+
+render page
+
+=item *
+
+add to symb list
+
+=item *
+
+page parms
+
+=item *
+
+Get SSI output, post parameters
+
+=item *
+
+SSI cell rendering
+
+=item *
+
+Deal with Applet codebases
+
+=item *
+
+Build page
+
+=item *
+
+send headers
+
+=item *
+
+start body
+
+=item *
+start form
+
+=item *
+
+start table
+
+=item *
+
+submit element, etc, render page, untie hash
+
+=back
+
+=head1 OTHER SUBROUTINES
+
+=over 4
+
+=item *
+
+euclid() : Euclid's method for determining the greatest common denominator.
+
+=item *
+
+tracetable() : Build page table.
+
+=back
+
+=cut
|