demonstration portal login  
customizable database-driven applications for the web


PortalApp Documentation   v2.2a (Freeware)


:: Installation
:: Configuration
:: Database Schema
:: Customization
:: User and Administration Interfaces
:: Support



Installation

The PortalApp installation process entails..
    1) "unzipping" the portal .zip file
    2) extracting or copying the files to a Web accessible folder
    3) connecting to the Access (.mdb) or SQL server database

    For Access
    • - unzip the .zip file to a Web shared (alias or virtual created via IIS) folder
    • - make sure the '/data' folder is write accesible to the IUSR_MACHINE account
    • - make sure the database connection paths (cn.Open, user_cn,Open) in 'i_utils' are valid paths to the database

      NOTE: "Operation must use an updateable query" -- The most common reason for problems is that the Internet Guest account (IUSR_MACHINE) does not have 'Write' permissions on the database file (.mdb). To fix this problem, use the Security tab in Windows Explorer to adjust the properties for this file so that the Internet Guest account has the correct permissions. When using Microsoft Access databases with ADO, it is also necessary to give the Internet Guest account Write permissions on the directory containing the .mdb file. This is because Jet creates an .ldb file to handle database locking. You may also need to give read/write permission on the Temp folder because Jet may create temporary files in this directory.

    For SQL
    • - unzip the .zip file to a Web shared (alias or virtual created via IIS) folder
    • - create a database on your SQL server
    • - execute the included portal.sql script on the new database (WARNING: executing the script on an existing SQL database will delete all tables and data!!)
    • - update the database connection strings (cn.Open, user_cn,Open) in 'i_utils.asp' for your SQL server database (ie; "PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername_or_ip;UID=myuserid;PWD=mypwd;DATABASE=mydatabase")

Configuration

To set-up your portal, there are some basic settings that need to be modified. Some of these settings can be updated from your Web browser, and others require that you can open the appropriate .asp files in an editor. This editor can be any standard text or HTML editor (Visual InterDev, Homesite, Dreamweaver, Notepad, etc..). The portal database comes pre-populated with data so that you can see how the .asp pages interact with the database.
  1. Define categories:

    All of the links and content in the portal are classified by categories. You probably have a hierarchical list of categories and sub-categories in mind, and now is the time to define these using the portal admin pages. Categories can be anything that is best suited for your portal. Your categories might by topics, subjects, regions, groups or any other multi-level classification system that will fit to the links and content that will later be added to your portal. To define new, or to change the existing categories go to the admin_cats.asp from your Web browser (you must login as admin/admin to access this page).

    Category data is stored in the 'Cats' table. Each category has a label that is stored in the 'Cat' field and a related 'CatId' that is an automatically generated (Access: autonumber or SQL: identity field) number. This 'CatId' is created when you add a new category. There is also an optional 'ParentId' field. This field is used to create the hierarchy of categories and sub-categories. Examine the table below to see how the 'My Main1 Sub Category' and 'My 2nd Main1 Sub Category' sub-categories are created under the 'My Main1 Category' category. Cat Table
    CatId Cat ParentId
    104 My Main1 Category
    105 My Main1 Sub Category 104
    106 My 2nd Main1 Sub Category 104
    107 My Main2 Category


    Categories without ParentId's are considered to be root (or main) categories. More advanced developers may also wish to also use the 'RelatedId' field to created related categories that will display at the bottom of the 'links.asp' page. Category relationships can be updated using 'admin_related_cats.asp'

    The CategoryTypes table (admin_cattypes.asp) is used to create different groups of categories. You may want to have one set of categories for links, and a different set of categories for articles, and other groups of categories for site information, classified ads, images, etc..

      - 'Link' category examples: Web designers, Web developers, Other software companies, etc..
      - 'Content' category examples: Web development, Web design, Programming, etc..
      - 'Classified' category examples: Real Estate, Jobs, Automotive, etc..

    By default, several CatTypes have been created and can be updated using the 'admin_cattypes.asp' page. To see how the CatTypes affect site hierarchy view 'cat.asp' in your browser. This page organizes each category by it's category type, and then display subordinate categroies, content, links, and classifieds. If you choose to modify the existing, or create new CategoryTypes, you may need to also modify the pages that are used for content display or submission. The Category selection list in these pages reference the corresponding CatType, so if you change the value of the CatTypeId in the database, you'll need to change the SQL query that is used to create the category select list on some pages. The SQL query is defined within the actual .asp code, so you'll need to edit the appropriate pages in a text or HTML editor.

    These queries can be changed by modifying the SQL statement used to created the "Category" select lists..

    For example, the 'submit.asp', 'submit_content.asp', 'admin_links.asp', and 'upd_link.asp' all contain a "Category" select list that references CatTypeId=2, so that only the "Link and Article" categories are displayed in the list...

    ie; =get_options ("SELECT Cat... ...WHERE Cats.CatTypeId = Cattypes.CatTypeId AND CatTypeId = 2, CatId)

  2. Define content types:

    You may intend to use the portal to manage many different types of "content". You may want to display articles, news stories, press releases, or other content bodies that contain text and images. To define content types use admin_contenttypes.asp. You'll see that several content types have already been defined. You can edit the existing types, or add new content types for your portal.

    If you choose to add new content types, you may need to update the 'user_profile.asp' page where the value of the ContentTypeId has been hardcoded. For example, 'user_profile.asp' is used to display content that has been submitted by any given user. The last section of this page displays content of type 'Article'. ContentType 'Article' has a ContentTypeId value of 2 in the database. The link for submitting new articles is 'submit_content.asp?ContentTypeId=2'.

  3. Define link types:

    When organizing external links to other sites you can classify links by "type" (as well as categories described above). The 'admin_linktypes.asp' page can be used to define various types of links.

  4. Change the admin password:

    For security reasons, it is recommended to change the default admin account password (admin) via 'admin_users.asp' To change the password, or any other account fields, click the [edit] link in the row for username 'admin'.

Database Schema
    Database Tables:

    Cats, CatTypes - These tables establish the hierarchy of categories througout the site. Categories can be anything you want such as regions, topics, subjects, people, etc.. CatTypes are used so that different categories sets can be used to organize different portal areas. For example, you may want "Good sites", "Bad sites", and "OK sites" as link categories, but "News", "Articles", and "Tutorials" as content categories. You might also want the classifieds area to use it's own categories. Since the 'ParentId' field is used to establish parent, child relationships you can define several levels of categories (ie: Main category, sub category, sub-sub category, etc..).

    Content, ContentTypes - These table are used to manage the content area. ContentTypes can be used to define different types of content. Content can also be related to a category (CatID). The submitter of the content is identified by user_id.

    Links, LinkTypes, LinkRatings - These table are used to manage the links area. Links always have a related category (CatID). LinkTypes can be used as another means to classify links. For example, link types might be: "resource", "article", "news/press release", "personal site", "external link", "internal link", "download", etc.. The submitter of the link is identified by user_id.

    Disc_Forums, Disc_Replies, Disc_Topics - These tables are used to manage the forums / bulletin boards. The "topmost" table is 'Disc_Forums', that have one or more related records in 'Disc_Topics', that may have one or more related records in 'Disc_Replies'. The submitter of the forum, topic or reply is identified by user_id.

    Newsletters - This table is used to manager the newsletter features. The submitter of the newsletter is identified by user_id.

    Events - This table is used to manager the calendar features. The submitter of any given event is identified by user_id.

    Users - This table is used to manage all "registered" users and for login validation. The "user_id" field also relates the user to data stored in the 'Links', 'Content', 'Classifieds', 'Disc_Forums', 'Disc_Topics', 'Disc_Replies', 'MessageRecipients', 'Messages', 'Surveys', 'Events' and 'Auctions'. Using the "user_id" any data that is posted by or intended for any given user can be tracked.

    UserLinks - This table is used to track and manage a user's favorite links.

    Some other tables may exist in the database that are not used by the application.

Customization

To make changes to you portal, an understanding of Active Server Pages, VBScript and relational database design is needed.

Changing the style and look of the portal

    Your own custom design can also be applied by editing the 'i_header.asp' and 'i_footer.asp' HTML files that create a "wrapper" around the page content. Most fonts and colors used throughout the portal are defined in the default.css file. You can change the style by modifying the values in the default.css, or reference a different .css file in 'i_header.asp'. Several other example other style sheets are provided(default1.css, default2.css, etc..). The code that references the .css file is in the section of 'i_header.asp'

    <link rel=stylesheet type="text/css" href="default.css">

Changing page content and functionality

    The portal home page (default.asp), is the most common page that clients and developers wish to modify. You may want to change the layout, or display different database-driven content. Familiarity with HTML, ASP, VBScript, and database design is useful when undertaking this task. To modify the home page (or any other page), simply open the page in any standard text or HTML editor. Modify 'i_menu.asp' to change the navigation throughout the site. A second example home page (default2.asp) is also provided as an example of how the layout and features of the home can be changed. This page uses it's own header(i_header2.asp), footer(i_footer2.asp), and menu(i_menu2.asp).

    If you would like to modify other portal pages, consider the following page architecture that is used consistently throughout all pages in the application.

    -- The 'i_utils.asp' file (database and login functions library) is included at the top of every page.

    -- Variables are declared (dim)

    -- The "request_" and "validate_" subroutines

    -- The "db_" subroutines

    -- Key database fields are requested

    -- The action variable is requested and handled using the "select case action" statement

    -- The 'i_header.asp' include file is displayed

    -- Forms and content are displayed

    -- The 'i_footer.asp' include file is displayed

Creating other user access levels / Modifying security

    You may also want to create different levels of security in your portal, where only certain users can access certain pages. Out of the box, the portal has 3 levels of access:

    accesslevel = null or 0 -- anonymous users that are not logged in

    accesslevel = 1 -- (member) these users can access all portal (user) pages and modify some data

    accesslevel = 2 -- (editor) these users can access most of the 'admin_' pages

    accesslevel = 3 -- (admin) these users can access all of the 'admin_' pages including user, category and file management

    When a user logs in, the session 'user_id' and 'accesslevel' variables are set. For example, the following code could be used to display a section only to users with an accesslevel of 2 or greater...

    <% if session("accesslevel") >= 2 then %> response.write "you are seeing this because you're logged in with an access level of at least 2" <% end if %>

    To set an access level for an entire page, just modify the check_security statement at the top of the page...

    <% check_security(n) %>
    ''' (where n is the value(1,2,3,4..) of the accesslevel field in the Users database table)


The User and Administration Interface

For consistency in page naming, the pages used for adminstration begin with 'admin_'. All of these pages can be used to add, edit, and delete data in the application database and require a user to be logged in with an accesslevel of 2 or greater. A users's access level is determined by the value of the accesslevel field in the Users table. The administrative pages used for User and Category management require a minimum access level of 3. For more information on security, see "Creating other user access levels / Modifying security"

All administrative features can be accessed via 'admin.asp'.
  • Category Management

    Category management is a one of the most important aspects of your portal. All of the links and content in the portal will fit into the hierarchy of categories (Root categories, sub categories, sub-sub categories, etc..)

    To add or edit categories, the 'admin_cats.asp' page is used. There is a form at the top of this page that is used to add or edit category information, and there is a table of the existing categories organized by root (parent or top categories) and sub-categories. You will see that each category has a corresponding category type. The category type enables you to have separate groups of categories. For example, there can be a set of categories used to organize the links and articles, another set for classified ads, and another distinct set for the image gallery.

  • User Management

    - Adding users: Login to the admin area using the default admin account (usr: admin, pwd: admin). Goto user administration ('admin_users.asp'), comlete the add user form, and click the 'Add User' button. Specify access level of 1 for basic users. Specify access level of 2 (or greater) for portal administrators and forum moderators. Users can also be added via the 'register.asp' page. This page is set to create basic users that will be added with an accesslevel of 1. User data is stored in the 'Users' table of the application database.

    There are situations where a user record is created in the 'Users' table with only the email and user_id fields populated. No username and password are needed when a user subscribes to a newsletter (subscribe.asp) or when an admin adds a link (admin_links.asp). Therefore, some user records may exist with only a 'user_id' and 'email'.

    - Logging in: 'login.asp' is used to prompt users for their username and password. When a user requests a security enabled page (check_security function) an permission level is obtained by referencing the current session 'user_id' and 'accesslevel' variables. If these session variables have not been set, the user is redirected to login.asp and prompted to login using their username and password credentials. The 'login.asp' also enables users to lookup a lost password. The user specifies their email address, and it is referenced in the 'Users' table. If a matching email address is found, the related password is emailed to the specified email address. As described above, there may be situations where no user_name or password exist, but an email address does. If a user attempts to lookup a password for an account with a non-existent user_name, they will be redirected to the registration form (register.asp). To find out more about the user email notification features click here.

    Once logged in, users can view and manage their own profile via 'user_profile.asp' and 'upd_user.asp'. The 'user_profile.asp' page also lets users view and compose internal messages, and view their favorite links, active discussions, and any links or content they have submitted.

  • Link Management

    - Link administration: 'admin_links.asp' can be used to add, edit, and delete links in the Links table. When an administrator adds a link, and specifies the "Webmaster email address", a new user record for this email address will be created in the 'Users' table. This enables administrators to add new links, and invite the site webmaster (speficied by the Webmaster email) to log-in and update their links. To prioritize links you need to set a priority level using 'admin_links.asp'. A priority value of 3 is normal, and priority of 1 is high. When the links display on the 'links.asp' page they will be ordered by Priority, Average Rating (AvgRating), and then Title.

    - User link submission: 'submit.asp' can be used to allow user to submit links. These links will be added to the Links table, and marked with Display=0. An administrator can later log-in to 'admin_links.asp' and approve the links for display. To find out more about the link email notification features click here.

    - Links display: All links are organized by category and displayed via 'links.asp'. There are 2 special "action" parameters that can be passed to this page. 'links.asp?action=new' can be used to request all new links, and 'links.asp?action=hot' can be used to request the most frequently viewed (or popular) links. Each link that displays on this page will have a 'rate this resource' link that opens the 'pu_rate.asp' pop-up page. This page enables users to rate the linked web site on a scale from 1-10.

  • Content Management

    - Content administration: 'admin_content.asp' is used to add, edit, and delete links in the Content table. Since there are different types of content (ContentTypes), not all of the fields are used for all types of content.

    To prioritize content you need to set a priority level using 'admin_content.asp'. A priority value of 3 is normal, and priority of 1 is high. When a list of content is displayed on the 'content.asp' page results will be ordered by Priority, Average Rating (AvgRating), and then Title)

    The 'admin_content.asp' page is also used to update the currently "featured" content. The "featured" content is requested and displayed on the portal home page (default.asp).

    - User content submission: 'submit_content.asp can be used to allow user to submit content (articles). This content will be added to the Content table, and marked with Display=0. An administrator can later log-in to 'admin_content.asp' and approve the articles for display by checking the "Display" checkbox.

    Values for 'ContentTypeId' and 'CatId' can be passed to the 'content.asp' page to filter the records that are displayed. For example, requesting 'content.asp?contenttypeid=2' will show only records of ContentTypeId=2 (Articles), whereas requesting 'content.asp' will display all content records.

  • Discussion Forums

    - Creating forums: Login in as an administrator (user accesslevel=2) to the admin area. Goto forum administration (admin_forums.asp) and click the 'create a new forum' link. Only other users that have accesslevel of 2 or greater can be selected as Forum moderators.

    - User forums interface: 'forums.asp' is used for all user forum interaction. Users can view the forums, read and post topics, and reply to topics. Users can also later edit there own topics and replies. To enable some of the message editing features the 'i_formatting.asp' include page contains several Javascript functions used in the forums.

  • Personalization (My Inbox)

    The personlized user features are enabled via the 'user_profile.asp' page. With the page, users can view and modify their related fields in the user table. They can also track information they have submitted, such as discussions and links.

Support and Customer Assistance

Information and assistance can be found in the support forums at ASPapp.com. Email and telephone support are not provided for this freeware version.



ASPapp.com

Copyright ©2000-2002 Iatek, ASPapp.com