diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-12 17:59:02 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-12 17:59:02 +0000 |
commit | 027bf93849e82ef3c60e4a3024db49d65f0fb3c9 (patch) | |
tree | c6bc438fcd50370944b94f605b3f34fe54b73248 /app/helpers | |
parent | 071f8e18d02f789149071abb8e052bae7ad01003 (diff) | |
download | redmine-027bf93849e82ef3c60e4a3024db49d65f0fb3c9.tar.gz redmine-027bf93849e82ef3c60e4a3024db49d65f0fb3c9.zip |
added svn:eol-style native property on /app files
git-svn-id: http://redmine.rubyforge.org/svn/trunk@333 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/account_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/admin_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 456 | ||||
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 150 | ||||
-rw-r--r-- | app/helpers/documents_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/enumerations_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/help_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/ifpdf_helper.rb | 138 | ||||
-rw-r--r-- | app/helpers/issue_categories_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/issue_statuses_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 144 | ||||
-rw-r--r-- | app/helpers/members_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/news_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 54 | ||||
-rw-r--r-- | app/helpers/reports_helper.rb | 60 | ||||
-rw-r--r-- | app/helpers/roles_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/trackers_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/users_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/versions_helper.rb | 34 | ||||
-rw-r--r-- | app/helpers/welcome_helper.rb | 34 |
20 files changed, 739 insertions, 739 deletions
diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index e18ab6ff4..ff18b76a4 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module AccountHelper end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index db2777392..4f82a3790 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module AdminHelper end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f9010df15..0a6c29101 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,229 +1,229 @@ -# redMine - project management software
-# Copyright (C) 2006-2007 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module ApplicationHelper
-
- # Return current logged in user or nil
- def loggedin?
- @logged_in_user
- end
-
- # Return true if user is logged in and is admin, otherwise false
- def admin_loggedin?
- @logged_in_user and @logged_in_user.admin?
- end
-
- # Return true if user is authorized for controller/action, otherwise false
- def authorize_for(controller, action)
- # check if action is allowed on public projects
- if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]
- return true
- end
- # check if user is authorized
- if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) )
- return true
- end
- return false
- end
-
- # Display a link if user is authorized
- def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
- link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
- end
-
- # Display a link to user's account page
- def link_to_user(user)
- link_to user.display_name, :controller => 'account', :action => 'show', :id => user
- end
-
- def image_to_function(name, function, html_options = {})
- html_options.symbolize_keys!
- tag(:input, html_options.merge({
- :type => "image", :src => image_path(name),
- :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};"
- }))
- end
-
- def format_date(date)
- l_date(date) if date
- end
-
- def format_time(time)
- l_datetime((time.is_a? String) ? time.to_time : time) if time
- end
-
- def day_name(day)
- l(:general_day_names).split(',')[day-1]
- end
-
- def month_name(month)
- l(:actionview_datehelper_select_month_names).split(',')[month-1]
- end
-
- def pagination_links_full(paginator, options={}, html_options={})
- html = ''
- html << link_to_remote(('« ' + l(:label_previous)),
- {:update => "content", :url => { :page => paginator.current.previous }},
- {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
-
- html << (pagination_links_each(paginator, options) do |n|
- link_to_remote(n.to_s,
- {:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},
- {:href => url_for(:action => 'list', :params => params.merge({:page => n}))})
- end || '')
-
- html << ' ' + link_to_remote((l(:label_next) + ' »'),
- {:update => "content", :url => { :page => paginator.current.next }},
- {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
- html
- end
-
- # textilize text according to system settings and RedCloth availability
- def textilizable(text, options = {})
- # different methods for formatting wiki links
- case options[:wiki_links]
- when :local
- # used for local links to html files
- format_wiki_link = Proc.new {|title| "#{title}.html" }
- when :anchor
- # used for single-file wiki export
- format_wiki_link = Proc.new {|title| "##{title}" }
- else
- if @project
- format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title }
- else
- format_wiki_link = Proc.new {|title| title }
- end
- end
-
- # turn wiki links into textile links:
- # example:
- # [[link]] -> "link":link
- # [[link|title]] -> "title":link
- text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }
-
- # turn issue ids to textile links
- # example:
- # #52 -> "#52":/issues/show/52
- text = text.gsub(/#(\d+)([\s\.\(\)\-,:;])/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) + $2 }
-
- # turn revision ids to textile links (@project needed)
- # example:
- # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6)
- text = text.gsub(/r(\d+)([\s\.\(\)\-,:;])/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) + $2 } if @project
-
- # finally textilize text
- text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text)))
- end
-
- def error_messages_for(object_name, options = {})
- options = options.symbolize_keys
- object = instance_variable_get("@#{object_name}")
- if object && !object.errors.empty?
- # build full_messages here with controller current language
- full_messages = []
- object.errors.each do |attr, msg|
- next if msg.nil?
- msg = msg.first if msg.is_a? Array
- if attr == "base"
- full_messages << l(msg)
- else
- full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values"
- end
- end
- # retrieve custom values error messages
- if object.errors[:custom_values]
- object.custom_values.each do |v|
- v.errors.each do |attr, msg|
- next if msg.nil?
- msg = msg.first if msg.is_a? Array
- full_messages << "« " + v.custom_field.name + " » " + l(msg)
- end
- end
- end
- content_tag("div",
- content_tag(
- options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :"
- ) +
- content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
- "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
- )
- else
- ""
- end
- end
-
- def lang_options_for_select(blank=true)
- (blank ? [["(auto)", ""]] : []) +
- (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
- end
-
- def label_tag_for(name, option_tags = nil, options = {})
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
- content_tag("label", label_text)
- end
-
- def labelled_tabular_form_for(name, object, options, &proc)
- options[:html] ||= {}
- options[:html].store :class, "tabular"
- form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
- end
-
- def check_all_links(form_name)
- link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
- " | " +
- link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
- end
-
- def calendar_for(field_id)
- image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
- javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
- end
+# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module ApplicationHelper + + # Return current logged in user or nil + def loggedin? + @logged_in_user + end + + # Return true if user is logged in and is admin, otherwise false + def admin_loggedin? + @logged_in_user and @logged_in_user.admin? + end + + # Return true if user is authorized for controller/action, otherwise false + def authorize_for(controller, action) + # check if action is allowed on public projects + if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ] + return true + end + # check if user is authorized + if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) ) + return true + end + return false + end + + # Display a link if user is authorized + def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) + link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action]) + end + + # Display a link to user's account page + def link_to_user(user) + link_to user.display_name, :controller => 'account', :action => 'show', :id => user + end + + def image_to_function(name, function, html_options = {}) + html_options.symbolize_keys! + tag(:input, html_options.merge({ + :type => "image", :src => image_path(name), + :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" + })) + end + + def format_date(date) + l_date(date) if date + end + + def format_time(time) + l_datetime((time.is_a? String) ? time.to_time : time) if time + end + + def day_name(day) + l(:general_day_names).split(',')[day-1] + end + + def month_name(month) + l(:actionview_datehelper_select_month_names).split(',')[month-1] + end + + def pagination_links_full(paginator, options={}, html_options={}) + html = '' + html << link_to_remote(('« ' + l(:label_previous)), + {:update => "content", :url => { :page => paginator.current.previous }}, + {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous + + html << (pagination_links_each(paginator, options) do |n| + link_to_remote(n.to_s, + {:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'}, + {:href => url_for(:action => 'list', :params => params.merge({:page => n}))}) + end || '') + + html << ' ' + link_to_remote((l(:label_next) + ' »'), + {:update => "content", :url => { :page => paginator.current.next }}, + {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next + html + end + + # textilize text according to system settings and RedCloth availability + def textilizable(text, options = {}) + # different methods for formatting wiki links + case options[:wiki_links] + when :local + # used for local links to html files + format_wiki_link = Proc.new {|title| "#{title}.html" } + when :anchor + # used for single-file wiki export + format_wiki_link = Proc.new {|title| "##{title}" } + else + if @project + format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title } + else + format_wiki_link = Proc.new {|title| title } + end + end + + # turn wiki links into textile links: + # example: + # [[link]] -> "link":link + # [[link|title]] -> "title":link + text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) } + + # turn issue ids to textile links + # example: + # #52 -> "#52":/issues/show/52 + text = text.gsub(/#(\d+)([\s\.\(\)\-,:;])/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) + $2 } + + # turn revision ids to textile links (@project needed) + # example: + # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6) + text = text.gsub(/r(\d+)([\s\.\(\)\-,:;])/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) + $2 } if @project + + # finally textilize text + text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text))) + end + + def error_messages_for(object_name, options = {}) + options = options.symbolize_keys + object = instance_variable_get("@#{object_name}") + if object && !object.errors.empty? + # build full_messages here with controller current language + full_messages = [] + object.errors.each do |attr, msg| + next if msg.nil? + msg = msg.first if msg.is_a? Array + if attr == "base" + full_messages << l(msg) + else + full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" + end + end + # retrieve custom values error messages + if object.errors[:custom_values] + object.custom_values.each do |v| + v.errors.each do |attr, msg| + next if msg.nil? + msg = msg.first if msg.is_a? Array + full_messages << "« " + v.custom_field.name + " » " + l(msg) + end + end + end + content_tag("div", + content_tag( + options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :" + ) + + content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), + "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" + ) + else + "" + end + end + + def lang_options_for_select(blank=true) + (blank ? [["(auto)", ""]] : []) + + (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]} + end + + def label_tag_for(name, option_tags = nil, options = {}) + label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") + content_tag("label", label_text) + end + + def labelled_tabular_form_for(name, object, options, &proc) + options[:html] ||= {} + options[:html].store :class, "tabular" + form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) + end + + def check_all_links(form_name) + link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + + " | " + + link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") + end + + def calendar_for(field_id) + image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + + javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") + end end -
-class TabularFormBuilder < ActionView::Helpers::FormBuilder
- include GLoc
-
- def initialize(object_name, object, template, options, proc)
- set_language_if_valid options.delete(:lang)
- @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc
- end
-
- (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|
- src = <<-END_SRC
- def #{selector}(field, options = {})
- return super if options.delete :no_label
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
- label = @template.content_tag("label", label_text,
- :class => (@object && @object.errors[field] ? "error" : nil),
- :for => (@object_name.to_s + "_" + field.to_s))
- label + super
- end
- END_SRC
- class_eval src, __FILE__, __LINE__
- end
-
- def select(field, choices, options = {}, html_options = {})
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
- label = @template.content_tag("label", label_text,
- :class => (@object && @object.errors[field] ? "error" : nil),
- :for => (@object_name.to_s + "_" + field.to_s))
- label + super
- end
-
-end
-
+ +class TabularFormBuilder < ActionView::Helpers::FormBuilder + include GLoc + + def initialize(object_name, object, template, options, proc) + set_language_if_valid options.delete(:lang) + @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc + end + + (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector| + src = <<-END_SRC + def #{selector}(field, options = {}) + return super if options.delete :no_label + label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") + label = @template.content_tag("label", label_text, + :class => (@object && @object.errors[field] ? "error" : nil), + :for => (@object_name.to_s + "_" + field.to_s)) + label + super + end + END_SRC + class_eval src, __FILE__, __LINE__ + end + + def select(field, choices, options = {}, html_options = {}) + label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") + label = @template.content_tag("label", label_text, + :class => (@object && @object.errors[field] ? "error" : nil), + :for => (@object_name.to_s + "_" + field.to_s)) + label + super + end + +end + diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 6a596b89b..d6dc586c4 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -1,77 +1,77 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module CustomFieldsHelper
-
- # Return custom field html tag corresponding to its format
- def custom_field_tag(custom_value)
- custom_field = custom_value.custom_field
- field_name = "custom_fields[#{custom_field.id}]"
- field_id = "custom_fields_#{custom_field.id}"
-
- case custom_field.field_format
- when "string", "int"
- text_field 'custom_value', 'value', :name => field_name, :id => field_id
- when "date"
- text_field('custom_value', 'value', :name => field_name, :id => field_id, :size => 10) +
- calendar_for(field_id)
- when "text"
- text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3
- when "bool"
- check_box 'custom_value', 'value', :name => field_name, :id => field_id
- when "list"
- select 'custom_value', 'value', custom_field.possible_values, { :include_blank => true }, :name => field_name, :id => field_id
- end
- end
-
- # Return custom field label tag
- def custom_field_label_tag(custom_value)
- content_tag "label", custom_value.custom_field.name +
- (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
- :for => "custom_fields_#{custom_value.custom_field.id}",
- :class => (custom_value.errors.empty? ? nil : "error" )
- end
-
- # Return custom field tag with its label tag
- def custom_field_tag_with_label(custom_value)
- custom_field_label_tag(custom_value) + custom_field_tag(custom_value)
- end
-
- # Return a string used to display a custom value
- def show_value(custom_value)
- return "" unless custom_value
- format_value(custom_value.value, custom_value.custom_field.field_format)
- end
-
- # Return a string used to display a custom value
- def format_value(value, field_format)
- return "" unless value && !value.empty?
- case field_format
- when "date"
- begin; l_date(value.to_date); rescue; value end
- when "bool"
- l_YesNo(value == "1")
- else
- value
- end
- end
-
- # Return an array of custom field formats which can be used in select_tag
- def custom_field_formats_for_select
- CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module CustomFieldsHelper + + # Return custom field html tag corresponding to its format + def custom_field_tag(custom_value) + custom_field = custom_value.custom_field + field_name = "custom_fields[#{custom_field.id}]" + field_id = "custom_fields_#{custom_field.id}" + + case custom_field.field_format + when "string", "int" + text_field 'custom_value', 'value', :name => field_name, :id => field_id + when "date" + text_field('custom_value', 'value', :name => field_name, :id => field_id, :size => 10) + + calendar_for(field_id) + when "text" + text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3 + when "bool" + check_box 'custom_value', 'value', :name => field_name, :id => field_id + when "list" + select 'custom_value', 'value', custom_field.possible_values, { :include_blank => true }, :name => field_name, :id => field_id + end + end + + # Return custom field label tag + def custom_field_label_tag(custom_value) + content_tag "label", custom_value.custom_field.name + + (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""), + :for => "custom_fields_#{custom_value.custom_field.id}", + :class => (custom_value.errors.empty? ? nil : "error" ) + end + + # Return custom field tag with its label tag + def custom_field_tag_with_label(custom_value) + custom_field_label_tag(custom_value) + custom_field_tag(custom_value) + end + + # Return a string used to display a custom value + def show_value(custom_value) + return "" unless custom_value + format_value(custom_value.value, custom_value.custom_field.field_format) + end + + # Return a string used to display a custom value + def format_value(value, field_format) + return "" unless value && !value.empty? + case field_format + when "date" + begin; l_date(value.to_date); rescue; value end + when "bool" + l_YesNo(value == "1") + else + value + end + end + + # Return an array of custom field formats which can be used in select_tag + def custom_field_formats_for_select + CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] } end end diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb index c9897647d..7e96a6db3 100644 --- a/app/helpers/documents_helper.rb +++ b/app/helpers/documents_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module DocumentsHelper end diff --git a/app/helpers/enumerations_helper.rb b/app/helpers/enumerations_helper.rb index 11a216a82..c0daf64d2 100644 --- a/app/helpers/enumerations_helper.rb +++ b/app/helpers/enumerations_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module EnumerationsHelper end diff --git a/app/helpers/help_helper.rb b/app/helpers/help_helper.rb index bb629316c..41fc5917c 100644 --- a/app/helpers/help_helper.rb +++ b/app/helpers/help_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module HelpHelper end diff --git a/app/helpers/ifpdf_helper.rb b/app/helpers/ifpdf_helper.rb index 481c2c318..267f96667 100644 --- a/app/helpers/ifpdf_helper.rb +++ b/app/helpers/ifpdf_helper.rb @@ -1,70 +1,70 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require 'iconv'
-require 'rfpdf/chinese'
-
-module IfpdfHelper
-
- class IFPDF < FPDF
- include GLoc
- attr_accessor :footer_date
-
- def initialize(lang)
- super()
- set_language_if_valid lang
- case current_language
- when :ja
- extend(PDF_Japanese)
- AddSJISFont()
- @font_for_content = 'SJIS'
- @font_for_footer = 'SJIS'
- else
- @font_for_content = 'Arial'
- @font_for_footer = 'Helvetica'
- end
- SetCreator("redMine #{Redmine::VERSION}")
- SetFont(@font_for_content)
- end
-
- def SetFontStyle(style, size)
- SetFont(@font_for_content, style, size)
- end
-
- def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
- @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
- txt = begin
- @ic.iconv(txt)
- rescue
- txt
- end
- super w,h,txt,border,ln,align,fill,link
- end
-
- def Footer
- SetFont(@font_for_footer, 'I', 8)
- SetY(-15)
- SetX(15)
- Cell(0, 5, @footer_date, 0, 0, 'L')
- SetY(-15)
- SetX(-30)
- Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
- end
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require 'iconv' +require 'rfpdf/chinese' + +module IfpdfHelper + + class IFPDF < FPDF + include GLoc + attr_accessor :footer_date + + def initialize(lang) + super() + set_language_if_valid lang + case current_language + when :ja + extend(PDF_Japanese) + AddSJISFont() + @font_for_content = 'SJIS' + @font_for_footer = 'SJIS' + else + @font_for_content = 'Arial' + @font_for_footer = 'Helvetica' + end + SetCreator("redMine #{Redmine::VERSION}") + SetFont(@font_for_content) + end + + def SetFontStyle(style, size) + SetFont(@font_for_content, style, size) + end + + def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') + @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') + txt = begin + @ic.iconv(txt) + rescue + txt + end + super w,h,txt,border,ln,align,fill,link + end + + def Footer + SetFont(@font_for_footer, 'I', 8) + SetY(-15) + SetX(15) + Cell(0, 5, @footer_date, 0, 0, 'L') + SetY(-15) + SetX(-30) + Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C') + end + end -
-end
+ +end diff --git a/app/helpers/issue_categories_helper.rb b/app/helpers/issue_categories_helper.rb index 997d830d7..0109e7fae 100644 --- a/app/helpers/issue_categories_helper.rb +++ b/app/helpers/issue_categories_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module IssueCategoriesHelper end diff --git a/app/helpers/issue_statuses_helper.rb b/app/helpers/issue_statuses_helper.rb index 17704b7ba..859b09911 100644 --- a/app/helpers/issue_statuses_helper.rb +++ b/app/helpers/issue_statuses_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module IssueStatusesHelper end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 57fb01600..8fa9f75eb 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -1,74 +1,74 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module IssuesHelper
-
- def show_detail(detail, no_html=false)
- case detail.property
- when 'attr'
- label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
- case detail.prop_key
- when 'due_date', 'start_date'
- value = format_date(detail.value.to_date) if detail.value
- old_value = format_date(detail.old_value.to_date) if detail.old_value
- when 'status_id'
- s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
- s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
- when 'assigned_to_id'
- u = User.find_by_id(detail.value) and value = u.name if detail.value
- u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
- when 'priority_id'
- e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value
- e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
- when 'category_id'
- c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
- c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
- when 'fixed_version_id'
- v = Version.find_by_id(detail.value) and value = v.name if detail.value
- v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
- end
- when 'cf'
- custom_field = CustomField.find_by_id(detail.prop_key)
- if custom_field
- label = custom_field.name
- value = format_value(detail.value, custom_field.field_format) if detail.value
- old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
- end
- end
-
- label ||= detail.prop_key
- value ||= detail.value
- old_value ||= detail.old_value
-
- unless no_html
- label = content_tag('strong', label)
- old_value = content_tag("i", h(old_value)) if detail.old_value
- old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
- value = content_tag("i", h(value)) if value
- end
-
- if detail.value and !detail.value.to_s.empty?
- if old_value
- label + " " + l(:text_journal_changed, old_value, value)
- else
- label + " " + l(:text_journal_set_to, value)
- end
- else
- label + " " + l(:text_journal_deleted) + " (#{old_value})"
- end
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module IssuesHelper + + def show_detail(detail, no_html=false) + case detail.property + when 'attr' + label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym) + case detail.prop_key + when 'due_date', 'start_date' + value = format_date(detail.value.to_date) if detail.value + old_value = format_date(detail.old_value.to_date) if detail.old_value + when 'status_id' + s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value + s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value + when 'assigned_to_id' + u = User.find_by_id(detail.value) and value = u.name if detail.value + u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value + when 'priority_id' + e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value + e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value + when 'category_id' + c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value + c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value + when 'fixed_version_id' + v = Version.find_by_id(detail.value) and value = v.name if detail.value + v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value + end + when 'cf' + custom_field = CustomField.find_by_id(detail.prop_key) + if custom_field + label = custom_field.name + value = format_value(detail.value, custom_field.field_format) if detail.value + old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value + end + end + + label ||= detail.prop_key + value ||= detail.value + old_value ||= detail.old_value + + unless no_html + label = content_tag('strong', label) + old_value = content_tag("i", h(old_value)) if detail.old_value + old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?) + value = content_tag("i", h(value)) if value + end + + if detail.value and !detail.value.to_s.empty? + if old_value + label + " " + l(:text_journal_changed, old_value, value) + else + label + " " + l(:text_journal_set_to, value) + end + else + label + " " + l(:text_journal_deleted) + " (#{old_value})" + end end end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 8bf90913d..fcf9c92e6 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module MembersHelper end diff --git a/app/helpers/news_helper.rb b/app/helpers/news_helper.rb index f4a633f4b..28d36f31a 100644 --- a/app/helpers/news_helper.rb +++ b/app/helpers/news_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module NewsHelper end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 694dd9124..43febd413 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,29 +1,29 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module ProjectsHelper
-
- def highlight_tokens(text, tokens)
- return text unless tokens && !tokens.empty?
- regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE
- result = ''
- text.split(regexp).each_with_index do |words, i|
- result << (i.even? ? (words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', words, :class => 'highlight'))
- end
- result
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module ProjectsHelper + + def highlight_tokens(text, tokens) + return text unless tokens && !tokens.empty? + regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE + result = '' + text.split(regexp).each_with_index do |words, i| + result << (i.even? ? (words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', words, :class => 'highlight')) + end + result end end diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index ed7fd7884..af7a1a972 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -1,32 +1,32 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module ReportsHelper
-
- def aggregate(data, criteria)
- a = 0
- data.each { |row|
- match = 1
- criteria.each { |k, v|
- match = 0 unless row[k].to_s == v.to_s
- } unless criteria.nil?
- a = a + row["total"].to_i if match == 1
- } unless data.nil?
- a
- end
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module ReportsHelper + + def aggregate(data, criteria) + a = 0 + data.each { |row| + match = 1 + criteria.each { |k, v| + match = 0 unless row[k].to_s == v.to_s + } unless criteria.nil? + a = a + row["total"].to_i if match == 1 + } unless data.nil? + a + end end diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rb index 8ae339053..ab3a7ff03 100644 --- a/app/helpers/roles_helper.rb +++ b/app/helpers/roles_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module RolesHelper end diff --git a/app/helpers/trackers_helper.rb b/app/helpers/trackers_helper.rb index 839327efe..89f92e333 100644 --- a/app/helpers/trackers_helper.rb +++ b/app/helpers/trackers_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module TrackersHelper end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 035db3d00..adc62fb77 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module UsersHelper end diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index e2724fe84..452f4d7fb 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module VersionsHelper end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index cace5f542..753e1f127 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -1,19 +1,19 @@ -# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module WelcomeHelper end |