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

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:     }
                     43:     my $color = &Apache::lonnet::unescape($ENV{'form.color'});
                     44:     my $faq = &Apache::lonnet::unescape($ENV{'form.faq'});
                     45:     my $bug = &Apache::lonnet::unescape($ENV{'form.bug'});
                     46:     my $topic = &Apache::lonnet::unescape($ENV{'form.topic'});
                     47:     my $function = &Apache::lonnet::unescape($ENV{'form.function'});
                     48:     my $component_help = &Apache::lonnet::unescape($ENV{'form.component_help'});
                     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') {
                     62:         &display_help_banner ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
                     63:     } elsif ($ENV{'form.page'} eq 'body') {
                     64:         &display_help_mainpage ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
                     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);
                     72:     my $fontcolor = &Apache::loncommon::designparm($function.'.font');
                     73:     my $alinkcolor = &Apache::loncommon::designparm($function.'.alink');
                     74:     my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
                     75:     my $pagecolor = &Apache::loncommon::designparm($function.'.pgbg');
                     76:     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
                     77: 
                     78:     $r->print(<<END);
                     79: <html>
                     80: <head>
                     81: <title>Help Banner</title>
                     82: <style type="text/css">
                     83: <!--
                     84:  a:link {text-decoration: none; color: $fontcolor; }
                     85:  a:visited {text-decoration: none; color: $fontcolor; }
                     86:  a:active {text-decoration: none; color: $fontcolor; }
                     87:  a:hover {text-decoration: underline; color: $vlinkcolor; }
                     88: -->
                     89: </style>
                     90: <script type="text/javascript">
                     91: function noTopic () { 
                     92:     bodyframe.document.write("<html><head><title>Topic Page</title></head>")
                     93:     bodyframe.document.write('$bodytag')
                     94:     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>.")
                     95:     bodyframe.document.write("</body></html>")
                     96:     body.document.close()
                     97: }
                     98: </script>
                     99: </head>
                    100: $bodytag
                    101:  <table width="600" border="0" cellspacing="0" cellpadding="0" height="55">
                    102:   <tr height="50">
                    103:    <td width='5'>&nbsp;</td>
                    104:    <td>
                    105:     <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>
                    106:  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
                    107:   <tr>
                    108:    <td>
                    109:     <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
                    110:      <tr>
                    111:       <td>
                    112:        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
                    113:         <tr>
                    114:          <td>
                    115: 	  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
                    116:            <tr bgcolor="$tablecolor">
                    117: END
                    118:     if (($component_url) || ($ENV{'user.adv'})) {
                    119:         if ($component_url) {
                    120:             $r->print("
                    121:             <td align=\"center\">&nbsp;<b><a href=\"$component_url\" target=\"bodyframe\">");
                    122:         } elsif ($ENV{'user.adv'}) {
                    123:             $r->print('<td align="center">&nbsp;<b><a href="javascript:noTopic()" target="bodyframe">');
                    124:         }
                    125:         $r->print('
                    126:    <image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;Topic help</a></b>&nbsp;</td>');
                    127:     }
                    128:     if ($requestmail) {
                    129:         $r->print('
                    130:             <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>');
                    131:     }
                    132:     if ($ENV{'user.adv'}) {
                    133:         $r->print(<<END)
                    134:             <td align="center">
                    135:              &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;
                    136:             </td>
                    137:             <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>
                    138: END
                    139:     }
                    140:     $r->print(<<END);
                    141:             <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>
                    142:            </tr>
                    143:           </table>
                    144:          </td>
                    145:         </tr>
                    146:        </table>
                    147:       </td>
                    148:      </tr>
                    149:     </table>
                    150:    </td>
                    151:   </tr>
                    152:  </table>
                    153: </fieldset>
                    154:   </td>
                    155:   <td width='5'>&nbsp;</td>
                    156:  </tr>
                    157:  <tr height='5'>
                    158:   <td colspan='3' height='5'>&nbsp;</td>
                    159:  </tr>
                    160: </table>
                    161: </body>
                    162: </html>
                    163: END
                    164: }
                    165: 
                    166: sub display_help_mainpage {
                    167:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
                    168:     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
                    169:     $r->print(<<END);
                    170: <html>
                    171:  <head>
                    172:   <title>Help Content</title>
                    173:   <script type="text/javascript">
                    174: function noTopic() {
                    175:     bodyframe.document.write("<html><head><title>Topic Page</title></head>$bodytag")
                    176:     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>.")
                    177:     bodyframe.document.write("</body></html>")
                    178:     body.document.close()
                    179: }
                    180:   </script>
                    181:  </head>
                    182: $bodytag
                    183: Choose an entry below to go directly to a relevant help page
                    184: END
                    185:     if ($requestmail) {
                    186:         $r->print(", or to submit a help request to the LON-CAPA support staff at you institution.");
                    187:     } else {
                    188:         $r->print(".");
                    189:     }
                    190:     if ($topic) {
                    191:         if ( ($component_url) || ($ENV{'user.adv'}) ) {
                    192:             if ($component_url) {
                    193:                 $r->print("
                    194:           <ul>
                    195:            <li><a href=\"$component_url\">Visit the help page for $topic</a></li>
                    196:           </ul>
                    197:           <p>Display the page in the inline help system that covers this topic.</p>
                    198:                 ");
                    199:             } elsif ($ENV{'user.adv'}) {
                    200:                 $r->print("
                    201:               <ul>
                    202:                <li><td align=\"center\">&nbsp;<a href=\"javascript:noTopic()\">Inline help system for $topic</a></li></ul>
                    203:                <p>Consult the inline help system for this topic.</p>");
                    204:             }
                    205:         }
                    206:     }
                    207:     if ($requestmail) {
                    208:         $r->print("
                    209:           <ul>
                    210:            <li><a href=\"/adm/support?origurl=$origurl&function=$function\" target=\"bodyframe\">Contact the LON-CAPA support team</a></li>
                    211:           </ul>
                    212:           <p>Submit a help request to the team responsible for LON-CAPA support at this institution.</p>
                    213:           <ul>
                    214:         ");
                    215:     }
                    216:     if ($faqbaseurl && $ENV{'user.adv'}) {
                    217:         if (!defined($faq) ||$faq eq '') {
                    218:             $faq = '1';
                    219:         }
                    220:         $r->print("
                    221:            <li><a href=\"$faqbaseurl/fom/cache/$faq.html\">FAQ-O-Matic Help system</a></li>
                    222:           </ul>
                    223:           <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>
                    224:         ");
                    225:     }
                    226:     if ($bugurl && $ENV{'user.adv'}) {
                    227:         $bugurl .= '?'.$bug;
                    228:         $r->print("
                    229:           <ul>
                    230:            <li><a href=\"$bugurl\">LON-CAPA Bugzilla bug/feature request tracking
                    231: system</a></li>
                    232:           </ul>
                    233:           <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,
                    234: 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>
                    235:         ");
                    236:     }
                    237:     $r->print(<<END);
                    238:  </body>
                    239: </html>
                    240: END
                    241: }
                    242: 
                    243: 1;

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