Diff for /loncom/interface/lonsupportreq.pm between versions 1.2 and 1.44

version 1.2, 2004/07/03 19:05:12 version 1.44, 2007/09/05 05:46:19
Line 1 Line 1
   #
   # $Id$
   #
   # Copyright Michigan State University Board of Trustees
   #
   # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   #
   # LON-CAPA is free software; you can redistribute it and/or modify
   # it under the terms of the GNU General Public License as published by
   # the Free Software Foundation; either version 2 of the License, or
   # (at your option) any later version.
   #
   # LON-CAPA is distributed in the hope that it will be useful,
   # but WITHOUT ANY WARRANTY; without even the implied warranty of
   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   # GNU General Public License for more details.
   #
   # You should have received a copy of the GNU General Public License
   # along with LON-CAPA; if not, write to the Free Software
   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   #
   # /home/httpd/html/adm/gpl.txt
   #
   # http://www.lon-capa.org/
   #
   
 package Apache::lonsupportreq;  package Apache::lonsupportreq;
   
 use strict;  use strict;
 use lib qw(/home/httpd/lib/perl);  use MIME::Types;
   use MIME::Lite;
   use CGI::Cookie();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonnet();  use Apache::lonhtmlcommon;
 use localenroll;  use Apache::lonnet;
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonacc();
 use Mail::Send;  use Apache::courseclassifier;
 # use MIME::Lite;  use LONCAPA;
 # use MIME::Types;   
   
 sub handler {  sub handler {
     my ($r) = @_;      my ($r) = @_;
Line 20  sub handler { Line 48  sub handler {
     if ($r->header_only) {      if ($r->header_only) {
         return OK;          return OK;
     }      }
       if ($r->uri eq '/adm/helpdesk') {
    &Apache::lonlocal::get_language_handle($r);
       }
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','origurl','function']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['origurl','function']);
     my $action = $ENV{'form.action'};      if ($r->uri eq '/adm/helpdesk') {
     my $function = $ENV{'form.function'};          &Apache::lonacc::get_posted_cgi($r);
     my $origurl = &Apache::lonnet::unescape($ENV{'form.origurl'});      }
     if ($action eq 'process') {      my $function = $env{'form.function'};
       my $origurl = &unescape($env{'form.origurl'});
       my $command = $env{'form.command'};
   
       if ($command eq 'process') {
         &print_request_receipt($r,$origurl,$function);          &print_request_receipt($r,$origurl,$function);
     } else {      } else {
         &print_request_form($r,$origurl,$function);          &print_request_form($r,$origurl,$function);
Line 35  sub handler { Line 70  sub handler {
           
 sub print_request_form {  sub print_request_form {
     my ($r,$origurl,$function) = @_;      my ($r,$origurl,$function) = @_;
     my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server);      my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,$formname);
     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0",marginheight="0"',1);      $function = &Apache::loncommon::get_users_function() if (!$function);
     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');      $ccode = '';
     $os = $ENV{'browser.os'};      $os = $env{'browser.os'};
     $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'};      $uname = $env{'user.name'};
     $udom = $ENV{'user.domain'};      $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'};
     $cid = $ENV{'request.course.id'};      $cid = $env{'request.course.id'};
     $server = $ENV{'SERVER_NAME'};      $formname = 'logproblem';
     my $scripttag;      my $machine = &Apache::lonnet::absolute_url();
     if ($cid =~ m/_/) {      if ($origurl =~ m-^https?://-) {
         ($cdom,$cnum) = split/_/,$cid;          $server = $origurl;
       } else {
           $server = $machine.$origurl;
       }
       my $showserver = $server;
       $showserver =~ s/\?.*$//;
       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',
                     entu => 'Enter the username you use to log-in to LON-CAPA',
                     chdo => 'Choose your LON-CAPA domain',
                     entr => 'Enter the username you use to log-in to LON-CAPA, and 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 help request (128 KB max.)',
                     fini => 'Finish',
                     clfm => 'Clear Form',
       );
       my $scripttag = (<<"END");
   function validate() {
       if (validmail(document.logproblem.email) == false) {
           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;
       }
       document.logproblem.submit();
   }
   
   END
       $scripttag .= &Apache::lonhtmlcommon::javascript_valid_email();
       if ($cid) {
           $cdom = $env{'course.'.$cid.'.domain'};
           $cnum = $env{'course.'.$cid.'.num'};
     }      }
     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 59  sub print_request_form { Line 151  sub print_request_form {
         $ccode = $csettings{'internal.coursecode'};          $ccode = $csettings{'internal.coursecode'};
         $sectionlist = $csettings{'internal.sectionnums'};          $sectionlist = $csettings{'internal.sectionnums'};
     }      }
     if ($ENV{'environment.critnotification'}) {  
         $email = $ENV{'environment.critnotification'};      if ($env{'environment.permanentemail'}) {
     }          $email = $env{'environment.permanentemail'};
     if (!$email && $ENV{'environment.notification'}) {      } elsif ($env{'environment.critnotification'}) {
         $email = $ENV{'environment.notification'};          $email = $env{'environment.critnotification'};
     }      } elsif ($env{'environment.notification'}) {
     if ($ENV{'environment.lastname'}) {          $email = $env{'environment.notification'};
         $lastname = $ENV{'environment.lastname'};      }
     }      if ($env{'environment.lastname'}) {
     if ($ENV{'environment.firstname'}) {          $lastname = $env{'environment.lastname'};
         $firstname = $ENV{'environment.firstname'};      }
     }      if ($env{'environment.firstname'}) {
     my @sections = split/,/,$sectionlist;          $firstname = $env{'environment.firstname'};
     my %groupid = ();      }
     foreach (@sections) {      my @sections = split(/,/,$sectionlist);
         my ($sec,$grp) = split/:/,$_;      my %groupid;
       foreach my $section (@sections) {
           my ($sec,$grp) = split(/:/,$section);
         $groupid{$sec} = $grp;          $groupid{$sec} = $grp;
     }      }
     $r->print(<<END);      my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};
 <html>      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']);
  <head>      if (exists($env{'form.codedom'})) {
   <title>LON-CAPA support request</title>          $codedom = $env{'form.codedom'};
 END      }
     my $defdom = $Apache::lonnet::perlvar{'lonDefDomain'};      my $details_title;
     my $codedom = $defdom;      if ($codedom) {
     my %coursecodes = ();          $details_title = '<br />('.$codedom.')';
     my %codes = ();      }
     my @codetitles = ();      my %coursecodes;
     my %cat_titles = ();      my %codes;
     my %cat_order = ();      my @codetitles;
       my %cat_titles;
       my %cat_order;
       my %idlist;
       my %idnums;
       my %idlist_titles;
     my $caller = 'global';      my $caller = 'global';
     my $totcodes = 0;      my $totcodes = 0;
     my $format_reply;      my $format_reply;
           my $jscript = '';
       my $loaditems = qq|
   function initialize_codes() {
       return;
   }
       |;
     if ($cdom) {      if ($cdom) {
         $codedom = $cdom;          $codedom = $cdom;
     }      }
     if ($cnum) {      if ($cnum) {
         $coursecodes{$cnum} = $ccode;          $coursecodes{$cnum} = $ccode;
         if ($ccode eq '') {          if ($ccode eq '') {
             $totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes);              $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
         } else {          } else {
             $coursecodes{$cnum} = $ccode;              $coursecodes{$cnum} = $ccode;
             $caller = $cnum;              $caller = $cnum;
             $totcodes ++;              $totcodes ++;
         }          }
     } else {       } else { 
         $totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes);          $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
     }      }
     if ($totcodes > 0) {      if ($totcodes > 0) {
         $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);          if ($ccode eq '') {
               $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
               if ($format_reply eq 'ok') {
                   my $numtypes = @codetitles;
                   &Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
                   my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
                   my $longtitles_str = join('","',@{$longtitles});
                   my $allidlist = $idlist{$codetitles[0]};
                   $jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist);
                   $jscript .= $scripttext;
                   $jscript .= &Apache::courseclassifier::javascript_code_selections($formname,@codetitles);
                   $loaditems = '';
               }
           }
     }      }
     $r->print(<<END);  
 <html>      my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n".
 <head>   '</script>';
  <title>LON-CAPA support request</title>      my %add_entries = (topmargin    => "0",
 $scripttag         marginheight => "0",
 </head>         onLoad       =>"initialize_codes()",);
 $bodytag  
  <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">      
   <tr>      $r->print(&Apache::loncommon::start_page('Support Request',$js,
    <td>         { 'function'    => $function,
     <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">   'add_entries' => \%add_entries,
      <tr>   'only_body'   => 1,}));
       <td>      if ($r->uri eq '/adm/helpdesk') {
        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">          &print_header($r,$origurl);
         <tr>      }
          <td>      $r->print('<form method="post" name="logproblem" enctype="multipart/form-data">'."\n");
   <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">      my $output = &Apache::lonhtmlcommon::start_pick_box().
            <form method="post" name="logproblem" onSubmit="return validate()">                   &Apache::lonhtmlcommon::row_title($lt{'name'},undef,'LC_oddrow_value')."\n";
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Name:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
 END  
     my $fullname = '';      my $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"; 
         $r->print("$fullname<input type=\"hidden\" name=\"username\" value=\"$fullname\" />");          $output .= $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />';
     } 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";
         }          }
         $r->print('<input type="text" size="20" name="username" value="'.$fullname.'" /><br />');          $output .= '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />';
     }      }
     $r->print(<<END);      $output .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$lt{'subm'}.'" onclick="validate()" />&nbsp;'.
                </td>                  &Apache::lonhtmlcommon::row_closure()."\n".
               </tr>                  &Apache::lonhtmlcommon::row_title($lt{'emad'},undef,'LC_evenrow_value').
              </table>                  '<input type="text" size="20" name="email" value="'.
             </td>                  &HTML::Entities::encode($email,'"<>&').'" /><br />'."\n".
            </tr>                  &Apache::lonhtmlcommon::row_closure().
            <tr>                  &Apache::lonhtmlcommon::row_title("$lt{'unme'}/$lt{'doma'}",undef,'LC_oddrow_value');
             <td width="100%" colspan="2" bgcolor="#000000">      my $udom_input = '<input type="hidden" name="udom" value="'.
              <img src="/adm/lonMisc/blackdot.jpg" /><br />                       &HTML::Entities::encode($udom,'"<>&').'" />';
             </td>      my $uname_input = '<input type="hidden" name="uname" value="'.
            </tr>                        &HTML::Entities::encode($uname,'"<>&').'" />'; 
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>E-mail address:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
                 <input type="text" size="20" name="email" value="$email" /><br />  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
             <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
             </td>  
            </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>username/domain:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
 END  
     my $udom_input = '<input type="hidden" name="udom" value="'.$udom.'" />';  
     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);          $output .= '<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;              $output .= $lt{'entu'};
         } elsif (defined($uname)) {          } elsif (defined($uname)) {
             $unameform = '<i>username</i>:&nbsp;'.$uname.'&nbsp;&nbsp;'.$uname_input;              $output .= $lt{'chdo'};
           } else {
               $output .= $lt{'entr'};
           }
           $output .= '<br />';
           if (defined($udom)) {
               $udomform = '<i>'.$lt{'doma'}.'</i>:&nbsp;'.$udom.$udom_input;
           } elsif (defined($uname)) {
               $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('','udom');              $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom');
         }          }
         if ($unameform eq '') {          if ($unameform eq '') {
             $unameform= '<i>username</i>:&nbsp;<input type="text" size="20" name="loncname" 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.');          $output .= $unameform.$udomform;
     }      }
     $r->print(<<END);      $output .= &Apache::lonhtmlcommon::row_closure().
                </td>                 &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,'LC_evenrow_value').
               </tr>                 $showserver.'<input type="hidden" name="sourceurl" value="'.
              </table>                 &HTML::Entities::encode($server,'"<>&').'" />'.
             </td>                 &Apache::lonhtmlcommon::row_closure().
            </tr>                 &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_oddrow_value').
            <tr>                 '<input type="text" size="15" name="phone" /><br />'.
             <td width="100%" colspan="2" bgcolor="#000000">                 &Apache::lonhtmlcommon::row_closure().
              <img src="/adm/lonMisc/blackdot.jpg" /><br />                 &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,'LC_evenrow_value');
             </td>      if ($cnum) { 
            </tr>          if ($coursecodes{$cnum}) {
            <tr>              foreach my $item (@codetitles) {
             <td width="140" bgcolor="$tablecolor">                  $output .= '<i>'.$item.'</i>:&nbsp;'.$codes{$cnum}{$item}.';&nbsp;';
              <table width="140" border="0" cellpadding="8" cellspacing="0">              }
               <tr>              $output .= '&nbsp;<input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />';
                <td align="right"><b>URL of page:</b>          } else {
                </td>              $output .= $lt{'enin'}.':&nbsp;
               </tr>                    <input type="text" name="coursecode" size="15" value="" />';
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
                 $server$origurl<input type="hidden" name="origurl" value="$server$origurl" />  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
             <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
             </td>  
            </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Phone #:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
                 <input type="text" size="15" name="phone"><br>  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
             <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
             </td>  
            </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Course Details:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table border="0" cellpadding="3" cellspacing="3">  
               <tr>  
                <td>  
 END  
     if ($coursecodes{$cnum}) {  
         foreach (@codetitles) {  
             $r->print('<i>'.$_.'</i>:&nbsp;'.$codes{$cnum}{$_});  
         }          }
         $r->print('.&nbsp;<input type="hidden" name="coursecode" value="'.$coursecodes{$cnum}.'" />');  
     } else {      } else {
         $r->print('Enter institutional course code:&nbsp;          if ($totcodes > 0) {
                   <input type="text" name="coursecode" size="15" value="" />');              my $numtitles = @codetitles;
               if ($numtitles == 0) {
                   $output .= $lt{'enin'}.':&nbsp;
                     <input type="text" name="coursecode" size="15" value="" />';
               } else {
                   my $lasttitle = $numtitles;
                   if ($numtitles > 4) {
                       $lasttitle = 4;
                   } 
                   $output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n".
                         '<select name="'.$codetitles[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n".
                         ' <option value="-1" />'.$lt{'sele'}."\n";
                   my @items = ();
                   my @longitems = ();
                   if ($idlist{$codetitles[0]} =~ /","/) {
                       @items = split(/","/,$idlist{$codetitles[0]});
                   } else {
                       $items[0] = $idlist{$codetitles[0]};
                   }
                   if (defined($idlist_titles{$codetitles[0]})) {
                       if ($idlist_titles{$codetitles[0]} =~ /","/) {
                           @longitems = split(/","/,$idlist_titles{$codetitles[0]});
                       } else {
                           $longitems[0] = $idlist_titles{$codetitles[0]};
                       }
                       for (my $i=0; $i<@longitems; $i++) {
                           if ($longitems[$i] eq '') {
                               $longitems[$i] = $items[$i];
                           }
                       }
                   } else {
                       @longitems = @items;
                   }
                   for (my $i=0; $i<@items; $i++) {
                       $output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n";
                   }
                   $output .= '</select></td>';
                   for (my $i=1; $i<$numtitles; $i++) {
                       $output .= '<td>'.$codetitles[$i].'<br />'."\n".
                        '<select name="'.$codetitles[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n".
                        '<option value="-1">&lt;-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n".
                        '</select>'."\n".
                        '</td>'."\n";
                   }
                   $output .= '</tr></table>';
                   if ($numtitles > 4) {
                       $output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n".
                             '<select name="'.$codetitles[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n".
                             '<option value="-1">&lt;-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n".
                             '</select>'."\n";
                   }
               }
           } else {
               $output .= $lt{'enin'}.':&nbsp;
                     <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.'" />');          $output .= '<br /><i>'.$lt{'titl'}.'</i>:&nbsp;'.$ctitle.
                      '<input type="hidden" name="title" value="'.
                      &HTML::Entities::encode($ctitle,'"<>&').'" />'."\n";
     } else {      } else {
         $r->print('<br />Enter course title:&nbsp;          $output .= '<br />'.$lt{'enct'}.':&nbsp;
                  <input type="text" name="title" size="15" value="" />');                   <input type="text" name="title" size="25" value="" />'."\n";
     }      }
     $r->print(<<END);      $output .= &Apache::lonhtmlcommon::row_closure().
                </td>                 &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,'LC_oddrow_value');
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
             <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
             </td>  
            </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Section Number: </b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
 END  
     if ($sectionlist) {      if ($sectionlist) {
         $r->print("<select name=\"section\">");          $output .= "<select name=\"section\"\n>".
         foreach (sort keys %groupid) {                     "  <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n";
             if ($_ eq $groupid{$_} || $groupid{$_} eq '') {          foreach my $id (sort(keys(%groupid))) {
                 $r->print("<option value=\"$_\" />$_");              if ($id eq $groupid{$id} || $groupid{$id} eq '') {
                   $output .= "  <option value=".
                              &HTML::Entities::encode($id,'"<>&').
                              " >$id</option>\n";
             } else {              } else {
                 $r->print("<option value=\"$_\" />$_ - (LON-CAPA sec: $groupid{$_}");                  $output .= "  <option value=".
                              &HTML::Entities::encode($id,'"<>&').
                              " >$id - ($lt{'lsec'}: $groupid{$id})</option>\n";
             }              }
         }          }
         $r->print("</select>");          $output .= "</select>";
     } else {      } else {
         $r->print("<input type=\"text\" name=\"section\" size=\"10\"/>");          $output .= '<input type="text" name="section" size="10" />';
     }      }
     $r->print(<<END);      $output .= &Apache::lonhtmlcommon::row_closure().
                </td>                 &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_evenrow_value').
               </tr>                 '  <input type="text" size="40" name="subject" />'."\n".
              </table>                 &Apache::lonhtmlcommon::row_closure().
             </td>                 &Apache::lonhtmlcommon::row_title($lt{'detd'},undef,'LC_oddrow_value').
            </tr>                 '  <textarea rows="10" cols="45" name="description" wrap="virtual"></textarea>'.
            <tr>                 &Apache::lonhtmlcommon::row_closure();
             <td width="100%" colspan="2" bgcolor="#000000">      my $lastrow = 'LC_evenrow_value';
              <img src="/adm/lonMisc/blackdot.jpg" /><br />      if (defined($env{'user.name'})) {
             </td>          $output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,'LC_evenrow_value').
            </tr>                     ' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n".
            <tr>          &Apache::lonhtmlcommon::row_closure();
             <td width="140" bgcolor="$tablecolor">          $lastrow = 'LC_oddrow_value';
              <table width="140" border="0" cellpadding="8" cellspacing="0">      }
               <tr>      $output .= &Apache::lonhtmlcommon::row_title($lt{'fini'},undef,$lastrow);
                <td align="right"><b>Subject</b>      $output .= <<END;
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
                 <input type="text" size="40" name="subject">  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
             <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
             </td>  
            </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Detailed description:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
                 <textarea rows="10" cols="45" name="description" wrap="virtual"></textarea>  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
            <tr>  
     <td width="100%" colspan="2" bgcolor="#000000">  
              <img src="/adm/lonMisc/blackdot.jpg" /><br />  
     </td>  
    </tr>  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Finish:</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table border="0" cellpadding="8" cellspacing="0">               <table border="0" cellpadding="8" cellspacing="0">
               <tr>                <tr>
                <td>                 <td>
                 <input type="hidden" name="action" value="process" />                  <input type="hidden" name="command" value="process" />
                 <input type="submit" value="Submit Request Form" /> &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>
             </td>  
            </tr>  
           </table>  
          </td>  
         </tr>  
        </table>  
       </td>  
      </tr>  
     </table>  
    </td>  
   </tr>  
  </table>  
 END  END
       $output .= &Apache::lonhtmlcommon::row_closure(1);
       $output .= &Apache::lonhtmlcommon::end_pick_box();
 # What do we know about this user?      $r->print(<<END);
 #    foreach (sort keys %ENV) {  $output
 #        if ($_ =~ m/^browser/) {  </form>
 #            $r->print("key is $_, value is $ENV{$_}");  <br />
 #        } elsif ($_ =~ m/^environment/) {  END
 #            $r->print("key is $_, value is $ENV{$_}");      $r->print(&Apache::loncommon::end_page());
 #        } elsif ($_ =~ m/^request/) {      return;
 #            $r->print("key is $_, value is $ENV{$_}");  
 #        } elsif ($_ =~ m/^user\.(domain|home|name)/) {  
 #            $r->print("key is $_, value is $ENV{$_}");  
 #        } elsif ($_ =~ /^[A-Z]/) {  
 #            $r->print("key is $_, value is $ENV{$_}");  
 #        }  
 #    }  
     return  
 }  }
   
 sub print_request_receipt {  sub print_request_receipt {
     my ($r,$url,$function) = @_;      my ($r,$url,$function) = @_;
     my @envvars = ('lonID','HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME','browser.os','browser.type','browser.version','user.home','request.role');      my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);      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 @cookievars = ('lonID');
   
       my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
     my $to =  $Apache::lonnet::perlvar{'lonSupportEMail'};      my $to =  $Apache::lonnet::perlvar{'lonSupportEMail'};
       my $from = $admin;
     my $reporttime = &Apache::lonlocal::locallocaltime(time);      my $reporttime = &Apache::lonlocal::locallocaltime(time);
     my $fontcolor = &Apache::loncommon::designparm($function.'.font');      my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
     my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');  
     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');  
     my @formvars = ('username','email','uname','udom','origurl','phone','section','coursecode','title','subject','description');  
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);  
   
 #    if ($ENV{'request.course.fn'}) {      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
 #        my $formdatafile = $ENV{'request.course.fn'}.'.formdata';      my $coursecode = $env{'form.coursecode'};
 #        if (-e $formdatafile) {      if ($coursecode eq '') {
 #            open(FILE,"<$formdatafile");          if (defined($env{'form.Year'})) {
 #            my @buffer =<FILE>;              $coursecode .= $env{'form.Year'};
 #            close(FILE);          }
 #            foreach (@buffer) {          if (defined($env{'form.Semester'})) {
 #                print STDERR $_;              $coursecode .= $env{'form.Semester'};
 #            }           }
 #        }          if (defined($env{'form.Department'})) {
 #    }              $coursecode .= $env{'form.Department'};
           }
     my $supportmsg = qq|          if (defined($env{'form.Number'})) {
 Name: $ENV{'form.username'}              $coursecode .= $env{'form.Number'};
 Email: $ENV{'form.email'}          }
 Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'}      }
 Tel: $ENV{'form.phone'}      my %lt = &Apache::lonlocal::texthash (
 Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}                   username    => 'Name',
 Subject: $ENV{'form.subject'}                   email       => 'Email',
 Description: $ENV{'form.description'}                   user        => 'Username/domain',
 URL: $ENV{'form.origurl'}                   phone       => 'Phone',
 Date/Time: $reporttime                   crsi        => 'Course Information',
                    subject     => 'Subject',
                    description => 'Description',
                    sourceurl   => 'URL',
                    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',
       );
    
       $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
       $env{'form.csri'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'};
       my $supportmsg = <<END;
   $lt{'username'}: $env{'form.username'}
   $lt{'email'}: $env{'form.email'}
   $lt{'user'}: $env{'form.user'}
   $lt{'phone'}: $env{'form.phone'}
   $lt{'crsi'}: $env{'form.csri'}
   $lt{'subject'}: $env{'form.subject'}
   $lt{'description'}: $env{'form.description'}
   $lt{'sourceurl'}: $env{'form.sourceurl'}
   $lt{'date'}: $reporttime
   
     |;  
     if ($to =~ m/^[^\@]+\@[^\@]+$/) {  
         $r->print(<<END);  
 <html>  
 <head>  
  <title>LON-CAPA support request recorded</title>  
 </head>  
 $bodytag  
  <h3>A support request has been sent to $to</h3>  
 END  END
     } else {       my $displaymsg;
         $to = 'helpdesk@lon-capa.org';      foreach my $item ('username','email','user','phone','crsi','subject','description','sourceurl') {
         $r->print(<<END);          if ($env{'form.'.$item} ne '') {
 <html>              if ($item eq 'description') {
 <head>                  my $descrip = $env{'form.description'};
  <title>LON-CAPA support request recorded</title>                  $descrip =~ s|\n|<br />|g;
 </head>                  $displaymsg .= 
 $bodytag                      '<span class="LC_helpform_receipt_cat">'.
  <h3>Warning: Problem with support e-mail address</h3>                      "$lt{$item}</span>: $descrip<br />\n";
 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 not been sent to the LON-CAPA support staff at your institution. Instead a copy has been sent to the LON-CAPA support team at Michigan State University.               } elsif ($item eq 'sourceurl') {
                   my $showurl = $env{'form.sourceurl'};
                   $showurl =~ s/\?.*$//;
                   $displaymsg .= 
                       '<span class="LC_helpform_receipt_cat">'.
                       "$lt{$item}</span>: $showurl<br />\n";
               } else {
                   $displaymsg .= 
                       '<span class="LC_helpform_receipt_cat">'.
                       "$lt{$item}</span>: $env{'form.'.$item}<br />\n";
               }
           }
       }
       $displaymsg .= '<span class="LC_helpform_receipt_cat">'.
                      $lt{'date'}.'</span>: '.$reporttime.'<br />'."\n";
   
       my $start_page = 
    &Apache::loncommon::start_page('Support request recorded',undef,
          {'function'    => $function,
    'add_entries' => {
       topmargin    => "0",
       marginheight => "0",
    },
    'only_body'   => 1,});
   
       $r->print(<<"END");
   $start_page
   <form name="logproblem">
   <input type="hidden" name="command" value="result" />
   </form>
 END  END
       if ($r->uri eq '/adm/helpdesk') {
           &print_header($r,$url,'process');
     }      }
     my $msg = new Mail::Send;      if ($to =~ m/^[^\@]+\@[^\@]+$/) {
     $msg->to($to);          $r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>');
 #    if (defined($ENV{'form.email'})) {      } else {
 #        if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {          $to = $admin;
 #            $msg->from($ENV{'form.email'});          if ($to =~ m/^[^\@]+\@[^\@]+$/) {
 #        }              $r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>');
 #    }          } else {
     $msg->subject('[LON-CAPA] - support request');              $r->print('
     if (my $fh = $msg->open()) {   <h3>'.$lt{'warn'}.'</h3>'.
         print $fh $supportmsg;  &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.')); 
         $fh->close;              $to = 'helpdesk@lon-capa.org';
           }
     }      }
     $r->print(<<END);      if (defined($env{'form.email'})) {
  <b>Your support request contained the following information</b>:<br /><br />          if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
  <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">              $from = $env{'form.email'};
   <tr>          }
    <td>  
     <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">  
      <tr>  
       <td>  
        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">  
         <tr>  
          <td>  
           <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">  
            <tr>  
             <td width="140" bgcolor="$tablecolor">  
              <table width="140" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td align="right"><b>Information supplied</b>  
                </td>  
               </tr>  
              </table>  
             </td>  
             <td width="100%" valign="top">  
              <table width="100%" border="0" cellpadding="8" cellspacing="0">  
               <tr>  
                <td>  
 END  
     my @textmsg = split/\n/,$supportmsg;  
     foreach my $line (@textmsg) {  
         $line =~ s|^|<font color="$fontcolor">|;  
         $line =~ s|:|:</font><font color="$vlinkcolor">|;  
         $r->print("$line</font><br />");  
     }      }
     $r->print('</td>  
               </tr>      my $subject = $env{'form.subject'};
              </table>      $subject =~ s/(`)/'/g;
             </td>      $subject =~ s/\$/\(\$\)/g;
            </tr>      $supportmsg =~ s/(`)/'/g;
            <tr>      $supportmsg =~ s/\$/\(\$\)/g;
             <td width="130" bgcolor="'.$tablecolor.'">      $displaymsg =~ s/(`)/'/g;
              <table width="130" border="0" cellpadding="8" cellspacing="0">      $displaymsg =~ s/\$/\(\$\)/g;
               <tr>      my $fname;
                <td align="right"><b>Additional information recorded</b>  
                </td>      my $attachmentpath = '';
               </tr>      my $attachmentsize = '';
              </table>      if (defined($env{'user.name'})) {
             </td>          if ($env{'form.screenshot.filename'}) {
             <td width="100%" valign="top">              $attachmentsize = length($env{'form.screenshot'});
              <table width="100%" border="0" cellpadding="8" cellspacing="0">              if ($attachmentsize > 131072) {
               <tr>                  $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);
                <td>              } else {
     ');                  $attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
     foreach (@envvars) {              }
         $r->print("$_:&nbsp;<font color='$vlinkcolor>$ENV{$_}</font>, ");          }
         $supportmsg .= "$_: $ENV{$_}\n";  
     }      }
     $r->print("  
                </td>  
               </tr>  
              </table>  
             </td>  
            </tr>  
           </table>  
          </td>  
         </tr>  
        </table>  
       </td>  
      </tr>  
     </table>  
    </td>  
   </tr>  
  </table>  
     ");  
 }  
   
 sub retrieve_instcodes {      my %cookies;
     my ($coursecodes,$codedom,$totcodes) = @_;      my $cookie=CGI::Cookie->parse($r->header_in('Cookie'));
     my %courses = &Apache::lonnet::courseiddump($codedom,'.',1);      if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
     foreach my $course (keys %courses) {          $cookies{'lonID'} = $1;
         if ($courses{$course} =~ m/^[^:]*:([^:]+)$/) {      }
             $$coursecodes{$course} = &Apache::lonnet::unescape($1);  
             $totcodes ++;      if ($attachmentpath =~ m-/([^/]+)$-) {
           $fname = $1;
           $displaymsg .= '<br />'.&mt('An uploaded screenshot file \'[_1]\' ([_2] bytes) was included in the request sent by [_3].',$fname,$attachmentsize,$env{'user.name'}.': '.$env{'user.domain'});
           $supportmsg .= "\n";
           foreach my $var (@cookievars) {
               $supportmsg .= "$var: $cookies{$var}\n";
           }
           foreach my $var(@ENVvars) {
               $supportmsg .= "$var: $ENV{$var}\n";
           }
           foreach my $var (@envvars) {
               $supportmsg .= "$var: $env{$var}\n";
           }
       }
    
       my $msg = MIME::Lite->new(
                    From    => $from,
                    To      => $to,
                    Subject => $subject,
                    Type    =>'TEXT',
                    Data    => $supportmsg,
                    );
   
       if ($attachmentpath) {
           my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
           $msg->attach(Type     => $type,
                        Path     => $attachmentpath,
                        Filename => $fname
                        );
   
       } else {
           my $envdata = '';
           foreach my $var (@cookievars) {
               $envdata .= "$var: $cookies{$var}\n";
           }
           foreach my $var (@ENVvars) {
               $envdata .= "$var: $ENV{$var}\n";
           }
           foreach my $var (@envvars) {
               $envdata .= "$var: $env{$var}\n";
           }
           foreach my $var (@loncvars) {
               $envdata .= "$var: $env{$var}\n";
           }
           $msg->attach(Type => 'TEXT',
                        Data => $envdata);
       }
   
   ### Send it:
       $msg->send('sendmail');
   
       if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
           unlink($attachmentpath);
       }
       $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");
       $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_helpform_receipt').
                 &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".
                 &Apache::lonhtmlcommon::row_closure().
                 &Apache::lonhtmlcommon::row_title($lt{'adin'},undef,'LC_evenrow_value'));
       my $envmsg;
       foreach my $var (@cookievars) {
           if ($cookies{$var} ne '') {
               $envmsg.= '<span class="LC_helpform_receipt_cat">'.
                         $var.'</span>:&nbsp;'.$cookies{$var}.', ';
           }
       }
       foreach my $var (@ENVvars) {
           if ($ENV{$var} ne '') {
               $envmsg .= '<span class="LC_helpform_receipt_cat">'.
                          $var.'</span>:&nbsp;'.$ENV{$var}.', ';
         }          }
     }      }
     return $totcodes;      foreach my $var (@envvars) {
           if ($env{$var} ne '') { 
               $envmsg .= '<span class="LC_helpform_receipt_cat">'.
                          $var.'</span>:&nbsp;'.$env{$var}.', ';
           }
       }
       $envmsg =~ s/, $//;
       $r->print($envmsg."\n".
                 &Apache::lonhtmlcommon::row_closure(1)."\n".
                 &Apache::lonhtmlcommon::end_pick_box()."\n".
                 &Apache::loncommon::end_page());
   }
   
   sub print_header {
       my ($r,$origurl,$command) = @_;
       my $location=&Apache::loncommon::lonhttpdurl("/adm");
       my ($component_url);
       my $helpdesk_link = '<a href="javascript:validate()">';
       if ($command eq 'process') {
           $helpdesk_link = '<a href="/adm/helpdesk">';
       }
       my %lt = &Apache::lonlocal::texthash (
                                              login => 'Log-in help',
                                              ask   => 'Ask helpdesk',
                                              getst => 'Getting started guide',
                                              back =>  'Back to last location'
                                            );
       my ($getstartlink,$getstarttext);
       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>|;
           $getstarttext = ' '.&mt('and the "Getting started" guide').' ';
       }
       $r->print(<<END);
   <table width="620" border="0" cellspacing="0" cellpadding="0" height="55">   <tr height="50">    <td width='5'>&nbsp;</td>
      <td>
       <fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' />&nbsp;&nbsp;<b><font size="+1">LON-CAPA help/support</font></b></legend>
    <table id="LC_helpmenu_links">
      <tr>
       <td align="center"><span class="LC_nobreak"><img src="$location/help/gif/smallHelp.gif" 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">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" valign="middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</span></td>$getstartlink
       <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'})" valign="middle" />&nbsp;$lt{'back'}</a></b>&nbsp;</span></td>
      </tr>
    </table>
   </fieldset>
     </td>
     <td width='5'>&nbsp;</td>
    </tr>
    <tr height='5'>
     <td colspan='3' height='5'>&nbsp;</td>
    </tr>
   END
       if  ($command ne 'process') {
           $r->print('
    <tr>
     <td colspan="3">'.&mt('
   Please review the information in "Log-in help"').$getstarttext.' '.&mt('if you are unable to log-in').'.  '.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk').'.<br /><font size="-1"><b>'.&mt('Students').'</b>: '.&mt('Do <b>not</b> use this form to ask questions about course content.').' '.&mt('Contact your instructor instead.').'</font><br /><br />
     </td>
    </tr>');
       }
       $r->print('
   </table>');
       return;
 }  }
   
 1;  1;

Removed from v.1.2  
changed lines
  Added in v.1.44


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