# WorkNet - an OnLine Employment Service

## Overview

WorkNet is a LiveWire Pro application that can really be looked at as a composite of several, reusable components that many sites designed with LiveWire will most likely want to incorporate in some form. The purpose of the WorkNet application is not only to show how these common components can be constructed using LiveWire, but it also allows LiveWire developers to take code directly from WorkNet and make a few modifications to fit their needs. In other words, if your site needs User Management features, Login/Security features, etc. rather than creating them from scratch, you can use the code and documentation in WorkNet either directly, or as a guide to developing your applications.

##

## Passwords and UserID's you will need to test out the application:

- The logon for the administrator is currently:

- userid = admin
- pass = admin

- From the administrative menu, you can obtain a list of userids and passwords for Job Seeker's and Employers so that you may try out those functions as well. To get you started, here are two logons:

- Employer:

- userid = 3pigs
- pass = oink

- Job Seeker

- userid = user10
- pass = pass10

Feel free to try out the others you find in the Administration Menu.

##

## WorkNet Architecture

WorkNet is divided into several major components:

- User Management
- Login/Security features
- Site Management Component
- Matching/Searching Component
- Advertising Component
- Site specific operations

The site is divided up into several subdirectories in an effort to keep each component and it's functions as distinct and reusable as possible. Most functions for a component reside within a single subdirectory whereever possible.

### User Management

The User Management component allows basic data entry operations on database tables. Adding new users (of distinct user types), editing user attributes, listing current users (which can depend on security - i.e. who is given permission to look at particular user information), etc. Most of the data entry forms for WorkNet deal, of course, with fields that are specific to the WorkNet database on the back-end. However, the concepts for adding, updating and listing users is exactly the same as what you will see in the WorkNet code. All that needs to be changed are the names of the form elements and the cursor field names, and the code can be easily re-used.

The User Management component consists of the following files under the worknet directory:

Under the "root" directory worknet:

- newuser.htm - the data entry form where new users pick id's and passwords (reusable for any usertype)
- register.htm - the back-end code that adds new users to the database

Under the profile subdirectory:

- seditpro.htm - data entry form for job seekers
- eeditpro.htm - data entry from for employers
- jobedit.htm - data entry for jobs listings
- supdate.htm, eupdate.htm jupdate.htm - server-side code to perform the database updates
- seekhome.htm, emphome.htm - "main menus" for seekers and employers, respectively

Under the lib subirectory:

- usermgt.js - some server-side JavaScript support functions

### Login/Security

The security component of the WorkNet application allows a LiveWire Pro developer to add security to their application without having to rely upon the server administrator to set up allowable users or IP addresses. With the security component, the LiveWire developer has control over what users are allowed or disallowed in certain pages. Essentially, the security feature uses one function in a library (.js) file, along with the Informix database that contains userid's and passwords, to check for authorization at the page level. In fact, this security component can be used at even deeper levels, disallowing viewing of particular fields of the database to different users, for example. Users are authorized via a login screen which checks the userid and password against what the user enters.

The files involved are:

- login.htm - the data entry form where users login
- validate.htm - code that performs the validation
- function securityCheck() in usermgt.js in the lib subdirectory
- function isUser() in usermgt.js

### Site Management

The Site Management functions allow the administrators of the site to perform special operations that are restricted to those with administrative privileges. For example, in WorkNet, administrators are allowed to activate and deactivate particular Employers and Advertisers. Obviously, not just anyone should have this kind of power over the user database.

Site Management consists of the following files:

- all files under the manage subdirectory
- the function isAdmin() in usermgt.js which validates administrative logins

### Matching Engine

The Matching engine allows job seekers to find jobs offered by employers. However, it is not merely a site-specific searching engine. The code demonstrates how one can construct a component that allows one thing to be matched with another. The rules used to match seekers to jobs are specific to WorkNet, but the structure of the code in the searching engine shows how to construct if-else statements to implement the matching rules, it illustrates a scoring system for weighting matches, and much of the code could be reused in other searching or matching applications.

The Matching Engine consists of:

- all files under the match directory

### Advertising Component

The Advertising component allows LiveWire Pro developers to manage advertiser accounts within a database. Many sites have sponsors with small, hot-linked graphics on the site in return for payment. The advertising functions allow site administrators to add, modify and activate/deactivate advertisers quickly and easily. Since the database stores information about the GIF file to be used for the sponsor ad and the url that it should link to, it would be a simple task for devlopers to write a short function that would randomly pick an advertiser graphic, and construct the link on a page.

The Advertising component consists of:

- all files under the advert directory
- adacct.htm - add and update advertisers
- adactive.htm - activate/deactivate advertisers

## Other Support Functions

In the lib subdirectory, there are several .js files which contain some useful functions that are used throughout the WorkNet application. For instance, before data can be sent to the Informix database via SQL, some processing must be done on the data to "escape" non-printable characters, like carriage returns. In the sqlstr.js file, you will find several functions used to process data both before it is loaded into the SQL statment, and when data is retrieved from the database. LiveWire devleopers may find them very useful as they are completely generic and will work with any SQL statement. These functions are fully documented and it is recommended that developers take a look and see how to use them.

Also present are some functions to dynamically create some form elements which would otherwise be laborious, or which are used often in many sites. There are functions to:

- statesList(), statesListFull() - functions which dynamically create a list box or a drop down box of the 50 states (plus D.C.) where statesList() - lists only abbreviations in the list box, and statesListFull() lists the full state name in the box.
- countryList() -a list or drop down box of several major countries/regions
- dynBody() - functions to dynamically create attributes for the BODY tag
- dynSelect() - a function to dynamically create a list or drop down box based on a lookup table in the Informix Database

Each function is very configurable and will save a lot of time. Also, each of these functions are ready-to-use with no modifcations necessary whatsoever. Just "plug and play" reading the function documentation first to determine how to call the functions and what arguments are necessary.

Back to the WorkNet Home Page