Diff for /loncom/interface/lonsupportreq.pm between versions 1.87 and 1.91

version 1.87, 2017/01/23 17:23:03 version 1.91, 2017/02/25 20:00:47
Line 79  sub handler { Line 79  sub handler {
     }      }
     return OK;      return OK;
 }  }
      
 sub print_request_form {  sub print_request_form {
     my ($r,$origurl,$function) = @_;      my ($r,$origurl,$function) = @_;
     my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid,      my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid,
Line 105  sub print_request_form { Line 105  sub print_request_form {
             }              }
         }          }
     }      }
     if (($env{'user.name'} =~ /^$match_username$/) &&       if (($env{'user.name'} =~ /^$match_username$/) &&
         ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {          ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
         $knownuser = 1;          $knownuser = 1;
     } else {      } else {
Line 350  ENDJS Line 350  ENDJS
     unless ($helpform{'username'} eq 'no') {      unless ($helpform{'username'} eq 'no') {
         my ($reqd,$namefield,$fullname);          my ($reqd,$namefield,$fullname);
         if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) {          if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) {
             $fullname = "$firstname $lastname";               $fullname = "$firstname $lastname";
             $namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n";              $namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n";
         } else {          } else {
             if (defined($firstname) && $firstname ne '') {              if (defined($firstname) && $firstname ne '') {
Line 378  ENDJS Line 378  ENDJS
                &HTML::Entities::encode($email,'"<>&').'" />'."\n";                 &HTML::Entities::encode($email,'"<>&').'" />'."\n";
     unless ($shownsubmit) {      unless ($shownsubmit) {
         $output .= $topsubmit;          $output .= $topsubmit;
     }       }
     $output .= &Apache::lonhtmlcommon::row_closure();      $output .= &Apache::lonhtmlcommon::row_closure();
     $num ++;      $num ++;
     $i = $num%2;      $i = $num%2;
Line 541  ENDJS Line 541  ENDJS
             $output .= '</select></div>'."\n".              $output .= '</select></div>'."\n".
                        '<div id="LC_helpdesk_section" style="display:none">'.                         '<div id="LC_helpdesk_section" style="display:none">'.
                        '<input type="text" name="sectiontxt" size="10" /></div>'."\n";                         '<input type="text" name="sectiontxt" size="10" /></div>'."\n";
         } else {           } else {
             $output .= '<input type="text" name="section" size="10" />'."\n";              $output .= '<input type="text" name="section" size="10" />'."\n";
         }          }
         $output .= &Apache::lonhtmlcommon::row_closure();          $output .= &Apache::lonhtmlcommon::row_closure();
Line 569  ENDJS Line 569  ENDJS
                 my $max = 1048576;                  my $max = 1048576;
                 my $showmax = 1.00;                  my $showmax = 1.00;
                 if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {                  if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {
                     $max *= $helpform{'maxsize'};                       $max *= $helpform{'maxsize'};
                     $showmax = $helpform{'maxsize'};                      $showmax = $helpform{'maxsize'};
                 }                  }
                 $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';                  $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';
Line 627  sub print_request_receipt { Line 627  sub print_request_receipt {
     if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) {      if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) {
         $public = 1;          $public = 1;
     }      }
     my $lonhost = $r->dir_config('lonHostID');       my $lonhost = $r->dir_config('lonHostID');
     unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {      unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
         my ($captcha_chk,$captcha_error) =           my ($captcha_chk,$captcha_error) = 
             &Apache::loncommon::captcha_response('login',$lonhost);              &Apache::loncommon::captcha_response('login',$lonhost);
Line 657  sub print_request_receipt { Line 657  sub print_request_receipt {
     my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');      my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
     my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');      my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');
     my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');      my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
     my @cookievars = ('lonID');      my @cookievars;
       if ($ENV{'SERVER_PORT'} == 443) {
           @cookievars = ('lonLinkID');
       } else {
           @cookievars = ('lonID');
       }
   
     my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};      my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
     my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};      my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
Line 833  sub print_request_receipt { Line 838  sub print_request_receipt {
     }      }
     if ($formvars{'course'}) {      if ($formvars{'course'}) {
         $supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n";          $supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n";
     }       }
     $supportmsg .= "$lt{'subject'}: $env{'form.subject'}      $supportmsg .= "$lt{'subject'}: $env{'form.subject'}
 $lt{'description'}: $env{'form.description'}  $lt{'description'}: $env{'form.description'}
 $lt{'sourceurl'}: $env{'form.sourceurl'}  $lt{'sourceurl'}: $env{'form.sourceurl'}
Line 961  END Line 966  END
     my $fname;      my $fname;
   
     my $attachmentpath = '';      my $attachmentpath = '';
     my $attachmentsize = '';      my $showsize = '';
   
     if ((defined($env{'user.name'})) && (!$public)) {      if ((defined($env{'user.name'})) && (!$public)) {
         if ($homeserver && $env{'form.screenshot.filename'}) {          if ($homeserver && $env{'form.screenshot.filename'}) {
             unless ($helpform{'screenshot'} eq 'no') {              unless ($helpform{'screenshot'} eq 'no') {
                 $attachmentsize = length($env{'form.screenshot'});                  my $attachmentsize = length($env{'form.screenshot'});
                 my $max = 1048576;                  my $max = 1048576;
                 my $showmax = 1.00;                  my $showmax = 1.00;
                 if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {                  if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {
                     $max *= $helpform{'maxsize'};                      $max *= $helpform{'maxsize'};
                     $showmax = $helpform{'maxsize'};                      $showmax = $helpform{'maxsize'};
                 }                  }
                 $showmax = '('.sprintf("%.2f",$showmax).' MB)';                   $showmax = '('.sprintf("%.2f",$showmax).' MB)';
                   $showsize = $attachmentsize/1048576;
                   $showsize = '('.sprintf("%.2f",$showsize).' MB)';
                 if ($attachmentsize > $max) {                  if ($attachmentsize > $max) {
                     my $showsize = $attachmentsize/1048576;  
                     $showsize = '('.sprintf("%.2f",$showsize).' MB)';  
                     $displaymsg .= '<br /><span class="LC_warning">'.                      $displaymsg .= '<br /><span class="LC_warning">'.
                                    &mt('The uploaded screenshot file [_1] included with your request exceeded the maximum allowed size [_2], and has therefore been discarded.',$showsize,$showmax).'</span>';                                     &mt('The uploaded screenshot file [_1] included with your request exceeded the maximum allowed size [_2], and has therefore been discarded.',$showsize,$showmax).'</span>';
                 } else {                  } else {
Line 990  END Line 996  END
     if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {      if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
         $cookies{'lonID'} = $1;          $cookies{'lonID'} = $1;
     }      }
       if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) {
           $cookies{'lonLinkID'} = $1;
       }
     if ($attachmentpath =~ m-/([^/]+)$-) {      if ($attachmentpath =~ m-/([^/]+)$-) {
         $fname = $1;          $fname = $1;
         $displaymsg .= '<br />'          $displaymsg .= '<br />'
                       .&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].'                        .&mt('An uploaded screenshot file [_1] was included in the request sent by [_2].'
                           ,'<span class="LC_filename">'.$fname.'</span>'                            ,'<span class="LC_filename">'.$fname.'</span>&nbsp;'.$showsize,
                           ,$attachmentsize  
                           ,$env{'user.name'}.':'.$env{'user.domain'}                            ,$env{'user.name'}.':'.$env{'user.domain'}
                        );                         );
         $supportmsg .= "\n";          $supportmsg .= "\n";
Line 1010  END Line 1017  END
             $supportmsg .= "$var: $env{$var}\n";              $supportmsg .= "$var: $env{$var}\n";
         }          }
     }      }
    
     my $cc_string;      my $cc_string;
     if ($homeserver) {      if ($homeserver) {
         if (@ok_ccs > 0) {          if (@ok_ccs > 0) {
Line 1018  END Line 1025  END
         }          }
     }      }
   
     my $attachment_text;      my $attachment_text = '';
     unless ($homeserver && $attachmentpath) {      unless ($homeserver && $attachmentpath) {
         my $envdata = '';  
         foreach my $var (@cookievars) {          foreach my $var (@cookievars) {
             $envdata .= "$var: $cookies{$var}\n";              $attachment_text .= "$var: $cookies{$var}\n";
         }          }
         foreach my $var (@ENVvars) {          foreach my $var (@ENVvars) {
             $envdata .= "$var: $ENV{$var}\n";              $attachment_text .= "$var: $ENV{$var}\n";
         }          }
         foreach my $var (@envvars) {          foreach my $var (@envvars) {
             $envdata .= "$var: $env{$var}\n";              $attachment_text .= "$var: $env{$var}\n";
         }          }
         foreach my $var (@loncvars) {          foreach my $var (@loncvars) {
             $envdata .= "$var: $env{$var}\n";              $attachment_text .= "$var: $env{$var}\n";
         }          }
         $attachment_text = $envdata;          $attachment_text = $envdata;
     }      }

Removed from v.1.87  
changed lines
  Added in v.1.91


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