Skip to content

Commit

Permalink
Expose mapping search task to Search Kit
Browse files Browse the repository at this point in the history
Fix OSM Javascript to work on Search Kit display
  • Loading branch information
seamuslee001 committed Mar 23, 2021
1 parent 7f892a5 commit 8fccc8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function preProcessCommon(&$form) {
$form->_contactIds = [];
$form->_contactTypes = [];

$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath);
$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath) || in_array('map', $form->urlPath);
if ($isStandAlone) {
[$form->_task, $title] = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form));
if (!array_key_exists($form->_task, CRM_Contact_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission()))) {
Expand Down
2 changes: 2 additions & 0 deletions CRM/Contact/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public static function tasks() {
'title' => ts('Map contacts'),
'class' => 'CRM_Contact_Form_Task_Map',
'result' => FALSE,
'url' => 'civicrm/contact/map',
'icon' => 'fa-map',
);
}

Expand Down
11 changes: 6 additions & 5 deletions templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@
popup.create(evt);
}

if (window.addEventListener) {
window.addEventListener("load", initMap, false);
} else if (window.attachEvent) {
document.attachEvent("onreadystatechange", initMap);
}
var checkExist = setInterval(function() {
if (typeof OpenLayers !== 'undefined') {
clearInterval(checkExist);
initMap();
}
}, 100); // check every 100ms

function gpopUp() {
var from = document.getElementById('from').value;
Expand Down

0 comments on commit 8fccc8a

Please sign in to comment.