Gossamer Forum
Home : Products : Links 2.0 : Customization :

Mapquest

(Page 2 of 2)
> >
Quote Reply
Re: Mapquest In reply to
Can someone please post the modifications if you are not using templates? I use Links2.0 but I don't use templates. Thank you.
-Greg
Quote Reply
Re: Mapquest In reply to
Hi,
Gr8 thread...I noticed the comment:
Quote:
Right now I'm using the script at http://www.hotrodding.net to access links, UBB, and Amazon searches with a drop down box to select what search you want.
That's a cool search box which I've wanted to do for awhile. Is this script available to the public? Thanks!

------------------
http://www.diamondgrading.com
Learn about Diamonds from former Gem-Lab Graders
Quote Reply
Re: Mapquest In reply to
Gregorio - I don't use thee non template so I'm not sure but you should be able to replace all the <%name%> tags with $name

kiel1- This will only work if they use get not post for their searches.

joegilbert- Here is what I wrote, sorry no comment or support. (I just don't have the time right now) it will only work if the search recource uses GET. You should be able to figure it out. Check out the source on http://www.hotrodding.net to get the form.

Code:
#!/usr/bin/perl -w

########################################################
########################################################
# CGI: hnsearch.pl
# VERSION: 1.0.1
# DATE: 4/6/99
# AUTHOR: John R. Marshall
# EMAIL: john@jrmstudios.com
# COMPANY: JRM Studios - http://www.jrmstudios.com
# PURPOSE: To be able to search different parts/programs of a site in one place.
########################################################
########################################################


########################################################
# Get the input
sub Get_input {

read(STDIN, $save_string, $ENV{CONTENT_LENGTH});

@prompts = split(/&/,$save_string);
foreach (@prompts)
{
($tmp1, $tmp2) = split(/=/,$_);
$tmp2 =~ s/\x2b/\x20/g;
$tmp2 =~ s/%2C/\x2c/g;
$tmp2 =~ s/%28/\x28/g;
$tmp2 =~ s/%29/\x29/g;
$fields{$tmp1}=$tmp2;
}

$search_term = $fields{'term'};
$URL_description = $fields{'goto'};

}

########################################################
# Now send the Info to the different programs in the format they use.

sub Send {


if ( $URL_description eq "Web" )
{ print "Location: http://www.hotrodding.net/hotrodding/cgi-bin/links/search.cgi?query=$search_term\n\n"; }

if ( $URL_description eq "Drivein" )
{ print "Location: http://www.hotrodding.net/cgi-bin/ubb/search.cgi?SearchTerms=$search_term&BooleanAND=YES&ForumChoice=ALL&SearchIn=ALL&SearchDate=ALL&ExactNa me=no&action=simplesearch\n\n"; }

if ( $URL_description eq "Amazon" )
{ print "Location: http://www.amazon.com/exec/obidos/external-search/002-7489426-0143668?mode=books&keyword=$search_term&tag=thehotroddingnet\n\n"; }

}

########################################################
# Main Program

&Get_input;
&Send;

#Simple ain't it? :-)

Hope I got to everybody Wink



------------------
JRM Studios www.jrmstudios.com
The Hotrodding Network www.hotrodding.net
Web discuss Free speech newsgroups - www.webdiscuss.com



Quote Reply
Re: Mapquest In reply to
Would it be possible to use this with Map/Tripquest? I've tried to fiqure it out myself but I haven't had any luck.
Quote Reply
Re: Mapquest In reply to
Hey thanx everybody. I just installed Links yesterday & I'm having a great time customizing it. I used this Map link and added a driving directions link

<A HREF="http://maps.yahoo.com/py/ddResults.py?Pyt=Tmap&YY=9495&tarname=&tardesc=&taraddr=<%StreetAddress%>&tarcsz=<%Town%>,%20< %State%>%20<%Zip%>&doit=1">get driving directions</a>

Thanx again everything worked perfectly

Quote Reply
Re: Mapquest In reply to
I have not gotten this thing to work. I stated this once before. May be I am missing something.

Here is the problem:

Let's say the address is "10211 Main Street" as it is listed in the links database.

When this address is passed to yahoo or any other mapping service, the blanks in between words has to be substitued by a + sign, like this - "10211+Main+Street"

It won't work since the address pulled from the database does not have a + sign in between and hence nothing is returned. Is there a fix for this. Seems like some of you have gotten this to work. I would appreicate some feedback.

Thanks.
Quote Reply
Re: Mapquest In reply to
Socrates,

Mine keeps the spaces in the URL and it works great!

check out
http://www.paintballcity.com/...North_East/New_York/

Have you tested it? Smile

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com
Quote Reply
Re: Mapquest In reply to
Hi James,

Yours is not working either. Are you sure?

It just takes me to Yahoo form. I can't imagine this would be a problem with browser or something. I am using 4.05 Navigator.

Yes, I tested mine a few times a long time ago and even made a post here (if you back up in this thread, but thought no understood the problem).
Quote Reply
Re: Mapquest In reply to
Socrates,

I tested it in Netscape, your right!

If you test it in IE5 or IE4 it works great.

I'm going to look into it some more. Hopefully we can find a solution.

Smile

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com
Quote Reply
Re: Mapquest In reply to
Got one solution.

Using the spaces instead of + signs on Netscape with Mapquest.com works.

If we just change the link to mapquest.com It could work that way.

I like Yahoo's layout better though. It is much cleaner, with less to look at. So, I hope we find a solution to allow us to use Yahho Maps.

Smile I was thinking, Maybe we can add a + sign to the spaces after a user enters their address in the add.html template. I don't know how to do it though. Anyone?
------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


[This message has been edited by Ground Zero (edited August 05, 1999).]
Quote Reply
Re: Mapquest In reply to
James,

Did you try to pass it from your browser and it worked? Because the with mapquest, it does not display the address in the browser location bar, like other services. Instead, it throws in some id numbers and stuff.

Thanks
Quote Reply
Re: Mapquest In reply to
Yeah, I only tried it from the browser.

Frown
Quote Reply
Re: Mapquest In reply to
I want to try to add a + sign the the spaces a user adds in the Address Field, when they submit a site.

So a friend advised I add this to add.cgi, but it did not work:
Code:
$Address = &urlencode($Address);

sub urlencode {
my ($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}

Can someone here help me out with the code. I'm not that good at PERL.

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com
Quote Reply
Re: Mapquest In reply to
Jerry,

here is the whole add.cgi
Code:
#!/usr/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: add.cgi
# Description: Adds a record marked unvalidated to the database and
# optionally emails someone.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
# Setup Notes:
# Make sure the require statement below points to the config file.

# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

$Address = &urlencode($Address);

sub urlencode {
my ($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}

sub main {
# --------------------------------------------------------
local (%in) = &parse_form;

# We are processing the form.
if (keys %in != 0) {
&process_form;
}
# Otherwise we are displaying the form (in site_html.pl).
else {
if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
$is_valid{$1} ? &site_html_add_get ($1) : &site_html_add_get ();
}
else {
&site_html_add_get ();
}
}
}

sub process_form {
# --------------------------------------------------------
my ($key, $status, $line, $output);

# Check the referer.
if (@db_referers and $ENV{'HTTP_REFERER'}) {
$found = 0;
foreach (@db_referers) {
$ENV{'HTTP_REFERER'} =~ /$_/i and $found++ and last;
}
if (!$found) {
&site_html_add_failure ("Auto submission is not allowed in this directory. Please visit the site to add your entry.");
return;
}
}

# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}

# Set date variable to today's date.
$in{$db_cols[$db_modified]} = &get_date;

open (ID, "<$db_links_id_file_name") or &cgierr("error in process_form. unable to open id file: $db_links_id_file_name. Reason: $!");
$in{$db_key} = <ID> + 1; # Get next ID number
close ID;

# Validate the form input..
$status = &validate_record(%in);
if ($status eq "ok") {

# Update the counter.
open (ID, ">$db_links_id_file_name") or &cgierr("error in get_defaults. unable to open id file: $db_links_id_file_name. Reason: $!");
flock(ID, 2) unless (!$db_use_flock);
print ID $in{$db_key}; # update counter.
close ID; # automatically removes file lock

# Print out the validate input to a "validation database" where it is stored until
# the admin decides to add it into the real database.
open (VAL, ">>$db_valid_name") or &cgierr("error in add_record. unable to open validate file: $db_valid_name. Reason: $!");
flock(VAL, 2) unless (!$db_use_flock);
print VAL &join_encode(%in);
close VAL; # automatically removes file lock

# Send the admin an email message notifying of new addition.
&send_email;
# Send the visitor to the success page.
&site_html_add_success;
}
else {
&site_html_add_failure($status);
}
}

sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated. No error checking as we don't
# want users to see the informative &cgierr output.

# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");

my $to = $db_admin_email;
my $from = $in{$db_cols[$db_contact_email]};
my $subject = "Addition to Database: $in{'Title'}\n";
my $msg = qq|
The following link is awaiting validation:

Title: $in{'Title'}
URL: $in{'URL'}
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}

Remote Host: $ENV{'REMOTE_HOST'}
Referer: $ENV{'HTTP_REFERER'}

To validate, please go to:
$db_script_url

Sincerely,

Links Manager.
|;

# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
}

Thanks.

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Mapquest In reply to
why don't you put it in when it is being called in site_html_link or site_html_detailed.. Smile

but if you want to do it this way..

Code:
$in{'Address'} = &encode_address($in{'Address'});

goes after:

Code:
$in{$db_cols[$db_modified]} = &get_date;

and then:

Code:
sub encode_address {
my ($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}

goes at the end of the script..

if you want to do it the "other" way.. ask me.. cause i think it's better..

jerry

[This message has been edited by widgetz (edited August 06, 1999).]
Quote Reply
Re: Mapquest In reply to
ok.. to do site_html_templates.pl or site_html.pl way.. put this at the end of the file you are using.. site_html.pl (for no templates.. site_html_templates.pl (for templates)..

Code:
sub encode_address {
my ($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}

TEMPLATES:

in site_html_templates.pl under:

Code:
my %rec = @_;

add:

Code:
$rec{'Address'} = &encode_address ($rec{'Address'});

and then in sub site_html_detailed...

under

Code:
my %rec = @_;

put:

Code:
$rec{'Address'} = &encode_address ($rec{'Address'});

okie..
NO TEMPLATES

in site_html.pl site_html_link...

udner

Code:
my %rec = @_;

put:

Code:
$rec{'Address'} = &encode_address ($rec{'Address'});

and in site_html_detailed..

under:

Code:
my %rec = @_;

put:

Code:
$rec{'Address'} = &encode_address ($rec{'Address'});

[This message has been edited by widgetz (edited August 06, 1999).]
Quote Reply
Re: Mapquest In reply to
It works great.

Thanks Widgetz!

Smile Smile Smile Smile Smile Smile

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Mapquest In reply to
Works great! Except, I have my map link at the top of my detailed page. A paragraph later, I have the actual address. How would I unencode the address AFTER the map link?

Yolanda
Quote Reply
Re: Mapquest In reply to
A paragraph later, I have the actual address. How would I unencode the address AFTER the map link?
=====
when I first read this, I did not understand and I thought everything was fine. Upon examining my detailed page it seems like I have the same problem that you are having.

I have my address listed, followed by the map link. Now in the address, in place of blankd %2C is printed. Now, the map link works but the adress looks ugly.

like: 7515%20W.%20Seventeenth%20Avenue

Is this the problem you are facing too?

If so, here is the solution:
put something like
$map_address = &encode_address ($rec{'Address'});

and then pass
map_address => $map_address,

use <%map_address%> in templates for the map.


[This message has been edited by socrates (edited August 25, 1999).]
Quote Reply
Re: [Ground Zero] Mapquest In reply to
Do you maybe still have coding that can link adresses to maps in Links2? Thanks, Gene C
Gene99
Quote Reply
Re: [XanthisHP] Mapquest In reply to
I need a map link solution for a links2 directory. Can you help/ Thanks, Gene C
Gene99
> >