Compare commits
261 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fe90cbfb5 | ||
|
|
644f03b834 | ||
|
|
1154141ee7 | ||
|
|
bf42d9b706 | ||
|
|
e2050d61fd | ||
|
|
1dfe63093b | ||
|
|
472ec31662 | ||
|
|
e66945cbd8 | ||
|
|
8a0a25fceb | ||
|
|
cf77c93cb4 | ||
|
|
956437b7fe | ||
|
|
a464d26e73 | ||
|
|
ea77929d62 | ||
|
|
996b2a5c1d | ||
|
|
50794b08a9 | ||
|
|
1b4f0c38ce | ||
|
|
5f9b1b0e0b | ||
|
|
93c04f2666 | ||
|
|
218e1bb267 | ||
|
|
1ce2ed065a | ||
|
|
d3386a5af7 | ||
|
|
5330ca9b8c | ||
|
|
84247e7272 | ||
|
|
e7b6a56a97 | ||
|
|
9572699301 | ||
|
|
84e70634fb | ||
|
|
94899e0339 | ||
|
|
abacc2754e | ||
|
|
2fa8030afc | ||
|
|
0b2299c7d1 | ||
|
|
5f3f2e756b | ||
|
|
dfc7a94578 | ||
|
|
0399b85ab6 | ||
|
|
9e5edfb728 | ||
|
|
b8b473244c | ||
|
|
6e777b7453 | ||
|
|
fce4615f10 | ||
|
|
b5fcea9e74 | ||
|
|
5014b23c2a | ||
|
|
a6b6dc60f4 | ||
|
|
9b1efcfaab | ||
|
|
546b98a118 | ||
|
|
7a441c1bc4 | ||
|
|
c54f15e35f | ||
|
|
db37e578f2 | ||
|
|
9e1192a54d | ||
|
|
06266c8fec | ||
|
|
af7e586b06 | ||
|
|
0b94f4afa9 | ||
|
|
5a51412e6a | ||
|
|
752d574b49 | ||
|
|
a303b5e2d5 | ||
|
|
e61916ea91 | ||
|
|
86504acb4c | ||
|
|
3fdc273252 | ||
|
|
9882217847 | ||
|
|
5362a85f2b | ||
|
|
f9ce4ff559 | ||
|
|
fefc6e6bec | ||
|
|
97252c26ee | ||
|
|
94b5bbcb5d | ||
|
|
9c09fd20fb | ||
|
|
79b1347ba5 | ||
|
|
0cef17ce44 | ||
|
|
d1b1f5977a | ||
|
|
33274b8d48 | ||
|
|
7c1d8ac00b | ||
|
|
243027e63a | ||
|
|
9d810f0059 | ||
|
|
eaedf9ed52 | ||
|
|
c894f74c5e | ||
|
|
8d8315d8f6 | ||
|
|
7f63f9a931 | ||
|
|
27af58ef1a | ||
|
|
fb4bab748f | ||
|
|
d771847078 | ||
|
|
3f4defe482 | ||
|
|
737bbb3d3d | ||
|
|
7a05f8ed66 | ||
|
|
cbacc71dff | ||
|
|
ad97165f1b | ||
|
|
8be1597ad0 | ||
|
|
1169ff05af | ||
|
|
876a9b6ffb | ||
|
|
d545ca7360 | ||
|
|
1802fa9348 | ||
|
|
29bad1dc95 | ||
|
|
6a8be88ad6 | ||
|
|
e8d0c26e43 | ||
|
|
4ed95ffff6 | ||
|
|
6f68a36679 | ||
|
|
79c33bbc83 | ||
|
|
f6b2be81b9 | ||
|
|
486ecc6661 | ||
|
|
5166213fd3 | ||
|
|
57a4ee318a | ||
|
|
d63746ab3e | ||
|
|
7619c286cc | ||
|
|
6157d20ec0 | ||
|
|
858eba2f1c | ||
|
|
365d92ebf4 | ||
|
|
11b9ceb054 | ||
|
|
9352bb527b | ||
|
|
47475acdaf | ||
|
|
9ae6e60c26 | ||
|
|
077723c90a | ||
|
|
81eee10d5b | ||
|
|
63c72fe87f | ||
|
|
006337fb0e | ||
|
|
4581baa5c0 | ||
|
|
203cf6333e | ||
|
|
b7c1a5c0d5 | ||
|
|
0ecca9d8f1 | ||
|
|
c58298835d | ||
|
|
42452a535f | ||
|
|
d32b9b92cf | ||
|
|
de31cd9ef6 | ||
|
|
a9295a7740 | ||
|
|
8b3a8ac1b4 | ||
|
|
b1cb9cd3bd | ||
|
|
76d33e1fb7 | ||
|
|
0dc6a41832 | ||
|
|
34b86628a0 | ||
|
|
66b9a76c7e | ||
|
|
bbc43e71ee | ||
|
|
ba20a67873 | ||
|
|
048fa5bd77 | ||
|
|
3bc2a5cf2f | ||
|
|
41dba2db86 | ||
|
|
e85a9f8609 | ||
|
|
b84dd8ec83 | ||
|
|
01fd8e685b | ||
|
|
1a6595aa17 | ||
|
|
9373f429d0 | ||
|
|
b3442a7d39 | ||
|
|
ed314caf7d | ||
|
|
1399f3dd12 | ||
|
|
7c99f8ad11 | ||
|
|
67159c12c5 | ||
|
|
0f1787ea0d | ||
|
|
6cd4f0c07e | ||
|
|
d143019dbb | ||
|
|
a3b9a5aa5f | ||
|
|
9b624fd1d6 | ||
|
|
8236563d6b | ||
|
|
5f9f6ea2e1 | ||
|
|
738fc579f0 | ||
|
|
0316fde06b | ||
|
|
bcde2f4dce | ||
|
|
48ae6f38e1 | ||
|
|
16eda4c5c9 | ||
|
|
b4101c8b65 | ||
|
|
d967507dcb | ||
|
|
d1b5bc1e82 | ||
|
|
6c54b0ba3b | ||
|
|
bdbc7b337f | ||
|
|
ff449b197f | ||
|
|
a0c29d8f99 | ||
|
|
58fbf5e66f | ||
|
|
ccbe48d779 | ||
|
|
64e67f754d | ||
|
|
6810972762 | ||
|
|
e160a3eec1 | ||
|
|
f16aae74dc | ||
|
|
bc77cc2c5c | ||
|
|
a4b07a36ed | ||
|
|
1894bef48a | ||
|
|
2ed9aa13f3 | ||
|
|
52e422da61 | ||
|
|
8b0016d71b | ||
|
|
df761e01fa | ||
|
|
07962e2840 | ||
|
|
7fe7677cde | ||
|
|
c4419e268f | ||
|
|
cf1ad65cd2 | ||
|
|
193ed689fb | ||
|
|
f2f54a711d | ||
|
|
0092a54e3b | ||
|
|
1ffa468240 | ||
|
|
ae0ed7fd05 | ||
|
|
b0e62e37ae | ||
|
|
3544d6398a | ||
|
|
5083e92772 | ||
|
|
a37af7a226 | ||
|
|
85711f1d54 | ||
|
|
050d0d046a | ||
|
|
925ef8f4f0 | ||
|
|
ad06bec6b6 | ||
|
|
433f2a043e | ||
|
|
394fc9c109 | ||
|
|
21979cf68a | ||
|
|
0177f732a2 | ||
|
|
a3cf5dcded | ||
|
|
8bc89b6e73 | ||
|
|
2e7e26fbb4 | ||
|
|
9131cdf6b9 | ||
|
|
fbf2646426 | ||
|
|
edf6757a75 | ||
|
|
8cb75be0db | ||
|
|
b09a18972d | ||
|
|
8a356baf3e | ||
|
|
e1c4659752 | ||
|
|
72c9884dfc | ||
|
|
7afdb01f00 | ||
|
|
1d542a5113 | ||
|
|
199428804f | ||
|
|
6854827f1a | ||
|
|
5452fd2f5a | ||
|
|
701e00d865 | ||
|
|
4e36bd2ce1 | ||
|
|
124ea898d5 | ||
|
|
07b69fd7fc | ||
|
|
952ff4184e | ||
|
|
5c449f844e | ||
|
|
16e09bfd77 | ||
|
|
9e7bce6a94 | ||
|
|
710ac5344d | ||
|
|
36aeeb99d9 | ||
|
|
713ce06e40 | ||
|
|
fcbd2b5228 | ||
|
|
14b4afeec9 | ||
|
|
3520961eae | ||
|
|
0961cdab31 | ||
|
|
a987649b1a | ||
|
|
9afaf26d66 | ||
|
|
a07a6d4aa4 | ||
|
|
25ed19cb35 | ||
|
|
1f862dbadb | ||
|
|
3ef92341fd | ||
|
|
225b6f4dc9 | ||
|
|
094520ab20 | ||
|
|
90dc93b81c | ||
|
|
323a26030b | ||
|
|
653d2aacbb | ||
|
|
f6b05ea3fb | ||
|
|
3041041a62 | ||
|
|
691b09fd72 | ||
|
|
f30a369d35 | ||
|
|
487ba400fc | ||
|
|
2e0cd9f196 | ||
|
|
59c961425e | ||
|
|
570d7e494e | ||
|
|
1f1fd9e034 | ||
|
|
35bb9307dc | ||
|
|
47679629f4 | ||
|
|
06f4b371ee | ||
|
|
c3040104ff | ||
|
|
455abea320 | ||
|
|
cc643ce932 | ||
|
|
6ef6459630 | ||
|
|
827e14eafe | ||
|
|
8fac9233de | ||
|
|
7385722441 | ||
|
|
b73141a153 | ||
|
|
8d6b32645c | ||
|
|
a592d6c40d | ||
|
|
fb151463eb | ||
|
|
586f4e3831 | ||
|
|
2986afc05e | ||
|
|
a8e3ddf382 | ||
|
|
de7d367820 |
@@ -15,11 +15,19 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AWSProjectWithRepository < ActionWebService::Struct
|
||||
member :id, :int
|
||||
member :identifier, :string
|
||||
member :name, :string
|
||||
member :is_public, :bool
|
||||
member :repository, Repository
|
||||
end
|
||||
|
||||
class SysApi < ActionWebService::API::Base
|
||||
api_method :projects,
|
||||
api_method :projects_with_repository_enabled,
|
||||
:expects => [],
|
||||
:returns => [[Project]]
|
||||
:returns => [[AWSProjectWithRepository]]
|
||||
api_method :repository_created,
|
||||
:expects => [:string, :string],
|
||||
:expects => [:string, :string, :string],
|
||||
:returns => [:int]
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -24,13 +24,17 @@ class AccountController < ApplicationController
|
||||
|
||||
# Show user's account
|
||||
def show
|
||||
@user = User.find_active(params[:id])
|
||||
@user = User.active.find(params[:id])
|
||||
@custom_values = @user.custom_values
|
||||
|
||||
# show only public projects and private projects that the logged in user is also a member of
|
||||
@memberships = @user.memberships.select do |membership|
|
||||
membership.project.is_public? || (User.current.member_of?(membership.project))
|
||||
end
|
||||
|
||||
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
|
||||
@events_by_day = events.group_by(&:event_date)
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
@@ -29,22 +29,30 @@ class AdminController < ApplicationController
|
||||
sort_init 'name', 'asc'
|
||||
sort_update
|
||||
|
||||
@status = params[:status] ? params[:status].to_i : 0
|
||||
conditions = nil
|
||||
conditions = ["status=?", @status] unless @status == 0
|
||||
@status = params[:status] ? params[:status].to_i : 1
|
||||
c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
|
||||
|
||||
@project_count = Project.count(:conditions => conditions)
|
||||
unless params[:name].blank?
|
||||
name = "%#{params[:name].strip.downcase}%"
|
||||
c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name]
|
||||
end
|
||||
|
||||
@project_count = Project.count(:conditions => c.conditions)
|
||||
@project_pages = Paginator.new self, @project_count,
|
||||
per_page_option,
|
||||
params['page']
|
||||
@projects = Project.find :all, :order => sort_clause,
|
||||
:conditions => conditions,
|
||||
:conditions => c.conditions,
|
||||
:limit => @project_pages.items_per_page,
|
||||
:offset => @project_pages.current.offset
|
||||
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def plugins
|
||||
@plugins = Redmine::Plugin.all
|
||||
end
|
||||
|
||||
# Loads the default configuration
|
||||
# (roles, trackers, statuses, workflow, enumerations)
|
||||
def default_configuration
|
||||
@@ -80,6 +88,5 @@ class AdminController < ApplicationController
|
||||
:file_repository_writable => File.writable?(Attachment.storage_path),
|
||||
:rmagick_available => Object.const_defined?(:Magick)
|
||||
}
|
||||
@plugins = Redmine::Plugin.registered_plugins
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
layout 'base'
|
||||
@@ -45,7 +46,7 @@ class ApplicationController < ActionController::Base
|
||||
def find_current_user
|
||||
if session[:user_id]
|
||||
# existing session
|
||||
(User.find_active(session[:user_id]) rescue nil)
|
||||
(User.active.find(session[:user_id]) rescue nil)
|
||||
elsif cookies[:autologin] && Setting.autologin?
|
||||
# auto-login feature
|
||||
User.find_by_autologin_key(cookies[:autologin])
|
||||
@@ -81,7 +82,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def require_login
|
||||
if !User.current.logged?
|
||||
redirect_to :controller => "account", :action => "login", :back_url => request.request_uri
|
||||
redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
|
||||
return false
|
||||
end
|
||||
true
|
||||
@@ -123,11 +124,11 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def redirect_back_or_default(default)
|
||||
back_url = params[:back_url]
|
||||
back_url = CGI.unescape(params[:back_url].to_s)
|
||||
if !back_url.blank?
|
||||
uri = URI.parse(back_url)
|
||||
# do not redirect user to another host
|
||||
if uri.relative? || (uri.host == request.host)
|
||||
# do not redirect user to another host or to the login or register page
|
||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
||||
redirect_to(back_url) and return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -21,8 +21,8 @@ class IssuesController < ApplicationController
|
||||
before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment]
|
||||
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
|
||||
before_filter :find_project, :only => [:new, :update_form, :preview]
|
||||
before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
|
||||
before_filter :find_optional_project, :only => [:index, :changes]
|
||||
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu]
|
||||
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
||||
accept_key_auth :index, :changes
|
||||
|
||||
helper :journals
|
||||
@@ -176,6 +176,9 @@ class IssuesController < ApplicationController
|
||||
@time_entry.attributes = params[:time_entry]
|
||||
attachments = attach_files(@issue, params[:attachments])
|
||||
attachments.each {|a| journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)}
|
||||
|
||||
call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal})
|
||||
|
||||
if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.save
|
||||
# Log spend time
|
||||
if current_role.allowed_to?(:log_time)
|
||||
@@ -253,7 +256,7 @@ class IssuesController < ApplicationController
|
||||
end
|
||||
# Find potential statuses the user could be allowed to switch issues to
|
||||
@available_statuses = Workflow.find(:all, :include => :new_status,
|
||||
:conditions => {:role_id => current_role.id}).collect(&:new_status).compact.uniq
|
||||
:conditions => {:role_id => current_role.id}).collect(&:new_status).compact.uniq.sort
|
||||
end
|
||||
|
||||
def move
|
||||
@@ -322,6 +325,64 @@ class IssuesController < ApplicationController
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
|
||||
def gantt
|
||||
@gantt = Redmine::Helpers::Gantt.new(params)
|
||||
retrieve_query
|
||||
if @query.valid?
|
||||
events = []
|
||||
# Issues that have start and due dates
|
||||
events += Issue.find(:all,
|
||||
:order => "start_date, due_date",
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project],
|
||||
:conditions => ["(#{@query.statement}) AND (((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
|
||||
)
|
||||
# Issues that don't have a due date but that are assigned to a version with a date
|
||||
events += Issue.find(:all,
|
||||
:order => "start_date, effective_date",
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version],
|
||||
:conditions => ["(#{@query.statement}) AND (((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
|
||||
)
|
||||
# Versions
|
||||
events += Version.find(:all, :include => :project,
|
||||
:conditions => ["(#{@query.project_statement}) AND effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
|
||||
|
||||
@gantt.events = events
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image')
|
||||
format.pdf { send_data(render(:template => "issues/gantt.rfpdf", :layout => false), :type => 'application/pdf', :filename => "#{@project.nil? ? '' : "#{@project.identifier}-" }gantt.pdf") }
|
||||
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
|
||||
|
||||
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
|
||||
retrieve_query
|
||||
if @query.valid?
|
||||
events = []
|
||||
events += Issue.find(:all,
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project],
|
||||
:conditions => ["(#{@query.statement}) AND ((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
|
||||
)
|
||||
events += Version.find(:all, :include => :project,
|
||||
:conditions => ["(#{@query.project_statement}) AND effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
|
||||
|
||||
@calendar.events = events
|
||||
end
|
||||
|
||||
render :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def context_menu
|
||||
@issues = Issue.find_all_by_id(params[:ids], :include => :project)
|
||||
if (@issues.size == 1)
|
||||
@@ -392,9 +453,9 @@ private
|
||||
end
|
||||
|
||||
def find_optional_project
|
||||
return true unless params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
authorize
|
||||
@project = Project.find(params[:project_id]) unless params[:project_id].blank?
|
||||
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
||||
allowed ? true : deny_access
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
@@ -19,18 +19,18 @@ class MessagesController < ApplicationController
|
||||
menu_item :boards
|
||||
before_filter :find_board, :only => [:new, :preview]
|
||||
before_filter :find_message, :except => [:new, :preview]
|
||||
before_filter :authorize, :except => :preview
|
||||
before_filter :authorize, :except => [:preview, :edit, :destroy]
|
||||
|
||||
verify :method => :post, :only => [ :reply, :destroy ], :redirect_to => { :action => :show }
|
||||
verify :xhr => true, :only => :quote
|
||||
|
||||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
|
||||
# Show a topic and its replies
|
||||
def show
|
||||
@replies = @topic.children
|
||||
@replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}])
|
||||
@replies.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
render :action => "show", :layout => false if request.xhr?
|
||||
@@ -65,7 +65,8 @@ class MessagesController < ApplicationController
|
||||
|
||||
# Edit a message
|
||||
def edit
|
||||
if params[:message] && User.current.allowed_to?(:edit_messages, @project)
|
||||
render_403 and return false unless @message.editable_by?(User.current)
|
||||
if params[:message]
|
||||
@message.locked = params[:message]['locked']
|
||||
@message.sticky = params[:message]['sticky']
|
||||
end
|
||||
@@ -78,6 +79,7 @@ class MessagesController < ApplicationController
|
||||
|
||||
# Delete a messages
|
||||
def destroy
|
||||
render_403 and return false unless @message.destroyable_by?(User.current)
|
||||
@message.destroy
|
||||
redirect_to @message.parent.nil? ?
|
||||
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
||||
|
||||
@@ -27,7 +27,7 @@ class ProjectsController < ApplicationController
|
||||
before_filter :find_optional_project, :only => :activity
|
||||
before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ]
|
||||
before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ]
|
||||
accept_key_auth :activity, :calendar
|
||||
accept_key_auth :activity
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
@@ -221,16 +221,19 @@ class ProjectsController < ApplicationController
|
||||
@days = Setting.activity_days_default.to_i
|
||||
|
||||
if params[:from]
|
||||
begin; @date_to = params[:from].to_date; rescue; end
|
||||
begin; @date_to = params[:from].to_date + 1; rescue; end
|
||||
end
|
||||
|
||||
@date_to ||= Date.today + 1
|
||||
@date_from = @date_to - @days
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects)
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| !params["show_#{t}"].nil?}
|
||||
@activity.default_scope! if @activity.scope.empty?
|
||||
@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
|
||||
|
||||
events = @activity.events(@date_from, @date_to)
|
||||
|
||||
@@ -240,101 +243,18 @@ class ProjectsController < ApplicationController
|
||||
render :layout => false if request.xhr?
|
||||
}
|
||||
format.atom {
|
||||
title = (@activity.scope.size == 1) ? l("label_#{@activity.scope.first.singularize}_plural") : l(:label_activity)
|
||||
title = l(:label_activity)
|
||||
if @author
|
||||
title = @author.name
|
||||
elsif @activity.scope.size == 1
|
||||
title = l("label_#{@activity.scope.first.singularize}_plural")
|
||||
end
|
||||
render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def calendar
|
||||
@trackers = @project.rolled_up_trackers
|
||||
retrieve_selected_tracker_ids(@trackers)
|
||||
|
||||
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
|
||||
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
events = []
|
||||
@project.issues_with_subprojects(@with_subprojects) do
|
||||
events += Issue.find(:all,
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project],
|
||||
:conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?)) AND #{Issue.table_name}.tracker_id IN (#{@selected_tracker_ids.join(',')})", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
|
||||
) unless @selected_tracker_ids.empty?
|
||||
events += Version.find(:all, :include => :project,
|
||||
:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt])
|
||||
end
|
||||
@calendar.events = events
|
||||
|
||||
render :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def gantt
|
||||
@trackers = @project.rolled_up_trackers
|
||||
retrieve_selected_tracker_ids(@trackers)
|
||||
|
||||
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.month
|
||||
@year_from ||= Date.today.year
|
||||
end
|
||||
|
||||
zoom = (params[:zoom] || User.current.pref[:gantt_zoom]).to_i
|
||||
@zoom = (zoom > 0 && zoom < 5) ? zoom : 2
|
||||
months = (params[:months] || User.current.pref[:gantt_months]).to_i
|
||||
@months = (months > 0 && months < 25) ? months : 6
|
||||
|
||||
# Save gantt paramters as user preference (zoom and months count)
|
||||
if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months]))
|
||||
User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months
|
||||
User.current.preference.save
|
||||
end
|
||||
|
||||
@date_from = Date.civil(@year_from, @month_from, 1)
|
||||
@date_to = (@date_from >> @months) - 1
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
|
||||
@events = []
|
||||
@project.issues_with_subprojects(@with_subprojects) do
|
||||
# Issues that have start and due dates
|
||||
@events += Issue.find(:all,
|
||||
:order => "start_date, due_date",
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project],
|
||||
:conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]
|
||||
) unless @selected_tracker_ids.empty?
|
||||
# Issues that don't have a due date but that are assigned to a version with a date
|
||||
@events += Issue.find(:all,
|
||||
:order => "start_date, effective_date",
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version],
|
||||
:conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]
|
||||
) unless @selected_tracker_ids.empty?
|
||||
@events += Version.find(:all, :include => :project,
|
||||
:conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to])
|
||||
end
|
||||
@events.sort! {|x,y| x.start_date <=> y.start_date }
|
||||
|
||||
if params[:format]=='pdf'
|
||||
@options_for_rfpdf ||= {}
|
||||
@options_for_rfpdf[:file_name] = "#{@project.identifier}-gantt.pdf"
|
||||
render :template => "projects/gantt.rfpdf", :layout => false
|
||||
elsif params[:format]=='png' && respond_to?('gantt_image')
|
||||
image = gantt_image(@events, @date_from, @months, @zoom)
|
||||
image.format = 'PNG'
|
||||
send_data(image.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png")
|
||||
else
|
||||
render :template => "projects/gantt.rhtml"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -44,6 +44,20 @@ class RepositoriesController < ApplicationController
|
||||
render(:update) {|page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'}
|
||||
end
|
||||
|
||||
def committers
|
||||
@committers = @repository.committers
|
||||
@users = @project.users
|
||||
additional_user_ids = @committers.collect(&:last).collect(&:to_i) - @users.collect(&:id)
|
||||
@users += User.find_all_by_id(additional_user_ids) unless additional_user_ids.empty?
|
||||
@users.compact!
|
||||
@users.sort!
|
||||
if request.post?
|
||||
@repository.committer_ids = params[:committers]
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'committers', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@repository.destroy
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
|
||||
@@ -84,7 +98,8 @@ class RepositoriesController < ApplicationController
|
||||
params['page']
|
||||
@changesets = @repository.changesets.find(:all,
|
||||
:limit => @changeset_pages.items_per_page,
|
||||
:offset => @changeset_pages.current.offset)
|
||||
:offset => @changeset_pages.current.offset,
|
||||
:include => :user)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false if request.xhr? }
|
||||
@@ -118,11 +133,6 @@ class RepositoriesController < ApplicationController
|
||||
def revision
|
||||
@changeset = @repository.changesets.find_by_revision(@rev)
|
||||
raise ChangesetNotFound unless @changeset
|
||||
@changes_count = @changeset.changes.size
|
||||
@changes_pages = Paginator.new self, @changes_count, 150, params['page']
|
||||
@changes = @changeset.changes.find(:all,
|
||||
:limit => @changes_pages.items_per_page,
|
||||
:offset => @changes_pages.current.offset)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
||||
@@ -79,27 +79,6 @@ class RolesController < ApplicationController
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
|
||||
def workflow
|
||||
@role = Role.find_by_id(params[:role_id])
|
||||
@tracker = Tracker.find_by_id(params[:tracker_id])
|
||||
|
||||
if request.post?
|
||||
Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id])
|
||||
(params[:issue_status] || []).each { |old, news|
|
||||
news.each { |new|
|
||||
@role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new)
|
||||
}
|
||||
}
|
||||
if @role.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'workflow', :role_id => @role, :tracker_id => @tracker
|
||||
end
|
||||
end
|
||||
@roles = Role.find(:all, :order => 'builtin, position')
|
||||
@trackers = Tracker.find(:all, :order => 'position')
|
||||
@statuses = IssueStatus.find(:all, :order => 'position')
|
||||
end
|
||||
|
||||
def report
|
||||
@roles = Role.find(:all, :order => 'builtin, position')
|
||||
@permissions = Redmine::AccessControl.permissions.select { |p| !p.public? }
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
# 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.
|
||||
|
||||
class SettingsController < ApplicationController
|
||||
before_filter :require_admin
|
||||
|
||||
|
||||
def index
|
||||
edit
|
||||
render :action => 'edit'
|
||||
@@ -39,17 +39,21 @@ class SettingsController < ApplicationController
|
||||
@options = {}
|
||||
@options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
|
||||
@deliveries = ActionMailer::Base.perform_deliveries
|
||||
|
||||
@guessed_host_and_path = request.host_with_port
|
||||
@guessed_host_and_path << ('/'+ request.relative_url_root.gsub(%r{^\/}, '')) unless request.relative_url_root.blank?
|
||||
end
|
||||
|
||||
|
||||
def plugin
|
||||
plugin_id = params[:id].to_sym
|
||||
@plugin = Redmine::Plugin.registered_plugins[plugin_id]
|
||||
@plugin = Redmine::Plugin.find(params[:id])
|
||||
if request.post?
|
||||
Setting["plugin_#{plugin_id}"] = params[:settings]
|
||||
Setting["plugin_#{@plugin.id}"] = params[:settings]
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'plugin', :id => params[:id]
|
||||
redirect_to :action => 'plugin', :id => @plugin.id
|
||||
end
|
||||
@partial = @plugin.settings[:partial]
|
||||
@settings = Setting["plugin_#{plugin_id}"]
|
||||
@settings = Setting["plugin_#{@plugin.id}"]
|
||||
rescue Redmine::PluginNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,18 +23,17 @@ class SysController < ActionController::Base
|
||||
before_invocation :check_enabled
|
||||
|
||||
# Returns the projects list, with their repositories
|
||||
def projects
|
||||
Project.find(:all, :include => :repository)
|
||||
def projects_with_repository_enabled
|
||||
Project.has_module(:repository).find(:all, :include => :repository, :order => 'identifier')
|
||||
end
|
||||
|
||||
# Registers a repository for the given project identifier
|
||||
# (Subversion specific)
|
||||
def repository_created(identifier, url)
|
||||
def repository_created(identifier, vendor, url)
|
||||
project = Project.find_by_identifier(identifier)
|
||||
# Do not create the repository if the project has already one
|
||||
return 0 unless project && project.repository.nil?
|
||||
logger.debug "Repository for #{project.name} was created"
|
||||
repository = Repository.factory('Subversion', :project => project, :url => url)
|
||||
repository = Repository.factory(vendor, :project => project, :url => url)
|
||||
repository.save
|
||||
repository.id || 0
|
||||
end
|
||||
|
||||
@@ -194,7 +194,7 @@ class TimelogController < ApplicationController
|
||||
@time_entry.attributes = params[:time_entry]
|
||||
if request.post? and @time_entry.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to(params[:back_url].blank? ? {:action => 'details', :project_id => @time_entry.project} : params[:back_url])
|
||||
redirect_back_or_default :action => 'details', :project_id => @time_entry.project
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,15 +33,19 @@ class UsersController < ApplicationController
|
||||
sort_update
|
||||
|
||||
@status = params[:status] ? params[:status].to_i : 1
|
||||
conditions = "status <> 0"
|
||||
conditions = ["status=?", @status] unless @status == 0
|
||||
c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
|
||||
|
||||
unless params[:name].blank?
|
||||
name = "%#{params[:name].strip.downcase}%"
|
||||
c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ?", name, name, name]
|
||||
end
|
||||
|
||||
@user_count = User.count(:conditions => conditions)
|
||||
@user_count = User.count(:conditions => c.conditions)
|
||||
@user_pages = Paginator.new self, @user_count,
|
||||
per_page_option,
|
||||
params['page']
|
||||
@users = User.find :all,:order => sort_clause,
|
||||
:conditions => conditions,
|
||||
:conditions => c.conditions,
|
||||
:limit => @user_pages.items_per_page,
|
||||
:offset => @user_pages.current.offset
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class VersionsController < ApplicationController
|
||||
@version.destroy
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
|
||||
rescue
|
||||
flash[:error] = "Unable to delete version"
|
||||
flash[:error] = l(:notice_unable_delete_version)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
|
||||
end
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@ class WikiController < ApplicationController
|
||||
end
|
||||
return
|
||||
end
|
||||
if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project)
|
||||
# Redirects user to the current version if he's not allowed to view previous versions
|
||||
redirect_to :version => nil
|
||||
return
|
||||
end
|
||||
@content = @page.content_for_version(params[:version])
|
||||
if params[:export] == 'html'
|
||||
export = render_to_string :action => 'export', :layout => false
|
||||
@@ -58,10 +63,13 @@ class WikiController < ApplicationController
|
||||
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
||||
|
||||
@content = @page.content_for_version(params[:version])
|
||||
@content.text = "h1. #{@page.pretty_title}" if @content.text.blank?
|
||||
@content.text = initial_page_content(@page) if @content.text.blank?
|
||||
# don't keep previous comment
|
||||
@content.comments = nil
|
||||
if request.post?
|
||||
if request.get?
|
||||
# To prevent StaleObjectError exception when reverting to a previous version
|
||||
@content.version = @page.content.version
|
||||
else
|
||||
if !@page.new_record? && @content.text == params[:content][:text]
|
||||
# don't save if text wasn't changed
|
||||
redirect_to :action => 'index', :id => @project, :page => @page.title
|
||||
@@ -200,4 +208,11 @@ private
|
||||
def editable?(page = @page)
|
||||
page.editable_by?(User.current)
|
||||
end
|
||||
|
||||
# Returns the default content of a new wiki page
|
||||
def initial_page_content(page)
|
||||
helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
|
||||
extend helper unless self.instance_of?(helper)
|
||||
helper.instance_method(:initial_page_content).bind(self).call(page)
|
||||
end
|
||||
end
|
||||
|
||||
45
app/controllers/workflows_controller.rb
Normal file
45
app/controllers/workflows_controller.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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.
|
||||
|
||||
class WorkflowsController < ApplicationController
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
@workflow_counts = Workflow.count_by_tracker_and_role
|
||||
end
|
||||
|
||||
def edit
|
||||
@role = Role.find_by_id(params[:role_id])
|
||||
@tracker = Tracker.find_by_id(params[:tracker_id])
|
||||
|
||||
if request.post?
|
||||
Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id])
|
||||
(params[:issue_status] || []).each { |old, news|
|
||||
news.each { |new|
|
||||
@role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new)
|
||||
}
|
||||
}
|
||||
if @role.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker
|
||||
end
|
||||
end
|
||||
@roles = Role.find(:all, :order => 'builtin, position')
|
||||
@trackers = Tracker.find(:all, :order => 'position')
|
||||
@statuses = IssueStatus.find(:all, :order => 'position')
|
||||
end
|
||||
end
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
module AdminHelper
|
||||
def project_status_options_for_select(selected)
|
||||
options_for_select([[l(:label_all), "*"],
|
||||
options_for_select([[l(:label_all), ''],
|
||||
[l(:status_active), 1]], selected)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,26 +5,31 @@
|
||||
# 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 'coderay'
|
||||
require 'coderay/helpers/file_type'
|
||||
require 'forwardable'
|
||||
|
||||
module ApplicationHelper
|
||||
include Redmine::WikiFormatting::Macros::Definitions
|
||||
include GravatarHelper::PublicMethods
|
||||
|
||||
extend Forwardable
|
||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||
|
||||
def current_role
|
||||
@current_role ||= User.current.role_for_project(@project)
|
||||
end
|
||||
|
||||
|
||||
# Return true if user is authorized for controller/action, otherwise false
|
||||
def authorize_for(controller, action)
|
||||
User.current.allowed_to?({:controller => controller, :action => action}, @project)
|
||||
@@ -34,7 +39,7 @@ module ApplicationHelper
|
||||
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] || params[:controller], options[:action])
|
||||
end
|
||||
|
||||
|
||||
# Display a link to remote if user is authorized
|
||||
def link_to_remote_if_authorized(name, options = {}, html_options = nil)
|
||||
url = options[:url] || {}
|
||||
@@ -43,16 +48,16 @@ module ApplicationHelper
|
||||
|
||||
# Display a link to user's account page
|
||||
def link_to_user(user)
|
||||
user ? link_to(user, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'
|
||||
(user && !user.anonymous?) ? link_to(user, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'
|
||||
end
|
||||
|
||||
|
||||
def link_to_issue(issue, options={})
|
||||
options[:class] ||= ''
|
||||
options[:class] << ' issue'
|
||||
options[:class] << ' closed' if issue.closed?
|
||||
link_to "#{issue.tracker.name} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, options
|
||||
end
|
||||
|
||||
|
||||
# Generates a link to an attachment.
|
||||
# Options:
|
||||
# * :text - Link text (default to attachment filename)
|
||||
@@ -60,70 +65,115 @@ module ApplicationHelper
|
||||
def link_to_attachment(attachment, options={})
|
||||
text = options.delete(:text) || attachment.filename
|
||||
action = options.delete(:download) ? 'download' : 'show'
|
||||
|
||||
|
||||
link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options)
|
||||
end
|
||||
|
||||
|
||||
def toggle_link(name, id, options={})
|
||||
onclick = "Element.toggle('#{id}'); "
|
||||
onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ")
|
||||
onclick << "return false;"
|
||||
link_to(name, "#", :onclick => onclick)
|
||||
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};"
|
||||
tag(:input, html_options.merge({
|
||||
:type => "image", :src => image_path(name),
|
||||
:onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};"
|
||||
}))
|
||||
end
|
||||
|
||||
|
||||
def prompt_to_remote(name, text, param, url, html_options = {})
|
||||
html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;"
|
||||
link_to name, {}, html_options
|
||||
end
|
||||
|
||||
|
||||
def format_date(date)
|
||||
return nil unless date
|
||||
# "Setting.date_format.size < 2" is a temporary fix (content of date_format setting changed)
|
||||
@date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format)
|
||||
date.strftime(@date_format)
|
||||
end
|
||||
|
||||
|
||||
def format_time(time, include_date = true)
|
||||
return nil unless time
|
||||
time = time.to_time if time.is_a?(String)
|
||||
zone = User.current.time_zone
|
||||
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.utc_to_local : time)
|
||||
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
|
||||
@date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format)
|
||||
@time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format)
|
||||
include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
|
||||
end
|
||||
|
||||
def format_activity_title(text)
|
||||
h(truncate_single_line(text, 100))
|
||||
end
|
||||
|
||||
def format_activity_day(date)
|
||||
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||||
end
|
||||
|
||||
def format_activity_description(text)
|
||||
h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
|
||||
end
|
||||
|
||||
def distance_of_date_in_words(from_date, to_date = 0)
|
||||
from_date = from_date.to_date if from_date.respond_to?(:to_date)
|
||||
to_date = to_date.to_date if to_date.respond_to?(:to_date)
|
||||
distance_in_days = (to_date - from_date).abs
|
||||
lwr(:actionview_datehelper_time_in_words_day, distance_in_days)
|
||||
end
|
||||
|
||||
def due_date_distance_in_words(date)
|
||||
if date
|
||||
l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date))
|
||||
end
|
||||
end
|
||||
|
||||
def render_page_hierarchy(pages, node=nil)
|
||||
content = ''
|
||||
if pages[node]
|
||||
content << "<ul class=\"pages-hierarchy\">\n"
|
||||
pages[node].each do |page|
|
||||
content << "<li>"
|
||||
content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title},
|
||||
:title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
|
||||
content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id]
|
||||
content << "</li>\n"
|
||||
end
|
||||
content << "</ul>\n"
|
||||
end
|
||||
content
|
||||
end
|
||||
|
||||
# Truncates and returns the string as a single line
|
||||
def truncate_single_line(string, *args)
|
||||
truncate(string, *args).gsub(%r{[\r\n]+}m, ' ')
|
||||
end
|
||||
|
||||
|
||||
def html_hours(text)
|
||||
text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
|
||||
end
|
||||
|
||||
def authoring(created, author)
|
||||
time_tag = content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created))
|
||||
|
||||
def authoring(created, author, options={})
|
||||
time_tag = @project.nil? ? content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) :
|
||||
link_to(distance_of_time_in_words(Time.now, created),
|
||||
{:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date},
|
||||
:title => format_time(created))
|
||||
author_tag = (author.is_a?(User) && !author.anonymous?) ? link_to(h(author), :controller => 'account', :action => 'show', :id => author) : h(author || 'Anonymous')
|
||||
l(:label_added_time_by, author_tag, time_tag)
|
||||
l(options[:label] || :label_added_time_by, author_tag, time_tag)
|
||||
end
|
||||
|
||||
def l_or_humanize(s)
|
||||
l_has_string?("label_#{s}".to_sym) ? l("label_#{s}".to_sym) : s.to_s.humanize
|
||||
|
||||
def l_or_humanize(s, options={})
|
||||
k = "#{options[:prefix]}#{s}".to_sym
|
||||
l_has_string?(k) ? l(k) : s.to_s.humanize
|
||||
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
|
||||
@@ -132,7 +182,7 @@ module ApplicationHelper
|
||||
type = CodeRay::FileType[name]
|
||||
type ? CodeRay.scan(content, type).html : h(content)
|
||||
end
|
||||
|
||||
|
||||
def to_path_param(path)
|
||||
path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
|
||||
end
|
||||
@@ -142,51 +192,51 @@ module ApplicationHelper
|
||||
url_param = params.dup
|
||||
# don't reuse params if filters are present
|
||||
url_param.clear if url_param.has_key?(:set_filter)
|
||||
|
||||
html = ''
|
||||
html << link_to_remote(('« ' + l(:label_previous)),
|
||||
|
||||
html = ''
|
||||
html << link_to_remote(('« ' + l(:label_previous)),
|
||||
{:update => 'content',
|
||||
:url => url_param.merge(page_param => paginator.current.previous),
|
||||
:complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(:params => url_param.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous
|
||||
|
||||
|
||||
html << (pagination_links_each(paginator, options) do |n|
|
||||
link_to_remote(n.to_s,
|
||||
link_to_remote(n.to_s,
|
||||
{:url => {:params => url_param.merge(page_param => n)},
|
||||
:update => 'content',
|
||||
:complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(:params => url_param.merge(page_param => n))})
|
||||
end || '')
|
||||
|
||||
html << ' ' + link_to_remote((l(:label_next) + ' »'),
|
||||
|
||||
html << ' ' + link_to_remote((l(:label_next) + ' »'),
|
||||
{:update => 'content',
|
||||
:url => url_param.merge(page_param => paginator.current.next),
|
||||
:complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(:params => url_param.merge(page_param => paginator.current.next))}) if paginator.current.next
|
||||
|
||||
|
||||
unless count.nil?
|
||||
html << [" (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", per_page_links(paginator.items_per_page)].compact.join(' | ')
|
||||
end
|
||||
|
||||
html
|
||||
|
||||
html
|
||||
end
|
||||
|
||||
|
||||
def per_page_links(selected=nil)
|
||||
url_param = params.dup
|
||||
url_param.clear if url_param.has_key?(:set_filter)
|
||||
|
||||
|
||||
links = Setting.per_page_options_array.collect do |n|
|
||||
n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)},
|
||||
n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)},
|
||||
{:href => url_for(url_param.merge(:per_page => n))})
|
||||
end
|
||||
links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil
|
||||
end
|
||||
|
||||
|
||||
def breadcrumb(*args)
|
||||
elements = args.flatten
|
||||
elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil
|
||||
end
|
||||
|
||||
|
||||
def html_title(*args)
|
||||
if args.empty?
|
||||
title = []
|
||||
@@ -221,17 +271,18 @@ module ApplicationHelper
|
||||
raise ArgumentError, 'invalid arguments to textilizable'
|
||||
end
|
||||
return '' if text.blank?
|
||||
|
||||
|
||||
only_path = options.delete(:only_path) == false ? false : true
|
||||
|
||||
# when using an image link, try to use an attachment, if possible
|
||||
attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
|
||||
|
||||
|
||||
if attachments
|
||||
text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
|
||||
attachments = attachments.sort_by(&:created_on).reverse
|
||||
text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m|
|
||||
style = $1
|
||||
filename = $6
|
||||
rf = Regexp.new(filename, Regexp::IGNORECASE)
|
||||
rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE)
|
||||
# search for the picture in attachments
|
||||
if found = attachments.detect { |att| att.filename =~ rf }
|
||||
image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
|
||||
@@ -243,10 +294,8 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
text = (Setting.text_formatting == 'textile') ?
|
||||
Redmine::WikiFormatting.to_html(text) { |macro, args| exec_macro(macro, obj, args) } :
|
||||
simple_format(auto_link(h(text)))
|
||||
|
||||
text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text) { |macro, args| exec_macro(macro, obj, args) }
|
||||
|
||||
# different methods for formatting wiki links
|
||||
case options[:wiki_links]
|
||||
@@ -259,11 +308,11 @@ module ApplicationHelper
|
||||
else
|
||||
format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) }
|
||||
end
|
||||
|
||||
|
||||
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
|
||||
|
||||
|
||||
# Wiki links
|
||||
#
|
||||
#
|
||||
# Examples:
|
||||
# [[mypage]]
|
||||
# [[mypage|mytext]]
|
||||
@@ -281,7 +330,7 @@ module ApplicationHelper
|
||||
page = $2
|
||||
title ||= $1 if page.blank?
|
||||
end
|
||||
|
||||
|
||||
if link_project && link_project.wiki
|
||||
# extract anchor
|
||||
anchor = nil
|
||||
@@ -302,7 +351,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
# Redmine links
|
||||
#
|
||||
#
|
||||
# Examples:
|
||||
# Issues:
|
||||
# #52 -> Link to issue #52
|
||||
@@ -341,7 +390,7 @@ module ApplicationHelper
|
||||
oid = oid.to_i
|
||||
case prefix
|
||||
when nil
|
||||
if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current))
|
||||
if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current))
|
||||
link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid},
|
||||
:class => (issue.closed? ? 'issue closed' : 'issue'),
|
||||
:title => "#{truncate(issue.subject, 100)} (#{issue.status.name})")
|
||||
@@ -409,10 +458,10 @@ module ApplicationHelper
|
||||
end
|
||||
leading + (link || "#{prefix}#{sep}#{oid}")
|
||||
end
|
||||
|
||||
|
||||
text
|
||||
end
|
||||
|
||||
|
||||
# Same as Rails' simple_format helper without using paragraphs
|
||||
def simple_format_without_paragraph(text)
|
||||
text.to_s.
|
||||
@@ -420,7 +469,7 @@ module ApplicationHelper
|
||||
gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br
|
||||
gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
|
||||
end
|
||||
|
||||
|
||||
def error_messages_for(object_name, options = {})
|
||||
options = options.symbolize_keys
|
||||
object = instance_variable_get("@#{object_name}")
|
||||
@@ -438,14 +487,14 @@ module ApplicationHelper
|
||||
end
|
||||
# retrieve custom values error messages
|
||||
if object.errors[:custom_values]
|
||||
object.custom_values.each do |v|
|
||||
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
|
||||
end
|
||||
content_tag("div",
|
||||
content_tag(
|
||||
options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":"
|
||||
@@ -457,34 +506,34 @@ module ApplicationHelper
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def lang_options_for_select(blank=true)
|
||||
(blank ? [["(auto)", ""]] : []) +
|
||||
(blank ? [["(auto)", ""]] : []) +
|
||||
GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last }
|
||||
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][:class] = 'tabular' unless options[:html].has_key?(:class)
|
||||
form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
|
||||
end
|
||||
|
||||
|
||||
def back_url_hidden_field_tag
|
||||
back_url = params[:back_url] || request.env['HTTP_REFERER']
|
||||
hidden_field_tag('back_url', back_url) unless back_url.blank?
|
||||
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)")
|
||||
link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
|
||||
end
|
||||
|
||||
|
||||
def progress_bar(pcts, options={})
|
||||
pcts = [pcts, pcts] unless pcts.is_a?(Array)
|
||||
pcts[1] = pcts[1] - pcts[0]
|
||||
@@ -493,13 +542,13 @@ module ApplicationHelper
|
||||
legend = options[:legend] || ''
|
||||
content_tag('table',
|
||||
content_tag('tr',
|
||||
(pcts[0] > 0 ? content_tag('td', '', :width => "#{pcts[0].floor}%;", :class => 'closed') : '') +
|
||||
(pcts[1] > 0 ? content_tag('td', '', :width => "#{pcts[1].floor}%;", :class => 'done') : '') +
|
||||
(pcts[2] > 0 ? content_tag('td', '', :width => "#{pcts[2].floor}%;", :class => 'todo') : '')
|
||||
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0].floor}%;", :class => 'closed') : '') +
|
||||
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1].floor}%;", :class => 'done') : '') +
|
||||
(pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2].floor}%;", :class => 'todo') : '')
|
||||
), :class => 'progress', :style => "width: #{width};") +
|
||||
content_tag('p', legend, :class => 'pourcent')
|
||||
end
|
||||
|
||||
|
||||
def context_menu_link(name, url, options={})
|
||||
options[:class] ||= ''
|
||||
if options.delete(:selected)
|
||||
@@ -515,7 +564,7 @@ module ApplicationHelper
|
||||
end
|
||||
link_to name, url, options
|
||||
end
|
||||
|
||||
|
||||
def calendar_for(field_id)
|
||||
include_calendar_headers_tags
|
||||
image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
|
||||
@@ -533,26 +582,36 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def wikitoolbar_for(field_id)
|
||||
return '' unless Setting.text_formatting == 'textile'
|
||||
|
||||
help_link = l(:setting_text_formatting) + ': ' +
|
||||
link_to(l(:label_help), compute_public_path('wiki_syntax', 'help', 'html'),
|
||||
:onclick => "window.open(\"#{ compute_public_path('wiki_syntax', 'help', 'html') }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")
|
||||
|
||||
javascript_include_tag('jstoolbar/jstoolbar') +
|
||||
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language}") +
|
||||
javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.setHelpLink('#{help_link}'); toolbar.draw();")
|
||||
end
|
||||
|
||||
def content_for(name, content = nil, &block)
|
||||
@has_content ||= {}
|
||||
@has_content[name] = true
|
||||
super(name, content, &block)
|
||||
end
|
||||
|
||||
|
||||
def has_content?(name)
|
||||
(@has_content && @has_content[name]) || false
|
||||
end
|
||||
|
||||
# Returns the avatar image tag for the given +user+ if avatars are enabled
|
||||
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
|
||||
def avatar(user, options = { })
|
||||
if Setting.gravatar_enabled?
|
||||
email = nil
|
||||
if user.respond_to?(:mail)
|
||||
email = user.mail
|
||||
elsif user.to_s =~ %r{<(.+?)>}
|
||||
email = $1
|
||||
end
|
||||
return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wiki_helper
|
||||
helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
|
||||
extend helper
|
||||
return self
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ module IfpdfHelper
|
||||
@font_for_content = 'Arial'
|
||||
@font_for_footer = 'Helvetica'
|
||||
end
|
||||
SetCreator("redMine #{Redmine::VERSION}")
|
||||
SetCreator(Redmine::Info.app_name)
|
||||
SetFont(@font_for_content)
|
||||
end
|
||||
|
||||
|
||||
@@ -21,18 +21,6 @@ module ProjectsHelper
|
||||
link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
|
||||
end
|
||||
|
||||
def format_activity_title(text)
|
||||
h(truncate_single_line(text, 100))
|
||||
end
|
||||
|
||||
def format_activity_day(date)
|
||||
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||||
end
|
||||
|
||||
def format_activity_description(text)
|
||||
h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
|
||||
end
|
||||
|
||||
def project_settings_tabs
|
||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
|
||||
{:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
|
||||
@@ -45,154 +33,4 @@ module ProjectsHelper
|
||||
]
|
||||
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
||||
end
|
||||
|
||||
# Generates a gantt image
|
||||
# Only defined if RMagick is avalaible
|
||||
def gantt_image(events, date_from, months, zoom)
|
||||
date_to = (date_from >> months)-1
|
||||
show_weeks = zoom > 1
|
||||
show_days = zoom > 2
|
||||
|
||||
subject_width = 320
|
||||
header_heigth = 18
|
||||
# width of one day in pixels
|
||||
zoom = zoom*2
|
||||
g_width = (date_to - date_from + 1)*zoom
|
||||
g_height = 20 * events.length + 20
|
||||
headers_heigth = (show_weeks ? 2*header_heigth : header_heigth)
|
||||
height = g_height + headers_heigth
|
||||
|
||||
imgl = Magick::ImageList.new
|
||||
imgl.new_image(subject_width+g_width+1, height)
|
||||
gc = Magick::Draw.new
|
||||
|
||||
# Subjects
|
||||
top = headers_heigth + 20
|
||||
gc.fill('black')
|
||||
gc.stroke('transparent')
|
||||
gc.stroke_width(1)
|
||||
events.each do |i|
|
||||
gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name))
|
||||
top = top + 20
|
||||
end
|
||||
|
||||
# Months headers
|
||||
month_f = date_from
|
||||
left = subject_width
|
||||
months.times do
|
||||
width = ((month_f >> 1) - month_f) * zoom
|
||||
gc.fill('white')
|
||||
gc.stroke('grey')
|
||||
gc.stroke_width(1)
|
||||
gc.rectangle(left, 0, left + width, height)
|
||||
gc.fill('black')
|
||||
gc.stroke('transparent')
|
||||
gc.stroke_width(1)
|
||||
gc.text(left.round + 8, 14, "#{month_f.year}-#{month_f.month}")
|
||||
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
|
||||
gc.fill('white')
|
||||
gc.stroke('grey')
|
||||
gc.stroke_width(1)
|
||||
gc.rectangle(left, header_heigth, left + width, 2*header_heigth + g_height-1)
|
||||
left = left + width
|
||||
end
|
||||
while week_f <= date_to
|
||||
width = (week_f + 6 <= date_to) ? 7 * zoom : (date_to - week_f + 1) * zoom
|
||||
gc.fill('white')
|
||||
gc.stroke('grey')
|
||||
gc.stroke_width(1)
|
||||
gc.rectangle(left.round, header_heigth, left.round + width, 2*header_heigth + g_height-1)
|
||||
gc.fill('black')
|
||||
gc.stroke('transparent')
|
||||
gc.stroke_width(1)
|
||||
gc.text(left.round + 2, header_heigth + 14, week_f.cweek.to_s)
|
||||
left = left + width
|
||||
week_f = week_f+7
|
||||
end
|
||||
end
|
||||
|
||||
# Days details (week-end in grey)
|
||||
if show_days
|
||||
left = subject_width
|
||||
height = g_height + header_heigth - 1
|
||||
wday = date_from.cwday
|
||||
(date_to - date_from + 1).to_i.times do
|
||||
width = zoom
|
||||
gc.fill(wday == 6 || wday == 7 ? '#eee' : 'white')
|
||||
gc.stroke('grey')
|
||||
gc.stroke_width(1)
|
||||
gc.rectangle(left, 2*header_heigth, left + width, 2*header_heigth + g_height-1)
|
||||
left = left + width
|
||||
wday = wday + 1
|
||||
wday = 1 if wday > 7
|
||||
end
|
||||
end
|
||||
|
||||
# border
|
||||
gc.fill('transparent')
|
||||
gc.stroke('grey')
|
||||
gc.stroke_width(1)
|
||||
gc.rectangle(0, 0, subject_width+g_width, headers_heigth)
|
||||
gc.stroke('black')
|
||||
gc.rectangle(0, 0, subject_width+g_width, g_height+ headers_heigth-1)
|
||||
|
||||
# content
|
||||
top = headers_heigth + 20
|
||||
gc.stroke('transparent')
|
||||
events.each do |i|
|
||||
if i.is_a?(Issue)
|
||||
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+1)*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 = subject_width + ((i_start_date - date_from)*zoom).floor
|
||||
i_width = ((i_end_date - i_start_date + 1)*zoom).floor # total width of the issue
|
||||
d_width = ((i_done_date - i_start_date)*zoom).floor # done width
|
||||
l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor : 0 # delay width
|
||||
|
||||
gc.fill('grey')
|
||||
gc.rectangle(i_left, top, i_left + i_width, top - 6)
|
||||
gc.fill('red')
|
||||
gc.rectangle(i_left, top, i_left + l_width, top - 6) if l_width > 0
|
||||
gc.fill('blue')
|
||||
gc.rectangle(i_left, top, i_left + d_width, top - 6) if d_width > 0
|
||||
gc.fill('black')
|
||||
gc.text(i_left + i_width + 5,top + 1, "#{i.status.name} #{i.done_ratio}%")
|
||||
else
|
||||
i_left = subject_width + ((i.start_date - date_from)*zoom).floor
|
||||
gc.fill('green')
|
||||
gc.rectangle(i_left, top, i_left + 6, top - 6)
|
||||
gc.fill('black')
|
||||
gc.text(i_left + 11, top + 1, i.name)
|
||||
end
|
||||
top = top + 20
|
||||
end
|
||||
|
||||
# today red line
|
||||
if Date.today >= date_from and Date.today <= date_to
|
||||
gc.stroke('red')
|
||||
x = (Date.today-date_from+1)*zoom + subject_width
|
||||
gc.line(x, headers_heigth, x, headers_heigth + g_height-1)
|
||||
end
|
||||
|
||||
gc.draw(imgl)
|
||||
imgl
|
||||
end if Object.const_defined?(:Magick)
|
||||
end
|
||||
|
||||
@@ -44,6 +44,8 @@ module QueriesHelper
|
||||
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
|
||||
when :done_ratio
|
||||
progress_bar(value, :width => '80px')
|
||||
when :fixed_version
|
||||
link_to(h(value), { :controller => 'versions', :action => 'show', :id => issue.fixed_version_id })
|
||||
else
|
||||
h(value)
|
||||
end
|
||||
|
||||
@@ -22,6 +22,12 @@ module RepositoriesHelper
|
||||
txt.to_s[0,8]
|
||||
end
|
||||
|
||||
def truncate_at_line_break(text, length = 255)
|
||||
if text
|
||||
text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...')
|
||||
end
|
||||
end
|
||||
|
||||
def render_properties(properties)
|
||||
unless properties.nil? || properties.empty?
|
||||
content = ''
|
||||
@@ -32,6 +38,74 @@ module RepositoriesHelper
|
||||
end
|
||||
end
|
||||
|
||||
def render_changeset_changes
|
||||
changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change|
|
||||
case change.action
|
||||
when 'A'
|
||||
# Detects moved/copied files
|
||||
if !change.from_path.blank?
|
||||
change.action = @changeset.changes.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
|
||||
end
|
||||
change
|
||||
when 'D'
|
||||
@changeset.changes.detect {|c| c.from_path == change.path} ? nil : change
|
||||
else
|
||||
change
|
||||
end
|
||||
end.compact
|
||||
|
||||
tree = { }
|
||||
changes.each do |change|
|
||||
p = tree
|
||||
dirs = change.path.to_s.split('/').select {|d| !d.blank?}
|
||||
dirs.each do |dir|
|
||||
p[:s] ||= {}
|
||||
p = p[:s]
|
||||
p[dir] ||= {}
|
||||
p = p[dir]
|
||||
end
|
||||
p[:c] = change
|
||||
end
|
||||
|
||||
render_changes_tree(tree[:s])
|
||||
end
|
||||
|
||||
def render_changes_tree(tree)
|
||||
return '' if tree.nil?
|
||||
|
||||
output = ''
|
||||
output << '<ul>'
|
||||
tree.keys.sort.each do |file|
|
||||
s = !tree[file][:s].nil?
|
||||
c = tree[file][:c]
|
||||
|
||||
style = 'change'
|
||||
style << ' folder' if s
|
||||
style << " change-#{c.action}" if c
|
||||
|
||||
text = h(file)
|
||||
unless c.nil?
|
||||
path_param = to_path_param(@repository.relative_path(c.path))
|
||||
text = link_to(text, :controller => 'repositories',
|
||||
:action => 'entry',
|
||||
:id => @project,
|
||||
:path => path_param,
|
||||
:rev => @changeset.revision) unless s || c.action == 'D'
|
||||
text << " - #{c.revision}" unless c.revision.blank?
|
||||
text << ' (' + link_to('diff', :controller => 'repositories',
|
||||
:action => 'diff',
|
||||
:id => @project,
|
||||
:path => path_param,
|
||||
:rev => @changeset.revision) + ') ' if c.action == 'M'
|
||||
text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
|
||||
end
|
||||
output << "<li class='#{style}'>#{text}</li>"
|
||||
output << render_changes_tree(tree[file][:s]) if s
|
||||
end
|
||||
output << '</ul>'
|
||||
output
|
||||
end
|
||||
|
||||
def to_utf8(str)
|
||||
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
||||
@encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
|
||||
|
||||
@@ -16,22 +16,6 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module WikiHelper
|
||||
|
||||
def render_page_hierarchy(pages, node=nil)
|
||||
content = ''
|
||||
if pages[node]
|
||||
content << "<ul class=\"pages-hierarchy\">\n"
|
||||
pages[node].each do |page|
|
||||
content << "<li>"
|
||||
content << link_to(h(page.pretty_title), {:action => 'index', :page => page.title},
|
||||
:title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
|
||||
content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id]
|
||||
content << "</li>\n"
|
||||
end
|
||||
content << "</ul>\n"
|
||||
end
|
||||
content
|
||||
end
|
||||
|
||||
def html_diff(wdiff)
|
||||
words = wdiff.words.collect{|word| h(word)}
|
||||
|
||||
19
app/helpers/workflows_helper.rb
Normal file
19
app/helpers/workflows_helper.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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 WorkflowsHelper
|
||||
end
|
||||
@@ -30,12 +30,14 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
acts_as_activity_provider :type => 'files',
|
||||
:permission => :view_files,
|
||||
:author_key => :author_id,
|
||||
:find_options => {:select => "#{Attachment.table_name}.*",
|
||||
:joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
|
||||
"LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id"}
|
||||
|
||||
acts_as_activity_provider :type => 'documents',
|
||||
:permission => :view_documents,
|
||||
:author_key => :author_id,
|
||||
:find_options => {:select => "#{Attachment.table_name}.*",
|
||||
:joins => "LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Document' AND #{Document.table_name}.id = #{Attachment.table_name}.container_id " +
|
||||
"LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"}
|
||||
@@ -70,7 +72,7 @@ class Attachment < ActiveRecord::Base
|
||||
File.open(diskfile, "wb") do |f|
|
||||
f.write(@temp_file.read)
|
||||
end
|
||||
self.digest = Digest::MD5.hexdigest(File.read(diskfile))
|
||||
self.digest = self.class.digest(diskfile)
|
||||
end
|
||||
# Don't save the content type if it's longer than the authorized length
|
||||
if self.content_type && self.content_type.length > 255
|
||||
@@ -131,4 +133,11 @@ private
|
||||
end
|
||||
df
|
||||
end
|
||||
|
||||
# Returns the MD5 digest of the file at given path
|
||||
def self.digest(filename)
|
||||
File.open(filename, 'rb') do |f|
|
||||
Digest::MD5.hexdigest(f.read)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,8 @@ class AuthSource < ActiveRecord::Base
|
||||
begin
|
||||
logger.debug "Authenticating '#{login}' against '#{source.name}'" if logger && logger.debug?
|
||||
attrs = source.authenticate(login, password)
|
||||
rescue
|
||||
rescue => e
|
||||
logger.error "Error during authentication: #{e.message}"
|
||||
attrs = nil
|
||||
end
|
||||
return attrs if attrs
|
||||
|
||||
@@ -25,6 +25,8 @@ class AuthSourceLdap < AuthSource
|
||||
validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true
|
||||
validates_numericality_of :port, :only_integer => true
|
||||
|
||||
before_validation :strip_ldap_attributes
|
||||
|
||||
def after_initialize
|
||||
self.port = 389 if self.port == 0
|
||||
end
|
||||
@@ -71,7 +73,14 @@ class AuthSourceLdap < AuthSource
|
||||
"LDAP"
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def strip_ldap_attributes
|
||||
[:attr_login, :attr_firstname, :attr_lastname, :attr_mail].each do |attr|
|
||||
write_attribute(attr, read_attribute(attr).strip) unless read_attribute(attr).nil?
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_ldap_con(ldap_user, ldap_password)
|
||||
options = { :host => self.host,
|
||||
:port => self.port,
|
||||
@@ -82,6 +91,8 @@ private
|
||||
end
|
||||
|
||||
def self.get_attr(entry, attr_name)
|
||||
entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
|
||||
if !attr_name.blank?
|
||||
entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -19,13 +19,13 @@ require 'iconv'
|
||||
|
||||
class Changeset < ActiveRecord::Base
|
||||
belongs_to :repository
|
||||
belongs_to :user
|
||||
has_many :changes, :dependent => :delete_all
|
||||
has_and_belongs_to_many :issues
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.revision}" + (o.comments.blank? ? '' : (': ' + o.comments))},
|
||||
:description => :comments,
|
||||
:datetime => :committed_on,
|
||||
:author => :committer,
|
||||
:url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project_id, :rev => o.revision}}
|
||||
|
||||
acts_as_searchable :columns => 'comments',
|
||||
@@ -34,6 +34,7 @@ class Changeset < ActiveRecord::Base
|
||||
:date_column => 'committed_on'
|
||||
|
||||
acts_as_activity_provider :timestamp => "#{table_name}.committed_on",
|
||||
:author_key => :user_id,
|
||||
:find_options => {:include => {:repository => :project}}
|
||||
|
||||
validates_presence_of :repository_id, :revision, :committed_on, :commit_date
|
||||
@@ -57,6 +58,14 @@ class Changeset < ActiveRecord::Base
|
||||
repository.project
|
||||
end
|
||||
|
||||
def author
|
||||
user || committer.to_s.split('<').first
|
||||
end
|
||||
|
||||
def before_create
|
||||
self.user = repository.find_committer_user(committer)
|
||||
end
|
||||
|
||||
def after_create
|
||||
scan_comment_for_issue_ids
|
||||
end
|
||||
@@ -96,12 +105,11 @@ class Changeset < ActiveRecord::Base
|
||||
issue.reload
|
||||
# don't change the status is the issue is closed
|
||||
next if issue.status.is_closed?
|
||||
user = committer_user || User.anonymous
|
||||
csettext = "r#{self.revision}"
|
||||
if self.scmid && (! (csettext =~ /^r[0-9]+$/))
|
||||
csettext = "commit:\"#{self.scmid}\""
|
||||
end
|
||||
journal = issue.init_journal(user, l(:text_status_changed_by_changeset, csettext))
|
||||
journal = issue.init_journal(user || User.anonymous, l(:text_status_changed_by_changeset, csettext))
|
||||
issue.status = fix_status
|
||||
issue.done_ratio = done_ratio if done_ratio
|
||||
issue.save
|
||||
@@ -113,16 +121,6 @@ class Changeset < ActiveRecord::Base
|
||||
|
||||
self.issues = referenced_issues.uniq
|
||||
end
|
||||
|
||||
# Returns the Redmine User corresponding to the committer
|
||||
def committer_user
|
||||
if committer && committer.strip =~ /^([^<]+)(<(.*)>)?$/
|
||||
username, email = $1.strip, $3
|
||||
u = User.find_by_login(username)
|
||||
u ||= User.find_by_mail(email) unless email.blank?
|
||||
u
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the previous changeset
|
||||
def previous
|
||||
@@ -140,7 +138,8 @@ class Changeset < ActiveRecord::Base
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
|
||||
def self.to_utf8(str)
|
||||
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
||||
encoding = Setting.commit_logs_encoding.to_s.strip
|
||||
|
||||
@@ -42,7 +42,8 @@ class Issue < ActiveRecord::Base
|
||||
acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"},
|
||||
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}
|
||||
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]},
|
||||
:author_key => :author_id
|
||||
|
||||
validates_presence_of :subject, :description, :priority, :project, :tracker, :author, :status
|
||||
validates_length_of :subject, :maximum => 255
|
||||
|
||||
@@ -25,8 +25,8 @@ class IssueStatus < ActiveRecord::Base
|
||||
validates_length_of :name, :maximum => 30
|
||||
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
|
||||
|
||||
def before_save
|
||||
IssueStatus.update_all "is_default=#{connection.quoted_false}" if self.is_default?
|
||||
def after_save
|
||||
IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
|
||||
end
|
||||
|
||||
# Returns the default status for new issues
|
||||
|
||||
@@ -33,6 +33,7 @@ class Journal < ActiveRecord::Base
|
||||
|
||||
acts_as_activity_provider :type => 'issues',
|
||||
:permission => :view_issues,
|
||||
:author_key => :user_id,
|
||||
:find_options => {:include => [{:issue => :project}, :details, :user],
|
||||
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||||
" (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
|
||||
|
||||
@@ -31,7 +31,7 @@ class MailHandler < ActionMailer::Base
|
||||
@@handler_options[:allow_override] ||= []
|
||||
# Project needs to be overridable if not specified
|
||||
@@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project)
|
||||
# Status needs to be overridable if not specified
|
||||
# Status overridable by default
|
||||
@@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status)
|
||||
super email
|
||||
end
|
||||
@@ -39,7 +39,7 @@ class MailHandler < ActionMailer::Base
|
||||
# Processes incoming emails
|
||||
def receive(email)
|
||||
@email = email
|
||||
@user = User.find_active(:first, :conditions => {:mail => email.from.first})
|
||||
@user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.from.first.to_s.strip.downcase])
|
||||
unless @user
|
||||
# Unknown user => the email is ignored
|
||||
# TODO: ability to create the user's account
|
||||
@@ -78,17 +78,25 @@ class MailHandler < ActionMailer::Base
|
||||
tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first)
|
||||
category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category)))
|
||||
priority = (get_keyword(:priority) && Enumeration.find_by_opt_and_name('IPRI', get_keyword(:priority)))
|
||||
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) || IssueStatus.default
|
||||
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
|
||||
|
||||
# check permission
|
||||
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
|
||||
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :status => status)
|
||||
issue.subject = email.subject.chomp
|
||||
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority)
|
||||
# check workflow
|
||||
if status && issue.new_statuses_allowed_to(user).include?(status)
|
||||
issue.status = status
|
||||
end
|
||||
issue.subject = email.subject.chomp.toutf8
|
||||
issue.description = email.plain_text_body.chomp
|
||||
issue.save!
|
||||
add_attachments(issue)
|
||||
logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info
|
||||
# send notification before adding watchers since they were cc'ed
|
||||
Mailer.deliver_issue_add(issue) if Setting.notified_events.include?('issue_added')
|
||||
# add To and Cc as watchers
|
||||
add_watchers(issue)
|
||||
|
||||
issue
|
||||
end
|
||||
|
||||
@@ -114,7 +122,10 @@ class MailHandler < ActionMailer::Base
|
||||
# add the note
|
||||
journal = issue.init_journal(user, email.plain_text_body.chomp)
|
||||
add_attachments(issue)
|
||||
issue.status = status unless status.nil?
|
||||
# check workflow
|
||||
if status && issue.new_statuses_allowed_to(user).include?(status)
|
||||
issue.status = status
|
||||
end
|
||||
issue.save!
|
||||
logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
|
||||
Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')
|
||||
@@ -132,6 +143,18 @@ class MailHandler < ActionMailer::Base
|
||||
end
|
||||
end
|
||||
|
||||
# Adds To and Cc as watchers of the given object if the sender has the
|
||||
# appropriate permission
|
||||
def add_watchers(obj)
|
||||
if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project)
|
||||
addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase}
|
||||
unless addresses.empty?
|
||||
watchers = User.active.find(:all, :conditions => ['LOWER(mail) IN (?)', addresses])
|
||||
watchers.each {|w| obj.add_watcher(w)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_keyword(attr)
|
||||
if @@handler_options[:allow_override].include?(attr.to_s) && email.plain_text_body =~ /^#{attr}:[ \t]*(.+)$/i
|
||||
$1.strip
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
# 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.
|
||||
@@ -19,15 +19,15 @@ class Mailer < ActionMailer::Base
|
||||
helper :application
|
||||
helper :issues
|
||||
helper :custom_fields
|
||||
|
||||
|
||||
include ActionController::UrlWriter
|
||||
|
||||
def issue_add(issue)
|
||||
|
||||
def issue_add(issue)
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => issue.id,
|
||||
'Issue-Author' => issue.author.login
|
||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
recipients issue.recipients
|
||||
recipients issue.recipients
|
||||
subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
|
||||
body :issue => issue,
|
||||
:issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
@@ -50,7 +50,7 @@ class Mailer < ActionMailer::Base
|
||||
:journal => journal,
|
||||
:issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
end
|
||||
|
||||
|
||||
def reminder(user, issues, days)
|
||||
set_language_if_valid user.language
|
||||
recipients user.mail
|
||||
@@ -59,7 +59,7 @@ class Mailer < ActionMailer::Base
|
||||
:days => days,
|
||||
:issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'issues.due_date', :sort_order => 'asc')
|
||||
end
|
||||
|
||||
|
||||
def document_added(document)
|
||||
redmine_headers 'Project' => document.project.identifier
|
||||
recipients document.project.recipients
|
||||
@@ -67,7 +67,7 @@ class Mailer < ActionMailer::Base
|
||||
body :document => document,
|
||||
:document_url => url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
end
|
||||
|
||||
|
||||
def attachments_added(attachments)
|
||||
container = attachments.first.container
|
||||
added_to = ''
|
||||
@@ -104,7 +104,7 @@ class Mailer < ActionMailer::Base
|
||||
body :message => message,
|
||||
:message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root)
|
||||
end
|
||||
|
||||
|
||||
def account_information(user, password)
|
||||
set_language_if_valid user.language
|
||||
recipients user.mail
|
||||
@@ -113,10 +113,10 @@ class Mailer < ActionMailer::Base
|
||||
:password => password,
|
||||
:login_url => url_for(:controller => 'account', :action => 'login')
|
||||
end
|
||||
|
||||
|
||||
def account_activation_request(user)
|
||||
# Send the email to all active administrators
|
||||
recipients User.find_active(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact
|
||||
recipients User.active.find(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact
|
||||
subject l(:mail_subject_account_activation_request, Setting.app_title)
|
||||
body :user => user,
|
||||
:url => url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc')
|
||||
@@ -128,7 +128,7 @@ class Mailer < ActionMailer::Base
|
||||
subject l(:mail_subject_lost_password, Setting.app_title)
|
||||
body :token => token,
|
||||
:url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value)
|
||||
end
|
||||
end
|
||||
|
||||
def register(token)
|
||||
set_language_if_valid(token.user.language)
|
||||
@@ -137,7 +137,7 @@ class Mailer < ActionMailer::Base
|
||||
body :token => token,
|
||||
:url => url_for(:controller => 'account', :action => 'activate', :token => token.value)
|
||||
end
|
||||
|
||||
|
||||
def test(user)
|
||||
set_language_if_valid(user.language)
|
||||
recipients user.mail
|
||||
@@ -148,12 +148,12 @@ class Mailer < ActionMailer::Base
|
||||
# Overrides default deliver! method to prevent from sending an email
|
||||
# with no recipient, cc or bcc
|
||||
def deliver!(mail = @mail)
|
||||
return false if (recipients.nil? || recipients.empty?) &&
|
||||
return false if (recipients.nil? || recipients.empty?) &&
|
||||
(cc.nil? || cc.empty?) &&
|
||||
(bcc.nil? || bcc.empty?)
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
# Sends reminders to issue assignees
|
||||
# Available options:
|
||||
# * :days => how many days in the future to remind about (defaults to 7)
|
||||
@@ -163,13 +163,13 @@ class Mailer < ActionMailer::Base
|
||||
days = options[:days] || 7
|
||||
project = options[:project] ? Project.find(options[:project]) : nil
|
||||
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
|
||||
|
||||
|
||||
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
|
||||
s << "#{Issue.table_name}.assigned_to_id IS NOT NULL"
|
||||
s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}"
|
||||
s << "#{Issue.table_name}.project_id = #{project.id}" if project
|
||||
s << "#{Issue.table_name}.tracker_id = #{tracker.id}" if tracker
|
||||
|
||||
|
||||
issues_by_assignee = Issue.find(:all, :include => [:status, :assigned_to, :project, :tracker],
|
||||
:conditions => s.conditions
|
||||
).group_by(&:assigned_to)
|
||||
@@ -183,19 +183,24 @@ class Mailer < ActionMailer::Base
|
||||
super
|
||||
set_language_if_valid Setting.default_language
|
||||
from Setting.mail_from
|
||||
default_url_options[:host] = Setting.host_name
|
||||
|
||||
# URL options
|
||||
h = Setting.host_name
|
||||
h = h.to_s.gsub(%r{\/.*$}, '') unless ActionController::AbstractRequest.relative_url_root.blank?
|
||||
default_url_options[:host] = h
|
||||
default_url_options[:protocol] = Setting.protocol
|
||||
|
||||
# Common headers
|
||||
headers 'X-Mailer' => 'Redmine',
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
'X-Redmine-Site' => Setting.app_title
|
||||
end
|
||||
|
||||
|
||||
# Appends a Redmine header field (name is prepended with 'X-Redmine-')
|
||||
def redmine_headers(h)
|
||||
h.each { |k,v| headers["X-Redmine-#{k}"] = v }
|
||||
end
|
||||
|
||||
|
||||
# Overrides the create_mail method
|
||||
def create_mail
|
||||
# Removes the current user from the recipients and cc
|
||||
@@ -209,17 +214,32 @@ class Mailer < ActionMailer::Base
|
||||
bcc([recipients, cc].flatten.compact.uniq)
|
||||
recipients []
|
||||
cc []
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
# Renders a message with the corresponding layout
|
||||
def render_message(method_name, body)
|
||||
layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml'
|
||||
body[:content_for_layout] = render(:file => method_name, :body => body)
|
||||
ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}")
|
||||
ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true)
|
||||
end
|
||||
|
||||
|
||||
# for the case of plain text only
|
||||
def body(*params)
|
||||
value = super(*params)
|
||||
if Setting.plain_text_mail?
|
||||
templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}")
|
||||
unless String === @body or templates.empty?
|
||||
template = File.basename(templates.first)
|
||||
@body[:content_for_layout] = render(:file => template, :body => @body)
|
||||
@body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true)
|
||||
return @body
|
||||
end
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
# Makes partial rendering work with Rails 1.2 (retro-compatibility)
|
||||
def self.controller_path
|
||||
''
|
||||
|
||||
@@ -32,12 +32,16 @@ class Message < ActiveRecord::Base
|
||||
:url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id} :
|
||||
{:id => o.parent_id, :anchor => "message-#{o.id}"})}
|
||||
|
||||
acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]}
|
||||
acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]},
|
||||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
attr_protected :locked, :sticky
|
||||
validates_presence_of :subject, :content
|
||||
validates_length_of :subject, :maximum => 255
|
||||
|
||||
after_create :add_author_as_watcher
|
||||
|
||||
def validate_on_create
|
||||
# Can not reply to a locked topic
|
||||
errors.add_to_base 'Topic is locked' if root.locked? && self != root
|
||||
@@ -68,4 +72,18 @@ class Message < ActiveRecord::Base
|
||||
def project
|
||||
board.project
|
||||
end
|
||||
|
||||
def editable_by?(usr)
|
||||
usr && usr.logged? && (usr.allowed_to?(:edit_messages, project) || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)))
|
||||
end
|
||||
|
||||
def destroyable_by?(usr)
|
||||
usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
Watcher.create(:watchable => self.root, :user => author)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
class MessageObserver < ActiveRecord::Observer
|
||||
def after_create(message)
|
||||
# send notification to the authors of the thread
|
||||
recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author && m.author.active?}
|
||||
recipients = []
|
||||
# send notification to the topic watchers
|
||||
recipients += message.root.watcher_recipients
|
||||
# send notification to the board watchers
|
||||
recipients += message.board.watcher_recipients
|
||||
# send notification to project members who want to be notified
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -26,10 +26,11 @@ class News < ActiveRecord::Base
|
||||
|
||||
acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project
|
||||
acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}}
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author]}
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author]},
|
||||
:author_key => :author_id
|
||||
|
||||
# returns latest news for projects visible by user
|
||||
def self.latest(user=nil, count=5)
|
||||
find(:all, :limit => count, :conditions => Project.visible_by(user), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||
def self.latest(user = User.current, count = 5)
|
||||
find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,6 +62,8 @@ class Project < ActiveRecord::Base
|
||||
validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
|
||||
|
||||
before_destroy :delete_all_members
|
||||
|
||||
named_scope :has_module, lambda { |mod| { :conditions => ["#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s] } }
|
||||
|
||||
def identifier=(identifier)
|
||||
super unless identifier_frozen?
|
||||
@@ -106,6 +108,12 @@ class Project < ActiveRecord::Base
|
||||
def self.allowed_to_condition(user, permission, options={})
|
||||
statements = []
|
||||
base_statement = "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"
|
||||
if perm = Redmine::AccessControl.permission(permission)
|
||||
unless perm.project_module.nil?
|
||||
# If the permission belongs to a project module, make sure the module is enabled
|
||||
base_statement << " AND EXISTS (SELECT em.id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.project_module}' AND em.project_id=#{Project.table_name}.id)"
|
||||
end
|
||||
end
|
||||
if options[:project]
|
||||
project_statement = "#{Project.table_name}.id = #{options[:project].id}"
|
||||
project_statement << " OR #{Project.table_name}.parent_id = #{options[:project].id}" if options[:with_subprojects]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2008 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
|
||||
@@ -254,9 +254,8 @@ class Query < ActiveRecord::Base
|
||||
def has_default_columns?
|
||||
column_names.nil? || column_names.empty?
|
||||
end
|
||||
|
||||
def statement
|
||||
# project/subprojects clause
|
||||
|
||||
def project_statement
|
||||
project_clauses = []
|
||||
if project && !@project.active_children.empty?
|
||||
ids = [project.id]
|
||||
@@ -274,12 +273,15 @@ class Query < ActiveRecord::Base
|
||||
elsif Setting.display_subprojects_issues?
|
||||
ids += project.child_ids
|
||||
end
|
||||
project_clauses << "#{Issue.table_name}.project_id IN (%s)" % ids.join(',')
|
||||
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
||||
elsif project
|
||||
project_clauses << "#{Issue.table_name}.project_id = %d" % project.id
|
||||
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
||||
end
|
||||
project_clauses << Project.visible_by(User.current)
|
||||
|
||||
project_clauses << Project.allowed_to_condition(User.current, :view_issues)
|
||||
project_clauses.join(' AND ')
|
||||
end
|
||||
|
||||
def statement
|
||||
# filters clauses
|
||||
filters_clauses = []
|
||||
filters.each_key do |field|
|
||||
@@ -307,60 +309,69 @@ class Query < ActiveRecord::Base
|
||||
v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me")
|
||||
end
|
||||
|
||||
case operator_for field
|
||||
when "="
|
||||
sql = sql + "#{db_table}.#{db_field} IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
|
||||
when "!"
|
||||
sql = sql + "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
|
||||
when "!*"
|
||||
sql = sql + "#{db_table}.#{db_field} IS NULL"
|
||||
sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
|
||||
when "*"
|
||||
sql = sql + "#{db_table}.#{db_field} IS NOT NULL"
|
||||
sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
|
||||
when ">="
|
||||
sql = sql + "#{db_table}.#{db_field} >= #{v.first.to_i}"
|
||||
when "<="
|
||||
sql = sql + "#{db_table}.#{db_field} <= #{v.first.to_i}"
|
||||
when "o"
|
||||
sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
|
||||
when "c"
|
||||
sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}" if field == "status_id"
|
||||
when ">t-"
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today + 1).to_time)]
|
||||
when "<t-"
|
||||
sql = sql + "#{db_table}.#{db_field} <= '%s'" % connection.quoted_date((Date.today - v.first.to_i).to_time)
|
||||
when "t-"
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today - v.first.to_i + 1).to_time)]
|
||||
when ">t+"
|
||||
sql = sql + "#{db_table}.#{db_field} >= '%s'" % connection.quoted_date((Date.today + v.first.to_i).to_time)
|
||||
when "<t+"
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
|
||||
when "t+"
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today + v.first.to_i).to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
|
||||
when "t"
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
|
||||
when "w"
|
||||
from = l(:general_first_day_of_week) == '7' ?
|
||||
# week starts on sunday
|
||||
((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :
|
||||
# week starts on monday (Rails default)
|
||||
Time.now.at_beginning_of_week
|
||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]
|
||||
when "~"
|
||||
sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
|
||||
when "!~"
|
||||
sql = sql + "#{db_table}.#{db_field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
|
||||
end
|
||||
sql = sql + sql_for_field(field, v, db_table, db_field, is_custom_filter)
|
||||
|
||||
sql << ')'
|
||||
filters_clauses << sql
|
||||
end if filters and valid?
|
||||
|
||||
(project_clauses + filters_clauses).join(' AND ')
|
||||
(filters_clauses << project_statement).join(' AND ')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Helper method to generate the WHERE sql for a +field+ with a +value+
|
||||
def sql_for_field(field, value, db_table, db_field, is_custom_filter)
|
||||
sql = ''
|
||||
case operator_for field
|
||||
when "="
|
||||
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
|
||||
when "!"
|
||||
sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
|
||||
when "!*"
|
||||
sql = "#{db_table}.#{db_field} IS NULL"
|
||||
sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
|
||||
when "*"
|
||||
sql = "#{db_table}.#{db_field} IS NOT NULL"
|
||||
sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
|
||||
when ">="
|
||||
sql = "#{db_table}.#{db_field} >= #{value.first.to_i}"
|
||||
when "<="
|
||||
sql = "#{db_table}.#{db_field} <= #{value.first.to_i}"
|
||||
when "o"
|
||||
sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
|
||||
when "c"
|
||||
sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}" if field == "status_id"
|
||||
when ">t-"
|
||||
sql = date_range_clause(db_table, db_field, - value.first.to_i, 0)
|
||||
when "<t-"
|
||||
sql = date_range_clause(db_table, db_field, nil, - value.first.to_i)
|
||||
when "t-"
|
||||
sql = date_range_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)
|
||||
when ">t+"
|
||||
sql = date_range_clause(db_table, db_field, value.first.to_i, nil)
|
||||
when "<t+"
|
||||
sql = date_range_clause(db_table, db_field, 0, value.first.to_i)
|
||||
when "t+"
|
||||
sql = date_range_clause(db_table, db_field, value.first.to_i, value.first.to_i)
|
||||
when "t"
|
||||
sql = date_range_clause(db_table, db_field, 0, 0)
|
||||
when "w"
|
||||
from = l(:general_first_day_of_week) == '7' ?
|
||||
# week starts on sunday
|
||||
((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :
|
||||
# week starts on monday (Rails default)
|
||||
Time.now.at_beginning_of_week
|
||||
sql = "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]
|
||||
when "~"
|
||||
sql = "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(value.first)}%'"
|
||||
when "!~"
|
||||
sql = "#{db_table}.#{db_field} NOT LIKE '%#{connection.quote_string(value.first)}%'"
|
||||
end
|
||||
|
||||
return sql
|
||||
end
|
||||
|
||||
def add_custom_fields_filters(custom_fields)
|
||||
@available_filters ||= {}
|
||||
|
||||
@@ -380,4 +391,16 @@ class Query < ActiveRecord::Base
|
||||
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a SQL clause for a date or datetime field.
|
||||
def date_range_clause(table, field, from, to)
|
||||
s = []
|
||||
if from
|
||||
s << ("#{table}.#{field} > '%s'" % [connection.quoted_date((Date.yesterday + from).to_time.end_of_day)])
|
||||
end
|
||||
if to
|
||||
s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date((Date.today + to).to_time.end_of_day)])
|
||||
end
|
||||
s.join(' AND ')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +78,7 @@ class Repository < ActiveRecord::Base
|
||||
# Default behaviour: we search in cached changesets
|
||||
def changesets_for_path(path)
|
||||
path = "/#{path}" unless path.starts_with?('/')
|
||||
Change.find(:all, :include => :changeset,
|
||||
Change.find(:all, :include => {:changeset => :user},
|
||||
:conditions => ["repository_id = ? AND path = ?", id, path],
|
||||
:order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset)
|
||||
end
|
||||
@@ -96,6 +96,45 @@ class Repository < ActiveRecord::Base
|
||||
self.changesets.each(&:scan_comment_for_issue_ids)
|
||||
end
|
||||
|
||||
# Returns an array of committers usernames and associated user_id
|
||||
def committers
|
||||
@committers ||= Changeset.connection.select_rows("SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}")
|
||||
end
|
||||
|
||||
# Maps committers username to a user ids
|
||||
def committer_ids=(h)
|
||||
if h.is_a?(Hash)
|
||||
committers.each do |committer, user_id|
|
||||
new_user_id = h[committer]
|
||||
if new_user_id && (new_user_id.to_i != user_id.to_i)
|
||||
new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil)
|
||||
Changeset.update_all("user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }", ["repository_id = ? AND committer = ?", id, committer])
|
||||
end
|
||||
end
|
||||
@committers = nil
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the Redmine User corresponding to the given +committer+
|
||||
# It will return nil if the committer is not yet mapped and if no User
|
||||
# with the same username or email was found
|
||||
def find_committer_user(committer)
|
||||
if committer
|
||||
c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user)
|
||||
if c && c.user
|
||||
c.user
|
||||
elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
|
||||
username, email = $1.strip, $3
|
||||
u = User.find_by_login(username)
|
||||
u ||= User.find_by_mail(email) unless email.blank?
|
||||
u
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# fetch new changesets for all repositories
|
||||
# can be called periodically by an external script
|
||||
# eg. ruby script/runner "Repository.fetch_changesets"
|
||||
|
||||
@@ -52,7 +52,7 @@ class Repository::Darcs < Repository
|
||||
end
|
||||
|
||||
def cat(path, identifier=nil)
|
||||
patch = identifier.nil? ? nil : changesets.find_by_revision(identifier)
|
||||
patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s)
|
||||
scm.cat(path, patch.nil? ? nil : patch.scmid)
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class Repository::Git < Repository
|
||||
end
|
||||
|
||||
def changesets_for_path(path)
|
||||
Change.find(:all, :include => :changeset,
|
||||
Change.find(:all, :include => {:changeset => :user},
|
||||
:conditions => ["repository_id = ? AND path = ?", id, path],
|
||||
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset)
|
||||
end
|
||||
@@ -45,20 +45,22 @@ class Repository::Git < Repository
|
||||
|
||||
unless changesets.find_by_scmid(scm_revision)
|
||||
scm.revisions('', db_revision, nil, :reverse => true) do |revision|
|
||||
transaction do
|
||||
changeset = Changeset.create(:repository => self,
|
||||
:revision => revision.identifier,
|
||||
:scmid => revision.scmid,
|
||||
:committer => revision.author,
|
||||
:committed_on => revision.time,
|
||||
:comments => revision.message)
|
||||
|
||||
revision.paths.each do |change|
|
||||
Change.create(:changeset => changeset,
|
||||
:action => change[:action],
|
||||
:path => change[:path],
|
||||
:from_path => change[:from_path],
|
||||
:from_revision => change[:from_revision])
|
||||
if changesets.find_by_scmid(revision.scmid.to_s).nil?
|
||||
transaction do
|
||||
changeset = Changeset.create!(:repository => self,
|
||||
:revision => revision.identifier,
|
||||
:scmid => revision.scmid,
|
||||
:committer => revision.author,
|
||||
:committed_on => revision.time,
|
||||
:comments => revision.message)
|
||||
|
||||
revision.paths.each do |change|
|
||||
Change.create!(:changeset => changeset,
|
||||
:action => change[:action],
|
||||
:path => change[:path],
|
||||
:from_path => change[:from_path],
|
||||
:from_revision => change[:from_revision])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ class Repository::Subversion < Repository
|
||||
|
||||
def changesets_for_path(path)
|
||||
revisions = scm.revisions(path)
|
||||
revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC") : []
|
||||
revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : []
|
||||
end
|
||||
|
||||
# Returns a path relative to the url of the repository
|
||||
|
||||
@@ -19,6 +19,11 @@ class Role < ActiveRecord::Base
|
||||
# Built-in roles
|
||||
BUILTIN_NON_MEMBER = 1
|
||||
BUILTIN_ANONYMOUS = 2
|
||||
|
||||
named_scope :builtin, lambda { |*args|
|
||||
compare = 'not' if args.first == true
|
||||
{ :conditions => "#{compare} builtin = 0" }
|
||||
}
|
||||
|
||||
before_destroy :check_deletable
|
||||
has_many :workflows, :dependent => :delete_all do
|
||||
@@ -36,7 +41,7 @@ class Role < ActiveRecord::Base
|
||||
has_many :members
|
||||
acts_as_list
|
||||
|
||||
serialize :permissions
|
||||
serialize :permissions, Array
|
||||
attr_protected :builtin
|
||||
|
||||
validates_presence_of :name
|
||||
@@ -49,9 +54,32 @@ class Role < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def permissions=(perms)
|
||||
perms = perms.collect {|p| p.to_sym unless p.blank? }.compact if perms
|
||||
perms = perms.collect {|p| p.to_sym unless p.blank? }.compact.uniq if perms
|
||||
write_attribute(:permissions, perms)
|
||||
end
|
||||
|
||||
def add_permission!(*perms)
|
||||
self.permissions = [] unless permissions.is_a?(Array)
|
||||
|
||||
permissions_will_change!
|
||||
perms.each do |p|
|
||||
p = p.to_sym
|
||||
permissions << p unless permissions.include?(p)
|
||||
end
|
||||
save!
|
||||
end
|
||||
|
||||
def remove_permission!(*perms)
|
||||
return unless permissions.is_a?(Array)
|
||||
permissions_will_change!
|
||||
perms.each { |p| permissions.delete(p.to_sym) }
|
||||
save!
|
||||
end
|
||||
|
||||
# Returns true if the role has the given permission
|
||||
def has_permission?(perm)
|
||||
!permissions.nil? && permissions.include?(perm.to_sym)
|
||||
end
|
||||
|
||||
def <=>(role)
|
||||
position <=> role.position
|
||||
|
||||
@@ -75,9 +75,9 @@ class Setting < ActiveRecord::Base
|
||||
|
||||
cattr_accessor :available_settings
|
||||
@@available_settings = YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml"))
|
||||
Redmine::Plugin.registered_plugins.each do |id, plugin|
|
||||
Redmine::Plugin.all.each do |plugin|
|
||||
next unless plugin.settings
|
||||
@@available_settings["plugin_#{id}"] = {'default' => plugin.settings[:default], 'serialized' => true}
|
||||
@@available_settings["plugin_#{plugin.id}"] = {'default' => plugin.settings[:default], 'serialized' => true}
|
||||
end
|
||||
|
||||
validates_uniqueness_of :name
|
||||
|
||||
@@ -37,10 +37,14 @@ class User < ActiveRecord::Base
|
||||
has_many :members, :dependent => :delete_all
|
||||
has_many :projects, :through => :memberships
|
||||
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
|
||||
has_many :changesets, :dependent => :nullify
|
||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||
has_one :rss_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'"
|
||||
belongs_to :auth_source
|
||||
|
||||
# Active non-anonymous users scope
|
||||
named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}"
|
||||
|
||||
acts_as_customizable
|
||||
|
||||
attr_accessor :password, :password_confirmation
|
||||
@@ -70,17 +74,10 @@ class User < ActiveRecord::Base
|
||||
# update hashed_password if password was set
|
||||
self.hashed_password = User.hash_password(self.password) if self.password
|
||||
end
|
||||
|
||||
def self.active
|
||||
with_scope :find => { :conditions => [ "status = ?", STATUS_ACTIVE ] } do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def self.find_active(*args)
|
||||
active do
|
||||
find(*args)
|
||||
end
|
||||
def reload(*args)
|
||||
@name = nil
|
||||
super
|
||||
end
|
||||
|
||||
# Returns the user that matches provided login and password, or nil
|
||||
@@ -119,8 +116,11 @@ class User < ActiveRecord::Base
|
||||
|
||||
# Return user's full name for display
|
||||
def name(formatter = nil)
|
||||
f = USER_FORMATS[formatter || Setting.user_format] || USER_FORMATS[:firstname_lastname]
|
||||
eval '"' + f + '"'
|
||||
if formatter
|
||||
eval('"' + (USER_FORMATS[formatter] || USER_FORMATS[:firstname_lastname]) + '"')
|
||||
else
|
||||
@name ||= eval('"' + (USER_FORMATS[Setting.user_format] || USER_FORMATS[:firstname_lastname]) + '"')
|
||||
end
|
||||
end
|
||||
|
||||
def active?
|
||||
@@ -144,7 +144,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def time_zone
|
||||
self.pref.time_zone.nil? ? nil : TimeZone[self.pref.time_zone]
|
||||
@time_zone ||= (self.pref.time_zone.blank? ? nil : TimeZone[self.pref.time_zone])
|
||||
end
|
||||
|
||||
def wants_comments_in_reverse_order?
|
||||
@@ -179,14 +179,9 @@ class User < ActiveRecord::Base
|
||||
token && (token.created_on > Setting.autologin.to_i.day.ago) && token.user.active? ? token.user : nil
|
||||
end
|
||||
|
||||
# Sort users by their display names
|
||||
def <=>(user)
|
||||
if user.nil?
|
||||
-1
|
||||
elsif lastname.to_s.downcase == user.lastname.to_s.downcase
|
||||
firstname.to_s.downcase <=> user.firstname.to_s.downcase
|
||||
else
|
||||
lastname.to_s.downcase <=> user.lastname.to_s.downcase
|
||||
end
|
||||
self.to_s.downcase <=> user.to_s.downcase
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
||||
@@ -24,7 +24,7 @@ class Version < ActiveRecord::Base
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name, :scope => [:project_id]
|
||||
validates_length_of :name, :maximum => 60
|
||||
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date, :allow_nil => true
|
||||
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => 'activerecord_error_not_a_date', :allow_nil => true
|
||||
|
||||
def start_date
|
||||
effective_date
|
||||
|
||||
@@ -43,6 +43,25 @@ class Wiki < ActiveRecord::Base
|
||||
page
|
||||
end
|
||||
|
||||
# Finds a page by title
|
||||
# The given string can be of one of the forms: "title" or "project:title"
|
||||
# Examples:
|
||||
# Wiki.find_page("bar", project => foo)
|
||||
# Wiki.find_page("foo:bar")
|
||||
def self.find_page(title, options = {})
|
||||
project = options[:project]
|
||||
if title.to_s =~ %r{^([^\:]+)\:(.*)$}
|
||||
project_identifier, title = $1, $2
|
||||
project = Project.find_by_identifier(project_identifier) || Project.find_by_name(project_identifier)
|
||||
end
|
||||
if project && project.wiki
|
||||
page = project.wiki.find_page(title)
|
||||
if page && page.content
|
||||
page
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# turn a string into a valid page title
|
||||
def self.titleize(title)
|
||||
# replace spaces with _ and remove unwanted caracters
|
||||
|
||||
@@ -35,9 +35,10 @@ class WikiContent < ActiveRecord::Base
|
||||
:type => 'wiki-page',
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
|
||||
|
||||
acts_as_activity_provider :type => 'wiki_pages',
|
||||
acts_as_activity_provider :type => 'wiki_edits',
|
||||
:timestamp => "#{WikiContent.versioned_table_name}.updated_on",
|
||||
:permission => :view_wiki_pages,
|
||||
:author_key => "#{WikiContent.versioned_table_name}.author_id",
|
||||
:permission => :view_wiki_edits,
|
||||
:find_options => {:select => "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comments, " +
|
||||
"#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title, " +
|
||||
"#{WikiContent.versioned_table_name}.page_id, #{WikiContent.versioned_table_name}.author_id, " +
|
||||
|
||||
@@ -21,4 +21,23 @@ class Workflow < ActiveRecord::Base
|
||||
belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id'
|
||||
|
||||
validates_presence_of :role, :old_status, :new_status
|
||||
|
||||
# Returns workflow transitions count by tracker and role
|
||||
def self.count_by_tracker_and_role
|
||||
counts = connection.select_all("SELECT role_id, tracker_id, count(id) AS c FROM #{Workflow.table_name} GROUP BY role_id, tracker_id")
|
||||
roles = Role.find(:all, :order => 'builtin, position')
|
||||
trackers = Tracker.find(:all, :order => 'position')
|
||||
|
||||
result = []
|
||||
trackers.each do |tracker|
|
||||
t = []
|
||||
roles.each do |role|
|
||||
row = counts.detect {|c| c['role_id'] == role.id.to_s && c['tracker_id'] == tracker.id.to_s}
|
||||
t << [role, (row.nil? ? 0 : row['c'].to_i)]
|
||||
end
|
||||
result << [tracker, t]
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
<%= link_to(l(:button_edit), {:controller => 'users', :action => 'edit', :id => @user}, :class => 'icon icon-edit') if User.current.admin? %>
|
||||
</div>
|
||||
|
||||
<h2><%=h @user.name %></h2>
|
||||
<h2><%= avatar @user %> <%=h @user.name %></h2>
|
||||
|
||||
<p>
|
||||
<%= mail_to(h(@user.mail)) unless @user.pref.hide_mail %>
|
||||
<div class="splitcontentleft">
|
||||
<ul>
|
||||
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
|
||||
<% for custom_value in @custom_values %>
|
||||
<% if !custom_value.value.empty? %>
|
||||
<% unless @user.pref.hide_mail %>
|
||||
<li><%=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></li>
|
||||
<% end %>
|
||||
<% for custom_value in @custom_values %>
|
||||
<% if !custom_value.value.empty? %>
|
||||
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
|
||||
<% unless @user.last_login_on.nil? %>
|
||||
<li><%=l(:field_last_login_on)%>: <%= format_date(@user.last_login_on) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<% unless @memberships.empty? %>
|
||||
<h3><%=l(:label_project_plural)%></h3>
|
||||
@@ -25,8 +29,41 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
|
||||
<% unless @events_by_day.empty? %>
|
||||
<h3><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :user_id => @user, :from => @events_by_day.keys.first %></h3>
|
||||
|
||||
<h3><%=l(:label_activity)%></h3>
|
||||
<p>
|
||||
<%=l(:label_reported_issues)%>: <%= Issue.count(:conditions => ["author_id=?", @user.id]) %>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<div id="activity">
|
||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||
<h4><%= format_activity_day(day) %></h4>
|
||||
<dl>
|
||||
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
||||
<dt class="<%= e.event_type %>">
|
||||
<span class="time"><%= format_time(e.event_datetime, false) %></span>
|
||||
<%= content_tag('span', h(e.project), :class => 'project') %>
|
||||
<%= link_to format_activity_title(e.event_title), e.event_url %></dt>
|
||||
<dd><span class="description"><%= format_activity_description(e.event_description) %></span></dd>
|
||||
<% end -%>
|
||||
</dl>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :user_id => @user, :format => :atom, :key => User.current.rss_key}, :class => 'feed' %>
|
||||
</p>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% html_title @user.name %>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<p class="icon22 icon22-tracker">
|
||||
<%= link_to l(:label_tracker_plural), :controller => 'trackers' %> |
|
||||
<%= link_to l(:label_issue_status_plural), :controller => 'issue_statuses' %> |
|
||||
<%= link_to l(:label_workflow), :controller => 'roles', :action => 'workflow' %>
|
||||
<%= link_to l(:label_workflow), :controller => 'workflows', :action => 'edit' %>
|
||||
</p>
|
||||
|
||||
<p class="icon22 icon22-workflow">
|
||||
@@ -34,6 +34,16 @@
|
||||
<%= link_to l(:label_settings), :controller => 'settings' %>
|
||||
</p>
|
||||
|
||||
<% menu_items_for(:admin_menu) do |item, caption, url, selected| -%>
|
||||
<%= content_tag 'p',
|
||||
link_to(h(caption), item.url, item.html_options),
|
||||
:class => ["icon22", "icon22-#{item.name}"].join(' ') %>
|
||||
<% end -%>
|
||||
|
||||
<p class="icon22 icon22-plugin">
|
||||
<%= link_to l(:label_plugins), :controller => 'admin', :action => 'plugins' %>
|
||||
</p>
|
||||
|
||||
<p class="icon22 icon22-info">
|
||||
<%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %>
|
||||
</p>
|
||||
|
||||
@@ -8,20 +8,4 @@
|
||||
<tr class="odd"><td><%= l(:text_rmagick_available) %></td><td><%= image_tag (@flags[:rmagick_available] ? 'true.png' : 'false.png'), :style => "vertical-align:bottom;" %></td></tr>
|
||||
</table>
|
||||
|
||||
<% if @plugins.any? %>
|
||||
|
||||
<h3 class="icon22 icon22-plugin"><%= l(:label_plugins) %></h3>
|
||||
<table class="list">
|
||||
<% @plugins.keys.sort {|x,y| x.to_s <=> y.to_s}.each do |plugin| %>
|
||||
<tr class="<%= cycle('odd', 'even') %>">
|
||||
<td><%=h @plugins[plugin].name %></td>
|
||||
<td><%=h @plugins[plugin].description %></td>
|
||||
<td><%=h @plugins[plugin].author %></td>
|
||||
<td><%=h @plugins[plugin].version %></td>
|
||||
<td><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.to_s) if @plugins[plugin].configurable? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_information_plural)) -%>
|
||||
|
||||
19
app/views/admin/plugins.rhtml
Normal file
19
app/views/admin/plugins.rhtml
Normal file
@@ -0,0 +1,19 @@
|
||||
<h2><%= l(:label_plugins) %></h2>
|
||||
|
||||
<% if @plugins.any? %>
|
||||
<table class="list plugins">
|
||||
<% @plugins.each do |plugin| %>
|
||||
<tr class="<%= cycle('odd', 'even') %>">
|
||||
<td><span class="name"><%=h plugin.name %></span>
|
||||
<%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
|
||||
<%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
|
||||
</td>
|
||||
<td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
|
||||
<td class="version"><%=h plugin.version %></td>
|
||||
<td class="configure"><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
@@ -4,11 +4,13 @@
|
||||
|
||||
<h2><%=l(:label_project_plural)%></h2>
|
||||
|
||||
<% form_tag() do %>
|
||||
<% form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label><%= l(:field_status) %> :</label>
|
||||
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<%= submit_tag l(:button_apply), :class => "small" %>
|
||||
<label><%= l(:label_project) %>:</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<th><%=l(:field_name)%></th>
|
||||
<th><%=l(:field_type)%></th>
|
||||
<th><%=l(:field_host)%></th>
|
||||
<th><%=l(:label_user_plural)%></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
@@ -18,8 +19,12 @@
|
||||
<td><%= link_to source.name, :action => 'edit', :id => source%></td>
|
||||
<td align="center"><%= source.auth_method_name %></td>
|
||||
<td align="center"><%= source.host %></td>
|
||||
<td align="center"><%= source.users.count %></td>
|
||||
<td align="center"><%= link_to l(:button_test), :action => 'test_connection', :id => source %></td>
|
||||
<td align="center"><%= button_to l(:button_delete), { :action => 'destroy', :id => source }, :confirm => l(:text_are_you_sure), :class => "button-small" %></td>
|
||||
<td align="center"><%= button_to l(:button_delete), { :action => 'destroy', :id => source },
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:class => "button-small",
|
||||
:disabled => source.users.any? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
</div>
|
||||
|
||||
<h2><%=h @board.name %></h2>
|
||||
<p class="subtitle"><%=h @board.description %></p>
|
||||
|
||||
<% if @topics.any? %>
|
||||
<table class="list messages">
|
||||
|
||||
@@ -6,7 +6,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||
xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
|
||||
xml.author { xml.name "#{Setting.app_title}" }
|
||||
xml.generator(:uri => Redmine::Info.url, :version => Redmine::VERSION) { xml.text! Redmine::Info.versioned_name; }
|
||||
xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
|
||||
@items.each do |item|
|
||||
xml.entry do
|
||||
url = url_for(item.event_url(:only_path => false))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="changeset <%= cycle('odd', 'even') %>">
|
||||
<p><%= link_to("#{l(:label_revision)} #{changeset.revision}",
|
||||
:controller => 'repositories', :action => 'revision', :id => @project, :rev => changeset.revision) %><br />
|
||||
<span class="author"><%= authoring(changeset.committed_on, changeset.committer) %></span></p>
|
||||
<span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
|
||||
<%= textilizable(changeset, :comments) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<fieldset><legend><%= l(:field_notes) %></legend>
|
||||
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
|
||||
<%= wikitoolbar_for 'notes' %>
|
||||
<%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
|
||||
|
||||
<p><%=l(:label_attachment_plural)%><br /><%= render :partial => 'attachments/form' %></p>
|
||||
</fieldset>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<% reply_links = authorize_for('issues', 'edit') -%>
|
||||
<% for journal in journals %>
|
||||
<div id="change-<%= journal.id %>" class="journal">
|
||||
<h4><div style="float:right;"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
|
||||
<%= content_tag('a', '', :name => "note-#{journal.indice}")%>
|
||||
<%= format_time(journal.created_on) %> - <%= journal.user.name %></h4>
|
||||
<ul>
|
||||
<% for detail in journal.details %>
|
||||
<li><%= show_detail(detail) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %>
|
||||
</div>
|
||||
<div id="change-<%= journal.id %>" class="journal">
|
||||
<h4><div style="float:right;"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
|
||||
<%= content_tag('a', '', :name => "note-#{journal.indice}")%>
|
||||
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %></h4>
|
||||
<%= avatar(journal.user, :size => "32") %>
|
||||
<ul>
|
||||
<% for detail in journal.details %>
|
||||
<li><%= show_detail(detail) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %>
|
||||
</div>
|
||||
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
|
||||
<% end %>
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<table style="width:100%">
|
||||
<% @issue.relations.each do |relation| %>
|
||||
<tr>
|
||||
<td><%= l(relation.label_for(@issue)) %> <%= "(#{lwr(:actionview_datehelper_time_in_words_day, relation.delay)})" if relation.delay && relation.delay != 0 %> <%= link_to_issue relation.other_issue(@issue) %></td>
|
||||
<td><%= l(relation.label_for(@issue)) %> <%= "(#{lwr(:actionview_datehelper_time_in_words_day, relation.delay)})" if relation.delay && relation.delay != 0 %>
|
||||
<%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %> <%= link_to_issue relation.other_issue(@issue) %></td>
|
||||
<td><%=h relation.other_issue(@issue).subject %></td>
|
||||
<td><%= relation.other_issue(@issue).status.name %></td>
|
||||
<td><%= format_date(relation.other_issue(@issue).start_date) %></td>
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
<%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br />
|
||||
<% if @project %>
|
||||
<%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br />
|
||||
<%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %>
|
||||
<%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %><br />
|
||||
<% end %>
|
||||
<%= call_hook(:view_issues_sidebar_issues_bottom) %>
|
||||
|
||||
<% planning_links = []
|
||||
planning_links << link_to(l(:label_calendar), :action => 'calendar', :project_id => @project) if User.current.allowed_to?(:view_calendar, @project, :global => true)
|
||||
planning_links << link_to(l(:label_gantt), :action => 'gantt', :project_id => @project) if User.current.allowed_to?(:view_gantt, @project, :global => true)
|
||||
%>
|
||||
<% unless planning_links.empty? %>
|
||||
<h3><%= l(:label_planning) %></h3>
|
||||
<p><%= planning_links.join(' | ') %></p>
|
||||
<%= call_hook(:view_issues_sidebar_planning_bottom) %>
|
||||
<% end %>
|
||||
|
||||
<% unless sidebar_queries.empty? -%>
|
||||
@@ -11,4 +22,5 @@
|
||||
<% sidebar_queries.each do |query| -%>
|
||||
<%= link_to query.name, :controller => 'issues', :action => 'index', :project_id => @project, :query_id => query %><br />
|
||||
<% end -%>
|
||||
<%= call_hook(:view_issues_sidebar_queries_bottom) %>
|
||||
<% end -%>
|
||||
|
||||
55
app/views/issues/calendar.rhtml
Normal file
55
app/views/issues/calendar.rhtml
Normal file
@@ -0,0 +1,55 @@
|
||||
<% form_tag({}, :id => 'query_form') do %>
|
||||
<% if @query.new_record? %>
|
||||
<h2><%= l(:label_calendar) %></h2>
|
||||
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<h2><%=h @query.name %></h2>
|
||||
<% html_title @query.name %>
|
||||
<% end %>
|
||||
|
||||
<fieldset id="date-range"><legend><%= l(:label_date_range) %></legend>
|
||||
<%= select_month(@month, :prefix => "month", :discard_type => true) %>
|
||||
<%= select_year(@year, :prefix => "year", :discard_type => true) %>
|
||||
</fieldset>
|
||||
|
||||
<p style="float:right; margin:0px;">
|
||||
<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
|
||||
{: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 ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'),
|
||||
{: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))}
|
||||
%>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<%= link_to_remote l(:button_apply),
|
||||
{ :url => { :set_filter => (@query.new_record? ? 1 : nil) },
|
||||
:update => "content",
|
||||
:with => "Form.serialize('query_form')"
|
||||
}, :class => 'icon icon-checked' %>
|
||||
|
||||
<%= link_to_remote l(:button_clear),
|
||||
{ :url => { :set_filter => (@query.new_record? ? 1 : nil) },
|
||||
:update => "content",
|
||||
}, :class => 'icon icon-reload' if @query.new_record? %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for 'query' %>
|
||||
<% if @query.valid? %>
|
||||
<%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
|
||||
|
||||
<%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br />
|
||||
<%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br />
|
||||
<%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br />
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_calendar)) -%>
|
||||
@@ -1,12 +1,12 @@
|
||||
<%
|
||||
pdf=IfpdfHelper::IFPDF.new(current_language)
|
||||
pdf.SetTitle("#{@project.name} - #{l(:label_gantt)}")
|
||||
pdf.SetTitle("#{l(:label_gantt)} #{@project}")
|
||||
pdf.AliasNbPages
|
||||
pdf.footer_date = format_date(Date.today)
|
||||
pdf.AddPage("L")
|
||||
pdf.SetFontStyle('B',12)
|
||||
pdf.SetX(15)
|
||||
pdf.Cell(70, 20, @project.name)
|
||||
pdf.Cell(70, 20, @project.to_s)
|
||||
pdf.Ln
|
||||
pdf.SetFontStyle('B',9)
|
||||
|
||||
@@ -17,17 +17,17 @@ headers_heigth = header_heigth
|
||||
show_weeks = false
|
||||
show_days = false
|
||||
|
||||
if @months < 7
|
||||
if @gantt.months < 7
|
||||
show_weeks = true
|
||||
headers_heigth = 2*header_heigth
|
||||
if @months < 3
|
||||
if @gantt.months < 3
|
||||
show_days = true
|
||||
headers_heigth = 3*header_heigth
|
||||
end
|
||||
end
|
||||
|
||||
g_width = 210
|
||||
zoom = (g_width) / (@date_to - @date_from + 1)
|
||||
zoom = (g_width) / (@gantt.date_to - @gantt.date_from + 1)
|
||||
g_height = 120
|
||||
t_height = g_height + headers_heigth
|
||||
|
||||
@@ -37,10 +37,10 @@ y_start = pdf.GetY
|
||||
#
|
||||
# Months headers
|
||||
#
|
||||
month_f = @date_from
|
||||
month_f = @gantt.date_from
|
||||
left = subject_width
|
||||
height = header_heigth
|
||||
@months.times do
|
||||
@gantt.months.times do
|
||||
width = ((month_f >> 1) - month_f) * zoom
|
||||
pdf.SetY(y_start)
|
||||
pdf.SetX(left)
|
||||
@@ -55,20 +55,20 @@ end
|
||||
if show_weeks
|
||||
left = subject_width
|
||||
height = header_heigth
|
||||
if @date_from.cwday == 1
|
||||
# @date_from is monday
|
||||
week_f = @date_from
|
||||
if @gantt.date_from.cwday == 1
|
||||
# @gantt.date_from is monday
|
||||
week_f = @gantt.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
|
||||
# find next monday after @gantt.date_from
|
||||
week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
|
||||
width = (7 - @gantt.date_from.cwday + 1) * zoom-1
|
||||
pdf.SetY(y_start + header_heigth)
|
||||
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
|
||||
while week_f <= @gantt.date_to
|
||||
width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom : (@gantt.date_to - week_f + 1) * zoom
|
||||
pdf.SetY(y_start + header_heigth)
|
||||
pdf.SetX(left)
|
||||
pdf.Cell(width, height, (width >= 5 ? week_f.cweek.to_s : ""), "LTR", 0, "C")
|
||||
@@ -83,9 +83,9 @@ end
|
||||
if show_days
|
||||
left = subject_width
|
||||
height = header_heigth
|
||||
wday = @date_from.cwday
|
||||
wday = @gantt.date_from.cwday
|
||||
pdf.SetFontStyle('B',7)
|
||||
(@date_to - @date_from + 1).to_i.times do
|
||||
(@gantt.date_to - @gantt.date_from + 1).to_i.times do
|
||||
width = zoom
|
||||
pdf.SetY(y_start + 2 * header_heigth)
|
||||
pdf.SetX(left)
|
||||
@@ -106,7 +106,7 @@ pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
|
||||
#
|
||||
top = headers_heigth + y_start
|
||||
pdf.SetFontStyle('B',7)
|
||||
@events.each do |i|
|
||||
@gantt.events.each do |i|
|
||||
pdf.SetY(top)
|
||||
pdf.SetX(15)
|
||||
|
||||
@@ -123,16 +123,16 @@ pdf.SetFontStyle('B',7)
|
||||
pdf.SetY(top+1.5)
|
||||
|
||||
if i.is_a? Issue
|
||||
i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
|
||||
i_end_date = (i.due_before <= @date_to ? i.due_before : @date_to )
|
||||
i_start_date = (i.start_date >= @gantt.date_from ? i.start_date : @gantt.date_from )
|
||||
i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to )
|
||||
|
||||
i_done_date = i.start_date + ((i.due_before - i.start_date+1)*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_done_date = (i_done_date <= @gantt.date_from ? @gantt.date_from : i_done_date )
|
||||
i_done_date = (i_done_date >= @gantt.date_to ? @gantt.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_left = ((i_start_date - @gantt.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
|
||||
@@ -159,7 +159,7 @@ pdf.SetFontStyle('B',7)
|
||||
pdf.SetX(subject_width + i_left + i_width)
|
||||
pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")
|
||||
else
|
||||
i_left = ((i.start_date - @date_from)*zoom)
|
||||
i_left = ((i.start_date - @gantt.date_from)*zoom)
|
||||
|
||||
pdf.SetX(subject_width + i_left)
|
||||
pdf.SetFillColor(50,200,50)
|
||||
@@ -1,5 +1,53 @@
|
||||
<% form_tag(params.merge(:month => nil, :year => nil, :months => nil), :id => 'query_form') do %>
|
||||
<% if @query.new_record? %>
|
||||
<h2><%=l(:label_gantt)%></h2>
|
||||
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<h2><%=h @query.name %></h2>
|
||||
<% html_title @query.name %>
|
||||
<% end %>
|
||||
|
||||
<fieldset id="date-range"><legend><%= l(:label_date_range) %></legend>
|
||||
<%= text_field_tag 'months', @gantt.months, :size => 2 %>
|
||||
<%= l(:label_months_from) %>
|
||||
<%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
|
||||
<%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
|
||||
<%= hidden_field_tag 'zoom', @gantt.zoom %>
|
||||
</fieldset>
|
||||
|
||||
<p style="float:right; margin:0px;">
|
||||
<%= if @gantt.zoom < 4
|
||||
link_to_remote image_tag('zoom_in.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom+1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom+1)))}
|
||||
else
|
||||
image_tag 'zoom_in_g.png'
|
||||
end %>
|
||||
<%= if @gantt.zoom > 1
|
||||
link_to_remote image_tag('zoom_out.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom-1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom-1)))}
|
||||
else
|
||||
image_tag 'zoom_out_g.png'
|
||||
end %>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<%= link_to_remote l(:button_apply),
|
||||
{ :url => { :set_filter => (@query.new_record? ? 1 : nil) },
|
||||
:update => "content",
|
||||
:with => "Form.serialize('query_form')"
|
||||
}, :class => 'icon icon-checked' %>
|
||||
|
||||
<%= link_to_remote l(:button_clear),
|
||||
{ :url => { :set_filter => (@query.new_record? ? 1 : nil) },
|
||||
:update => "content",
|
||||
}, :class => 'icon icon-reload' if @query.new_record? %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for 'query' %>
|
||||
<% if @query.valid? %>
|
||||
<% zoom = 1
|
||||
@zoom.times { zoom = zoom * 2 }
|
||||
@gantt.zoom.times { zoom = zoom * 2 }
|
||||
|
||||
subject_width = 330
|
||||
header_heigth = 18
|
||||
@@ -8,56 +56,23 @@ headers_height = header_heigth
|
||||
show_weeks = false
|
||||
show_days = false
|
||||
|
||||
if @zoom >1
|
||||
if @gantt.zoom >1
|
||||
show_weeks = true
|
||||
headers_height = 2*header_heigth
|
||||
if @zoom > 2
|
||||
if @gantt.zoom > 2
|
||||
show_days = true
|
||||
headers_height = 3*header_heigth
|
||||
end
|
||||
end
|
||||
|
||||
g_width = (@date_to - @date_from + 1)*zoom
|
||||
g_height = [(20 * @events.length + 6)+150, 206].max
|
||||
g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
|
||||
g_height = [(20 * @gantt.events.length + 6)+150, 206].max
|
||||
t_height = g_height + headers_height
|
||||
%>
|
||||
|
||||
<div class="contextual">
|
||||
</div>
|
||||
|
||||
<h2><%= l(:label_gantt) %></h2>
|
||||
|
||||
<% form_tag(params.merge(:month => nil, :year => nil, :months => nil)) do %>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input type="text" name="months" size="2" value="<%= @months %>" />
|
||||
<%= 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" %>
|
||||
</td>
|
||||
|
||||
<td align="right">
|
||||
<%= if @zoom < 4
|
||||
link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]}
|
||||
else
|
||||
image_tag 'zoom_in_g.png'
|
||||
end %>
|
||||
<%= if @zoom > 1
|
||||
link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]}
|
||||
else
|
||||
image_tag 'zoom_out_g.png'
|
||||
end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<table width="100%" style="border:0; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="width:<%= subject_width %>px;">
|
||||
<td style="width:<%= subject_width %>px; padding:0px;">
|
||||
|
||||
<div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
|
||||
<div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
|
||||
@@ -67,7 +82,7 @@ t_height = g_height + headers_height
|
||||
# Tasks subjects
|
||||
#
|
||||
top = headers_height + 8
|
||||
@events.each do |i| %>
|
||||
@gantt.events.each do |i| %>
|
||||
<div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
|
||||
<% if i.is_a? Issue %>
|
||||
<%= h("#{i.project} -") unless @project && @project == i.project %>
|
||||
@@ -91,14 +106,14 @@ end %>
|
||||
#
|
||||
# Months headers
|
||||
#
|
||||
month_f = @date_from
|
||||
month_f = @gantt.date_from
|
||||
left = 0
|
||||
height = (show_weeks ? header_heigth : header_heigth + g_height)
|
||||
@months.times do
|
||||
@gantt.months.times do
|
||||
width = ((month_f >> 1) - month_f) * zoom - 1
|
||||
%>
|
||||
<div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
|
||||
<%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }, :title => "#{month_name(month_f.month)} #{month_f.year}"%>
|
||||
<%= link_to "#{month_f.year}-#{month_f.month}", @gantt.params.merge(:year => month_f.year, :month => month_f.month), :title => "#{month_name(month_f.month)} #{month_f.year}"%>
|
||||
</div>
|
||||
<%
|
||||
left = left + width + 1
|
||||
@@ -112,21 +127,21 @@ end %>
|
||||
if show_weeks
|
||||
left = 0
|
||||
height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
|
||||
if @date_from.cwday == 1
|
||||
if @gantt.date_from.cwday == 1
|
||||
# @date_from is monday
|
||||
week_f = @date_from
|
||||
week_f = @gantt.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
|
||||
week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
|
||||
width = (7 - @gantt.date_from.cwday + 1) * zoom-1
|
||||
%>
|
||||
<div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div>
|
||||
<%
|
||||
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
|
||||
while week_f <= @gantt.date_to
|
||||
width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom -1 : (@gantt.date_to - week_f + 1) * zoom-1
|
||||
%>
|
||||
<div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
|
||||
<small><%= week_f.cweek if width >= 16 %></small>
|
||||
@@ -144,8 +159,8 @@ end %>
|
||||
if show_days
|
||||
left = 0
|
||||
height = g_height + header_heigth - 1
|
||||
wday = @date_from.cwday
|
||||
(@date_to - @date_from + 1).to_i.times do
|
||||
wday = @gantt.date_from.cwday
|
||||
(@gantt.date_to - @gantt.date_from + 1).to_i.times do
|
||||
width = zoom - 1
|
||||
%>
|
||||
<div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr">
|
||||
@@ -163,18 +178,18 @@ end %>
|
||||
# Tasks
|
||||
#
|
||||
top = headers_height + 10
|
||||
@events.each do |i|
|
||||
@gantt.events.each do |i|
|
||||
if i.is_a? Issue
|
||||
i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
|
||||
i_end_date = (i.due_before <= @date_to ? i.due_before : @date_to )
|
||||
i_start_date = (i.start_date >= @gantt.date_from ? i.start_date : @gantt.date_from )
|
||||
i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to )
|
||||
|
||||
i_done_date = i.start_date + ((i.due_before - i.start_date+1)*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_done_date = (i_done_date <= @gantt.date_from ? @gantt.date_from : i_done_date )
|
||||
i_done_date = (i_done_date >= @gantt.date_to ? @gantt.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_left = ((i_start_date - @gantt.date_from)*zoom).floor
|
||||
i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders)
|
||||
d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width
|
||||
l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width
|
||||
@@ -195,7 +210,7 @@ top = headers_height + 10
|
||||
<%= render_issue_tooltip i %>
|
||||
</span></div>
|
||||
<% else
|
||||
i_left = ((i.start_date - @date_from)*zoom).floor
|
||||
i_left = ((i.start_date - @gantt.date_from)*zoom).floor
|
||||
%>
|
||||
<div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div>
|
||||
<div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
|
||||
@@ -210,8 +225,8 @@ end %>
|
||||
#
|
||||
# Today red line (excluded from cache)
|
||||
#
|
||||
if Date.today >= @date_from and Date.today <= @date_to %>
|
||||
<div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div>
|
||||
if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
|
||||
<div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@gantt.date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
@@ -221,29 +236,22 @@ if Date.today >= @date_from and Date.today <= @date_to %>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td>
|
||||
<td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td>
|
||||
<td align="left"><%= link_to_remote ('« ' + l(:label_previous)), {:url => @gantt.params_previous, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_previous)} %></td>
|
||||
<td align="right"><%= link_to_remote (l(:label_next) + ' »'), {:url => @gantt.params_next, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(@gantt.params_next)} %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<span><%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :format => 'pdf'}, :class => 'pdf' %></span>
|
||||
<%= content_tag('span', link_to('PNG', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :format => 'png'}, :class => 'image')) if respond_to?('gantt_image') %>
|
||||
<span><%= link_to 'PDF', @gantt.params.merge(:format => 'pdf'), :class => 'pdf' %></span>
|
||||
<% if @gantt.respond_to?('to_image') %>
|
||||
<span><%= link_to 'PNG', @gantt.params.merge(:format => 'png'), :class => 'image' %></span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end # query.valid? %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<h3><%= l(:label_gantt) %></h3>
|
||||
<% form_tag(params.merge(:tracker_ids => nil, :with_subprojects => nil), :method => :get) do %>
|
||||
<% @trackers.each do |tracker| %>
|
||||
<label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
|
||||
<% end %>
|
||||
<% if @project.active_children.any? %>
|
||||
<br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
|
||||
<%= hidden_field_tag 'with_subprojects', 0 %>
|
||||
<% end %>
|
||||
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
|
||||
<% end %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_gantt)) -%>
|
||||
@@ -79,7 +79,7 @@
|
||||
pdf.Ln
|
||||
for changeset in @issue.changesets
|
||||
pdf.SetFontStyle('B',8)
|
||||
pdf.Cell(190,5, format_time(changeset.committed_on) + " - " + changeset.committer)
|
||||
pdf.Cell(190,5, format_time(changeset.committed_on) + " - " + changeset.author.to_s)
|
||||
pdf.Ln
|
||||
unless changeset.comments.blank?
|
||||
pdf.SetFontStyle('',8)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<h2><%= @issue.tracker.name %> #<%= @issue.id %></h2>
|
||||
|
||||
<div class="issue <%= "status-#{@issue.status.position} priority-#{@issue.priority.position}" %>">
|
||||
<%= avatar(@issue.author, :size => "64") %>
|
||||
<h3><%=h @issue.subject %></h3>
|
||||
<p class="author">
|
||||
<%= authoring @issue.created_on, @issue.author %>.
|
||||
@@ -18,28 +19,28 @@
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="width:15%"><b><%=l(:field_status)%>:</b></td><td style="width:35%"><%= @issue.status.name %></td>
|
||||
<td style="width:15%"><b><%=l(:field_start_date)%>:</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>
|
||||
<td style="width:15%" class="status"><b><%=l(:field_status)%>:</b></td><td style="width:35%" class="status status-<%= @issue.status.name %>"><%= @issue.status.name %></td>
|
||||
<td style="width:15%" class="start-date"><b><%=l(:field_start_date)%>:</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><%=l(:field_priority)%>:</b></td><td><%= @issue.priority.name %></td>
|
||||
<td><b><%=l(:field_due_date)%>:</b></td><td><%= format_date(@issue.due_date) %></td>
|
||||
<td class="priority"><b><%=l(:field_priority)%>:</b></td><td class="priority priority-<%= @issue.priority.name %>"><%= @issue.priority.name %></td>
|
||||
<td class="due-date"><b><%=l(:field_due_date)%>:</b></td><td class="due-date"><%= format_date(@issue.due_date) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><%=l(:field_assigned_to)%>:</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
|
||||
<td><b><%=l(:field_done_ratio)%>:</b></td><td><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td>
|
||||
<td class="assigned-to"><b><%=l(:field_assigned_to)%>:</b></td><td><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
|
||||
<td class="progress"><b><%=l(:field_done_ratio)%>:</b></td><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><%=l(:field_category)%>:</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
|
||||
<td class="category"><b><%=l(:field_category)%>:</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
|
||||
<% if User.current.allowed_to?(:view_time_entries, @project) %>
|
||||
<td><b><%=l(:label_spent_time)%>:</b></td>
|
||||
<td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
|
||||
<td class="spent-time"><b><%=l(:label_spent_time)%>:</b></td>
|
||||
<td class="spent-hours"><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><%=l(:field_fixed_version)%>:</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
|
||||
<td class="fixed-version"><b><%=l(:field_fixed_version)%>:</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
|
||||
<% if @issue.estimated_hours %>
|
||||
<td><b><%=l(:field_estimated_hours)%>:</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td>
|
||||
<td class="estimated-hours"><b><%=l(:field_estimated_hours)%>:</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= stylesheet_link_tag 'application', :media => 'all' %>
|
||||
<%= javascript_include_tag :defaults, :cache => true %>
|
||||
<%= stylesheet_link_tag 'jstoolbar' %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= heads_for_wiki_formatter %>
|
||||
<!--[if IE]>
|
||||
<style type="text/css">
|
||||
* html body{ width: expression( document.documentElement.clientWidth < 900 ? '900px' : '100%' ); }
|
||||
@@ -62,5 +62,6 @@
|
||||
Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> © 2006-2008 Jean-Philippe Lang
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -32,6 +32,6 @@ hr {
|
||||
<body>
|
||||
<%= yield %>
|
||||
<hr />
|
||||
<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.emails_footer) %></span>
|
||||
<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %></span>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
link_to(h(@board.name), {:controller => 'boards', :action => 'show', :project_id => @project, :id => @board}) %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= watcher_tag(@topic, User.current) %>
|
||||
<%= link_to_remote_if_authorized l(:button_quote), { :url => {:action => 'quote', :id => @topic} }, :class => 'icon icon-comment' %>
|
||||
<%= link_to_if_authorized l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'icon icon-edit' %>
|
||||
<%= link_to_if_authorized l(:button_delete), {:action => 'destroy', :id => @topic}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %>
|
||||
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'icon icon-edit') if @message.editable_by?(User.current) %>
|
||||
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') if @message.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
|
||||
<h2><%=h @topic.subject %></h2>
|
||||
@@ -24,8 +25,8 @@
|
||||
<a name="<%= "message-#{message.id}" %>"></a>
|
||||
<div class="contextual">
|
||||
<%= link_to_remote_if_authorized image_tag('comment.png'), { :url => {:action => 'quote', :id => message} }, :title => l(:button_quote) %>
|
||||
<%= link_to_if_authorized image_tag('edit.png'), {:action => 'edit', :id => message}, :title => l(:button_edit) %>
|
||||
<%= link_to_if_authorized image_tag('delete.png'), {:action => 'destroy', :id => message}, :method => :post, :confirm => l(:text_are_you_sure), :title => l(:button_delete) %>
|
||||
<%= link_to(image_tag('edit.png'), {:action => 'edit', :id => message}, :title => l(:button_edit)) if message.editable_by?(User.current) %>
|
||||
<%= link_to(image_tag('delete.png'), {:action => 'destroy', :id => message}, :method => :post, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) if message.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
<div class="message reply">
|
||||
<h4><%=h message.subject %> - <%= authoring message.created_on, message.author %></h4>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<% @project.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :project, value %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
||||
</div>
|
||||
|
||||
<% unless @trackers.empty? %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h2><%= l(:label_activity) %></h2>
|
||||
<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2>
|
||||
<p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p>
|
||||
|
||||
<div id="activity">
|
||||
@@ -6,7 +6,8 @@
|
||||
<h3><%= format_activity_day(day) %></h3>
|
||||
<dl>
|
||||
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
||||
<dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
|
||||
<dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
|
||||
<%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
|
||||
<span class="time"><%= format_time(e.event_datetime, false) %></span>
|
||||
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
|
||||
<%= link_to format_activity_title(e.event_title), e.event_url %></dt>
|
||||
@@ -21,24 +22,24 @@
|
||||
|
||||
<div style="float:left;">
|
||||
<%= link_to_remote(('« ' + l(:label_previous)),
|
||||
{:update => "content", :url => params.merge(:from => @date_to - @days), :complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(params.merge(:from => @date_to - @days)),
|
||||
{:update => "content", :url => params.merge(:from => @date_to - @days - 1), :complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(params.merge(:from => @date_to - @days - 1)),
|
||||
:title => "#{l(:label_date_from)} #{format_date(@date_to - 2*@days)} #{l(:label_date_to).downcase} #{format_date(@date_to - @days - 1)}"}) %>
|
||||
</div>
|
||||
<div style="float:right;">
|
||||
<%= link_to_remote((l(:label_next) + ' »'),
|
||||
{:update => "content", :url => params.merge(:from => @date_to + @days), :complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(params.merge(:from => @date_to + @days)),
|
||||
{:update => "content", :url => params.merge(:from => @date_to + @days - 1), :complete => 'window.scrollTo(0,0)'},
|
||||
{:href => url_for(params.merge(:from => @date_to + @days - 1)),
|
||||
:title => "#{l(:label_date_from)} #{format_date(@date_to)} #{l(:label_date_to).downcase} #{format_date(@date_to + @days - 1)}"}) unless @date_to >= Date.today %>
|
||||
</div>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<%= link_to 'Atom', params.merge(:format => :atom, :key => User.current.rss_key).delete_if{|k,v|k=="commit"}, :class => 'feed' %>
|
||||
<%= link_to 'Atom', params.merge(:format => :atom, :from => nil, :key => User.current.rss_key), :class => 'feed' %>
|
||||
</p>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :year => nil, :month => nil, :key => User.current.rss_key)) %>
|
||||
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
@@ -51,8 +52,9 @@
|
||||
<p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
|
||||
<%= hidden_field_tag 'with_subprojects', 0 %>
|
||||
<% end %>
|
||||
<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
|
||||
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_activity)) -%>
|
||||
<% html_title(l(:label_activity), @author) -%>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<h2><%= "#{month_name(@month)} #{@year}" %></h2>
|
||||
|
||||
<table width="100%">
|
||||
<tr><td align="left">
|
||||
<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
|
||||
{:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }},
|
||||
{:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])}
|
||||
%>
|
||||
</td><td align="right">
|
||||
<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'),
|
||||
{:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }},
|
||||
{:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])}
|
||||
%>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
|
||||
|
||||
<%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br />
|
||||
<%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br />
|
||||
<%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br />
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<h3><%= l(:label_calendar) %></h3>
|
||||
|
||||
<% form_tag({}, :method => :get) do %>
|
||||
<p><%= select_month(@month, :prefix => "month", :discard_type => true) %>
|
||||
<%= select_year(@year, :prefix => "year", :discard_type => true) %></p>
|
||||
|
||||
<% @trackers.each do |tracker| %>
|
||||
<label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
|
||||
<% end %>
|
||||
<% if @project.active_children.any? %>
|
||||
<br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
|
||||
<%= hidden_field_tag 'with_subprojects', 0 %>
|
||||
<% end %>
|
||||
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_calendar)) -%>
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= error_messages_for 'member' %>
|
||||
<% roles = Role.find_all_givable %>
|
||||
<% users = User.find_active(:all).sort - @project.users %>
|
||||
<% users = User.active.find(:all).sort - @project.users %>
|
||||
<% # members sorted by role position
|
||||
members = @project.members.find(:all, :include => [:role, :user]).sort %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header) %>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
@@ -31,7 +31,7 @@
|
||||
}, :title => l(:button_delete),
|
||||
:class => 'icon icon-del' %>
|
||||
</td>
|
||||
<%= call_hook(:view_projects_settings_members_table_row, :member => @member) %>
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end; reset_cycle %>
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
</div>
|
||||
|
||||
<div class="contextual">
|
||||
<% if @repository && !@repository.new_record? %>
|
||||
<%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %>
|
||||
<%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project},
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:method => :post,
|
||||
:class => 'icon icon-del') if @repository && !@repository.new_record? %>
|
||||
:class => 'icon icon-del') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="splitcontentleft">
|
||||
<%= textilizable @project.description %>
|
||||
<ul>
|
||||
<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %>
|
||||
<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= link_to(h(@project.homepage), @project.homepage) %></li><% end %>
|
||||
<% if @subprojects.any? %>
|
||||
<li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(h(p.name), :action => 'show', :id => p)}.join(", ") %></li>
|
||||
<% end %>
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<% planning_links = []
|
||||
planning_links << link_to_if_authorized(l(:label_calendar), :action => 'calendar', :id => @project)
|
||||
planning_links << link_to_if_authorized(l(:label_gantt), :action => 'gantt', :id => @project)
|
||||
planning_links << link_to_if_authorized(l(:label_calendar), :controller => 'issues', :action => 'calendar', :project_id => @project)
|
||||
planning_links << link_to_if_authorized(l(:label_gantt), :controller => 'issues', :action => 'gantt', :project_id => @project)
|
||||
planning_links.compact!
|
||||
unless planning_links.empty? %>
|
||||
<h3><%= l(:label_planning) %></h3>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
:class => (entry.is_dir? ? 'icon icon-folder' : 'icon icon-file')%>
|
||||
</td>
|
||||
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
|
||||
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
|
||||
<td class="revision"><%= link_to(format_revision(entry.lastrev.name), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
|
||||
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
|
||||
<td class="author"><%=h(entry.lastrev.author.to_s.split('<').first) if entry.lastrev %></td>
|
||||
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
|
||||
<td class="author"><%= changeset.nil? ? h(entry.lastrev.author.to_s.split('<').first) : changeset.author if entry.lastrev %></td>
|
||||
<td class="comments"><%=h truncate(changeset.comments, 50) unless changeset.nil? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
|
||||
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
|
||||
<td class="author"><%=h changeset.committer.to_s.split('<').first %></td>
|
||||
<td class="comments"><%= textilizable(changeset.comments) %></td>
|
||||
<td class="author"><%=h changeset.author %></td>
|
||||
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
|
||||
</tr>
|
||||
<% line_num += 1 %>
|
||||
<% end %>
|
||||
|
||||
29
app/views/repositories/committers.rhtml
Normal file
29
app/views/repositories/committers.rhtml
Normal file
@@ -0,0 +1,29 @@
|
||||
<h2><%= l(:label_repository) %></h2>
|
||||
|
||||
<%= simple_format(l(:text_repository_usernames_mapping)) %>
|
||||
|
||||
<% if @committers.empty? %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
|
||||
<% form_tag({}) do %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:field_login) %></th>
|
||||
<th><%= l(:label_user) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @committers.each do |committer, user_id| -%>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><%=h committer %></td>
|
||||
<td><%= select_tag "committers[#{committer}]", content_tag('option', "-- #{l :actionview_instancetag_blank_option} --", :value => '') + options_from_collection_for_select(@users, 'id', 'name', user_id.to_i) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><%= submit_tag(l(:button_update)) %></p>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
@@ -22,7 +22,7 @@
|
||||
<h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
|
||||
|
||||
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
|
||||
<em><%= @changeset.committer.to_s.split('<').first %>, <%= format_time(@changeset.committed_on) %></em></p>
|
||||
<span class="author"><%= authoring(@changeset.committed_on, @changeset.author) %></span></p>
|
||||
|
||||
<%= textilizable @changeset.comments %>
|
||||
|
||||
@@ -36,33 +36,19 @@
|
||||
<% end %>
|
||||
|
||||
<h3><%= l(:label_attachment_plural) %></h3>
|
||||
<div style="float:right;">
|
||||
<div class="square action_A"></div> <div style="float:left;"><%= l(:label_added) %> </div>
|
||||
<div class="square action_M"></div> <div style="float:left;"><%= l(:label_modified) %> </div>
|
||||
<div class="square action_D"></div> <div style="float:left;"><%= l(:label_deleted) %> </div>
|
||||
</div>
|
||||
<ul id="changes-legend">
|
||||
<li class="change change-A"><%= l(:label_added) %></li>
|
||||
<li class="change change-M"><%= l(:label_modified) %></li>
|
||||
<li class="change change-C"><%= l(:label_copied) %></li>
|
||||
<li class="change change-R"><%= l(:label_renamed) %></li>
|
||||
<li class="change change-D"><%= l(:label_deleted) %></li>
|
||||
</ul>
|
||||
|
||||
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
|
||||
<table class="list">
|
||||
<tbody>
|
||||
<% @changes.each do |change| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><div class="square action_<%= change.action %>"></div>
|
||||
<% if change.action == "D" -%>
|
||||
<%= change.path -%>
|
||||
<% else -%>
|
||||
<%= link_to change.path, :action => 'entry', :id => @project, :path => to_path_param(change.relative_path), :rev => @changeset.revision -%>
|
||||
<% end -%>
|
||||
<%= "(#{change.revision})" unless change.revision.blank? %></td>
|
||||
<td align="right">
|
||||
<% if change.action == "M" %>
|
||||
<%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => to_path_param(change.relative_path), :rev => @changeset.revision %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="pagination"><%= pagination_links_full @changes_pages %></p>
|
||||
|
||||
<div class="changeset-changes">
|
||||
<%= render_changeset_changes %>
|
||||
</div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
|
||||
@@ -16,4 +16,9 @@
|
||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||
<% end %>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
||||
</p>
|
||||
|
||||
<% html_title(l(:label_revision_plural)) -%>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div class="contextual">
|
||||
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
|
||||
<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %>
|
||||
|
||||
<% if !@entries.nil? && authorize_for('repositories', 'browse') -%>
|
||||
@@ -21,6 +22,10 @@
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
|
||||
<% end %>
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<span><%= link_to 'Atom', {:action => 'revisions', :id => @project, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
<div class="box" id="permissions">
|
||||
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<fieldset><legend><%= mod.blank? ? l(:label_project) : mod.humanize %></legend>
|
||||
<fieldset><legend><%= mod.blank? ? l(:label_project) : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= permission.name.to_s.humanize %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<% unless mod.blank? %>
|
||||
<tr><%= content_tag('th', mod.humanize, :colspan => (@roles.size + 1), :align => 'left') %></tr>
|
||||
<tr><%= content_tag('th', l_or_humanize(mod, :prefix => 'project_module_'), :colspan => (@roles.size + 1), :align => 'left') %></tr>
|
||||
<% end %>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= permission.name.to_s.humanize %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
|
||||
@@ -33,19 +33,23 @@
|
||||
<%= text_field_tag 'settings[activity_days_default]', Setting.activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p>
|
||||
|
||||
<p><label><%= l(:setting_host_name) %></label>
|
||||
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
|
||||
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %><br />
|
||||
<em><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p>
|
||||
|
||||
<p><label><%= l(:setting_protocol) %></label>
|
||||
<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p>
|
||||
|
||||
<p><label><%= l(:setting_text_formatting) %></label>
|
||||
<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p>
|
||||
<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], *Redmine::WikiFormatting.format_names.collect{|name| [name, name]} ], Setting.text_formatting.to_sym) %></p>
|
||||
|
||||
<p><label><%= l(:setting_wiki_compression) %></label>
|
||||
<%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p>
|
||||
|
||||
<p><label><%= l(:setting_feeds_limit) %></label>
|
||||
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
|
||||
|
||||
<p><label><%= l(:setting_gravatar_enabled) %></label>
|
||||
<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
|
||||
@@ -8,12 +8,16 @@
|
||||
<p><label><%= l(:setting_bcc_recipients) %></label>
|
||||
<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %>
|
||||
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
|
||||
|
||||
<p><label><%= l(:setting_plain_text_mail) %></label>
|
||||
<%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %>
|
||||
<%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p>
|
||||
</div>
|
||||
|
||||
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
|
||||
<% @notifiables.each do |notifiable| %>
|
||||
<label><%= check_box_tag 'settings[notified_events][]', notifiable, Setting.notified_events.include?(notifiable) %>
|
||||
<%= l_or_humanize(notifiable) %></label><br />
|
||||
<%= l_or_humanize(notifiable, :prefix => 'label_') %></label><br />
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'settings[notified_events][]', '' %>
|
||||
<p><%= check_all_links('notified_events') %></p>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<% @time_entry.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<% for tracker in @trackers %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td>
|
||||
<td align="center"><% unless tracker.workflows.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => "roles", :action => "workflow", :tracker_id => tracker} %>)</span><% end %></td>
|
||||
<td align="center"><% unless tracker.workflows.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td>
|
||||
<td align="center" style="width:15%;">
|
||||
<%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => tracker, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
|
||||
<%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => tracker, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
|
||||
<% form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label><%= l(:field_status) %> :</label>
|
||||
<label><%= l(:field_status) %>:</label>
|
||||
<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<label><%= l(:label_user) %>:</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
@@ -26,7 +29,7 @@
|
||||
<tbody>
|
||||
<% for user in @users -%>
|
||||
<tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>">
|
||||
<td class="username"><%= link_to h(user.login), :action => 'edit', :id => user %></td>
|
||||
<td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), :action => 'edit', :id => user %></td>
|
||||
<td class="firstname"><%= h(user.firstname) %></td>
|
||||
<td class="lastname"><%= h(user.lastname) %></td>
|
||||
<td class="email"><%= mail_to(h(user.mail)) %></td>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<% if version.completed? %>
|
||||
<p><%= format_date(version.effective_date) %></p>
|
||||
<% elsif version.overdue? %>
|
||||
<p><strong><%= l(:label_roadmap_overdue, distance_of_time_in_words(Time.now, version.effective_date)) %> (<%= format_date(version.effective_date) %>)</strong></p>
|
||||
<% elsif version.effective_date %>
|
||||
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
|
||||
<p><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</p>
|
||||
<% end %>
|
||||
|
||||
<p><%=h version.description %></p>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %>
|
||||
<% end %>
|
||||
<%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %>
|
||||
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %>
|
||||
</div>
|
||||
|
||||
<%= breadcrumb(@page.ancestors.reverse.collect {|parent| link_to h(parent.pretty_title), {:page => parent.title}}) %>
|
||||
|
||||
@@ -1,40 +1,47 @@
|
||||
<div class="contextual">
|
||||
<%= link_to l(:field_summary), :action => 'index' %>
|
||||
</div>
|
||||
|
||||
<h2><%=l(:label_workflow)%></h2>
|
||||
|
||||
<p><%=l(:text_workflow_edit)%>:</p>
|
||||
|
||||
<% form_tag({:action => 'workflow'}, :method => 'get') do %>
|
||||
<% form_tag({}, :method => 'get') do %>
|
||||
<p><label for="role_id"><%=l(:label_role)%>:</label>
|
||||
<select id="role_id" name="role_id">
|
||||
<select name="role_id">
|
||||
<%= options_from_collection_for_select @roles, "id", "name", (@role.id unless @role.nil?) %>
|
||||
</select>
|
||||
|
||||
<label for="tracker_id"><%=l(:label_tracker)%>:</label>
|
||||
<select id="tracker_id" name="tracker_id">
|
||||
<select name="tracker_id">
|
||||
<%= options_from_collection_for_select @trackers, "id", "name", (@tracker.id unless @tracker.nil?) %>
|
||||
</select>
|
||||
<%= submit_tag l(:button_edit) %>
|
||||
<%= submit_tag l(:button_edit), :name => nil %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
<% unless @tracker.nil? or @role.nil? %>
|
||||
<% form_tag({:action => 'workflow', :role_id => @role, :tracker_id => @tracker }, :id => 'workflow_form' ) do %>
|
||||
<div class="box">
|
||||
<table>
|
||||
<% unless @tracker.nil? or @role.nil? or @statuses.empty? %>
|
||||
<% form_tag({}, :id => 'workflow_form' ) do %>
|
||||
<%= hidden_field_tag 'tracker_id', @tracker.id %>
|
||||
<%= hidden_field_tag 'role_id', @role.id %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center"><strong><%=l(:label_current_status)%></strong></td>
|
||||
<td align="center" colspan="<%= @statuses.length %>"><strong><%=l(:label_new_statuses_allowed)%></strong></td>
|
||||
<th align="left"><%=l(:label_current_status)%></th>
|
||||
<th align="center" colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<% for new_status in @statuses %>
|
||||
<td width="80" align="center"><%= new_status.name %></td>
|
||||
<td width="<%= 75 / @statuses.size %>%" align="center"><%= new_status.name %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for old_status in @statuses %>
|
||||
<tr>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= old_status.name %></td>
|
||||
<% new_status_ids_allowed = old_status.find_new_statuses_allowed_to(@role, @tracker).collect(&:id) -%>
|
||||
<% for new_status in @statuses -%>
|
||||
@@ -42,14 +49,15 @@
|
||||
<input type="checkbox"
|
||||
name="issue_status[<%= old_status.id %>][]"
|
||||
value="<%= new_status.id %>"
|
||||
<%= 'checked="checked"' if new_status_ids_allowed.include? new_status.id %>>
|
||||
<%= 'checked="checked"' if new_status_ids_allowed.include? new_status.id %> />
|
||||
</td>
|
||||
<% end -%>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<p><%= check_all_links 'workflow_form' %></p>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><%= check_all_links 'workflow_form' %></p>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
|
||||
31
app/views/workflows/index.rhtml
Normal file
31
app/views/workflows/index.rhtml
Normal file
@@ -0,0 +1,31 @@
|
||||
<h2><%=l(:label_workflow)%></h2>
|
||||
|
||||
<% if @workflow_counts.empty? %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<% @workflow_counts.first.last.each do |role, count| %>
|
||||
<th>
|
||||
<%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %>
|
||||
</th>
|
||||
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @workflow_counts.each do |tracker, roles| -%>
|
||||
<tr class="<%= cycle('odd', 'even') %>">
|
||||
<td><%= h tracker %></td>
|
||||
<% roles.each do |role, count| -%>
|
||||
<td align="center">
|
||||
<%= link_to((count > 1 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role, :tracker_id => tracker}, :title => l(:button_edit)) %>
|
||||
</td>
|
||||
<% end -%>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
@@ -1,7 +1,7 @@
|
||||
# Don't change this file!
|
||||
# Configure your app in config/environment.rb and config/environments/*.rb
|
||||
|
||||
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
||||
RAILS_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(RAILS_ROOT)
|
||||
|
||||
module Rails
|
||||
class << self
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# ENV['RAILS_ENV'] ||= 'production'
|
||||
|
||||
# Specifies gem version of Rails to use when vendor/rails is not present
|
||||
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
|
||||
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION
|
||||
|
||||
# Bootstrap the Rails environment, frameworks, and default configuration
|
||||
require File.join(File.dirname(__FILE__), 'boot')
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
Mime::SET << Mime::CSV unless Mime::SET.include?(Mime::CSV)
|
||||
Mime::Type.register 'application/pdf', :pdf
|
||||
Mime::Type.register 'image/png', :png
|
||||
|
||||
@@ -6,6 +6,11 @@ ActionController::Routing::Routes.draw do |map|
|
||||
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
||||
# Keep in mind you can assign values other than :controller and :action
|
||||
|
||||
# Allow Redmine plugins to map routes and potentially override them
|
||||
Rails.plugins.each do |plugin|
|
||||
map.from_plugin plugin.name.to_sym
|
||||
end
|
||||
|
||||
map.home '', :controller => 'welcome'
|
||||
map.signin 'login', :controller => 'account', :action => 'login'
|
||||
map.signout 'logout', :controller => 'account', :action => 'logout'
|
||||
|
||||
@@ -46,6 +46,8 @@ mail_from:
|
||||
default: redmine@example.net
|
||||
bcc_recipients:
|
||||
default: 1
|
||||
plain_text_mail:
|
||||
default: 0
|
||||
text_formatting:
|
||||
default: textile
|
||||
wiki_compression:
|
||||
@@ -133,4 +135,5 @@ emails_footer:
|
||||
default: |-
|
||||
You have received this notification because you have either subscribed to it, or are involved in it.
|
||||
To change your notification preferences, please click here: http://hostname/my/account
|
||||
|
||||
gravatar_enabled:
|
||||
default: 0
|
||||
|
||||
14
db/migrate/096_add_commit_access_permission.rb
Normal file
14
db/migrate/096_add_commit_access_permission.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class AddCommitAccessPermission < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
Role.find(:all).select { |r| not r.builtin? }.each do |r|
|
||||
r.add_permission!(:commit_access)
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
Role.find(:all).select { |r| not r.builtin? }.each do |r|
|
||||
r.remove_permission!(:commit_access)
|
||||
end
|
||||
end
|
||||
end
|
||||
13
db/migrate/097_add_view_wiki_edits_permission.rb
Normal file
13
db/migrate/097_add_view_wiki_edits_permission.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class AddViewWikiEditsPermission < ActiveRecord::Migration
|
||||
def self.up
|
||||
Role.find(:all).each do |r|
|
||||
r.add_permission!(:view_wiki_edits) if r.has_permission?(:view_wiki_pages)
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
Role.find(:all).each do |r|
|
||||
r.remove_permission!(:view_wiki_edits)
|
||||
end
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user