RMDatabase README File
RMDatabase (RMdB) ver 4.0
Written by: P. Eric Huber
moonlight@hubernet.com
Release Date: April 25, 2001
(dba Moonlight Design)
http://www.hubernet.com/mld

Many Thanks to...
Doug Schubert, Adam Bayless and Curtis Jewell for their original works on earlier versions of RMDatabase that gave me the foundation to go as far as I have gone with this. Thank you.

CONTENTS

DISCLAIMER

RMDatabase is not a commercial product and is still not to the level that I would envision it to go. It does still lack in its language abilities and eventually I hope to have it completely multi-lingual capable. Because it is technically a "free" package (to LDS Mission Network affiliated sites), I cannot guarantee support. I do try and help where I can, but sometimes it is just not possible. I will not be responsible for any data loss or damage that comes from usage of these scripts. By using them you agree to indemnify me from any liability that may arise from their use. I recommend routine backups of your data directory (which is always a good practice anyway).



WHY VERSION 4?

I know some will ask why the effort on a new RMDatabase version. Dan Wilson's Site-in-a-Box (SIB) is making great strides and is a great alternative to those wanting to get a site up and running with minimal effort. There have also been efforts to create a centralized database that runs on mission.net that webmasters can utilize for their own sites. The advantage here is when webmasters decide to abandon their sites, the data is not lost. This is a worthwhile effort and I don't want to take away from it, but we are not there yet and I wanted to have a tool that can still be utilized on mission.net or any other ISP without requiring any external packages or database servers to run. Version 4 contains many enhancements and is a feature-rich product that I think mission alumni page webmasters will really like.



WHAT'S NEW IN VERSION 4?

RMdB 4.x is a result of comments and requests received from users of version 3.x from years of use. The following list represents just some of the enhancements in version 4:

  1. Integrated Administrator functionality - version 4.x uses a cookie to store the administrator password in the admin's browser. The password can stay active indefinately (until the admin click's the logout link) or the admin can have the password be active for only his/her session (until the browser is shut down). This means that once the administrator is logged in, there are no password requirements on any function.

    Essentially, there is only one point of entry to the page. There are still physically two scripts (rmdb4 and rmadm4) but from the browser perspective, everything is combined. All pages displayed have admin functions integrated into them and only manifest themselves if an admin currently viewing the page.

  2. Template Controlled Pages - version 4.x uses templates to determine how pages are displayed. This gives the admin greater control and flexibility in use of colors and graphics. Data from the database is displayed as a module on some pages (that can be put where ever the admin wants) and on the profile detail and edit pages the admin can customize the layout down to the field level.

  3. Database Export Capabilities - with version 4.x, you can easily export all or portions of your database at any time. You can select groups of records (all records, by president, or by mission) and check the fields you want to include. The process creates a comma-seperated value (.CSV) file which you can bring into Excel or any other utility that recognizes that format.

  4. Security Event Logging - version 4.x logs events such as invalid admin login attempts, invalid user passwords entered on profile updates, and password requests. The admin can view this log and then mark IP addresses to be included in the BADIPs file. Once an IP address is in the BAD file, all interactive functionality is denied to that address in the future.

  5. Modified Search Functionality - version 4.x changes the way searches are done from the way they were done in the past. Now, there is essentially one search function that takes all the search parameters used and focuses in on the records that meet all the criteria. Now, instead of searching for a person by first letter of last name, you type as many letters of the last name as you want and the script will give you all matches. Combine that by selecting a mission president, time period, or current address and search results are displayed much faster (especially on larger databases).

  6. Custom Settings Maintenance - version 4.x gives the admin the ability to maintain more switches and parameters through the browser than version 3.x. Some of these parameters are explained below:

    • Module Widths
    • Module Colors
    • E-Mail message files (you can now edit them through your browser as well)
    • Column Configurations (for lists - for sorting, columns to include, etc)
    • Toggle Lists and Search options to be included (or excluded) on the main database screen
    • Automatically convert case on Name(s) and addresses (you can select to turn this off, or force upper, lower, or mixed case).
    • Validate e-mail address and web address formats (if a user inputs an invalid e-mail address or web address, it is blanked out). Admin can toggle this on or off.
    • Toggle option to force all e-mail and URLs entered to be converted to lower-case.



INSTALLATION

Here is a description of the files included in this distribution: (The code between the filename and the description indicates the upload type needed - if you are FTPing these files to your ISP - [A]=ASCII upload [B]=Binary upload [N]=not needed)

readme.txt [N] this file
rmdb4.cgi [A] the main script.
rmadm4.cgi [A] admin functions script.
rmdb4.lib [A] library file containing shared functions used by both scripts.
rmcgi.lib [A] library file containing cgi functions used by both scripts.
home [A] default template file.
default [A] default template file.
column [A] default template file.
view [A] default template file.
edit [A] default template file.
error [A] default template file.
custom.db [A] default settings/parameters database.
lang.db [A] default language database.
new_usrs.txt [A] default new user e-mail message.
rqst_pw.txt [A] default request password e-mail message.
rmdb4.css [A] default stylesheet file.
bad_mail.gif [B] default "mark bad e-mail" icon.
del_rec.gif [B] default "delete record" icon.
err_banner.jpg [B] default error banner graphic.
head_bot.gif [B] default header (bottom strip) for database main page.
head_top.gif [B] default header (top portion).
ldsmn-88x31-m.gif [B] LDS Mission Network "member" button.
mailbutn.gif [B] default e-mail button icon.
sidebar.gif [B] default background graphic.
spacer.gif [B] transparent gif.
template.psd [N] Photoshop Multi-layer graphic of header file.
rmsetup [A] RMdB4 installation script.
setup [A] shell script - calls rmsetup.

To install RMdB 4.0, follow the steps below. NOTE: If you currently have a previous version, this setup installs a NEW instance for version 4. Nothing setup previously is overwritten. If you have version 3.x, the setup script for version 4 will search for your rmset3.pl file and utilize settings there to create your rmdb4.ini file (basically the equivalent of rmset3 for version 4).

  1. Create an "install" directory below your home directory on your ISP account. Then FTP all of the above files into that directory. (NOTE: BE SURE AND UPLOAD THE FILES USING THEIR PROPER FORMAT - ASCII or BINARY. 90% OF ALL ERRORS THAT OCCUR ON INSTALL ARE RELATED TO UPLOADING SCRIPTS USING THE WRONG FORMAT).

  2. Next you need to set the proper permissions on the rmsetup and setup scripts. From the telnet (or ssh) prompt, move to your install directory.

    type "chmod 755 rmsetup"
    type "chmod 755 setup"

    (This makes both of these files executable)

    (Depending on your FTP client, you may be able to run chmod from within FTP)

  3. If you are installing these scripts on mission.net, you may skip to step 5.

  4. Verify that you have two environment variables set (HOME and USER). The installation script relies on these variables and if you don't have them, you will need to create them. There are various ways of creating environment variables (depending on your unix shell). You will need to handle this on your own - but you might try one of the following ways:

    To view your environment variables:
    type "set" (or if you have a lot scroll too fast type "set | more")

    To set environment variable:
    If you are using csh: - [setenv HOME "/home/eric"]
    If you are using bash: - [HOME="/home/eric"; export HOME]

    Also verify that you have a "public_html" or "mission_html" directory off of your home directory and that your "cgi-bin" directory is off your HTML directory.

  5. Next run the setup script:
    type "./setup"

  6. If you get a successful message at the end, your scripts are now installed.

  7. Next you need to verify the path to perl is correct in the rmdb4.cgi and rmadm4.cgi scripts (in your cgi-bin directory). Using vi, pico, emacs or other favorite editor, ensure that the path is correct (make sure to leave the "#!" in the path to perl).

    NOTE: To verify that it is, you can type "which perl" from the shell prompt and your system will tell you where it is located.

  8. Next, you need to edit your rmdb4.ini file and verify that paths passwords, missions, and other settings are correct. If this is a new install, you WILL have to edit the values here. The default password is "master" on a new install so be sure and change it. Also, check the "@missions" array towards the bottom of the file. If it is a new install, you WILL need to edit this portion. If your mission page is just for one mission and you do not identify any sub-missions or defunct missions, then make sure that you put one mission name in the array (the name of your mission) and delete the East, West, North, and South missions that come by default. Most of the other settings in this file will be correct when the install script finishes setup - so just verify the file and correct any thing that wasn't setup correctly or that you want to change.

    NOTE: If you do FTP this file from your ISP to make changes on your local computer remember to download AND upload this file in ASCII mode as well.

  9. When you get to this point, you are ready to go. If you previously used version 3.x, the installation script should have copied your alumni.db, pres.db and lost.db database files into the new data directory for rmdb4. If you are installing this new or the installation script was unable to locate your existing databases, you will start out with empty databases. Before going "live" with your database, you will want to login as administrator and update your mission president's database so users will have presidents to select from when they register.

    The URL to use for script access should be (unless you have customized it):

    http://www.mission.net/your/mission/cgi-bin/rmdb4.cgi

    (obviously you would replace the "/your/mission" portion with the actual mission name used if you are on mission.net and if you are not on mission.net, then you would begin with your own domain instead of "www.mission.net")


PATH MAP

This path represents the structure for mission.net users. If you are installing on your own ISP, the setup script will attempt to do the same setup but your mission_html directory may be called public_html on your ISP account.

  Home directory
  rmdb4
  data
  pres.db
  lang.db
  custom.db
  lost.db
  badips.db
  new_usrs.txt
  rqst_pw.txt
  rmdb4.log
  templates
  home
  default
  error
  column
  view
  edit
  mission_html
  index.html
  count.html
  other HTML files and directories
  cgi-bin
  rmadm4.cgi
  rmdb4.lib
  rmcgi.lib
  rmdb4.ini
  other cgi scripts
  rmdb4
  css
  rmdb4.css
  images
  bad_mail.gif
  del_rec.gif
  head_bot.gif
  head_top.gif
  ldsmn-88x31-m.gif
  mailbutn.gif
  sidebar.gif
  spacer.gif
  err_banner.jpg


CUSTOMIZATION THROUGH STYLESHEETS AND TEMPLATES

RMdB 4.x introduces a new level of administrator control through the use of stylesheet (css) and template files. This is an advanced level of customization offered. You must be cautious when editing these files. If you don't understand HTML and CSS very well then I would suggest staying with the default files provided.

STYLESHEETS (CSS)

Upon installation, the rmdb4.css file is copied into the "rmdb4/css" directory off the HTML directory that was found on your account. This will be the only file in this directory. You may edit this file, add more classes, but be sure and not delete the classes that are there. The scripts utilize these classes when creating modules both for administrator options as well as regular user options. Again, you may modify the parameters on existing classes, just don't change the class names. Another good tip - be sure and save a copy of the original css file - just in case.

TEMPLATES

RMdB 4.x uses six template files for all of its functionality. Each template file is nothing more than a regular HTML file with special tags that the perl scripts run "search and replace" functionality on. In some cases, these tags also pass parameters to the perl engine that perform extra tasks or retrieve specific information from the database. These tags will be explained in detail below.

The six template files that are used are explained here. Each filename is fixed (you cannot define your own templates) and is used for a specific function:

home This template produces the main entry point page for the database script.
default This template is used for most admin pages displayed and any other page that isn't defined elsewhere.
error This template produces error messages that are displayed to the user.
column This template is whenever an alumni list or results of a "search" are displayed.
view This template displays the information for a specific alumni record.
edit This template displays the form that is used to add or edit alumni information.


TEMPLATE TAGS

All RMdB template tags use the following format (within the quotation marks):

    "[<tag_name>:<param>]"

where <tag_name> is the name of the tag and <param> is the parameter string that is passed. NOTE: some tags do not require parameters.

Not all tags are available on every template. A list of the tags available as well as the templates they are available on and the function that they perform is explained in the table below.

Tag Name Valid Templates Description
[COLOR:<param>] ALL TEMPLATES This tag excepts a from the list below which corresponds to the values setup under the "customize settings" option:
MOD1_HEADModule 1 heading color
MOD2_HEADModule 2 heading color
MOD3_HEADModule 3 heading color
MOD_BG1Module 1 background color
MOD_BG2Module 2 background color
MOD_BG3Module 3 background color
[WIDTH:<param>] ALL TEMPLATES This tag excepts a <param> from the list below which corresponds to the values setup under the "customize settings" option:
LGLarge module width
MDMedium module width
SMSmall module width
[PATH:<param>] ALL TEMPLATES This tag excepts a <param> from the list below which will substitute the appropriate URL value:
IMAGEthe (URL) path to the images directory
HOMEthe (URL) path to the mission homepage
CSSthe (URL) path to the rmdb4.css file
CGIthe (URL) path to the rmdb4.cgi script
[COPYRIGHT:] ALL TEMPLATES This tag requires no parameter. NOTE: It is required to use this tag somewhere on all templates.
[BODY:] default
column
error
This tag requires no parameter. It is used to display the main content on the default, column and error templates.
[TITLE:] ALL TEMPLATES This tag requires no parameter. It should be used between the <TITLE> and </TITLE> HTML tags on all template files to capture the page title.
[PAGEHEAD:] default
column
error
home
This tag requires no parameter. It displays a page header text message on each page dependent upon the template that is used. A description of the header message follows below:
default:Varies (usually a page description)
column:Description of the query
error:The word "Error"
home:Page title (from the language DB)
[MAIN_REG:] home This tag requires no parameter. It displays the value from the language DB that represents the link to Register.
[MAIN_LNG:] home This tag requires no parameter. If a second language is defined. This tag will display the the other language name as a link to toggle that language active.
[MAIN_NEW:] home This tag requires no parameter. It displays the value from the language DB that represents the link to view newly registered alumni (last 30 days).
[ADM_MAILTO:] ALL TEMPLATES This tag requires no parameter. This tag will create an <a href="mailto:"></a> HTML link and display the administrator's name as the link (linking to the administrator's e-mail address).
[MISSION:] ALL TEMPLATES This tag requires no parameter. This tag will display the mission name (as defined in the "customize settings" option).
[ACTION:<param>] view
edit
This tag will accept one parameter on the "view" template and one of two parameters on the "edit" template. They are explained below:

On the "view" template use [ACTION:OPTIONS] to display the "Options Module". The options module will display a table with a width equalled to the small module width defined in the "customize settings" option.

On the "edit" template use [ACTION:FORM_START] to setup your <form> tag and the appropriate action related to either editing an existing entry or adding a new one (Since the same template is used for both, be sure and use generic wording on template to handle instructions for both).

Also on the "edit" template use [ACTION:FORM_SUBMIT] to setup your submit button within your form. This tag will also determine whether a password is required (is the admin making the change), or if it is new entry, ask the user to enter a new password verses asking the user to enter an existing password for verification.

[MODULE:<param>] home This tag will accept parameters that correspond to modules displayed on the the main database page. These parameters are described below:
MAINDisplays the main count line from the language DB
SRCHDisplays the search module
LISTDisplays the lists module
FOOTDisplays the problems/contact footer from the language DB
ADMDisplays the Admin Options module

This tag also accepts an additional parameter that will override the default width of the module called (EX: [MODULE:ADM,150] will display the admin options module using a table width of 150 pixels).

[FIELD:<param>] view
edit
This tag will accept a value corresponding to list of fields below and display that value:
RECNOThe alumni record ID
MISSIONARYMissionary title lastname "Elder Jones"
FULLNAMEFirstname Lastname (now)
SPOUSESpouse
SERVETIMEStartdate to Enddate
EMAILE-mail address (or "None" if blank)
HOMEPAGEhomepage (as link)
WORKWork/School (as link if workURL)
CITIESCities and Companions comments
OTHEROther comments
CURADDCurrent Address
CURPHNCurrent phone
PERMADDPermanent Address
PERMPHNPermanent Phone
PRESMission President(s)
CHILDRENChildren
LASTUPLast updated date
MISSIONMission
OCCUPATIONOccupation
[INPUT:<param>] edit This tag requires a parameter that represents the input field on a form. It optionally can accept a second parameter which represents "size" for HTML <input> tags or "cols" for HTML <textarea> tags.

(EX: [INPUT:LASTNAME,15] would generate an input tag with "size=15" as an element of the tag). If no size value is included, the default size for the field in question is used. The valid input names that can be used are listed below:
LASTNAME Last name (while in the mission).
FIRSTNAME First name
SPOUSE Spouse
BEG_MONTH Starting Month select box
BEG_YEAR Starting Year select box
END_MONTH Ending Month select box
END_YEAR Ending Year select box
EMAIL E-mail Address
HOMEPAGE Homepage URL address
WORK Work or School name
WORKURL Work or School URL
CITIES Companions and Cities text
OTHER Other comments text
C_ADD Current street address
C_CITY Current city
C_STATE Current state
C_ZIP Current zip code
C_CTRY Current country
C_PHONE Current phone
P_ADD Permanent street address
P_CITY Permanent city
P_STATE Permanent state
P_ZIP Permanent zip code
P_CTRY Permanent country
P_PHONE Permanent phone
PRES1 First Mission President select box
PRES2 Second Mission President select box
PRES3 Third Mission President select box
PRES4 Fourth Mission President select box
CHILDREN Children's names
MISSION Mission name select box
TITLE Missionary title select box
OCCUPATION Occupation
LAST_NOW Last name (now - married name for sisters)

For the best example of how to use tags, study the default templates that come with the distribution. Make sure to save them for future reference as needed.

Also, I would like to develop a repository of sample templates and stylesheets to use. Send me copies of your efforts and I will review them for inclusion in the repository.



A WORD ABOUT COPYRIGHT

Now finally, please be respectful of my copyright notice. I know to some, it may be considered a nuisance and I didn't require it on earlier versions - in fact, I even allowed the admin to customize the copyright line as they saw fit. I appreciated those that kept me (Moonlight Design) listed even when they were not required to do so. The "footer" class within the stylesheet controls the display of the copyright. You can adjust it how you see fit but I do ask that it be large enough to be readable.

This rewrite project has taken me about 50 hours to complete over a period (off and on) of 6 months. All I ask in return is credit for my efforts. I don't have any problems with people tweaking the code for use on their mission sites (although with the use of templates and stylesheets, this should be minimized), but selling, distributing, or profiting from the code is strictly prohibited. I am not charging anyone for this code, It is only logical that noone else charges for it. Also - as mentioned in the scripts, RMdB 4.x is not to be given or utilized by anyone not associated with LDS Mission Network.



CONTACT INFORMATION

Eric Huber (dba Moonlight Design)
Home: (801) 299-0851
Work: (801) 297-1654
moonlight@hubernet.com