Gossamer Forum
Home : Products : Links 2.0 : Customization :

For Glennu (or anyone else)

Quote Reply
For Glennu (or anyone else)
Here is my links.def code, please tell me why I can add links from add.cgi successfully, but only the default fields show in admin.cgi?

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 100, 1, 'http://', '^http|ftp|$mp3|MP3'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
AltCategories => [5, 'alpha', 0, 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Length => [14, 'numer', 40, 75, 1, '', ''],
Size => [15, 'numer', 40, 75, 1, '', ''],
Artist => [16, 'alpha', 40, 75, 1, '', '']
);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_links_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title used in admin output.
$html_title = 'Links Database';
$html_object = 'Link';

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_alt = 5; $db_Length = 14; $db_Size = 15; $db_Artist = 16;
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;

# Field number to sort links by:
$db_sort_links = 1;

# Field names you want to allow visitors to search on:
@search_fields = (1,2,16);


From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
How does your add.html template look?

Quote Reply
Re: For Glennu (or anyone else) In reply to
I use site_html.pl and it looks like this...


<form action="$build_add_url" method="POST">
<p>To add a resource to the Audio-Grabber Directory:

Please fill in all fields of the form below and your resource should be visible in the directory within two days!
<p>
<font color="#ff3333">Important:</font>Please add the FULL Url, ie. include http://

Only music resources can be submitted here - To add a website resource <a href="http://www.audio-grabber.com/cgi-bin/add.cgi">Click Here</a>
<p><div class="margin">
<table border ="0" cellspacing="0" cellpadding="0">
<tr><td align="right" valign="top">Song Title:</td>
<td><input name="Title" value="$in{'Title'}" size="50"></td></tr>
<tr><td align="right" valign="top">Artist:</td>
<td><input name="Artist" value="$in{'Artist'}" size="50"></td></tr>

<tr><td align="right" valign="top">Song URL:</td>
<td><input name="URL" value="$in{'URL'}" size="50"></td></tr>
<tr><td align="right" valign="top">Category:</td>
<td>$category</td></tr>
<tr><td align="right" valign="top">Track Length:</td>
<td><input name="Length" value="$in{'Length'}" size="20"> minutes.</td></tr>
<tr><td align="right" valign="top">File Size:</td>
<td><input name="Size" value="$in{'Size'}" size="20"> minutes.</td></tr>

<tr><td align="right" valign="top">Contact Name:</td>
<td><input name="Contact Name" value="$in{'Contact Name'}" size="40"></td></tr>
<tr><td align="right" valign="top">Contact Email:</td>
<td><input name="Contact Email" value="$in{'Contact Email'}" size="40"></td></tr>
<tr><td></td><td><input type="SUBMIT" name="add_record" value="Add Resource">
</td></tr>
</table>
</div>
</form>



From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
Also Glennu. or anyone, I successfully added the mod by Bmxer that detects a files size automatically and prints it on the add success page!

However it always shows up as 0 bytes

The links are all mp3 files, is this the problem?
Will it only work with html pages?

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
OK, I see. So, does the new fields show up empty, or not at all in your admin?
Have you updated your links.db?

Quote Reply
Re: For Glennu (or anyone else) In reply to
The fields don't show up at all and I don't need to update links.db because there are no links in it anyway because it's a new database (2nd one)

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
The code in links.def and add.cgi both seem correct. When adding links can you see the new fields in links.db?

Did you use the upgrade.pl to createthe new fields in links.db?

Good Luck!

Glenn


http://mir.spaceports.com/~glennu/
Quote Reply
Re: For Glennu (or anyone else) In reply to
As I've mentioned, I don't need to upgrade my links.db because there are no links in it anyway!

I just can't understand why it's not working if all the code is correct!

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
All the new fields appear in links.db and validate.db just not admin.cgi

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
So, there must be something in your admin_html.pl. Have you changed html_add_form for example? (note: you shouldn't)

John

Quote Reply
Re: For Glennu (or anyone else) In reply to
Ok, looking at it... the only thing that seems to possibly make sense is that either you have 2 copies of the links.def file and you're pointing to each one with different files... Are their two copies of links on your system?

Otherwise, the admin window should be showing up with no problems...

The only other thing I can think of is good old Browse cache. It might be that your browser is hogging it's old copy and not letting you see the new one.. possibly there's a bug in it and it's reverting to the one that worked last. Internet Explorer always did this to me and drove me scatty.

So, possibly clearing your browser cache may aleviate the problem..

Other than that.. I can only suggest letting someone you know and trust to have a look at the ftp site and accessing the admin script and checking your settings...

Hope that offers some ideas that help..

Regards,

Martin

The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: For Glennu (or anyone else) In reply to
No, everything is in it's original state!

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
Well, as Catflap01 suggests above: Check your links.cfg and make sure you point to the right links.def. And refresh pages, clear your cache, reboot, to make sure you don't load an old page.

Quote Reply
Re: For Glennu (or anyone else) In reply to
EVERYTHING is correct in terms of paths and refreshing pages!

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
I have two copies of all cgi files, 2 copies of site_html.pl, 2 admin_html.pl and 2 everything, and all point to the correct files!

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
This is my add_form sub in admin_html.pl


sub html_add_form {
# --------------------------------------------------------
# The add form page where the user fills out all the details
# on the new record he would like to add. You should use
# &html_record_form to print out the form as it makes
# updating much easier. Feel free to edit &get_defaults
# to change the default values.

&html_print_headers();
print qq|
<html>
<head>
<title>$html_title: Add a New $html_object.</title>
</head>

<body bgcolor="#DDDDDD">
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$in{'db'}">
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Add a New $html_object</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>
Add a New $html_object
</b></font></center>

<$font>
|; &html_record_form (&get_defaults); print qq|
</font></p>
<p><center> <INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add $html_object"> <INPUT TYPE="RESET" VALUE="Reset Form"></center></p>
|; &html_footer; print qq|
</td></tr>
</table>
</form>
</body>
</html>
|;
}



Thinking about it, instead of using globals to create the add_form and other forms in admin_html.pl, could I not just manually type out the forms with the new fields and save the file!?
From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
Paul,

I honestly can't see any other way other than to get someone else to have a look at your site and try to work it out from a fresh perspective.

As far as I can tell there is absolutely no reason for the admin pages to not have the updated table. They will mirror the links.def file whether you've updated the actual links.db or not.

The only thing that makes any sense is a rogue links.def somehow being picked up from somewhere else.

Sorry if that's not helpful but it's all I can think of that could cause this problem...

To be sure can I suggest you shove in a dummy field to your OTHER links.def and see if that turns up in the first links admin page... That at least would prove whether or not this was an issue.

Regards,

Martin

The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: For Glennu (or anyone else) In reply to
Ok thanks, I'll try!

I suppose I can just use the original fields if the worst comes to the worst, but just change their title on my pages!

From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Quote Reply
Re: For Glennu (or anyone else) In reply to
Hi Paul...

To tell the truth, if I was in your position this is one bug I wouldn't want to let slide... it could have serious implications for not only security but also your setups stability later on...

I really would recommend you ask for someone like Bobsie to take a peek at your setup. If it's a situation anything like me losing stuff as a kid.. Bobsie will end up finding the problem in 5 seconds flat... (just like my Mother always did!!)

Hope you work it out either way.

Martin

The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: For Glennu (or anyone else) In reply to
Thanks for your help!

How do Icontact Bobsie? should I send him a private message?

From Paul Wilson.
http://www.audio-grabber.com
Music Directory