I've created a custom module that pulls data from a separate database and then renders a bar chart. However, the chart never rendered. I viewed the source of the web page and saw this:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
swfobject.embedSWF("//sites/all/libraries/ofcv2/open-flash-chart.swf", "ofc_057245b366ab7841589c81504c61", "400", "250", "9.0.0", false, {"get-data":"ofc_057245b366ab7841589c81504c61"}, [  ])
//--><!]]>
</script>

Notice the leading "/" in the path to the SWF file.

So, on a wild guess, I modified line 91 of open_flash_chart_api.module from:

  $swf = url(base_path() . variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf');

...to:

  $swf = url(variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf');

This removed the extra leading "/", and the chart loaded correctly.

This behavior occurred in Firefox and IE.

Comments

MaffooClock’s picture


I just noticed that this workaround does allow Firefox to display the SWF, but in IE8 the behavior is the same (no SWF), and toggling Compatibility View has no effect.


Also, for clarification, in IE the only things that's displayed is the "Get Adobe Flash Player" button.

Woops. Apparently Flash was installed for Firefox, but not for IE. The above workaround resolves my problem. Can anyone else confirm that the extra "/" is a problem?

redndahead’s picture

Look under admin/settings/open_flash_chart_api and if you specified a path remove the beginning '/'

MaffooClock’s picture

StatusFileSize
new38.66 KB

There is no leading slash.

pedrorocha’s picture

I'm having the same problem and i the question is that both url() and base_path() append the base path in the beggining of the string.

The solution is to remove one of them. (i'm in hurry right now, but will try to come back later and apply the patch)

As said by MaffooClock, the change must be on "open_flash_chart_api.module", line 91

$swf = url(variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf');

or

$swf = base_path() . variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf';

will work ;)

Anclywen’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new1.21 KB

//I changed priority, I couldn't render any single graph :(

IMHO first option is better one, because base_path() is already used in url()

pedrorocha’s picture

Assigned: Unassigned » pedrorocha
Status: Needs review » Closed (fixed)

Thanks Anclywen. I commited the patch. Just need to wait for the next development snapshot.