--- rat/lonpage.pm 2013/06/09 02:59:25 1.101
+++ rat/lonpage.pm 2014/09/14 15:21:47 1.105
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.101 2013/06/09 02:59:25 raeburn Exp $
+# $Id: lonpage.pm,v 1.105 2014/09/14 15:21:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@ use strict;
use Apache::Constants qw(:common :http);
use Apache::lonnet;
use Apache::loncommon();
+use Apache::lonhtmlcommon;
use Apache::lonxml();
use Apache::lonlocal;
use Apache::lonmenu;
@@ -372,6 +373,10 @@ ENDEXT
s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
$output=~
s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
+ $output=~
+ s/(\Q
\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;
@@ -456,7 +461,7 @@ ENDEXT
}
$fmtag .= ' action="'.
&Apache::lonenc::check_encrypt($requrl)
- .'">';
+ .'" id="LC_page">';
$r->print($fmtag);
}
} elsif (($target eq 'tex') || ($target eq 'tex_answer')) {
@@ -489,7 +494,6 @@ ENDEXT
my $avespan=$lcm/($#colcont+1);
for ($j=0;$j<=$#colcont;$j++) {
my $rid=$colcont[$j];
-
my $metainfo =&get_buttons(\%hash,$rid).' ';
unless (($target eq 'tex') || ($target eq 'tex_answer')) {
$r->print(' print('>'.$metainfo.' ');
} elsif (&Apache::lonnet::declutter($hash{'src_'.$rid}) !~/\.(sequence|page)$/) {
- $r->print($metainfo.''.$hash{'title_'.$rid}.' '.
- &mt('It is recommended that you use an up-to-date virus scanner before handling this file.').'
'.
- &Apache::londocs::entryline(0,&mt("Click to download or use your browser's Save Link function"),'/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).'
');
+ $r->print($metainfo.''.$hash{'title_'.$rid}.' ');
+ unless ($cellemb{$rid} eq 'wrp') {
+ $r->print(&mt('It is recommended that you use an up-to-date virus scanner before handling this file.'));
+ }
+ $r->print('
'.
+ &Apache::londocs::entryline(0,
+ &mt("Click to download or use your browser's Save Link function"),
+ '/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).
+ '
');
}
unless (($target eq 'tex') || ($target eq 'tex_answer')) {
$r->print(' ');
@@ -564,7 +574,7 @@ ENDEXT
# ---------------------------------------------------------------- Submit, etc.
if ($nforms) {
$r->print(
- '
');
}
unless (($target eq 'tex') || ($target eq 'tex_answer')) {
@@ -667,6 +677,26 @@ 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;
}