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

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.3       albertel   72:     $bodytag=~/[\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\">");
                    123:         } elsif ($ENV{'user.adv'}) {
                    124:             $r->print('<td align="center">&nbsp;<b><a href="javascript:noTopic()" target="bodyframe">');
                    125:         }
                    126:         $r->print('
                    127:    <image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;Topic help</a></b>&nbsp;</td>');
                    128:     }
                    129:     if ($requestmail) {
                    130:         $r->print('
                    131:             <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>');
                    132:     }
                    133:     if ($ENV{'user.adv'}) {
                    134:         $r->print(<<END)
                    135:             <td align="center">
                    136:              &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;
                    137:             </td>
                    138:             <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>
                    139: END
                    140:     }
                    141:     $r->print(<<END);
                    142:             <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>
                    143:            </tr>
                    144:           </table>
                    145:          </td>
                    146:         </tr>
                    147:        </table>
                    148:       </td>
                    149:      </tr>
                    150:     </table>
                    151:    </td>
                    152:   </tr>
                    153:  </table>
                    154: </fieldset>
                    155:   </td>
                    156:   <td width='5'>&nbsp;</td>
                    157:  </tr>
                    158:  <tr height='5'>
                    159:   <td colspan='3' height='5'>&nbsp;</td>
                    160:  </tr>
                    161: </table>
                    162: </body>
                    163: </html>
                    164: END
                    165: }
                    166: 
                    167: sub display_help_mainpage {
                    168:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
                    169:     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
1.4     ! albertel  170:     $bodytag=~s/[\n\r]/ /g;
1.1       raeburn   171:     $r->print(<<END);
                    172: <html>
                    173:  <head>
                    174:   <title>Help Content</title>
                    175:   <script type="text/javascript">
                    176: function noTopic() {
                    177:     bodyframe.document.write("<html><head><title>Topic Page</title></head>$bodytag")
                    178:     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>.")
                    179:     bodyframe.document.write("</body></html>")
                    180:     body.document.close()
                    181: }
                    182:   </script>
                    183:  </head>
                    184: $bodytag
                    185: Choose an entry below to go directly to a relevant help page
                    186: END
                    187:     if ($requestmail) {
                    188:         $r->print(", or to submit a help request to the LON-CAPA support staff at you institution.");
                    189:     } else {
                    190:         $r->print(".");
                    191:     }
                    192:     if ($topic) {
                    193:         if ( ($component_url) || ($ENV{'user.adv'}) ) {
                    194:             if ($component_url) {
                    195:                 $r->print("
                    196:           <ul>
                    197:            <li><a href=\"$component_url\">Visit the help page for $topic</a></li>
                    198:           </ul>
                    199:           <p>Display the page in the inline help system that covers this topic.</p>
                    200:                 ");
                    201:             } elsif ($ENV{'user.adv'}) {
                    202:                 $r->print("
                    203:               <ul>
                    204:                <li><td align=\"center\">&nbsp;<a href=\"javascript:noTopic()\">Inline help system for $topic</a></li></ul>
                    205:                <p>Consult the inline help system for this topic.</p>");
                    206:             }
                    207:         }
                    208:     }
                    209:     if ($requestmail) {
                    210:         $r->print("
                    211:           <ul>
                    212:            <li><a href=\"/adm/support?origurl=$origurl&function=$function\" target=\"bodyframe\">Contact the LON-CAPA support team</a></li>
                    213:           </ul>
                    214:           <p>Submit a help request to the team responsible for LON-CAPA support at this institution.</p>
                    215:           <ul>
                    216:         ");
                    217:     }
                    218:     if ($faqbaseurl && $ENV{'user.adv'}) {
                    219:         if (!defined($faq) ||$faq eq '') {
                    220:             $faq = '1';
                    221:         }
                    222:         $r->print("
                    223:            <li><a href=\"$faqbaseurl/fom/cache/$faq.html\">FAQ-O-Matic Help system</a></li>
                    224:           </ul>
                    225:           <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>
                    226:         ");
                    227:     }
                    228:     if ($bugurl && $ENV{'user.adv'}) {
                    229:         $bugurl .= '?'.$bug;
                    230:         $r->print("
                    231:           <ul>
                    232:            <li><a href=\"$bugurl\">LON-CAPA Bugzilla bug/feature request tracking
                    233: system</a></li>
                    234:           </ul>
                    235:           <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,
                    236: 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>
                    237:         ");
                    238:     }
                    239:     $r->print(<<END);
                    240:  </body>
                    241: </html>
                    242: END
                    243: }
                    244: 
                    245: 1;

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