Gossamer Forum
Home : Products : Links 2.0 : Customization :

Review-It MOD Problem

Quote Reply
Review-It MOD Problem
When I tried to install the review-it mod into my links 1.1 it puts the id of the next record into the review field. It's screwing up big time and I have no clue how to fix it. Here is my links.def which I think is what is wrong:

#!/usr/local/bin/perl -w
# -------------
# Links
# -------------
# Links Manager
#
# File: links.def
# Description: Contains the database definition for links.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 1.11
#
# 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 written 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.
# =====================================================================

# Database Definition: LINKS
# --------------------------------------------------------
# This file contains all the information to describe a link.
#

# List of columns in your database
@db_cols = ('ID','Title','URL','Date','Category','Description', 'Contact Name', 'Contact Email', 'Hits', 'isNew', 'isPopular','Votes','Rating','AltCat','Review','Revchoice');
# Database file to use:
$db_file_name = $db_links_name;
# Counter file to use:
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key. MUST be the first column in the database.
$db_key = 'ID';
# Value to insert for a NULL entry. Must not appear by itself normally.
$db_null = 'NULL';
# Database delimeter.
$db_delim = '|';
# Field Number of some important fields. The number is from @db_cols above
# where the first field equals 0.

$db_title = 1;
$db_url = 2;
$db_modified = 3;
$db_category = 4;
$db_contact_name = 6;
$db_contact_email = 7;
$db_hits = 8;
$db_isnew = 9;
$db_ispop = 10;
$db_votes= 11;
$db_rating = 12;
$db_alt= 13;
$db_review= 14;
$db_revchoice= 15;





# Field number to sort links by:
$db_sort_links = 1;
# Field names you want to allow visitors to search on:
@search_fields = (1,2,5,14);

# Hash of column names to regular expressions. Any input for a column,
# must pass the given regular expression before it is entered into the
# database.
%db_valid_types = ( 'ID' => '^\d+$', # Must be one or more digits only
'Contact Email' => '.+\@.+\..+', # Must be something@something.something
'Category' => '^[\w][\w\d/_]+$' # Categories can only contain letters, numbers, / and _ characters
# and must begin with a letter not a "/". DO NOT CHANGE THIS!!
);

# Hash of column names that say which columns can not be NULL. A record will
# be accepted if a column has a NULL value even though it might fail the regular
# expression above. You must define the column as not null if you don't want NULL
# entries.
%db_not_null = ( 'ID' => 'yes',
'Title' => 'yes',
'URL' => 'yes',
'Type' => 'yes',
'Date', => 'yes',
'Category' => 'yes',
'Contact Name' => 'yes',
'Contact Email' => 'yes',
'Hits' => 'yes'
);

# Hash of column names to default values. These defaults are used for Adding
# records. Special Defaults built into the program include getting the next key
# from the counter file for the database key, and getting today's date for a column
# named 'Date'. You can modify the special entries in &get_defaults in the admin script.
%db_defaults = ( 'URL' => 'http://',
'Type' => 'Web',
'Hits' => '0',
'isNew' => 'No',
'isPopular' => 'No');

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = ( 'Revchoice' => 'Yes,No',
'Type' => 'Web,Newsgroup,Mailing List,Postscript,Acrobat,FTP,Gopher',
'isNew' => 'Yes,No',
'isPopular' => 'Yes,No');

# Hash of column names to radio values. If you use &build_radio_field, it will
# make a <INPUT TYPE="RADIO"> tag for you using the options specified in the hash.
%db_radio_fields = ( 'Revchoice' => 'Yes,No',
'isNew' => 'Yes,No',
'isPopular' => 'Yes,No');
# Maximum number of hits returned in a search. Can be overridden in the search
# options.
$db_max_hits = '25';

# Maximum field size. The program will choak if a field is set larger then
# this value. Keep this close to what you would like the maximum, otherwise
# people can fill up your database with crap.
# Might need a high value to edit category descriptions..
$db_max_field_length = 5000;

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.
# 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. See the README for more info.

my (%rec) = @_;
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399|;

# Pre Load the category list.
$db_select_fields{'Category'} = $db_select_fields{'AltCat'} = join(",", &category_list);

print qq|
<TABLE WIDTH="600" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</font></TD>
<TD VALIGN="TOP" WIDTH="450"> <INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Title:</font></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Title" VALUE="$rec{'Title'}" SIZE="60" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>URL: </font></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="URL" VALUE="$rec{'URL'}" SIZE="60" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Main Category:</font></TD>
<TD VALIGN="TOP"> |; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Secondary Category:</font></TD>
<TD VALIGN="TOP"> |; print &build_select_field ("AltCat", "$rec{'AltCat'}","AltCat", "MULTIPLE", 5); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Description:</font></TD>
<TD VALIGN="TOP"> <TEXTAREA NAME="Description" ROWS="4" COLS="55" WRAP="VIRTUAL">$rec{'Description'}</TEXTAREA></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Submitter's Name:</font></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Contact Name" VALUE="$rec{'Contact Name'}" SIZE="20" MAXLENGTH="35">
<$font>Submitter's Email:</font>
<INPUT TYPE="TEXT" NAME="Contact Email" VALUE="$rec{'Contact Email'}" SIZE="20" MAXLENGTH="35">
</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date: </font></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Date" VALUE="$rec{'Date'}" SIZE="15" MAXLENGTH="25"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>New:</font></TD>
<TD VALIGN="TOP"> |; print &build_radio_field ("isNew", "$rec{'isNew'}"); print qq|
       
<$font>Popular: </font>|; print &build_radio_field ("isPopular", "$rec{'isPopular'}"); print qq|          
<$font>Number of Hits: </font>
<INPUT TYPE="TEXT" NAME="Hits" VALUE="$rec{'Hits'}" SIZE="5" MAXLENGTH="8"></TD></TR>
</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.
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399|;

print qq|
<TABLE WIDTH="600" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="130"><$font>ID:</font></TD>
<TD WIDTH="470"> <$font>$rec{'ID'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Title:</font></TD>
<TD> <$font>$rec{'Title'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>URL: </font></TD>
<TD> <$font><A HREF="$rec{'URL'}">$rec{'URL'}</A></font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</font></TD>
<TD> <$font>$rec{'Date'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Main Category:</font></TD>
<TD> <$font>$rec{'Category'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Secondary Categories:</font></TD>
<TD> <$font>$rec{'AltCat'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Description:<BR><IMG SRC="dot_clear.gif" WIDTH=130 HEIGHT=1></font></TD>
<TD> <$font>$rec{'Description'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Submitter:</font></TD>
<TD> <$font>$rec{'Contact Name'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Email: </font></TD>
<TD> <A HREF="mailto:$rec{'Contact Email'}"><$font>$rec{'Contact Email'}</font></A></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Number of Hits: </font></TD>
<TD> <$font>$rec{'Hits'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>New:</font></TD>
<TD> <$font>$rec{'isNew'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Popular:</font></TD>
<TD> <$font>$rec{'isPopular'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Review It?:</font></TD>
<TD> <$font>$rec{'Revchoice'}</font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Review:<BR>
<IMG SRC="dot_clear.gif" WIDTH=130 HEIGHT=1></font></TD><TD> <$font>$rec{'Review'}</font>
</TD></TR>
</TABLE>
|;
}

sub html_record_spreadsheet {
# --------------------------------------------------------
# Displays a record in a one row format

my (%rec) = @_;
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=2|;

print qq|
<td><$font>$rec{'Title'}</font></td>
<td><$font><a href="$rec{'URL'}" target="_blank">$rec{'URL'}</a></font></td>
<td><$font>$rec{'Category'}</font></td>
<td><$font>$rec{'AltCat'}</font></td>
<td><$font>$rec{'Date'}</font></td>
|;
}

# Spreadsheet header columns
@db_record_header_columns = ("Title", "URL", "Category", "Alternative Category", "Date");

sub html_record_form_spreadsheet {
# --------------------------------------------------------
# Displays a record in a one row format

my (%rec) = @_;
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399|;

print qq|
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-Title" VALUE="$rec{'Title'}" SIZE="15" MAXLENGTH="255">
<INPUT TYPE="HIDDEN" NAME="$rec{$db_key}-ID" VALUE="$rec{'ID'}"></td>
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-URL" VALUE="$rec{'URL'}" SIZE="15" MAXLENGTH="255"></td>
<td valign=top>|; print &build_select_field ("Category", "$rec{'Category'}", "$rec{$db_key}-Category"); print qq|</td>
<td valign=top>|; print &build_select_field ("Category", "$rec{'AltCat'}", "$rec{$db_key}-AltCat", "MULTIPLE", 5);print qq|</td>
<td valign=top><TEXTAREA NAME="$rec{$db_key}-Description" ROWS="2" COLS="20" WRAP="VIRTUAL">$rec{'Description'}</TEXTAREA></td>
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-Date" VALUE="$rec{'Date'}" SIZE="8" MAXLENGTH="255"></td>
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-Contact Name" VALUE="$rec{'Contact Name'}" SIZE="15" MAXLENGTH="35"></td>
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-Contact Email" VALUE="$rec{'Contact Email'}" SIZE="15" MAXLENGTH="35"></td>
<td valign=top>|; print &build_select_field ("isNew", "$rec{'isNew'}", "$rec{$db_key}-isNew"); print qq|</td>
<td valign=top>|; print &build_select_field ("isPopular", "$rec{'isPopular'}", "$rec{$db_key}-isPopular"); print qq|</td>
<td valign=top><INPUT TYPE="TEXT" NAME="$rec{$db_key}-Hits" VALUE="$rec{'Hits'}" SIZE="3" MAXLENGTH="8"></td>
<td valign=top>|; print &build_select_field ("Revchoice", "$rec{'Revchoice'}", "$rec{$db_key}-Revchoice"); print qq|</td>
<td valign=top><TEXTAREA NAME="$rec{$db_key}-Review" ROWS="2" COLS="20" WRAP="VIRTUAL">$rec{'Review'}</TEXTAREA></td>
|;
}

# Spreadsheet header columns
@db_form_header_columns = ("Title", "URL", "Category", "Alternative Category", "Description", "Date", "Contact Name", "Contact Email", "New", "Popular", "Hits", "Revchoice", "Review",);



Can you help me fix this please? I would really like to get it to work! Thanks.



------------------
The RelayMan
simsearch.hyperart.net
mdhealyjr@adelphia.net


[This message has been edited by relayman (edited February 08, 1999).]
Quote Reply
Re: Review-It MOD Problem In reply to
You need to look at the instructions more carefully. In the beginning of your links.def your @db_cols needs to have the "review" and "revchoice" fields in it to begin with or they won't even be in your database.

It's one of the more complicated mods...you have to add the two new fields.

Steve Miles
Quote Reply
Re: Review-It MOD Problem In reply to
Well, acctually those were removed so that it wouldn't affect it and when they were there it wouldn't work.

------------------
The RelayMan
simsearch.hyperart.net
mdhealyjr@adelphia.net
Quote Reply
Re: Review-It MOD Problem In reply to
After you 'added' the categories in your links.def (assuming that that all went smoothly), did you actually add two columns into you links.db?

If not, that's probaby why it "wouldn't work". Just a thought.

------------------
Kevin D
greeknet.hypermart.net
webmaster@greeknet.hypermart.net