Chapter 12Online Help System IN THIS CHAPTER ◆ Developing an online help system ◆ Installing an online help system ◆ Using an online help system H AVING ONLINE HELPwith your Web or intra
Trang 1Security Concerns
Now you have a set of intranet applications that allow you to add/modify/delete Internet site resources Since these applications are run from your intranet they are only accessible to your intranet users who must authenticate using the central authentication system developed in Chapter 5 However, if you needed to restrict access to these applications even further using some other special schema such as
IP subnet or time, you can incorporate such custom authorization requirements in the authorize()methods for each of these applications
Summary
In this chapter, you learned to create an Internet Resource Manager for your intranet This application allows users to organize the resources on a shareable and searchable central database
Chapter 11: Internet Resource Manager 401
Trang 3Chapter 12
Online Help System
IN THIS CHAPTER
◆ Developing an online help system
◆ Installing an online help system
◆ Using an online help system
H AVING ONLINE HELPwith your Web or intranet applications can be a great blessing, because it may reduce user support calls and, therefore, cost In this chapter, you’ll develop an online help system that can be used for any of the Web or intranet appli-cations developed in this book
First, let’s look at the functionality you want the help system to offer
Functionality Requirements
The help system will offer the following features
◆ Structured help contents: The system will assume a structured help
con-tent design where help for an application will be divided into sections
Each section will be represented with one or more HTML pages, which may or may not have embedded images Each section will have a number like x.y.z where x is the section number, y is the second level subsection number, and z is the third level subsection number For example, 1.0.0.html, 1.1.0.html, and 1.1.1.html are pages for section 1 The images for all the help contents will be stored in an images directory
◆ Automatic table of contents page: The system should generate the table
of contents page automatically This feature is very good to have because you can then add or remove sections
◆ Automatic navigation: The system should generate automatic navigation
links from section to section and also have a link to the table of contents from each page
403
Trang 4◆ Keyword search: The system will allow keyword-based searches using the
logic operators AND and OR
◆ Template-based interface: The system should support a central help
tem-plate to display help pages but also allow individual sections to have their own templates to alter the look and feel of the help as needed
Understanding the Prerequisites
The help system requires the application framework classes that were discussed in Chapter 4 You must have the application framework classes along with PHPLIB and PEAR packages installed
Designing and Implementing the Help Application Classes
As shown in the system diagram, Figure 12-1, there is one new object, Help object, which is needed to implement the online help system
Figure 12-1: The help system diagram.
Here you will develop the class that will provide the help object for the online help applications
Designing and implementing the Help class
The Help class is used by all help applications It allows help applications to display, search, and index help contents The ch12/apps/class/class.Help.php file on the CD-ROM implements this class This class implements the following methods
Help Application Make Index Application
PHP Application Framework
Help Applications
Help Object class.Help.php
404 Part II: Developing Intranet Solutions
Trang 5Help( )
This is the constructor method It works as follows:
◆ It sets the object variable _APPto the given application name The name
of the application for which help will be displayed is passed to this method using the $params[‘app’]parameter
◆ It sets the object variable _MAPto the given application’s map file name
The name of the map file that will be used to locate help contents for the current application is passed to this method using the $params[‘map’]
parameter
◆ The object variable _FORCEis set using the $params[‘force’]parameter, which indicates if the help index should be forcefully created again even
if the current index is up to date
◆ The object variable _OPERATORSis set to an array of two logical operators:
OR and AND These are the logical operators that are supported in keyword search operations
◆ The object variable _LOADEDis set to false, which indicates that the object has not yet loaded the help map information from the named map file
◆ If the application for which help contents is to be displayed, searched, indexed is named (that is, $this->_APPis set) and the map file name is given (that is, $this->_MAPis set), then the method calls the loadMap()
method to load the map information for the named application The map file contains help contents information for the named application
getApp( )
This method returns the value of the _APPobject variable, which is the name of the application for which the help object is to display, search, or index the help contents
getRelHelpDir( )
This method returns the relative help directory path stored in the _REL_HELP_DIR
object variable, which is set in the loadMap()method
getSectionContents()
This method returns the contents of a section of the help contents The section num-ber is passed as a parameter ($section) to this method The contents are stored in a hash called $contents It works as follows:
◆ The $contents[‘output’]is set to show_section, which indicates to the help display application (help.php) that it needs to show the help content for a given section
◆ A local variable called $tocLinkis created to store the table of contents link The table of contents link is simply the path to the help application
Chapter 12: Online Help System 405