Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Google Map view from wordpress WordPress

  • SOLVED

hi i am working on this page

http://bahrainsmart.com/list/?ptype=post_event

on the map how is it possible to show a satellite and hybrid view drop down option similar to this page

http://www.streetviews.co/?e=26.230765268735006,50.57733178138733

I need it so that the people can properly switch between google views to properly mark their location.


<?php
/*
Template Name: Add Listing Form
*/
?>
<?php
session_start();
ob_start();

if($_REQUEST['backandedit'])
{
}else
{
$_SESSION['property_info'] = array();
}
if(!is_user_can_add_event())
{
wp_redirect(site_url());
}
if($_REQUEST['pid'])
{
if(!$current_user->data->ID)
{
wp_redirect(get_settings('home').'/index.php?ptype=login');
exit;
}
$pid = $_REQUEST['pid'];
$proprty_type = $catid_info_arr['type']['id'];
$post_info = get_post_info($_REQUEST['pid']);

check_user_post($post_info['post_author']); //security settings


$proprty_name = $post_info['post_title'];
$proprty_desc = $post_info['post_content'];
$post_meta = get_post_meta($_REQUEST['pid'], '',false);
$address = $post_meta['address'][0];
$geo_latitude = $post_meta['geo_latitude'][0];
$geo_longitude = $post_meta['geo_longitude'][0];
$map_view = $post_meta['map_view'][0];
$timing = $post_meta['timing'][0];
$contact = $post_meta['contact'][0];
$email = $post_meta['email'][0];
$website = $post_meta['website'][0];
$twitter = $post_meta['twitter'][0];
$facebook = $post_meta['facebook'][0];
$kw_tags = $post_meta['kw_tags'][0];
$proprty_feature =$post_meta['proprty_feature'][0];
$post_city_id =$post_meta['post_city_id'][0];
$cat_array = array();
if($pid)
{
$catinfoarr = get_the_category($post_info['ID']);
$cat_array = array();
for($c=0;$c<count($catinfoarr);$c++)
{
$cat_array[] = $catinfoarr[$c]->term_id;
}
}
$thumb_img_arr = bdw_get_images_with_info($_REQUEST['pid'],'thumb');
}
if($_SESSION['property_info'] && $_REQUEST['backandedit'])
{
$proprty_name = $_SESSION['property_info']['proprty_name'];
$proprty_desc = $_SESSION['property_info']['proprty_desc'];
$proprty_feature = $_SESSION['property_info']['proprty_feature'];
$address = $_SESSION['property_info']['address'];
$geo_latitude = $_SESSION['property_info']['geo_latitude'];
$geo_longitude = $_SESSION['property_info']['geo_longitude'];
$map_view = $_SESSION['property_info']['map_view'];
$timing = $_SESSION['property_info']['timing'];
$contact = $_SESSION['property_info']['contact'];
$email = $_SESSION['property_info']['email'];
$website = $_SESSION['property_info']['website'];
$twitter = $_SESSION['property_info']['twitter'];
$facebook = $_SESSION['property_info']['facebook'];
$kw_tags = $_SESSION['property_info']['kw_tags'];
$post_city_id = $_SESSION['property_info']['post_city_id'];

$user_fname = $_SESSION['property_info']['user_fname'];
$user_phone = $_SESSION['property_info']['user_phone'];
$user_email = $_SESSION['property_info']['user_email'];
$user_login_or_not = $_SESSION['property_info']['user_login_or_not'];
$cat_array = $_SESSION['property_info']['category'];
$proprty_add_coupon = $_SESSION['property_info']['proprty_add_coupon'];
$price_select = $_SESSION['property_info']['price_select'];
}
if($proprty_desc=='')
{
$proprty_desc = __("Enter description for your listing.");
}
if($_REQUEST['renew'])
{
$property_list_type = get_post_meta($_REQUEST['pid'],'list_type',true);
}
if($_REQUEST['ptype']=='post_event')
{
if($_REQUEST['pid'])
{
if($_REQUEST['renew'])
{
$page_title = RENEW_EVENT_TEXT;
}else
{
$page_title = EDIT_EVENT_TEXT;
}
}else
{
$page_title = POST_EVENT_TITLE;
}
}else
{
if($_REQUEST['pid'])
{
if($_REQUEST['renew'])
{
$page_title = RENEW_LISING_TEXT;
}else
{
$page_title = EDIT_LISING_TEXT;
}
}else
{
$page_title = POST_PLACE_TITLE;
}
}
?>
<?php get_header(); ?>

<!-- TinyMCE -->
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins :"advimage,advlink,emotions,iespell,",

// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,bullist,numlist,blockquote,|,link,unlink,anchor,image,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,

// Example word content CSS (should be your site CSS) this one removes paragraph margins
content_css : "css/word.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",

// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<!-- /TinyMCE -->
<div id="wrapper" class="clearfix">
<div id="inner_pages" class="clearfix" >
<h1><?php echo $page_title;?></h1>
<div class="breadcrumb clearfix"> <?php if ( get_option( 'ptthemes_breadcrumbs' )) { ?>

<div class="breadcrumb_in"><?php yoast_breadcrumb('',' &raquo; '.$page_title); ?></div>

<?php } ?> </div>
<div id="content" class="content_inner" >
<?php if(is_allow_user_register()){?>
<p class="note "> <span class="required">*</span> <?php _e(INDICATES_MANDATORY_FIELDS_TEXT);?> </p>
<?php if($_REQUEST['usererror']==1)
{
if($_SESSION['userinset_error'])
{
for($i=0;$i<count($_SESSION['userinset_error']);$i++)
{
echo '<div class="error_msg">'.$_SESSION['userinset_error'][$i].'</div>';
}
echo "<br>";
}
}
?>
<?php
if($_REQUEST['emsg']==1)
{
?>
<div class="error_msg"><?php echo INVALID_USER_PW_MSG;?></div>
<?php
}
if($current_user->ID=='')
{
?>


<h5 class="form_title spacer_none"><?php _e(LOGINORREGISTER);?> </h5>

<div class="form_row clearfix">
<label><?php _e(IAM_TEXT);?> </label>
<span class=" user_define"> <input name="user_login_or_not" type="radio" value="existing_user" <?php if($user_login_or_not=='existing_user'){ echo 'checked="checked"';}?> onclick="set_login_registration_frm(this.value);" /> <?php _e(EXISTING_USER_TEXT);?> </span>
<?php if ( get_option('users_can_register') ) { ?>
<span class="user_define"> <input name="user_login_or_not" type="radio" value="new_user" <?php if($user_login_or_not=='new_user'){ echo 'checked="checked"';}?> onclick="set_login_registration_frm(this.value);" /> <?php _e(NEW_USER_TEXT);?> </span>
<?php } ?>
</div>
<div class="login_submit clearfix" id="login_user_frm_id">
<form name="loginform" id="loginform" action="<?php echo get_ssl_normal_url(get_settings('home').'/index.php?ptype=login'); ?>" method="post" >
<div class="form_row clearfix">
<label><?php _e(LOGIN_TEXT);?> <span>*</span> </label>
<input type="text" class="textfield " id="user_login" name="log" />
</div>

<div class="form_row clearfix">
<label><?php _e(PASSWORD_TEXT);?> <span>*</span> </label>
<input type="password" class="textfield " id="user_pass" name="pwd" />
</div>

<div class="form_row clearfix">
<input name="submit" type="submit" value="<?php _e(SUBMIT_BUTTON);?>" class="b_submit" />

</div>




<?php $login_redirect_link = get_settings('home').'/?ptype=post_listing';?>
<input type="hidden" name="redirect_to" value="<?php echo $login_redirect_link; ?>" />
<input type="hidden" name="testcookie" value="1" />
<input type="hidden" name="pagetype" value="<?php echo $login_redirect_link; ?>" />
</form>
</div>
<?php }?>
<?php }?>

<?php
if($_REQUEST['pid'] || $_POST['renew']){
$form_action_url = site_url().'/?ptype=preview';
}else
{
$form_action_url = get_ssl_normal_url(site_url().'/?ptype=preview',$_REQUEST['pid']);
}
?>
<form name="propertyform" id="propertyform" action="<?php echo $form_action_url; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="user_login_or_not" id="user_login_or_not" value="<?php echo $user_login_or_not;?>" />
<input type="hidden" name="pid" value="<?php echo $_REQUEST['pid'];?>" />
<input type="hidden" name="renew" value="<?php echo $_REQUEST['renew'];?>" />

<h5 class="form_title spacer_none" <?php if(get_option('is_user_addevent')=='0' || get_option('is_user_eventlist')=='0'){ echo 'style="display:none"';} ?>> <?php _e(SELECT_LISTING_TYPE_TEXT);?></h5>
<div class="form_row clearfix" <?php if(get_option('is_user_addevent')=='0' || get_option('is_user_eventlist')=='0'){ echo 'style="display:none"';} ?>>
<label><?php echo SELECT_EVENT_TYPE_TEXT;?> </label>
<?php if(get_option('is_user_addevent')=='0'){}else{ ?>
<span class=" user_define"> <input name="listing_type" id="place_listing" type="radio" value="post_listing" <?php if($_REQUEST['ptype']=='post_listing'){ echo 'checked="checked"';}?> onclick="window.location.href='<?php echo site_url();?>/?ptype=post_listing'" /> <?php echo POST_PLACE_TITLE;?> </span>
<?php }?>
<?php if(get_option('is_user_eventlist')=='0'){}else{ ?>
<span class="user_define"> <input name="listing_type" id="event_listing" type="radio" value="post_event" <?php if($_REQUEST['ptype']=='post_event'){ echo 'checked="checked"';}?> onclick="window.location.href='<?php echo site_url();?>/?ptype=post_event'" /> <?php echo POST_EVENT_TITLE;?> </span>
<?php }?>
</div>

<h5 class="form_title "> <?php _e(LISTING_DETAILS_TEXT);?> </h5>

<div class="form_row clearfix">
<label><?php echo EVENT_TITLE_TEXT;?> <span>*</span> </label>
<input type="text" name="proprty_name" id="proprty_name" class="textfield" value="<?php echo esc_attr(stripslashes($proprty_name)); ?>" size="25" />
<span class="message_error2" id="proprty_name_span"></span>
</div>




<div class="form_row clearfix">
<label><?php echo EVENT_ADDRESS;?> </label>
<input type="text" name="address" id="address" class="textfield" value="<?php echo esc_attr(stripslashes($address)); ?>" size="25" />
<span class="message_note"><?php echo ADDREDD_MSG;?></span>
<span class="message_error2" id="address_span"></span>
</div>

<div class="form_row clearfix">
<?php include_once(TEMPLATEPATH . "/library/map/location_add_map.php");?>
<span class="message_note"><?php echo GET_MAP_MSG;?></span></div>
<div class="form_row clearfix" <?php if(!get_option('ptthemes_enable_multicity_flag')){?>style="display:none;"<?php }?>>
<label><?php echo EVENT_CITY_TEXT;?> </label>
<?php echo get_multicit_select_dl('post_city_id','post_city_id',$post_city_id,' class="textfield textfield_x" ');?>

</div>

<div class="form_row clearfix">
<label><?php echo EVENT_ADDRESS_LAT;?> </label>
<input type="text" name="geo_latitude" id="geo_latitude" class="textfield" value="<?php echo esc_attr(stripslashes($geo_latitude)); ?>" size="25" />
<span class="message_note"><?php echo GET_LATITUDE_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo EVENT_ADDRESS_LNG;?> </label>
<input type="text" name="geo_longitude" id="geo_longitude" class="textfield" value="<?php echo esc_attr(stripslashes($geo_longitude)); ?>" size="25" />
<span class="message_note"><?php echo GET_LOGNGITUDE_MSG;?></span>
</div>
<div class="form_row clearfix ">
<label><?php echo EVENT_MAP_VIEW_LNG;?> </label>

<div class="category_label2">
<?php
if($map_view=='')
{
$map_view = 'G_NORMAL_MAP';
}
?>
<div class="form_cat2">

<input type="radio" class="checkbox" name="map_view" id="map_view1" <?php if($map_view=='G_NORMAL_MAP' ){echo 'checked="checked"';}?> value="G_NORMAL_MAP" size="25" /> <?php _e('Default Map');?></div>
<div class="form_cat2"> <input type="radio" class="checkbox" name="map_view" id="map_view2" <?php if($map_view=='G_SATELLITE_MAP'){echo 'checked="checked"';}?> value="G_SATELLITE_MAP" size="25" /> <?php _e('Satellite Map');?></div>
<div class="form_cat2"><input type="radio" class="checkbox" name="map_view" id="map_view3" <?php if($map_view=='G_HYBRID_MAP'){echo 'checked="checked"';}?> value="G_HYBRID_MAP" size="25" /> <?php _e('Hybrid Map');?></div>

</div>

</div>

<div class="form_row clearfix">
<label><?php echo PRO_DESCRIPTION_TEXT;?> <span>*</span> </label>
<textarea name="proprty_desc" id="proprty_desc" class="textarea" rows="" cols="" ><?php echo esc_attr(stripslashes($proprty_desc)); ?></textarea>
<span class="message_note"><?php _e(HTML_TAGS_ALLOW_MSG);?></span>
<span class="message_error2" id="proprty_desc_span"></span>
</div>

<div class="form_row clearfix">
<label><?php echo PRO_FEATURE_TEXT;?> </label>
<textarea name="proprty_feature" id="proprty_feature" class="textarea" rows="" cols="" ><?php echo esc_attr(stripslashes($proprty_feature)); ?></textarea>
<?php /*?><span class="message_note"><?php _e(HTML_TAGS_ALLOW_MSG);?></span><?php */?>
<span class="message_note"><?php _e(HTML_SPECIAL_TEXT);?></span>
<span class="message_error2" id="proprty_feature_span"></span>
</div>



<div class="form_row clearfix">
<label><?php echo EVENT_TIMING;?> </label>
<input type="text" name="timing" id="timing" class="textfield" value="<?php echo esc_attr(stripslashes($timing)); ?>" size="25" />
<span class="message_note"><?php echo TIMING_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo EVENT_CONTACT_INFO;?> </label>
<input type="text" name="contact" id="contact" class="textfield" value="<?php echo esc_attr(stripslashes($contact)); ?>" size="25" />
<span class="message_error2" id="contact_span"></span>
<span class="message_note"><?php echo CONTACT_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo EVENT_CONTACT_EMAIL;?> </label>
<input type="text" name="email" id="email" class="textfield" value="<?php echo esc_attr(stripslashes($email)); ?>" size="25" />
<span class="message_error2" id="email_span"></span>
</div>
<div class="form_row clearfix">
<label><?php echo EVENT_WEBSITE;?> </label>
<input type="text" name="website" id="website" class="textfield" value="<?php echo esc_attr(stripslashes($website)); ?>" size="25" />
<span class="message_note"><?php echo WEBSITE_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo TWITTER_TEXT; ?></label>
<input name="twitter" id="twitter" value="<?php echo $twitter;?>" type="text" class="textfield" />
<span class="message_note"><?php echo TWITTER_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo FACEBOOK_TEXT; ?></label>
<input name="facebook" id="facebook" value="<?php echo $facebook;?>" type="text" class="textfield" />
<span class="message_note"><?php echo FACEBOOK_MSG;?></span>
</div>
<div class="form_row clearfix">
<label><?php echo EVENT_CATETORY_TEXT;?> <span>*</span> </label>
<div class="category_label"><?php require_once (TEMPLATEPATH . '/library/includes/places_category.php');?></div>
<span class="message_note"><?php echo CATEGORY_MSG;?></span>
<span id="category_span" class="message_error2"></span>
</div>
<div class="form_row clearfix">
<label><?php echo TAGKW_TEXT; ?></label>
<input name="kw_tags" id="kw_tags" value="<?php echo $kw_tags;?>" type="text" class="textfield" maxlength="<?php echo TAGKW_TEXT_COUNT;?>" />
<span class="message_note"><?php echo TAGKW_MSG;?></span>
</div>
<?php
$custom_metaboxes = get_post_custom_fields_templ();
foreach($custom_metaboxes as $key=>$val)
{
$name = $val['name'];
$site_title = $val['site_title'];
$type = $val['type'];
$admin_desc = $val['desc'];
$option_values = $val['option_values'];
$default_value = $val['default'];
if($_REQUEST['pid'])
{
$value = get_post_meta($_REQUEST['pid'], $name,true);
}else
if($_SESSION['property_info'] && $_REQUEST['backandedit'])
{
$value = $_SESSION['property_info'][$name];
}
?>
<div class="form_row clearfix">
<?php if($type=='text'){?>
<label><?php echo $site_title; ?></label>
<input name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo $value;?>" type="text" class="textfield" />
<?php
}elseif($type=='checkbox'){
?>
<label>&nbsp;</label>
<input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php if($value){ echo 'checked="checked"';}?> value="<?php echo $value;?>" type="checkbox" /> <?php echo $site_title; ?>
<?php
}
elseif($type=='multicheckbox')
{ ?>
<label><?php echo $site_title; ?></label>
<?php
$options = $val['option_values'];
if($options)
{ $chkcounter = 0;

$option_values_arr = explode(',',$options);
for($i=0;$i<count($option_values_arr);$i++)
{
$chkcounter++;
$seled='';
if($default_value == $option_values_arr[$i]){ $seled='checked="checked"';}
echo '
<div class="form_cat">
<label>
<input name="'.$key.'[]" id="'.$key.'_'.$chkcounter.'" type="checkbox" value="'.$option_values_arr[$i].'" '.$seled.' /> '.$option_values_arr[$i].'
</label>
</div>';
}

}
}

elseif($type=='textarea'){
?>
<label><?php echo $site_title; ?></label>
<textarea name="<?php echo $name;?>" id="<?php echo $name;?>"><?php echo $value;?></textarea>
<?php
}elseif($type=='select'){

?>
<label><?php echo $site_title; ?></label>
<select name="<?php echo $name;?>" id="<?php echo $name;?>" class="textfield textfield_x">
<?php if($option_values){

$option_values_arr = explode(',',$option_values);

for($i=0;$i<count($option_values_arr);$i++)
{
?>
<option value="<?php echo $option_values_arr[$i]; ?>" <?php if($value==$option_values_arr[$i]){ echo 'selected="selected"';} else if($default_value==$option_values_arr[$i]){ echo 'selected="selected"';}?>><?php echo $option_values_arr[$i]; ?></option>
<?php
}
?>
<?php }?>

</select>

<?php
}
?>
<span class="message_note"><?php echo $admin_desc;?></span>
</div>
<?php
}
?>

<h5 class="form_title"> <?php _e(PRO_PHOTO_TEXT);?></h5>
<div class="form_row clearfix">
<label><?php echo PHOTOES_BUTTON;?></label>
<?php include (TEMPLATEPATH . "/library/includes/image_uploader.php"); ?>
</div>

<?php if($_REQUEST['pid']=='' || $_REQUEST['renew']=='1'){?>

<?php
$property_price_info = get_property_price_info();
if($property_price_info)
{
?>
<h5 class="form_title"> <?php echo GENERAL_PROPERTY_INFO_TEXT;?></h5>
<div class="form_row clearfix">
<label><?php echo SELECT_TYPE_TEXT;?> </label>
<?php get_price_info($price_select);?>

</div>


<?php if(get_option('is_allow_coupon_code')){?>
<h5 class="form_title"><?php echo COUPON_CODE_TITLE_TEXT;?></h5>
<div class="form_row clearfix">
<label><?php echo PRO_ADD_COUPON_TEXT;?> </label>
<input type="text" name="proprty_add_coupon" id="proprty_add_coupon" class="textfield" value="<?php echo esc_attr(stripslashes($proprty_add_coupon)); ?>" />
<span class="message_note"><?php echo COUPON_NOTE_TEXT; ?></span>
</div>
<?php }?>
<?php }?>
<?php }?>
<script type="text/javascript">
function show_value_hide(val)
{
document.getElementById('property_submit_price_id').innerHTML = document.getElementById('span_'+val).innerHTML;
}
</script>
<?php
if($current_user->ID=='')
{
?>
<div id="contact_detail_id" style="display:none;">
<h5 class="form_title"><?php echo CONTACT_DETAIL_TITLE; ?></h5>

<div class="form_row clearfix">
<label><?php echo CONTACT_NAME_TEXT; ?></label>
<input name="user_fname" id="user_fname" value="<?php echo $user_fname;?>" type="text" class="textfield" />
</div>
<div class="form_row clearfix">
<label><?php echo CONTACT_TEXT; ?></label>
<input name="user_phone" id="user_phone" value="<?php echo $user_phone;?>" type="text" class="textfield" />
</div>
<div class="form_row clearfix">
<label><?php echo EMAIL_TEXT; ?> <span>*</span></label>
<input name="user_email" id="user_email" value="<?php echo $user_email;?>" type="text" class="textfield" />
<span class="message_note"><?php echo EMAIL_TEXT_MSG;?></span>
</div>
</div>
<?php }?>

<?php if(get_option('accept_term_condition')){ ?>
<div class="form_row clearfix">
<label>&nbsp;</label>
<input name="term_and_condition" id="term_and_condition" value="" type="checkbox" class="chexkbox" />
<?php echo stripslashes(get_option('term_condition_content'));?>
</div>
<script type="text/javascript">
function check_term_condition()
{
if(eval(document.getElementById('term_and_condition')))
{
if(document.getElementById('term_and_condition').checked)
{
return true;
}else
{
alert('<?php _e('Please accept Term and Conditions');?>');
return false;
}
}
}
</script>
<?php
$submit_button = 'onclick="return check_term_condition();"';
}?>

<?php if(function_exists('pt_get_captch') && $_REQUEST['pid']==''){pt_get_captch(); }?>
<input type="submit" name="Update" value="<?php echo PRO_PREVIEW_BUTTON;?>" class="b_review" <?php echo $submit_button;?>/>

<div class="form_row clear_both">
<span class="message_note"> <?php _e('Note: You will be able to see a preview in the next page');?> </span>
</div>

</form>
</div> <!-- content #end -->

<div id="sidebar">
<?php dynamic_sidebar(6); ?>
</div>
</div>


<script language="javascript" type="text/javascript">
function set_login_registration_frm(val)
{
if(val=='existing_user')
{
document.getElementById('contact_detail_id').style.display = 'none';
document.getElementById('login_user_frm_id').style.display = '';
document.getElementById('user_login_or_not').value = val;
}else //new_user
{
document.getElementById('contact_detail_id').style.display = '';
document.getElementById('login_user_frm_id').style.display = 'none';
document.getElementById('user_login_or_not').value = val;
}
}
<?php if($user_login_or_not)
{
?>
set_login_registration_frm('<?php echo $user_login_or_not;?>');
<?php
}
?>
var ptthemes_category_dislay = '<?php echo get_option('ptthemes_category_dislay');?>';
</script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/place_validation.js"></script>
<?php get_footer(); ?>

Answers (1)

2011-08-08

Kailey Lampert answers:

Try changing

$map_view = 'G_NORMAL_MAP';

To this:

$map_view = 'G_HYBRID_MAP';


Mahmood Yaqub comments:

ive tried doing that already


<div class="category_label2">
<?php
if($map_view=='')
{
$map_view = 'G_HYBRID_MAP';
}
?>
<div class="form_cat2">


http://bahrainsmart.com/list/?ptype=post_listing

still doesn't show


Kailey Lampert comments:

I scanned a bit too quickly...

It looks like the map code is in /library/map/location_add_map.php

Could you post that file? If it's really large you can use something like http://pastebin.com/


Mahmood Yaqub comments:

Interesting, thanks for making time Kailey. This fix has been troubling me for days now.


<?php
if(!function_exists('get_location_map_javascripts'))
{
function get_location_map_javascripts()
{
?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=<?php echo get_option('ptthemes_api_key');?>" type="text/javascript"></script>
<script type="text/javascript">
/* <![CDATA[ */
window.onload = function () {main_function();}
window.onunload = function () {GUnload();}
var map;
var latlng;
var geocoder;
var address;
<?php
if($_SESSION['multi_city'])
{
?>
var CITY_MAP_CENTER_LAT = '<?php echo get_current_city_lat();?>';
var CITY_MAP_CENTER_LNG = '<?php echo get_current_city_lng();?>';
var CITY_MAP_ZOOMING_FACT=<?php echo get_current_city_scale_factor();?>;
<?php
}else
{
?>
var CITY_MAP_CENTER_LAT = '<?php echo get_option('ptthemes_latitute');?>';
var CITY_MAP_CENTER_LNG = '<?php echo get_option('ptthemes_longitute');?>';
var CITY_MAP_ZOOMING_FACT=<?php echo get_option('ptthemes_scaling_factor');?>;
<?php }?>
<?php
global $geo_latitude,$geo_longitude;
if(esc_attr(stripslashes($geo_latitude)) && esc_attr(stripslashes($geo_longitude)))
{
?>
var CITY_MAP_CENTER_LAT = '<?php echo $geo_latitude;?>';
var CITY_MAP_CENTER_LNG = '<?php echo $geo_longitude;?>';
<?php
}
?>
if(CITY_MAP_CENTER_LAT=='')
{
var CITY_MAP_CENTER_LAT = 34;
}
if(CITY_MAP_CENTER_LNG=='')
{
var CITY_MAP_CENTER_LNG = 0;
}
if(CITY_MAP_CENTER_LAT!='' && CITY_MAP_CENTER_LNG!='' && CITY_MAP_ZOOMING_FACT!='')
{
var CITY_MAP_ZOOMING_FACT = 13;
}else if(CITY_MAP_ZOOMING_FACT!='')
{
var CITY_MAP_ZOOMING_FACT = 3;
}
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
//map.setCenter(new GLatLng(0,34), 3);
map.setCenter(new GLatLng(CITY_MAP_CENTER_LAT,CITY_MAP_CENTER_LNG), CITY_MAP_ZOOMING_FACT);
map.addControl(new GLargeMapControl);


GEvent.addListener(map, "click", getAddress);
geocoder = new GClientGeocoder();
var marker = new GMarker(new GLatLng(CITY_MAP_CENTER_LAT,CITY_MAP_CENTER_LNG), {draggable: true});

GEvent.addListener(marker, "dragstart", function() {
map.closeInfoWindow();
});

GEvent.addListener(marker, "dragend", function() {

var lat = marker.getLatLng().lat();
var lng = marker.getLatLng().lng();

/*
if(eval(marker.A)){
var lat = marker.A.Nd;
}
if(eval(marker.A)){
var lng = marker.A.Ga;
}
if(eval(marker.B)){
var lat = marker.B.Nd;
}
if(eval(marker.B)){
var lng = marker.B.Ga;
}
if(eval(marker.C)){
var lat = marker.C.Nd;
}
if(eval(marker.C)){
var lng = marker.C.Ga;
}
if(eval(marker.D)){
var lat = marker.D.Nd;
}
if(eval(marker.D)){
var lng = marker.D.Ga;
}
if(eval(marker.Ca)){
var lat = marker.Ca.Md;
}
if(eval(marker.Ca)){
var lng = marker.Ca.Ha;
}
*/
marker.openInfoWindowHtml('<?php _e('Latitude:');?>' + lat + '<br><?php _e('Longitude:');?>' + lng);
document.getElementById('geo_latitude').value=lat;
document.getElementById('geo_longitude').value=lng;
});
map.addOverlay(marker);

}

function dumpProps(obj, parent) {
// Go through all the properties of the passed-in object
for (var i in obj) {
// if a parent (2nd parameter) was passed in, then use that to
// build the message. Message includes i (the object's property name)
// then the object's property value on a new line
if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
// Display the message. If the user clicks "OK", then continue. If they
// click "CANCEL" then quit this level of recursion
if (!confirm(msg)) { return; }
// If this property (i) is an object, then recursively process the object
if (typeof obj[i] == "object") {
if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
}
}
}

function getAddress(overlay, latlng) {
if (latlng != null) {
address = latlng;
geocoder.getLocations(latlng, showAddress);
}
}

function showAddress(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("<?php _e('Status Code:');?>" + response.Status.code);
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
marker.openInfoWindowHtml(
'<?php _e('latlng:');?>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
'<?php _e('Address:');?>' + place.address
);
document.getElementById('geo_latitude').value=place.Point.coordinates[1];
document.getElementById('geo_longitude').value=place.Point.coordinates[0];

GEvent.addListener(marker, "dragstart", function() {
map.closeInfoWindow();
});


GEvent.addListener(marker, "dragend", function() {
//dumpProps(marker);

/* if(eval(marker.A)){
var lat = marker.A.Nd;
}
if(eval(marker.A)){
var lng = marker.A.Ga;
}
if(eval(marker.B)){
var lat = marker.B.Nd;
}
if(eval(marker.B)){
var lng = marker.B.Ga;
}
if(eval(marker.C)){
var lat = marker.C.Nd;
}
if(eval(marker.C)){
var lng = marker.C.Ga;
}
if(eval(marker.D)){
var lat = marker.D.Nd;
}
if(eval(marker.D)){
var lng = marker.D.Ga;
}
if(eval(marker.Ca.Md)){
var lat = marker.Ca.Md;
}
if(eval(marker.Ca.Ha)){
var lng = marker.Ca.Ha;
}

//marker.openInfoWindowHtml('<?php _e('Latitude:');?>' + lat + '<br><?php _e('Longitude:');?>' + lng + '<br>');

//document.getElementById('geo_latitude').value=lat;
//document.getElementById('geo_longitude').value=lng;*/

var lat = marker.getLatLng().lat();
var lng = marker.getLatLng().lng();

marker.openInfoWindowHtml('<?php _e('Latitude:');?>' + lat + '<br><?php _e('Longitude:');?>' + lng + '<br>');
document.getElementById('geo_latitude').value=lat;
document.getElementById('geo_longitude').value=lng;

});
}
}
function findAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + "<?php _e('not found');?>");
} else {
map.setCenter(point, 13);
geocoder.getLocations(point, showAddress);
}
}
);
return marker;

}
}
/* ]]> */
</script>
<?php
}
}
get_location_map_javascripts();
?>
<script type="text/javascript">
window.onload = function () {initialize();}
window.onunload = function () {GUnload();}
</script>
<input type="button" class="b_submit" value="<?php _e('Set Address on Map');?>" onclick="findAddress(document.getElementById('address').value);" />
<div id="map_canvas" style="float:right; height:300px; margin-right:36px; position:relative; width:410px;" class="form_row clearfix"></div>


Kailey Lampert comments:

Okay, try this one instead.

Find map.addControl(new GLargeMapControl);
and add map.setMapType(G_HYBRID_MAP); right after


Mahmood Yaqub comments:

Great, that shows the hybrid satellite view but its still now showing the controls for selection.


Kailey Lampert comments:

This is clearly a Monday...

Add this line to the same spot

map.addControl(new GMapTypeControl());


Mahmood Yaqub comments:

You have officially made my day!

Thanks, this is fixed. What do i need to next?


Kailey Lampert comments:

I think you can use a Vote or Assign Prize Money link to choose an answer

[[LINK href="http://codewi.se/2011/04/22/voting-assign-prize-money/"]]http://codewi.se/2011/04/22/voting-assign-prize-money/[[/LINK]]

I haven't used this site to ask a question yet, so I'm not exactly sure how it works


Mahmood Yaqub comments:

ok did vote. heres the link i see

http://www.wpquestions.com/voting/show/id/4751/questionId/2809

thank you very much.