Diff for /loncom/interface/lonsupportreq.pm between versions 1.98 and 1.108

version 1.98, 2019/08/11 15:15:40 version 1.108, 2025/02/25 05:35:26
Line 68  sub handler { Line 68  sub handler {
     }      }
     my $origurl = $env{'form.origurl'};      my $origurl = $env{'form.origurl'};
     if ($origurl =~ m{^https?://[^/]+(.*)$}) {      if ($origurl =~ m{^https?://[^/]+(.*)$}) {
         $origurl =~ $1;          $origurl = $1;
     }      }
     $origurl =~ s/(`)//g;      $origurl =~ s/(`)//g;
     $origurl =~ s/\$/\(\$\)/g;      $origurl =~ s/\$/\(\$\)/g;
Line 319  $jscript Line 319  $jscript
 $loaditems  $loaditems
 // ]]>  // ]]>
 </script>  </script>
 <script type="text/javascript" src="/res/adm/includes/file_upload.js"></script>  
 ENDJS  ENDJS
     if ($recaptcha_version >=2) {      if ($knownuser) {
           $js .="\n".'<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script>';
       } elsif ($recaptcha_version >=2) {
         $js.= "\n".'<script src="https://www.google.com/recaptcha/api.js"></script>'."\n";          $js.= "\n".'<script src="https://www.google.com/recaptcha/api.js"></script>'."\n";
     }      }
     my %add_entries = (      my %add_entries = (
Line 329  ENDJS Line 330  ENDJS
                        onload   => "initialize_codes();",                         onload   => "initialize_codes();",
                       );                        );
   
           my $args = { 'function'    => $function,
     $r->print(&Apache::loncommon::start_page('Support Request',$js,                   'add_entries' => \%add_entries,
        { 'function'    => $function,                   'only_body'   => 1,};
  'add_entries' => \%add_entries,      unless (($knownuser) || ($public)) {
  'only_body'   => 1,}));          (undef,undef,undef,my $clientmathml,my $clientunicode) =
               &Apache::loncommon::decode_user_agent();
           if ($clientunicode && !$clientmathml) {
               $args->{'browser.unicode'} = 1;
           }
       }
       $r->print(&Apache::loncommon::start_page('Support Request',$js,$args));
     if ($r->uri eq '/adm/helpdesk') {      if ($r->uri eq '/adm/helpdesk') {
         &print_header($r,$origurl);          &print_header($r,$origurl);
     }      }
Line 346  ENDJS Line 353  ENDJS
     }      }
     my $topsubmit = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$html_lt{'subm'}.'" onclick="validate()" />&nbsp;';      my $topsubmit = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$html_lt{'subm'}.'" onclick="validate()" />&nbsp;';
     my $shownsubmit;      my $shownsubmit;
     $r->print('<form method="post" action="" name="logproblem"'.$formtype.'>'."\n");      $r->print('<div class="LC_landmark" role="main">'."\n".
                 '<form method="post" action="" name="logproblem"'.$formtype.'>'."\n");
     my $output = &Apache::lonhtmlcommon::start_pick_box().      my $output = &Apache::lonhtmlcommon::start_pick_box().
                  &Apache::lonhtmlcommon::row_headline().                   &Apache::lonhtmlcommon::row_headline().
                  '<span class="LC_info">'.                   '<span class="LC_info">'.
                  &mt('(All fields marked with * are required.)').                   &mt('(All fields marked with [_1]*[_2] are required.)',
                        '<span class="LC_parm_part">','</span>').
                  '</span>'.                   '</span>'.
                  &Apache::lonhtmlcommon::row_closure();                   &Apache::lonhtmlcommon::row_closure();
     unless ($helpform{'username'} eq 'no') {      unless ($helpform{'username'} eq 'no') {
         my ($reqd,$namefield,$fullname);          my ($reqd,$aria_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" id="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n";
         } else {          } else {
             if (defined($firstname) && $firstname ne '') {              if (defined($firstname) && $firstname ne '') {
                 $fullname = $firstname;                  $fullname = $firstname;
             } elsif (defined($lastname) && $lastname ne '') {              } elsif (defined($lastname) && $lastname ne '') {
                 $fullname = " $lastname";                  $fullname = " $lastname";
             }              }
             $namefield = '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n";  
             if ($helpform{'username'} eq 'req') {              if ($helpform{'username'} eq 'req') {
                 $reqd = '<span class="LC_info">*</span>';                  $reqd = '<span class="LC_parm_part">*</span>';
                   $aria_reqd = 'aria-required="true" ';
             }              }
               $namefield = '<input type="text" size="20" name="username" id="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" '.$aria_reqd.'/>'."\n";
         }          }
         $output .= &Apache::lonhtmlcommon::row_title($html_lt{'name'}.$reqd,undef,$css[$num])."\n".$namefield.          my $title = '<label for="username">'.$html_lt{'name'}.'</label>';
           $output .= &Apache::lonhtmlcommon::row_title($title.$reqd,undef,$css[$num])."\n".$namefield.
                    $topsubmit.                     $topsubmit.
                    &Apache::lonhtmlcommon::row_closure()."\n";                     &Apache::lonhtmlcommon::row_closure()."\n";
         $shownsubmit = 1;          $shownsubmit = 1;
Line 378  ENDJS Line 389  ENDJS
     }      }
     $output .= &Apache::lonhtmlcommon::row_title(      $output .= &Apache::lonhtmlcommon::row_title(
                    '<span title="'.&mt('required').'">'.                     '<span title="'.&mt('required').'">'.
                    $html_lt{'emad'}.' <span class="LC_info">*</span></span>'                     '<label for="email">'.$html_lt{'emad'}.
                      '</label><span class="LC_parm_part">*</span></span>'
                   ,undef,$css[$i]).                    ,undef,$css[$i]).
                '<input type="text" size="20" name="email" value="'.                 '<input type="text" size="20" name="email" id="email" value="'.
                &HTML::Entities::encode($email,'"<>&').'" />'."\n";                 &HTML::Entities::encode($email,'"<>&').'" aria-required="true" />'."\n";
     unless ($shownsubmit) {      unless ($shownsubmit) {
         $output .= $topsubmit;          $output .= $topsubmit;
     }      }
Line 390  ENDJS Line 402  ENDJS
     $i = $num%2;      $i = $num%2;
     if ($knownuser) {      if ($knownuser) {
         if ($homeserver) {          if ($homeserver) {
             unless ($helpform{'cc'} eq 'no') {              my $ip = &Apache::lonnet::get_requestor_ip($r);
                 $output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]).              my %setters;
                            '<input type="text" size="50" name="cc" value="" /><br />'."\n".              my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
                   &Apache::loncommon::blockcheck(\%setters,'com',$ip);
               unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
                   $output .= &Apache::lonhtmlcommon::row_title('<label for="cc">'.$html_lt{'emac'}.'</label>',
                                                                undef,$css[$i]).
                              '<input type="text" size="50" name="cc" id="cc" value="" /><br />'."\n".
                            &Apache::lonhtmlcommon::row_closure();                             &Apache::lonhtmlcommon::row_closure();
                 $num ++;                  $num ++;
                 $i = $num%2;                  $i = $num%2;
Line 406  ENDJS Line 423  ENDJS
         my $uname_input = '<input type="hidden" name="uname" value="'.          my $uname_input = '<input type="hidden" name="uname" value="'.
                          &HTML::Entities::encode($uname,'"<>&').'" />'."\n";                           &HTML::Entities::encode($uname,'"<>&').'" />'."\n";
         if ($knownuser) {          if ($knownuser) {
             $output .= '<i>'.$html_lt{'unme'}.'</i>:&nbsp;'.$uname.'&nbsp;&nbsp;<i>'.$html_lt{'doma'}.'</i>:&nbsp;'.$udom.$udom_input.$uname_input;              $output .= '<span class="LC_nobreak"><span class="LC_cusr_emph">'.$html_lt{'unme'}
                         .'</span>:&nbsp;'.$uname.'&nbsp;&nbsp;<span class="LC_cusr_emph">'
                         .$html_lt{'doma'}.'</span>:&nbsp;'.$udom.$udom_input.$uname_input.'</span>';
         } else {          } else {
             my $udomform = '';              my $udomform = '';
             my $unameform = '';              my $unameform = '';
Line 420  ENDJS Line 439  ENDJS
             $output .= '<br />'."\n";              $output .= '<br />'."\n";
             if (!$public) {              if (!$public) {
                 if ($env{'user.domain'} =~ /^$match_domain$/) {                  if ($env{'user.domain'} =~ /^$match_domain$/) {
                     $udomform = '<i>'.$html_lt{'doma'}.'</i>:&nbsp;'.$udom.$udom_input;                      $udomform = '<span class="LC_cusr_emph">'.$html_lt{'doma'}.'</span>:&nbsp;'.$udom.$udom_input;
                 } elsif ($env{'user.name'} =~ /^$match_username$/) {                  } elsif ($env{'user.name'} =~ /^$match_username$/) {
                     $unameform = '<i>'.$html_lt{'unme'}.'</i>:&nbsp;'.$uname.'&nbsp;&nbsp;'.$uname_input;                      $unameform = '<span class="LC_cusr_emph">'.$html_lt{'unme'}.'</span>:&nbsp;'.$uname.'&nbsp;&nbsp;'.$uname_input;
                 }                  }
             }              }
             if ($udomform eq '') {              if ($udomform eq '') {
                 $udomform = '<i>'.$html_lt{'doma'}.'</i>:&nbsp;';                  $udomform = '<span class="LC_nobreak"><span class="LC_cusr_emph"><label for="udom">'
                 $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n";                             .$html_lt{'doma'}.'</label></span>:&nbsp;'
                              .&Apache::loncommon::select_dom_form($codedom,'udom','','','','','','','udom')."</span>\n";
             }              }
             if ($unameform eq '') {              if ($unameform eq '') {
                 $unameform= '<i>'.$html_lt{'unme'}.'</i>:&nbsp;<input type="text" size="20" name="uname" value="'.$uname.'" />&nbsp;&nbsp;';                  $unameform= '<span class="LC_nobreak"><span class="LC_cusr_emph"><label for="uname">'
                              .$html_lt{'unme'}.'</label></span>:&nbsp;'
                              .'<input type="text" size="20" name="uname" id="uname" value="'.$uname.'" />'
                              .'&nbsp;&nbsp;</span>';
             }              }
             $output .= $unameform.$udomform;              $output .= $unameform.$udomform;
         }          }
Line 445  ENDJS Line 468  ENDJS
                    &Apache::lonhtmlcommon::row_closure();                     &Apache::lonhtmlcommon::row_closure();
     }      }
     unless ($helpform{'phone'} eq 'no') {      unless ($helpform{'phone'} eq 'no') {
         my $reqd;          my ($reqd,$aria_reqd);
         if ($helpform{'phone'} eq 'req') {          if ($helpform{'phone'} eq 'req') {
             $reqd = '<span class="LC_info">*</span>';              $reqd = '<span class="LC_parm_part">*</span>';
               $aria_reqd = 'aria-required="true" ';
         }          }
         $output .= &Apache::lonhtmlcommon::row_title($html_lt{'phon'}.$reqd,undef,'LC_evenrow_value').          $output .= &Apache::lonhtmlcommon::row_title('<label for="phone">'.$html_lt{'phon'}.'</label>'.$reqd,undef,'LC_evenrow_value').
                    '<input type="text" size="15" name="phone" /><br />'."\n".                     '<input type="text" size="15" name="phone" id="phone" '.$aria_reqd.'/><br />'."\n".
                    &Apache::lonhtmlcommon::row_closure();                     &Apache::lonhtmlcommon::row_closure();
         $num ++;          $num ++;
         $i = $num%2;          $i = $num%2;
Line 460  ENDJS Line 484  ENDJS
         if ($totcodes > 0) {          if ($totcodes > 0) {
             my $numtitles = @codetitles;              my $numtitles = @codetitles;
             if ($numtitles == 0) {              if ($numtitles == 0) {
                 $output .= $html_lt{'enin'}.':&nbsp;                  $output .= '<label>'.$html_lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />'."\n";                    <input type="text" name="coursecode" size="15" value="'.&HTML::Entities::encode($ccode,'\'"&<>').'" /></label>'."\n";
             } else {              } else {
                 my @standardnames = &Apache::loncommon::get_standard_codeitems();                  my @standardnames = &Apache::loncommon::get_standard_codeitems();
                 my $lasttitle = $numtitles;                  my $lasttitle = $numtitles;
Line 472  ENDJS Line 496  ENDJS
                 if ($sectionlist) {                  if ($sectionlist) {
                     $onchange = 'toggleSecVis()';                      $onchange = 'toggleSecVis()';
                 }                  }
                 $output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n".                  $output .= '<table><tr>';
                       '<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".');'.$onchange.'">'."\n".                  for (my $i=0; $i<$lasttitle; $i++) {
                       $output .= '<th><label for="'.$standardnames[$i].'_'.$i.'">'.$codetitles[0].'</label></th>';
                   }
                   $output .= '</tr>';
                   $output .= '<tr><td>'.
                         '<select name="'.$standardnames[0].'" id="'.$standardnames[0].'_0" onchange="courseSet('."'$codetitles[0]'".');'.$onchange.'">'."\n".
                       ' <option value="-1">'.$html_lt{'sele'}."</option>\n";                        ' <option value="-1">'.$html_lt{'sele'}."</option>\n";
                 my @items = ();                  my @items = ();
                 my @longitems = ();                  my @longitems = ();
Line 500  ENDJS Line 529  ENDJS
                     $output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n";                      $output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n";
                 }                  }
                 $output .= '</select></td>';                  $output .= '</select></td>';
                 for (my $i=1; $i<$numtitles; $i++) {                  for (my $i=1; $i<$lasttitle; $i++) {
                     $output .= '<td>'.$codetitles[$i].'<br />'."\n".                      $output .= '<td>'."\n".
                      '<select name="'.$standardnames[$i].'" onchange="courseSet('."'$codetitles[$i]'".');'.$onchange.'">'."\n".                       '<select name="'.$standardnames[$i].'" id="'.$standardnames[$i].'_'.$i.'" onchange="courseSet('."'$codetitles[$i]'".');'.$onchange.'">'."\n".
                      '<option value="-1">&lt;-'.$html_lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n".                       '<option value="-1">&lt;-'.$html_lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n".
                      '</select>'."\n".                       '</select>'."\n".
                      '</td>'."\n";                       '</td>'."\n";
                 }                  }
                 $output .= '</tr></table>';                  $output .= '</tr></table>';
                 if ($numtitles > 4) {                  if ($numtitles > 4) {
                     $output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n".                      $output .= '<br /><br /><label>'.$codetitles[$numtitles].'<br />'."\n".
                           '<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".');'.$onchange.'">'."\n".                            '<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".');'.$onchange.'">'."\n".
                           '<option value="-1">&lt;-'.$html_lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n".                            '<option value="-1">&lt;-'.$html_lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n".
                           '</select>'."\n";                            '</select></label>'."\n";
                 }                  }
             }              }
         } else {          } else {
             $output .= $html_lt{'enin'}.':&nbsp;              $output .= '<label>'.$html_lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />'."\n";                    <input type="text" name="coursecode" size="15" value="" /></label>'."\n";
         }          }
         my $reqd;          my ($reqd,$aria_reqd);
         if ($helpform{'course'} eq 'req') {          if ($helpform{'course'} eq 'req') {
              $reqd = '<span class="LC_info">*</span>';               $reqd = '<span class="LC_parm_part">*</span>';
                $aria_reqd = 'aria-required="true" ';
         }          }
         $output .= '<br />'.$html_lt{'enct'}.$reqd.':&nbsp;          $output .= '<br /><div><label>'.$html_lt{'enct'}.$reqd.':&nbsp;
                    <input type="text" name="title" size="25" value="'.                     <input type="text" name="title" size="25" value="'.
                    &HTML::Entities::encode($ctitle,'"<>&').'" />'."\n";                     &HTML::Entities::encode($ctitle,'"<>&').'" '.$aria_reqd.'/></label></div>'."\n";
         $output .= &Apache::lonhtmlcommon::row_closure();          $output .= &Apache::lonhtmlcommon::row_closure();
         $num ++;          $num ++;
         $i = $num%2;          $i = $num%2;
     }      }
     unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) {      unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) {
         $output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]);          $output .= &Apache::lonhtmlcommon::row_title('<label for="section">'.$html_lt{'secn'}.'</label>',
                                                        undef,$css[$i]);
         if ($sectionlist) {          if ($sectionlist) {
             $output .= "<div id=\"LC_helpdesk_sectionlist\"><select name=\"sectionsel\">\n".              $output .= "<div id=\"LC_helpdesk_sectionlist\">\n".
                          "<select name=\"sectionsel\" id=\"section\">\n".
                        "  <option value=\"\" selected=\"selected\">$html_lt{'sele'}</option>\n";                         "  <option value=\"\" selected=\"selected\">$html_lt{'sele'}</option>\n";
             foreach my $id (sort(keys(%groupid))) {              foreach my $id (sort(keys(%groupid))) {
                 if ($id eq $groupid{$id} || $groupid{$id} eq '') {                  if ($id eq $groupid{$id} || $groupid{$id} eq '') {
Line 548  ENDJS Line 580  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" id="notinuse" size="10" /></div>'."\n";
         } else {          } else {
             $output .= '<input type="text" name="section" size="10" />'."\n";              $output .= '<input type="text" name="section" id="section" size="10" />'."\n";
         }          }
         $output .= &Apache::lonhtmlcommon::row_closure();          $output .= &Apache::lonhtmlcommon::row_closure();
         $num ++;          $num ++;
Line 558  ENDJS Line 590  ENDJS
     }      }
     $output .= &Apache::lonhtmlcommon::row_title(      $output .= &Apache::lonhtmlcommon::row_title(
                    '<span title="'.&mt('required').'">'.                     '<span title="'.&mt('required').'">'.
                    $html_lt{'subj'}.' <span class="LC_info">*</span></span>'                     '<label for="subject">'.$html_lt{'subj'}.'</label>'.
                      '<span class="LC_parm_part">*</span></span>'
                   ,undef,'LC_oddrow_value').                    ,undef,'LC_oddrow_value').
                '<input type="text" size="40" name="subject" />'."\n".                 '<input type="text" size="40" name="subject" id="subject" aria-required="true" />'."\n".
                &Apache::lonhtmlcommon::row_closure().                 &Apache::lonhtmlcommon::row_closure().
                &Apache::lonhtmlcommon::row_title(                 &Apache::lonhtmlcommon::row_title(
                    '<span title="'.&mt('required').'">'.                     '<span title="'.&mt('required').'">'.
                    $html_lt{'detd'}.' <span class="LC_info">*</span></span>'                     '<label for="description">'.$html_lt{'detd'}.'</label>'.
                      '<span class="LC_parm_part">*</span></span>'
                   ,undef,'LC_evenrow_value').                    ,undef,'LC_evenrow_value').
                '<textarea rows="10" cols="45" name="description" style="word-wrap:normal;">'.                 '<textarea rows="10" cols="45" name="description" id="description" style="word-wrap:normal;" aria-required="true">'.
                '</textarea>'."\n".                 '</textarea>'."\n".
                &Apache::lonhtmlcommon::row_closure();                 &Apache::lonhtmlcommon::row_closure();
     $num ++;      $num ++;
Line 582  ENDJS Line 616  ENDJS
                 }                  }
                 $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';                  $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';
                 $output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i])                  $output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i])
                     .' <input type="file" name="screenshot" class="LC_flUpload" size="20" />'                      .'<input type="file" name="screenshot" id="screenshot" class="LC_flUpload" size="20" />'
                     .'<input type="hidden" id="LC_free_space" value="'.$max.'" />'                      .'<input type="hidden" id="LC_free_space" value="'.$max.'" />'
                     .'<br />'."\n".$html_lt{'uplf'}.$showmax."\n"                      .'<br />'."\n".'<label for="screenshot">'.$html_lt{'uplf'}.'</label>'.$showmax."\n"
                     .&Apache::lonhtmlcommon::row_closure();                      .&Apache::lonhtmlcommon::row_closure();
                 $num ++;                  $num ++;
                 $i = $num%2;                  $i = $num%2;
Line 595  ENDJS Line 629  ENDJS
             $output .= &Apache::lonhtmlcommon::row_title(              $output .= &Apache::lonhtmlcommon::row_title(
                            '<span title="'.&mt('required').'">'.                             '<span title="'.&mt('required').'">'.
                            &mt('Validation').                             &mt('Validation').
                            ' <span class="LC_info">*</span></span>'                             '<span class="LC_parm_part">*</span></span>'
                       ,undef,$css[$i]).                        ,undef,$css[$i]).
                        $captcha_form."\n".                         $captcha_form."\n".
                        &Apache::lonhtmlcommon::row_closure();                         &Apache::lonhtmlcommon::row_closure();
Line 605  ENDJS Line 639  ENDJS
     }      }
     $output .= &Apache::lonhtmlcommon::row_title($html_lt{'fini'},undef,$css[$i]);      $output .= &Apache::lonhtmlcommon::row_title($html_lt{'fini'},undef,$css[$i]);
     $output .= <<END;      $output .= <<END;
              <table border="0" cellpadding="8" cellspacing="0">               <div>
               <tr>                 <div class="LC_floatleft" style="padding-top:0, padding-left:8px; padding-right:8px; padding-bottom:0; margin:0">
                <td>  
                 <input type="hidden" name="command" value="process" />                  <input type="hidden" name="command" value="process" />
                 <input type="button" value="$html_lt{'subm'}" onclick="validate()" /> &nbsp;                  <input type="button" value="$html_lt{'subm'}" onclick="validate()" /> &nbsp;
                </td>                 </div>
                <td>&nbsp;</td>                 <div class="LC_floatleft" style="padding-top:0, padding-left:8px; padding-right:8px; padding-bottom:0; margin:0">
                <td>  
                 <input type="reset" value="$html_lt{'clfm'}" />                  <input type="reset" value="$html_lt{'clfm'}" />
                </td>                 </div>
               </tr>               </div>
              </table>               <div style="padding:0;clear:both;margin:0;border:0"></div>
 END  END
     $output .= &Apache::lonhtmlcommon::row_closure(1);      $output .= &Apache::lonhtmlcommon::row_closure(1);
     $output .= &Apache::lonhtmlcommon::end_pick_box();      $output .= &Apache::lonhtmlcommon::end_pick_box();
Line 624  END Line 656  END
 $output  $output
 </form>  </form>
 <br />  <br />
   </div>
 END  END
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return;      return;
Line 632  END Line 665  END
 sub print_request_receipt {  sub print_request_receipt {
     my ($r,$url,$function) = @_;      my ($r,$url,$function) = @_;
     my $public;      my $public;
       my $args;
     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;
     }      }
Line 640  sub print_request_receipt { Line 674  sub print_request_receipt {
         my ($captcha_chk,$captcha_error) =           my ($captcha_chk,$captcha_error) = 
             &Apache::loncommon::captcha_response('login',$lonhost);              &Apache::loncommon::captcha_response('login',$lonhost);
         if ($captcha_chk != 1) {          if ($captcha_chk != 1) {
             $r->print(&Apache::loncommon::start_page('Support request failed',undef,              $args = {
                                        {'function'    => $function,                       'function'    => $function,
                                         'add_entries' => {                       'add_entries' => {
                                             topmargin    => "0",                                           topmargin    => "0",
                                             marginheight => "0",                                           marginheight => "0",
                                         },                                        },
                                         'only_body'   => 1,}));                       'only_body'   => 1,};
               (undef,undef,undef,my $clientmathml,my $clientunicode) =
                   &Apache::loncommon::decode_user_agent();
               if ($clientunicode && !$clientmathml) {
                   $args->{'browser.unicode' => 1};
               }
               $r->print(&Apache::loncommon::start_page('Support request failed',undef,$args));
             if ($r->uri eq '/adm/helpdesk') {              if ($r->uri eq '/adm/helpdesk') {
                 &print_header($r,$url,'process');                  &print_header($r,$url,'process');
             }              }
             $r->print(              $r->print(
                 '<h2>'.&mt('Support request failed').'</h2>'.                  '<div class="LC_landmark" role="main">'.
                   '<h2 class="LC_heading_2">'.&mt('Support request failed').'</h2>'.
                       &Apache::lonhtmlcommon::confirm_success(                        &Apache::lonhtmlcommon::confirm_success(
                         &mt('Validation of the code you entered failed.'),1).                          &mt('Validation of the code you entered failed.'),1).
                 '<br /><br />'.                  '<br /><br />'.
                 &Apache::lonhtmlcommon::actionbox([                  &Apache::lonhtmlcommon::actionbox([
                     &mt('[_1]Go back[_2] and try again',                      &mt('[_1]Go back[_2] and try again',
                         '<a href="javascript:history.go(-1)">','</a>')]).                          '<a href="javascript:history.go(-1)">','</a>')]).
                       &Apache::loncommon::end_page());                  '</div>'.
                   &Apache::loncommon::end_page());
             return;              return;
         }          }
     }      }
     my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');      my $ip = &Apache::lonnet::get_requestor_ip($r);
       my %setters;
       my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
           &Apache::loncommon::blockcheck(\%setters,'com',$ip);
       my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','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;      my @cookievars;
Line 707  sub print_request_receipt { Line 753  sub print_request_receipt {
     unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) {      unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) {
         $formvars{'course'} = 1;          $formvars{'course'} = 1;
     }      }
     unless ($helpform{'cc'} eq 'no') {      unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
         $formvars{'cc'} = 1;          $formvars{'cc'} = 1;
     }      }
     unless ($helpform{'screenshot'} eq 'no') {      unless ($helpform{'screenshot'} eq 'no') {
Line 753  sub print_request_receipt { Line 799  sub print_request_receipt {
                  secn        => 'Section',                   secn        => 'Section',
                  warn        => 'Warning: Problem with support e-mail address',                   warn        => 'Warning: Problem with support e-mail address',
                  your        => 'Your support request contained the following information',                   your        => 'Your support request contained the following information',
                    belo        => 'Below is your support request which could not be sent',
                    ifyk        => 'If you know an IT support address for your institution, you could copy this information and send it to that email address.',
                  sect        => 'section',                   sect        => 'section',
                  info        => 'Information supplied',                   info        => 'Information supplied',
                  adin        => 'Additional information recorded',                   adin        => 'Additional information recorded',
Line 930  $lt{'date'}: $reporttime Line 978  $lt{'date'}: $reporttime
   
     $displaymsg .= '<span class="LC_helpform_receipt_cat">'.      $displaymsg .= '<span class="LC_helpform_receipt_cat">'.
                    $lt{'date'}.'</span>: '.$reporttime.'<br />'."\n";                     $lt{'date'}.'</span>: '.$reporttime.'<br />'."\n";
       my $args = {'function'    => $function,
     my $start_page =                   'add_entries' => {
  &Apache::loncommon::start_page('Support request recorded',undef,                                      topmargin    => "0",
        {'function'    => $function,                                      marginheight => "0",
  'add_entries' => {                                   },
     topmargin    => "0",                  'only_body'   => 1,};
     marginheight => "0",      (undef,undef,undef,my $clientmathml,my $clientunicode) =
  },          &Apache::loncommon::decode_user_agent();
  'only_body'   => 1,});      if ($clientunicode && !$clientmathml) {
           $args->{'browser.unicode'} = 1;
       }
       $r->print(&Apache::loncommon::start_page('Support request recorded',undef,$args));
     $r->print(<<"END");      $r->print(<<"END");
 $start_page  
 <form name="logproblem" action="">  <form name="logproblem" action="">
 <input type="hidden" name="command" value="result" />  <input type="hidden" name="command" value="result" />
 </form>  </form>
Line 981  END Line 1030  END
   
     my $message;      my $message;
     if (!$bad_email) {      if (!$bad_email) {
         $message = &Apache::lonhtmlcommon::confirm_success(          $message = &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>');
             &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>'));  
     } else {      } else {
         $message = &Apache::lonhtmlcommon::confirm_success(          $message = $lt{'warn'}.'<br />';
             $lt{'warn'}.'<br />'          if ($to eq '') {
            .&mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.','<tt>'.$to.'</tt>','<b>','</b>')              $message .= &mt('For this LON-CAPA server no e-mail address has been configured to receive support requests, so your support request has [_1]not[_2] been sent to the LON-CAPA support staff or administrator at your institution.','<b>','</b>');
            .' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1);           } else {
         $to = 'helpdesk@lon-capa.org';              $message .= &mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.','<tt>'.$to.'</tt>','<b>','</b>');
           }
       }
       $r->print('<div class="LC_landmark" role="main">');
       if ($bad_email) {
           $r->print(&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message,$bad_email)).'<br />');
     }      }
     $r->print(&Apache::loncommon::confirmwrapper($message));  
   
     if ($reqemail ne '') {      if ($reqemail ne '') {
         $from = $reqemail;          $from = $reqemail;
     }      }
Line 1071  END Line 1122  END
         foreach my $var(@ENVvars) {          foreach my $var(@ENVvars) {
             $supportmsg .= "$var: $ENV{$var}\n";              $supportmsg .= "$var: $ENV{$var}\n";
         }          }
           $supportmsg .= "REMOTE_ADDR: $ip\n";
         foreach my $var (@envvars) {          foreach my $var (@envvars) {
             $supportmsg .= "$var: $env{$var}\n";              $supportmsg .= "$var: $env{$var}\n";
         }          }
Line 1094  END Line 1146  END
         foreach my $var (@ENVvars) {          foreach my $var (@ENVvars) {
             $attachment_text .= "$var: $ENV{$var}\n";              $attachment_text .= "$var: $ENV{$var}\n";
         }          }
           $attachment_text .= "REMOTE_ADDR: $ip\n";
         foreach my $var (@envvars) {          foreach my $var (@envvars) {
             $attachment_text .= "$var: $env{$var}\n";              $attachment_text .= "$var: $env{$var}\n";
         }          }
Line 1115  END Line 1168  END
         }          }
     }      }
   
     # Compose and send a MIME email      if ($bad_email) {
     &Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc,           $r->print('<b>'.$lt{'belo'}.'</b><br />'.
                                     $attachmentpath, $fname, $attachment_text);                    $lt{'ifyk'}."\n");
       } else {
           # Compose and send a MIME email
           &Apache::loncommon::mime_email($from,'',$to,$subject,$supportmsg,$cc_string,
                                          $bcc,$attachmentpath,$fname,$attachment_text);
           $r->print('<b>'.$lt{'your'}.'</b>:'."\n");
       }
     if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {      if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
         unlink($attachmentpath);          unlink($attachmentpath);
     }      }
     $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");  
     $r->print('<div style="width:620px;">'.      $r->print('<div style="width:620px;">'.
               &Apache::lonhtmlcommon::start_pick_box().                &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".
Line 1141  END Line 1198  END
                        $var.'</span>:&nbsp;'.$ENV{$var}.', ';                         $var.'</span>:&nbsp;'.$ENV{$var}.', ';
         }          }
     }      }
       if ($ip ne '') {
           $envmsg .= '<span class="LC_helpform_receipt_cat">'.
                      'REMOTE_ADDR</span>:&nbsp;'.$ip.', ';
       }
     foreach my $var (@envvars) {      foreach my $var (@envvars) {
         if ($env{$var} ne '') {           if ($env{$var} ne '') { 
             $envmsg .= '<span class="LC_helpform_receipt_cat">'.              $envmsg .= '<span class="LC_helpform_receipt_cat">'.
Line 1151  END Line 1212  END
     $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().                &Apache::lonhtmlcommon::end_pick_box().
               "</div>\n".                '</div>');
       unless ($bad_email) {
           $r->print('<p><br />'.&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message)).'</p>');
       }
       $r->print("</div>\n".
               &Apache::loncommon::end_page());                &Apache::loncommon::end_page());
 }  }
   
Line 1159  sub print_header { Line 1224  sub print_header {
     my ($r,$origurl,$command) = @_;      my ($r,$origurl,$command) = @_;
     my $location=&Apache::loncommon::lonhttpdurl("/adm");      my $location=&Apache::loncommon::lonhttpdurl("/adm");
     my ($component_url);      my ($component_url);
     my $helpdesk_link = '<a href="javascript:validate()">';      my $helpicon_link = '<a href="javascript:validate();" tabindex="-1">';
       if ($command eq 'process') {
           $helpicon_link = '<a href="/adm/helpdesk" tabindex="-1">';
       }
       my $helpdesk_link = '<a href="javascript:validate();">';
     if ($command eq 'process') {      if ($command eq 'process') {
         $helpdesk_link = '<a href="/adm/helpdesk">';          $helpdesk_link = '<a href="/adm/helpdesk">';
     }      }
Line 1175  sub print_header { Line 1244  sub print_header {
                                          );                                           );
     my ($getstartlink,$reviewtext);      my ($getstartlink,$reviewtext);
     if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') {      if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') {
         $getstartlink = qq|<td align="center">&nbsp;<b><a href="/adm/gettingstarted.html">$lt{'getst'}</a></td>|;          $getstartlink = qq|<div class="LC_helpdesk_links LC_nobreak"><div class="LC_helpdesk_img" aria-hidden="true">&nbsp;</div><div class="LC_helpdesk_text"><a href="/adm/gettingstarted.html">$lt{'getst'}</a>&nbsp;</div></div>|;
         $reviewtext = &mt('Please review the information in "Log-in help" and the "Getting started" guide if you are unable to log-in.');          $reviewtext = &mt('Please review the information in "Log-in help" and the "Getting started" guide if you are unable to log-in.');
     } 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.');
Line 1191  sub print_header { Line 1260  sub print_header {
         $loginhelp = '/adm/loginproblems.html';          $loginhelp = '/adm/loginproblems.html';
     }      }
     $r->print(<<"END");      $r->print(<<"END");
 <table width="620" border="0" cellspacing="0" cellpadding="0" style="height: 55px;">  <div class="LC_landmark" style="display: inline-block;" role="navigation">
  <tr>    <div class="LC_helpdesk_headbox">
    <td width="5" height="50">&nbsp;</td>      <h1 class="LC_helpdesk_legend">
    <td height="50">        <img src="$location/lonIcons/minilogo.gif" height="20" width="29" alt="LONCAPA logo" style="vertical-align: middle" />
     <fieldset>        LON-CAPA $lt{'headline'}
       <legend>      </h1>
         <img src="$location/lonIcons/minilogo.gif" height="20" width="29" alt="logo" style="vertical-align:bottom" />      <div style="border:0; padding:0; margin: 1em 0 0.5em;">
         LON-CAPA $lt{'headline'}        <div class="LC_helpdesk_links LC_nobreak"><div class="LC_helpdesk_img" aria-hidden="true">&nbsp;<a href="$loginhelp" tabindex="-1"><img src="$location/help/help.png" border="0" alt="($lt{'login'})" style="vertical-align:middle" />&nbsp;</a></div><div class="LC_helpdesk_text"><a href="$loginhelp">$lt{'login'}</a>&nbsp;</div></div>
       </legend>        <div class="LC_helpdesk_links LC_nobreak"><div class="LC_helpdesk_img" aria-hidden="true">&nbsp;$helpicon_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" style="vertical-align:top" />&nbsp;</a></div><div class="LC_helpdesk_text">$helpdesk_link$lt{'ask'}</a>&nbsp;</div></div>$getstartlink
  <table id="LC_helpmenu_links">        <div class="LC_helpdesk_links LC_nobreak"><div class="LC_helpdesk_img" aria-hidden="true">&nbsp;<a href="$linkback" target="_top" tabindex="-1"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" style="vertical-align:middle" />&nbsp;</a></div><div class="LC_helpdesk_text"><a href="$linkback" target="_top">$lt{'back'}</a>&nbsp;</div></div>
    <tr>      </div>
     <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>    </div>
     <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  </div>
     <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>  
    </tr>  
  </table>  
 </fieldset>  
   </td>  
   <td width="5">&nbsp;</td>  
  </tr>  
  <tr>  
   <td colspan="3" height="5">&nbsp;</td>  
  </tr>  
 END  END
     if  ($command ne 'process') {      if  ($command ne 'process') {
         my $stuwarn = &mt('Do [_1]not[_2] use this form to ask about course content.',          my $stuwarn = &mt('Do [_1]not[_2] use this form to ask about course content.',
                           '<b>','</b>');                            '<b>','</b>');
         $r->print(<<"END");          $r->print(<<"END");
  <tr>   <div style="border:0; padding:0; margin: 0; max-width: 600px;" role="complementary">
   <td colspan="3">$reviewtext     $reviewtext
   $lt{'ifyo'}    $lt{'ifyo'}
 <p class="LC_info">    <p class="LC_info">
 <b>$lt{'stud'}:</b>       <b>$lt{'stud'}:</b> 
 $stuwarn $lt{'cont'}      $stuwarn $lt{'cont'}
 </p><br />    </p>
   </td>   </div>
  </tr>  
 END  END
     }      }
     $r->print('  
 </table>');  
     return;      return;
 }  }
   

Removed from v.1.98  
changed lines
  Added in v.1.108


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