Annotation of loncom/interface/lonhelpmenu.pm, revision 1.6

1.1       raeburn     1: # The LearningOnline Network with CAPA
                      2: # generate frame-based help system
                      3: #
                      4: # Copyright Michigan State University Board of Trustees
                      5: #
                      6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      7: #
                      8: # LON-CAPA is free software; you can redistribute it and/or modify
                      9: # it under the terms of the GNU General Public License as published by
                     10: # the Free Software Foundation; either version 2 of the License, or
                     11: # (at your option) any later version.
                     12: #
                     13: # LON-CAPA is distributed in the hope that it will be useful,
                     14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: # GNU General Public License for more details.
                     17: #
                     18: # You should have received a copy of the GNU General Public License
                     19: # along with LON-CAPA; if not, write to the Free Software
                     20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     21: #
                     22: # /home/httpd/html/adm/gpl.txt
                     23: #
                     24: # http://www.lon-capa.org/
                     25: #
                     26: 
                     27: package Apache::lonhelpmenu;
                     28: 
                     29: use strict;
                     30: use lib qw(/home/httpd/lib/perl);
                     31: use Apache::Constants qw(:common);
                     32: use Apache::loncommon();
                     33: 
1.2       albertel   34: sub handler {
                     35:     my ($r) = @_;
1.1       raeburn    36:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['page','color','function','faq','bug','topic','component_help','origurl']);
1.2       albertel   37:     &Apache::loncommon::content_type($r,'text/html');
1.1       raeburn    38:     $r->send_http_header;
                     39: 
                     40:     if ($r->header_only) {
                     41:         return OK;
                     42:     }
1.3       albertel   43:     my $color = $ENV{'form.color'};
                     44:     my $faq = $ENV{'form.faq'};
                     45:     my $bug = $ENV{'form.bug'};
                     46:     my $topic = $ENV{'form.topic'};
                     47:     my $function = $ENV{'form.function'};
                     48:     my $component_help = $ENV{'form.component_help'};
1.1       raeburn    49:     my $origurl = $ENV{'form.origurl'};
                     50:     my $component_url = $component_help;
                     51:     if ($component_url) {
                     52:         $component_url = '/adm/help/'.$component_url.'.hlp';
                     53:     }
                     54:     my $bugurl = $Apache::lonnet::perlvar{'BugzillaHost'};
                     55:     $bugurl .= 'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.$origurl;
                     56:     if ($bug) {
                     57:         $bugurl .= '&component='.$bug;
                     58:     }
                     59:     my $faqbaseurl = $Apache::lonnet::perlvar{'FAQHost'};
                     60:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                     61:     if ($ENV{'form.page'} eq 'banner') {
1.3       albertel   62:         &display_help_banner($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
1.1       raeburn    63:     } elsif ($ENV{'form.page'} eq 'body') {
1.3       albertel   64:         &display_help_mainpage($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
1.1       raeburn    65:     }
                     66:     return OK;
                     67: }
                     68: 
                     69: sub display_help_banner {
                     70:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
                     71:     my $bodytag = &Apache::loncommon::bodytag('',$function,'rightmargin="0" leftmargin="0" marginwidth="0" topmargin="1" marginheight="1"',1);
1.5       albertel   72:     $bodytag=~s/[\n\r]/ /g;
1.1       raeburn    73:     my $fontcolor = &Apache::loncommon::designparm($function.'.font');
                     74:     my $alinkcolor = &Apache::loncommon::designparm($function.'.alink');
                     75:     my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
                     76:     my $pagecolor = &Apache::loncommon::designparm($function.'.pgbg');
                     77:     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
                     78: 
                     79:     $r->print(<<END);
                     80: <html>
                     81: <head>
                     82: <title>Help Banner</title>
                     83: <style type="text/css">
                     84: <!--
                     85:  a:link {text-decoration: none; color: $fontcolor; }
                     86:  a:visited {text-decoration: none; color: $fontcolor; }
                     87:  a:active {text-decoration: none; color: $fontcolor; }
                     88:  a:hover {text-decoration: underline; color: $vlinkcolor; }
                     89: -->
                     90: </style>
                     91: <script type="text/javascript">
                     92: function noTopic () { 
                     93:     bodyframe.document.write("<html><head><title>Topic Page</title></head>")
                     94:     bodyframe.document.write('$bodytag')
                     95:     bodyframe.document.write("The LON-CAPA help system does not currently include a specific pop-up help item for this topic. You may wish to consult the LON-CAPA <a href='/adm/help/author.manual.pdf'>Authoring Manual</a> or the <a href='/adm/help/course.manual.pdf'>Course Coordinator Manual</a>.")
                     96:     bodyframe.document.write("</body></html>")
                     97:     body.document.close()
                     98: }
                     99: </script>
                    100: </head>
                    101: $bodytag
                    102:  <table width="600" border="0" cellspacing="0" cellpadding="0" height="55">
                    103:   <tr height="50">
                    104:    <td width='5'>&nbsp;</td>
                    105:    <td>
                    106:     <fieldset><legend><img src="/adm/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' />&nbsp;&nbsp;<b><font size="+1">LON-CAPA help/support</font></b></legend>
                    107:  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
                    108:   <tr>
                    109:    <td>
                    110:     <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
                    111:      <tr>
                    112:       <td>
                    113:        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
                    114:         <tr>
                    115:          <td>
                    116: 	  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
                    117:            <tr bgcolor="$tablecolor">
                    118: END
                    119:     if (($component_url) || ($ENV{'user.adv'})) {
                    120:         if ($component_url) {
                    121:             $r->print("
                    122:             <td align=\"center\">&nbsp;<b><a href=\"$component_url\" target=\"bodyframe\">");
1.6     ! albertel  123: 	    $r->print('
        !           124:    <image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;Topic help</a></b>&nbsp;</td>');
        !           125:         } elsif (0 && $ENV{'user.adv'}) {
        !           126: 	    #FIXME doing this in JS is problematic since JS can't control frames that go to outside sites
1.1       raeburn   127:             $r->print('<td align="center">&nbsp;<b><a href="javascript:noTopic()" target="bodyframe">');
                    128:         }
                    129:     }
                    130:     if ($requestmail) {
                    131:         $r->print('
                    132:             <td align="center">&nbsp;<b><a href="/adm/support?origurl='.$origurl.'&function='.$function.'" target="bodyframe"><image src="/adm/lonMisc/feedback.gif" border="0" alt="(Ask helpdesk)" valign="middle" />&nbsp;Ask helpdesk</a></b>&nbsp;</td>');
                    133:     }
                    134:     if ($ENV{'user.adv'}) {
                    135:         $r->print(<<END)
                    136:             <td align="center">
                    137:              &nbsp;<b><a href="$faqbaseurl/fom/cache/$faq.html" target="bodyframe"><image src="/adm/lonMisc/smallFAQ.gif" border="0" alt="(FAQ)" valign="middle" />&nbsp;FAQ</a></b>&nbsp;
                    138:             </td>
                    139:             <td align="center">&nbsp;<b><a href="$bugurl" target="bodyframe"><image src="/adm/lonMisc/smallBug.gif" border="0" alt="(Report a bug)" valign="middle" />&nbsp;Report a bug</a>&nbsp;</b></td>
                    140: END
                    141:     }
                    142:     $r->print(<<END);
                    143:             <td align="center">&nbsp;<b><a href="javascript:window.close()" target="_top"><image src="/adm/lonIcons/move_up.gif" border="0" alt="(Close window)" valign="middle" />Close</a></b>&nbsp;</td>
                    144:            </tr>
                    145:           </table>
                    146:          </td>
                    147:         </tr>
                    148:        </table>
                    149:       </td>
                    150:      </tr>
                    151:     </table>
                    152:    </td>
                    153:   </tr>
                    154:  </table>
                    155: </fieldset>
                    156:   </td>
                    157:   <td width='5'>&nbsp;</td>
                    158:  </tr>
                    159:  <tr height='5'>
                    160:   <td colspan='3' height='5'>&nbsp;</td>
                    161:  </tr>
                    162: </table>
                    163: </body>
                    164: </html>
                    165: END
                    166: }
                    167: 
                    168: sub display_help_mainpage {
                    169:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
                    170:     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
1.4       albertel  171:     $bodytag=~s/[\n\r]/ /g;
1.1       raeburn   172:     $r->print(<<END);
                    173: <html>
                    174:  <head>
                    175:   <title>Help Content</title>
                    176:   <script type="text/javascript">
                    177: function noTopic() {
1.6     ! albertel  178:     bodyframe.document.write('<html><head><title>Topic Page</title></head>$bodytag')
1.1       raeburn   179:     bodyframe.document.write("The LON-CAPA help system does not currently include a specific pop-up help item for this topic. You may wish to consult the LON-CAPA <a href='/adm/help/author.manual.pdf'>Authoring Manual</a> or the <a href='/adm/help/course.manual.pdf'>Course Coordinator Manual</a>.")
                    180:     bodyframe.document.write("</body></html>")
                    181:     body.document.close()
                    182: }
                    183:   </script>
                    184:  </head>
                    185: $bodytag
                    186: Choose an entry below to go directly to a relevant help page
                    187: END
                    188:     if ($requestmail) {
                    189:         $r->print(", or to submit a help request to the LON-CAPA support staff at you institution.");
                    190:     } else {
                    191:         $r->print(".");
                    192:     }
                    193:     if ($topic) {
                    194:         if ( ($component_url) || ($ENV{'user.adv'}) ) {
                    195:             if ($component_url) {
                    196:                 $r->print("
                    197:           <ul>
                    198:            <li><a href=\"$component_url\">Visit the help page for $topic</a></li>
                    199:           </ul>
                    200:           <p>Display the page in the inline help system that covers this topic.</p>
                    201:                 ");
                    202:             } elsif ($ENV{'user.adv'}) {
                    203:                 $r->print("
                    204:               <ul>
                    205:                <li><td align=\"center\">&nbsp;<a href=\"javascript:noTopic()\">Inline help system for $topic</a></li></ul>
                    206:                <p>Consult the inline help system for this topic.</p>");
                    207:             }
                    208:         }
                    209:     }
                    210:     if ($requestmail) {
                    211:         $r->print("
                    212:           <ul>
                    213:            <li><a href=\"/adm/support?origurl=$origurl&function=$function\" target=\"bodyframe\">Contact the LON-CAPA support team</a></li>
                    214:           </ul>
                    215:           <p>Submit a help request to the team responsible for LON-CAPA support at this institution.</p>
                    216:           <ul>
                    217:         ");
                    218:     }
                    219:     if ($faqbaseurl && $ENV{'user.adv'}) {
                    220:         if (!defined($faq) ||$faq eq '') {
                    221:             $faq = '1';
                    222:         }
                    223:         $r->print("
                    224:            <li><a href=\"$faqbaseurl/fom/cache/$faq.html\">FAQ-O-Matic Help system</a></li>
                    225:           </ul>
                    226:           <p>The FAQ-O-Matic is a compendium of answers provided to common questions asked by users of LON-CAPA over the past couple of years.</p>
                    227:         ");
                    228:     }
                    229:     if ($bugurl && $ENV{'user.adv'}) {
                    230:         $bugurl .= '?'.$bug;
                    231:         $r->print("
                    232:           <ul>
                    233:            <li><a href=\"$bugurl\">LON-CAPA Bugzilla bug/feature request tracking
                    234: system</a></li>
                    235:           </ul>
                    236:           <p>Create an account for yourself in the LON-CAPA Bugzilla tracking system, if you wish to report bugs you have encountered in the LON-CAPA software,
                    237: or if you have suggestions for improvements in LON-CAPA.  Suggested improvements may include additional functionality, improved usability, or changes to wording used in LON-CAPA pages, including the embedded help system.</p>
                    238:         ");
                    239:     }
                    240:     $r->print(<<END);
                    241:  </body>
                    242: </html>
                    243: END
                    244: }
                    245: 
                    246: 1;

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