Diff for /loncom/interface/lonsupportreq.pm between versions 1.51 and 1.56

version 1.51, 2009/01/15 18:31:11 version 1.56, 2010/04/14 03:09:35
Line 77  sub print_request_form { Line 77  sub print_request_form {
     $browser = $env{'browser.type'};      $browser = $env{'browser.type'};
     $bversion = $env{'browser.version'};      $bversion = $env{'browser.version'};
     $uhost = $env{'request.host'};      $uhost = $env{'request.host'};
     $uname = $env{'user.name'};      my ($uname,$udom);
     $udom = $env{'user.domain'};      if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) {
           $uname = $env{'user.name'};
           $udom = $env{'user.domain'};
       }
     $uhome = $env{'user.home'};      $uhome = $env{'user.home'};
     $urole = $env{'request.role'};      $urole = $env{'request.role'};
     $usec = $env{'request.course.sec'};      $usec = $env{'request.course.sec'};
Line 266  function initialize_codes() { Line 269  function initialize_codes() {
                &Apache::lonhtmlcommon::row_closure();                 &Apache::lonhtmlcommon::row_closure();
     $num ++;      $num ++;
     $i = $num%2;      $i = $num%2;
     if (defined($env{'user.name'})) {      if (defined($uname)) {
         $output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]).          $output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]).
                    '<input type="text" size="50" name="cc" value="" /><br />'."\n".                     '<input type="text" size="50" name="cc" value="" /><br />'."\n".
                    &Apache::lonhtmlcommon::row_closure();                     &Apache::lonhtmlcommon::row_closure();
Line 428  function initialize_codes() { Line 431  function initialize_codes() {
                &Apache::lonhtmlcommon::row_closure();                 &Apache::lonhtmlcommon::row_closure();
     $num ++;      $num ++;
     $i = $num%2;       $i = $num%2; 
     if (defined($env{'user.name'})) {      if (defined($uname)) {
         $output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]).          $output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]).
                    ' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n".                     ' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n".
         &Apache::lonhtmlcommon::row_closure();          &Apache::lonhtmlcommon::row_closure();
Line 474  sub print_request_receipt { Line 477  sub print_request_receipt {
     my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',      my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
                                                       $defdom,$origmail);                                                        $defdom,$origmail);
     my $from = $admin;      my $from = $admin;
       my $bcc;
       my %domconfig =
            &Apache::lonnet::get_dom('configuration',['contacts'],$defdom);
       if (ref($domconfig{'contacts'}) eq 'HASH') {
           if (exists($domconfig{'contacts'}{'helpdeskmail'})) {
               if (ref($domconfig{'contacts'}{'helpdeskmail'}) eq 'HASH') {
                   my $bccmail = $domconfig{'contacts'}{'helpdeskmail'}{'bcc'};
                   if ($bccmail ne '') {
                       my @bccs = split(/,/,$bccmail);
                       my @ok_bccs;
                       foreach my $bcc (@bccs) {
                           $bcc =~ s/^\s+//g;
                           $bcc =~ s/\s+$//g;
                           if ($bcc =~ m/^[^\@]+\@[^\@]+$/) {
                               if (!(grep(/^\Q$bcc\E$/,@ok_bccs))) {
                                   push(@ok_bccs,$bcc);
                               }
                           }
                       }
                       if (@ok_bccs > 0) {
                           $bcc = join(', ',@ok_bccs);
                       }
                   }
               }
           }
       }
     my $reporttime = &Apache::lonlocal::locallocaltime(time);      my $reporttime = &Apache::lonlocal::locallocaltime(time);
     my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');      my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
   
Line 495  sub print_request_receipt { Line 524  sub print_request_receipt {
     }      }
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                  username    => 'Name',                   username    => 'Name',
                  email       => 'Email',                   email       => 'E-mail',
                  cc          => 'Cc',                   cc          => 'Cc',
                  user        => 'Username/domain',                   user        => 'Username/domain',
                  phone       => 'Phone',                   phone       => 'Phone',
Line 566  END Line 595  END
         if ($env{'form.'.$item} ne '') {          if ($env{'form.'.$item} ne '') {
             if ($item eq 'description') {              if ($item eq 'description') {
                 my $descrip = $env{'form.description'};                  my $descrip = $env{'form.description'};
                 $descrip =~ s|\n|<br />|g;                  $descrip =  &cleanup_html($descrip);
                   $descrip =~ s|[\n\r\f]|<br />|g;
                 $displaymsg .=                   $displaymsg .= 
                     '<span class="LC_helpform_receipt_cat">'.                      '<span class="LC_helpform_receipt_cat">'.
                     "$lt{$item}</span>: $descrip<br />\n";                      "$lt{$item}</span>: $descrip<br />\n";
             } elsif ($item eq 'sourceurl') {              } elsif ($item eq 'sourceurl') {
                 my $showurl = $env{'form.sourceurl'};                  my $showurl = $env{'form.sourceurl'};
                 $showurl =~ s/\?.*$//;                  $showurl =~ s/\?.*$//;
                   $showurl =  &cleanup_html($showurl);
                 $displaymsg .=                   $displaymsg .= 
                     '<span class="LC_helpform_receipt_cat">'.                      '<span class="LC_helpform_receipt_cat">'.
                     "$lt{$item}</span>: $showurl<br />\n";                      "$lt{$item}</span>: $showurl<br />\n";
Line 581  END Line 612  END
                     '<span class="LC_helpform_receipt_cat">'.                      '<span class="LC_helpform_receipt_cat">'.
                     "$lt{$item}</span>: $okcclist<br />\n";                      "$lt{$item}</span>: $okcclist<br />\n";
             } else {              } else {
                   my $showitem = $env{'form.'.$item};
                   $showitem = &cleanup_html($showitem);
                 $displaymsg .=                   $displaymsg .= 
                     '<span class="LC_helpform_receipt_cat">'.                      '<span class="LC_helpform_receipt_cat">'.
                     "$lt{$item}</span>: $env{'form.'.$item}<br />\n";                      "$lt{$item}</span>: $showitem<br />\n";
             }              }
         }          }
     }      }
Line 665  END Line 698  END
   
     my $attachmentpath = '';      my $attachmentpath = '';
     my $attachmentsize = '';      my $attachmentsize = '';
     if (defined($env{'user.name'})) {      if ((defined($env{'user.name'})) && ($env{'user.name'} ne 'public')
           && ($env{'user.domain'} ne 'public')) {
         if ($env{'form.screenshot.filename'}) {          if ($env{'form.screenshot.filename'}) {
             $attachmentsize = length($env{'form.screenshot'});              $attachmentsize = length($env{'form.screenshot'});
             if ($attachmentsize > 131072) {              if ($attachmentsize > 131072) {
Line 713  END Line 747  END
         my $cc_string = join(', ',@ok_ccs);          my $cc_string = join(', ',@ok_ccs);
         $msg->add("Cc" => $cc_string);          $msg->add("Cc" => $cc_string);
     }      }
       if ($bcc ne '') {
           $msg->add("Bcc" => $bcc);
       }
   
     if ($attachmentpath) {      if ($attachmentpath) {
         my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);          my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
Line 746  END Line 783  END
         unlink($attachmentpath);          unlink($attachmentpath);
     }      }
     $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");      $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");
     $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_helpform_receipt').      $r->print('<div style="width:620px;">'.
                 &Apache::lonhtmlcommon::start_pick_box().
               &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".                &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".
               &Apache::lonhtmlcommon::row_closure().                &Apache::lonhtmlcommon::row_closure().
               &Apache::lonhtmlcommon::row_title($lt{'adin'},undef,'LC_evenrow_value'));                &Apache::lonhtmlcommon::row_title($lt{'adin'},undef,'LC_evenrow_value'));
Line 772  END Line 810  END
     $envmsg =~ s/, $//;      $envmsg =~ s/, $//;
     $r->print($envmsg."\n".      $r->print($envmsg."\n".
               &Apache::lonhtmlcommon::row_closure(1)."\n".                &Apache::lonhtmlcommon::row_closure(1)."\n".
               &Apache::lonhtmlcommon::end_pick_box()."\n".                &Apache::lonhtmlcommon::end_pick_box().
                 "</div>\n".
               &Apache::loncommon::end_page());                &Apache::loncommon::end_page());
 }  }
   
Line 801  sub print_header { Line 840  sub print_header {
     $r->print(<<END);      $r->print(<<END);
 <table width="620" border="0" cellspacing="0" cellpadding="0" height="55">   <tr height="50">    <td width='5'>&nbsp;</td>  <table width="620" border="0" cellspacing="0" cellpadding="0" height="55">   <tr height="50">    <td width='5'>&nbsp;</td>
    <td>     <td>
     <fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' />&nbsp;&nbsp;<b><font size="+1">LON-CAPA $lt{'headline'}</font></b></legend>      <fieldset>
         <legend>
           <img src="$location/lonIcons/minilogo.gif" height="20" width="29" valign="bottom" />
           LON-CAPA $lt{'headline'}
         </legend>
  <table id="LC_helpmenu_links">   <table id="LC_helpmenu_links">
    <tr>     <tr>
     <td align="center"><span class="LC_nobreak"><img src="$location/help/help.png" border="0" alt="($lt{'login'})" valign="middle" />&nbsp;<b><a href="/adm/loginproblems.html">$lt{'login'}</a></b>&nbsp;</span></td>      <td align="center"><span class="LC_nobreak"><img src="$location/help/help.png" border="0" alt="($lt{'login'})" valign="middle" />&nbsp;<b><a href="/adm/loginproblems.html">$lt{'login'}</a></b>&nbsp;</span></td>
Line 842  sub get_domain { Line 885  sub get_domain {
     } elsif ($env{'request.role.domain'}) {      } elsif ($env{'request.role.domain'}) {
         $codedom = $env{'request.role.domain'};          $codedom = $env{'request.role.domain'};
     } else {      } else {
         $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};          $codedom = &Apache::lonnet::default_login_domain();
     }      }
     return $codedom;      return $codedom;
 }  }
   
   sub cleanup_html {
       my ($incoming) = @_;
       my $outgoing;
       if ($incoming ne '') {
           $outgoing = $incoming;
           $outgoing =~ s/\#/&#035;/g;
           $outgoing =~ s/\&/&#038;/g;
           $outgoing =~ s/</&#060;/g;
           $outgoing =~ s/>/&#062;/g;
           $outgoing =~ s/\(/&#040/g;
           $outgoing =~ s/\)/&#041;/g;
           $outgoing =~ s/"/&#034;/g;
           $outgoing =~ s/'/&#039;/g;
           $outgoing =~ s/\$/&#036;/g;
       }
       return $outgoing;
   }
   
 1;  1;

Removed from v.1.51  
changed lines
  Added in v.1.56


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