It is messy to put objects (functions) in the document object as well as creates a higher possibility of name collision. It is also messy and annoying to do this.

Drupal.settings.openlayers = {};
Drupal.settings.openlayers.maps = {};
Drupal.openlayers.layer = {};

We should find a unified way to handle things like this.

Comments

tmcw’s picture

Coming from Drupal, it's entirely unavoidable. Within all other code, like behaviors and layer types, we should use .data() for arbitrary data.

zzolo’s picture

What about functions like openlayers_behavior_fullscreen_toggle = function(context) {, if there is no elegant way to do this, I would rather see something like this in the beginning of the module"

Drupal.settings.openlayers = {};
Drupal.settings.openlayers.maps = {};
Drupal.openlayers.layer = {};
Drupal.openlayers.callbacks = {};
// define top level things up front

Then have this:

Drupal.openlayers.callbacks.behaviorFullscreenToggle = function(context) {
tmcw’s picture

Ideally callbacks are anonymous functions. In other cases, I don't think it's a good idea to have a freerange callbacks dictionary, but rather that contained functions should be attributes of the behavior functions themselves.

So,

Drupal.behaviors.openlayers_behavior_fullscreen.toggle = function(context) {

tmcw’s picture

Okay, so to make this actionable, these behaviors use globals:

  • DrawFeatures
  • BoxSelect
tmcw’s picture

Fixed in boxselect with: http://drupal.org/cvs?commit=403502

Will be fixed in drawfeatures when most recent patch is committed.

tmcw’s picture

Status: Active » Fixed

Fixed in #721924: CCK does not limit features for drawfeatures.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.