Update Mapstraction to properly scrape data from notice-list pages

Refactored the JavaScript for Mapstraction use so it scrapes data from
the HTML of the page it's on, if possible, and otherwise generates a
JSON array.
This commit is contained in:
Evan Prodromou
2009-12-04 14:31:19 -05:00
parent 2c07d4a530
commit a92228c713
3 changed files with 65 additions and 49 deletions

View File

@@ -128,12 +128,9 @@ class MapAction extends OwnerDesignAction
}
}
$this->elementStart('script', array('type' => 'text/javascript'));
$this->raw('/*<![CDATA[*/'); // XHTML compat for Safari
$this->raw('var _notices = ' . json_encode($jsonArray).'; ');
$this->raw('showMapstraction($("#map_canvas"),_notices);');
$this->raw('/*]]>*/'); // XHTML compat for Safari
$this->elementEnd('script');
$this->inlineScript('$(document).ready(function() { '.
' var _notices = ' . json_encode($jsonArray).'; ' .
'showMapstraction($("#map_canvas"), _notices); });');
return true;
}