Gossamer Forum
Home : Products : DBMan : Installation :

"list all" problem Can you help?

Quote Reply
"list all" problem Can you help?
I don't quite get it....there is a "list all" link on the DBMAN installation that obviously displays all records on request. It seems as I add fields to my installation this function disapears and is instead replaced by the error message stating search criteria required or something to that effect. I don't quite understand why I lose this function as I add additional fields. Somebody? anybody?

BELOW is a copy of my default.cfg & html.pl sections that may be of some help.

# Wait until this file finishes loading and then save it to your hard drive as default.cfg.
#
# After you have saved the file, use the "back" button on your browser to build the next file.
#
# ----------------------
# DBMan
# ----------------------
# Database Administrator
#
# File: default.cfg
# Description: This is the setup file that contains the database definition,
# and most of the options required to set the program up.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.04
#
# COPYRIGHT NOTICE:
#
# Copyright 1997 Gossamer Threads Inc. All Rights Reserved.
#
# This program is being distributed as shareware. It may be used and
# modified free of charge for personal, academic, government or non-profit
# use, so long as this copyright notice and the header above remain intact.
# Any commercial use should be registered. Please also send me an email,
# and let me know where you are using this script. By using this program
# you agree to indemnify Gossamer Threads Inc. from any liability.
#
# Selling the code for this program without prior written consent is
# expressly forbidden. Obtain permission before redistributing this
# program over the Internet or in any other medium. In all cases
# copyright and header must remain intact.
#
# Please check the README file for full details on registration.
# =====================================================================
# File and URL's
# --------------------------------------------------------
# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://irealtor.nu/cgi-bin/dbman";
# URL of dbman.
$db_script_url = $db_dir_url . "/db.cgi";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/default.db";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/default.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/default.log";
# Full path and file name of the html routines.
require $db_script_path . "/html.pl";

# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
'Date' => [ 0, 'date', 10, 20, 1, &get_date(), ''],
'MLS#' => [ 1, 'numer', 6, 6, 1, '', '\d{6}'],
'Address' => [ 2, 'alpha', 20, 30, 1, '', ''],
'List Price' => [ 3, 'alpha', 10, 15, 1, '$', ''],
'District' => [ 4, 'alpha', 0, 15, 1, '', ''],
'Realtor' => [ 5, 'alpha', 20, 30, 1, '', ''],
'Company' => [ 6, 'alpha', 20, 30, 1, '', ''],
'Phone' => [ 7, 'alpha', 12, 15, 1, '1-250-', ''],
'Email' => [ 8, 'alpha', 20, 30, 1, '', '.+@.+..+'],
'Remarks' => [ 9, 'alpha', '50x5', 750, 1, '', ''],
'Photo' => [10, 'alpha', '50x2', 300, 0, '', ''],
'Agent ID' => [11, 'alpha', 14, 14, 1, '', '']
);

# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'MLS#';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 0;
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# Display Benchmarking Information (1 = Yes, 0 = No).
# use Benchmark; # Uncomment this line if benchmarking is used.
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 0;

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
'District' => 'Central Saanich,Colwood,Esquimalt,Highlands,Langford,Malahat,Metchosin,North Saanich,Oak Bay,Other,Saanich East,Saanich West,Shawnigan Lake,Sidney,Sooke,Up Island,Victoria,Vic West,View Royal'
);

# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = (

);

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = (

);

# Default maximum number of hits returned in a search.
$db_max_hits = 10;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 1;
# Regular and title fonts used in auto_generation and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';

# Authorization Options
# --------------------------------------------------------
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;

# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)

# Enable (1) or disable (0) logging.
$auth_logging = 1;

# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 1;

# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);

# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 0;

# Permissions a new signup should get.
@auth_signup_permissions = (1,1,1,1,0);
# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 1;

# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = 11;

# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = "";


# ===========================================================================
# Build up some variables from your definitions. Internal use only.
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}
1;

*************************************************
##########################################################
## Record Layout ##
##########################################################

sub html_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info.

my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=0 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Date:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Date" SIZE="10" VALUE="$rec{'Date'}" MAXLENGTH="20"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>MLS#:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="MLS#" SIZE="6" VALUE="$rec{'MLS#'}" MAXLENGTH="6"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Address:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Address" SIZE="20" VALUE="$rec{'Address'}" MAXLENGTH="30"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>List Price:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="List Price" SIZE="10" VALUE="$rec{'List Price'}" MAXLENGTH="15"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>District:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> |; print &build_select_field("District",$rec{'District'}); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Realtor:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Realtor" SIZE="20" VALUE="$rec{'Realtor'}" MAXLENGTH="30"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Company:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Company" SIZE="20" VALUE="$rec{'Company'}" MAXLENGTH="30"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Phone:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Phone" SIZE="12" VALUE="$rec{'Phone'}" MAXLENGTH="15"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Email:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Email" SIZE="20" VALUE="$rec{'Email'}" MAXLENGTH="30"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Remarks:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <TEXTAREA NAME="Remarks" ROWS="5" COLS="50" WRAP="VIRTUAL" MAXLENGTH="750">$rec{'Remarks'}</TEXTAREA></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Photo:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <TEXTAREA NAME="Photo" ROWS="2" COLS="50" WRAP="VIRTUAL" MAXLENGTH="300">$rec{'Photo'}</TEXTAREA></TD></TR>
|;
if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Agent ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Agent ID" SIZE="14" VALUE="$rec{'Agent ID'}" MAXLENGTH="14"></TD></TR>
|;
}
else {
print qq|
<input type="hidden" NAME="Agent ID" VALUE="$rec{'Agent ID'}">
|;
}
print qq|
</TABLE>
|;
}

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

$url{'Email'} = $rec{'Email'};
$url{'Email'} =~ s/<\/?B>//g;
$rec{'Remarks'} =~ s/\n/<BR>/g;
$rec{'Photo'} =~ s/\n/<BR>/g;

print qq|
<TABLE WIDTH="550" CELLPADDING=0 CELLSPACING=0 BORDER=0 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Date:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Date'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>MLS#:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'MLS#'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Address:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Address'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>List Price:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'List Price'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>District:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'District'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Realtor:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Realtor'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Company:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Company'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Phone:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Phone'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Email:</FONT></TD>
<TD WIDTH="80%"> <$font><a href="mailto:$url{'Email'}">$rec{'Email'}</a>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Remarks:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Remarks'}</Font></TD></TR>|;
if ($rec{'Photo'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Photo:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Photo'}</Font></TD></TR>
|;
}
print qq||;
if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Agent ID:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Agent ID'}</Font></TD></TR>
|;
}
print qq|
</TABLE>
|;
}