| 1 | ############################################################################## | ||||||||||||
| 2 | # The Faq-O-Matic is Copyright 1997 by Jon Howell, all rights reserved. # | ||||||||||||
| 3 | # # | ||||||||||||
| 4 | # This program is free software; you can redistribute it and/or # | ||||||||||||
| 5 | # modify it under the terms of the GNU General Public License # | ||||||||||||
| 6 | # as published by the Free Software Foundation; either version 2 # | ||||||||||||
| 7 | # of the License, or (at your option) any later version. # | ||||||||||||
| 8 | # # | ||||||||||||
| 9 | # This program is distributed in the hope that it will be useful, # | ||||||||||||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||||||||||||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||||||||||||
| 12 | # GNU General Public License for more details. # | ||||||||||||
| 13 | # # | ||||||||||||
| 14 | # You should have received a copy of the GNU General Public License # | ||||||||||||
| 15 | # along with this program; if not, write to the Free Software # | ||||||||||||
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# | ||||||||||||
| 17 | # # | ||||||||||||
| 18 | # Jon Howell can be contacted at: # | ||||||||||||
| 19 | # 6211 Sudikoff Lab, Dartmouth College # | ||||||||||||
| 20 | # Hanover, NH 03755-3510 # | ||||||||||||
| 21 | # jonh@cs.dartmouth.edu # | ||||||||||||
| 22 | # # | ||||||||||||
| 23 | # An electronic copy of the GPL is available at: # | ||||||||||||
| 24 | # http://www.gnu.org/copyleft/gpl.html # | ||||||||||||
| 25 | # # | ||||||||||||
| 26 | ############################################################################## | ||||||||||||
| 27 | |||||||||||||
| 28 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 29 | |||||||||||||
| 30 | ### Help.pm | ||||||||||||
| 31 | ### | ||||||||||||
| 32 | ### Online, context-sensitive help system | ||||||||||||
| 33 | ### | ||||||||||||
| 34 | |||||||||||||
| 35 | package FAQ::OMatic::HelpMod; | ||||||||||||
| 36 | |||||||||||||
| 37 | 1 | ▶ | use FAQ::OMatic; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 38 | |||||||||||||
| 39 | 1 | my $helpIndex = {}; # constant; no mod_perl cache problems | |||||||||||
| 40 | |||||||||||||
| 41 | 11 | ▶ | sub hr { | ||||||||||
|
Subroutine
hr: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 42 | 11 | my $fileName = shift; | |||||||||||
| 43 | 11 | my $title = shift; | |||||||||||
| 44 | 11 | my $nick; | |||||||||||
| 45 | 11 | $helpIndex->{$title} = [ $fileName, $title ]; | |||||||||||
| 46 | 11 | foreach $nick (@_) { | |||||||||||
| 47 | 12 | $helpIndex->{$nick} = [ $fileName, $title ]; | |||||||||||
| 48 | } | ||||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 1 | hr('help000', 'Online Help', 'faq', ''); | |||||||||||
| 52 | 1 | hr('help001', 'How can I contribute to this FAQ?'); | |||||||||||
| 53 | 1 | hr('help002', 'Search Tips', 'search', 'searchForm'); | |||||||||||
| 54 | 1 | hr('help003', 'Appearance Options', 'appearanceForm'); | |||||||||||
| 55 | 1 | hr('help004', 'Authentication', 'authenticate'); | |||||||||||
| 56 | 1 | hr('help005', "Editing an Item's Title and Options", 'editItem'); | |||||||||||
| 57 | 1 | hr('help006', 'Moderator Options', 'moderatorOptions'); | |||||||||||
| 58 | 1 | hr('help007', 'Editing Text Parts', 'editPart'); | |||||||||||
| 59 | 1 | hr('help008', 'Making Links To Other Sites', 'makingLinks'); | |||||||||||
| 60 | 1 | hr('help009', 'Making Links To Other FAQ-O-Matic Items', 'seeAlso'); | |||||||||||
| 61 | 1 | hr('help010', 'Moving Answers and Categories', 'moveItem'); | |||||||||||
| 62 | |||||||||||||
| 63 | 0 | ▶ | sub helpLookup { | ||||||||||
|
Subroutine
helpLookup: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 64 | 0 | my $params = shift; | |||||||||||
| 65 | 0 | my $target = shift; | |||||||||||
| 66 | |||||||||||||
| 67 | 0 | ▶ | return @{ $helpIndex->{$target} || ["inv $target", 'Invalid Help Target'] }; | ||||||||||
|
Condition0%0/2
$helpIndex->{$target} || ["inv $target", 'Invalid Help Target']
MC/DC0%0/1
$helpIndex->{$target} || ["inv $target", 'Invalid Help Target']
$helpIndex->{$target}
Truth table0%0/2
A
A= $helpIndex->{$target}
| |||||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | 0 | ▶ | sub helpFor { | ||||||||||
|
Subroutine
helpFor: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||
| 71 | 0 | my $params = shift; | |||||||||||
| 72 | 0 | my $target = shift; | |||||||||||
| 73 | 0 | ▶ | my $punctuation = shift || ''; # add only if button is presented | ||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 74 | |||||||||||||
| 75 | 0 | ▶ | return '' if (not $params->{'help'}); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 76 | 0 | ▶ | my $file = $params->{'file'} || ''; | ||||||||||
|
Condition0%0/2
$params->{'file'} || ''
MC/DC0%0/1
$params->{'file'} || ''
$params->{'file'}
Truth table0%0/2
A
A= $params->{'file'}
| |||||||||||||
| 77 | 0 | ▶ | return '' if ($file =~ m/^help/); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 78 | |||||||||||||
| 79 | 0 | my ($helpFile, $helpName) = helpLookup($params, $target); | |||||||||||
| 80 | |||||||||||||
| 81 | 0 | return FAQ::OMatic::button( | |||||||||||
| 82 | FAQ::OMatic::makeAref('-params'=>$params, | ||||||||||||
| 83 | '-changedParams'=>{'file'=>$helpFile, | ||||||||||||
| 84 | 'editCmds'=>'hide'}, | ||||||||||||
| 85 | '-target'=>'help'), | ||||||||||||
| 86 | "HELP: $helpName") | ||||||||||||
| 87 | .$punctuation | ||||||||||||
| 88 | ."\n"; | ||||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | 0 | ▶ | sub helpURL { | ||||||||||
|
Subroutine
helpURL: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 92 | 0 | my $params = shift; | |||||||||||
| 93 | 0 | my $target = shift; | |||||||||||
| 94 | |||||||||||||
| 95 | 0 | my ($file, $name) = helpLookup($params, $target); | |||||||||||
| 96 | |||||||||||||
| 97 | 0 | return FAQ::OMatic::makeAref('-params'=>$params, | |||||||||||
| 98 | '-changedParams'=>{'file'=>$file, | ||||||||||||
| 99 | 'editCmds'=>'hide'}, | ||||||||||||
| 100 | '-target'=>'help', | ||||||||||||
| 101 | '-refType'=>'url'); | ||||||||||||
| 102 | } | ||||||||||||
| 103 | |||||||||||||
| 104 | 1 | 1; | |||||||||||