Diff for /rat/lonpage.pm between versions 1.119 and 1.123

version 1.119, 2016/10/29 05:29:39 version 1.123, 2017/09/11 12:23:55
Line 185  sub handler { Line 185  sub handler {
       my $fn=$env{'request.course.fn'};        my $fn=$env{'request.course.fn'};
       if (-e "$fn.db") {        if (-e "$fn.db") {
           my %buttonshide;            my %buttonshide;
             my $hostname = $r->hostname();
           if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {            if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
 # ------------------------------------------------------------------- Hash tied  # ------------------------------------------------------------------- Hash tied
               my $firstres=$hash{'map_start_'.$requrl};                my $firstres=$hash{'map_start_'.$requrl};
Line 301  sub handler { Line 302  sub handler {
                       $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));                        $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
                       foreach (@colcont) {                        foreach (@colcont) {
                           my $src=$hash{'src_'.$_};                            my $src=$hash{'src_'.$_};
                             my $plainsrc = $src;
                           my ($extension)=($src=~/\.(\w+)$/);                            my ($extension)=($src=~/\.(\w+)$/);
   $cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');    $cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
   if ($hash{'encrypted_'.$_}) {    if ($hash{'encrypted_'.$_}) {
Line 441  ENDEXT Line 443  ENDEXT
       s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;        s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
                                   $output=~                                    $output=~
                                       s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;                                        s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
                                     $output=~
                                         s/(\Qthis.form.elements['HWVAL_\E)([^']+\'\]\.)(value=|checked)/$1$prefix$2$3/gsi; 
                                   if ($hastimer) {                                    if ($hastimer) {
                                       $output=~                                        $output=~
                                           s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;                                            s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;
Line 474  ENDEXT Line 478  ENDEXT
                                   $output=~                                    $output=~
                                       s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;                                        s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
                                   unless ($hastimer) {                                    unless ($hastimer) {
                                       if ($src =~ /$LONCAPA::assess_re/) {                                        if ($plainsrc =~ /$LONCAPA::assess_re/) {
                                           %Apache::lonhomework::history =                                            %Apache::lonhomework::history =
                                               &Apache::lonnet::restore($symb,$courseid,$domain,$name);                                                &Apache::lonnet::restore($symb,$courseid,$domain,$name);
                                           my $type = 'problem';                                            my $type = 'problem';
                                           if ($src =~ /\.task$/) {                                            if ($extension eq 'task') {
                                               $type = 'Task';                                                $type = 'Task';
                                           }                                            }
                                           my ($status,$accessmsg,$slot_name,$slot) =                                            my ($status,$accessmsg,$slot_name,$slot) =
Line 745  ENDEXT Line 749  ENDEXT
                           my $avespan=$lcm/($#colcont+1);                            my $avespan=$lcm/($#colcont+1);
                           for ($j=0;$j<=$#colcont;$j++) {                            for ($j=0;$j<=$#colcont;$j++) {
                               my $rid=$colcont[$j];                                my $rid=$colcont[$j];
       my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide).'<br />';        my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide,$hostname).'<br />';
     unless (($target eq 'tex') || ($target eq 'tex_answer')) {      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  $r->print('<td colspan="'.$avespan.'"');   $r->print('<td colspan="'.$avespan.'"');
     }      }
Line 873  ENDEXT Line 877  ENDEXT
 }  }
   
 sub get_buttons {  sub get_buttons {
     my ($hash,$rid,$buttonshide) = @_;      my ($hash,$rid,$buttonshide,$hostname) = @_;
   
     my $metainfo = '';      my $metainfo = '';
     my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});      my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});
Line 952  sub get_buttons { Line 956  sub get_buttons {
         if ($cfile ne '') {          if ($cfile ne '') {
             my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,              my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
                                                                  $forceedit,1,$symb,undef,                                                                   $forceedit,1,$symb,undef,
                                                                  &escape($env{'form.title'}));                                                                   &escape($env{'form.title'}),
                                                                    $hostname);
             if ($jscall) {              if ($jscall) {
                 my $icon = 'pcstr.png';                  my $icon = 'pcstr.png';
                 my $label = &mt('Edit');                  my $label = &mt('Edit');

Removed from v.1.119  
changed lines
  Added in v.1.123


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>