diff --git a/redmine/app/controllers/issues_controller.rb b/redmine/app/controllers/issues_controller.rb index 45a618b0..8bf3805d 100644 --- a/redmine/app/controllers/issues_controller.rb +++ b/redmine/app/controllers/issues_controller.rb @@ -63,6 +63,7 @@ class IssuesController < ApplicationController @history.status = @issue.status if @history.save flash[:notice] = l(:notice_successful_update) + Mailer.deliver_issue_add_note(@history) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled? redirect_to :action => 'show', :id => @issue return end diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 1d38aad7..8666dae0 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -356,6 +356,48 @@ class ProjectsController < ApplicationController @fixed_issues ||= [] end + def activity + @date_from = begin + params[:date_from].to_date + rescue + end || Date.today + @days_back = params[:days_back] ? params[:days_back].to_i : 15 + @date_to = @date_from - @days_back + @events_by_day = {} + + unless params[:show_issues] == "0" + @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on<=? and issues.created_on>=?", @date_from+1, @date_to], :order => "issues.created_on asc" ).each { |i| + @events_by_day[i.created_on.to_date] ||= [] + @events_by_day[i.created_on.to_date] << i + } + @show_issues = 1 + end + + unless params[:show_news] == "0" + @project.news.find(:all, :conditions => ["news.created_on<=? and news.created_on>=?", @date_from+1, @date_to], :order => "news.created_on asc" ).each { |i| + @events_by_day[i.created_on.to_date] ||= [] + @events_by_day[i.created_on.to_date] << i + } + @show_news = 1 + end + + unless params[:show_files] == "0" + Attachment.find(:all, :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on<=? and attachments.created_on>=?", @project.id, @date_from+1, @date_to], :order => "attachments.created_on asc" ).each { |i| + @events_by_day[i.created_on.to_date] ||= [] + @events_by_day[i.created_on.to_date] << i + } + @show_files = 1 + end + + unless params[:show_documentss] == "0" + Attachment.find(:all, :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on<=? and attachments.created_on>=?", @project.id, @date_from+1, @date_to], :order => "attachments.created_on asc" ).each { |i| + @events_by_day[i.created_on.to_date] ||= [] + @events_by_day[i.created_on.to_date] << i + } + @show_documents = 1 + end + + end private # Find project of id params[:id] # if not found, redirect to project list diff --git a/redmine/app/helpers/custom_fields_helper.rb b/redmine/app/helpers/custom_fields_helper.rb index 8eb16de0..38cb9df5 100644 --- a/redmine/app/helpers/custom_fields_helper.rb +++ b/redmine/app/helpers/custom_fields_helper.rb @@ -57,7 +57,7 @@ module CustomFieldsHelper case custom_value.custom_field.field_format when "date" - l_date(custom_value.value.to_date) if custom_value.value + custom_value.value.empty? ? "" : l_date(custom_value.value.to_date) when "bool" l_YesNo(custom_value.value == "1") else diff --git a/redmine/app/models/issue.rb b/redmine/app/models/issue.rb index 9327aa7b..5f2a600e 100644 --- a/redmine/app/models/issue.rb +++ b/redmine/app/models/issue.rb @@ -32,7 +32,7 @@ class Issue < ActiveRecord::Base has_many :custom_values, :dependent => true, :as => :customized has_many :custom_fields, :through => :custom_values - validates_presence_of :subject, :description, :priority, :tracker, :author + validates_presence_of :subject, :description, :priority, :tracker, :author, :status validates_associated :custom_values, :on => :update # set default status for new issues @@ -49,7 +49,7 @@ class Issue < ActiveRecord::Base def before_create build_history end - + def long_id "%05d" % self.id end diff --git a/redmine/app/models/issue_history.rb b/redmine/app/models/issue_history.rb index f410a39c..4b668260 100644 --- a/redmine/app/models/issue_history.rb +++ b/redmine/app/models/issue_history.rb @@ -18,6 +18,7 @@ class IssueHistory < ActiveRecord::Base belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' + belongs_to :issue validates_presence_of :status end diff --git a/redmine/app/models/issue_status.rb b/redmine/app/models/issue_status.rb index 42658098..c8a40d33 100644 --- a/redmine/app/models/issue_status.rb +++ b/redmine/app/models/issue_status.rb @@ -21,9 +21,13 @@ class IssueStatus < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name - validates_length_of :html_color, :is=>6 + validates_length_of :html_color, :is => 6 validates_format_of :html_color, :with => /^[a-f0-9]*$/i + def before_save + IssueStatus.update_all "is_default=false" if self.is_default? + end + # Returns the default status for new issues def self.default find(:first, :conditions =>["is_default=?", true]) diff --git a/redmine/app/models/mailer.rb b/redmine/app/models/mailer.rb index 755764dc..fa19bf4d 100644 --- a/redmine/app/models/mailer.rb +++ b/redmine/app/models/mailer.rb @@ -20,30 +20,38 @@ class Mailer < ActionMailer::Base def issue_change_status(issue) # Sends to all project members @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification } - @from = 'redmine@somenet.foo' - @subject = "Issue ##{issue.id} has been updated" + @from = $RDM_MAIL_FROM + @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}" @body['issue'] = issue end def issue_add(issue) # Sends to all project members @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification } - @from = 'redmine@somenet.foo' - @subject = "Issue ##{issue.id} has been reported" + @from = $RDM_MAIL_FROM + @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}" @body['issue'] = issue end + def issue_add_note(history) + # Sends to all project members + @recipients = history.issue.project.members.collect { |m| m.user.mail if m.user.mail_notification } + @from = $RDM_MAIL_FROM + @subject = "[#{history.issue.project.name} - #{history.issue.tracker.name} ##{history.issue.id}] #{history.issue.status.name} - #{history.issue.subject}" + @body['history'] = history + end + def lost_password(token) @recipients = token.user.mail - @from = 'redmine@somenet.foo' - @subject = "redMine password" + @from = $RDM_MAIL_FROM + @subject = l(:mail_subject_lost_password) @body['token'] = token end def register(token) @recipients = token.user.mail - @from = 'redmine@somenet.foo' - @subject = "redMine account activation" + @from = $RDM_MAIL_FROM + @subject = l(:mail_subject_register) @body['token'] = token end end diff --git a/redmine/app/views/issues/edit.rhtml b/redmine/app/views/issues/edit.rhtml index 979dc6a4..3d6da398 100644 --- a/redmine/app/views/issues/edit.rhtml +++ b/redmine/app/views/issues/edit.rhtml @@ -23,4 +23,32 @@ <%= f.hidden_field :lock_version %> <%= submit_tag l(:button_save) %> -<% end %> \ No newline at end of file +<% end %> + +<%= javascript_include_tag 'jstoolbar' %> + \ No newline at end of file diff --git a/redmine/app/views/issues/show.rhtml b/redmine/app/views/issues/show.rhtml index d6658bf4..b1affb5a 100644 --- a/redmine/app/views/issues/show.rhtml +++ b/redmine/app/views/issues/show.rhtml @@ -6,25 +6,42 @@
<%=l(:field_status)%> : | <%= @issue.status.name %> | +<%=l(:field_priority)%> : | <%= @issue.priority.name %> | +
<%=l(:field_author)%> : | <%= link_to_user @issue.author %> | +<%=l(:field_category)%> : | <%= @issue.category ? @issue.category.name : "-" %> | +
<%=l(:field_created_on)%> : | <%= format_date(@issue.created_on) %> | +<%=l(:field_assigned_to)%> : | <%= @issue.assigned_to ? @issue.assigned_to.name : "-" %> | +
<%=l(:field_updated_on)%> : | <%= format_date(@issue.updated_on) %> | +<%=l(:field_due_date)%> : | <%= format_date(@issue.due_date) %> | +
<%= custom_value.custom_field.name %> : | <%= show_value custom_value %> | +<% n = n + 1 + if (n > 1) + n = 0 %> +||
-<%=l(:field_status)%> : <%= @issue.status.name %>     -<%=l(:field_priority)%> : <%= @issue.priority.name %>     -<%=l(:field_assigned_to)%> : <%= @issue.assigned_to ? @issue.assigned_to.display_name : "-" %>     -<%=l(:field_category)%> : <%= @issue.category ? @issue.category.name : "-" %> -
-<%= link_to_user @issue.author %>
-<%= format_date(@issue.created_on) %>
-<%= @issue.subject %>
-<%= simple_format ("" + auto_link(@issue.description)) %> -<%= format_date(@issue.due_date) %>
- -<% for custom_value in @custom_values %> -<%= show_value custom_value %>
-<% end %> - -