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

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.8       raeburn    36:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['page','color','function','faq','bug','topic','component_help','origurl','stayonpage']);
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'};
1.8       raeburn    50:     my $stayOnPage = $ENV{'form.stayonpage'};
1.1       raeburn    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') {
1.8       raeburn    63:         &display_help_banner($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage);
1.1       raeburn    64:     } elsif ($ENV{'form.page'} eq 'body') {
1.3       albertel   65:         &display_help_mainpage($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
1.1       raeburn    66:     }
                     67:     return OK;
                     68: }
                     69: 
                     70: sub display_help_banner {
1.8       raeburn    71:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage) = @_;
1.1       raeburn    72:     my $bodytag = &Apache::loncommon::bodytag('',$function,'rightmargin="0" leftmargin="0" marginwidth="0" topmargin="1" marginheight="1"',1);
1.5       albertel   73:     $bodytag=~s/[\n\r]/ /g;
1.1       raeburn    74:     my $fontcolor = &Apache::loncommon::designparm($function.'.font');
                     75:     my $alinkcolor = &Apache::loncommon::designparm($function.'.alink');
                     76:     my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
                     77:     my $pagecolor = &Apache::loncommon::designparm($function.'.pgbg');
                     78:     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
1.14    ! albertel   79:     my $location=&Apache::loncommon::lonhttpdurl("/adm");
1.8       raeburn    80:     if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) {
                     81:         $tablecolor = '#CCCCFF';
                     82:     }
                     83: 
1.1       raeburn    84:     $r->print(<<END);
                     85: <html>
                     86: <head>
                     87: <title>Help Banner</title>
                     88: <style type="text/css">
                     89: <!--
                     90:  a:link {text-decoration: none; color: $fontcolor; }
                     91:  a:visited {text-decoration: none; color: $fontcolor; }
                     92:  a:active {text-decoration: none; color: $fontcolor; }
                     93:  a:hover {text-decoration: underline; color: $vlinkcolor; }
                     94: -->
                     95: </style>
                     96: </head>
                     97: $bodytag
1.8       raeburn    98: END
                     99:     if ($stayOnPage) {
                    100:         $r->print('<table width="700" border="0" cellspacing="0" cellpadding="0" height="55">');
                    101:     } else {
                    102:         $r->print('<table width="600" border="0" cellspacing="0" cellpadding="0" height="55">');
                    103:     }
                    104:     $r->print(<<END);
1.1       raeburn   105:   <tr height="50">
                    106:    <td width='5'>&nbsp;</td>
                    107:    <td>
1.12      albertel  108:     <fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' />&nbsp;&nbsp;<b><font size="+1">LON-CAPA help/support</font></b></legend>
1.1       raeburn   109:  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
                    110:   <tr>
                    111:    <td>
                    112:     <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
                    113:      <tr>
                    114:       <td>
                    115:        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
                    116:         <tr>
                    117:          <td>
                    118: 	  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
                    119:            <tr bgcolor="$tablecolor">
                    120: END
                    121:     if (($component_url) || ($ENV{'user.adv'})) {
                    122:         if ($component_url) {
                    123:             $r->print("
                    124:             <td align=\"center\">&nbsp;<b><a href=\"$component_url\" target=\"bodyframe\">");
1.8       raeburn   125:         } elsif ($ENV{'user.adv'}) {
1.12      albertel  126:             $r->print('<td align="center">&nbsp;<b><a href="$location/help/nohelptopic.html" target="bodyframe">');
1.1       raeburn   127:         }
1.8       raeburn   128:         $r->print('
1.13      albertel  129:   <img src="$location/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;Topic help</a></b>&nbsp;</td>');
1.1       raeburn   130:     }
1.11      raeburn   131:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
1.1       raeburn   132:         $r->print('
1.13      albertel  133:             <td align="center">&nbsp;<b><a href="/adm/support?origurl='.&Apache::lonnet::escape($origurl).'&function='.$function.'" target="bodyframe"><img src="$location/lonIcons/helpdesk.gif" border="0" alt="(Ask helpdesk)" valign="middle" />&nbsp;Ask helpdesk</a></b>&nbsp;</td>');
1.1       raeburn   134:     }
1.7       albertel  135:     if ($faq && $ENV{'user.adv'}) {
1.1       raeburn   136:         $r->print(<<END)
                    137:             <td align="center">
1.13      albertel  138:              &nbsp;<b><a href="$faqbaseurl/fom/cache/$faq.html" target="bodyframe"><img src="$location/lonMisc/smallFAQ.gif" border="0" alt="(FAQ)" valign="middle" />&nbsp;FAQ</a></b>&nbsp;
1.1       raeburn   139:             </td>
1.7       albertel  140: END
                    141:     }
                    142:     if ($ENV{'user.adv'}) {
                    143:         $r->print(<<END)
1.13      albertel  144:             <td align="center">&nbsp;<b><a href="$bugurl" target="bodyframe"><img src="$location/lonMisc/smallBug.gif" border="0" alt="(Report a bug)" valign="middle" />&nbsp;Report a bug</a>&nbsp;</b></td>
1.1       raeburn   145: END
                    146:     }
1.8       raeburn   147:     if ($stayOnPage) {
                    148:         $r->print(<<END);
1.13      albertel  149:             <td align="center">&nbsp;<b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="(Return to last location)" valign="middle" />&nbsp;Return to last location</a></b>&nbsp;</td>
1.8       raeburn   150: END
                    151:     } else {
                    152:         $r->print(<<END);
1.13      albertel  153:             <td align="center">&nbsp;<b><a href="javascript:window.close()" target="_top"><img src="$location/lonIcons/closepage.gif" border="0" alt="(Close window)" valign="bottom" />&nbsp;Close</a></b>&nbsp;</td>
1.8       raeburn   154: END
                    155:     }
1.1       raeburn   156:     $r->print(<<END);
                    157:            </tr>
                    158:           </table>
                    159:          </td>
                    160:         </tr>
                    161:        </table>
                    162:       </td>
                    163:      </tr>
                    164:     </table>
                    165:    </td>
                    166:   </tr>
                    167:  </table>
                    168: </fieldset>
                    169:   </td>
                    170:   <td width='5'>&nbsp;</td>
                    171:  </tr>
                    172:  <tr height='5'>
                    173:   <td colspan='3' height='5'>&nbsp;</td>
                    174:  </tr>
                    175: </table>
                    176: </body>
                    177: </html>
                    178: END
                    179: }
                    180: 
                    181: sub display_help_mainpage {
                    182:     my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail) = @_;
                    183:     my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
1.4       albertel  184:     $bodytag=~s/[\n\r]/ /g;
1.8       raeburn   185:     my %lt =&Apache::lonlocal::texthash(
                    186:         'heco' => 'Help Content',
                    187:         'topp' => 'Topic Page',
                    188:         'chen' => 'Choose an entry below to go directly to a relevant help page',
                    189:         'orto' => 'or to submit a help request to the LON-CAPA support staff at your institution.',
                    190:         'vthp' => 'Visit the help page for ',
                    191:         'disp' => 'Display the page in the inline help system that covers this topic.',
                    192:         'crac' => '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, or if you have suggestions for improvements in LON-CAPA.',
                    193:         'inhs' => 'Inline help system for',
                    194:         'coth' => 'Consult the inline help system for this topic.',
                    195:         'cont' => 'Contact the LON-CAPA support team',
                    196:         'suhr' => 'Submit a help request to the team responsible for LON-CAPA support at this institution.',
                    197:         'faqo' => 'FAQ-O-Matic Help system',
                    198:         'tfaq' => '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.',
                    199:         'lbug' => 'LON-CAPA Bugzilla bug/feature request tracking system',
                    200:         'crea' => '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,or if you have suggestions for improvements in LON-CAPA.',
                    201:         'suim' => ' Suggested improvements may include additional functionality, improved usability, or changes to wording used in LON-CAPA pages, including the embedded help system.'
                    202:     );
                    203: 
1.1       raeburn   204:     $r->print(<<END);
                    205: <html>
                    206:  <head>
1.8       raeburn   207:   <title>$lt{'heco'}</title>
1.1       raeburn   208:  </head>
                    209: $bodytag
                    210: END
1.8       raeburn   211:     $r->print($lt{'chen'});
1.11      raeburn   212:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
1.8       raeburn   213:         $r->print(', '.$lt{'orto'});
1.1       raeburn   214:     } else {
                    215:         $r->print(".");
                    216:     }
                    217:     if ($topic) {
                    218:         if ( ($component_url) || ($ENV{'user.adv'}) ) {
                    219:             if ($component_url) {
                    220:                 $r->print("
                    221:           <ul>
1.8       raeburn   222:            <li><a href=\"$component_url\">$lt{'vthp'} $topic</a></li>
1.1       raeburn   223:           </ul>
1.8       raeburn   224:           <p>$lt{'disp'}</p>
1.1       raeburn   225:                 ");
                    226:             } elsif ($ENV{'user.adv'}) {
                    227:                 $r->print("
                    228:               <ul>
1.8       raeburn   229:                <li><td align=\"center\">&nbsp;<a href=\"/adm/help/nohelptopic.html\">$lt{'inhs'} $topic</a></li></ul>
                    230:                <p>$lt{'coth'}</p>");
1.1       raeburn   231:             }
                    232:         }
                    233:     }
1.11      raeburn   234:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
1.1       raeburn   235:         $r->print("
                    236:           <ul>
1.9       raeburn   237:            <li><a href=\"/adm/support?origurl=".&Apache::lonnet::escape($origurl)."&function=$function\">$lt{'cont'}</a></li>
1.1       raeburn   238:           </ul>
1.8       raeburn   239:           <p>$lt{'suhr'}</p>
1.1       raeburn   240:         ");
                    241:     }
                    242:     if ($faqbaseurl && $ENV{'user.adv'}) {
                    243:         if (!defined($faq) ||$faq eq '') {
                    244:             $faq = '1';
                    245:         }
                    246:         $r->print("
1.11      raeburn   247:           <ul>
1.8       raeburn   248:            <li><a href=\"$faqbaseurl/fom/cache/$faq.html\">$lt{'faqo'}</a></li>
1.1       raeburn   249:           </ul>
1.8       raeburn   250:           <p>$lt{'tfaq'}</p>
1.1       raeburn   251:         ");
                    252:     }
                    253:     if ($bugurl && $ENV{'user.adv'}) {
                    254:         $bugurl .= '?'.$bug;
                    255:         $r->print("
                    256:           <ul>
1.8       raeburn   257:            <li><a href=\"$bugurl\">$lt{'lbug'}</a></li>
1.1       raeburn   258:           </ul>
1.8       raeburn   259:           <p>$lt{'crea'} $lt{'suim'}</p>
1.1       raeburn   260:         ");
                    261:     }
                    262:     $r->print(<<END);
                    263:  </body>
                    264: </html>
                    265: END
                    266: }
                    267: 
                    268: 1;

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