diff --git a/app/controllers/xls_export_controller.rb b/app/controllers/xls_export_controller.rb index f3664fe..d1c2dce 100755 --- a/app/controllers/xls_export_controller.rb +++ b/app/controllers/xls_export_controller.rb @@ -1,5 +1,5 @@ -require 'xlse_asset_helpers' -require_dependency 'xls_export' +require_relative '../../lib/xlse_asset_helpers' +require_relative '../../lib/xls_export' begin require 'zip/zip' rescue LoadError @@ -44,11 +44,11 @@ def index redirect_to :controller => 'issues', :action => 'index', :project_id => @project end end - @settings=XLSE_AssetHelpers::settings + @settings=XlseAssetHelpers::settings end def export_current - @settings=XLSE_AssetHelpers::settings + @settings=XlseAssetHelpers::settings @issues_export_offset=params[:issues_export_offset].to_i || 0 if retrieve_xls_export_data(@settings) export_name = get_xls_export_name(@settings) @@ -100,7 +100,7 @@ def retrieve_xls_export_data(settings=nil) @issues = query_issues(export_offset, limit) # @issue_count_by_group = @query.issue_count_by_group # end of original code - @settings=XLSE_AssetHelpers::settings unless settings + @settings=XlseAssetHelpers::settings unless settings end return true end diff --git a/init.rb b/init.rb index dbda96e..6c95b58 100755 --- a/init.rb +++ b/init.rb @@ -1,14 +1,14 @@ require 'redmine' require 'dispatcher' unless Rails::VERSION::MAJOR >= 3 -require 'xlse_asset_helpers' +require_relative 'lib/xlse_asset_helpers' begin require 'zip/zip' rescue LoadError ActionController::Base::logger.info 'XLS export controller: rubyzip gem not available' end -unless Redmine::Plugin.registered_plugins.keys.include?(XLSE_AssetHelpers::PLUGIN_NAME) - Redmine::Plugin.register XLSE_AssetHelpers::PLUGIN_NAME do +unless Redmine::Plugin.registered_plugins.keys.include?(XlseAssetHelpers::PLUGIN_NAME) + Redmine::Plugin.register XlseAssetHelpers::PLUGIN_NAME do name 'Issues XLS export' author 'Vitaly Klimov' author_url 'mailto:vitaly.klimov@snowbirdgames.com' @@ -43,7 +43,7 @@ requires_redmine :version_or_higher => '3.2.0' end - require 'xls_export_hooks' + require_relative 'lib/xls_export_hooks' end Mime::Type.register('application/vnd.ms-excel', :xls, %w(application/vnd.ms-excel)) unless defined?(Mime::XLS) diff --git a/lib/xls_export.rb b/lib/xls_export.rb index fb61776..4f65098 100644 --- a/lib/xls_export.rb +++ b/lib/xls_export.rb @@ -21,6 +21,9 @@ def strip_html(str, options) end end +module XlsExport +end + module Redmine module Export module XLS @@ -218,7 +221,7 @@ def init_row(row, query, first) def insert_issue_id(row, issue) issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) - row << Spreadsheet::Link.new(URI.escape(issue_url), issue.id.to_s) + row << Spreadsheet::Link.new(ERB::Util.url_encode(issue_url), issue.id.to_s) format_link = Spreadsheet::Format.new :color => :blue, :underline => :single row.set_format(row.size - 1, format_link) end diff --git a/lib/xls_export_hooks.rb b/lib/xls_export_hooks.rb index 3e6d89b..787d9d0 100755 --- a/lib/xls_export_hooks.rb +++ b/lib/xls_export_hooks.rb @@ -1,10 +1,10 @@ -require 'xlse_asset_helpers' +require_relative 'xlse_asset_helpers' -class XLSExportHook < Redmine::Hook::ViewListener +class XlsExportHooks < Redmine::Hook::ViewListener def view_issues_index_bottom(context={}) if context[:query].valid? && !context[:issues].empty? ret_str ='' - ret_str << stylesheet_link_tag("xls_export.css", :plugin => XLSE_AssetHelpers::PLUGIN_NAME, :media => "screen") + ret_str << stylesheet_link_tag("xls_export.css", :plugin => XlseAssetHelpers::PLUGIN_NAME, :media => "screen") ret_str << '
' << l(:label_plugin_xlse_export_format) ret_str << content_tag('span', link_to(l(:label_plugin_xlse_export_format_quick), hook_url_for({ :controller => 'xls_export', :action => 'export_current', :project_id => context[:project] }), diff --git a/lib/xlse_asset_helpers.rb b/lib/xlse_asset_helpers.rb index cde6cf3..f9e80ca 100755 --- a/lib/xlse_asset_helpers.rb +++ b/lib/xlse_asset_helpers.rb @@ -1,4 +1,4 @@ -module XLSE_AssetHelpers +module XlseAssetHelpers PLUGIN_NAME = File.expand_path('../../*', __FILE__).match(/.*\/(.*)\/\*$/)[1].to_sym