After updating to the 6.x-1.0 version (released on 2011-Jul-27) The Activate Editing and Deactivate Editing buttons are not visible. The reason seems to be this piece of code:

/**
 *  Function that includes the Activate/Deactivate editing mode control if it is enabled
 * @param $field
 * @param $map
 */

function addEditionControl($field, $map){
  if(!empty($field['widget']['mapstraction_cck']['controls']['show_edition']))return '<div id="'. $map['id'] .'-activate-edition" class="mapstraction-cck-edition-control-active" rel="'. $map['id'] .'" active="false" edition-active="'.t('Deactivate Editing').'" edition-inactive="'.t('Activate Editing').'">'. t('Activate Editing') .'</div>';
  else return "";
}

...in the mapstraction_cck.theme.inc file. Is there a way to enable the button? The comment above the quoted code would indicate that this might be the case, but I do not see the interface to do so anywhere.

Thank you

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plopesc’s picture

Hello sano

Last Mapstraction CCK changes included an option that allows to hide the Editing button and include the reset map button.
Did you configure that options in your Mapstraction CCK field config page?

I've made some tests and it works fine for me.

Thanks for your interest in the module.
Regards

sano’s picture

Hi,

As I am writing in the original post. I do not see an interface to set visibility of that button. Can you please tell me where to look for it or include a screen shot of the screen?

Thank you

plopesc’s picture

Status: Active » Fixed
FileSize
36.2 KB

Hello
In the Field config page you can find the "Widget Controls" fieldset, where you can configure the Map controls behavior.

I'm attaching a screenshot from my local environment.

Regards

sano’s picture

FileSize
149.39 KB
93.29 KB

Hmm, I still can't locate the screen where the "Widget Controls" fieldset is placed. I checked the Mapstraction Map field for the content type where I have the map, but do not see it there (see attached Picture 4.png). I also checked the Mapstraction CCK page on the Administer > Site configuration page and it is not there either (see attached Picture 5.png). Finally, I searched for the string "Administrator can customize" that I can see on the screenshot you attached, but Drupal is not finding it anywhere.

Thank you.

plopesc’s picture

Hello.

Check your source code, please. It could be not synchronized with git repository.
You can view in http://drupalcode.org/project/mapstraction_cck.git/blob/b7fe9d1421aaab41... that the string you were looking for is included in the includes/mapstracton_cck.inc file

The fieldset is in the administration field page, where you can configure other field settings as provider or zoom level.

Regards

plopesc’s picture

Helo

After view your screenshot. I found that you must include the patch in the geo_field module provided in issue #640492: hook_gis_input info() and widgets issues. That patch allows to configure the widget.

Regards.

sano’s picture

Hi,

It looks like the patch is for the "geo" module, not the geo-field module. The file path in the patch seems to confirm my "theory":

RCS file: /cvs/drupal-contrib/contributions/modules/geo/modules/geo_field/geo_field.module,v

However, it looks like I have a newer version of the geo_field.module file where the patched segment seems to be in a different place. I am using geo module version 6.x-1.0-alpha5 and I see the following code starting on line 158:

/**
 * Implementation of hook_widget().
 */
function geo_field_widget(&$form, &$form_state, $field, $items, $delta = 0) {
  $widget_info  = _content_widget_types();
  $info = $widget_info[$field['widget']['type']];

  foreach ($items as $key => $item) {
    // Convert from the storage format (wkb) to the element's expected format.
    //if (!isset($item['geo'])) {
      if ($info['gis input']) {
        if (isset($item['wkb'])) {
          $data = geo_wkb_get_data($item['wkb'], $info['gis input']);
          $items[$key]['geo'] = $data['value'];
        }
      }
    //}
  }

  $element['#theme'] = 'geo_fields';
  $element['geo'] = array_merge($info['element'], array(
    '#default_value' => isset($items[$delta]['geo']) ? $items[$delta]['geo'] : NULL,
    '#delta' => $delta,
    '#title' => t($field['widget']['label']),
    '#required' => $field['required'],
    '#description' => $field['widget']['description'],
  ));

  return $element;
}

Could you please advise what should I do?

Thank you

plopesc’s picture

Hello

As I said, the patch is for the geo_field module, given that is the geo_field.info file where you have to make the changes. Geo_field is a Geo's submodule.

The given patch includes a complete hook implementation. Then, you can put that function where you prefer, while you will include it in that file.

Paste that code (is the same as I included in the patch) in the geo_field.module file:

/**
 * Implementation of hook_widget().
 */
function geo_field_widget_settings($op, $widget){
  $widget_info  = _content_widget_types();
  switch ($op){
    case 'form':
      $function = $widget_info[$widget['type']]['settings callback']['form'];
      if (isset($function)) return $function($widget);
      break;
    case 'validate':
      $function = $widget_info[$widget['widget_type']]['settings callback']['validate'];
      if (isset($function)) return $function($widget);
      break;
    case 'save':
      $function = $widget_info[$widget['widget_type']]['settings callback']['save'];
      if (isset($function)) return $function($widget);
      break;
  }
}

Regards

sano’s picture

I ended up pasting the patch code into the geo_field.module (not the geo_field.info) file and now the Map Settings section is visible on the Mapstraction Map Widget type field page.

Now I can also set a default viewport and zoom for the map - a great improvement.

Thank you.

plopesc’s picture

Hello

I'm glad that you were able to enable the map config form. Then, that features were availables since the Mapstraction CCK module was released more than one year ago. That patch was always exposed in the project page and in the documentation page.

Thank you and thanks for your interest in the module.

Regards

Status: Fixed » Closed (fixed)

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