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

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: 
        !            34: sub handler
        !            35: {
        !            36:     my $r = shift;
        !            37:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['page','color','function','faq','bug','topic','component_help','origurl']);
        !            38:     $r->content_type('text/html');
        !            39:     $r->send_http_header;
        !            40: 
        !            41:     if ($r->header_only) {
        !            42:         return OK;
        !            43:     }
        !            44:     my $color = &Apache::lonnet::unescape($ENV{'form.color'});
        !            45:     my $faq = &Apache::lonnet::unescape($ENV{'form.faq'});
        !            46:     my $bug = &Apache::lonnet::unescape($ENV{'form.bug'});
        !            47:     my $topic = &Apache::lonnet::unescape($ENV{'form.topic'});
        !            48:     my $function = &Apache::lonnet::unescape($ENV{'form.function'});
        !            49:     my $component_help = &Apache::lonnet::unescape($ENV{'form.component_help'});
        !            50:     my $origurl = $ENV{'form.origurl'};
        !            51:     my $component_url = $component_help;
        !            52:     if ($component_url) {
        !            53:         $component_url = '/adm/help/'.$component_url.'.hlp';
        !            54:     }
        !            55:     my $bugurl = $Apache::lonnet::perlvar{'BugzillaHost'};
        !            56:     $bugurl .= 'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.$origurl;
        !            57:     if ($bug) {
        !            58:         $bugurl .= '&component='.$bug;
        !            59:     }
        !            60:     my $faqbaseurl = $Apache::lonnet::perlvar{'FAQHost'};
        !            61:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
        !            62:     if ($ENV{'form.page'} eq 'banner') {
        !            63:         &display_help_banner ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
        !            64:     } elsif ($ENV{'form.page'} eq 'body') {
        !            65:         &display_help_mainpage ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
        !            66:     }
        !            67:     return OK;
        !            68: }
        !            69: 
        !            70: sub display_help_banner {
        !            71:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
        !            72:     my $bodytag = &Apache::loncommon::bodytag('',$function,'rightmargin="0" leftmargin="0" marginwidth="0" topmargin="1" marginheight="1"',1);
        !            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);
        !           170:     $r->print(<<END);
        !           171: <html>
        !           172:  <head>
        !           173:   <title>Help Content</title>
        !           174:   <script type="text/javascript">
        !           175: function noTopic() {
        !           176:     bodyframe.document.write("<html><head><title>Topic Page</title></head>$bodytag")
        !           177:     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>.")
        !           178:     bodyframe.document.write("</body></html>")
        !           179:     body.document.close()
        !           180: }
        !           181:   </script>
        !           182:  </head>
        !           183: $bodytag
        !           184: Choose an entry below to go directly to a relevant help page
        !           185: END
        !           186:     if ($requestmail) {
        !           187:         $r->print(", or to submit a help request to the LON-CAPA support staff at you institution.");
        !           188:     } else {
        !           189:         $r->print(".");
        !           190:     }
        !           191:     if ($topic) {
        !           192:         if ( ($component_url) || ($ENV{'user.adv'}) ) {
        !           193:             if ($component_url) {
        !           194:                 $r->print("
        !           195:           <ul>
        !           196:            <li><a href=\"$component_url\">Visit the help page for $topic</a></li>
        !           197:           </ul>
        !           198:           <p>Display the page in the inline help system that covers this topic.</p>
        !           199:                 ");
        !           200:             } elsif ($ENV{'user.adv'}) {
        !           201:                 $r->print("
        !           202:               <ul>
        !           203:                <li><td align=\"center\">&nbsp;<a href=\"javascript:noTopic()\">Inline help system for $topic</a></li></ul>
        !           204:                <p>Consult the inline help system for this topic.</p>");
        !           205:             }
        !           206:         }
        !           207:     }
        !           208:     if ($requestmail) {
        !           209:         $r->print("
        !           210:           <ul>
        !           211:            <li><a href=\"/adm/support?origurl=$origurl&function=$function\" target=\"bodyframe\">Contact the LON-CAPA support team</a></li>
        !           212:           </ul>
        !           213:           <p>Submit a help request to the team responsible for LON-CAPA support at this institution.</p>
        !           214:           <ul>
        !           215:         ");
        !           216:     }
        !           217:     if ($faqbaseurl && $ENV{'user.adv'}) {
        !           218:         if (!defined($faq) ||$faq eq '') {
        !           219:             $faq = '1';
        !           220:         }
        !           221:         $r->print("
        !           222:            <li><a href=\"$faqbaseurl/fom/cache/$faq.html\">FAQ-O-Matic Help system</a></li>
        !           223:           </ul>
        !           224:           <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>
        !           225:         ");
        !           226:     }
        !           227:     if ($bugurl && $ENV{'user.adv'}) {
        !           228:         $bugurl .= '?'.$bug;
        !           229:         $r->print("
        !           230:           <ul>
        !           231:            <li><a href=\"$bugurl\">LON-CAPA Bugzilla bug/feature request tracking
        !           232: system</a></li>
        !           233:           </ul>
        !           234:           <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,
        !           235: 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>
        !           236:         ");
        !           237:     }
        !           238:     $r->print(<<END);
        !           239:  </body>
        !           240: </html>
        !           241: END
        !           242: }
        !           243: 
        !           244: 1;

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