Configuration Variable Purpose $USER_PREFERENCE_TBL Name of the user preference table in the database. $MESSAGE_TBL Name of the MOTD message table in the database. $IRM_RESOURCE_VISITOR Name of the resource visitor table in the database. $MSG_VIEWER_TBL Name of the message viewer list table in the database. $AUTH_DB_TBL Name of the user authentication table in the database. $IRM_RESOURCE_ Name of the resource description template file. DES_TEMPLATE $IRM_RESOURCE_ Name of the resource menu template file. MENU_TEMPLATE $IRM_RESOURCE_MODIFY_ Name of the resource modify form template file. MENU_TEMPLATE $IRM_MOTD_TEMPLATE Name of the live note template file. $IRM_CAT_HOME_TEMPLATE Name of the category index template file. $IRM_CAT_ADD_MODTEMPLATE Name of the add/modify category entry form template file. $IRM_SEARCH_RESULT_ Name of the search result showing template file. TEMPLATE $IRM_SEARCH_TEMPLATE Name of the resource searching template file. $IRM_STATUS_TEMPLATE Name of the status template file used to display status messages. ODD_COLOR Color defined for odd rows when displaying tabular data such as document track listing. EVEN_COLOR Color defined for even rows when displaying tabular data such as document track listing. $RATINGS Defines an associative array used to display response rating information. USER_DB_URL The fully qualified authentication database URL. CAT_PER_LINE’ Number of categories per row to show in a navigation table, which is created in the navigation file. Continued Chapter 11: Internet Resource Manager 371 14 549669 ch11.qxd 4/4/03 9:25 AM Page 371 TABLE 11-1 IRM.CONF VARIABLES (Continued) Configuration Variable Purpose SEPARATOR The characters that separate each navigation entry (category) in the navigation, which is created in the navigation file. $DEFAULT_THEME The default theme index in the $THEME_TEMPLATE array. $USER_DEFAULTS A user’s theme and auto tip default settings. $TIP_SCRIPT The name of the tip script. $TIP_URL The Web-relative path for the tip files. $MAX_AVAILABLE_TIP The maximum number of tips from which to display the tip. $THEME_TEMPLATE[x] The list of theme templates. $PRINT_TEMPLATE[x] The list of print templates associative with the theme templates. The directory structure used in the irm.conf file supplied in the ch11 directory on the CD-ROM might need to be tailored to your own system’s requirements. Here is how the current directory structure looks: htdocs ($ROOT_PATH = %DocumentRoot%) | + home (base intranet application discussed in chapter 7) | | | + templates (templates used by intranet apps) | | | + themes (theme templates used by all intranet apps) | + photos (user photos used by all intranet apps) | + irm (IRM Applications) | + apps (IRM apps and configuration files) | + class (IRM classes) | 372 Part II: Developing Intranet Solutions 14 549669 ch11.qxd 4/4/03 9:25 AM Page 372 + templates (IRM HTML templates) | + themes (symlink to %DocumentRoot%/home/templates/themes) By changing the following configuration parameters in irm.conf, you can mod- ify the directory structure to fit your site requirements: $PEAR_DIR = $_SERVER[‘DOCUMENT_ROOT’] . ‘/pear’ ; $PHPLIB_DIR = $_SERVER[‘DOCUMENT_ROOT’] . ‘/phplib’; $APP_FRAMEWORK_DIR = $_SERVER[‘DOCUMENT_ROOT’] . ‘/framework2’; $PATH = $PEAR_DIR . ‘:’ . $PHPLIB_DIR . ‘:’ . $APP_FRAMEWORK_DIR; $ROOT_PATH = $_SERVER[‘DOCUMENT_ROOT’]; $REL_ROOT_PATH = ‘/irm’; $REL_APP_PATH = $REL_ROOT_PATH . ‘/apps’; $TEMPLATE_DIR = $ROOT_PATH . $REL_APP_PATH . ‘/templates’; $CLASS_DIR = $ROOT_PATH . $REL_APP_PATH . ‘/class’; $THEME_TEMPLATE_DIR = $TEMPLATE_DIR . ‘/themes’; $REL_PHOTO_DIR = ‘/photos’; $PHOTO_DIR = $ROOT_PATH . $REL_PHOTO_DIR; Creating a messages file The messages displayed by the IRM applications are stored in the ch11/apps/ calendar.messages file in the CDROM. You can change the messages using a text editor. Creating an errors file The error messages displayed by the IRM applications are stored in the /ch11/ apps/calendar.errors file in the CDROM. You can modify the error messages using a text editor. Creating Application Templates The HTML interface templates needed for the applications are included in the ch11/apps/templates directory in the CD-ROM. These templates contain vari- ous template tags to display necessary information dynamically. The templates are named in the irm.conf file. These templates are discussed in Table 11-2. Chapter 11: Internet Resource Manager 373 14 549669 ch11.qxd 4/4/03 9:25 AM Page 373 TABLE 11-2 HTML TEMPLATES Configuration Variable Template File Purpose $IRM_STATUS_TEMPLATE irm_status.html This template is used to show status message. $IRM_RESOURCE_ irm_resource_des.html This template is used to DES_TEMPLATE display resource description. $IRM_RESOURCE_ irm_resource_mngr.html This is the template used MENU_TEMPLATE to show/create resources. $IRM_RESOURCE_MODIFY_ irm_resource_modify_ This is the Web form MENU_TEMPLATE mngr.html template to modify resource information. $IRM_CAT_HOME_TEMPLATE irm_cat_home.html This is the category index template. $IRM_CAT_ADD_ irm_cat_add_mod.html This is the Web form MODTEMPLATE template to add or modify a category. $IRM_SEARCH_ irm_search_result.html This template is used to RESULT_TEMPLATE show search results. $IRM_SEARCH_TEMPLATE irm_search.html This template is used to show search options. $IRM_MOTD_TEMPLATE irm_motd.html This template is used to generate the live note message. Creating a Category Manager Application This application, irm_cat_mngr.php, is responsible for managing categories. This application is included on the CD-ROM in the ch11/apps directory. It implements the following functionality: ◆ Allows administrative users to create, modify, and delete categories. ◆ Allows non-administrative users to create categories. Non-administrative users cannot modify or delete categories. 374 Part II: Developing Intranet Solutions 14 549669 ch11.qxd 4/4/03 9:25 AM Page 374 The ch11/apps/irm_cat_mngr.php in the CDROM is an implementaiton of this application. This application has the following methods. run() When the application is run, this method is called. It does the following: ◆ Creates a theme object, $this->themeObj. ◆ The current user’s theme choice is stored in $this->theme by calling the getUserTheme() method of the theme object created. ◆ Next, if the application is called with cmd set to add query parameter, the addDriver() method starts running. If cmd is set to modify then the modifyDriver() method is called. Similarly, if cmd is set to delete then it invokes deleteCategory() method. If the cmd is set to null then it calls the showMenu() method. In other words, the run() method decides which functionality is requested by the user and calls the appropriate driver method to perform the desired operations. addDriver() This method controls how add operations are performed on categories. It works as follows: ◆ If step is set to 1 in the query parameter when the application is called, this method calls the displayAddCategoryMenu() method to show the category creation options. ◆ If step is set to 2 in the query parameter when this application is called, this method runs the addCategory() method to add the new category. modifyDriver() This method controls how modify operations are performed on categories. It works as follows: ◆ If step, query parameter, is set to 1, then it calls the displayModifyCategoryMenu() method to show the category modification options. ◆ If step, query parameter, is set to 2, then it runs the modifyCategory() method to start the category modification process. addCategory() This method adds new category to the database. It works as follows: Chapter 11: Internet Resource Manager 375 14 549669 ch11.qxd 4/4/03 9:25 AM Page 375 . $_SERVER[‘DOCUMENT_ROOT’] . ‘/pear’ ; $PHPLIB_DIR = $_SERVER[‘DOCUMENT_ROOT’] . ‘/phplib’; $APP_FRAMEWORK_DIR = $_SERVER[‘DOCUMENT_ROOT’] . ‘/framework2’; $PATH = $PEAR_DIR . ‘:’ . $PHPLIB_DIR . ‘:’ . $APP_FRAMEWORK_DIR; $ROOT_PATH. the live note message. Creating a Category Manager Application This application, irm_cat_mngr .php, is responsible for managing categories. This application is included on the CD-ROM in the ch11/apps. Developing Intranet Solutions 14 549669 ch11.qxd 4/4/03 9:25 AM Page 374 The ch11/apps/irm_cat_mngr .php in the CDROM is an implementaiton of this application. This application has the following methods. run() When