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

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

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