Diff for /loncom/interface/lonsupportreq.pm between versions 1.67.2.1 and 1.68

version 1.67.2.1, 2013/01/04 19:07:17 version 1.68, 2012/08/27 02:02:57
Line 36  use Apache::lonhtmlcommon; Line 36  use Apache::lonhtmlcommon;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonacc();  use Apache::lonacc();
   use Apache::lonauth();
 use Apache::courseclassifier;  use Apache::courseclassifier;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities;   
   
 sub handler {  sub handler {
     my ($r) = @_;      my ($r) = @_;
Line 56  sub handler { Line 57  sub handler {
     if ($r->uri eq '/adm/helpdesk') {      if ($r->uri eq '/adm/helpdesk') {
         &Apache::lonacc::get_posted_cgi($r);          &Apache::lonacc::get_posted_cgi($r);
     }      }
     my $function;      my $function = $env{'form.function'};
     if ($env{'form.function'}) {  
         if (($env{'form.function'} eq 'norole')  ||  
             ($env{'form.function'} eq 'student') ||  
             ($env{'form.function'} eq 'admin')   ||  
             ($env{'form.function'} eq 'author')) {  
             $function = $env{'form.function'};  
         }  
     }  
     my $origurl = $env{'form.origurl'};      my $origurl = $env{'form.origurl'};
     $origurl =~ s{^https?://}{};  
     $origurl =~ s/(`)//g;  
     $origurl =~ s/\$/\(\$\)/g;  
     my $command = $env{'form.command'};      my $command = $env{'form.command'};
   
     if ($command eq 'process') {      if ($command eq 'process') {
Line 112  sub print_request_form { Line 102  sub print_request_form {
     }      }
     $formname = 'logproblem';      $formname = 'logproblem';
     my $machine = &Apache::lonnet::absolute_url();      my $machine = &Apache::lonnet::absolute_url();
     my $sourceurl = $machine.$origurl;      if ($origurl =~ m-^https?://-) {
     $server = $machine.&cleanup_html($origurl);          $server = $origurl;
     $server =~ s/\?.*$//;      } else {
           $server = $machine.$origurl;
       }
       my $showserver = $server;
       $showserver =~ s/\?.*$//;
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                   email => 'The e-mail address you entered',                    email => 'The e-mail address you entered',
                   notv => 'is not a valid e-mail address',                    notv => 'is not a valid e-mail address',
Line 364  ENDJS Line 358  ENDJS
     $num ++;      $num ++;
     $i = $num%2;      $i = $num%2;
     $output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]).      $output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]).
                $server."\n".'<input type="hidden" name="sourceurl" value="'.                 $showserver."\n".'<input type="hidden" name="sourceurl" value="'.
                &HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n".                 &HTML::Entities::encode($server,'"<>&').'" />'."\n".
                &Apache::lonhtmlcommon::row_closure().                 &Apache::lonhtmlcommon::row_closure().
                &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value').                 &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value').
                '<input type="text" size="15" name="phone" /><br />'."\n".                 '<input type="text" size="15" name="phone" /><br />'."\n".
Line 638  sub print_request_receipt { Line 632  sub print_request_receipt {
            $okcclist = join(', ',@ok_ccs);              $okcclist = join(', ',@ok_ccs); 
         }           } 
         if (@bad_ccs == 1) {          if (@bad_ccs == 1) {
             if ($bad_ccs[0] ne '') {              $badccmsg .= '<br />'.&mt('The following Cc e-mail address is invalid: ').$bad_ccs[0];
                 $badccmsg .= '<br />'.&mt('The following Cc e-mail address is invalid: ').&cleanup_html($bad_ccs[0]);  
             }  
         } elsif (@bad_ccs > 1) {          } elsif (@bad_ccs > 1) {
             $badccmsg .= '<br />'.&mt('The following Cc e-mail addresses are invalid: '). &cleanup_html(join(', ',@bad_ccs));              my $bad_cc_string = join(', ',@bad_ccs);
               $badccmsg .= '<br />'.&mt('The following Cc e-mail addresses are invalid: ').$bad_cc_string;
         }          }
     }      }
     $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";      $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
Line 678  END Line 671  END
                     '<span class="LC_helpform_receipt_cat">'.                      '<span class="LC_helpform_receipt_cat">'.
                     "$lt{$item}</span>: $showurl<br />\n";                      "$lt{$item}</span>: $showurl<br />\n";
             } elsif ($item eq 'cc') {              } elsif ($item eq 'cc') {
                 if ($okcclist) {                  $displaymsg .=
                     my $showcclist = &cleanup_html($okcclist);                      '<span class="LC_helpform_receipt_cat">'.
                     $displaymsg .=                      "$lt{$item}</span>: $okcclist<br />\n";
                         '<span class="LC_helpform_receipt_cat">'.  
                         "$lt{$item}</span>: $showcclist<br />\n";  
                 }  
             } else {              } else {
                 my $showitem = $env{'form.'.$item};                  my $showitem = $env{'form.'.$item};
                 $showitem = &cleanup_html($showitem);                  $showitem = &cleanup_html($showitem);
Line 923  sub print_header { Line 913  sub print_header {
     } else {      } else {
         $reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.');          $reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.');
     }      }
     my $linkback;  
     if ($origurl eq '') {      if ($origurl eq '') {
         $linkback = 'javascript:history.go(-1)';          $origurl = 'javascript:history.go(-1)';
     } else {      }
         $linkback = &HTML::Entities::encode($origurl,'"<>&');      my $loginhelp = &Apache::lonauth::loginhelpdisplay();
       if ($loginhelp eq '') {
           $loginhelp = '/adm/loginproblems.html';
     }      }
     $r->print(<<"END");      $r->print(<<"END");
 <table width="620" border="0" cellspacing="0" cellpadding="0" style="height: 55px;">  <table width="620" border="0" cellspacing="0" cellpadding="0" style="height: 55px;">
Line 941  sub print_header { Line 932  sub print_header {
       </legend>        </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'})" style="vertical-align: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'})" style="vertical-align:middle" />&nbsp;<b><a href="$loginhelp">$lt{'login'}</a></b>&nbsp;</span></td>
     <td align="center"><span class="LC_nobreak">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" style="vertical-align:middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</span></td>$getstartlink      <td align="center"><span class="LC_nobreak">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" style="vertical-align:middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</span></td>$getstartlink
     <td align="center"><span class="LC_nobreak">&nbsp;<b><a href="$linkback" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" style="vertical-align:middle" />&nbsp;$lt{'back'}</a></b>&nbsp;</span></td>      <td align="center"><span class="LC_nobreak">&nbsp;<b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" style="vertical-align:middle" />&nbsp;$lt{'back'}</a></b>&nbsp;</span></td>
    </tr>     </tr>
  </table>   </table>
 </fieldset>  </fieldset>
Line 976  END Line 967  END
 sub get_domain {  sub get_domain {
     my $codedom;      my $codedom;
     if (exists($env{'form.codedom'})) {      if (exists($env{'form.codedom'})) {
         if (&Apache::lonnet::domain($env{'form.codedom'}) ne '') {          $codedom = $env{'form.codedom'};
             return $env{'form.codedom'};      } elsif ($env{'request.course.id'}) {
         }  
     }  
     if ($env{'request.course.id'}) {  
         $codedom = $env{'course.'.$env{'request.course.id'}.'.domain'};          $codedom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     } elsif ($env{'request.role.domain'}) {      } elsif ($env{'request.role.domain'}) {
         $codedom = $env{'request.role.domain'};          $codedom = $env{'request.role.domain'};
Line 995  sub cleanup_html { Line 983  sub cleanup_html {
     my $outgoing;      my $outgoing;
     if ($incoming ne '') {      if ($incoming ne '') {
         $outgoing = $incoming;          $outgoing = $incoming;
         $outgoing =~ s/;/&#059;/g;  
         $outgoing =~ s/\#/&#035;/g;          $outgoing =~ s/\#/&#035;/g;
         $outgoing =~ s/\&/&#038;/g;          $outgoing =~ s/\&/&#038;/g;
         $outgoing =~ s/</&#060;/g;          $outgoing =~ s/</&#060;/g;
Line 1005  sub cleanup_html { Line 992  sub cleanup_html {
         $outgoing =~ s/"/&#034;/g;          $outgoing =~ s/"/&#034;/g;
         $outgoing =~ s/'/&#039;/g;          $outgoing =~ s/'/&#039;/g;
         $outgoing =~ s/\$/&#036;/g;          $outgoing =~ s/\$/&#036;/g;
         $outgoing =~ s{/}{&#047;}g;  
         $outgoing =~ s/=/&#061;/g;  
         $outgoing =~ s/\\/&#092;/g  
     }      }
     return $outgoing;      return $outgoing;
 }  }

Removed from v.1.67.2.1  
changed lines
  Added in v.1.68


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