From e693c045b80a4d11aa64f648dfed82dcca7651f2 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Wed, 11 May 2011 16:42:41 +0200 Subject: [PATCH 1/6] simply force UTC TZ rather than converting time --- lib/report/operator.rb | 6 +++--- lib/to_date_patch.rb | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/report/operator.rb b/lib/report/operator.rb index 8365ea029d..a2fc719eb7 100644 --- a/lib/report/operator.rb +++ b/lib/report/operator.rb @@ -43,7 +43,7 @@ class Report::Operator 1 # assume mondays end - from = Time.now.utc.at_beginning_of_week + ((first_day % 7) - 1).days + from = Time.now.force_utc.at_beginning_of_week + ((first_day % 7) - 1).days from -= offset.days '<>d'.to_operator.modify query, field, from, from + 7.days end @@ -277,8 +277,8 @@ class Report::Operator module DateRange def modify(query, field, from, to) - query.where ["#{field} > '%s'", quoted_date((Date.yesterday + from).to_time.utc.end_of_day)] if from - query.where ["#{field} <= '%s'", quoted_date((Date.today + to).to_time.utc.end_of_day)] if to + query.where ["#{field} > '%s'", quoted_date((Date.yesterday + from).to_time.force_utc.end_of_day)] if from + query.where ["#{field} <= '%s'", quoted_date((Date.today + to).to_time.force_utc.end_of_day)] if to query end end diff --git a/lib/to_date_patch.rb b/lib/to_date_patch.rb index 4bac1c94fb..2f9dd1e8cb 100644 --- a/lib/to_date_patch.rb +++ b/lib/to_date_patch.rb @@ -9,6 +9,11 @@ module ToDatePatch return Date.today if blank? Date.parse self end + + def force_utc + return self if utc? + utc - utc_offset + end end module DateAndTime From 88c01dea805b83842ae39d893f77fdd07ded9bde Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Wed, 11 May 2011 16:47:20 +0200 Subject: [PATCH 2/6] fix force_utc --- lib/to_date_patch.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/to_date_patch.rb b/lib/to_date_patch.rb index 2f9dd1e8cb..3af633ee50 100644 --- a/lib/to_date_patch.rb +++ b/lib/to_date_patch.rb @@ -9,11 +9,6 @@ module ToDatePatch return Date.today if blank? Date.parse self end - - def force_utc - return self if utc? - utc - utc_offset - end end module DateAndTime @@ -23,5 +18,11 @@ module ToDatePatch def to_dateish self end + + def force_utc + return to_time.force_utc unless repond_to? :utc_offset + return self if utc? + utc - utc_offset + end end end From e7f2faf1c3f0d27fabdb7bd085741b8aa61bb2b1 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Wed, 11 May 2011 16:52:13 +0200 Subject: [PATCH 3/6] fix force_utc --- lib/to_date_patch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/to_date_patch.rb b/lib/to_date_patch.rb index 3af633ee50..cf98973db8 100644 --- a/lib/to_date_patch.rb +++ b/lib/to_date_patch.rb @@ -20,7 +20,7 @@ module ToDatePatch end def force_utc - return to_time.force_utc unless repond_to? :utc_offset + return to_time.force_utc unless respond_to? :utc_offset return self if utc? utc - utc_offset end From 30fc64e4fbb5383905b4ade47e893121d5611cda Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Wed, 11 May 2011 16:59:47 +0200 Subject: [PATCH 4/6] dont use UTC --- lib/report/operator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/report/operator.rb b/lib/report/operator.rb index a2fc719eb7..c01386d49f 100644 --- a/lib/report/operator.rb +++ b/lib/report/operator.rb @@ -43,7 +43,7 @@ class Report::Operator 1 # assume mondays end - from = Time.now.force_utc.at_beginning_of_week + ((first_day % 7) - 1).days + from = Time.now.at_beginning_of_week + ((first_day % 7) - 1).days from -= offset.days '<>d'.to_operator.modify query, field, from, from + 7.days end @@ -277,8 +277,8 @@ class Report::Operator module DateRange def modify(query, field, from, to) - query.where ["#{field} > '%s'", quoted_date((Date.yesterday + from).to_time.force_utc.end_of_day)] if from - query.where ["#{field} <= '%s'", quoted_date((Date.today + to).to_time.force_utc.end_of_day)] if to + query.where ["#{field} > '%s'", quoted_date((Date.yesterday + from).to_time.end_of_day)] if from + query.where ["#{field} <= '%s'", quoted_date((Date.today + to).to_time.end_of_day)] if to query end end From c98d1ca26e9353cefd52f063a6564ad4b0d31070 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Fri, 3 Jun 2011 15:11:31 +0200 Subject: [PATCH 5/6] add subject name to cache key --- lib/widget/controls/save_as.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/widget/controls/save_as.rb b/lib/widget/controls/save_as.rb index 8b0b6d6969..898fbaffd4 100644 --- a/lib/widget/controls/save_as.rb +++ b/lib/widget/controls/save_as.rb @@ -14,6 +14,10 @@ class Widget::Controls::SaveAs < Widget::Controls maybe_with_help end + def cache_key + super + @subject.name + end + def render_popup_form name = content_tag :p do label_tag(:query_name, l(:field_name)) + From 7ea83c2e0bed67646340ec503bc53cc704040678 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Fri, 3 Jun 2011 16:25:03 +0200 Subject: [PATCH 6/6] resurrected filter(chainable) help icons --- lib/widget/filters.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/widget/filters.rb b/lib/widget/filters.rb index b99d82ae9c..88626dcaad 100644 --- a/lib/widget/filters.rb +++ b/lib/widget/filters.rb @@ -18,7 +18,7 @@ class Widget::Filters < Widget::Base :name => nil add_filter += maybe_with_help :icon => { :class => 'filter-icon' }, :tooltip => { :class => 'filter-tip' }, - :instant_write => false + :instant_write => false # help associated with this kind of Widget add_filter.html_safe end write content_tag(:div, table + select) @@ -74,6 +74,21 @@ class Widget::Filters < Widget::Base render_widget Filters::MultiValues, f, :to => html end end + render_filter_help f, :to => html render_widget Filters::RemoveButton, f, :to => html end + + ##Renders help for a filter (chainable) + def render_filter_help(filter, options = {}) + html = content_tag :td, :width => "25px" do + if filter.help_text # help associated with the chainable this Widget represents + render_widget Widget::Controls::Help, filter.help_text + end + end + if canvas = options[:to] + canvas << "\n" << html + else + html + end + end end