Will a Drupal 7 version of KML be released and maintained?

Comments

jeffschuler’s picture

Version: 6.x-2.x-dev » 6.x-2.0-alpha1
Status: Active » Needs work
StatusFileSize
new8.42 KB

I ran KML 6.x-2.0-alpha1 through Coder Upgrade... first through the Coding Standards process, then Core API changes.

There are a few issues but it's actually kind of working!

jeffschuler’s picture

StatusFileSize
new8.42 KB

So, a KML Feed Views display can been added, and fields defined properly.

When the display is loaded again, (in the Views UI,) though -- upon saving the View or upon switching to the display from another display -- the KML Content-Type headers are being injected, and my browser wants to download the views display UI (and thinks it's a KML file.)

Doing something simple and dumb like commenting out these lines in template_preprocess_views_view_kml() allows us to avoid this problem:

  //drupal_add_http_header('Content-Type', 'application/vnd.google-earth.kml+xml; charset=utf-8');
  //drupal_add_http_header("Content-Disposition: attachment; filename=$filename");

The attached patch makes [only] this change to the previous one.

Other errors are thrown, and when really downloading the file, the type is now discovered... but we can actually download our KML, and continue to use and edit the display Views.

jeffschuler’s picture

Ah, this is better:

  if (empty($vars['view']->live_preview)) {
    drupal_add_http_header('Content-Type', 'application/vnd.google-earth.kml+xml; charset=utf-8');
    drupal_add_http_header("Content-Disposition: attachment; filename=$filename");
  }

(Views does it like this for the RSS Feed style plugin...)

Lots of other Warnings and Notices being thrown... I'm still poking.

tmcw’s picture

Hey Jeff - awesome work! I've added you to the maintainers, so you have full access to the repo and commit whenever you feel's right.

jeffschuler’s picture

StatusFileSize
new9.17 KB

This patch not only includes the change in #3, but a bunch of hacks to get rid of warnings and notices:

in template_preprocess_views_view_kml() :

+  $rows = '';
   foreach ($points as $point) {
     $rows .= theme('kml_placemark', array('point' => $point, 'points' => $points));
   }

in template_preprocess_kml_placemark() :

-  $vars['styleUrl'] = check_plain($vars['point']['styleUrl']);
+  $vars['styleUrl'] = isset($vars['point']['styleUrl']) ? check_plain($vars['point']['styleUrl']) : '';

in views_plugin_style_kml::option_definition() :

-      'default' => $this->filename,
+      'default' => isset($this->filename) ? $this->filename : '',

in views_plugin_style_kml::map_rows() :

-      if ($this->options['linestring']['enable']) {
+      if (isset($this->options['linestring']) && $this->options['linestring']['enable']) {

and added a mostly blank file, views/kml_style.theme.inc :

<?php
?>
jeffschuler’s picture

tmcw: awesome; thanks!!

I was just getting annoyed at rolling full patches for tiny changes.

I've got a bit of learning to do here on the process, but I'd love to commit this (and tag as 7.x-1.x-dev?) if you're comfortable with that.

jeffschuler’s picture

Version: 6.x-2.0-alpha1 » 6.x-2.x-dev
Status: Needs work » Active

OK. 7.x-1.x pushed.

I'd appreciate if you let me know if I've done things properly...

From my initial clone, (even before doing anything) git has been complaining:

warning: refname 'HEAD' is ambiguous.

I see a HEAD tag in there (git tag -l)... is that normal?

jeffschuler’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Active » Fixed

I've made another small fix, and published 7.x-1.x as a dev release.

Status: Fixed » Closed (fixed)

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

AlexisWilke’s picture

Hi jeffschuler,

Did you find a way to get rid of the HEAD tag from the "git tag -l" list? I have the same problem with the addresses module...

Thank you.
Alexis

jeffschuler’s picture

AlexisWilke: you can just delete the tag with "git tag -d HEAD". I think you might need to "git push --tags" after that.

AlexisWilke’s picture

Wasn't sure the git tag -d ... would not destroy the "real" HEAD...

The push needs the tag reference though: git push origin :refs/tags/HEAD

Thank you.
Alexis