[LON-CAPA-cvs] cvs: loncom /interface lonsupportreq.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 31 Dec 2004 02:46:18 -0000


raeburn		Thu Dec 30 21:46:18 2004 EDT

  Modified files:              
    /loncom/interface	lonsupportreq.pm 
  Log:
  Only display 'Getting started guide' link if a file exists at /home/httpd/html/adm/gettingstarted.html.  Also allow 'Back to last location' to point to a different server -- allows linking from an institution's custom LON-CAP help page (e.g., loncapa.msu.edu or help.loncapa.org).
  
  
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.20 loncom/interface/lonsupportreq.pm:1.21
--- loncom/interface/lonsupportreq.pm:1.20	Thu Dec 30 16:16:38 2004
+++ loncom/interface/lonsupportreq.pm	Thu Dec 30 21:46:18 2004
@@ -52,7 +52,11 @@
     $urole = $ENV{'request.role'};
     $usec = $ENV{'request.course.sec'};
     $cid = $ENV{'request.course.id'};
-    $server = $ENV{'SERVER_NAME'};
+    if ($origurl =~ m-^http://-) {
+        $server = $origurl;
+    } else {
+        $server = 'http://'.$ENV{'SERVER_NAME'}.$origurl;
+    }
     my $scripttag = (<<'END');
 function validate() {
     if (validmail(document.logproblem.email) == false) {
@@ -115,6 +119,10 @@
     if (exists($ENV{'form.codedom'})) {
         $codedom = $ENV{'form.codedom'};
     }
+    my $details_title;
+    if ($codedom) {
+        $details_title = '<br />('.$codedom.')';
+    }
     my %coursecodes = ();
     my %codes = ();
     my @codetitles = ();
@@ -298,7 +306,7 @@
              <table width="100%" border="0" cellpadding="8" cellspacing="0">
               <tr>
                <td>
-                http://$server$origurl<input type="hidden" name="sourceurl" value="http://$server$origurl" />
+                $server<input type="hidden" name="sourceurl" value="$server" />
                </td>
               </tr>
              </table>
@@ -337,7 +345,7 @@
             <td width="140" bgcolor="$tablecolor">
              <table width="140" border="0" cellpadding="8" cellspacing="0">
               <tr>
-               <td align="right"><b>Course Details:</b>
+               <td align="right"><b>Course Details:</b>$details_title
                </td>
               </tr>
              </table>
@@ -834,7 +842,12 @@
                                            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>
@@ -851,8 +864,7 @@
           <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
            <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">&nbsp;<b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="(Ask helpdesk)" valign="middle" />&nbsp;$lt{'ask'}</a></b>&nbsp;</td>
-            <td align="center">&nbsp;<b><a href="/adm/gettingstarted.html">$lt{'getst'}</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><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>
            </tr>
           </table>
@@ -877,7 +889,7 @@
         $r->print('
  <tr>
   <td colspan="3">'.&mt('
-Please read the "Log-in help" and "Getting started guide" if you can not 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('Note').':</b> '.&mt('Student questions about course content should be directed to the course instructor').'.</font><br /><br />
+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('Note').':</b> '.&mt('Student questions about course content should be directed to the course instructor').'.</font><br /><br />
   </td>
  </tr>');
     }