diff --git a/lib/open_flash_chart/ofc_ajax.rb b/lib/open_flash_chart/ofc_ajax.rb index 85726a2..db34dc9 100644 --- a/lib/open_flash_chart/ofc_ajax.rb +++ b/lib/open_flash_chart/ofc_ajax.rb @@ -8,83 +8,109 @@ def periodically_call_function(function, options = {}) def js_open_flash_chart_object(div_name, width, height, base="/") <<-OUTPUT - - #{self.to_open_flash_chart_data(div_name)} -
+ + #{self.to_open_flash_chart_data(div_name)} +
OUTPUT end def link_to_ofc_load(link_text, div_name) data_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" <<-OUTPUT - - #{ActionView::Base.new.link_to_function link_text, "load_#{data_name}()"} - OUTPUT - end - - def link_to_remote_ofc_load(link_text, div_name, url) - fx_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" - <<-OUTPUT - - #{ActionView::Base.new.link_to_function link_text, "reload_#{fx_name}()"} - OUTPUT - end + + #{ActionView::Base.new.link_to_function link_text, "load_#{data_name}()"} + OUTPUT + end - def periodically_call_to_remote_ofc_load(div_name, url, options={}) - fx_name = "#{div_name.gsub(" ","_")}" - # fix a bug in rails with url_for - url = url.gsub("&","&") - <<-OUTPUT - - #{periodically_call_function("reload_#{fx_name}()", options)} - OUTPUT - end + def link_to_remote_ofc_load(link_text, div_name, url) + fx_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" + <<-OUTPUT + + #{ActionView::Base.new.link_to_function link_text, "reload_#{fx_name}()"} + OUTPUT + end + def periodically_call_to_remote_ofc_load(div_name, url, options={}) + fx_name = "#{div_name.gsub(" ","_")}" + # fix a bug in rails with url_for + url = url.gsub("&","&") + <<-OUTPUT + + #{periodically_call_function("reload_#{fx_name}()", options)} + OUTPUT + end - def to_open_flash_chart_data(id="in") - # this builds the open_flash_chart_data js function - <<-OUTPUT - OUTPUT end - + + def to_open_flash_chart_data(id="in", options={}) + # this builds the open_flash_chart_data js function + <<-OUTPUT + + OUTPUT + end + + def save_as_image(post_url, options={}) + id = options[:id] || "in" + + <<-OUTPUT + + OUTPUT + end end end