<%once> my $api; use deasil::util::db::utils qw(handleify); <%args> $prop => undef $region => undef $hood => undef $page => undef $text => undef $class => undef $qs => '' $urlonly => 0 $anchor => '' $fqdn => undef <%init> $api ||= $m->comp('/apis/property.imhtml'); $text = $m->content if $m->has_content(); my $url; if( ref $prop ) { $region ||= $api->getRegionById($prop->getRegion_id()); return if ! ref $region; my( $country, $state ) = $m->comp('/funcs/getLocHash.imhtml:split', region=>$region); my $city = handleify($region->getL_name()); $city =~ s/_\d+$//; $url = "\L/$country/$state/$city"; if( ! ref $hood && $prop->getHood_id() ) { $hood = $api->getHoodById($prop->getHood_id()); $url .= lc( '/' . $hood->getS_name() ) if ref $hood; } $url .= lc( '/' . $prop->getS_name() ); $text ||= $prop->getL_name(); } elsif( ref $page ) { $url = '/p/' . $page->getS_name() . '.mhtml'; $text ||= $page->getTitle(); } else { return; } $url .= "?$qs" if length $qs; $url .= "#$anchor" if length $anchor; #handle fqdn #Request for hard coded redirect: if ( $url =~ m!/us/nevada/las_vegas/las_vegas/bf! ) { $url = 'http://www.bellafioreliving.com'; } elsif ( $url =~ m!/us/texas/dallas/arlington/hv! ) { $url = 'http://www.hiddenvalleyliving.com'; } elsif ( $url =~ m!/us/texas/dallas/irving/sp! ) { $url = 'http://www.sandpebbleliving.com'; } elsif ( $url =~ m!/us/texas/dallas/irving/swd! ) { $url = 'http://www.summerwoodaptliving.com'; } elsif ( $url =~ m!/us/texas/houston/lwo! ) { $url = 'http://www.lodgeatwestoaks.com'; } elsif ( $url =~ m!/us/texas/houston/tlh! ) { $url = 'http://www.trailsatlakehouston.com'; } elsif ( $url =~ m!/us/texas/houston/clear_lake/clp! ) { $url = 'http://www.clearlakeplace.com'; } elsif ( $url =~ m!/us/texas/houston/tomball/am! ) { $url = 'http://www.augustameadows.com'; } elsif ( $url =~ m!/us/texas/houston/(rw|bo|bm|cwd)! ) { $url = 'http://www.777Memorial.com'; } elsif ( $url =~ m!/us/texas/houston/(bp|lf)! ) { $url = 'http://www.10501hollysprings.com'; } elsif ( $url =~ m!/us/nevada/las_vegas/las_vegas/al! ) { $url = 'http://www.alterralasvegas.com'; } elsif ( $url =~ m!/us/nevada/las_vegas/las_vegas/cv! ) { $url = 'http://www.canyonviewliving.com'; } if( $urlonly ) { $m->out($urlonly); } else { $class = qq{ class="$class"} if length $class; $m->out(qq{$text}); } return;