Modules: ClustrMaps integration - v.1.7

Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Mon, 2009-10-19 00:52

ClustrMaps Sidebar module - allows adding small map of visitor to your site.
ClustrMaps is a free service.

Quote:
Do you know your audience? You will with ClustrMaps! Visitors don't need to click on anything: just viewing your page is sufficient. We provide (free) the HTML that gives you a tiny map, like the one on the left. When it loads, it increments a counter and shows the locations of all visitors to your page, cumulatively (even for huge numbers). Clicking on it zooms in to a big world map, and (optionally) lets you zoom in to the continents, as in the example above.

---
Problems? Report it here | Get latest version | Coffee Fund | My Library | Blog

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2009-10-19 04:30

Thanks for the contribution!
Not tested but where do you get the 2 variables needed from the ClustrMaps admin page? I guess I have to dig it out of the HTML they generate for me?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Mon, 2009-10-19 05:39

Yes, when you register and generate the html, you would notice that there is two parts in it:

User id is part of initial link:

Quote:
<a href="http://www4.clustrmaps.com/user/...

Site id is part of the image reference:

Quote:
<img src="http://www4.clustrmaps.com/stats/maps-no_clusters/....-thumb.jpg

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sun, 2009-11-01 19:06

New version is available.
Instead of breaking down url, you can now post the whole 'HTML Code' provided by the service.
It allows using advanced features of the "plus".

 
davibou

Joined: 2010-02-15
Posts: 5
Posted: Mon, 2010-02-15 16:22

Hi,

I rencently install the RC1 and wan't your module to work but i can't.

I installed your module as mentioned in the wiki, registered at ClustrMaps but when i add the html code in the module config it doesn't work.

In the module i only have a part of the link i paste in the config but not the map picture.

I check my php config to allow url open but doesn't fix.

So i check the link

In the clustrMaps admin i choose the second link:

Quote:
<a href="http://www3.clustrmaps.com/user/XXXXXX"><img src="http://www3.clustrmaps.com/stats/maps-no_clusters/www.XXXXX.XX-gallery3--thumb.jpg" alt="Locations of visitors to this page" />
</a>

and in the block it show à link like this:

Quote:
\"Locations

If i click this link i get an error

Quote:
Kohana_404_Exception [ Page Not Found ]: The page you requested, \"http:/www3.clustrmaps.com/counter/maps.php?url=http://www.XXXXX.XX/gallery3/\", could not be found.

And if i simplified the link this way nothing is shown:

Quote:
<a href="http://www3.clustrmaps.com/user/XXXXXX"><img src=\'http://www3.clustrmaps.com/stats/maps-no_clusters/www.XXXXXX.XX-gallery3--thumb.jpg\'></a>

Another bug when i modify the link in the admin the html code is parsed everytime i save.

Quote:
<a href=\\\"http://www3.clustrmaps.com/user/XXXXXX\\\"><img src=\\\'http://www3.clustrmaps.com/stats/maps-no_clusters/www.XXXXX.XX-gallery3--thumb.jpg\\\'></a>

Any idea

Regards David

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2010-02-16 13:37

I do not do anything special about the code
I will check if there were changes to how G3 stores data since the time module was published

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2010-02-16 15:00

Fixed. Please get latest version.

 
davibou

Joined: 2010-02-15
Posts: 5
Posted: Tue, 2010-02-16 16:40

Thanks it work well :)

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sat, 2010-12-11 01:50

version 1.6 released - sync update between all my modules for admin panel

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Sat, 2011-03-12 11:30

Hi Serge,

I've installed the latest version 1.6 but when trying to enter the settings"tab" i get the following message:

Exception [ 0 ]: @todo CLUSTRMAPS_NOT_CONFIGURED

1.

MODPATH/clustrmaps/helpers/clustrmaps.php[ 39 ]
34 return; 35 } 36 37 $html_code = module::get_var("clustrmaps", "html_code"); 38 if (empty($html_code)) { 39 throw new Exception("@todo CLUSTRMAPS_NOT_CONFIGURED"); 40 } 41 42 $caption = module::get_var("clustrmaps", "caption"); 43 if (empty($caption)) { 44 throw new Exception("@todo CLUSTRMAPS_NOT_CONFIGURED");
2.

MODPATH/clustrmaps/controllers/admin_clustrmaps.php[ 24 ] » Clustrmaps_Core::init()

19 */
20class Admin_clustrmaps_Controller extends Admin_Controller {
21
22 public function index() {
23 if (clustrmaps::is_configured()) {
24 clustrmaps::init();
25 }
26
27 $view = new Admin_View("admin.html");
28 $view->content = new View("admin_clustrmaps.html");
29 $view->content->form = $this->_get_setting_form();

3.

{Appel interne PHP} » Admin_clustrmaps_Controller->index()
4.

MODPATH/gallery/controllers/admin.php[ 62 ] » call_user_func_array( paramètres )

function_name

array(2) (
"0 (type: Admin_clustrmaps_Controller)" => array(1) (
"private: theme" => NULL
)
1 => string(5) "index"
)

parameters

array(0)

57
58 if (!method_exists($controller_name, $method)) {
59 throw new Kohana_404_Exception();
60 }
61
62 call_user_func_array(array(new $controller_name, $method), $args);
63 }
64
65 private static function _reauth_check() {
66 $session = Session::instance();
67 $last_active_auth = $session->get("active_auth_timestamp", 0);

5.

{Appel interne PHP} » Admin_Controller->__call( paramètres )

controller_name

string(10) "clustrmaps"

args

array(0)

6.

SYSPATH/core/Kohana.php[ 331 ] » ReflectionMethod->invokeArgs( paramètres )

object

array(1) (
"private: theme" => NULL
)

args

array(2) (
0 => string(10) "clustrmaps"
1 => array(0)
)

326
327 // Start the controller execution benchmark
328 Benchmark::start(SYSTEM_BENCHMARK.'_controller_execution');
329
330 // Execute the controller method
331 $method->invokeArgs($controller, $arguments);
332
333 // Controller method has been executed
334 Event::run('system.post_controller');
335
336 // Stop the controller execution benchmark

7.

{Appel interne PHP} » Kohana_Core::instance( paramètres )

0

NULL

8.

SYSPATH/core/Event.php[ 208 ] » call_user_func_array( paramètres )

function_name

array(2) (
0 => string(6) "Kohana"
1 => string(8) "instance"
)

parameters

array(1) (
0 => NULL
)

203 Event::$data =& $data;
204 $callbacks = Event::get($name);
205
206 foreach ($callbacks as $callback)
207 {
208 call_user_func_array($callback, array(&$data));
209 }
210
211 // Do this to prevent data from getting 'stuck'
212 $clear_data = '';
213 Event::$data =& $clear_data;

9.

APPPATH/Bootstrap.php[ 67 ] » Event_Core::run( paramètres )

name

string(14) "system.execute"

62
63// End system_initialization
64Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization');
65
66// Make the magic happen!
67Event::run('system.execute');

10.

DOCROOT/index.php[ 102 ] » require( paramètres )

I must mention that i'm using G3 with Greydragon Wind theme.
Any idea what's going wrong?
Thanks.

jofrari

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Sat, 2011-03-12 12:43

Hi Serge,

I've installed the latest version 1.6 but when trying to enter the settings"tab" i get the following message:

Exception [ 0 ]: @todo CLUSTRMAPS_NOT_CONFIGURED

1.

MODPATH/clustrmaps/helpers/clustrmaps.php[ 39 ]
34 return; 35 } 36 37 $html_code = module::get_var("clustrmaps", "html_code"); 38 if (empty($html_code)) { 39 throw new Exception("@todo CLUSTRMAPS_NOT_CONFIGURED"); 40 } 41 42 $caption = module::get_var("clustrmaps", "caption"); 43 if (empty($caption)) { 44 throw new Exception("@todo CLUSTRMAPS_NOT_CONFIGURED");
2.

MODPATH/clustrmaps/controllers/admin_clustrmaps.php[ 24 ] » Clustrmaps_Core::init()

19 */
20class Admin_clustrmaps_Controller extends Admin_Controller {
21
22 public function index() {
23 if (clustrmaps::is_configured()) {
24 clustrmaps::init();
25 }
26
27 $view = new Admin_View("admin.html");
28 $view->content = new View("admin_clustrmaps.html");
29 $view->content->form = $this->_get_setting_form();

3.

{Appel interne PHP} » Admin_clustrmaps_Controller->index()
4.

MODPATH/gallery/controllers/admin.php[ 62 ] » call_user_func_array( paramètres )

function_name

array(2) (
"0 (type: Admin_clustrmaps_Controller)" => array(1) (
"private: theme" => NULL
)
1 => string(5) "index"
)

parameters

array(0)

57
58 if (!method_exists($controller_name, $method)) {
59 throw new Kohana_404_Exception();
60 }
61
62 call_user_func_array(array(new $controller_name, $method), $args);
63 }
64
65 private static function _reauth_check() {
66 $session = Session::instance();
67 $last_active_auth = $session->get("active_auth_timestamp", 0);

5.

{Appel interne PHP} » Admin_Controller->__call( paramètres )

controller_name

string(10) "clustrmaps"

args

array(0)

6.

SYSPATH/core/Kohana.php[ 331 ] » ReflectionMethod->invokeArgs( paramètres )

object

array(1) (
"private: theme" => NULL
)

args

array(2) (
0 => string(10) "clustrmaps"
1 => array(0)
)

326
327 // Start the controller execution benchmark
328 Benchmark::start(SYSTEM_BENCHMARK.'_controller_execution');
329
330 // Execute the controller method
331 $method->invokeArgs($controller, $arguments);
332
333 // Controller method has been executed
334 Event::run('system.post_controller');
335
336 // Stop the controller execution benchmark

7.

{Appel interne PHP} » Kohana_Core::instance( paramètres )

0

NULL

8.

SYSPATH/core/Event.php[ 208 ] » call_user_func_array( paramètres )

function_name

array(2) (
0 => string(6) "Kohana"
1 => string(8) "instance"
)

parameters

array(1) (
0 => NULL
)

203 Event::$data =& $data;
204 $callbacks = Event::get($name);
205
206 foreach ($callbacks as $callback)
207 {
208 call_user_func_array($callback, array(&$data));
209 }
210
211 // Do this to prevent data from getting 'stuck'
212 $clear_data = '';
213 Event::$data =& $clear_data;

9.

APPPATH/Bootstrap.php[ 67 ] » Event_Core::run( paramètres )

name

string(14) "system.execute"

62
63// End system_initialization
64Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization');
65
66// Make the magic happen!
67Event::run('system.execute');

10.

DOCROOT/index.php[ 102 ] » require( paramètres )

I must mention that i'm using G3 with Greydragon Wind theme.
Any idea what's going wrong?
Thanks.

jofrari

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sat, 2011-03-12 18:04

Not very ellegant and may require some rework, but it is what it is
just specify your settings, save it and it would not write anything into log
it does not prevent you from using UI, just log is polluted in strict error mode

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Sun, 2011-03-13 10:48

Hi Serge,

Not sure i understand your advice!
Where to specify my settings, wich kind of settings
because i can't access the admin area.
Maybe i have to change some file, but again wich one?
Furthermore what you mean by UI...you're a techie and
i'm almost a newbie able to understand if you talk
newbie language.
Thanks again.

jofrari

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sun, 2011-03-13 17:56

you should not be required to change any files
I'll see what I can do

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Mon, 2011-03-14 09:35

Thanks Serge, i'll wait for your advice.

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Wed, 2011-03-16 02:52

version 1.7 released
- simplified validation logic

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Wed, 2011-03-16 11:58

Thanks Serge for your imput, but where to download the
latest version because all links are redirecting to the 1.6 version.
Thanks.

jofrari

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Wed, 2011-03-16 16:31

I have corrected the version number in codex page, but it was, in fact, 1.7 version

 
jofrari
jofrari's picture

Joined: 2008-10-04
Posts: 17
Posted: Wed, 2011-03-16 17:36

Hi Serge,

Thanks a lot, it works perfectly and you'll have some
coffes from me for the time you've spent.
Have a nice day.

jofrari

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Wed, 2011-03-16 19:53

Wonderful ;)

 
Tessalief

Joined: 2009-07-18
Posts: 48
Posted: Mon, 2011-08-15 19:40

Hello there

Today i Registred at clustrmaps

The site gave me those 4 codes but all 4 codes doesn't work. (sorry for taking the links and personal data out.)

A] Recommended (good for most users)
<div id="clustrmaps-widget"></div><script type="text/javascript">var _clustrmaps = {'url' : 'http://www.mylink.nl/album', 'user' : 920853, 'server' : '4', 'id' : 'clustrmaps-widget', 'version' : 1, 'date' : '2011-08-15', 'lang' : 'en', 'corners' : 'square' };(function (){ var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'http://www4.clustrmaps.com/counter/map.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);})();</script><noscript><a href="http://www4.clustrmaps.com/user/takenaway"><img src="http://www4.clustrmaps.com/stats/maps-no_clusters/www.mylink.nl-album-thumb.jpg" alt="Locations of visitors to this page" /></a></noscript>
[img]http://ammg.web-chat.eu/clustrmap/A.jpg[/img]
[B] Minimalist (for MySpace and other sites needing the plainest HTML)
<a href="http://www4.clustrmaps.com/user/takenaway"><img src="http://www4.clustrmaps.com/stats/maps-no_clusters/www.mylink.nl-album-thumb.jpg" alt="Locations of visitors to this page" />
</a>
[img]http://ammg.web-chat.eu/clustrmap/B.jpg[/img]
[C] Advanced (for those requiring true W3C XHTML1.1 validation)
<a href="http://www4.clustrmaps.com/counter/maps.php?url=http://www.mylink.nl/album" id="clustrMapsLink"><img src="http://www4.clustrmaps.com/counter/index2.php?url=http://www.mylink.nl/album" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" />
</a>
<script type="text/javascript">
function cantload() {
img = document.getElementById("clustrMapsImg");
img.onerror = null;
img.src = "http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg";
document.getElementById("clustrMapsLink").href = "http://www2.clustrmaps.com";
}
img = document.getElementById("clustrMapsImg");
img.onerror = cantload;
</script>
[img]http://ammg.web-chat.eu/clustrmap/C.jpg[/img]
[D] BBcode syntax (for BBCode / Wiki / Last.FM and other sites needing it)
Gives me this
[img]http://ammg.web-chat.eu/clustrmap/D.jpg[/img]

You have [img]http://ammg.web-chat.eu/clustrmap/serge.jpg[/img] on your site. But mine looks different.

On the codex page I saw the following text:
Installation / Configuration

Download module using link above
Unpack Zip and copy it into modules folder
Activate module
New admin menu item would be available under Settings->ClustMaps allowing provide User ID and Site ID associated with the ClustrMaps account.

I only see this on my website. Please tell me what I do wrong :(
[img]http://ammg.web-chat.eu/clustrmap/clustrmap.jpg[/img]

I'm desperate again :(

Yours
Tes

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Mon, 2011-08-15 20:12

I have just this

<a href="http://www4.clustrmaps.com/counter/maps.php?url=http://gallery.dragonsoft.us" id="clustrMapsLink" target="_blank"><img src="http://www4.clustrmaps.com/counter/index2.php?url=http://gallery.dragonsoft.us" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" /></a>

With some small modification, it is option B from the list above
and it looks like it works for you
as it is mentioned on the CM web-site, you need to give it few days before first stats would appear

 
Tessalief

Joined: 2009-07-18
Posts: 48
Posted: Tue, 2011-08-16 07:32

Thank you for your answer.

Then I'll give it some time..
I agree, that I'm a bit impatient lately :(

First I thought it has to do with a free account or a payed account.

I go read more on http://clustrmaps.com/

Thanks again,

Tes

 
Tessalief

Joined: 2009-07-18
Posts: 48
Posted: Tue, 2011-08-16 14:48

It worked with code B, then I delete 2 pending users in database and now my gallery is a white index page..

I can access the admin section, but the index page is " gone ".

Dang... Something went wrong!
We tried really hard, but it's broken.
Talk to your Gallery administrator for help fixing this!

Now I have to start all over again.... :(