{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/26725634","id":26725634,"diff_hunk":"@@ -318,6 +318,71 @@ public function setCenter($location, $title = true, $markeroptions = array())\n \t}\n \n \t/**\n+\t * Method to add and event handler to the map.\n+\t * Event handlers must be passed in without being wrapped by a `function(){}` declaration.","path":"libraries/joomla/google/embed/maps.php","position":5,"original_position":5,"commit_id":"82382054e9581344454476492a60e487812f2c40","original_commit_id":"82382054e9581344454476492a60e487812f2c40","user":{"login":"itbra","id":2728569,"avatar_url":"https://avatars.githubusercontent.com/u/2728569?v=3","gravatar_id":"","url":"https://api.github.com/users/itbra","html_url":"https://github.com/itbra","followers_url":"https://api.github.com/users/itbra/followers","following_url":"https://api.github.com/users/itbra/following{/other_user}","gists_url":"https://api.github.com/users/itbra/gists{/gist_id}","starred_url":"https://api.github.com/users/itbra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itbra/subscriptions","organizations_url":"https://api.github.com/users/itbra/orgs","repos_url":"https://api.github.com/users/itbra/repos","events_url":"https://api.github.com/users/itbra/events{/privacy}","received_events_url":"https://api.github.com/users/itbra/received_events","type":"User","site_admin":false},"body":"Absolutely! My bad. In fact this was how i had it before i decided to allow fully qualified function definitions. I simply just forgot to change it there.","created_at":"2015-03-19T02:22:25Z","updated_at":"2015-03-19T02:22:25Z","html_url":"https://github.com/joomla/joomla-cms/pull/6472#discussion_r26725634","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/26725634"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6472#discussion_r26725634"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472","id":31321716,"html_url":"https://github.com/joomla/joomla-cms/pull/6472","diff_url":"https://github.com/joomla/joomla-cms/pull/6472.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/6472.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6472","number":6472,"state":"open","locked":false,"title":"JGoogleEmbedMaps::addEventHandler() to map","user":{"login":"itbra","id":2728569,"avatar_url":"https://avatars.githubusercontent.com/u/2728569?v=3","gravatar_id":"","url":"https://api.github.com/users/itbra","html_url":"https://github.com/itbra","followers_url":"https://api.github.com/users/itbra/followers","following_url":"https://api.github.com/users/itbra/following{/other_user}","gists_url":"https://api.github.com/users/itbra/gists{/gist_id}","starred_url":"https://api.github.com/users/itbra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itbra/subscriptions","organizations_url":"https://api.github.com/users/itbra/orgs","repos_url":"https://api.github.com/users/itbra/repos","events_url":"https://api.github.com/users/itbra/events{/privacy}","received_events_url":"https://api.github.com/users/itbra/received_events","type":"User","site_admin":false},"body":"I found that when creating a map it is not considered to bind events to it. Isn't it a tyical scenario to click on a map and not only zoom in but also trigger some action? \r\n\r\nThe [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference) presents as an example to create the map and immediately create the desired event which expects to receive the map created as reference to bind to. I added the functions required for *map event* handler creation and deletion *([find a PR for marker events here](https://github.com/joomla/joomla-cms/pull/6381))*. Also, the function creating the script was extended to consider registered map event handlers.\r\n\r\nI tested this functionality by taking a view template and writing down the following:\r\n```\r\n// Target element\r\necho '<h1>JGoogleEmbedMaps Test</h1>';\r\necho '<div class=\"row\">';\r\necho \t'<div class=\"col col-xs-12\">';\r\necho \t\t'<div id=\"map\" style=\"height:500px; background:gainsboro; border:gray\">LOADING ...</div>';\r\necho \t'</div>';\r\necho \t'<div class=\"col col-xs-12\">';\r\necho \t\t'<h5>Monitor</h5>';\r\necho \t\t'<p id=\"monitor\" style=\"padding:1em 0.5em; border:1px solid gainsboro; border-radius:3px\"></p>';\r\necho \t'</div>';\r\necho '</div>';\r\n\r\n// Config\r\n$options = new JRegistry(array(\r\n\t'key'         => '',\r\n\t'mapid'       => 'map',\r\n\t'mapclass'    => 'mapclass'\r\n));\r\n\r\n// Get instance\r\n$google = new JGoogle($options);\r\n$map = $google->embed('Maps');\r\n\r\n// Define load type\r\n$map->setAutoload('jquery');\r\n\r\n$map->setMapType('HYBRID');\r\n$map->setCenter(array('50','10'), null);\r\n$map->setZoom('3');\r\n\r\n// Marker configuration\r\n$markerOptions = array(\r\n\t'clickable' => true,\r\n\t'draggable' => false,\r\n\t'opacity'   => 0.75,\r\n\t'optimized' => true,\r\n\t'visible'   => true\r\n);\r\n\r\n// Add events handlers\r\n$map->addEventHandler('bounds_changed',     'function(){ document.getElementById(\"monitor\").innerHTML = \"map bounds_changed event\"; }');\r\n$map->addEventHandler('center_changed',     'function(){ document.getElementById(\"monitor\").innerHTML = \"map center_changed event\"; }');\r\n$map->addEventHandler('click',              'function(){ alert(\"map click event\"); }');\r\n$map->addEventHandler('dblclick',           'function(){ alert(\"map dblclick event\"); }');\r\n$map->addEventHandler('drag',               'function(){ document.getElementById(\"monitor\").innerHTML = \"map drag event\"; }');\r\n$map->addEventHandler('dragend',            'function(){ document.getElementById(\"monitor\").innerHTML = \"map dragend event\"; }');\r\n$map->addEventHandler('dragstart',          'function(){ document.getElementById(\"monitor\").innerHTML = \"map dragstart event\"; }');\r\n$map->addEventHandler('heading_changed',    'function(){ document.getElementById(\"monitor\").innerHTML = \"map heading_changed event\"; }');\r\n$map->addEventHandler('idle',               'function(){ document.getElementById(\"monitor\").innerHTML = \"map idle event\"; }');\r\n$map->addEventHandler('maptypeid_changed',  'function(){ document.getElementById(\"monitor\").innerHTML = \"map maptypeid_changed event\"; }');\r\n$map->addEventHandler('mousemove',          'function(){ document.getElementById(\"monitor\").innerHTML = \"map mousemove event\"; }');\r\n$map->addEventHandler('mouseout',           'function(){ document.getElementById(\"monitor\").innerHTML = \"map mouseout event\"; }');\r\n$map->addEventHandler('mouseover',          'function(){ document.getElementById(\"monitor\").innerHTML = \"map mouseover event\"; }');\r\n$map->addEventHandler('projection_changed', 'function(){ document.getElementById(\"monitor\").innerHTML = \"map projection_changed event\"; }');\r\n$map->addEventHandler('resize',             'function(){ document.getElementById(\"monitor\").innerHTML = \"map resize event\"; }');\r\n$map->addEventHandler('rightclick',         'function(){ document.getElementById(\"monitor\").innerHTML = \"map rightclick event\"; }');\r\n$map->addEventHandler('tilesloaded',        'function(){ document.getElementById(\"monitor\").innerHTML = \"map tilesloaded event\"; }');\r\n$map->addEventHandler('tilt_changed',       'function(){ document.getElementById(\"monitor\").innerHTML = \"map tilt_changed event\"; }');\r\n$map->addEventHandler('zoom_changed',       'function(){ document.getElementById(\"monitor\").innerHTML = \"map zoom_changed event\"; }');\r\n\r\n// Prepare custom script(s)\r\n// initialization callback\r\n$callback =\r\n<<<ENDSCRIPT\r\nwindow.gm = map;   // Will execute after initialisation to add reference to the created map as a global.\r\n(function($, gm, element) {\r\n\t$('#monitor').append('<em>Calling back</em>');\r\n})(jQuery.noConflict(), window.google || {}, document.getElementById({$options->get('mapid')}));\r\nENDSCRIPT;\r\n\r\n// Register custom script(s)\r\n$map->setAdditionalJavascript($callback);\r\n\r\n$map->echoHeader();\r\n$map->echoBody();\r\n```\r\n\r\nWhat do you think about this?\r\n\r\nIf somebody experienced in writing Unit tests might help out to write 3 test for the 3 new functions i would really appreciate your support as i have no experience in that.","created_at":"2015-03-17T10:16:28Z","updated_at":"2015-03-19T02:22:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1871879062db5dcc38fca6b338f5fcf105af5567","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6472/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/82382054e9581344454476492a60e487812f2c40","head":{"label":"itbra:patch-32","ref":"patch-32","sha":"82382054e9581344454476492a60e487812f2c40","user":{"login":"itbra","id":2728569,"avatar_url":"https://avatars.githubusercontent.com/u/2728569?v=3","gravatar_id":"","url":"https://api.github.com/users/itbra","html_url":"https://github.com/itbra","followers_url":"https://api.github.com/users/itbra/followers","following_url":"https://api.github.com/users/itbra/following{/other_user}","gists_url":"https://api.github.com/users/itbra/gists{/gist_id}","starred_url":"https://api.github.com/users/itbra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itbra/subscriptions","organizations_url":"https://api.github.com/users/itbra/orgs","repos_url":"https://api.github.com/users/itbra/repos","events_url":"https://api.github.com/users/itbra/events{/privacy}","received_events_url":"https://api.github.com/users/itbra/received_events","type":"User","site_admin":false},"repo":{"id":16026050,"name":"joomla-cms","full_name":"itbra/joomla-cms","owner":{"login":"itbra","id":2728569,"avatar_url":"https://avatars.githubusercontent.com/u/2728569?v=3","gravatar_id":"","url":"https://api.github.com/users/itbra","html_url":"https://github.com/itbra","followers_url":"https://api.github.com/users/itbra/followers","following_url":"https://api.github.com/users/itbra/following{/other_user}","gists_url":"https://api.github.com/users/itbra/gists{/gist_id}","starred_url":"https://api.github.com/users/itbra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itbra/subscriptions","organizations_url":"https://api.github.com/users/itbra/orgs","repos_url":"https://api.github.com/users/itbra/repos","events_url":"https://api.github.com/users/itbra/events{/privacy}","received_events_url":"https://api.github.com/users/itbra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/itbra/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/itbra/joomla-cms","forks_url":"https://api.github.com/repos/itbra/joomla-cms/forks","keys_url":"https://api.github.com/repos/itbra/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itbra/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itbra/joomla-cms/teams","hooks_url":"https://api.github.com/repos/itbra/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/itbra/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/itbra/joomla-cms/events","assignees_url":"https://api.github.com/repos/itbra/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/itbra/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/itbra/joomla-cms/tags","blobs_url":"https://api.github.com/repos/itbra/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itbra/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itbra/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/itbra/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itbra/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/itbra/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/itbra/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/itbra/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/itbra/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/itbra/joomla-cms/subscription","commits_url":"https://api.github.com/repos/itbra/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/itbra/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/itbra/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/itbra/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/itbra/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/itbra/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itbra/joomla-cms/merges","archive_url":"https://api.github.com/repos/itbra/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itbra/joomla-cms/downloads","issues_url":"https://api.github.com/repos/itbra/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/itbra/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/itbra/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/itbra/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itbra/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/itbra/joomla-cms/releases{/id}","created_at":"2014-01-18T13:31:59Z","updated_at":"2014-08-01T16:18:28Z","pushed_at":"2015-03-17T20:27:17Z","git_url":"git://github.com/itbra/joomla-cms.git","ssh_url":"git@github.com:itbra/joomla-cms.git","clone_url":"https://github.com/itbra/joomla-cms.git","svn_url":"https://github.com/itbra/joomla-cms","homepage":"http://joomla.org","size":125578,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"5753408dab24b40a495b1890d724b7296c0f5dcf","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","created_at":"2011-09-27T02:07:38Z","updated_at":"2015-03-18T13:57:56Z","pushed_at":"2015-03-18T14:20:36Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"http://joomla.org","size":320621,"stargazers_count":1482,"watchers_count":1482,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1651,"mirror_url":null,"open_issues_count":541,"forks":1651,"open_issues":541,"watchers":1482,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6472"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6472"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6472/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6472/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/82382054e9581344454476492a60e487812f2c40"}}}}