Diff for /loncom/interface/lonsupportreq.pm between versions 1.39 and 1.40

version 1.39, 2006/12/06 22:22:37 version 1.40, 2006/12/12 16:04:40
Line 83  sub print_request_form { Line 83  sub print_request_form {
     $usec = $env{'request.course.sec'};      $usec = $env{'request.course.sec'};
     $cid = $env{'request.course.id'};      $cid = $env{'request.course.id'};
     $formname = 'logproblem';      $formname = 'logproblem';
     if ($origurl =~ m-^http://-) {      my $machine = &Apache::lonnet::absolute_url();
       if ($origurl =~ m-^https?://-) {
         $server = $origurl;          $server = $origurl;
     } else {      } else {
         $server = 'http://'.$ENV{'SERVER_NAME'}.$origurl;          $server = $machine.$origurl;
     }      }
     my $scripttag = (<<'END');      my %lt = &Apache::lonlocal::texthash (
                     email => 'The e-mail address you entered',
                     notv => 'is not a valid e-mail address',
                     rsub => 'You must include a subject',
                     rdes => 'You must include a description',
                     name => 'Name',
                     subm => 'Submit Request',
                     emad => 'E-mail address',
                     unme => 'username',
                     doma => 'domain',
                     entr => 'Enter the username you use to log-in to your LON-CAPA system, and choose your domain.',
                     urlp => 'URL of page',
                     phon => 'Phone',
                     crsd => 'Course Details',
                     enin => 'Enter institutional course code',
                     pick => 'Pick',
                     enct => 'Enter course title',
                     secn => 'Section Number',
                     sele => 'Select',
                     titl => 'Title',
                     lsec => 'LON-CAPA sec',
                     subj => 'Subject',
                     detd => 'Detailed Description',
                     opfi => 'Optional file upload',
                     uplf => 'Upload a file (e.g., a screenshot) relevant to your support request (128 KB max. size)',
                     fini => 'Finish',
                     clfm => 'Clear Form',
       );
       my $scripttag = (<<"END");
 function validate() {  function validate() {
     if (validmail(document.logproblem.email) == false) {      if (validmail(document.logproblem.email) == false) {
         alert("The e-mail address you entered: "+document.logproblem.email.value+" is not a valid e-mail address.");          alert("$lt{'email'}: "+document.logproblem.email.value+" $lt{'notv'}.");
           return;
       }
       if (document.logproblem.subject.value == '') {
           alert("$lt{'rsub'}.");
           return;
       }
       if (document.logproblem.description.value == '') {
           alert("$lt{'rdes'}.");
         return;          return;
     }      }
     document.logproblem.submit();      document.logproblem.submit();
 }  }
   
   END
       $scripttag .= <<'END';
 function validmail(field) {  function validmail(field) {
     var str = field.value;      var str = field.value;
     if (window.RegExp) {      if (window.RegExp) {
Line 120  function validmail(field) { Line 159  function validmail(field) {
 END  END
   
     if ($cid =~ m/_/) {      if ($cid =~ m/_/) {
         ($cdom,$cnum) = split/_/,$cid;          ($cdom,$cnum) = split(/_/,$cid);
     }      }
     if ($cdom && $cnum) {      if ($cdom && $cnum) {
         my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum);          my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum);
Line 140  END Line 179  END
     if ($env{'environment.firstname'}) {      if ($env{'environment.firstname'}) {
         $firstname = $env{'environment.firstname'};          $firstname = $env{'environment.firstname'};
     }      }
     my @sections = split/,/,$sectionlist;      my @sections = split(/,/,$sectionlist);
     my %groupid = ();      my %groupid;
     foreach (@sections) {      foreach my $section (@sections) {
         my ($sec,$grp) = split/:/,$_;          my ($sec,$grp) = split(/:/,$section);
         $groupid{$sec} = $grp;          $groupid{$sec} = $grp;
     }      }
     my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};      my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};
Line 155  END Line 194  END
     if ($codedom) {      if ($codedom) {
         $details_title = '<br />('.$codedom.')';          $details_title = '<br />('.$codedom.')';
     }      }
     my %coursecodes = ();      my %coursecodes;
     my %codes = ();      my %codes;
     my @codetitles = ();      my @codetitles;
     my %cat_titles = ();      my %cat_titles;
     my %cat_order = ();      my %cat_order;
     my %idlist = ();      my %idlist;
     my %idnums = ();      my %idnums;
     my %idlist_titles = ();      my %idlist_titles;
     my $caller = 'global';      my $caller = 'global';
     my $totcodes = 0;      my $totcodes = 0;
     my $format_reply;      my $format_reply;
Line 236  function initialize_codes() { Line 275  function initialize_codes() {
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Name:</b>                 <td align="right"><b>$lt{'name'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 259  END Line 298  END
         $r->print('<input type="text" size="20" name="username" value="'.$fullname.'" />');          $r->print('<input type="text" size="20" name="username" value="'.$fullname.'" />');
     }      }
     $r->print(<<END);      $r->print(<<END);
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Submit Request" onClick="validate()" />&nbsp;                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="$lt{'subm'}" onClick="validate()" />&nbsp;
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 274  END Line 313  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>E-mail address:</b>                 <td align="right"><b>$lt{'emad'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 298  END Line 337  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>username/domain:</b>                 <td align="right"><b>$lt{'unme'}/$lt{'doma'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 311  END Line 350  END
     my $udom_input = '<input type="hidden" name="udom" value="'.$udom.'" />';      my $udom_input = '<input type="hidden" name="udom" value="'.$udom.'" />';
     my $uname_input = '<input type="hidden" name="uname" value="'.$uname.'" />';       my $uname_input = '<input type="hidden" name="uname" value="'.$uname.'" />'; 
     if (defined($uname) && defined($udom)) {      if (defined($uname) && defined($udom)) {
         $r->print('<i>username</i>:&nbsp;'.$uname.'&nbsp;&nbsp;<i>domain</i>:&nbsp;'.$udom.$udom_input.$uname_input);          $r->print('<i>'.$lt{'unme'}.'</i>:&nbsp;'.$uname.'&nbsp;&nbsp;<i>'.$lt{'doma'}.'</i>:&nbsp;'.$udom.$udom_input.$uname_input);
     } else {      } else {
         my $udomform = '';          my $udomform = '';
         my $unameform = '';          my $unameform = '';
         if (defined($udom)) {          if (defined($udom)) {
             $udomform = '<i>domain</i>:&nbsp;'.$udom.$udom_input;              $udomform = '<i>'.$lt{'doma'}.'</i>:&nbsp;'.$udom.$udom_input;
         } elsif (defined($uname)) {          } elsif (defined($uname)) {
             $unameform = '<i>username</i>:&nbsp;'.$uname.'&nbsp;&nbsp;'.$uname_input;              $unameform = '<i>'.$lt{'unme'}.'</i>:&nbsp;'.$uname.'&nbsp;&nbsp;'.$uname_input;
         }          }
         if ($udomform eq '') {          if ($udomform eq '') {
             $udomform = '<i>domain</i>:&nbsp;';              $udomform = '<i>'.$lt{'doma'}.'</i>:&nbsp;';
             $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom');              $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom');
         }          }
         if ($unameform eq '') {          if ($unameform eq '') {
             $unameform= '<i>username</i>:&nbsp;<input type="text" size="12" name="uname" value="'.$uname.'" />&nbsp;&nbsp;';              $unameform= '<i>'.$lt{'unme'}.'</i>:&nbsp;<input type="text" size="12" name="uname" value="'.$uname.'" />&nbsp;&nbsp;';
         }          }
         $r->print($unameform.$udomform.'<br />Enter the username you use to log-in to your LON-CAPA system, and choose your domain.');          $r->print($unameform.$udomform.'<br />'.$lt{'entr'});
     }      }
     $r->print(<<END);      $r->print(<<END);
                </td>                 </td>
Line 344  END Line 383  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>URL of page:</b>                 <td align="right"><b>$lt{'urlp'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 368  END Line 407  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Phone #:</b>                 <td align="right"><b>$lt{'phon'} #:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 392  END Line 431  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Course Details:</b>$details_title                 <td align="right"><b>$lt{'crsd'}:</b>$details_title
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 404  END Line 443  END
 END  END
     if ($cnum) {       if ($cnum) { 
         if ($coursecodes{$cnum}) {          if ($coursecodes{$cnum}) {
             foreach (@codetitles) {              foreach my $item (@codetitles) {
                 $r->print('<i>'.$_.'</i>:&nbsp;'.$codes{$cnum}{$_}.';&nbsp;');                  $r->print('<i>'.$item.'</i>:&nbsp;'.$codes{$cnum}{$item}.';&nbsp;');
             }              }
             $r->print('&nbsp;<input type="hidden" name="coursecode" value="'.$coursecodes{$cnum}.'" />');              $r->print('&nbsp;<input type="hidden" name="coursecode" value="'.$coursecodes{$cnum}.'" />');
         } else {          } else {
             $r->print('Enter institutional course code:&nbsp;              $r->print($lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />');                    <input type="text" name="coursecode" size="15" value="" />');
         }          }
     } else {      } else {
         if ($totcodes > 0) {          if ($totcodes > 0) {
             my $numtitles = @codetitles;              my $numtitles = @codetitles;
             if ($numtitles == 0) {              if ($numtitles == 0) {
                 $r->print('Enter institutional course code:&nbsp;                  $r->print($lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />');                    <input type="text" name="coursecode" size="15" value="" />');
             } else {              } else {
                 my $lasttitle = $numtitles;                  my $lasttitle = $numtitles;
Line 425  END Line 464  END
                 }                   } 
                 $r->print('<table><tr><td>'.$codetitles[0].'<br />'."\n".                  $r->print('<table><tr><td>'.$codetitles[0].'<br />'."\n".
                       '<select name="'.$codetitles[0].'" onChange="courseSet('."'$codetitles[0]'".')">'."\n".                        '<select name="'.$codetitles[0].'" onChange="courseSet('."'$codetitles[0]'".')">'."\n".
                       ' <option value="-1" />Select'."\n");                        ' <option value="-1" />'.$lt{'sele'}."\n");
                 my @items = ();                  my @items = ();
                 my @longitems = ();                  my @longitems = ();
                 if ($idlist{$codetitles[0]} =~ /","/) {                  if ($idlist{$codetitles[0]} =~ /","/) {
                     @items = split/","/,$idlist{$codetitles[0]};                      @items = split(/","/,$idlist{$codetitles[0]});
                 } else {                  } else {
                     $items[0] = $idlist{$codetitles[0]};                      $items[0] = $idlist{$codetitles[0]};
                 }                  }
                 if (defined($idlist_titles{$codetitles[0]})) {                  if (defined($idlist_titles{$codetitles[0]})) {
                     if ($idlist_titles{$codetitles[0]} =~ /","/) {                      if ($idlist_titles{$codetitles[0]} =~ /","/) {
                         @longitems = split/","/,$idlist_titles{$codetitles[0]};                          @longitems = split(/","/,$idlist_titles{$codetitles[0]});
                     } else {                      } else {
                         $longitems[0] = $idlist_titles{$codetitles[0]};                          $longitems[0] = $idlist_titles{$codetitles[0]};
                     }                      }
Line 454  END Line 493  END
                 for (my $i=1; $i<$numtitles; $i++) {                  for (my $i=1; $i<$numtitles; $i++) {
                     $r->print('<td>'.$codetitles[$i].'<br />'."\n".                      $r->print('<td>'.$codetitles[$i].'<br />'."\n".
                      '<select name="'.$codetitles[$i].'" onChange="courseSet('."'$codetitles[$i]'".')">'."\n".                       '<select name="'.$codetitles[$i].'" onChange="courseSet('."'$codetitles[$i]'".')">'."\n".
                      '<option value="-1">&lt;-Pick '.$codetitles[$i-1].'</option>'."\n".                       '<option value="-1">&lt;-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n".
                      '</select>'."\n".                       '</select>'."\n".
                      '</td>'                       '</td>'
                     );                      );
Line 463  END Line 502  END
                 if ($numtitles > 4) {                  if ($numtitles > 4) {
                     $r->print('<br /><br />'.$codetitles[$numtitles].'<br />'."\n".                      $r->print('<br /><br />'.$codetitles[$numtitles].'<br />'."\n".
                           '<select name="'.$codetitles[$numtitles].'" onChange="courseSet('."'$codetitles[$numtitles]'".')">'."\n".                            '<select name="'.$codetitles[$numtitles].'" onChange="courseSet('."'$codetitles[$numtitles]'".')">'."\n".
                           '<option value="-1">&lt;-Pick '.$codetitles[$numtitles-1].'</option>'."\n".                            '<option value="-1">&lt;-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n".
                           '</select>'."\n");                            '</select>'."\n");
                 }                  }
             }              }
         } else {          } else {
             $r->print('Enter institutional course code:&nbsp;              $r->print($lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />');                    <input type="text" name="coursecode" size="15" value="" />');
         }          }
     }      }
     if ($ctitle) {      if ($ctitle) {
         $r->print('<br /><i>Title</i>:&nbsp;'.$ctitle.'<input type="hidden" name="title" value="'.$ctitle.'" />');          $r->print('<br /><i>'.$lt{'titl'}.'</i>:&nbsp;'.$ctitle.'<input type="hidden" name="title" value="'.$ctitle.'" />');
     } else {      } else {
         $r->print('<br />Enter course title:&nbsp;          $r->print('<br />'.$lt{'enct'}.':&nbsp;
                  <input type="text" name="title" size="25" value="" />');                   <input type="text" name="title" size="25" value="" />');
     }      }
     $r->print(<<END);      $r->print(<<END);
Line 493  END Line 532  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Section Number: </b>                 <td align="right"><b>$lt{'secn'}: </b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 505  END Line 544  END
 END  END
     if ($sectionlist) {      if ($sectionlist) {
         $r->print("<select name=\"section\"\n>".          $r->print("<select name=\"section\"\n>".
                   "  <option value=\"\" selected=\"selected\">Select</option>\n");                    "  <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n");
         foreach (sort keys %groupid) {          foreach my $id (sort(keys(%groupid))) {
             if ($_ eq $groupid{$_} || $groupid{$_} eq '') {              if ($id eq $groupid{$id} || $groupid{$id} eq '') {
                 $r->print("  <option value=\"$_\" >$_</option>\n");                  $r->print("  <option value=\"$id\" >$id</option>\n");
             } else {              } else {
                 $r->print("  <option value=\"$_\" >$_ - (LON-CAPA sec: $groupid{$_})</option>\n");                  $r->print("  <option value=\"$id\" >$id - ($lt{'lsec'}: $groupid{$id})</option>\n");
             }              }
         }          }
         $r->print("</select>");          $r->print("</select>");
Line 532  END Line 571  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Subject</b>                 <td align="right"><b>$lt{'subj'}</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 556  END Line 595  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Detailed description:</b>                 <td align="right"><b>$lt{'detd'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 583  END Line 622  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Optional file upload:</b>                 <td align="right"><b>$lt{'opfi'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 592  END Line 631  END
              <table width="100%" border="0" cellpadding="8" cellspacing="0">               <table width="100%" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td>                 <td>
                 <input type="file" name="screenshot" size="20" /><br />Upload a file (e.g., a screenshot) relevant to your support request (128 KB max. size).                  <input type="file" name="screenshot" size="20" /><br />$lt{'uplf'}
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 611  END Line 650  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Finish:</b>                 <td align="right"><b>$lt{'fini'}:</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 621  END Line 660  END
               <tr>                <tr>
                <td>                 <td>
                 <input type="hidden" name="action" value="process" />                  <input type="hidden" name="action" value="process" />
                 <input type="button" value="Submit Request" onClick="validate()"/> &nbsp;                  <input type="button" value="$lt{'subm'}" onClick="validate()"/> &nbsp;
                </td>                 </td>
                <td>&nbsp;</td>                 <td>&nbsp;</td>
                <td>                 <td>
                 <input type="reset" value="Clear Form">                  <input type="reset" value="$lt{'clfm'}">
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 679  sub print_request_receipt { Line 718  sub print_request_receipt {
             $coursecode .= $env{'form.Number'};              $coursecode .= $env{'form.Number'};
         }          }
     }      }
       my %lt = &Apache::lonlocal::texthash (
                    name => 'Name',
                    email => 'Email',
                    unme => 'Username/domain',
                    tel => 'Tel',
                    crsi => 'Course Information',
                    subj => 'Subject',
                    desc => 'Description',
                    date => 'Date/Time',
                    secn => 'Section',
                    asup => 'A support request has been sent to',
                    warn => 'Warning: Problem with support e-mail address',
                    your => 'Your support request contained the following information',
                    sect => 'section',
                    info => 'Information supplied',
                    adin => 'Additional information recorded',
       );
   
     my $supportmsg = qq|      my $supportmsg = qq|
 Name: $env{'form.username'}  $lt{'name'}: $env{'form.username'}
 Email: $env{'form.email'}  $lt{'email'}: $env{'form.email'}
 Username/domain: $env{'form.uname'} - $env{'form.udom'}  $lt{'unme'}: $env{'form.uname'} - $env{'form.udom'}
 Tel: $env{'form.phone'}  $lt{'tel'}: $env{'form.phone'}
 Course Information: $env{'form.title'} - $coursecode - section: $env{'form.section'}  $lt{'crsi'}: env{'form.title'} - $coursecode - $lt{'secn'}: $env{'form.section'}
 Subject: $env{'form.subject'}  $lt{'subj'}: $env{'form.subject'}
 Description: $env{'form.description'}  $lt{'desc'}: $env{'form.description'}
 URL: $env{'form.sourceurl'}  URL: $env{'form.sourceurl'}
 Date/Time: $reporttime  $lt{'date'}: $reporttime
   
     |;      |;
     my $descrip = $env{'form.description'};      my $descrip = $env{'form.description'};
     $descrip =~ s#\n#<br />#g;      $descrip =~ s#\n#<br />#g;
     my $displaymsg = qq|      my $displaymsg = qq|
 <font color="$fontcolor">Name:</font><font color="$vlinkcolor"> $env{'form.username'}</font><br />  <font color="$fontcolor">$lt{'name'}:</font><font color="$vlinkcolor"> $env{'form.username'}</font><br />
 <font color="$fontcolor">Email: </font><font color="$vlinkcolor">$env{'form.email'}</font><br />  <font color="$fontcolor">$lt{'email'}: </font><font color="$vlinkcolor">$env{'form.email'}</font><br />
 <font color="$fontcolor">Username/domain: </font><font color="$vlinkcolor">$env{'form.uname'} - $env{'form.udom'}</font><br />  <font color="$fontcolor">$lt{'unme'}: </font><font color="$vlinkcolor">$env{'form.uname'} - $env{'form.udom'}</font><br />
 <font color="$fontcolor">Tel: </font><font color="$vlinkcolor">$env{'form.phone'}</font><br />  <font color="$fontcolor">$lt{'tel'}: </font><font color="$vlinkcolor">$env{'form.phone'}</font><br />
 <font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$env{'form.title'} - $coursecode - section: $env{'form.section'}</font><br />  <font color="$fontcolor">$lt{'crsi'}: </font><font color="$vlinkcolor">$env{'form.title'} - $coursecode - $lt{'sect'}: $env{'form.section'}</font><br />
 <font color="$fontcolor">Subject: </font><font color="$vlinkcolor">$env{'form.subject'}</font><br />  <font color="$fontcolor">$lt{'subj'}: </font><font color="$vlinkcolor">$env{'form.subject'}</font><br />
 <font color="$fontcolor">Description: </font><font color="$vlinkcolor">$descrip</font><br />  <font color="$fontcolor">$lt{'desc'}: </font><font color="$vlinkcolor">$descrip</font><br />
 <font color="$fontcolor">URL: </font><font color="$vlinkcolor">$env{'form.sourceurl'}</font><br />  <font color="$fontcolor">URL: </font><font color="$vlinkcolor">$env{'form.sourceurl'}</font><br />
 <font color="$fontcolor">Date/Time: </font><font color="$vlinkcolor">$reporttime</font><br />  <font color="$fontcolor">$lt{'date'}: </font><font color="$vlinkcolor">$reporttime</font><br />
     |;      |;
   
     my $start_page =       my $start_page = 
Line 724  END Line 781  END
         &print_header($r,$url,'process');          &print_header($r,$url,'process');
     }      }
     if ($to =~ m/^[^\@]+\@[^\@]+$/) {      if ($to =~ m/^[^\@]+\@[^\@]+$/) {
         $r->print("<h3>A support request has been sent to $to</h3>");          $r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>');
     } else {      } else {
         $to = $admin;          $to = $admin;
         if ($to =~ m/^[^\@]+\@[^\@]+$/) {          if ($to =~ m/^[^\@]+\@[^\@]+$/) {
             $r->print("<h3>A support request has been sent to $to</h3>");              $r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>');
 END  
         } else {          } else {
             $r->print(<<END);              $r->print('
  <h3>Warning: Problem with support e-mail address</h3>   <h3>'.$lt{'warn'}.'</h3>'.
 As the e-mail address provided for this LON-CAPA server ($to) does not appear to be a valid e-mail address, your support request has <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution. Instead a copy has been sent to the LON-CAPA support team at Michigan State University.   &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 <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution.',$to).' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.')); 
 END  
             $to = 'helpdesk@lon-capa.org';              $to = 'helpdesk@lon-capa.org';
         }          }
     }      }
Line 759  END Line 814  END
         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) {
                 $displaymsg .= "<br />The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.";                  $displaymsg .= '<br />'.&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.',$attachmentsize);
             } else {              } else {
                 $attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');                  $attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
             }              }
         }          }
     }      }
   
     my %cookies = ();      my %cookies;
     my $cookie=CGI::Cookie->parse($r->header_in('Cookie'));      my $cookie=CGI::Cookie->parse($r->header_in('Cookie'));
     if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {      if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
         $cookies{'lonID'} = $1;          $cookies{'lonID'} = $1;
Line 774  END Line 829  END
   
     if ($attachmentpath =~ m-/([^/]+)$-) {      if ($attachmentpath =~ m-/([^/]+)$-) {
         $fname = $1;          $fname = $1;
         $displaymsg .= "<br />An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $env{'user.name'} from LON-CAPA domain: $env{'user.domain'}";          $displaymsg .= '<br />'.&mt('An uploaded screenshot file - [_1] ([_2] bytes) was included in the request sent by [_3] from LON-CAPA domain',$fname,$attachmentsize,$env{'user.name'}.': '.$env{'user.domain'});
         $supportmsg .= "\n";          $supportmsg .= "\n";
         foreach (@cookievars) {          foreach my $var (@cookievars) {
             $supportmsg .= "$_: $cookies{$_}\n";              $supportmsg .= "$var: $cookies{$var}\n";
         }          }
         foreach (@ENVvars) {          foreach my $var(@ENVvars) {
             $supportmsg .= "$_: $ENV{$_}\n";              $supportmsg .= "$var: $ENV{$var}\n";
         }          }
         foreach (@envvars) {          foreach my $var (@envvars) {
             $supportmsg .= "$_: $env{$_}\n";              $supportmsg .= "$var: $env{$var}\n";
         }          }
     }      }
     
Line 804  END Line 859  END
   
     } else {      } else {
         my $envdata = '';          my $envdata = '';
         foreach (@cookievars) {          foreach my $var (@cookievars) {
             $envdata .= "$_: $cookies{$_}\n";              $envdata .= "$var: $cookies{$var}\n";
         }          }
         foreach (@ENVvars) {          foreach my $var (@ENVvars) {
             $envdata .= "$_: $ENV{$_}\n";              $envdata .= "$var: $ENV{$var}\n";
         }          }
         foreach (@envvars) {          foreach my $var (@envvars) {
             $envdata .= "$_: $env{$_}\n";              $envdata .= "$var: $env{$var}\n";
         }          }
         foreach (@loncvars) {          foreach my $var (@loncvars) {
             $envdata .= "$_: $env{$_}\n";              $envdata .= "$var: $env{$var}\n";
         }          }
         $msg->attach(Type => 'TEXT',          $msg->attach(Type => 'TEXT',
                      Data => $envdata);                       Data => $envdata);
Line 827  END Line 882  END
         unlink($attachmentpath);          unlink($attachmentpath);
     }      }
     $r->print(qq|      $r->print(qq|
  <b>Your support request contained the following information</b>:<br /><br />   <b>$lt{'your'}</b>:<br /><br />
  <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">   <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
   <tr>    <tr>
    <td>     <td>
Line 842  END Line 897  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Information supplied</b>                 <td align="right"><b>$lt{'info'}</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 864  END Line 919  END
             <td width="140" bgcolor="$tablecolor">              <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">               <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td align="right"><b>Additional information recorded</b>                 <td align="right"><b>$lt{'adin'}</b>
                </td>                 </td>
               </tr>                </tr>
              </table>               </table>
Line 874  END Line 929  END
               <tr>                <tr>
                <td>                 <td>
     |);      |);
     foreach (@cookievars) {      foreach my $var (@cookievars) {
         unless($cookies{$_} eq '') {          unless($cookies{$var} eq '') {
             $r->print("$_:&nbsp;<font color='$vlinkcolor'>$cookies{$_}</font>, ");              $r->print("$var:&nbsp;<font color='$vlinkcolor'>$cookies{$var}</font>, ");
         }          }
     }      }
     foreach (@ENVvars) {      foreach my $var (@ENVvars) {
         unless($ENV{$_} eq '') {          unless($ENV{$var} eq '') {
             $r->print("$_:&nbsp;<font color='$vlinkcolor'>$ENV{$_}</font>, ");              $r->print("$var:&nbsp;<font color='$vlinkcolor'>$ENV{$var}</font>, ");
         }          }
     }      }
     foreach (@envvars) {      foreach my $var (@envvars) {
         unless($env{$_} eq '') {           unless($env{$var} eq '') { 
             $r->print("$_:&nbsp;<font color='$vlinkcolor'>$env{$_}</font>, ");              $r->print("$var:&nbsp;<font color='$vlinkcolor'>$env{$var}</font>, ");
         }          }
     }      }
     $r->print("      $r->print("
Line 944  sub print_header { Line 999  sub print_header {
          <td>           <td>
           <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">            <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
            <tr bgcolor="$tablecolor">             <tr bgcolor="$tablecolor">
             <td align="center"><img src="$location/help/gif/smallHelp.gif" border="0" alt="(Login help)" valign="middle" />&nbsp;<b><a href="/adm/loginproblems.html">$lt{'login'}</a></td>              <td align="center"><img src="$location/help/gif/smallHelp.gif" border="0" alt="($lt{'login'})" valign="middle" />&nbsp;<b><a href="/adm/loginproblems.html">$lt{'login'}</a></td>
             <td align="center">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="(Ask helpdesk)" valign="middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</td>$getstartlink              <td align="center">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" valign="middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</td>$getstartlink
             <td align="center">&nbsp;<b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="(Back to last location)" valign="middle" />&nbsp;$lt{'back'}</a></b>&nbsp;</td>              <td align="center">&nbsp;<b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" valign="middle" />&nbsp;$lt{'back'}</a></b>&nbsp;</td>
            </tr>             </tr>
           </table>            </table>
          </td>           </td>

Removed from v.1.39  
changed lines
  Added in v.1.40


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