ABOUT US PRODUCTS GET INVOLVED BLOG

Ushahidi Mailing Lists

« All Listsdevelopers@list.ushahidi.com

Message: previous - next
Month: February 2012

OpenLayers code duplication across different pages that provide maps

From: "Mr. Evoltech" <evoltech@...>
Date: Thu, 02 Feb 2012 16:28:04 -0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello All,

This is my first post to this list.  I am the lead developer of the
March-Hare Communications Collective.  We are adding a number of
features to Ushahidi to make it a bit more suitable for real time report
aggregation and publishing at the street level for protesters.

Right now alot of the functionality we are working on is in the
OpenLayers code of Ushahidi.  While there are ways to hook into
different sections of functionality for the site there do not seem to be
many ways to hook into JS.  To make issues more difficult for developers
who want to customize the mapping features of Ushahidi it seems like
there is a fair amount of duplication of OpenLayers code in the
project.  I am wondering if anyone can speak if there are any plans to
address these issues and / or if there is a specific way it is intended
for developers to hook into the OpenLayers JS for mapping pages?

Currently the technique I am using is not to override the
/application/views/*_js.php files, but to use the
ushahidi_filter.header_js event to override javascript functions in the
end of the JS that is inserted in the html header with code like so:

preg_match(':^(.+)(//-->\s*</script>\s*)$:s', Event::$data, $matches);
$new_js = " ... ";
Event::$data = $matches[1] . $new_js . $matches[2];

Sincerely,
evoltech


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPKyoQAAoJEDTy25qNIucjXQsQAM4NOb9vQEf8WBObEmshYHqt
NG7eBGUMJ93gZbGxVlcYWEM52VGTj7PgGaPP6Zdw1ZXTjHpS/EJJ4I4uxS1zKD9J
4IsaCWdA4QB9zaQgshSqrFxLD5YVh1zcHouCpL4ul9uX/oa4gGQqPUe9fCRGtWcd
zzKU26nQ7Yh+X+HUwzNQdJG1/1BuAXrI7kxY4pAEFECDSSHADwG79MWBcjvTcntz
LO7dbrWD2m1rArS7Iq6DXWWDN0DIEarCPsyO4JztyNbRlBk7tVrCKcqwHrcPY9sQ
SCQD1EW2as6JSdX6oJ5c6fiZ1rTkfaN38H2APNfHNF/mvTzHIl+Aj3gsUSYxfDyO
ENe/HTax1MMlbtye3jYEctarfNMR77++jAzD86Sp5AAnH6GnoEW9iG2444HMYx/W
A/vTzbW7LpFjUEhAFuVrm8Eq1Ot6kTn/iOJwPxAg8/bITWWrhMZLypdmShldE2OB
6bqeTInzb8/ZJeUI8sde6ERifTcuVkqGgsxoboVaBH2OQL1wVuBRUt9J0b1H3VhN
16SZ7yJKRxK43meUzPcIJi91MZi8NKp2bvfezlnhl85+iw884MLV2xailmOlF9cY
BYdsrFQAoRTRAaMxCW3LsRJt8kyyw/jySfPc2v52fF+1MnRFO3kIyVrpgJg9IXvG
UIYRxorlD/gjJtxapaQl
=L+Vt
-----END PGP SIGNATURE-----