From 7136b85f21201b9611977ae4ff8004aeb1ba47bb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 12 Nov 2006 18:50:30 +0000 Subject: * new report: project activity * "start date" and "% done" fields added on issues * project calendar added * gantt chart added (exportable to pdf) * multiple file upload for issues attachments * user custom field displayed on account/show * default configuration improved (default roles, trackers, status, permissions and workflows) * fixed: project settings now displayed according to user's permissions git-svn-id: http://redmine.rubyforge.org/svn/trunk@44 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- redmine/app/controllers/account_controller.rb | 1 + redmine/app/controllers/issues_controller.rb | 2 + redmine/app/controllers/projects_controller.rb | 85 +++++++-- redmine/app/controllers/users_controller.rb | 8 +- redmine/app/helpers/application_helper.rb | 8 + redmine/app/models/issue.rb | 5 + redmine/app/views/account/show.rhtml | 11 +- redmine/app/views/issues/change_status.rhtml | 6 + redmine/app/views/issues/edit.rhtml | 33 ++-- redmine/app/views/issues/show.rhtml | 18 +- redmine/app/views/layouts/base.rhtml | 6 +- redmine/app/views/news/_form.rhtml | 16 +- redmine/app/views/news/show.rhtml | 2 +- redmine/app/views/projects/_form.rhtml | 12 +- redmine/app/views/projects/activity.rhtml | 12 +- redmine/app/views/projects/add_issue.rhtml | 35 +++- redmine/app/views/projects/calendar.rhtml | 71 +++++++ redmine/app/views/projects/gantt.rfpdf | 161 ++++++++++++++++ redmine/app/views/projects/gantt.rhtml | 241 ++++++++++++++++++++++++ redmine/app/views/projects/list_issues.rhtml | 2 +- redmine/app/views/projects/list_news.rhtml | 2 +- redmine/app/views/projects/settings.rhtml | 133 +++++++------ redmine/app/views/projects/show.rhtml | 2 +- redmine/app/views/reports/issue_report.rhtml | 8 +- redmine/app/views/users/_form.rhtml | 24 ++- redmine/config/config_custom.example.rb | 65 +++++++ redmine/config/config_custom.rb | 60 ------ redmine/config/environment.rb | 4 + redmine/db/migrate/005_issue_start_date.rb | 11 ++ redmine/db/migrate/006_calendar_and_activity.rb | 13 ++ redmine/doc/CHANGELOG | 26 ++- redmine/doc/INSTALL | 7 +- redmine/lang/de.yml | 114 +++++------ redmine/lang/en.yml | 16 +- redmine/lang/es.yml | 94 ++++----- redmine/lang/fr.yml | 13 +- redmine/lib/tasks/load_default_data.rake | 85 +++++++-- redmine/public/images/add.png | Bin 0 -> 336 bytes redmine/public/images/arrow_bw.png | Bin 0 -> 997 bytes redmine/public/images/arrow_from.png | Bin 0 -> 994 bytes redmine/public/images/arrow_to.png | Bin 0 -> 991 bytes redmine/public/images/attachment.png | Bin 0 -> 259 bytes redmine/public/images/details.png | Bin 0 -> 224 bytes redmine/public/images/gantt.png | Bin 0 -> 218 bytes redmine/public/images/jstoolbar/bt_br.png | Bin 0 -> 244 bytes redmine/public/images/jstoolbar/bt_code.png | Bin 0 -> 338 bytes redmine/public/images/jstoolbar/bt_del.png | Bin 0 -> 368 bytes redmine/public/images/jstoolbar/bt_em.png | Bin 0 -> 311 bytes redmine/public/images/jstoolbar/bt_ins.png | Bin 0 -> 322 bytes redmine/public/images/jstoolbar/bt_link.png | Bin 0 -> 900 bytes redmine/public/images/jstoolbar/bt_ol.png | Bin 0 -> 249 bytes redmine/public/images/jstoolbar/bt_quote.png | Bin 0 -> 323 bytes redmine/public/images/jstoolbar/bt_strong.png | Bin 0 -> 355 bytes redmine/public/images/jstoolbar/bt_ul.png | Bin 0 -> 239 bytes redmine/public/images/zoom_in.png | Bin 0 -> 593 bytes redmine/public/images/zoom_in_g.png | Bin 0 -> 312 bytes redmine/public/images/zoom_out.png | Bin 0 -> 588 bytes redmine/public/images/zoom_out_g.png | Bin 0 -> 311 bytes redmine/public/javascripts/application.js | 1 + redmine/public/javascripts/jstoolbar.js | 42 ++--- redmine/public/stylesheets/application.css | 23 ++- 61 files changed, 1121 insertions(+), 357 deletions(-) create mode 100644 redmine/app/views/projects/calendar.rhtml create mode 100644 redmine/app/views/projects/gantt.rfpdf create mode 100644 redmine/app/views/projects/gantt.rhtml create mode 100644 redmine/config/config_custom.example.rb delete mode 100644 redmine/config/config_custom.rb create mode 100644 redmine/db/migrate/005_issue_start_date.rb create mode 100644 redmine/db/migrate/006_calendar_and_activity.rb create mode 100644 redmine/public/images/add.png create mode 100644 redmine/public/images/arrow_bw.png create mode 100644 redmine/public/images/arrow_from.png create mode 100644 redmine/public/images/arrow_to.png create mode 100644 redmine/public/images/attachment.png create mode 100644 redmine/public/images/details.png create mode 100644 redmine/public/images/gantt.png create mode 100644 redmine/public/images/jstoolbar/bt_br.png create mode 100644 redmine/public/images/jstoolbar/bt_code.png create mode 100644 redmine/public/images/jstoolbar/bt_del.png create mode 100644 redmine/public/images/jstoolbar/bt_em.png create mode 100644 redmine/public/images/jstoolbar/bt_ins.png create mode 100644 redmine/public/images/jstoolbar/bt_link.png create mode 100644 redmine/public/images/jstoolbar/bt_ol.png create mode 100644 redmine/public/images/jstoolbar/bt_quote.png create mode 100644 redmine/public/images/jstoolbar/bt_strong.png create mode 100644 redmine/public/images/jstoolbar/bt_ul.png create mode 100644 redmine/public/images/zoom_in.png create mode 100644 redmine/public/images/zoom_in_g.png create mode 100644 redmine/public/images/zoom_out.png create mode 100644 redmine/public/images/zoom_out_g.png diff --git a/redmine/app/controllers/account_controller.rb b/redmine/app/controllers/account_controller.rb index 22ac8609a..7031d71ec 100644 --- a/redmine/app/controllers/account_controller.rb +++ b/redmine/app/controllers/account_controller.rb @@ -27,6 +27,7 @@ class AccountController < ApplicationController # Show user's account def show @user = User.find(params[:id]) + @custom_values = @user.custom_values.find(:all, :include => :custom_field) end # Login request and validation diff --git a/redmine/app/controllers/issues_controller.rb b/redmine/app/controllers/issues_controller.rb index d428c75bf..c279e6430 100644 --- a/redmine/app/controllers/issues_controller.rb +++ b/redmine/app/controllers/issues_controller.rb @@ -81,6 +81,7 @@ class IssuesController < ApplicationController @issue.status = @history.status @issue.fixed_version_id = (params[:issue][:fixed_version_id]) @issue.assigned_to_id = (params[:issue][:assigned_to_id]) + @issue.done_ratio = (params[:issue][:done_ratio]) @issue.lock_version = (params[:issue][:lock_version]) if @issue.save flash[:notice] = l(:notice_successful_update) @@ -124,5 +125,6 @@ private def find_project @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) @project = @issue.project + @html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}" end end diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 9e1dc14ef..0198e975f 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -182,7 +182,8 @@ class ProjectsController < ApplicationController @tracker = Tracker.find(params[:tracker_id]) @priorities = Enumeration::get_values('IPRI') @issue = Issue.new(:project => @project, :tracker => @tracker) - if request.get? + if request.get? + @issue.start_date = Date.today @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } else @issue.attributes = params[:issue] @@ -214,7 +215,7 @@ class ProjectsController < ApplicationController @results_per_page = params[:per_page].to_i session[:results_per_page] = @results_per_page else - @results_per_page = session[:results_per_page] || @results_per_page_options.first + @results_per_page = session[:results_per_page] || 25 end @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause) @@ -356,16 +357,22 @@ class ProjectsController < ApplicationController 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 + if params[:year] and params[:year].to_i > 1900 + @year = params[:year].to_i + if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 + @month = params[:month].to_i + end + end + @year ||= Date.today.year + @month ||= Date.today.month + + @date_from = Date.civil(@year, @month, 1) + @date_to = (@date_from >> 1)-1 + @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| + @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i| @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @@ -373,7 +380,7 @@ class ProjectsController < ApplicationController 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| + @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to] ).each { |i| @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @@ -381,7 +388,7 @@ class ProjectsController < ApplicationController 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| + 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, @date_to] ).each { |i| @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @@ -389,7 +396,7 @@ class ProjectsController < ApplicationController 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| + 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, @date_to] ).each { |i| @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } @@ -397,12 +404,64 @@ class ProjectsController < ApplicationController end end + + def calendar + if params[:year] and params[:year].to_i > 1900 + @year = params[:year].to_i + if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 + @month = params[:month].to_i + end + end + @year ||= Date.today.year + @month ||= Date.today.month + + @date_from = Date.civil(@year, @month, 1) + @date_to = (@date_from >> 1)-1 + # start on monday + @date_from = @date_from - (@date_from.cwday-1) + # finish on sunday + @date_to = @date_to + (7-@date_to.cwday) + + @issues = @project.issues.find(:all, :include => :tracker, :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) + render :layout => false if request.xhr? + end + + def gantt + if params[:year] and params[:year].to_i >0 + @year_from = params[:year].to_i + if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 + @month_from = params[:month].to_i + else + @month_from = 1 + end + else + @month_from ||= (Date.today << 1).month + @year_from ||= (Date.today << 1).year + end + + @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 + @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 + + @date_from = Date.civil(@year_from, @month_from, 1) + @date_to = (@date_from >> @months) - 1 + @issues = @project.issues.find(:all, :order => "start_date, due_date", :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]) + + if params[:output]=='pdf' + @options_for_rfpdf ||= {} + @options_for_rfpdf[:file_name] = "gantt.pdf" + render :template => "projects/gantt.rfpdf", :layout => false + else + render :template => "projects/gantt.rhtml" + end + end + private # Find project of id params[:id] # if not found, redirect to project list # Used as a before_filter def find_project - @project = Project.find(params[:id]) + @project = Project.find(params[:id]) + @html_title = @project.name rescue redirect_to :action => 'list' end diff --git a/redmine/app/controllers/users_controller.rb b/redmine/app/controllers/users_controller.rb index dee9e9d6b..47d0e51c9 100644 --- a/redmine/app/controllers/users_controller.rb +++ b/redmine/app/controllers/users_controller.rb @@ -51,14 +51,15 @@ class UsersController < ApplicationController @user = User.new(params[:user]) @user.admin = params[:user][:admin] || false @user.login = params[:user][:login] - @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] + @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } @user.custom_values = @custom_values if @user.save flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end - end + end + @auth_sources = AuthSource.find(:all) end def edit @@ -68,7 +69,7 @@ class UsersController < ApplicationController else @user.admin = params[:user][:admin] if params[:user][:admin] @user.login = params[:user][:login] if params[:user][:login] - @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? + @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? or @user.auth_source_id if params[:custom_fields] @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } @user.custom_values = @custom_values @@ -78,6 +79,7 @@ class UsersController < ApplicationController redirect_to :action => 'list' end end + @auth_sources = AuthSource.find(:all) end def destroy diff --git a/redmine/app/helpers/application_helper.rb b/redmine/app/helpers/application_helper.rb index 835ac4859..378545eb1 100644 --- a/redmine/app/helpers/application_helper.rb +++ b/redmine/app/helpers/application_helper.rb @@ -57,6 +57,10 @@ module ApplicationHelper def format_time(time) l_datetime(time) if time end + + def day_name(day) + l(:general_day_names).split(',')[day-1] + end def pagination_links_full(paginator, options={}, html_options={}) html = '' @@ -76,6 +80,10 @@ module ApplicationHelper html end + def textilizable(text) + $RDM_TEXTILE_DISABLED ? text : textilize(text) + end + def error_messages_for(object_name, options = {}) options = options.symbolize_keys object = instance_variable_get("@#{object_name}") diff --git a/redmine/app/models/issue.rb b/redmine/app/models/issue.rb index 5f2a600e1..4834e069f 100644 --- a/redmine/app/models/issue.rb +++ b/redmine/app/models/issue.rb @@ -33,6 +33,7 @@ class Issue < ActiveRecord::Base has_many :custom_fields, :through => :custom_values validates_presence_of :subject, :description, :priority, :tracker, :author, :status + validates_inclusion_of :done_ratio, :in => 0..100 validates_associated :custom_values, :on => :update # set default status for new issues @@ -44,6 +45,10 @@ class Issue < ActiveRecord::Base if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty? errors.add :due_date, :activerecord_error_not_a_date end + + if self.due_date and self.start_date and self.due_date < self.start_date + errors.add :due_date, :activerecord_error_greater_than_start_date + end end def before_create diff --git a/redmine/app/views/account/show.rhtml b/redmine/app/views/account/show.rhtml index 78fe0a679..4fa306764 100644 --- a/redmine/app/views/account/show.rhtml +++ b/redmine/app/views/account/show.rhtml @@ -1,8 +1,15 @@

<%= @user.display_name %>

-<%= mail_to @user.mail %>
-<%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %> +<%= mail_to @user.mail %> +

<%=l(:label_project_plural)%>

diff --git a/redmine/app/views/issues/change_status.rhtml b/redmine/app/views/issues/change_status.rhtml index e525de60d..0fe07ad23 100644 --- a/redmine/app/views/issues/change_status.rhtml +++ b/redmine/app/views/issues/change_status.rhtml @@ -14,6 +14,12 @@ <%= options_from_collection_for_select @assignable_to, "id", "display_name", @issue.assigned_to_id %>

+ + +

+<%= select("issue", "done_ratio", ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) ) %> +

+

+ <%= f.hidden_field :lock_version %> <%= submit_tag l(:button_save) %> <% end %> +<% unless $RDM_TEXTILE_DISABLED %> <%= javascript_include_tag 'jstoolbar' %> \ No newline at end of file + +<% end %> \ No newline at end of file diff --git a/redmine/app/views/issues/show.rhtml b/redmine/app/views/issues/show.rhtml index 104d33654..43b7d0449 100644 --- a/redmine/app/views/issues/show.rhtml +++ b/redmine/app/views/issues/show.rhtml @@ -12,16 +12,20 @@ <%=l(:field_priority)%> :<%= @issue.priority.name %> - <%=l(:field_author)%> :<%= link_to_user @issue.author %> + <%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? @issue.assigned_to.name : "-" %> <%=l(:field_category)%> :<%= @issue.category ? @issue.category.name : "-" %> + + <%=l(:field_author)%> :<%= link_to_user @issue.author %> + <%=l(:field_start_date)%> :<%= format_date(@issue.start_date) %> + <%=l(:field_created_on)%> :<%= format_date(@issue.created_on) %> - <%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? @issue.assigned_to.name : "-" %> + <%=l(:field_due_date)%> :<%= format_date(@issue.due_date) %> <%=l(:field_updated_on)%> :<%= format_date(@issue.updated_on) %> - <%=l(:field_due_date)%> :<%= format_date(@issue.due_date) %> + <%=l(:field_done_ratio)%> :<%= @issue.done_ratio %> % <% n = 0 @@ -39,7 +43,7 @@ end %>
<%=l(:field_description)%> :

-<%= textilize @issue.description %> +<%= textilizable @issue.description %>

<% if authorize_for('issues', 'edit') %> @@ -98,7 +102,7 @@ end %> <% for attachment in @issue.attachments %> - + <% if authorize_for('issues', 'destroy_attachment') %> @@ -114,8 +118,8 @@ end %>
<% if authorize_for('issues', 'add_attachment') %> <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %> -

+

<%= file_field_tag 'attachments[]', :size => 30 %>

<%= submit_tag l(:button_add) %> <%= end_form_tag %> diff --git a/redmine/app/views/layouts/base.rhtml b/redmine/app/views/layouts/base.rhtml index 7825442ff..e04d3cdea 100644 --- a/redmine/app/views/layouts/base.rhtml +++ b/redmine/app/views/layouts/base.rhtml @@ -1,7 +1,7 @@ -<%= $RDM_HEADER_TITLE %> +<%= $RDM_HEADER_TITLE + (@html_title ? ": #{@html_title}" : "") %> @@ -37,6 +37,7 @@ var menu_contenu=' \ \ <% unless @project.nil? || @project.id.nil? %> \
diff --git a/redmine/app/views/news/_form.rhtml b/redmine/app/views/news/_form.rhtml index 02bb824d9..c04c3b242 100644 --- a/redmine/app/views/news/_form.rhtml +++ b/redmine/app/views/news/_form.rhtml @@ -3,4 +3,18 @@

<%= f.text_field :title, :required => true, :size => 60 %>

<%= f.text_area :summary, :cols => 60, :rows => 2 %>

<%= f.text_area :description, :required => true, :cols => 60, :rows => 10 %>

-
\ No newline at end of file + + +<% unless $RDM_TEXTILE_DISABLED %> +<%= javascript_include_tag 'jstoolbar' %> + +<% end %> \ No newline at end of file diff --git a/redmine/app/views/news/show.rhtml b/redmine/app/views/news/show.rhtml index bea9af4fb..fcc206072 100644 --- a/redmine/app/views/news/show.rhtml +++ b/redmine/app/views/news/show.rhtml @@ -6,7 +6,7 @@ <%=l(:field_created_on)%>: <%= format_time(@news.created_on) %>

-<%= simple_format auto_link @news.description %> +<%= textilizable auto_link @news.description %> <% if authorize_for('news', 'edit') %> <%= start_form_tag ({:controller => 'news', :action => 'edit', :id => @news}, :method => 'get' ) %> diff --git a/redmine/app/views/projects/_form.rhtml b/redmine/app/views/projects/_form.rhtml index 889404bbc..ab0b35fab 100644 --- a/redmine/app/views/projects/_form.rhtml +++ b/redmine/app/views/projects/_form.rhtml @@ -3,7 +3,7 @@

<%= f.text_field :name, :required => true %>

-<% if admin_loggedin? %> +<% if admin_loggedin? and !@root_projects.empty? %>

<%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %>

<% end %> @@ -14,11 +14,13 @@ <% for @custom_value in @custom_values %>

<%= custom_field_tag_with_label @custom_value %>

<% end %> - -

+ +<% unless @custom_fields.empty? %> +

<% for custom_field in @custom_fields %> - <%= check_box_tag "custom_field_ids[]", custom_field.id, (@project.custom_fields.include? custom_field) %> + <%= check_box_tag "custom_field_ids[]", custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %> <%= custom_field.name %> -<% end %>

+<% end %>

+<% end %> diff --git a/redmine/app/views/projects/activity.rhtml b/redmine/app/views/projects/activity.rhtml index 9f5a5d3c9..84275a6e6 100644 --- a/redmine/app/views/projects/activity.rhtml +++ b/redmine/app/views/projects/activity.rhtml @@ -3,8 +3,8 @@
<%= start_form_tag %> -

From <%= text_field_tag 'date_from', @date_from, :size => 10, :class => 'button-small' %> - and <%= text_field_tag 'days_back', @days_back, :size => 2, :class => 'button-small' %> days back

+

<%= select_month(@month, :prefix => "month", :discard_type => true) %> +<%= select_year(@year, :prefix => "year", :discard_type => true) %>

<%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0 %> <%=l(:label_issue_plural)%>
<%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0 %> <%=l(:label_news_plural)%>
<%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0 %> <%=l(:label_attachment_plural)%>
@@ -15,7 +15,7 @@ <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>

<%= format_date(day) %>

    - <% @events_by_day[day].each do |e| %> + <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
  • <% if e.is_a? Issue %> <%= e.created_on.strftime("%H:%M") %> <%= e.tracker.name %> <%= link_to e.long_id, :controller => 'issues', :action => 'show', :id => e %> (<%= e.status.name %>): <%= e.subject %>
    @@ -36,8 +36,6 @@ <% end %>

<% end %> -
- - - +<% if @events_by_day.empty? %>

<%= l(:label_no_data) %>

<% end %> +
\ No newline at end of file diff --git a/redmine/app/views/projects/add_issue.rhtml b/redmine/app/views/projects/add_issue.rhtml index 3e22940b3..b60f91a2e 100644 --- a/redmine/app/views/projects/add_issue.rhtml +++ b/redmine/app/views/projects/add_issue.rhtml @@ -5,23 +5,46 @@
<%= hidden_field_tag 'tracker_id', @tracker.id %> - + +

<%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %>

<%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %>

<%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>

+
+
+

<%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %>

+

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %>

+

<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

+
+ +

<%= f.text_field :subject, :size => 80, :required => true %>

<%= f.text_area :description, :cols => 60, :rows => 10, :required => true %>

-

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %>

<% for @custom_value in @custom_values %>

<%= custom_field_tag_with_label @custom_value %>

<% end %> -

+

<%= file_field_tag 'attachments[]', :size => 30 %>

- -
+
+ +
<%= submit_tag l(:button_create) %> +<% end %> + +<% unless $RDM_TEXTILE_DISABLED %> +<%= javascript_include_tag 'jstoolbar' %> + <% end %> \ No newline at end of file diff --git a/redmine/app/views/projects/calendar.rhtml b/redmine/app/views/projects/calendar.rhtml new file mode 100644 index 000000000..236184fa3 --- /dev/null +++ b/redmine/app/views/projects/calendar.rhtml @@ -0,0 +1,71 @@ +

<%= l(:label_calendar) %>

+ +
<%= link_to attachment.filename, :action => 'download', :id => @issue, :attachment_id => attachment %> (<%= human_size(attachment.filesize) %>)<%= image_tag('attachment') %> <%= link_to attachment.filename, :action => 'download', :id => @issue, :attachment_id => attachment %> (<%= human_size(attachment.filesize) %>) <%= format_date(attachment.created_on) %> <%= attachment.author.display_name %>
+ + + + +
+<%= start_form_tag :action => 'calendar', :id => @project %> +<%= select_month(@month, :prefix => "month", :discard_type => true) %> +<%= select_year(@year, :prefix => "year", :discard_type => true) %> +<%= submit_tag l(:button_submit), :class => "button-small" %> +<%= end_form_tag %> + +<%= image_tag 'gantt' %> +<%= link_to l(:label_gantt_chart), :action => 'gantt', :id => @project %>  +
+
+ + + + +<% 1.upto(7) do |d| %> + +<% end %> + + +<% day = @date_from +while day <= @date_to + if day.cwday == 1 %> + + <% end %> + + <%= '' if day.cwday >= 7 and day!=@date_to %> + <% + day = day + 1 +end %> + +
<%= day_name(d) %>
<%= day.cweek %>"> +

<%= day==Date.today ? "#{day.day}" : day.day %>

+ <% day_issues = [] + @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } + day_issues.each do |i| %> + <%= if day == i.start_date and day == i.due_date + image_tag('arrow_bw') + elsif day == i.start_date + image_tag('arrow_from') + elsif day == i.due_date + image_tag('arrow_to') + end %> + <%= i.tracker.name %> <%= link_to i.id, :controller => 'issues', :action => 'show', :id => i %>: <%= i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %>
+ <% end %> +
+ + + + + + +
+<%= link_to_remote ('« ' + l(:label_previous)), + {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, + {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} + %> + +<%= link_to_remote (l(:label_next) + ' »'), + {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, + {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} + %> +  +
diff --git a/redmine/app/views/projects/gantt.rfpdf b/redmine/app/views/projects/gantt.rfpdf new file mode 100644 index 000000000..0ac0d75ff --- /dev/null +++ b/redmine/app/views/projects/gantt.rfpdf @@ -0,0 +1,161 @@ +<% +pdf=IfpdfHelper::IFPDF.new +pdf.AliasNbPages +pdf.AddPage("L") +pdf.SetFont('Arial','B',9) + +subject_width = 70 +header_heigth = 5 + +headers_heigth = header_heigth +show_weeks = false +show_days = false + +if @months < 7 + show_weeks = true + headers_heigth = 2*header_heigth + if @months < 3 + show_days = true + headers_heigth = 3*header_heigth + end +end + +g_width = 210 +zoom = (g_width) / (@date_to - @date_from + 1) +g_height = 120 +t_height = g_height + headers_heigth + + +# +# Months headers +# +month_f = @date_from +left = subject_width +height = header_heigth +@months.times do + width = ((month_f >> 1) - month_f) * zoom + pdf.SetY(20) + pdf.SetX(left) + pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C") + left = left + width + month_f = month_f >> 1 +end + +# +# Weeks headers +# +if show_weeks + left = subject_width + height = header_heigth + if @date_from.cwday == 1 + # @date_from is monday + week_f = @date_from + else + # find next monday after @date_from + week_f = @date_from + (7 - @date_from.cwday + 1) + width = (7 - @date_from.cwday + 1) * zoom-1 + pdf.SetY(25) + pdf.SetX(left) + pdf.Cell(width + 1, height, "", "LTR") + left = left + width+1 + end + while week_f < @date_to + width = (week_f + 6 <= @date_to) ? 7 * zoom : (@date_to - week_f + 1) * zoom + pdf.SetY(25) + pdf.SetX(left) + pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C") + left = left + width + week_f = week_f+7 + end +end + +# +# Days headers +# +if show_days + left = subject_width + height = header_heigth + wday = @date_from.cwday + pdf.SetFont('Arial','B',7) + (@date_to - @date_from + 1).to_i.times do + width = zoom + pdf.SetY(30) + pdf.SetX(left) + pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C") + left = left + width + wday = wday + 1 + wday = 1 if wday > 7 + end +end + +pdf.SetY(20) +pdf.SetX(15) +pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1) + + +# +# Tasks +# +top = headers_heigth + 20 +pdf.SetFont('Arial','B',7) +@issues.each do |i| + pdf.SetY(top) + pdf.SetX(15) + pdf.Cell(subject_width-15, 5, i.id.to_s + " " + i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR") + + pdf.SetY(top) + pdf.SetX(subject_width) + pdf.Cell(g_width, 5, "", "LR") + + i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) + i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to ) + + i_done_date = i.start_date + ((i.due_date - i.start_date)*i.done_ratio/100).floor + i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) + i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) + + i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today + + i_left = ((i_start_date - @date_from)*zoom) + i_width = ((i_end_date - i_start_date + 1)*zoom) + d_width = ((i_done_date - i_start_date)*zoom) + l_width = ((i_late_date - i_start_date+1)*zoom) if i_late_date + l_width ||= 0 + + pdf.SetY(top+1.5) + pdf.SetX(subject_width + i_left) + pdf.SetFillColor(200,200,200) + pdf.Cell(i_width, 2, "", 0, 0, "", 1) + + if l_width > 0 + pdf.SetY(top+1.5) + pdf.SetX(subject_width + i_left) + pdf.SetFillColor(255,100,100) + pdf.Cell(l_width, 2, "", 0, 0, "", 1) + end + if d_width > 0 + pdf.SetY(top+1.5) + pdf.SetX(subject_width + i_left) + pdf.SetFillColor(100,100,255) + pdf.Cell(d_width, 2, "", 0, 0, "", 1) + end + + pdf.SetY(top+1.5) + pdf.SetX(subject_width + i_left + i_width) + pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%") + + top = top + 5 + pdf.SetDrawColor(200, 200, 200) + pdf.Line(15, top, subject_width+g_width, top) + if pdf.GetY() > 180 + pdf.AddPage("L") + top = 20 + pdf.Line(15, top, subject_width+g_width, top) + end + pdf.SetDrawColor(0, 0, 0) +end + +pdf.Line(15, top, subject_width+g_width, top) + +%> +<%= pdf.Output %> \ No newline at end of file diff --git a/redmine/app/views/projects/gantt.rhtml b/redmine/app/views/projects/gantt.rhtml new file mode 100644 index 000000000..51334660c --- /dev/null +++ b/redmine/app/views/projects/gantt.rhtml @@ -0,0 +1,241 @@ +

<%= l(:label_gantt_chart) %>

+
+ +<%= link_to 'PDF ', :zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :output => 'pdf' %> + +
+ + + + + + +
+<%= start_form_tag %> + +<%= l(:label_months_from) %> +<%= select_month(@month_from, :prefix => "month", :discard_type => true) %> +<%= select_year(@year_from, :prefix => "year", :discard_type => true) %> +<%= hidden_field_tag 'zoom', @zoom %> +<%= submit_tag l(:button_submit), :class => "button-small" %> +<%= end_form_tag %> + +<%= if @zoom < 4 + link_to image_tag('zoom_in'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months} + else + image_tag 'zoom_in_g' + end %> +<%= if @zoom > 1 + link_to image_tag('zoom_out'), :zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months + else + image_tag 'zoom_out_g' + end %> +
+
+ + + +<% zoom = 1 +@zoom.times { zoom = zoom * 2 } + +subject_width = 260 +header_heigth = 18 + +headers_heigth = header_heigth +show_weeks = false +show_days = false + +if @zoom >1 + show_weeks = true + headers_heigth = 2*header_heigth + if @zoom > 2 + show_days = true + headers_heigth = 3*header_heigth + end +end + +g_width = (@date_to - @date_from + 1)*zoom +g_height = [(20 * @issues.length + 6), 206].max +t_height = g_height + headers_heigth +%> + + + + + + +
+ +
+
+
+<% +# +# Tasks subjects +# +top = headers_heigth + 8 +@issues.each do |i| %> +
+ <%= link_to i.id, :controller => 'issues', :action => 'show', :id => i %> + <%= i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> +
+<% top = top + 20 +end %> +
+
+ +
+
 
+<% +# +# Months headers +# +month_f = @date_from +left = 0 +height = (show_weeks ? header_heigth : header_heigth + g_height) +@months.times do + width = ((month_f >> 1) - month_f) * zoom - 1 + %> +
+ <%= link_to "#{month_f.year}-#{month_f.month}", :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months %> +
+ <% + left = left + width + 1 + month_f = month_f >> 1 +end %> + +<% +# +# Weeks headers +# +if show_weeks + left = 0 + height = (show_days ? header_heigth-1 : header_heigth-1 + g_height) + if @date_from.cwday == 1 + # @date_from is monday + week_f = @date_from + else + # find next monday after @date_from + week_f = @date_from + (7 - @date_from.cwday + 1) + width = (7 - @date_from.cwday + 1) * zoom-1 + %> +
 
+ <% + left = left + width+1 + end %> + <% + while week_f < @date_to + width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1 + %> +
+ <%= week_f.cweek %> +
+ <% + left = left + width+1 + week_f = week_f+7 + end +end %> + +<% +# +# Days headers +# +if show_days + left = 0 + height = g_height + header_heigth - 1 + wday = @date_from.cwday + (@date_to - @date_from + 1).to_i.times do + width = zoom - 1 + %> +
5 %>" class="m_bg"> + <%= day_name(wday)[0,1] %> +
+ <% + left = left + width+1 + wday = wday + 1 + wday = 1 if wday > 7 + end +end %> + +<% +# +# Today red line +# +if Date.today >= @date_from and Date.today <= @date_to %> +
 
+<% end %> + +<% +# +# Tasks +# +top = headers_heigth + 12 +@issues.each do |i| %> + <% + i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) + i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to ) + + i_done_date = i.start_date + ((i.due_date - i.start_date)*i.done_ratio/100).floor + i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) + i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date ) + + i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today + + i_left = ((i_start_date - @date_from)*zoom).floor + i_width = ((i_end_date - i_start_date + 1)*zoom).floor + d_width = ((i_done_date - i_start_date)*zoom).floor + l_width = ((i_late_date - i_start_date+1)*zoom).floor if i_late_date + l_width ||= 0 + %> +
 
+ <% if l_width > 0 %> +
 
+ <% end %> + <% if d_width > 0 %> +
 
+ <% end %> +
+ <%= i.status.name %> + <%= (i.done_ratio).to_i %>% +
+ <% top = top + 20 +end %> +
+
+ + + + + + +
<%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months %> +<%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months %>
\ No newline at end of file diff --git a/redmine/app/views/projects/list_issues.rhtml b/redmine/app/views/projects/list_issues.rhtml index 3075d077a..ba6f40f86 100644 --- a/redmine/app/views/projects/list_issues.rhtml +++ b/redmine/app/views/projects/list_issues.rhtml @@ -41,7 +41,7 @@ -<%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %> +<%= start_form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %> diff --git a/redmine/app/views/projects/list_news.rhtml b/redmine/app/views/projects/list_news.rhtml index 31a5f86a4..ae7ae0f86 100644 --- a/redmine/app/views/projects/list_news.rhtml +++ b/redmine/app/views/projects/list_news.rhtml @@ -5,7 +5,7 @@ <% for news in @news %>

<%= news.title %> (<%= link_to_user news.author %> <%= format_time(news.created_on) %>)
- <%= news.summary %>
+ <% unless news.summary.empty? %><%= news.summary %>
<% end %> [<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]

<% end %> diff --git a/redmine/app/views/projects/settings.rhtml b/redmine/app/views/projects/settings.rhtml index cb6864a23..3f9cba0a0 100644 --- a/redmine/app/views/projects/settings.rhtml +++ b/redmine/app/views/projects/settings.rhtml @@ -1,11 +1,12 @@

<%=l(:label_settings)%>

- -<% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %> -<%= render :partial => 'form', :locals => { :f => f } %> -<%= submit_tag l(:button_save) %> -<% end %> -  +<% if authorize_for('projects', 'edit') %> + <% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %> + <%= render :partial => 'form', :locals => { :f => f } %> + <%= submit_tag l(:button_save) %> + <% end %> +
  +<% end %>

<%=l(:label_member_plural)%>

@@ -14,59 +15,67 @@ <% for member in @project.members.find(:all, :include => :user) %> <% unless member.new_record? %>
- + - - <% end %> <% end %> -
<%= member.user.display_name %><%= member.user.display_name %> - <%= start_form_tag :controller => 'members', :action => 'edit', :id => member %> - <%= options_from_collection_for_select @roles, "id", "name", member.role_id %> - + + <%= submit_tag l(:button_change), :class => "button-small" %> + <%= end_form_tag %> + <% end %> - <%= submit_tag l(:button_change), :class => "button-small" %> - <%= end_form_tag %> + + <% if authorize_for('members', 'destroy') %> + <%= start_form_tag :controller => 'members', :action => 'destroy', :id => member %> + <%= submit_tag l(:button_delete), :class => "button-small" %> + <%= end_form_tag %> + <% end %> - <%= start_form_tag :controller => 'members', :action => 'destroy', :id => member %> - <%= submit_tag l(:button_delete), :class => "button-small" %> - <%= end_form_tag %> -
-
+ +<% if authorize_for('projects', 'add_member') %> +

- <%= start_form_tag :controller => 'projects', :action => 'add_member', :id => @project %> - - - <%= submit_tag l(:button_add) %> - <%= end_form_tag %> + <%= start_form_tag :controller => 'projects', :action => 'add_member', :id => @project %> + + + <%= submit_tag l(:button_add) %> + <%= end_form_tag %> +<% end %>

<%=l(:label_version_plural)%>

- <% for version in @project.versions %> - - - + + + <% end %> -
<%= link_to version.name, :controller => 'versions', :action => 'edit', :id => version %><%=h version.description %> + <%=h version.name %><%= format_date(version.effective_date) %><%=h version.description %>    + <%= link_to_if_authorized l(:button_edit), :controller => 'versions', :action => 'edit', :id => version %> + <% if authorize_for('versions', 'destroy') %> +   <%= start_form_tag :controller => 'versions', :action => 'destroy', :id => version %> <%= submit_tag l(:button_delete), :class => "button-small" %> - <%= end_form_tag %> + <%= end_form_tag %> + <% end %>
-
- <%= start_form_tag ({ :controller => 'projects', :action => 'add_version', :id => @project }, :method => 'get' ) %> - <%= submit_tag l(:label_version_new) %> - <%= end_form_tag %> + +<% if authorize_for('projects', 'add_version') %> +
+ <%= link_to l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %> +<% end %>
@@ -76,30 +85,34 @@ <% for @category in @project.issue_categories %> <% unless @category.new_record? %> - - <%= start_form_tag :controller => 'issue_categories', :action => 'edit', :id => @category %> - <%= text_field 'category', 'name', :size => 25 %> + + <%= start_form_tag :controller => 'issue_categories', :action => 'edit', :id => @category %> + <%= text_field 'category', 'name', :size => 25 %> - - <%= submit_tag l(:button_save), :class => "button-small" %> - <%= end_form_tag %> + + <% if authorize_for('issue_categories', 'edit') %> + <%= submit_tag l(:button_save), :class => "button-small" %> + <%= end_form_tag %> + <% end %> + + + <% if authorize_for('issue_categories', 'destroy') %> + <%= start_form_tag :controller => 'issue_categories', :action => 'destroy', :id => @category %> + <%= submit_tag l(:button_delete), :class => "button-small" %> + <%= end_form_tag %> + <% end %> - - <%= start_form_tag :controller => 'issue_categories', :action => 'destroy', :id => @category %> - <%= submit_tag l(:button_delete), :class => "button-small" %> - <%= end_form_tag %> - <% end %> <% end %> - -
- -<%= start_form_tag :action => 'add_issue_category', :id => @project %> -
-<%= error_messages_for 'issue_category' %> -<%= text_field 'issue_category', 'name', :size => 25 %> -<%= submit_tag l(:button_create) %> -<%= end_form_tag %> - + +<% if authorize_for('projects', 'add_issue_category') %> +
+ <%= start_form_tag :action => 'add_issue_category', :id => @project %> +
+ <%= error_messages_for 'issue_category' %> + <%= text_field 'issue_category', 'name', :size => 25 %> + <%= submit_tag l(:button_create) %> + <%= end_form_tag %> +<% end %> diff --git a/redmine/app/views/projects/show.rhtml b/redmine/app/views/projects/show.rhtml index 2cf012390..79e36a586 100644 --- a/redmine/app/views/projects/show.rhtml +++ b/redmine/app/views/projects/show.rhtml @@ -3,7 +3,7 @@
<%= simple_format(auto_link(@project.description)) %>