Chapter 8: Intranet Simple Document Publisher 275 (Web server iis)
Wednesday, October 31st, 2007Chapter 8: Intranet Simple Document Publisher 275 A category object called $catObj is created. If the user has supplied the category name using a query parameter ($cat), the selected category name is used to retrieve the category ID ($selCid) using getCategoryIDbyName() of the $catObj Category object. The list of categories stored in $categories is used to populate an HTML drop-down list, but the user is not allowed to change the chosen category, so the menu is disabled. The publication date is stored as the current date using date( m/d/Y ,mktime()). If the $nid query parameter, which is used to signify that the user is modifying an existing document (as $nid represent document ID), is not empty, the chosen document is loaded into the Web form using a document object called $docObj. Note that if multiple documents are selected by the user, an alert message is shown to inform the user that only a single document can be modified at any time. Unlike add, in case of modify the $categories list is used to create the HTML drop-down list, but this time the user is allowed to change the current category of the document. Therefore, the menu is not disabled. Finally, the user is presented with the filled out template with document data, which is embedded in the user s theme template. . displayAddModCategoryMenu(): This method is responsible for displaying the add or modify category Web form. It works as follows: It creates a theme template object called $themeTemplate and a template object called $template. These templates are populated with various template key=values. It creates a category object called $cObj and retrieves the order of the categories in $lastOrder using the getHighestOrder() method. If the method is called with a category ID ($cid), the method checks to see if more than one category is chosen. In case of more than one, it shows an alert message to state that only one category can be modified at any time and returns null. In case a single category ID is provided in $cid, a new category object, $catObj, is used to get the publishers ($publishers) and viewers ($viewers) using the getPublishers() and getViewers() methods, respectively. A DBI object called $authDBI is created to point to the central user database (USER_DB_URL). A user object called $userObj is created using the $authDBI object the database reference. A list of current users is retrieved in $users using the getUserList() method of the $ userObj object.