Full screen mode and switcher behavior

Bevan - March 26, 2008 - 09:36
Project:GMap Module
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

This patch
* culminates preceding patches: http://drupal.org/node/238471 http://drupal.org/node/238850 http://drupal.org/node/238432 http://drupal.org/node/236029
* Adds some minor enhancements such as code style adherences, whitespace and comments.
* Uses the correct default parameters for drupal_add_js() for js-compressor compatibility.

And most importantly, adds a behavior (off by default) for the fullscreen switcher as seen on the Hub map: http://hub.witness.org/map#full-screen

There are a few more features seen on the hub map that will be integrated once this (and the requisite patches) are committed:
* logo and legend for maps
* improvements to map/node and map/user and addition of map
* support for views for nodes in map/node

AttachmentSize
fullscreen_switcher.patch29.02 KB
full_screen.css_.txt1.02 KB
full_screen.js_.txt6.09 KB

#1

Bevan - March 31, 2008 - 08:10

This patch includes changes from the other patches, such as fixed js/poly.js to support the d5 backport of the d6 javascript compressor, consistent file endings of javascript files, improved documentation and code style, a notice for browsers with js disabled.

Newest versions of all new files are also attached.

AttachmentSize
238872.patch 32.4 KB
full_screen.css_.txt 1.06 KB
throbber.png 53.11 KB
throbber.gif 2.62 KB
full_screen.js_.txt 6.24 KB
markerloader_chunks.js_.txt 1.77 KB
238872.zip 342.11 KB

#2

Bevan - May 19, 2008 - 10:26

I just updated the forked version of gmap module for the hub. Use this patch file instead of the above attached on on head as of uploading this file

AttachmentSize
238872.patch 31.48 KB

#3

bdragon - May 19, 2008 - 17:56

Bevan:

Please review the need to exclude files from the compressor again. I believe I have fixed most/all the bugs preventing compression from working.

#4

Bevan - May 26, 2008 - 13:59

Rerolled for head, includes a few bugfixes on new code in other patches, include a rewrite fo the fix for double clicks on location picker so taht single and double clicks are dealt with alike.

Also introduces a node locations block, and different titles for all gmap_location blocks to better recall which block is what.

I refactored hook_block to be more maintainable too.

AttachmentSize
238872.patch 33.35 KB

#5

Bevan - June 12, 2008 - 05:52

Rerolled for head, with a few new features/changes:

  • more code style improvements
  • theme can override function theme_gmap_script() to change how and where the <script/> tag for the GMap API is printed. This is useful if the theme has moved <?php print $scripts; ?> out of <head/> and into <body/> in page.tpl.php -- which is a page-load-time enhancement technique.
  • theme can also override function zen_gmap_map_script() to render map data in Drupal.settings directly, instead of by extending Drupal.settings inline.
  • don't render empty <p/> elements in function theme_gmap_location_node_page().
  • refactor function gmap_location_block() (an implementation of hook_block()) to use string keys for block delta's, instead of integer keys. This improves the readability of the code.
  • refactor function gmap_location_block() to use switch-case constructs instead of long if-else-if constructs in the configure, save and view operations.
  • new block nodes_map, a map of all nodes on the site.
  • fixed a bug in $form['initialization']['gmap_load_zoom_plugin']['#description'] and improved the usefulness of the help text.

Example theme functions to override theme_gmap_map_script() and theme_gmap_script() for said purposes in zen or a zen subtheme:

<?php
 
/**
   * Override theme_gmap_script() for storing gmap's external <script> element that
   * normally goes in <head> but instead needs to go in <body>.
   */
 
function zen_gmap_script($version = NULL, $key = NULL) {
    static
$script;
    if (
$version and $key) {
     
// Store the script and return empty string if called with parameters.
     
$script = theme_gmap_script($version, $key);
      return
'';
    }
    else {
     
// Otherwise return the stored script.
     
return $script;
    }
  }

 
/**
   * Override theme_gmap_map_script() to render maps in Drupal.settings instead of inline.
   */
 
function zen_gmap_map_script($id, $map) {
   
drupal_add_js(array('gmap' => array($id => $map)), 'setting');
    return
'';
  }
?>

AttachmentSize
238872.patch 37.35 KB

#6

Bevan - June 25, 2008 - 05:33

I rerolled for head with some new enhancements and bug fixes, on critical;

  • CRITICAL BUG: define('GMAP_WMS', variable_get('gmap_wms', 0)); results in REALLY slow loads of admin/settings/gmap because variables aren't ready at that point in execution. Argh! define() is for constants only. And NOT anything returned by a function, even t() or variable_*(), because the static variables these functions depend on are not properly initialized when modules are included. A constant is a primitive literal, such as 'I am a string', 42, 3.142 and TRUE.
  • Interface bug: The value of "Default map type" (maptype) is not being stored, merged or recalled consistently. The effect is that changes are 'forgotten'. They are stored in {variables} table, but #default_value is not set, and gmap_defaults() wasn't consistent. I fixed that issue in this new patch, but did not fix the fact that gmap.js doesn't do anything with the value. In other words, google's default, 'Map' or G_NORMAL_MAP is always loaded, regardless of the setting of maptype / "Default map type".
  • Some unnecessary extra whitespace was removed.
  • Two lines were refactored in gmap_defaults() to allow for easier debugging.

This patch is now growing faster than it's shrinking, or in other words; Our fork of gmap module is getting further from gmap module faster than it is merging. It would be good to get more of this patch committed quicker, and feedback as to what's NOT committable and why.

AttachmentSize
238872.patch 41.76 KB

#7

Bevan - June 25, 2008 - 10:53

This one fixes the maptype bug properly and fully, and also implements support for gmap_locations ahah callbacks for marker info-windows in gmap_views.

AttachmentSize
238872.patch 43.81 KB

#8

jasontanner - June 25, 2008 - 12:14

Hi Bevan,

I've applied the patch above to a fresh install of the latest 5.x-1.x-dev release but get the following errors about missing marker .png files when going to the admin screen:

    * warning: getimagesize(sites/all/modules/gmap/markers/small/black.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/bpink.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/bred.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/brown.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/dblue.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/dgreen.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/fgreen.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/gray.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/green.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/lblue.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/lgray.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/orange.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/pblue.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/pgreen.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/pyellow.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/pink.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/purple.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/white.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.
    * warning: getimagesize(sites/all/modules/gmap/markers/small/yellow.png) [function.getimagesize]: failed to open stream: No such file or directory in /drupal/site/sites/all/modules/gmap/gmap_markerinfo.inc on line 91.

#9

Bevan - June 25, 2008 - 12:31

You'll need to download the zip and add the respective files. This was included in an earlier comment, but I just realized is out of date, so use the attached one here.

AttachmentSize
newfiles.zip 353.22 KB

#10

jasontanner - June 25, 2008 - 15:17

Hi Bevan,

Thanks for the speedy response. Those newfiles did the trick, I now have a working FullScreen button on my node map, user map and also a views map. The errors I reported before about missing files have gone away. I still have a problem with displaying a map on a node but I suspect thats nothing to do with this patch. (FIXED)

Regards,

Jason

#11

bdragon - June 25, 2008 - 16:09

Sorry, I haven't been following this as closely as I should. :(
It's on my todo list now.

#12

Bevan - June 25, 2008 - 22:31

@jasontanner, glad it's useful for someone else too! Let me know (on this thread) if you have any issues.

#13

bdragon - June 26, 2008 - 15:16

I coulda sworn I had nuked that define already...

Oh well, it's gone now. Thanks.

#14

bdragon - June 26, 2008 - 15:31

The default map type interface bug is now fixed as well.

#15

Bevan - June 26, 2008 - 22:03

Cool! I don't think I'll have a chance to reroll for 3 or 4 weeks, but a review of other changes in this patch would be great!

#16

jasontanner - August 27, 2008 - 16:22

I'm in the process of re-rolling this for D6. I have it basically working but am undecided yet whether I should also try to include the gmap_location changes.

e.g the node locations map, node location map and author location map changes mentioned above.

Attached is what I have so far, but its not in patch format - its a tar.gz of my gmap module folder.

AttachmentSize
gmap.tar.gz for D6 includes the Full Screen functionality. 257.39 KB

#17

jasontanner - August 27, 2008 - 16:22
Version:5.x-1.x-dev» 6.x-1.x-dev

#18

Bevan - August 27, 2008 - 20:05

Jason, This (my) patch includes many other changes to gmap module, so rerolling the whole patch for the drupal 6 branch is more work than necesary. Also, please submit unified diff patches; See http://drupal.org/patch/create

#19

jasontanner - August 28, 2008 - 07:54

Hi,

I'm not sure what you mean by "rerolling the whole patch for the D6 branch being more work than necessary" - I think I only did what was needed to get your changes to work in D6.

I'll be happy to submit a proper patch, I'll try to get that done in the next day or so.

#20

jasontanner - August 28, 2008 - 10:12

Ok, here is the patch file - against the HEAD version of gmap. I think HEAD is the D6 Port .. couldn't see a D6 branch or version.

I ended up having to use Eclipse (after following the instructions on drupal.org) to create the patch. For some reason, the cvs command hangs on my linux box.

AttachmentSize
238872-D6.patch 246.01 KB

#21

Bevan - August 28, 2008 - 13:17

Meanwhile, I rerolled this for DRUPAL-5. Brandon, I replied to one of your comments in the code.

What's the standard for getting html snippets and text strings client-side for use by DOM-manipulating javascript? map's #settings doesn't always make sense because test strings apply to all maps on a page, and duplicating it is redundant and asking for problems when we set it twice. Also, I'm not sure how I'd find a map setting clientside?

I tested markerloader_static.js with ~1200 markers and it loaded within a several seconds (barely acceptable) on a MacBook Pro, 4Gb Ram, OS X Leopard, FF3. I didn't benchmark this against the version that centered the map after each addmarker event, but I know from memory that performance has improved about 10-fold with this change, making the chunkMarkerLoader near-redundant, and mostly useful for the animation factor. I've adjusted the default chunk markerloader settings accordingly in this patch. I also reverted the markers that already existed, hence the new zip file with new files too.

AttachmentSize
238872.patch 45.72 KB
238872.zip 249 KB

#22

Summit - January 5, 2009 - 10:04

Subscribing, will this patch be committed?
Greetings,
Martijn

#23

Bevan - January 5, 2009 - 23:08

Summit, I don't expect so. I'm currently waiting for funding/time to be able to contribute these features to d.o as a 3rd party 'bonus features' module instead.

#24

trogie - January 9, 2009 - 10:37

subscribing

 
 

Drupal is a registered trademark of Dries Buytaert.