-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ | |
}); | ||
} | ||
}) | ||
}); | ||
</script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="pageoverflow"> | ||
<p class="pagetext">{$fielddef->ModLang('address_field')}:</p> | ||
<p class="pageinput"> | ||
{$themeObject->DisplayImage('icons/system/info.gif')}<em> {$fielddef->ModLang('fielddef_address_field_help')}</em><br /> | ||
{html_options name="{$actionid}custom_input[address_field]" options=$fielddef->Siblings() selected=$fielddef->GetOptionValue('address_field')} | ||
</p> | ||
</div> | ||
|
||
<div class="pageoverflow"> | ||
<p class="pagetext">{$fielddef->ModLang('size')}:</p> | ||
<p class="pageinput"> | ||
{$themeObject->DisplayImage('icons/system/info.gif')}<em> {$fielddef->ModLang('fielddef_size_help')}</em><br /> | ||
<input type="text" name="{$actionid}custom_input[size]" value="{$fielddef->GetOptionValue('size', 20)}" /> | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<div class="pageoverflow"> | ||
<p class="pagetext">{$fielddef->GetName()}{if $fielddef->IsRequired()}*{/if}:</p> | ||
<div class="pageinput"> | ||
{if $fielddef->GetDesc()}({$fielddef->GetDesc()})<br />{/if} | ||
{$fld_value = $fielddef->GetValue("array")} | ||
<input type="text" name="{$actionid}customfield[{$fielddef->GetId()}][]" id="{$actionid}customfield_{$fielddef->GetId()}_lat" value="{$fld_value[0]}" size="{$fielddef->GetOptionValue('size')}" /><br /> | ||
<input type="text" name="{$actionid}customfield[{$fielddef->GetId()}][]" id="{$actionid}customfield_{$fielddef->GetId()}_lon" value="{$fld_value[1]}" size="{$fielddef->GetOptionValue('size')}" /><br /> | ||
<button id="{$actionid}customfield_{$fielddef->GetId()}_lookup">Lookup</button> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
jQuery(document).ready(function($) { | ||
$("#{$actionid}customfield_{$fielddef->GetId()}_lookup").on("click", function(e) { | ||
$.ajaxSetup({ cache: true }); | ||
$.getScript('https://www.google.com/jsapi', function() { | ||
google.load('maps', '3', { | ||
other_params: 'sensor=false', | ||
callback: function () { | ||
// Init GeoCoder | ||
var geocoder = new google.maps.Geocoder(); | ||
// Marker setup | ||
geocoder.geocode({ 'address' : '{$fielddef->Address()}' }, function(results, status) { | ||
if(status === google.maps.GeocoderStatus.OK) { | ||
$("#{$actionid}customfield_{$fielddef->GetId()}_lat").val(results[0].geometry.location.d); | ||
$("#{$actionid}customfield_{$fielddef->GetId()}_lon").val(results[0].geometry.location.e); | ||
console.log(results[0].geometry.location); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
e.preventDefault(); | ||
}); | ||
}); | ||
</script> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
#------------------------------------------------------------------------- | ||
# | ||
# Author: Ben Malen, <[email protected]> | ||
# Co-Maintainer: Simon Radford, <[email protected]> | ||
# Web: www.conceptfactory.com.au | ||
# | ||
#------------------------------------------------------------------------- | ||
# | ||
# Maintainer since 2011: Jonathan Schmid, <[email protected]> | ||
# Web: www.jonathanschmid.de | ||
# | ||
#------------------------------------------------------------------------- | ||
# | ||
# Some wackos started destroying stuff since 2012: | ||
# | ||
# Tapio Löytty, <[email protected]> | ||
# Web: www.orange-media.fi | ||
# | ||
# Goran Ilic, <[email protected]> | ||
# Web: www.ich-mach-das.at | ||
# | ||
#------------------------------------------------------------------------- | ||
# | ||
# ListIt is a CMS Made Simple module that enables the web developer to create | ||
# multiple lists throughout a site. It can be duplicated and given friendly | ||
# names for easier client maintenance. | ||
# | ||
#------------------------------------------------------------------------- | ||
|
||
class listit2fd_GeoCoder extends ListIt2FielddefBase | ||
{ | ||
public function __construct(&$db_info, $caller_object) | ||
{ | ||
parent::__construct($db_info, $caller_object); | ||
|
||
$this->SetFriendlyType($this->ModLang('fielddef_'.$this->GetType())); | ||
} | ||
|
||
public function Siblings() | ||
{ | ||
$caller = $this->GetModuleInstance(true); | ||
$all_fields = $caller->GetFieldDefs(); | ||
|
||
$output = array(); | ||
foreach($all_fields as $field) { | ||
|
||
if($field->GetId() == $this->GetId()) | ||
continue; | ||
|
||
$output[$field->GetId()] = $field->GetName(); | ||
} | ||
|
||
return $output; | ||
} | ||
|
||
public function Address() | ||
{ | ||
foreach($this->GetParentArray() as $field) { | ||
|
||
if($field->GetId() == $this->GetOptionValue('address_field')) | ||
return $field->GetValue(self::TYPE_STRING); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} // end of class | ||
?> |