-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class AccountController < ApplicationController\r
- layout 'base' \r
- helper :custom_fields\r
- include CustomFieldsHelper \r
- \r
- # prevents login action to be filtered by check_if_login_required application scope filter\r
- skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]\r
- before_filter :require_login, :only => :logout\r
-\r
- # Show user's account\r
- def show\r
- @user = User.find(params[:id])\r
- @custom_values = @user.custom_values.find(:all, :include => :custom_field)\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
- end\r
-\r
- # Login request and validation\r
- def login\r
- if request.get?\r
- # Logout user\r
- self.logged_in_user = nil\r
- else\r
- # Authenticate user\r
- user = User.try_to_login(params[:login], params[:password])\r
- if user\r
- self.logged_in_user = user\r
- redirect_back_or_default :controller => 'my', :action => 'page'\r
- else\r
- flash.now[:notice] = l(:notice_account_invalid_creditentials)\r
- end\r
- end\r
- end\r
-\r
- # Log out current user and redirect to welcome page\r
- def logout\r
- self.logged_in_user = nil\r
- redirect_to :controller => 'welcome'\r
- end\r
- \r
- # Enable user to choose a new password\r
- def lost_password\r
- redirect_to :controller => 'welcome' and return unless Setting.lost_password?\r
- if params[:token]\r
- @token = Token.find_by_action_and_value("recovery", params[:token])\r
- redirect_to :controller => 'welcome' and return unless @token and !@token.expired?\r
- @user = @token.user\r
- if request.post?\r
- @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]\r
- if @user.save\r
- @token.destroy\r
- flash[:notice] = l(:notice_account_password_updated)\r
- redirect_to :action => 'login'\r
- return\r
- end \r
- end\r
- render :template => "account/password_recovery"\r
- return\r
- else\r
- if request.post?\r
- user = User.find_by_mail(params[:mail])\r
- # user not found in db\r
- flash.now[:notice] = l(:notice_account_unknown_email) and return unless user\r
- # user uses an external authentification\r
- flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id\r
- # create a new token for password recovery\r
- token = Token.new(:user => user, :action => "recovery")\r
- if token.save\r
- Mailer.deliver_lost_password(token)\r
- flash[:notice] = l(:notice_account_lost_email_sent)\r
- redirect_to :action => 'login'\r
- return\r
- end\r
- end\r
- end\r
- end\r
- \r
- # User self-registration\r
- def register\r
- redirect_to :controller => 'welcome' and return unless Setting.self_registration?\r
- if params[:token]\r
- token = Token.find_by_action_and_value("register", params[:token])\r
- redirect_to :controller => 'welcome' and return unless token and !token.expired?\r
- user = token.user\r
- redirect_to :controller => 'welcome' and return unless user.status == User::STATUS_REGISTERED\r
- user.status = User::STATUS_ACTIVE\r
- if user.save\r
- token.destroy\r
- flash[:notice] = l(:notice_account_activated)\r
- redirect_to :action => 'login'\r
- return\r
- end \r
- else\r
- if request.get?\r
- @user = User.new(:language => Setting.default_language)\r
- @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }\r
- else\r
- @user = User.new(params[:user])\r
- @user.admin = false\r
- @user.login = params[:user][:login]\r
- @user.status = User::STATUS_REGISTERED\r
- @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]\r
- @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }\r
- @user.custom_values = @custom_values\r
- token = Token.new(:user => @user, :action => "register")\r
- if @user.save and token.save\r
- Mailer.deliver_register(token)\r
- flash[:notice] = l(:notice_account_register_done)\r
- redirect_to :controller => 'welcome' and return\r
- end\r
- end\r
- end\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class AccountController < ApplicationController
+ layout 'base'
+ helper :custom_fields
+ include CustomFieldsHelper
+
+ # prevents login action to be filtered by check_if_login_required application scope filter
+ skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
+ before_filter :require_login, :only => :logout
+
+ # Show user's account
+ def show
+ @user = User.find(params[:id])
+ @custom_values = @user.custom_values.find(:all, :include => :custom_field)
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ # Login request and validation
+ def login
+ if request.get?
+ # Logout user
+ self.logged_in_user = nil
+ else
+ # Authenticate user
+ user = User.try_to_login(params[:login], params[:password])
+ if user
+ self.logged_in_user = user
+ redirect_back_or_default :controller => 'my', :action => 'page'
+ else
+ flash.now[:notice] = l(:notice_account_invalid_creditentials)
+ end
+ end
+ end
+
+ # Log out current user and redirect to welcome page
+ def logout
+ self.logged_in_user = nil
+ redirect_to :controller => 'welcome'
+ end
+
+ # Enable user to choose a new password
+ def lost_password
+ redirect_to :controller => 'welcome' and return unless Setting.lost_password?
+ if params[:token]
+ @token = Token.find_by_action_and_value("recovery", params[:token])
+ redirect_to :controller => 'welcome' and return unless @token and !@token.expired?
+ @user = @token.user
+ if request.post?
+ @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
+ if @user.save
+ @token.destroy
+ flash[:notice] = l(:notice_account_password_updated)
+ redirect_to :action => 'login'
+ return
+ end
+ end
+ render :template => "account/password_recovery"
+ return
+ else
+ if request.post?
+ user = User.find_by_mail(params[:mail])
+ # user not found in db
+ flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
+ # user uses an external authentification
+ flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
+ # create a new token for password recovery
+ token = Token.new(:user => user, :action => "recovery")
+ if token.save
+ Mailer.deliver_lost_password(token)
+ flash[:notice] = l(:notice_account_lost_email_sent)
+ redirect_to :action => 'login'
+ return
+ end
+ end
+ end
+ end
+
+ # User self-registration
+ def register
+ redirect_to :controller => 'welcome' and return unless Setting.self_registration?
+ if params[:token]
+ token = Token.find_by_action_and_value("register", params[:token])
+ redirect_to :controller => 'welcome' and return unless token and !token.expired?
+ user = token.user
+ redirect_to :controller => 'welcome' and return unless user.status == User::STATUS_REGISTERED
+ user.status = User::STATUS_ACTIVE
+ if user.save
+ token.destroy
+ flash[:notice] = l(:notice_account_activated)
+ redirect_to :action => 'login'
+ return
+ end
+ else
+ if request.get?
+ @user = User.new(:language => Setting.default_language)
+ @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
+ else
+ @user = User.new(params[:user])
+ @user.admin = false
+ @user.login = params[:user][:login]
+ @user.status = User::STATUS_REGISTERED
+ @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
+ @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
+ @user.custom_values = @custom_values
+ token = Token.new(:user => @user, :action => "register")
+ if @user.save and token.save
+ Mailer.deliver_register(token)
+ flash[:notice] = l(:notice_account_register_done)
+ redirect_to :controller => 'welcome' and return
+ end
+ end
+ end
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class AdminController < ApplicationController\r
- layout 'base' \r
- before_filter :require_admin\r
-\r
- helper :sort\r
- include SortHelper \r
-\r
- def index \r
- end\r
- \r
- def projects\r
- sort_init 'name', 'asc'\r
- sort_update \r
- @project_count = Project.count \r
- @project_pages = Paginator.new self, @project_count,\r
- 15,\r
- params['page'] \r
- @projects = Project.find :all, :order => sort_clause,\r
- :limit => @project_pages.items_per_page,\r
- :offset => @project_pages.current.offset\r
-\r
- render :action => "projects", :layout => false if request.xhr?\r
- end\r
-\r
- def mail_options\r
- @actions = Permission.find(:all, :conditions => ["mail_option=?", true]) || []\r
- if request.post?\r
- @actions.each { |a|\r
- a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s \r
- a.save\r
- }\r
- flash.now[:notice] = l(:notice_successful_update)\r
- end\r
- end\r
- \r
- def info\r
- @db_adapter_name = ActiveRecord::Base.connection.adapter_name\r
- end \r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class AdminController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
+
+ helper :sort
+ include SortHelper
+
+ def index
+ end
+
+ def projects
+ sort_init 'name', 'asc'
+ sort_update
+ @project_count = Project.count
+ @project_pages = Paginator.new self, @project_count,
+ 15,
+ params['page']
+ @projects = Project.find :all, :order => sort_clause,
+ :limit => @project_pages.items_per_page,
+ :offset => @project_pages.current.offset
+
+ render :action => "projects", :layout => false if request.xhr?
+ end
+
+ def mail_options
+ @actions = Permission.find(:all, :conditions => ["mail_option=?", true]) || []
+ if request.post?
+ @actions.each { |a|
+ a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s
+ a.save
+ }
+ flash.now[:notice] = l(:notice_successful_update)
+ end
+ end
+
+ def info
+ @db_adapter_name = ActiveRecord::Base.connection.adapter_name
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class ApplicationController < ActionController::Base\r
- before_filter :check_if_login_required, :set_localization\r
- filter_parameter_logging :password\r
- \r
- def logged_in_user=(user)\r
- @logged_in_user = user\r
- session[:user_id] = (user ? user.id : nil)\r
- end\r
- \r
- def logged_in_user\r
- if session[:user_id]\r
- @logged_in_user ||= User.find(session[:user_id])\r
- else\r
- nil\r
- end\r
- end\r
- \r
- def logged_in_user_membership\r
- @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])\r
- end\r
- \r
- # check if login is globally required to access the application\r
- def check_if_login_required\r
- require_login if Setting.login_required?\r
- end \r
- \r
- def set_localization\r
- lang = begin\r
- if self.logged_in_user and self.logged_in_user.language and !self.logged_in_user.language.empty? and GLoc.valid_languages.include? self.logged_in_user.language.to_sym\r
- self.logged_in_user.language\r
- elsif request.env['HTTP_ACCEPT_LANGUAGE']\r
- accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first\r
- if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym\r
- accept_lang\r
- end\r
- end\r
- rescue\r
- nil\r
- end || Setting.default_language\r
- set_language_if_valid(lang) \r
- end\r
- \r
- def require_login\r
- unless self.logged_in_user\r
- store_location\r
- redirect_to :controller => "account", :action => "login"\r
- return false\r
- end\r
- true\r
- end\r
-\r
- def require_admin\r
- return unless require_login\r
- unless self.logged_in_user.admin?\r
- render :nothing => true, :status => 403\r
- return false\r
- end\r
- true\r
- end\r
-\r
- # authorizes the user for the requested action.\r
- def authorize(ctrl = params[:controller], action = params[:action])\r
- # check if action is allowed on public projects\r
- if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]\r
- return true\r
- end \r
- # if action is not public, force login\r
- return unless require_login \r
- # admin is always authorized\r
- return true if self.logged_in_user.admin?\r
- # if not admin, check membership permission \r
- @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id]) \r
- if @user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], @user_membership.role_id ) \r
- return true \r
- end \r
- render :nothing => true, :status => 403\r
- false\r
- end\r
- \r
- # make sure that the user is a member of the project (or admin) if project is private\r
- # used as a before_filter for actions that do not require any particular permission on the project\r
- def check_project_privacy\r
- return true if @project.is_public?\r
- return false unless logged_in_user\r
- return true if logged_in_user.admin? || logged_in_user_membership\r
- render :nothing => true, :status => 403\r
- false\r
- end\r
-\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class ApplicationController < ActionController::Base
+ before_filter :check_if_login_required, :set_localization
+ filter_parameter_logging :password
+
+ def logged_in_user=(user)
+ @logged_in_user = user
+ session[:user_id] = (user ? user.id : nil)
+ end
+
+ def logged_in_user
+ if session[:user_id]
+ @logged_in_user ||= User.find(session[:user_id])
+ else
+ nil
+ end
+ end
+
+ def logged_in_user_membership
+ @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
+ end
+
+ # check if login is globally required to access the application
+ def check_if_login_required
+ require_login if Setting.login_required?
+ end
+
+ def set_localization
+ lang = begin
+ if self.logged_in_user and self.logged_in_user.language and !self.logged_in_user.language.empty? and GLoc.valid_languages.include? self.logged_in_user.language.to_sym
+ self.logged_in_user.language
+ elsif request.env['HTTP_ACCEPT_LANGUAGE']
+ accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
+ if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
+ accept_lang
+ end
+ end
+ rescue
+ nil
+ end || Setting.default_language
+ set_language_if_valid(lang)
+ end
+
+ def require_login
+ unless self.logged_in_user
+ store_location
+ redirect_to :controller => "account", :action => "login"
+ return false
+ end
+ true
+ end
+
+ def require_admin
+ return unless require_login
+ unless self.logged_in_user.admin?
+ render :nothing => true, :status => 403
+ return false
+ end
+ true
+ end
+
+ # authorizes the user for the requested action.
+ def authorize(ctrl = params[:controller], action = params[:action])
+ # check if action is allowed on public projects
+ if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
+ return true
+ end
+ # if action is not public, force login
+ return unless require_login
+ # admin is always authorized
+ return true if self.logged_in_user.admin?
+ # if not admin, check membership permission
+ @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
+ if @user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], @user_membership.role_id )
+ return true
+ end
+ render :nothing => true, :status => 403
+ false
+ end
+
+ # make sure that the user is a member of the project (or admin) if project is private
+ # used as a before_filter for actions that do not require any particular permission on the project
+ def check_project_privacy
+ return true if @project.is_public?
+ return false unless logged_in_user
+ return true if logged_in_user.admin? || logged_in_user_membership
+ render :nothing => true, :status => 403
+ false
+ end
+
# store current uri in session.
# return to this location by calling redirect_back_or_default
def store_location
redirect_to session[:return_to_params]
session[:return_to_params] = nil
end
- end\r
- \r
- def render_404\r
- @html_title = "404"\r
- render :template => "common/404", :layout => true, :status => 404\r
- return false\r
end
-\r
- # qvalues http header parser\r
- # code taken from webrick\r
- def parse_qvalues(value)\r
- tmp = []\r
- if value\r
- parts = value.split(/,\s*/)\r
- parts.each {|part|\r
- if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)\r
- val = m[1]\r
- q = (m[2] or 1).to_f\r
- tmp.push([val, q])\r
- end\r
- }\r
- tmp = tmp.sort_by{|val, q| -q}\r
- tmp.collect!{|val, q| val}\r
- end\r
- return tmp\r
- end\r
+
+ def render_404
+ @html_title = "404"
+ render :template => "common/404", :layout => true, :status => 404
+ return false
+ end
+
+ # qvalues http header parser
+ # code taken from webrick
+ def parse_qvalues(value)
+ tmp = []
+ if value
+ parts = value.split(/,\s*/)
+ parts.each {|part|
+ if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
+ val = m[1]
+ q = (m[2] or 1).to_f
+ tmp.push([val, q])
+ end
+ }
+ tmp = tmp.sort_by{|val, q| -q}
+ tmp.collect!{|val, q| val}
+ end
+ return tmp
+ end
end
\ No newline at end of file
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class CustomFieldsController < ApplicationController\r
- layout 'base' \r
- before_filter :require_admin\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class CustomFieldsController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
def index
list
end
def list
- @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.type.to_s }\r
- @tab = params[:tab] || 'IssueCustomField'\r
+ @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.type.to_s }
+ @tab = params[:tab] || 'IssueCustomField'
render :action => "list", :layout => false if request.xhr?
end
- \r
- def new\r
- case params[:type]\r
- when "IssueCustomField" \r
- @custom_field = IssueCustomField.new(params[:custom_field])\r
- @custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]\r
- when "UserCustomField" \r
- @custom_field = UserCustomField.new(params[:custom_field])\r
- when "ProjectCustomField" \r
- @custom_field = ProjectCustomField.new(params[:custom_field])\r
- else\r
- redirect_to :action => 'list'\r
- return\r
- end \r
- if request.post? and @custom_field.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :action => 'list', :tab => @custom_field.type\r
- end\r
- @trackers = Tracker.find(:all, :order => 'position')\r
- end\r
-\r
- def edit\r
- @custom_field = CustomField.find(params[:id])\r
- if request.post? and @custom_field.update_attributes(params[:custom_field])\r
- if @custom_field.is_a? IssueCustomField\r
- @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []\r
- end\r
- flash[:notice] = l(:notice_successful_update)\r
- redirect_to :action => 'list', :tab => @custom_field.type\r
- end\r
- @trackers = Tracker.find(:all, :order => 'position')\r
- end\r
+
+ def new
+ case params[:type]
+ when "IssueCustomField"
+ @custom_field = IssueCustomField.new(params[:custom_field])
+ @custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]
+ when "UserCustomField"
+ @custom_field = UserCustomField.new(params[:custom_field])
+ when "ProjectCustomField"
+ @custom_field = ProjectCustomField.new(params[:custom_field])
+ else
+ redirect_to :action => 'list'
+ return
+ end
+ if request.post? and @custom_field.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :action => 'list', :tab => @custom_field.type
+ end
+ @trackers = Tracker.find(:all, :order => 'position')
+ end
+
+ def edit
+ @custom_field = CustomField.find(params[:id])
+ if request.post? and @custom_field.update_attributes(params[:custom_field])
+ if @custom_field.is_a? IssueCustomField
+ @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []
+ end
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to :action => 'list', :tab => @custom_field.type
+ end
+ @trackers = Tracker.find(:all, :order => 'position')
+ end
def destroy
- @custom_field = CustomField.find(params[:id]).destroy\r
- redirect_to :action => 'list', :tab => @custom_field.type\r
- rescue\r
- flash[:notice] = "Unable to delete custom field"\r
+ @custom_field = CustomField.find(params[:id]).destroy
+ redirect_to :action => 'list', :tab => @custom_field.type
+ rescue
+ flash[:notice] = "Unable to delete custom field"
redirect_to :action => 'list'
- end\r
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class DocumentsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- def show\r
+class DocumentsController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
+
+ def show
@attachments = @document.attachments.find(:all, :order => "created_on DESC")
end
- def edit\r
+ def edit
@categories = Enumeration::get_values('DCAT')
if request.post? and @document.update_attributes(params[:document])
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @document
end
- end \r
+ end
def destroy
@document.destroy
redirect_to :controller => 'projects', :action => 'list_documents', :id => @project
- end\r
-\r
- def download\r
- @attachment = @document.attachments.find(params[:attachment_id])\r
- @attachment.increment_download\r
- send_file @attachment.diskfile, :filename => @attachment.filename\r
- rescue\r
- render_404\r
- end \r
- \r
- def add_attachment\r
- # Save the attachments\r
- @attachments = []\r
- params[:attachments].each { |file|\r
- next unless file.size > 0\r
- a = Attachment.create(:container => @document, :file => file, :author => logged_in_user)\r
- @attachments << a unless a.new_record?\r
- } if params[:attachments] and params[:attachments].is_a? Array\r
- Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'show', :id => @document\r
- end\r
- \r
- def destroy_attachment\r
- @document.attachments.find(params[:attachment_id]).destroy\r
- redirect_to :action => 'show', :id => @document\r
end
-\r
-private\r
- def find_project\r
- @document = Document.find(params[:id])\r
- @project = @document.project\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
+
+ def download
+ @attachment = @document.attachments.find(params[:attachment_id])
+ @attachment.increment_download
+ send_file @attachment.diskfile, :filename => @attachment.filename
+ rescue
+ render_404
+ end
+
+ def add_attachment
+ # Save the attachments
+ @attachments = []
+ params[:attachments].each { |file|
+ next unless file.size > 0
+ a = Attachment.create(:container => @document, :file => file, :author => logged_in_user)
+ @attachments << a unless a.new_record?
+ } if params[:attachments] and params[:attachments].is_a? Array
+ Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'show', :id => @document
+ end
+
+ def destroy_attachment
+ @document.attachments.find(params[:attachment_id]).destroy
+ redirect_to :action => 'show', :id => @document
+ end
+
+private
+ def find_project
+ @document = Document.find(params[:id])
+ @project = @document.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class EnumerationsController < ApplicationController\r
- layout 'base'\r
- before_filter :require_admin\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class EnumerationsController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
def index
list
end
def destroy
- Enumeration.find(params[:id]).destroy\r
+ Enumeration.find(params[:id]).destroy
flash[:notice] = l(:notice_successful_delete)
- redirect_to :action => 'list'\r
- rescue\r
- flash[:notice] = "Unable to delete enumeration"\r
+ redirect_to :action => 'list'
+ rescue
+ flash[:notice] = "Unable to delete enumeration"
redirect_to :action => 'list'
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class HelpController < ApplicationController\r
-\r
- skip_before_filter :check_if_login_required\r
- before_filter :load_help_config\r
-\r
- # displays help page for the requested controller/action\r
- def index \r
- # select help page to display\r
- if params[:ctrl] and @help_config['pages'][params[:ctrl]]\r
- if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]\r
- template = @help_config['pages'][params[:ctrl]][params[:page]]\r
- else\r
- template = @help_config['pages'][params[:ctrl]]['index']\r
- end\r
- end\r
- # choose language according to available help translations\r
- lang = (@help_config['langs'].include? current_language.to_s) ? current_language.to_s : @help_config['langs'].first\r
- \r
- if template\r
- redirect_to "/manual/#{lang}/#{template}"\r
- else\r
- redirect_to "/manual/#{lang}/index.html"\r
- end\r
- end\r
-\r
-private\r
- def load_help_config\r
- @help_config = YAML::load(File.open("#{RAILS_ROOT}/config/help.yml"))\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class HelpController < ApplicationController
+
+ skip_before_filter :check_if_login_required
+ before_filter :load_help_config
+
+ # displays help page for the requested controller/action
+ def index
+ # select help page to display
+ if params[:ctrl] and @help_config['pages'][params[:ctrl]]
+ if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]
+ template = @help_config['pages'][params[:ctrl]][params[:page]]
+ else
+ template = @help_config['pages'][params[:ctrl]]['index']
+ end
+ end
+ # choose language according to available help translations
+ lang = (@help_config['langs'].include? current_language.to_s) ? current_language.to_s : @help_config['langs'].first
+
+ if template
+ redirect_to "/manual/#{lang}/#{template}"
+ else
+ redirect_to "/manual/#{lang}/index.html"
+ end
+ end
+
+private
+ def load_help_config
+ @help_config = YAML::load(File.open("#{RAILS_ROOT}/config/help.yml"))
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
class IssueCategoriesController < ApplicationController
- layout 'base'\r
- before_filter :find_project, :authorize\r
-\r
+ layout 'base'
+ before_filter :find_project, :authorize
+
def edit
if request.post? and @category.update_attributes(params[:category])
flash[:notice] = l(:notice_successful_update)
def destroy
@category.destroy
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project\r
- rescue\r
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
+ rescue
flash[:notice] = "Categorie can't be deleted"
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project\r
- end\r
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
+ end
-private\r
- def find_project\r
- @category = IssueCategory.find(params[:id])\r
- @project = @category.project\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
- end \r
+private
+ def find_project
+ @category = IssueCategory.find(params[:id])
+ @project = @category.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class IssueStatusesController < ApplicationController\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class IssueStatusesController < ApplicationController
layout 'base'
- before_filter :require_admin\r
-\r
- verify :method => :post, :only => [ :destroy, :create, :update, :move ],\r
- :redirect_to => { :action => :list }\r
- \r
+ before_filter :require_admin
+
+ verify :method => :post, :only => [ :destroy, :create, :update, :move ],
+ :redirect_to => { :action => :list }
+
def index
list
render :action => 'list' unless request.xhr?
end
def list
- @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"\r
+ @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"
render :action => "list", :layout => false if request.xhr?
end
else
render :action => 'edit'
end
- end\r
- \r
- def move\r
- @issue_status = IssueStatus.find(params[:id])\r
- case params[:position]\r
- when 'highest'\r
- @issue_status.move_to_top\r
- when 'higher'\r
- @issue_status.move_higher\r
- when 'lower'\r
- @issue_status.move_lower\r
- when 'lowest'\r
- @issue_status.move_to_bottom\r
- end if params[:position]\r
- redirect_to :action => 'list'\r
+ end
+
+ def move
+ @issue_status = IssueStatus.find(params[:id])
+ case params[:position]
+ when 'highest'
+ @issue_status.move_to_top
+ when 'higher'
+ @issue_status.move_higher
+ when 'lower'
+ @issue_status.move_lower
+ when 'lowest'
+ @issue_status.move_to_bottom
+ end if params[:position]
+ redirect_to :action => 'list'
end
def destroy
IssueStatus.find(params[:id]).destroy
- redirect_to :action => 'list'\r
- rescue\r
- flash[:notice] = "Unable to delete issue status"\r
+ redirect_to :action => 'list'
+ rescue
+ flash[:notice] = "Unable to delete issue status"
redirect_to :action => 'list'
end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class IssuesController < ApplicationController\r
- layout 'base', :except => :export_pdf\r
- before_filter :find_project, :authorize\r
-\r
- helper :custom_fields\r
- include CustomFieldsHelper\r
- helper :ifpdf\r
- include IfpdfHelper\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class IssuesController < ApplicationController
+ layout 'base', :except => :export_pdf
+ before_filter :find_project, :authorize
+
+ helper :custom_fields
+ include CustomFieldsHelper
+ helper :ifpdf
+ include IfpdfHelper
def show
- @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user\r
- @custom_values = @issue.custom_values.find(:all, :include => :custom_field)\r
- @journals_count = @issue.journals.count\r
- @journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "journals.created_on desc")\r
- end\r
- \r
- def history\r
- @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "journals.created_on desc")\r
- @journals_count = @journals.length \r
- end\r
- \r
- def export_pdf\r
- @custom_values = @issue.custom_values.find(:all, :include => :custom_field)\r
- @options_for_rfpdf ||= {}\r
- @options_for_rfpdf[:file_name] = "#{@project.name}_#{@issue.long_id}.pdf"\r
+ @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
+ @custom_values = @issue.custom_values.find(:all, :include => :custom_field)
+ @journals_count = @issue.journals.count
+ @journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "journals.created_on desc")
+ end
+
+ def history
+ @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "journals.created_on desc")
+ @journals_count = @journals.length
+ end
+
+ def export_pdf
+ @custom_values = @issue.custom_values.find(:all, :include => :custom_field)
+ @options_for_rfpdf ||= {}
+ @options_for_rfpdf[:file_name] = "#{@project.name}_#{@issue.long_id}.pdf"
end
- def edit\r
- @priorities = Enumeration::get_values('IPRI')\r
- if request.get?\r
- @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) }\r
- else\r
- begin\r
- @issue.init_journal(self.logged_in_user)\r
- # Retrieve custom fields and values\r
- @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }\r
- @issue.custom_values = @custom_values\r
- @issue.attributes = params[:issue]\r
+ def edit
+ @priorities = Enumeration::get_values('IPRI')
+ if request.get?
+ @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) }
+ else
+ begin
+ @issue.init_journal(self.logged_in_user)
+ # Retrieve custom fields and values
+ @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
+ @issue.custom_values = @custom_values
+ @issue.attributes = params[:issue]
if @issue.save
- flash[:notice] = l(:notice_successful_update)\r
+ flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @issue
- end\r
- rescue ActiveRecord::StaleObjectError\r
- # Optimistic locking exception\r
- flash[:notice] = l(:notice_locking_conflict)\r
- end\r
+ end
+ rescue ActiveRecord::StaleObjectError
+ # Optimistic locking exception
+ flash[:notice] = l(:notice_locking_conflict)
+ end
end
- end\r
- \r
- def add_note\r
- unless params[:notes].empty?\r
- journal = @issue.init_journal(self.logged_in_user, params[:notes])\r
- #@history = @issue.histories.build(params[:history])\r
- #@history.author_id = self.logged_in_user.id if self.logged_in_user\r
- #@history.status = @issue.status\r
- if @issue.save\r
- flash[:notice] = l(:notice_successful_update)\r
- Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'show', :id => @issue\r
- return\r
- end\r
- end\r
- show\r
- render :action => 'show'\r
- end\r
-\r
- def change_status\r
- #@history = @issue.histories.build(params[:history]) \r
- @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user\r
- @new_status = IssueStatus.find(params[:new_status_id])\r
- if params[:confirm]\r
- begin\r
- #@history.author_id = self.logged_in_user.id if self.logged_in_user\r
- #@issue.status = @history.status\r
- #@issue.fixed_version_id = (params[:issue][:fixed_version_id])\r
- #@issue.assigned_to_id = (params[:issue][:assigned_to_id])\r
- #@issue.done_ratio = (params[:issue][:done_ratio])\r
- #@issue.lock_version = (params[:issue][:lock_version])\r
- journal = @issue.init_journal(self.logged_in_user, params[:notes])\r
- @issue.status = @new_status\r
- if @issue.update_attributes(params[:issue])\r
- flash[:notice] = l(:notice_successful_update)\r
- Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'show', :id => @issue\r
- end\r
- rescue ActiveRecord::StaleObjectError\r
- # Optimistic locking exception\r
- flash[:notice] = l(:notice_locking_conflict)\r
- end\r
- end \r
- @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }\r
+ end
+
+ def add_note
+ unless params[:notes].empty?
+ journal = @issue.init_journal(self.logged_in_user, params[:notes])
+ #@history = @issue.histories.build(params[:history])
+ #@history.author_id = self.logged_in_user.id if self.logged_in_user
+ #@history.status = @issue.status
+ if @issue.save
+ flash[:notice] = l(:notice_successful_update)
+ Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'show', :id => @issue
+ return
+ end
+ end
+ show
+ render :action => 'show'
+ end
+
+ def change_status
+ #@history = @issue.histories.build(params[:history])
+ @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
+ @new_status = IssueStatus.find(params[:new_status_id])
+ if params[:confirm]
+ begin
+ #@history.author_id = self.logged_in_user.id if self.logged_in_user
+ #@issue.status = @history.status
+ #@issue.fixed_version_id = (params[:issue][:fixed_version_id])
+ #@issue.assigned_to_id = (params[:issue][:assigned_to_id])
+ #@issue.done_ratio = (params[:issue][:done_ratio])
+ #@issue.lock_version = (params[:issue][:lock_version])
+ journal = @issue.init_journal(self.logged_in_user, params[:notes])
+ @issue.status = @new_status
+ if @issue.update_attributes(params[:issue])
+ flash[:notice] = l(:notice_successful_update)
+ Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'show', :id => @issue
+ end
+ rescue ActiveRecord::StaleObjectError
+ # Optimistic locking exception
+ flash[:notice] = l(:notice_locking_conflict)
+ end
+ end
+ @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
end
def destroy
@issue.destroy
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project
- end\r
-\r
- def add_attachment\r
- # Save the attachments\r
- @attachments = []\r
- params[:attachments].each { |file|\r
- next unless file.size > 0\r
- a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user)\r
- @attachments << a unless a.new_record?\r
- } if params[:attachments] and params[:attachments].is_a? Array\r
- Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'show', :id => @issue\r
- end\r
-\r
- def destroy_attachment\r
- @issue.attachments.find(params[:attachment_id]).destroy\r
- redirect_to :action => 'show', :id => @issue\r
- end\r
-\r
- # Send the file in stream mode\r
- def download\r
- @attachment = @issue.attachments.find(params[:attachment_id])\r
- send_file @attachment.diskfile, :filename => @attachment.filename\r
- rescue\r
- render_404\r
- end\r
-\r
-private\r
- def find_project\r
- @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])\r
- @project = @issue.project\r
- @html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}"\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
+ end
+
+ def add_attachment
+ # Save the attachments
+ @attachments = []
+ params[:attachments].each { |file|
+ next unless file.size > 0
+ a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user)
+ @attachments << a unless a.new_record?
+ } if params[:attachments] and params[:attachments].is_a? Array
+ Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'show', :id => @issue
+ end
+
+ def destroy_attachment
+ @issue.attachments.find(params[:attachment_id]).destroy
+ redirect_to :action => 'show', :id => @issue
+ end
+
+ # Send the file in stream mode
+ def download
+ @attachment = @issue.attachments.find(params[:attachment_id])
+ send_file @attachment.diskfile, :filename => @attachment.filename
+ rescue
+ render_404
+ end
+
+private
+ def find_project
+ @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
+ @project = @issue.project
+ @html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}"
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
class MembersController < ApplicationController
- layout 'base'\r
- before_filter :find_project, :authorize\r
+ layout 'base'
+ before_filter :find_project, :authorize
def edit
- if request.post? and @member.update_attributes(params[:member])\r
+ if request.post? and @member.update_attributes(params[:member])
flash[:notice] = l(:notice_successful_update)
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project\r
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project
end
end
-\r
+
def destroy
- @member.destroy\r
+ @member.destroy
flash[:notice] = l(:notice_successful_delete)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project
- end\r
-\r
-private\r
- def find_project\r
- @member = Member.find(params[:id]) \r
- @project = @member.project\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
+ end
+
+private
+ def find_project
+ @member = Member.find(params[:id])
+ @project = @member.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class NewsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class NewsController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
def show
end
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @news
end
- end\r
- \r
- def add_comment\r
- @comment = Comment.new(params[:comment])\r
- @comment.author = logged_in_user\r
- if @news.comments << @comment\r
- flash[:notice] = l(:label_comment_added)\r
- redirect_to :action => 'show', :id => @news\r
- else\r
- render :action => 'show'\r
- end\r
end
-\r
- def destroy_comment\r
- @news.comments.find(params[:comment_id]).destroy\r
- redirect_to :action => 'show', :id => @news\r
- end\r
+
+ def add_comment
+ @comment = Comment.new(params[:comment])
+ @comment.author = logged_in_user
+ if @news.comments << @comment
+ flash[:notice] = l(:label_comment_added)
+ redirect_to :action => 'show', :id => @news
+ else
+ render :action => 'show'
+ end
+ end
+
+ def destroy_comment
+ @news.comments.find(params[:comment_id]).destroy
+ redirect_to :action => 'show', :id => @news
+ end
def destroy
@news.destroy
redirect_to :controller => 'projects', :action => 'list_news', :id => @project
- end\r
- \r
-private\r
- def find_project\r
- @news = News.find(params[:id])\r
- @project = @news.project\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
+ end
+
+private
+ def find_project
+ @news = News.find(params[:id])
+ @project = @news.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require 'csv'\r
-\r
-class ProjectsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize, :except => [ :index, :list, :add ]\r
- before_filter :require_admin, :only => [ :add, :destroy ]\r
-\r
- helper :sort\r
- include SortHelper\r
- helper :custom_fields\r
- include CustomFieldsHelper \r
- helper :ifpdf\r
- include IfpdfHelper\r
- helper IssuesHelper\r
- helper :queries\r
- include QueriesHelper\r
- \r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require 'csv'
+
+class ProjectsController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
+ before_filter :require_admin, :only => [ :add, :destroy ]
+
+ helper :sort
+ include SortHelper
+ helper :custom_fields
+ include CustomFieldsHelper
+ helper :ifpdf
+ include IfpdfHelper
+ helper IssuesHelper
+ helper :queries
+ include QueriesHelper
+
def index
list
render :action => 'list' unless request.xhr?
end
-\r
+
# Lists public projects
- def list\r
- sort_init 'name', 'asc'\r
- sort_update \r
- @project_count = Project.count(:all, :conditions => ["is_public=?", true]) \r
- @project_pages = Paginator.new self, @project_count,\r
- 15,\r
- params['page'] \r
- @projects = Project.find :all, :order => sort_clause,\r
- :conditions => ["is_public=?", true],\r
- :limit => @project_pages.items_per_page,\r
- :offset => @project_pages.current.offset\r
-\r
+ def list
+ sort_init 'name', 'asc'
+ sort_update
+ @project_count = Project.count(:all, :conditions => ["is_public=?", true])
+ @project_pages = Paginator.new self, @project_count,
+ 15,
+ params['page']
+ @projects = Project.find :all, :order => sort_clause,
+ :conditions => ["is_public=?", true],
+ :limit => @project_pages.items_per_page,
+ :offset => @project_pages.current.offset
+
render :action => "list", :layout => false if request.xhr?
- end\r
- \r
+ end
+
# Add a new project
- def add\r
- @custom_fields = IssueCustomField.find(:all)\r
- @root_projects = Project.find(:all, :conditions => "parent_id is null")\r
- @project = Project.new(params[:project])\r
- if request.get?\r
- @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }\r
- else\r
- @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]\r
- @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }\r
- @project.custom_values = @custom_values \r
- if params[:repository_enabled] && params[:repository_enabled] == "1"\r
- @project.repository = Repository.new\r
- @project.repository.attributes = params[:repository]\r
- end\r
- if "1" == params[:wiki_enabled]\r
- @project.wiki = Wiki.new\r
- @project.wiki.attributes = params[:wiki]\r
- end\r
+ def add
+ @custom_fields = IssueCustomField.find(:all)
+ @root_projects = Project.find(:all, :conditions => "parent_id is null")
+ @project = Project.new(params[:project])
+ if request.get?
+ @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
+ else
+ @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
+ @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
+ @project.custom_values = @custom_values
+ if params[:repository_enabled] && params[:repository_enabled] == "1"
+ @project.repository = Repository.new
+ @project.repository.attributes = params[:repository]
+ end
+ if "1" == params[:wiki_enabled]
+ @project.wiki = Wiki.new
+ @project.wiki.attributes = params[:wiki]
+ end
if @project.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'admin', :action => 'projects'\r
- end \r
- end \r
- end\r
- \r
- # Show @project\r
- def show\r
- @custom_values = @project.custom_values.find(:all, :include => :custom_field)\r
- @members = @project.members.find(:all, :include => [:user, :role])\r
- @subprojects = @project.children if @project.children.size > 0\r
- @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")\r
- @trackers = Tracker.find(:all, :order => 'position')\r
+ redirect_to :controller => 'admin', :action => 'projects'
+ end
+ end
+ end
+
+ # Show @project
+ def show
+ @custom_values = @project.custom_values.find(:all, :include => :custom_field)
+ @members = @project.members.find(:all, :include => [:user, :role])
+ @subprojects = @project.children if @project.children.size > 0
+ @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
+ @trackers = Tracker.find(:all, :order => 'position')
@open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false])
- @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])\r
+ @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
end
-\r
- def settings\r
- @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])\r
- @custom_fields = IssueCustomField.find(:all)\r
- @issue_category ||= IssueCategory.new\r
- @member ||= @project.members.new\r
- @roles = Role.find(:all, :order => 'position')\r
- @users = User.find_active(:all) - @project.users\r
- @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }\r
- end\r
- \r
- # Edit @project\r
- def edit\r
- if request.post?\r
- @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]\r
- if params[:custom_fields]\r
- @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }\r
- @project.custom_values = @custom_values\r
- end\r
- if params[:repository_enabled]\r
- case params[:repository_enabled]\r
- when "0"\r
- @project.repository = nil\r
- when "1"\r
- @project.repository ||= Repository.new\r
- @project.repository.update_attributes params[:repository]\r
- end\r
- end\r
- if params[:wiki_enabled]\r
- case params[:wiki_enabled]\r
- when "0"\r
- @project.wiki.destroy if @project.wiki\r
- when "1"\r
- @project.wiki ||= Wiki.new\r
- @project.wiki.update_attributes params[:wiki]\r
- end\r
- end \r
- @project.attributes = params[:project]\r
+
+ def settings
+ @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
+ @custom_fields = IssueCustomField.find(:all)
+ @issue_category ||= IssueCategory.new
+ @member ||= @project.members.new
+ @roles = Role.find(:all, :order => 'position')
+ @users = User.find_active(:all) - @project.users
+ @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
+ end
+
+ # Edit @project
+ def edit
+ if request.post?
+ @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
+ if params[:custom_fields]
+ @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
+ @project.custom_values = @custom_values
+ end
+ if params[:repository_enabled]
+ case params[:repository_enabled]
+ when "0"
+ @project.repository = nil
+ when "1"
+ @project.repository ||= Repository.new
+ @project.repository.update_attributes params[:repository]
+ end
+ end
+ if params[:wiki_enabled]
+ case params[:wiki_enabled]
+ when "0"
+ @project.wiki.destroy if @project.wiki
+ when "1"
+ @project.wiki ||= Wiki.new
+ @project.wiki.update_attributes params[:wiki]
+ end
+ end
+ @project.attributes = params[:project]
if @project.save
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'settings', :id => @project\r
- else\r
- settings\r
- render :action => 'settings'\r
- end\r
+ redirect_to :action => 'settings', :id => @project
+ else
+ settings
+ render :action => 'settings'
+ end
end
- end\r
-\r
+ end
+
# Delete @project
- def destroy\r
+ def destroy
if request.post? and params[:confirm]
@project.destroy
- redirect_to :controller => 'admin', :action => 'projects'\r
+ redirect_to :controller => 'admin', :action => 'projects'
+ end
+ end
+
+ # Add a new issue category to @project
+ def add_issue_category
+ if request.post?
+ @issue_category = @project.issue_categories.build(params[:issue_category])
+ if @issue_category.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :action => 'settings', :tab => 'categories', :id => @project
+ else
+ settings
+ render :action => 'settings'
+ end
+ end
+ end
+
+ # Add a new version to @project
+ def add_version
+ @version = @project.versions.build(params[:version])
+ if request.post? and @version.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :action => 'settings', :tab => 'versions', :id => @project
+ end
+ end
+
+ # Add a new member to @project
+ def add_member
+ @member = @project.members.build(params[:member])
+ if request.post?
+ if @member.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :action => 'settings', :tab => 'members', :id => @project
+ else
+ settings
+ render :action => 'settings'
+ end
+ end
+ end
+
+ # Show members list of @project
+ def list_members
+ @members = @project.members.find(:all)
+ end
+
+ # Add a new document to @project
+ def add_document
+ @categories = Enumeration::get_values('DCAT')
+ @document = @project.documents.build(params[:document])
+ if request.post? and @document.save
+ # Save the attachments
+ params[:attachments].each { |a|
+ Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0
+ } if params[:attachments] and params[:attachments].is_a? Array
+ flash[:notice] = l(:notice_successful_create)
+ Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'list_documents', :id => @project
end
- end\r
- \r
- # Add a new issue category to @project\r
- def add_issue_category\r
- if request.post?\r
- @issue_category = @project.issue_categories.build(params[:issue_category])\r
- if @issue_category.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :action => 'settings', :tab => 'categories', :id => @project\r
- else\r
- settings\r
- render :action => 'settings'\r
- end\r
- end\r
- end \r
- \r
- # Add a new version to @project\r
- def add_version\r
- @version = @project.versions.build(params[:version])\r
- if request.post? and @version.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :action => 'settings', :tab => 'versions', :id => @project\r
- end\r
- end\r
-\r
- # Add a new member to @project\r
- def add_member\r
- @member = @project.members.build(params[:member])\r
- if request.post?\r
- if @member.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :action => 'settings', :tab => 'members', :id => @project\r
- else \r
- settings\r
- render :action => 'settings'\r
- end\r
- end\r
- end\r
-\r
- # Show members list of @project\r
- def list_members\r
- @members = @project.members.find(:all)\r
- end\r
-\r
- # Add a new document to @project\r
- def add_document\r
- @categories = Enumeration::get_values('DCAT')\r
- @document = @project.documents.build(params[:document]) \r
- if request.post? and @document.save \r
- # Save the attachments\r
- params[:attachments].each { |a|\r
- Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0\r
- } if params[:attachments] and params[:attachments].is_a? Array\r
- flash[:notice] = l(:notice_successful_create)\r
- Mailer.deliver_document_add(@document) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'list_documents', :id => @project\r
- end\r
- end\r
- \r
+ end
+
# Show documents list of @project
- def list_documents\r
- @documents = @project.documents.find :all, :include => :category\r
- end\r
-\r
- # Add a new issue to @project\r
- def add_issue\r
- @tracker = Tracker.find(params[:tracker_id])\r
- @priorities = Enumeration::get_values('IPRI')\r
- @issue = Issue.new(:project => @project, :tracker => @tracker)\r
- if request.get?\r
- @issue.start_date = Date.today\r
- @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }\r
- else\r
- @issue.attributes = params[:issue]\r
- @issue.author_id = self.logged_in_user.id if self.logged_in_user\r
- # Multiple file upload\r
- @attachments = []\r
- params[:attachments].each { |a|\r
- @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0\r
- } if params[:attachments] and params[:attachments].is_a? Array\r
- @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }\r
- @issue.custom_values = @custom_values\r
- if @issue.save\r
- @attachments.each(&:save)\r
- flash[:notice] = l(:notice_successful_create)\r
- Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :action => 'list_issues', :id => @project\r
- end \r
- end \r
- end\r
-\r
- # Show filtered/sorted issues list of @project\r
- def list_issues\r
- sort_init 'issues.id', 'desc'\r
- sort_update\r
-\r
- retrieve_query\r
-\r
- @results_per_page_options = [ 15, 25, 50, 100 ]\r
- if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i\r
- @results_per_page = params[:per_page].to_i\r
- session[:results_per_page] = @results_per_page\r
- else\r
- @results_per_page = session[:results_per_page] || 25\r
- end\r
-\r
- if @query.valid?\r
- @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement) \r
- @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page'] \r
- @issues = Issue.find :all, :order => sort_clause,\r
- :include => [ :author, :status, :tracker, :project, :priority ],\r
- :conditions => @query.statement,\r
- :limit => @issue_pages.items_per_page,\r
- :offset => @issue_pages.current.offset \r
- end \r
- @trackers = Tracker.find :all, :order => 'position'\r
- render :layout => false if request.xhr?\r
- end\r
-\r
- # Export filtered/sorted issues list to CSV\r
- def export_issues_csv\r
- sort_init 'issues.id', 'desc'\r
- sort_update\r
-\r
- retrieve_query\r
- render :action => 'list_issues' and return unless @query.valid?\r
- \r
- @issues = Issue.find :all, :order => sort_clause,\r
- :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ],\r
- :conditions => @query.statement,\r
- :limit => Setting.issues_export_limit\r
-\r
- ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') \r
- export = StringIO.new\r
- CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|\r
- # csv header fields\r
- headers = [ "#", l(:field_status), \r
- l(:field_tracker),\r
- l(:field_priority),\r
- l(:field_subject),\r
- l(:field_author),\r
- l(:field_start_date),\r
- l(:field_due_date),\r
- l(:field_done_ratio),\r
- l(:field_created_on),\r
- l(:field_updated_on)\r
- ]\r
- for custom_field in @project.all_custom_fields\r
- headers << custom_field.name\r
- end \r
- csv << headers.collect {|c| ic.iconv(c) }\r
- # csv lines\r
- @issues.each do |issue|\r
- fields = [issue.id, issue.status.name, \r
- issue.tracker.name, \r
- issue.priority.name,\r
- issue.subject, \r
- issue.author.display_name,\r
- issue.start_date ? l_date(issue.start_date) : nil,\r
- issue.due_date ? l_date(issue.due_date) : nil,\r
- issue.done_ratio,\r
- l_datetime(issue.created_on), \r
- l_datetime(issue.updated_on)\r
- ]\r
- for custom_field in @project.all_custom_fields\r
- fields << (show_value issue.custom_value_for(custom_field))\r
- end\r
- csv << fields.collect {|c| ic.iconv(c.to_s) }\r
- end\r
- end\r
- export.rewind\r
- send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv')\r
- end\r
- \r
- # Export filtered/sorted issues to PDF\r
- def export_issues_pdf\r
- sort_init 'issues.id', 'desc'\r
- sort_update\r
-\r
- retrieve_query\r
- render :action => 'list_issues' and return unless @query.valid?\r
- \r
- @issues = Issue.find :all, :order => sort_clause,\r
- :include => [ :author, :status, :tracker, :priority ],\r
- :conditions => @query.statement,\r
- :limit => Setting.issues_export_limit\r
- \r
- @options_for_rfpdf ||= {}\r
- @options_for_rfpdf[:file_name] = "export.pdf"\r
- render :layout => false\r
- end\r
-\r
- def move_issues\r
- @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids]\r
- redirect_to :action => 'list_issues', :id => @project and return unless @issues\r
- @projects = []\r
- # find projects to which the user is allowed to move the issue\r
- @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)}\r
- # issue can be moved to any tracker\r
- @trackers = Tracker.find(:all)\r
- if request.post? and params[:new_project_id] and params[:new_tracker_id] \r
- new_project = Project.find(params[:new_project_id])\r
- new_tracker = Tracker.find(params[:new_tracker_id])\r
- @issues.each { |i|\r
- # project dependent properties\r
- unless i.project_id == new_project.id\r
- i.category = nil \r
- i.fixed_version = nil\r
- end\r
- # move the issue\r
- i.project = new_project\r
- i.tracker = new_tracker\r
- i.save\r
- }\r
- flash[:notice] = l(:notice_successful_update)\r
- redirect_to :action => 'list_issues', :id => @project\r
- end\r
- end\r
-\r
- def add_query\r
- @query = Query.new(params[:query])\r
- @query.project = @project\r
- @query.user = logged_in_user\r
- \r
- params[:fields].each do |field|\r
- @query.add_filter(field, params[:operators][field], params[:values][field])\r
- end if params[:fields]\r
- \r
- if request.post? and @query.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :controller => 'reports', :action => 'issue_report', :id => @project\r
- end \r
- render :layout => false if request.xhr?\r
- end\r
-\r
- # Add a news to @project\r
- def add_news\r
- @news = News.new(:project => @project)\r
- if request.post?\r
- @news.attributes = params[:news]\r
- @news.author_id = self.logged_in_user.id if self.logged_in_user\r
- if @news.save\r
- flash[:notice] = l(:notice_successful_create)\r
- redirect_to :action => 'list_news', :id => @project\r
- end\r
- end\r
- end\r
-\r
- # Show news list of @project\r
- def list_news\r
- @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"\r
- render :action => "list_news", :layout => false if request.xhr?\r
- end\r
-\r
- def add_file\r
- if request.post?\r
- @version = @project.versions.find_by_id(params[:version_id])\r
- # Save the attachments\r
- @attachments = []\r
- params[:attachments].each { |file|\r
- next unless file.size > 0\r
- a = Attachment.create(:container => @version, :file => file, :author => logged_in_user)\r
- @attachments << a unless a.new_record?\r
- } if params[:attachments] and params[:attachments].is_a? Array\r
- Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?\r
- redirect_to :controller => 'projects', :action => 'list_files', :id => @project\r
- end\r
- @versions = @project.versions\r
- end\r
- \r
- def list_files\r
- @versions = @project.versions\r
- end\r
- \r
- # Show changelog for @project\r
- def changelog\r
- @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')\r
- if request.get?\r
- @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }\r
- else\r
- @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array\r
- end\r
- @selected_tracker_ids ||= []\r
- @fixed_issues = @project.issues.find(:all, \r
- :include => [ :fixed_version, :status, :tracker ], \r
- :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],\r
- :order => "versions.effective_date DESC, issues.id DESC"\r
- ) unless @selected_tracker_ids.empty?\r
- @fixed_issues ||= []\r
- end\r
-\r
- def roadmap\r
- @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position')\r
- if request.get?\r
- @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }\r
- else\r
- @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array\r
- end\r
- @selected_tracker_ids ||= []\r
- @versions = @project.versions.find(:all,\r
- :conditions => [ "versions.effective_date>?", Date.today],\r
- :order => "versions.effective_date ASC"\r
- )\r
- end\r
- \r
- def activity\r
- if params[:year] and params[:year].to_i > 1900\r
- @year = params[:year].to_i\r
- if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13\r
- @month = params[:month].to_i\r
- end \r
- end\r
- @year ||= Date.today.year\r
- @month ||= Date.today.month\r
-\r
- @date_from = Date.civil(@year, @month, 1)\r
- @date_to = (@date_from >> 1)-1\r
- \r
- @events_by_day = {} \r
- \r
- unless params[:show_issues] == "0"\r
- @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i|\r
- @events_by_day[i.created_on.to_date] ||= []\r
- @events_by_day[i.created_on.to_date] << i\r
- }\r
- @show_issues = 1\r
- end\r
- \r
- unless params[:show_news] == "0"\r
- @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|\r
- @events_by_day[i.created_on.to_date] ||= []\r
- @events_by_day[i.created_on.to_date] << i\r
- }\r
- @show_news = 1 \r
- end\r
- \r
- unless params[:show_files] == "0"\r
- Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|\r
- @events_by_day[i.created_on.to_date] ||= []\r
- @events_by_day[i.created_on.to_date] << i\r
- }\r
- @show_files = 1 \r
- end\r
- \r
- unless params[:show_documents] == "0"\r
- @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|\r
- @events_by_day[i.created_on.to_date] ||= []\r
- @events_by_day[i.created_on.to_date] << i\r
- }\r
- Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|\r
- @events_by_day[i.created_on.to_date] ||= []\r
- @events_by_day[i.created_on.to_date] << i\r
- }\r
- @show_documents = 1 \r
- end\r
- \r
- render :layout => false if request.xhr?\r
- end\r
- \r
- def calendar\r
- if params[:year] and params[:year].to_i > 1900\r
- @year = params[:year].to_i\r
- if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13\r
- @month = params[:month].to_i\r
- end \r
- end\r
- @year ||= Date.today.year\r
- @month ||= Date.today.month\r
- \r
- @date_from = Date.civil(@year, @month, 1)\r
- @date_to = (@date_from >> 1)-1\r
- # start on monday\r
- @date_from = @date_from - (@date_from.cwday-1)\r
- # finish on sunday\r
- @date_to = @date_to + (7-@date_to.cwday) \r
- \r
- @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])\r
- render :layout => false if request.xhr?\r
- end \r
-\r
- def gantt\r
- if params[:year] and params[:year].to_i >0\r
- @year_from = params[:year].to_i\r
- if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12\r
- @month_from = params[:month].to_i\r
- else\r
- @month_from = 1\r
- end\r
- else\r
- @month_from ||= (Date.today << 1).month\r
- @year_from ||= (Date.today << 1).year\r
- end\r
- \r
- @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2\r
- @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6\r
- \r
- @date_from = Date.civil(@year_from, @month_from, 1)\r
- @date_to = (@date_from >> @months) - 1\r
- @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :assigned_to, :priority], :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)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])\r
- \r
- if params[:output]=='pdf'\r
- @options_for_rfpdf ||= {}\r
- @options_for_rfpdf[:file_name] = "gantt.pdf"\r
- render :template => "projects/gantt.rfpdf", :layout => false\r
- else\r
- render :template => "projects/gantt.rhtml"\r
- end\r
- end\r
- \r
- def search\r
- @question = params[:q] || ""\r
- @question.strip!\r
- @all_words = params[:all_words] || (params[:submit] ? false : true)\r
- @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents wiki) )\r
- if !@question.empty?\r
- # tokens must be at least 3 character long\r
- @tokens = @question.split.uniq.select {|w| w.length > 2 }\r
- # no more than 5 tokens to search for\r
- @tokens.slice! 5..-1 if @tokens.size > 5\r
- # strings used in sql like statement\r
- like_tokens = @tokens.collect {|w| "%#{w}%"}\r
- operator = @all_words ? " AND " : " OR "\r
- limit = 10\r
- @results = []\r
- @results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(issues.subject) like ? OR LOWER(issues.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues'\r
- @results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(news.title) like ? OR LOWER(news.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'\r
- @results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents'\r
- @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(wiki_pages.title) like ? OR LOWER(wiki_contents.text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')\r
- @question = @tokens.join(" ")\r
- end\r
- end\r
- \r
-private\r
- # Find project of id params[:id]\r
- # if not found, redirect to project list\r
- # Used as a before_filter\r
- def find_project\r
- @project = Project.find(params[:id])\r
- @html_title = @project.name\r
+ def list_documents
+ @documents = @project.documents.find :all, :include => :category
+ end
+
+ # Add a new issue to @project
+ def add_issue
+ @tracker = Tracker.find(params[:tracker_id])
+ @priorities = Enumeration::get_values('IPRI')
+ @issue = Issue.new(:project => @project, :tracker => @tracker)
+ if request.get?
+ @issue.start_date = Date.today
+ @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
+ else
+ @issue.attributes = params[:issue]
+ @issue.author_id = self.logged_in_user.id if self.logged_in_user
+ # Multiple file upload
+ @attachments = []
+ params[:attachments].each { |a|
+ @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0
+ } if params[:attachments] and params[:attachments].is_a? Array
+ @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
+ @issue.custom_values = @custom_values
+ if @issue.save
+ @attachments.each(&:save)
+ flash[:notice] = l(:notice_successful_create)
+ Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :action => 'list_issues', :id => @project
+ end
+ end
+ end
+
+ # Show filtered/sorted issues list of @project
+ def list_issues
+ sort_init 'issues.id', 'desc'
+ sort_update
+
+ retrieve_query
+
+ @results_per_page_options = [ 15, 25, 50, 100 ]
+ if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i
+ @results_per_page = params[:per_page].to_i
+ session[:results_per_page] = @results_per_page
+ else
+ @results_per_page = session[:results_per_page] || 25
+ end
+
+ if @query.valid?
+ @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
+ @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
+ @issues = Issue.find :all, :order => sort_clause,
+ :include => [ :author, :status, :tracker, :project, :priority ],
+ :conditions => @query.statement,
+ :limit => @issue_pages.items_per_page,
+ :offset => @issue_pages.current.offset
+ end
+ @trackers = Tracker.find :all, :order => 'position'
+ render :layout => false if request.xhr?
+ end
+
+ # Export filtered/sorted issues list to CSV
+ def export_issues_csv
+ sort_init 'issues.id', 'desc'
+ sort_update
+
+ retrieve_query
+ render :action => 'list_issues' and return unless @query.valid?
+
+ @issues = Issue.find :all, :order => sort_clause,
+ :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ],
+ :conditions => @query.statement,
+ :limit => Setting.issues_export_limit
+
+ ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
+ export = StringIO.new
+ CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
+ # csv header fields
+ headers = [ "#", l(:field_status),
+ l(:field_tracker),
+ l(:field_priority),
+ l(:field_subject),
+ l(:field_author),
+ l(:field_start_date),
+ l(:field_due_date),
+ l(:field_done_ratio),
+ l(:field_created_on),
+ l(:field_updated_on)
+ ]
+ for custom_field in @project.all_custom_fields
+ headers << custom_field.name
+ end
+ csv << headers.collect {|c| ic.iconv(c) }
+ # csv lines
+ @issues.each do |issue|
+ fields = [issue.id, issue.status.name,
+ issue.tracker.name,
+ issue.priority.name,
+ issue.subject,
+ issue.author.display_name,
+ issue.start_date ? l_date(issue.start_date) : nil,
+ issue.due_date ? l_date(issue.due_date) : nil,
+ issue.done_ratio,
+ l_datetime(issue.created_on),
+ l_datetime(issue.updated_on)
+ ]
+ for custom_field in @project.all_custom_fields
+ fields << (show_value issue.custom_value_for(custom_field))
+ end
+ csv << fields.collect {|c| ic.iconv(c.to_s) }
+ end
+ end
+ export.rewind
+ send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv')
+ end
+
+ # Export filtered/sorted issues to PDF
+ def export_issues_pdf
+ sort_init 'issues.id', 'desc'
+ sort_update
+
+ retrieve_query
+ render :action => 'list_issues' and return unless @query.valid?
+
+ @issues = Issue.find :all, :order => sort_clause,
+ :include => [ :author, :status, :tracker, :priority ],
+ :conditions => @query.statement,
+ :limit => Setting.issues_export_limit
+
+ @options_for_rfpdf ||= {}
+ @options_for_rfpdf[:file_name] = "export.pdf"
+ render :layout => false
+ end
+
+ def move_issues
+ @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids]
+ redirect_to :action => 'list_issues', :id => @project and return unless @issues
+ @projects = []
+ # find projects to which the user is allowed to move the issue
+ @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)}
+ # issue can be moved to any tracker
+ @trackers = Tracker.find(:all)
+ if request.post? and params[:new_project_id] and params[:new_tracker_id]
+ new_project = Project.find(params[:new_project_id])
+ new_tracker = Tracker.find(params[:new_tracker_id])
+ @issues.each { |i|
+ # project dependent properties
+ unless i.project_id == new_project.id
+ i.category = nil
+ i.fixed_version = nil
+ end
+ # move the issue
+ i.project = new_project
+ i.tracker = new_tracker
+ i.save
+ }
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to :action => 'list_issues', :id => @project
+ end
+ end
+
+ def add_query
+ @query = Query.new(params[:query])
+ @query.project = @project
+ @query.user = logged_in_user
+
+ params[:fields].each do |field|
+ @query.add_filter(field, params[:operators][field], params[:values][field])
+ end if params[:fields]
+
+ if request.post? and @query.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :controller => 'reports', :action => 'issue_report', :id => @project
+ end
+ render :layout => false if request.xhr?
+ end
+
+ # Add a news to @project
+ def add_news
+ @news = News.new(:project => @project)
+ if request.post?
+ @news.attributes = params[:news]
+ @news.author_id = self.logged_in_user.id if self.logged_in_user
+ if @news.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :action => 'list_news', :id => @project
+ end
+ end
+ end
+
+ # Show news list of @project
+ def list_news
+ @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
+ render :action => "list_news", :layout => false if request.xhr?
+ end
+
+ def add_file
+ if request.post?
+ @version = @project.versions.find_by_id(params[:version_id])
+ # Save the attachments
+ @attachments = []
+ params[:attachments].each { |file|
+ next unless file.size > 0
+ a = Attachment.create(:container => @version, :file => file, :author => logged_in_user)
+ @attachments << a unless a.new_record?
+ } if params[:attachments] and params[:attachments].is_a? Array
+ Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ redirect_to :controller => 'projects', :action => 'list_files', :id => @project
+ end
+ @versions = @project.versions
+ end
+
+ def list_files
+ @versions = @project.versions
+ end
+
+ # Show changelog for @project
+ def changelog
+ @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
+ if request.get?
+ @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
+ else
+ @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
+ end
+ @selected_tracker_ids ||= []
+ @fixed_issues = @project.issues.find(:all,
+ :include => [ :fixed_version, :status, :tracker ],
+ :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
+ :order => "versions.effective_date DESC, issues.id DESC"
+ ) unless @selected_tracker_ids.empty?
+ @fixed_issues ||= []
+ end
+
+ def roadmap
+ @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position')
+ if request.get?
+ @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
+ else
+ @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
+ end
+ @selected_tracker_ids ||= []
+ @versions = @project.versions.find(:all,
+ :conditions => [ "versions.effective_date>?", Date.today],
+ :order => "versions.effective_date ASC"
+ )
+ end
+
+ def activity
+ if params[:year] and params[:year].to_i > 1900
+ @year = params[:year].to_i
+ if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
+ @month = params[:month].to_i
+ end
+ end
+ @year ||= Date.today.year
+ @month ||= Date.today.month
+
+ @date_from = Date.civil(@year, @month, 1)
+ @date_to = (@date_from >> 1)-1
+
+ @events_by_day = {}
+
+ unless params[:show_issues] == "0"
+ @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ @show_issues = 1
+ end
+
+ unless params[:show_news] == "0"
+ @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ @show_news = 1
+ end
+
+ unless params[:show_files] == "0"
+ Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ @show_files = 1
+ end
+
+ unless params[:show_documents] == "0"
+ @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ @show_documents = 1
+ end
+
+ render :layout => false if request.xhr?
+ end
+
+ def calendar
+ if params[:year] and params[:year].to_i > 1900
+ @year = params[:year].to_i
+ if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
+ @month = params[:month].to_i
+ end
+ end
+ @year ||= Date.today.year
+ @month ||= Date.today.month
+
+ @date_from = Date.civil(@year, @month, 1)
+ @date_to = (@date_from >> 1)-1
+ # start on monday
+ @date_from = @date_from - (@date_from.cwday-1)
+ # finish on sunday
+ @date_to = @date_to + (7-@date_to.cwday)
+
+ @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])
+ render :layout => false if request.xhr?
+ end
+
+ def gantt
+ if params[:year] and params[:year].to_i >0
+ @year_from = params[:year].to_i
+ if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12
+ @month_from = params[:month].to_i
+ else
+ @month_from = 1
+ end
+ else
+ @month_from ||= (Date.today << 1).month
+ @year_from ||= (Date.today << 1).year
+ end
+
+ @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2
+ @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6
+
+ @date_from = Date.civil(@year_from, @month_from, 1)
+ @date_to = (@date_from >> @months) - 1
+ @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :assigned_to, :priority], :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)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])
+
+ if params[:output]=='pdf'
+ @options_for_rfpdf ||= {}
+ @options_for_rfpdf[:file_name] = "gantt.pdf"
+ render :template => "projects/gantt.rfpdf", :layout => false
+ else
+ render :template => "projects/gantt.rhtml"
+ end
+ end
+
+ def search
+ @question = params[:q] || ""
+ @question.strip!
+ @all_words = params[:all_words] || (params[:submit] ? false : true)
+ @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents wiki) )
+ if !@question.empty?
+ # tokens must be at least 3 character long
+ @tokens = @question.split.uniq.select {|w| w.length > 2 }
+ # no more than 5 tokens to search for
+ @tokens.slice! 5..-1 if @tokens.size > 5
+ # strings used in sql like statement
+ like_tokens = @tokens.collect {|w| "%#{w}%"}
+ operator = @all_words ? " AND " : " OR "
+ limit = 10
+ @results = []
+ @results += @project.issues.find(:all, :limit => limit, :include => :author, :conditions => [ (["(LOWER(issues.subject) like ? OR LOWER(issues.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'issues'
+ @results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(news.title) like ? OR LOWER(news.description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'
+ @results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents'
+ @results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(wiki_pages.title) like ? OR LOWER(wiki_contents.text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')
+ @question = @tokens.join(" ")
+ end
+ end
+
+private
+ # Find project of id params[:id]
+ # if not found, redirect to project list
+ # Used as a before_filter
+ def find_project
+ @project = Project.find(params[:id])
+ @html_title = @project.name
rescue ActiveRecord::RecordNotFound
- render_404\r
- end\r
- \r
- # Retrieve query from session or build a new query\r
- def retrieve_query\r
- if params[:query_id]\r
- @query = @project.queries.find(params[:query_id])\r
- session[:query] = @query\r
- else\r
- if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r
- # Give it a name, required to be valid\r
- @query = Query.new(:name => "_")\r
- @query.project = @project\r
- if params[:fields] and params[:fields].is_a? Array\r
- params[:fields].each do |field|\r
- @query.add_filter(field, params[:operators][field], params[:values][field])\r
- end\r
- else\r
- @query.available_filters.keys.each do |field|\r
- @query.add_short_filter(field, params[field]) if params[field]\r
- end\r
- end\r
- session[:query] = @query\r
- else\r
- @query = session[:query]\r
- end\r
- end \r
- end\r
+ render_404
+ end
+
+ # Retrieve query from session or build a new query
+ def retrieve_query
+ if params[:query_id]
+ @query = @project.queries.find(params[:query_id])
+ session[:query] = @query
+ else
+ if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id
+ # Give it a name, required to be valid
+ @query = Query.new(:name => "_")
+ @query.project = @project
+ if params[:fields] and params[:fields].is_a? Array
+ params[:fields].each do |field|
+ @query.add_filter(field, params[:operators][field], params[:values][field])
+ end
+ else
+ @query.available_filters.keys.each do |field|
+ @query.add_short_filter(field, params[field]) if params[field]
+ end
+ end
+ session[:query] = @query
+ else
+ @query = session[:query]
+ end
+ end
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class ReportsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize\r
-\r
- def issue_report\r
- @statuses = IssueStatus.find(:all, :order => 'position')\r
- \r
- case params[:detail]\r
- when "tracker"\r
- @field = "tracker_id"\r
- @rows = Tracker.find :all, :order => 'position'\r
- @data = issues_by_tracker\r
- @report_title = l(:field_tracker)\r
- render :template => "reports/issue_report_details"\r
- when "priority"\r
- @field = "priority_id"\r
- @rows = Enumeration::get_values('IPRI')\r
- @data = issues_by_priority\r
- @report_title = l(:field_priority)\r
- render :template => "reports/issue_report_details" \r
- when "category"\r
- @field = "category_id"\r
- @rows = @project.issue_categories\r
- @data = issues_by_category\r
- @report_title = l(:field_category)\r
- render :template => "reports/issue_report_details" \r
- when "author"\r
- @field = "author_id"\r
- @rows = @project.members.collect { |m| m.user }\r
- @data = issues_by_author\r
- @report_title = l(:field_author)\r
- render :template => "reports/issue_report_details" \r
- else\r
- @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]\r
- @trackers = Tracker.find(:all, :order => 'position')\r
- @priorities = Enumeration::get_values('IPRI')\r
- @categories = @project.issue_categories\r
- @authors = @project.members.collect { |m| m.user }\r
- issues_by_tracker\r
- issues_by_priority\r
- issues_by_category\r
- issues_by_author\r
- render :template => "reports/issue_report"\r
- end\r
- end \r
- \r
- def delays\r
- @trackers = Tracker.find(:all)\r
- if request.get?\r
- @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }\r
- else\r
- @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array\r
- end\r
- @selected_tracker_ids ||= [] \r
- @raw = \r
- ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total\r
- FROM issue_histories a, issue_histories b, issues i\r
- WHERE a.status_id =5\r
- AND a.issue_id = b.issue_id\r
- AND a.issue_id = i.id\r
- AND i.tracker_id in (#{@selected_tracker_ids.join(',')})\r
- AND b.id = (\r
- SELECT min( c.id )\r
- FROM issue_histories c\r
- WHERE b.issue_id = c.issue_id ) \r
- GROUP BY delay") unless @selected_tracker_ids.empty? \r
- @raw ||=[]\r
- \r
- @x_from = 0\r
- @x_to = 0\r
- @y_from = 0\r
- @y_to = 0\r
- @sum_total = 0\r
- @sum_delay = 0\r
- @raw.each do |r|\r
- @x_to = [r['delay'].to_i, @x_to].max\r
- @y_to = [r['total'].to_i, @y_to].max\r
- @sum_total = @sum_total + r['total'].to_i\r
- @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i\r
- end \r
- end\r
- \r
-private\r
- # Find project of id params[:id]\r
- def find_project\r
- @project = Project.find(params[:id]) \r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
- end\r
-\r
- def issues_by_tracker\r
- @issues_by_tracker ||= \r
- ActiveRecord::Base.connection.select_all("select s.id as status_id, \r
- s.is_closed as closed, \r
- t.id as tracker_id,\r
- count(i.id) as total \r
- from \r
- issues i, issue_statuses s, trackers t\r
- where \r
- i.status_id=s.id \r
- and i.tracker_id=t.id\r
- and i.project_id=#{@project.id}\r
- group by s.id, s.is_closed, t.id") \r
- end\r
- \r
- def issues_by_priority \r
- @issues_by_priority ||= \r
- ActiveRecord::Base.connection.select_all("select s.id as status_id, \r
- s.is_closed as closed, \r
- p.id as priority_id,\r
- count(i.id) as total \r
- from \r
- issues i, issue_statuses s, enumerations p\r
- where \r
- i.status_id=s.id \r
- and i.priority_id=p.id\r
- and i.project_id=#{@project.id}\r
- group by s.id, s.is_closed, p.id") \r
- end\r
- \r
- def issues_by_category \r
- @issues_by_category ||= \r
- ActiveRecord::Base.connection.select_all("select s.id as status_id, \r
- s.is_closed as closed, \r
- c.id as category_id,\r
- count(i.id) as total \r
- from \r
- issues i, issue_statuses s, issue_categories c\r
- where \r
- i.status_id=s.id \r
- and i.category_id=c.id\r
- and i.project_id=#{@project.id}\r
- group by s.id, s.is_closed, c.id") \r
- end\r
- \r
- def issues_by_author\r
- @issues_by_author ||= \r
- ActiveRecord::Base.connection.select_all("select s.id as status_id, \r
- s.is_closed as closed, \r
- a.id as author_id,\r
- count(i.id) as total \r
- from \r
- issues i, issue_statuses s, users a\r
- where \r
- i.status_id=s.id \r
- and i.author_id=a.id\r
- and i.project_id=#{@project.id}\r
- group by s.id, s.is_closed, a.id") \r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class ReportsController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
+
+ def issue_report
+ @statuses = IssueStatus.find(:all, :order => 'position')
+
+ case params[:detail]
+ when "tracker"
+ @field = "tracker_id"
+ @rows = Tracker.find :all, :order => 'position'
+ @data = issues_by_tracker
+ @report_title = l(:field_tracker)
+ render :template => "reports/issue_report_details"
+ when "priority"
+ @field = "priority_id"
+ @rows = Enumeration::get_values('IPRI')
+ @data = issues_by_priority
+ @report_title = l(:field_priority)
+ render :template => "reports/issue_report_details"
+ when "category"
+ @field = "category_id"
+ @rows = @project.issue_categories
+ @data = issues_by_category
+ @report_title = l(:field_category)
+ render :template => "reports/issue_report_details"
+ when "author"
+ @field = "author_id"
+ @rows = @project.members.collect { |m| m.user }
+ @data = issues_by_author
+ @report_title = l(:field_author)
+ render :template => "reports/issue_report_details"
+ else
+ @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
+ @trackers = Tracker.find(:all, :order => 'position')
+ @priorities = Enumeration::get_values('IPRI')
+ @categories = @project.issue_categories
+ @authors = @project.members.collect { |m| m.user }
+ issues_by_tracker
+ issues_by_priority
+ issues_by_category
+ issues_by_author
+ render :template => "reports/issue_report"
+ end
+ end
+
+ def delays
+ @trackers = Tracker.find(:all)
+ if request.get?
+ @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
+ else
+ @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
+ end
+ @selected_tracker_ids ||= []
+ @raw =
+ ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total
+ FROM issue_histories a, issue_histories b, issues i
+ WHERE a.status_id =5
+ AND a.issue_id = b.issue_id
+ AND a.issue_id = i.id
+ AND i.tracker_id in (#{@selected_tracker_ids.join(',')})
+ AND b.id = (
+ SELECT min( c.id )
+ FROM issue_histories c
+ WHERE b.issue_id = c.issue_id )
+ GROUP BY delay") unless @selected_tracker_ids.empty?
+ @raw ||=[]
+
+ @x_from = 0
+ @x_to = 0
+ @y_from = 0
+ @y_to = 0
+ @sum_total = 0
+ @sum_delay = 0
+ @raw.each do |r|
+ @x_to = [r['delay'].to_i, @x_to].max
+ @y_to = [r['total'].to_i, @y_to].max
+ @sum_total = @sum_total + r['total'].to_i
+ @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i
+ end
+ end
+
+private
+ # Find project of id params[:id]
+ def find_project
+ @project = Project.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ def issues_by_tracker
+ @issues_by_tracker ||=
+ ActiveRecord::Base.connection.select_all("select s.id as status_id,
+ s.is_closed as closed,
+ t.id as tracker_id,
+ count(i.id) as total
+ from
+ issues i, issue_statuses s, trackers t
+ where
+ i.status_id=s.id
+ and i.tracker_id=t.id
+ and i.project_id=#{@project.id}
+ group by s.id, s.is_closed, t.id")
+ end
+
+ def issues_by_priority
+ @issues_by_priority ||=
+ ActiveRecord::Base.connection.select_all("select s.id as status_id,
+ s.is_closed as closed,
+ p.id as priority_id,
+ count(i.id) as total
+ from
+ issues i, issue_statuses s, enumerations p
+ where
+ i.status_id=s.id
+ and i.priority_id=p.id
+ and i.project_id=#{@project.id}
+ group by s.id, s.is_closed, p.id")
+ end
+
+ def issues_by_category
+ @issues_by_category ||=
+ ActiveRecord::Base.connection.select_all("select s.id as status_id,
+ s.is_closed as closed,
+ c.id as category_id,
+ count(i.id) as total
+ from
+ issues i, issue_statuses s, issue_categories c
+ where
+ i.status_id=s.id
+ and i.category_id=c.id
+ and i.project_id=#{@project.id}
+ group by s.id, s.is_closed, c.id")
+ end
+
+ def issues_by_author
+ @issues_by_author ||=
+ ActiveRecord::Base.connection.select_all("select s.id as status_id,
+ s.is_closed as closed,
+ a.id as author_id,
+ count(i.id) as total
+ from
+ issues i, issue_statuses s, users a
+ where
+ i.status_id=s.id
+ and i.author_id=a.id
+ and i.project_id=#{@project.id}
+ group by s.id, s.is_closed, a.id")
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class RolesController < ApplicationController\r
- layout 'base' \r
- before_filter :require_admin\r
-\r
- verify :method => :post, :only => [ :destroy, :move ],\r
- :redirect_to => { :action => :list }\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class RolesController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
+
+ verify :method => :post, :only => [ :destroy, :move ],
+ :redirect_to => { :action => :list }
def index
list
end
def list
- @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position"\r
+ @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position"
render :action => "list", :layout => false if request.xhr?
end
def new
- @role = Role.new(params[:role])\r
+ @role = Role.new(params[:role])
if request.post?
@role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids]
if @role.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'list'
- end\r
+ end
end
@permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC')
end
def edit
- @role = Role.find(params[:id])\r
+ @role = Role.find(params[:id])
if request.post? and @role.update_attributes(params[:role])
- @role.permissions = Permission.find(params[:permission_ids] || [])\r
+ @role.permissions = Permission.find(params[:permission_ids] || [])
Permission.allowed_to_role_expired
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list'
end
def destroy
- @role = Role.find(params[:id])\r
- unless @role.members.empty?\r
- flash[:notice] = 'Some members have this role. Can\'t delete it.'\r
- else\r
- @role.destroy\r
+ @role = Role.find(params[:id])
+ unless @role.members.empty?
+ flash[:notice] = 'Some members have this role. Can\'t delete it.'
+ else
+ @role.destroy
end
redirect_to :action => 'list'
- end\r
- \r
- def move\r
- @role = Role.find(params[:id])\r
- case params[:position]\r
- when 'highest'\r
- @role.move_to_top\r
- when 'higher'\r
- @role.move_higher\r
- when 'lower'\r
- @role.move_lower\r
- when 'lowest'\r
- @role.move_to_bottom\r
- end if params[:position]\r
- redirect_to :action => 'list'\r
- end\r
- \r
- def workflow \r
- @role = Role.find_by_id(params[:role_id])\r
- @tracker = Tracker.find_by_id(params[:tracker_id]) \r
- \r
- if request.post?\r
- Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id])\r
- (params[:issue_status] || []).each { |old, news| \r
- news.each { |new| \r
- @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new) \r
- }\r
- }\r
- if @role.save\r
- flash[:notice] = l(:notice_successful_update)\r
- end\r
- end\r
- @roles = Role.find(:all, :order => 'position')\r
- @trackers = Tracker.find(:all, :order => 'position')\r
- @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')\r
+ end
+
+ def move
+ @role = Role.find(params[:id])
+ case params[:position]
+ when 'highest'
+ @role.move_to_top
+ when 'higher'
+ @role.move_higher
+ when 'lower'
+ @role.move_lower
+ when 'lowest'
+ @role.move_to_bottom
+ end if params[:position]
+ 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)
+ end
+ end
+ @roles = Role.find(:all, :order => 'position')
+ @trackers = Tracker.find(:all, :order => 'position')
+ @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class TrackersController < ApplicationController\r
- layout 'base'\r
- before_filter :require_admin\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class TrackersController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
def index
list
verify :method => :post, :only => [ :destroy, :move ], :redirect_to => { :action => :list }
def list
- @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'\r
+ @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
render :action => "list", :layout => false if request.xhr?
end
redirect_to :action => 'list'
end
end
-\r
- def move\r
- @tracker = Tracker.find(params[:id])\r
- case params[:position]\r
- when 'highest'\r
- @tracker.move_to_top\r
- when 'higher'\r
- @tracker.move_higher\r
- when 'lower'\r
- @tracker.move_lower\r
- when 'lowest'\r
- @tracker.move_to_bottom\r
- end if params[:position]\r
- redirect_to :action => 'list'\r
- end\r
+
+ def move
+ @tracker = Tracker.find(params[:id])
+ case params[:position]
+ when 'highest'
+ @tracker.move_to_top
+ when 'higher'
+ @tracker.move_higher
+ when 'lower'
+ @tracker.move_lower
+ when 'lowest'
+ @tracker.move_to_bottom
+ end if params[:position]
+ redirect_to :action => 'list'
+ end
def destroy
- @tracker = Tracker.find(params[:id])\r
- unless @tracker.issues.empty?\r
- flash[:notice] = "This tracker contains issues and can\'t be deleted."\r
- else\r
- @tracker.destroy\r
+ @tracker = Tracker.find(params[:id])
+ unless @tracker.issues.empty?
+ flash[:notice] = "This tracker contains issues and can\'t be deleted."
+ else
+ @tracker.destroy
end
redirect_to :action => 'list'
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class UsersController < ApplicationController\r
- layout 'base' \r
- before_filter :require_admin\r
-\r
- helper :sort\r
- include SortHelper\r
- helper :custom_fields\r
- include CustomFieldsHelper \r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class UsersController < ApplicationController
+ layout 'base'
+ before_filter :require_admin
+
+ helper :sort
+ include SortHelper
+ helper :custom_fields
+ include CustomFieldsHelper
def index
list
render :action => 'list' unless request.xhr?
end
- def list\r
- sort_init 'login', 'asc'\r
- sort_update\r
- @user_count = User.count \r
- @user_pages = Paginator.new self, @user_count,\r
- 15,\r
- params['page'] \r
- @users = User.find :all,:order => sort_clause,\r
- :limit => @user_pages.items_per_page,\r
- :offset => @user_pages.current.offset\r
-\r
+ def list
+ sort_init 'login', 'asc'
+ sort_update
+ @user_count = User.count
+ @user_pages = Paginator.new self, @user_count,
+ 15,
+ params['page']
+ @users = User.find :all,:order => sort_clause,
+ :limit => @user_pages.items_per_page,
+ :offset => @user_pages.current.offset
+
render :action => "list", :layout => false if request.xhr?
end
def add
- if request.get?\r
- @user = User.new(:language => Setting.default_language)\r
- @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }\r
+ if request.get?
+ @user = User.new(:language => Setting.default_language)
+ @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
else
- @user = User.new(params[:user])\r
- @user.admin = params[:user][:admin] || false\r
- @user.login = params[:user][:login]\r
- @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id\r
- @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }\r
- @user.custom_values = @custom_values \r
+ @user = User.new(params[:user])
+ @user.admin = params[:user][:admin] || false
+ @user.login = params[:user][:login]
+ @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id
+ @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
+ @user.custom_values = @custom_values
if @user.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'list'
- end\r
- end\r
+ end
+ end
@auth_sources = AuthSource.find(:all)
end
def edit
@user = User.find(params[:id])
- if request.get?\r
- @custom_values = UserCustomField.find(:all).collect { |x| @user.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }\r
- else\r
- @user.admin = params[:user][:admin] if params[:user][:admin]\r
- @user.login = params[:user][:login] if params[:user][:login]\r
- @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? or @user.auth_source_id\r
- if params[:custom_fields]\r
- @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }\r
- @user.custom_values = @custom_values\r
- end\r
+ if request.get?
+ @custom_values = UserCustomField.find(:all).collect { |x| @user.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
+ else
+ @user.admin = params[:user][:admin] if params[:user][:admin]
+ @user.login = params[:user][:login] if params[:user][:login]
+ @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? or @user.auth_source_id
+ if params[:custom_fields]
+ @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
+ @user.custom_values = @custom_values
+ end
if @user.update_attributes(params[:user])
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list'
- end\r
+ end
end
- @auth_sources = AuthSource.find(:all)\r
- @roles = Role.find(:all, :order => 'position')\r
- @projects = Project.find(:all) - @user.projects\r
- @membership ||= Member.new\r
- end\r
- \r
- def edit_membership\r
- @user = User.find(params[:id])\r
- @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:user => @user)\r
- @membership.attributes = params[:membership]\r
- if request.post? and @membership.save\r
- flash[:notice] = l(:notice_successful_update)\r
- end\r
- redirect_to :action => 'edit', :id => @user and return\r
- end\r
- \r
- def destroy_membership\r
- @user = User.find(params[:id])\r
- if request.post? and Member.find(params[:membership_id]).destroy\r
- flash[:notice] = l(:notice_successful_update)\r
- end\r
- redirect_to :action => 'edit', :id => @user and return\r
+ @auth_sources = AuthSource.find(:all)
+ @roles = Role.find(:all, :order => 'position')
+ @projects = Project.find(:all) - @user.projects
+ @membership ||= Member.new
+ end
+
+ def edit_membership
+ @user = User.find(params[:id])
+ @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:user => @user)
+ @membership.attributes = params[:membership]
+ if request.post? and @membership.save
+ flash[:notice] = l(:notice_successful_update)
+ end
+ redirect_to :action => 'edit', :id => @user and return
+ end
+
+ def destroy_membership
+ @user = User.find(params[:id])
+ if request.post? and Member.find(params[:membership_id]).destroy
+ flash[:notice] = l(:notice_successful_update)
+ end
+ redirect_to :action => 'edit', :id => @user and return
end
def destroy
User.find(params[:id]).destroy
- redirect_to :action => 'list'\r
- rescue\r
- flash[:notice] = "Unable to delete user"\r
redirect_to :action => 'list'
- end \r
+ rescue
+ flash[:notice] = "Unable to delete user"
+ redirect_to :action => 'list'
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class VersionsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class VersionsController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
def edit
if request.post? and @version.update_attributes(params[:version])
end
end
- def destroy\r
+ def destroy
@version.destroy
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project\r
- rescue\r
- flash[:notice] = "Unable to delete version"\r
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project\r
- end\r
-\r
- def download\r
- @attachment = @version.attachments.find(params[:attachment_id])\r
- @attachment.increment_download\r
- send_file @attachment.diskfile, :filename => @attachment.filename\r
- rescue\r
- render_404\r
- end \r
- \r
- def destroy_file\r
- @version.attachments.find(params[:attachment_id]).destroy\r
- flash[:notice] = l(:notice_successful_delete)\r
- redirect_to :controller => 'projects', :action => 'list_files', :id => @project\r
- end\r
-\r
-private\r
- def find_project\r
- @version = Version.find(params[:id])\r
- @project = @version.project\r
- rescue ActiveRecord::RecordNotFound\r
- render_404\r
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ rescue
+ flash[:notice] = "Unable to delete version"
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ end
+
+ def download
+ @attachment = @version.attachments.find(params[:attachment_id])
+ @attachment.increment_download
+ send_file @attachment.diskfile, :filename => @attachment.filename
+ rescue
+ render_404
+ end
+
+ def destroy_file
+ @version.attachments.find(params[:attachment_id]).destroy
+ flash[:notice] = l(:notice_successful_delete)
+ redirect_to :controller => 'projects', :action => 'list_files', :id => @project
+ end
+
+private
+ def find_project
+ @version = Version.find(params[:id])
+ @project = @version.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class WelcomeController < ApplicationController\r
- layout 'base'\r
-\r
- def index\r
- @news = News.latest logged_in_user\r
- @projects = Project.latest logged_in_user\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class WelcomeController < ApplicationController
+ layout 'base'
+
+ def index
+ @news = News.latest logged_in_user
+ @projects = Project.latest logged_in_user
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module AccountHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module AdminHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-module ApplicationHelper\r
-\r
- # Return current logged in user or nil\r
- def loggedin?\r
- @logged_in_user\r
- end\r
- \r
- # Return true if user is logged in and is admin, otherwise false\r
- def admin_loggedin?\r
- @logged_in_user and @logged_in_user.admin?\r
- end\r
-\r
- # Return true if user is authorized for controller/action, otherwise false\r
- def authorize_for(controller, action) \r
- # check if action is allowed on public projects\r
- if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]\r
- return true\r
- end\r
- # check if user is authorized \r
- if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) )\r
- return true\r
- end\r
- return false\r
- end\r
-\r
- # Display a link if user is authorized\r
- def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)\r
- link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])\r
- end\r
-\r
- # Display a link to user's account page\r
- def link_to_user(user)\r
- link_to user.display_name, :controller => 'account', :action => 'show', :id => user\r
- end\r
- \r
- def image_to_function(name, function, html_options = {})\r
- html_options.symbolize_keys!\r
- tag(:input, html_options.merge({ \r
- :type => "image", :src => image_path(name), \r
- :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" \r
- }))\r
- end\r
- \r
- def format_date(date)\r
- l_date(date) if date\r
- end\r
- \r
- def format_time(time)\r
- l_datetime((time.is_a? String) ? time.to_time : time) if time\r
- end\r
- \r
- def day_name(day)\r
- l(:general_day_names).split(',')[day-1]\r
- end\r
- \r
- def month_name(month)\r
- l(:actionview_datehelper_select_month_names).split(',')[month-1]\r
- end\r
-\r
- def pagination_links_full(paginator, options={}, html_options={})\r
- html = '' \r
- html << link_to_remote(('« ' + l(:label_previous)), \r
- {:update => "content", :url => { :page => paginator.current.previous }},\r
- {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous\r
- \r
- html << (pagination_links_each(paginator, options) do |n|\r
- link_to_remote(n.to_s, \r
- {:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},\r
- {:href => url_for(:action => 'list', :params => params.merge({:page => n}))})\r
- end || '')\r
- \r
- html << ' ' + link_to_remote((l(:label_next) + ' »'), \r
- {:update => "content", :url => { :page => paginator.current.next }},\r
- {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next\r
- html \r
- end\r
- \r
- # textilize text according to system settings and RedCloth availability\r
- def textilizable(text, options = {})\r
- # different methods for formatting wiki links\r
- case options[:wiki_links]\r
- when :local\r
- # used for local links to html files\r
- format_wiki_link = Proc.new {|title| "#{title}.html" }\r
- when :anchor\r
- # used for single-file wiki export\r
- format_wiki_link = Proc.new {|title| "##{title}" }\r
- else\r
- if @project\r
- format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title }\r
- else\r
- format_wiki_link = Proc.new {|title| title }\r
- end\r
- end\r
- \r
- # turn wiki links into textile links: \r
- # example:\r
- # [[link]] -> "link":link\r
- # [[link|title]] -> "title":link\r
- text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }\r
-\r
- # turn issue ids to textile links\r
- # example:\r
- # #52 -> "#52":/issues/show/52\r
- text = text.gsub(/#(\d+)([\s\.\(\)\-,:;])/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) + $2 }\r
- \r
- # turn revision ids to textile links (@project needed)\r
- # example:\r
- # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6)\r
- text = text.gsub(/r(\d+)([\s\.\(\)\-,:;])/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) + $2 } if @project\r
- \r
- # finally textilize text\r
- text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text)))\r
- end\r
- \r
- def error_messages_for(object_name, options = {})\r
- options = options.symbolize_keys\r
- object = instance_variable_get("@#{object_name}")\r
- if object && !object.errors.empty?\r
- # build full_messages here with controller current language\r
- full_messages = []\r
- object.errors.each do |attr, msg|\r
- next if msg.nil?\r
- msg = msg.first if msg.is_a? Array\r
- if attr == "base"\r
- full_messages << l(msg)\r
- else\r
- full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values"\r
- end\r
- end\r
- # retrieve custom values error messages\r
- if object.errors[:custom_values]\r
- object.custom_values.each do |v| \r
- v.errors.each do |attr, msg|\r
- next if msg.nil?\r
- msg = msg.first if msg.is_a? Array\r
- full_messages << "« " + v.custom_field.name + " » " + l(msg)\r
- end\r
- end\r
- end \r
- content_tag("div",\r
- content_tag(\r
- options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :"\r
- ) +\r
- content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),\r
- "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"\r
- )\r
- else\r
- ""\r
- end\r
- end\r
- \r
- def lang_options_for_select(blank=true)\r
- (blank ? [["(auto)", ""]] : []) + \r
- (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}\r
- end\r
- \r
- def label_tag_for(name, option_tags = nil, options = {})\r
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")\r
- content_tag("label", label_text)\r
- end\r
- \r
- def labelled_tabular_form_for(name, object, options, &proc)\r
- options[:html] ||= {}\r
- options[:html].store :class, "tabular"\r
- form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)\r
- end\r
- \r
- def check_all_links(form_name)\r
- link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +\r
- " | " +\r
- link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") \r
- end\r
- \r
- def calendar_for(field_id)\r
- image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +\r
- javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module ApplicationHelper
+
+ # Return current logged in user or nil
+ def loggedin?
+ @logged_in_user
+ end
+
+ # Return true if user is logged in and is admin, otherwise false
+ def admin_loggedin?
+ @logged_in_user and @logged_in_user.admin?
+ end
+
+ # Return true if user is authorized for controller/action, otherwise false
+ def authorize_for(controller, action)
+ # check if action is allowed on public projects
+ if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]
+ return true
+ end
+ # check if user is authorized
+ if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) )
+ return true
+ end
+ return false
+ end
+
+ # Display a link if user is authorized
+ def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
+ link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
+ end
+
+ # Display a link to user's account page
+ def link_to_user(user)
+ link_to user.display_name, :controller => 'account', :action => 'show', :id => user
+ end
+
+ def image_to_function(name, function, html_options = {})
+ html_options.symbolize_keys!
+ tag(:input, html_options.merge({
+ :type => "image", :src => image_path(name),
+ :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};"
+ }))
+ end
+
+ def format_date(date)
+ l_date(date) if date
+ end
+
+ def format_time(time)
+ l_datetime((time.is_a? String) ? time.to_time : time) if time
+ end
+
+ def day_name(day)
+ l(:general_day_names).split(',')[day-1]
+ end
+
+ def month_name(month)
+ l(:actionview_datehelper_select_month_names).split(',')[month-1]
+ end
+
+ def pagination_links_full(paginator, options={}, html_options={})
+ html = ''
+ html << link_to_remote(('« ' + l(:label_previous)),
+ {:update => "content", :url => { :page => paginator.current.previous }},
+ {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
+
+ html << (pagination_links_each(paginator, options) do |n|
+ link_to_remote(n.to_s,
+ {:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},
+ {:href => url_for(:action => 'list', :params => params.merge({:page => n}))})
+ end || '')
+
+ html << ' ' + link_to_remote((l(:label_next) + ' »'),
+ {:update => "content", :url => { :page => paginator.current.next }},
+ {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
+ html
+ end
+
+ # textilize text according to system settings and RedCloth availability
+ def textilizable(text, options = {})
+ # different methods for formatting wiki links
+ case options[:wiki_links]
+ when :local
+ # used for local links to html files
+ format_wiki_link = Proc.new {|title| "#{title}.html" }
+ when :anchor
+ # used for single-file wiki export
+ format_wiki_link = Proc.new {|title| "##{title}" }
+ else
+ if @project
+ format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title }
+ else
+ format_wiki_link = Proc.new {|title| title }
+ end
+ end
+
+ # turn wiki links into textile links:
+ # example:
+ # [[link]] -> "link":link
+ # [[link|title]] -> "title":link
+ text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }
+
+ # turn issue ids to textile links
+ # example:
+ # #52 -> "#52":/issues/show/52
+ text = text.gsub(/#(\d+)([\s\.\(\)\-,:;])/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) + $2 }
+
+ # turn revision ids to textile links (@project needed)
+ # example:
+ # r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6)
+ text = text.gsub(/r(\d+)([\s\.\(\)\-,:;])/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) + $2 } if @project
+
+ # finally textilize text
+ text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text)))
+ end
+
+ def error_messages_for(object_name, options = {})
+ options = options.symbolize_keys
+ object = instance_variable_get("@#{object_name}")
+ if object && !object.errors.empty?
+ # build full_messages here with controller current language
+ full_messages = []
+ object.errors.each do |attr, msg|
+ next if msg.nil?
+ msg = msg.first if msg.is_a? Array
+ if attr == "base"
+ full_messages << l(msg)
+ else
+ full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values"
+ end
+ end
+ # retrieve custom values error messages
+ if object.errors[:custom_values]
+ object.custom_values.each do |v|
+ v.errors.each do |attr, msg|
+ next if msg.nil?
+ msg = msg.first if msg.is_a? Array
+ full_messages << "« " + v.custom_field.name + " » " + l(msg)
+ end
+ end
+ end
+ content_tag("div",
+ content_tag(
+ options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :"
+ ) +
+ content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
+ "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
+ )
+ else
+ ""
+ end
+ end
+
+ def lang_options_for_select(blank=true)
+ (blank ? [["(auto)", ""]] : []) +
+ (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
+ end
+
+ def label_tag_for(name, option_tags = nil, options = {})
+ label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
+ content_tag("label", label_text)
+ end
+
+ def labelled_tabular_form_for(name, object, options, &proc)
+ options[:html] ||= {}
+ options[:html].store :class, "tabular"
+ form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
+ end
+
+ def check_all_links(form_name)
+ link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
+ " | " +
+ link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
+ end
+
+ def calendar_for(field_id)
+ image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
+ javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
+ end
end
-\r
-class TabularFormBuilder < ActionView::Helpers::FormBuilder\r
- include GLoc\r
- \r
- def initialize(object_name, object, template, options, proc)\r
- set_language_if_valid options.delete(:lang)\r
- @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc \r
- end \r
- \r
- (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|\r
- src = <<-END_SRC\r
- def #{selector}(field, options = {}) \r
- return super if options.delete :no_label\r
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")\r
- label = @template.content_tag("label", label_text, \r
- :class => (@object && @object.errors[field] ? "error" : nil), \r
- :for => (@object_name.to_s + "_" + field.to_s))\r
- label + super\r
- end\r
- END_SRC\r
- class_eval src, __FILE__, __LINE__\r
- end\r
- \r
- def select(field, choices, options = {}, html_options = {}) \r
- label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")\r
- label = @template.content_tag("label", label_text, \r
- :class => (@object && @object.errors[field] ? "error" : nil), \r
- :for => (@object_name.to_s + "_" + field.to_s))\r
- label + super\r
- end\r
-\r
-end\r
-\r
+
+class TabularFormBuilder < ActionView::Helpers::FormBuilder
+ include GLoc
+
+ def initialize(object_name, object, template, options, proc)
+ set_language_if_valid options.delete(:lang)
+ @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc
+ end
+
+ (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|
+ src = <<-END_SRC
+ def #{selector}(field, options = {})
+ return super if options.delete :no_label
+ label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
+ label = @template.content_tag("label", label_text,
+ :class => (@object && @object.errors[field] ? "error" : nil),
+ :for => (@object_name.to_s + "_" + field.to_s))
+ label + super
+ end
+ END_SRC
+ class_eval src, __FILE__, __LINE__
+ end
+
+ def select(field, choices, options = {}, html_options = {})
+ label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
+ label = @template.content_tag("label", label_text,
+ :class => (@object && @object.errors[field] ? "error" : nil),
+ :for => (@object_name.to_s + "_" + field.to_s))
+ label + super
+ end
+
+end
+
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-module CustomFieldsHelper\r
-\r
- # Return custom field html tag corresponding to its format\r
- def custom_field_tag(custom_value) \r
- custom_field = custom_value.custom_field\r
- field_name = "custom_fields[#{custom_field.id}]"\r
- field_id = "custom_fields_#{custom_field.id}"\r
- \r
- case custom_field.field_format\r
- when "string", "int"\r
- text_field 'custom_value', 'value', :name => field_name, :id => field_id\r
- when "date"\r
- text_field('custom_value', 'value', :name => field_name, :id => field_id, :size => 10) + \r
- calendar_for(field_id)\r
- when "text"\r
- text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3\r
- when "bool"\r
- check_box 'custom_value', 'value', :name => field_name, :id => field_id\r
- when "list"\r
- select 'custom_value', 'value', custom_field.possible_values, { :include_blank => true }, :name => field_name, :id => field_id\r
- end\r
- end\r
- \r
- # Return custom field label tag\r
- def custom_field_label_tag(custom_value)\r
- content_tag "label", custom_value.custom_field.name +\r
- (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),\r
- :for => "custom_fields_#{custom_value.custom_field.id}",\r
- :class => (custom_value.errors.empty? ? nil : "error" )\r
- end\r
- \r
- # Return custom field tag with its label tag\r
- def custom_field_tag_with_label(custom_value)\r
- custom_field_label_tag(custom_value) + custom_field_tag(custom_value)\r
- end\r
-\r
- # Return a string used to display a custom value\r
- def show_value(custom_value)\r
- return "" unless custom_value\r
- format_value(custom_value.value, custom_value.custom_field.field_format)\r
- end\r
- \r
- # Return a string used to display a custom value\r
- def format_value(value, field_format)\r
- return "" unless value && !value.empty?\r
- case field_format\r
- when "date"\r
- begin; l_date(value.to_date); rescue; value end\r
- when "bool"\r
- l_YesNo(value == "1")\r
- else\r
- value\r
- end\r
- end\r
-\r
- # Return an array of custom field formats which can be used in select_tag\r
- def custom_field_formats_for_select\r
- CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module CustomFieldsHelper
+
+ # Return custom field html tag corresponding to its format
+ def custom_field_tag(custom_value)
+ custom_field = custom_value.custom_field
+ field_name = "custom_fields[#{custom_field.id}]"
+ field_id = "custom_fields_#{custom_field.id}"
+
+ case custom_field.field_format
+ when "string", "int"
+ text_field 'custom_value', 'value', :name => field_name, :id => field_id
+ when "date"
+ text_field('custom_value', 'value', :name => field_name, :id => field_id, :size => 10) +
+ calendar_for(field_id)
+ when "text"
+ text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3
+ when "bool"
+ check_box 'custom_value', 'value', :name => field_name, :id => field_id
+ when "list"
+ select 'custom_value', 'value', custom_field.possible_values, { :include_blank => true }, :name => field_name, :id => field_id
+ end
+ end
+
+ # Return custom field label tag
+ def custom_field_label_tag(custom_value)
+ content_tag "label", custom_value.custom_field.name +
+ (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
+ :for => "custom_fields_#{custom_value.custom_field.id}",
+ :class => (custom_value.errors.empty? ? nil : "error" )
+ end
+
+ # Return custom field tag with its label tag
+ def custom_field_tag_with_label(custom_value)
+ custom_field_label_tag(custom_value) + custom_field_tag(custom_value)
+ end
+
+ # Return a string used to display a custom value
+ def show_value(custom_value)
+ return "" unless custom_value
+ format_value(custom_value.value, custom_value.custom_field.field_format)
+ end
+
+ # Return a string used to display a custom value
+ def format_value(value, field_format)
+ return "" unless value && !value.empty?
+ case field_format
+ when "date"
+ begin; l_date(value.to_date); rescue; value end
+ when "bool"
+ l_YesNo(value == "1")
+ else
+ value
+ end
+ end
+
+ # Return an array of custom field formats which can be used in select_tag
+ def custom_field_formats_for_select
+ CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module DocumentsHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module EnumerationsHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module HelpHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require 'iconv'\r
-require 'rfpdf/chinese'\r
-\r
-module IfpdfHelper \r
- \r
- class IFPDF < FPDF\r
- include GLoc\r
- attr_accessor :footer_date\r
- \r
- def initialize(lang)\r
- super()\r
- set_language_if_valid lang\r
- case current_language\r
- when :ja\r
- extend(PDF_Japanese)\r
- AddSJISFont()\r
- @font_for_content = 'SJIS'\r
- @font_for_footer = 'SJIS'\r
- else\r
- @font_for_content = 'Arial'\r
- @font_for_footer = 'Helvetica' \r
- end\r
- SetCreator("redMine #{Redmine::VERSION}")\r
- SetFont(@font_for_content)\r
- end\r
- \r
- def SetFontStyle(style, size)\r
- SetFont(@font_for_content, style, size)\r
- end\r
- \r
- def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')\r
- @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')\r
- txt = begin\r
- @ic.iconv(txt)\r
- rescue\r
- txt\r
- end\r
- super w,h,txt,border,ln,align,fill,link\r
- end\r
- \r
- def Footer\r
- SetFont(@font_for_footer, 'I', 8)\r
- SetY(-15)\r
- SetX(15)\r
- Cell(0, 5, @footer_date, 0, 0, 'L')\r
- SetY(-15)\r
- SetX(-30)\r
- Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')\r
- end\r
- \r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require 'iconv'
+require 'rfpdf/chinese'
+
+module IfpdfHelper
+
+ class IFPDF < FPDF
+ include GLoc
+ attr_accessor :footer_date
+
+ def initialize(lang)
+ super()
+ set_language_if_valid lang
+ case current_language
+ when :ja
+ extend(PDF_Japanese)
+ AddSJISFont()
+ @font_for_content = 'SJIS'
+ @font_for_footer = 'SJIS'
+ else
+ @font_for_content = 'Arial'
+ @font_for_footer = 'Helvetica'
+ end
+ SetCreator("redMine #{Redmine::VERSION}")
+ SetFont(@font_for_content)
+ end
+
+ def SetFontStyle(style, size)
+ SetFont(@font_for_content, style, size)
+ end
+
+ def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
+ @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
+ txt = begin
+ @ic.iconv(txt)
+ rescue
+ txt
+ end
+ super w,h,txt,border,ln,align,fill,link
+ end
+
+ def Footer
+ SetFont(@font_for_footer, 'I', 8)
+ SetY(-15)
+ SetX(15)
+ Cell(0, 5, @footer_date, 0, 0, 'L')
+ SetY(-15)
+ SetX(-30)
+ Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
+ end
+
end
-\r
-end\r
+
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module IssueCategoriesHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module IssueStatusesHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-module IssuesHelper\r
-\r
- def show_detail(detail, no_html=false)\r
- case detail.property\r
- when 'attr'\r
- label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym) \r
- case detail.prop_key\r
- when 'due_date', 'start_date'\r
- value = format_date(detail.value.to_date) if detail.value\r
- old_value = format_date(detail.old_value.to_date) if detail.old_value\r
- when 'status_id'\r
- s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value\r
- s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value\r
- when 'assigned_to_id'\r
- u = User.find_by_id(detail.value) and value = u.name if detail.value\r
- u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value\r
- when 'priority_id'\r
- e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value\r
- e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value\r
- when 'category_id'\r
- c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value\r
- c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value\r
- when 'fixed_version_id'\r
- v = Version.find_by_id(detail.value) and value = v.name if detail.value\r
- v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value\r
- end\r
- when 'cf'\r
- custom_field = CustomField.find_by_id(detail.prop_key)\r
- if custom_field\r
- label = custom_field.name\r
- value = format_value(detail.value, custom_field.field_format) if detail.value\r
- old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value\r
- end\r
- end\r
- \r
- label ||= detail.prop_key\r
- value ||= detail.value\r
- old_value ||= detail.old_value\r
- \r
- unless no_html\r
- label = content_tag('strong', label)\r
- old_value = content_tag("i", h(old_value)) if detail.old_value\r
- old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)\r
- value = content_tag("i", h(value)) if value\r
- end\r
- \r
- if detail.value and !detail.value.to_s.empty?\r
- if old_value\r
- label + " " + l(:text_journal_changed, old_value, value)\r
- else\r
- label + " " + l(:text_journal_set_to, value)\r
- end\r
- else\r
- label + " " + l(:text_journal_deleted) + " (#{old_value})"\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module IssuesHelper
+
+ def show_detail(detail, no_html=false)
+ case detail.property
+ when 'attr'
+ label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
+ case detail.prop_key
+ when 'due_date', 'start_date'
+ value = format_date(detail.value.to_date) if detail.value
+ old_value = format_date(detail.old_value.to_date) if detail.old_value
+ when 'status_id'
+ s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
+ s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
+ when 'assigned_to_id'
+ u = User.find_by_id(detail.value) and value = u.name if detail.value
+ u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
+ when 'priority_id'
+ e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value
+ e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
+ when 'category_id'
+ c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
+ c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
+ when 'fixed_version_id'
+ v = Version.find_by_id(detail.value) and value = v.name if detail.value
+ v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
+ end
+ when 'cf'
+ custom_field = CustomField.find_by_id(detail.prop_key)
+ if custom_field
+ label = custom_field.name
+ value = format_value(detail.value, custom_field.field_format) if detail.value
+ old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
+ end
+ end
+
+ label ||= detail.prop_key
+ value ||= detail.value
+ old_value ||= detail.old_value
+
+ unless no_html
+ label = content_tag('strong', label)
+ old_value = content_tag("i", h(old_value)) if detail.old_value
+ old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
+ value = content_tag("i", h(value)) if value
+ end
+
+ if detail.value and !detail.value.to_s.empty?
+ if old_value
+ label + " " + l(:text_journal_changed, old_value, value)
+ else
+ label + " " + l(:text_journal_set_to, value)
+ end
+ else
+ label + " " + l(:text_journal_deleted) + " (#{old_value})"
+ end
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module MembersHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module NewsHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-module ProjectsHelper\r
-\r
- def highlight_tokens(text, tokens)\r
- return text unless tokens && !tokens.empty?\r
- regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE \r
- result = ''\r
- text.split(regexp).each_with_index do |words, i|\r
- result << (i.even? ? (words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', words, :class => 'highlight'))\r
- end\r
- result\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module ProjectsHelper
+
+ def highlight_tokens(text, tokens)
+ return text unless tokens && !tokens.empty?
+ regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE
+ result = ''
+ text.split(regexp).each_with_index do |words, i|
+ result << (i.even? ? (words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', words, :class => 'highlight'))
+ end
+ result
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-module ReportsHelper\r
- \r
- def aggregate(data, criteria)\r
- a = 0\r
- data.each { |row|\r
- match = 1\r
- criteria.each { |k, v|\r
- match = 0 unless row[k].to_s == v.to_s\r
- } unless criteria.nil?\r
- a = a + row["total"].to_i if match == 1\r
- } unless data.nil?\r
- a\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module ReportsHelper
+
+ def aggregate(data, criteria)
+ a = 0
+ data.each { |row|
+ match = 1
+ criteria.each { |k, v|
+ match = 0 unless row[k].to_s == v.to_s
+ } unless criteria.nil?
+ a = a + row["total"].to_i if match == 1
+ } unless data.nil?
+ a
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module RolesHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module TrackersHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module UsersHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module VersionsHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
module WelcomeHelper
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require "digest/md5"\r
-\r
-class Attachment < ActiveRecord::Base\r
- belongs_to :container, :polymorphic => true\r
- belongs_to :author, :class_name => "User", :foreign_key => "author_id"\r
- \r
- validates_presence_of :container, :filename\r
- \r
- cattr_accessor :storage_path\r
- @@storage_path = "#{RAILS_ROOT}/files"\r
- \r
- def validate\r
- errors.add_to_base :too_long if self.filesize > Setting.attachment_max_size.to_i.kilobytes\r
- end\r
-\r
- def file=(incomming_file)\r
- unless incomming_file.nil?\r
- @temp_file = incomming_file\r
- if @temp_file.size > 0\r
- self.filename = sanitize_filename(@temp_file.original_filename)\r
- self.disk_filename = DateTime.now.strftime("%y%m%d%H%M%S") + "_" + self.filename\r
- self.content_type = @temp_file.content_type\r
- self.filesize = @temp_file.size\r
- end\r
- end\r
- end\r
- \r
- def file\r
- nil\r
- end\r
- \r
- # Copy temp file to its final location\r
- def before_save\r
- if @temp_file && (@temp_file.size > 0)\r
- logger.debug("saving '#{self.diskfile}'")\r
- File.open(diskfile, "wb") do |f| \r
- f.write(@temp_file.read)\r
- end\r
- self.digest = Digest::MD5.hexdigest(File.read(diskfile))\r
- end\r
- end\r
- \r
- # Deletes file on the disk\r
- def after_destroy\r
- if self.filename?\r
- File.delete(diskfile) if File.exist?(diskfile)\r
- end\r
- end\r
- \r
- # Returns file's location on disk\r
- def diskfile\r
- "#{@@storage_path}/#{self.disk_filename}"\r
- end\r
- \r
- def increment_download\r
- increment!(:downloads)\r
- end\r
- \r
- # returns last created projects\r
- def self.most_downloaded\r
- find(:all, :limit => 5, :order => "downloads DESC") \r
- end\r
- \r
-private\r
- def sanitize_filename(value)\r
- # get only the filename, not the whole path\r
- just_filename = value.gsub(/^.*(\\|\/)/, '')\r
- # NOTE: File.basename doesn't work right with Windows paths on Unix\r
- # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/')) \r
-\r
- # Finally, replace all non alphanumeric, underscore or periods with underscore\r
- @filename = just_filename.gsub(/[^\w\.\-]/,'_') \r
- end\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require "digest/md5"
+
+class Attachment < ActiveRecord::Base
+ belongs_to :container, :polymorphic => true
+ belongs_to :author, :class_name => "User", :foreign_key => "author_id"
+
+ validates_presence_of :container, :filename
+
+ cattr_accessor :storage_path
+ @@storage_path = "#{RAILS_ROOT}/files"
+
+ def validate
+ errors.add_to_base :too_long if self.filesize > Setting.attachment_max_size.to_i.kilobytes
+ end
+
+ def file=(incomming_file)
+ unless incomming_file.nil?
+ @temp_file = incomming_file
+ if @temp_file.size > 0
+ self.filename = sanitize_filename(@temp_file.original_filename)
+ self.disk_filename = DateTime.now.strftime("%y%m%d%H%M%S") + "_" + self.filename
+ self.content_type = @temp_file.content_type
+ self.filesize = @temp_file.size
+ end
+ end
+ end
+
+ def file
+ nil
+ end
+
+ # Copy temp file to its final location
+ def before_save
+ if @temp_file && (@temp_file.size > 0)
+ logger.debug("saving '#{self.diskfile}'")
+ File.open(diskfile, "wb") do |f|
+ f.write(@temp_file.read)
+ end
+ self.digest = Digest::MD5.hexdigest(File.read(diskfile))
+ end
+ end
+
+ # Deletes file on the disk
+ def after_destroy
+ if self.filename?
+ File.delete(diskfile) if File.exist?(diskfile)
+ end
+ end
+
+ # Returns file's location on disk
+ def diskfile
+ "#{@@storage_path}/#{self.disk_filename}"
+ end
+
+ def increment_download
+ increment!(:downloads)
+ end
+
+ # returns last created projects
+ def self.most_downloaded
+ find(:all, :limit => 5, :order => "downloads DESC")
+ end
+
+private
+ def sanitize_filename(value)
+ # get only the filename, not the whole path
+ just_filename = value.gsub(/^.*(\\|\/)/, '')
+ # NOTE: File.basename doesn't work right with Windows paths on Unix
+ # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/'))
+
+ # Finally, replace all non alphanumeric, underscore or periods with underscore
+ @filename = just_filename.gsub(/[^\w\.\-]/,'_')
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require 'net/ldap'\r
-require 'iconv'\r
-\r
-class AuthSourceLdap < AuthSource \r
- validates_presence_of :host, :port, :attr_login\r
-\r
- def after_initialize\r
- self.port = 389 if self.port == 0\r
- end\r
- \r
- def authenticate(login, password)\r
- attrs = []\r
- # get user's DN\r
- ldap_con = initialize_ldap_con(self.account, self.account_password)\r
- login_filter = Net::LDAP::Filter.eq( self.attr_login, login ) \r
- object_filter = Net::LDAP::Filter.eq( "objectClass", "*" ) \r
- dn = String.new\r
- ldap_con.search( :base => self.base_dn, \r
- :filter => object_filter & login_filter, \r
- :attributes=> ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail]) do |entry|\r
- dn = entry.dn\r
- attrs = [:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),\r
- :lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),\r
- :mail => AuthSourceLdap.get_attr(entry, self.attr_mail),\r
- :auth_source_id => self.id ]\r
- end\r
- return nil if dn.empty?\r
- logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?\r
- # authenticate user\r
- ldap_con = initialize_ldap_con(dn, password)\r
- return nil unless ldap_con.bind\r
- # return user's attributes\r
- logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?\r
- attrs \r
- rescue Net::LDAP::LdapError => text\r
- raise "LdapError: " + text\r
- end\r
-\r
- # test the connection to the LDAP\r
- def test_connection\r
- ldap_con = initialize_ldap_con(self.account, self.account_password)\r
- ldap_con.open { }\r
- rescue Net::LDAP::LdapError => text\r
- raise "LdapError: " + text\r
- end\r
- \r
- def auth_method_name\r
- "LDAP"\r
- end\r
- \r
-private\r
- def initialize_ldap_con(ldap_user, ldap_password)\r
- Net::LDAP.new( {:host => self.host, \r
- :port => self.port, \r
- :auth => { :method => :simple, :username => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_user), :password => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_password) }} \r
- ) \r
- end\r
- \r
- def self.get_attr(entry, attr_name)\r
- entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require 'net/ldap'
+require 'iconv'
+
+class AuthSourceLdap < AuthSource
+ validates_presence_of :host, :port, :attr_login
+
+ def after_initialize
+ self.port = 389 if self.port == 0
+ end
+
+ def authenticate(login, password)
+ attrs = []
+ # get user's DN
+ ldap_con = initialize_ldap_con(self.account, self.account_password)
+ login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
+ object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
+ dn = String.new
+ ldap_con.search( :base => self.base_dn,
+ :filter => object_filter & login_filter,
+ :attributes=> ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail]) do |entry|
+ dn = entry.dn
+ attrs = [:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
+ :lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
+ :mail => AuthSourceLdap.get_attr(entry, self.attr_mail),
+ :auth_source_id => self.id ]
+ end
+ return nil if dn.empty?
+ logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
+ # authenticate user
+ ldap_con = initialize_ldap_con(dn, password)
+ return nil unless ldap_con.bind
+ # return user's attributes
+ logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
+ attrs
+ rescue Net::LDAP::LdapError => text
+ raise "LdapError: " + text
+ end
+
+ # test the connection to the LDAP
+ def test_connection
+ ldap_con = initialize_ldap_con(self.account, self.account_password)
+ ldap_con.open { }
+ rescue Net::LDAP::LdapError => text
+ raise "LdapError: " + text
+ end
+
+ def auth_method_name
+ "LDAP"
+ end
+
+private
+ def initialize_ldap_con(ldap_user, ldap_password)
+ Net::LDAP.new( {:host => self.host,
+ :port => self.port,
+ :auth => { :method => :simple, :username => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_user), :password => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_password) }}
+ )
+ end
+
+ def self.get_attr(entry, attr_name)
+ entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class CustomField < ActiveRecord::Base\r
- has_many :custom_values, :dependent => :delete_all\r
- serialize :possible_values\r
- \r
- FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },\r
- "text" => { :name => :label_text, :order => 2 },\r
- "int" => { :name => :label_integer, :order => 3 },\r
- "list" => { :name => :label_list, :order => 4 },\r
- "date" => { :name => :label_date, :order => 5 },\r
- "bool" => { :name => :label_boolean, :order => 6 }\r
- }.freeze\r
-\r
- validates_presence_of :name, :field_format\r
- validates_uniqueness_of :name\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
- validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys\r
-\r
- def initialize(attributes = nil)\r
- super\r
- self.possible_values ||= []\r
- end\r
- \r
- def before_validation\r
- # remove empty values\r
- self.possible_values = self.possible_values.collect{|v| v unless v.empty?}.compact\r
- end\r
- \r
- def validate\r
- if self.field_format == "list"\r
- errors.add(:possible_values, :activerecord_error_blank) if self.possible_values.nil? || self.possible_values.empty?\r
- errors.add(:possible_values, :activerecord_error_invalid) unless self.possible_values.is_a? Array\r
- end\r
- end\r
-\r
- # to move in project_custom_field\r
- def self.for_all\r
- find(:all, :conditions => ["is_for_all=?", true])\r
- end\r
- \r
- def type_name\r
- nil\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class CustomField < ActiveRecord::Base
+ has_many :custom_values, :dependent => :delete_all
+ serialize :possible_values
+
+ FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
+ "text" => { :name => :label_text, :order => 2 },
+ "int" => { :name => :label_integer, :order => 3 },
+ "list" => { :name => :label_list, :order => 4 },
+ "date" => { :name => :label_date, :order => 5 },
+ "bool" => { :name => :label_boolean, :order => 6 }
+ }.freeze
+
+ validates_presence_of :name, :field_format
+ validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+ validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
+
+ def initialize(attributes = nil)
+ super
+ self.possible_values ||= []
end
-end\r
+
+ def before_validation
+ # remove empty values
+ self.possible_values = self.possible_values.collect{|v| v unless v.empty?}.compact
+ end
+
+ def validate
+ if self.field_format == "list"
+ errors.add(:possible_values, :activerecord_error_blank) if self.possible_values.nil? || self.possible_values.empty?
+ errors.add(:possible_values, :activerecord_error_invalid) unless self.possible_values.is_a? Array
+ end
+ end
+
+ # to move in project_custom_field
+ def self.for_all
+ find(:all, :conditions => ["is_for_all=?", true])
+ end
+
+ def type_name
+ nil
+ end
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class CustomValue < ActiveRecord::Base\r
- belongs_to :custom_field\r
- belongs_to :customized, :polymorphic => true\r
-\r
-protected\r
- def validate\r
- errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty? \r
- errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)\r
- errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0\r
- errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length\r
- case custom_field.field_format\r
- when "int"\r
- errors.add(:value, :activerecord_error_not_a_number) unless value =~ /^[0-9]*$/ \r
- when "date"\r
- errors.add(:value, :activerecord_error_not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/ or value.empty?\r
- when "list"\r
- errors.add(:value, :activerecord_error_inclusion) unless custom_field.possible_values.include? value or value.empty?\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class CustomValue < ActiveRecord::Base
+ belongs_to :custom_field
+ belongs_to :customized, :polymorphic => true
+
+protected
+ def validate
+ errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty?
+ errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
+ errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
+ errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
+ case custom_field.field_format
+ when "int"
+ errors.add(:value, :activerecord_error_not_a_number) unless value =~ /^[0-9]*$/
+ when "date"
+ errors.add(:value, :activerecord_error_not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/ or value.empty?
+ when "list"
+ errors.add(:value, :activerecord_error_inclusion) unless custom_field.possible_values.include? value or value.empty?
+ end
end
-end\r
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Document < ActiveRecord::Base\r
- belongs_to :project\r
- belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id"\r
- has_many :attachments, :as => :container, :dependent => :destroy\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Document < ActiveRecord::Base
+ belongs_to :project
+ belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id"
+ has_many :attachments, :as => :container, :dependent => :destroy
+
validates_presence_of :project, :title, :category
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Enumeration < ActiveRecord::Base\r
- before_destroy :check_integrity\r
- \r
- validates_presence_of :opt, :name\r
- validates_uniqueness_of :name, :scope => [:opt]\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
- \r
- OPTIONS = {\r
- "IPRI" => :enumeration_issue_priorities,\r
- "DCAT" => :enumeration_doc_categories\r
- }.freeze\r
- \r
- def self.get_values(option)\r
- find(:all, :conditions => ['opt=?', option])\r
- end\r
- \r
- def option_name\r
- OPTIONS[self.opt]\r
- end\r
- \r
-private\r
- def check_integrity\r
- case self.opt\r
- when "IPRI"\r
- raise "Can't delete enumeration" if Issue.find(:first, :conditions => ["priority_id=?", self.id])\r
- when "DCAT"\r
- raise "Can't delete enumeration" if Document.find(:first, :conditions => ["category_id=?", self.id])\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Enumeration < ActiveRecord::Base
+ before_destroy :check_integrity
+
+ validates_presence_of :opt, :name
+ validates_uniqueness_of :name, :scope => [:opt]
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+
+ OPTIONS = {
+ "IPRI" => :enumeration_issue_priorities,
+ "DCAT" => :enumeration_doc_categories
+ }.freeze
+
+ def self.get_values(option)
+ find(:all, :conditions => ['opt=?', option])
+ end
+
+ def option_name
+ OPTIONS[self.opt]
+ end
+
+private
+ def check_integrity
+ case self.opt
+ when "IPRI"
+ raise "Can't delete enumeration" if Issue.find(:first, :conditions => ["priority_id=?", self.id])
+ when "DCAT"
+ raise "Can't delete enumeration" if Document.find(:first, :conditions => ["category_id=?", self.id])
+ end
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Issue < ActiveRecord::Base\r
-\r
- belongs_to :project\r
- belongs_to :tracker\r
- belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'\r
- belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'\r
- belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id'\r
- belongs_to :fixed_version, :class_name => 'Version', :foreign_key => 'fixed_version_id'\r
- belongs_to :priority, :class_name => 'Enumeration', :foreign_key => 'priority_id'\r
- belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'\r
-\r
- has_many :journals, :as => :journalized, :dependent => :destroy\r
- has_many :attachments, :as => :container, :dependent => :destroy\r
-\r
- has_many :custom_values, :dependent => :delete_all, :as => :customized\r
- has_many :custom_fields, :through => :custom_values\r
-\r
- validates_presence_of :subject, :description, :priority, :tracker, :author, :status\r
- validates_inclusion_of :done_ratio, :in => 0..100\r
- validates_associated :custom_values, :on => :update\r
-\r
- # set default status for new issues\r
- def before_validation\r
- self.status = IssueStatus.default if new_record?\r
- end\r
-\r
- def validate\r
- if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty?\r
- errors.add :due_date, :activerecord_error_not_a_date\r
- end\r
- \r
- if self.due_date and self.start_date and self.due_date < self.start_date\r
- errors.add :due_date, :activerecord_error_greater_than_start_date\r
- end\r
- end\r
-\r
- #def before_create\r
- # build_history\r
- #end\r
- \r
- def before_save\r
- if @current_journal\r
- # attributes changes\r
- (Issue.column_names - %w(id description)).each {|c|\r
- @current_journal.details << JournalDetail.new(:property => 'attr',\r
- :prop_key => c,\r
- :old_value => @issue_before_change.send(c),\r
- :value => send(c)) unless send(c)==@issue_before_change.send(c)\r
- }\r
- # custom fields changes\r
- custom_values.each {|c|\r
- @current_journal.details << JournalDetail.new(:property => 'cf', \r
- :prop_key => c.custom_field_id,\r
- :old_value => @custom_values_before_change[c.custom_field_id],\r
- :value => c.value) unless @custom_values_before_change[c.custom_field_id]==c.value\r
- } \r
- @current_journal.save unless @current_journal.details.empty? and @current_journal.notes.empty?\r
- end\r
- end\r
- \r
- def long_id\r
- "%05d" % self.id\r
- end\r
- \r
- def custom_value_for(custom_field)\r
- self.custom_values.each {|v| return v if v.custom_field_id == custom_field.id }\r
- return nil\r
- end\r
- \r
- def init_journal(user, notes = "")\r
- @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)\r
- @issue_before_change = self.clone\r
- @custom_values_before_change = {}\r
- self.custom_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }\r
- @current_journal\r
- end\r
-\r
-private\r
- # Creates an history for the issue\r
- #def build_history\r
- # @history = self.histories.build\r
- # @history.status = self.status\r
- # @history.author = self.author\r
- #end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Issue < ActiveRecord::Base
+
+ belongs_to :project
+ belongs_to :tracker
+ belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
+ belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
+ belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id'
+ belongs_to :fixed_version, :class_name => 'Version', :foreign_key => 'fixed_version_id'
+ belongs_to :priority, :class_name => 'Enumeration', :foreign_key => 'priority_id'
+ belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
+
+ has_many :journals, :as => :journalized, :dependent => :destroy
+ has_many :attachments, :as => :container, :dependent => :destroy
+
+ has_many :custom_values, :dependent => :delete_all, :as => :customized
+ has_many :custom_fields, :through => :custom_values
+
+ validates_presence_of :subject, :description, :priority, :tracker, :author, :status
+ validates_inclusion_of :done_ratio, :in => 0..100
+ validates_associated :custom_values, :on => :update
+
+ # set default status for new issues
+ def before_validation
+ self.status = IssueStatus.default if new_record?
+ end
+
+ def validate
+ if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty?
+ errors.add :due_date, :activerecord_error_not_a_date
+ end
+
+ if self.due_date and self.start_date and self.due_date < self.start_date
+ errors.add :due_date, :activerecord_error_greater_than_start_date
+ end
+ end
+
+ #def before_create
+ # build_history
+ #end
+
+ def before_save
+ if @current_journal
+ # attributes changes
+ (Issue.column_names - %w(id description)).each {|c|
+ @current_journal.details << JournalDetail.new(:property => 'attr',
+ :prop_key => c,
+ :old_value => @issue_before_change.send(c),
+ :value => send(c)) unless send(c)==@issue_before_change.send(c)
+ }
+ # custom fields changes
+ custom_values.each {|c|
+ @current_journal.details << JournalDetail.new(:property => 'cf',
+ :prop_key => c.custom_field_id,
+ :old_value => @custom_values_before_change[c.custom_field_id],
+ :value => c.value) unless @custom_values_before_change[c.custom_field_id]==c.value
+ }
+ @current_journal.save unless @current_journal.details.empty? and @current_journal.notes.empty?
+ end
+ end
+
+ def long_id
+ "%05d" % self.id
+ end
+
+ def custom_value_for(custom_field)
+ self.custom_values.each {|v| return v if v.custom_field_id == custom_field.id }
+ return nil
+ end
+
+ def init_journal(user, notes = "")
+ @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
+ @issue_before_change = self.clone
+ @custom_values_before_change = {}
+ self.custom_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
+ @current_journal
+ end
+
+private
+ # Creates an history for the issue
+ #def build_history
+ # @history = self.histories.build
+ # @history.status = self.status
+ # @history.author = self.author
+ #end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class IssueCategory < ActiveRecord::Base\r
- before_destroy :check_integrity \r
- belongs_to :project\r
-\r
- validates_presence_of :name\r
- validates_uniqueness_of :name, :scope => [:project_id]\r
- \r
-private\r
- def check_integrity\r
- raise "Can't delete category" if Issue.find(:first, :conditions => ["category_id=?", self.id])\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class IssueCategory < ActiveRecord::Base
+ before_destroy :check_integrity
+ belongs_to :project
+
+ validates_presence_of :name
+ validates_uniqueness_of :name, :scope => [:project_id]
+
+private
+ def check_integrity
+ raise "Can't delete category" if Issue.find(:first, :conditions => ["category_id=?", self.id])
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class IssueCustomField < CustomField\r
- has_and_belongs_to_many :projects, :join_table => "custom_fields_projects", :foreign_key => "custom_field_id"\r
- has_and_belongs_to_many :trackers, :join_table => "custom_fields_trackers", :foreign_key => "custom_field_id"\r
- has_many :issues, :through => :issue_custom_values\r
- \r
- def type_name\r
- :label_issue_plural\r
- end\r
-end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class IssueCustomField < CustomField
+ has_and_belongs_to_many :projects, :join_table => "custom_fields_projects", :foreign_key => "custom_field_id"
+ has_and_belongs_to_many :trackers, :join_table => "custom_fields_trackers", :foreign_key => "custom_field_id"
+ has_many :issues, :through => :issue_custom_values
+
+ def type_name
+ :label_issue_plural
+ end
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
class IssueHistory < ActiveRecord::Base
- belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'\r
- belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'\r
- belongs_to :issue\r
- \r
- validates_presence_of :status\r
+ belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
+ belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
+ belongs_to :issue
+
+ validates_presence_of :status
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class IssueStatus < ActiveRecord::Base\r
- before_destroy :check_integrity \r
- has_many :workflows, :foreign_key => "old_status_id"\r
- acts_as_list\r
-\r
- validates_presence_of :name\r
- validates_uniqueness_of :name\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
- validates_length_of :html_color, :is => 6\r
- validates_format_of :html_color, :with => /^[a-f0-9]*$/i\r
-\r
- def before_save\r
- IssueStatus.update_all "is_default=#{connection.quoted_false}" if self.is_default?\r
- end \r
- \r
- # Returns the default status for new issues\r
- def self.default\r
- find(:first, :conditions =>["is_default=?", true])\r
- end\r
-\r
- # Returns an array of all statuses the given role can switch to\r
- def new_statuses_allowed_to(role, tracker)\r
- statuses = []\r
- for workflow in self.workflows\r
- statuses << workflow.new_status if workflow.role_id == role.id and workflow.tracker_id == tracker.id\r
- end unless role.nil? or tracker.nil?\r
- statuses\r
- end\r
- \r
-private\r
- def check_integrity\r
- raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id])\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class IssueStatus < ActiveRecord::Base
+ before_destroy :check_integrity
+ has_many :workflows, :foreign_key => "old_status_id"
+ acts_as_list
+
+ validates_presence_of :name
+ validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+ validates_length_of :html_color, :is => 6
+ validates_format_of :html_color, :with => /^[a-f0-9]*$/i
+
+ def before_save
+ IssueStatus.update_all "is_default=#{connection.quoted_false}" if self.is_default?
+ end
+
+ # Returns the default status for new issues
+ def self.default
+ find(:first, :conditions =>["is_default=?", true])
+ end
+
+ # Returns an array of all statuses the given role can switch to
+ def new_statuses_allowed_to(role, tracker)
+ statuses = []
+ for workflow in self.workflows
+ statuses << workflow.new_status if workflow.role_id == role.id and workflow.tracker_id == tracker.id
+ end unless role.nil? or tracker.nil?
+ statuses
+ end
+
+private
+ def check_integrity
+ raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id])
end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Mailer < ActionMailer::Base\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Mailer < ActionMailer::Base
helper IssuesHelper
- def issue_add(issue)\r
+ def issue_add(issue)
+ set_language_if_valid(Setting.default_language)
+ # Sends to all project members
+ @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
+ @from = Setting.mail_from
+ @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}"
+ @body['issue'] = issue
+ end
+
+ def issue_edit(journal)
set_language_if_valid(Setting.default_language)
# Sends to all project members
+ issue = journal.journalized
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
@from = Setting.mail_from
@subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}"
- @body['issue'] = issue\r
- end\r
-\r
- def issue_edit(journal)\r
- set_language_if_valid(Setting.default_language)\r
- # Sends to all project members\r
- issue = journal.journalized\r
- @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact\r
- @from = Setting.mail_from\r
- @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}"\r
- @body['issue'] = issue\r
- @body['journal']= journal\r
- end\r
- \r
- def document_add(document)\r
- set_language_if_valid(Setting.default_language)\r
- @recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact\r
- @from = Setting.mail_from\r
- @subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"\r
- @body['document'] = document\r
- end\r
- \r
- def attachments_add(attachments)\r
- set_language_if_valid(Setting.default_language)\r
- container = attachments.first.container\r
- url = "http://#{Setting.host_name}/"\r
- added_to = ""\r
- case container.class.to_s\r
- when 'Version'\r
- url << "projects/list_files/#{container.project_id}"\r
- added_to = "#{l(:label_version)}: #{container.name}"\r
- when 'Document'\r
- url << "documents/show/#{container.id}"\r
- added_to = "#{l(:label_document)}: #{container.title}"\r
- when 'Issue'\r
- url << "issues/show/#{container.id}"\r
- added_to = "#{container.tracker.name} ##{container.id}: #{container.subject}"\r
- end\r
- @recipients = container.project.users.collect { |u| u.mail if u.mail_notification }.compact\r
- @from = Setting.mail_from\r
- @subject = "[#{container.project.name}] #{l(:label_attachment_new)}"\r
- @body['attachments'] = attachments\r
- @body['url'] = url\r
- @body['added_to'] = added_to\r
- end\r
- \r
- def lost_password(token)\r
- set_language_if_valid(token.user.language)\r
- @recipients = token.user.mail\r
- @from = Setting.mail_from\r
- @subject = l(:mail_subject_lost_password)\r
- @body['token'] = token\r
+ @body['issue'] = issue
+ @body['journal']= journal
+ end
+
+ def document_add(document)
+ set_language_if_valid(Setting.default_language)
+ @recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact
+ @from = Setting.mail_from
+ @subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
+ @body['document'] = document
+ end
+
+ def attachments_add(attachments)
+ set_language_if_valid(Setting.default_language)
+ container = attachments.first.container
+ url = "http://#{Setting.host_name}/"
+ added_to = ""
+ case container.class.to_s
+ when 'Version'
+ url << "projects/list_files/#{container.project_id}"
+ added_to = "#{l(:label_version)}: #{container.name}"
+ when 'Document'
+ url << "documents/show/#{container.id}"
+ added_to = "#{l(:label_document)}: #{container.title}"
+ when 'Issue'
+ url << "issues/show/#{container.id}"
+ added_to = "#{container.tracker.name} ##{container.id}: #{container.subject}"
+ end
+ @recipients = container.project.users.collect { |u| u.mail if u.mail_notification }.compact
+ @from = Setting.mail_from
+ @subject = "[#{container.project.name}] #{l(:label_attachment_new)}"
+ @body['attachments'] = attachments
+ @body['url'] = url
+ @body['added_to'] = added_to
+ end
+
+ def lost_password(token)
+ set_language_if_valid(token.user.language)
+ @recipients = token.user.mail
+ @from = Setting.mail_from
+ @subject = l(:mail_subject_lost_password)
+ @body['token'] = token
end
-\r
- def register(token)\r
- set_language_if_valid(token.user.language)\r
- @recipients = token.user.mail\r
- @from = Setting.mail_from\r
- @subject = l(:mail_subject_register)\r
- @body['token'] = token\r
- end\r
+
+ def register(token)
+ set_language_if_valid(token.user.language)
+ @recipients = token.user.mail
+ @from = Setting.mail_from
+ @subject = l(:mail_subject_register)
+ @body['token'] = token
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Member < ActiveRecord::Base\r
- belongs_to :user\r
- belongs_to :role\r
- belongs_to :project\r
-\r
- validates_presence_of :role, :user, :project\r
- validates_uniqueness_of :user_id, :scope => :project_id\r
-\r
- def name\r
- self.user.display_name\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Member < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :role
+ belongs_to :project
+
+ validates_presence_of :role, :user, :project
+ validates_uniqueness_of :user_id, :scope => :project_id
+
+ def name
+ self.user.display_name
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class News < ActiveRecord::Base\r
- belongs_to :project\r
- belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'\r
- has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"\r
- \r
- validates_presence_of :title, :description\r
- \r
- # returns latest news for projects visible by user\r
- def self.latest(user=nil, count=5)\r
- find(:all, :limit => count, :conditions => Project.visible_by(user), :include => [ :author, :project ], :order => "news.created_on DESC") \r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class News < ActiveRecord::Base
+ belongs_to :project
+ belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
+ has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
+
+ validates_presence_of :title, :description
+
+ # 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.created_on DESC")
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Permission < ActiveRecord::Base\r
- has_and_belongs_to_many :roles\r
-\r
- validates_presence_of :controller, :action, :description\r
-\r
- GROUPS = {\r
- 100 => :label_project,\r
- 200 => :label_member_plural,\r
- 300 => :label_version_plural,\r
- 400 => :label_issue_category_plural,\r
- 600 => :label_query_plural,\r
- 1000 => :label_issue_plural,\r
- 1100 => :label_news_plural,\r
- 1200 => :label_document_plural,\r
- 1300 => :label_attachment_plural,\r
- 1400 => :label_repository\r
- }.freeze\r
- \r
- @@cached_perms_for_public = nil\r
- @@cached_perms_for_roles = nil\r
- \r
- def name\r
- self.controller + "/" + self.action\r
- end\r
- \r
- def group_id\r
- (self.sort / 100)*100\r
- end\r
- \r
- def self.allowed_to_public(action)\r
- @@cached_perms_for_public ||= find(:all, :conditions => ["is_public=?", true]).collect {|p| "#{p.controller}/#{p.action}"}\r
- @@cached_perms_for_public.include? action\r
- end\r
- \r
- def self.allowed_to_role(action, role)\r
- @@cached_perms_for_roles ||=\r
- begin\r
- perms = {}\r
- find(:all, :include => :roles).each {|p| perms.store "#{p.controller}/#{p.action}", p.roles.collect {|r| r.id } }\r
- perms\r
- end\r
- allowed_to_public(action) or (@@cached_perms_for_roles[action] and @@cached_perms_for_roles[action].include? role)\r
- end\r
- \r
- def self.allowed_to_role_expired\r
- @@cached_perms_for_roles = nil\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Permission < ActiveRecord::Base
+ has_and_belongs_to_many :roles
+
+ validates_presence_of :controller, :action, :description
+
+ GROUPS = {
+ 100 => :label_project,
+ 200 => :label_member_plural,
+ 300 => :label_version_plural,
+ 400 => :label_issue_category_plural,
+ 600 => :label_query_plural,
+ 1000 => :label_issue_plural,
+ 1100 => :label_news_plural,
+ 1200 => :label_document_plural,
+ 1300 => :label_attachment_plural,
+ 1400 => :label_repository
+ }.freeze
+
+ @@cached_perms_for_public = nil
+ @@cached_perms_for_roles = nil
+
+ def name
+ self.controller + "/" + self.action
+ end
+
+ def group_id
+ (self.sort / 100)*100
+ end
+
+ def self.allowed_to_public(action)
+ @@cached_perms_for_public ||= find(:all, :conditions => ["is_public=?", true]).collect {|p| "#{p.controller}/#{p.action}"}
+ @@cached_perms_for_public.include? action
+ end
+
+ def self.allowed_to_role(action, role)
+ @@cached_perms_for_roles ||=
+ begin
+ perms = {}
+ find(:all, :include => :roles).each {|p| perms.store "#{p.controller}/#{p.action}", p.roles.collect {|r| r.id } }
+ perms
+ end
+ allowed_to_public(action) or (@@cached_perms_for_roles[action] and @@cached_perms_for_roles[action].include? role)
+ end
+
+ def self.allowed_to_role_expired
+ @@cached_perms_for_roles = nil
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Project < ActiveRecord::Base\r
- has_many :versions, :dependent => :destroy, :order => "versions.effective_date DESC, versions.name DESC"\r
- has_many :members, :dependent => :delete_all, :include => :user, :conditions => "users.status=#{User::STATUS_ACTIVE}"\r
- has_many :users, :through => :members\r
- has_many :custom_values, :dependent => :delete_all, :as => :customized\r
- has_many :issues, :dependent => :destroy, :order => "issues.created_on DESC", :include => [:status, :tracker]\r
- has_many :queries, :dependent => :delete_all\r
- has_many :documents, :dependent => :destroy\r
- has_many :news, :dependent => :delete_all, :include => :author\r
- has_many :issue_categories, :dependent => :delete_all, :order => "issue_categories.name"\r
- has_one :repository, :dependent => :destroy\r
- has_one :wiki, :dependent => :destroy\r
- has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'\r
- acts_as_tree :order => "name", :counter_cache => true\r
-\r
- validates_presence_of :name, :description\r
- validates_uniqueness_of :name\r
- validates_associated :custom_values, :on => :update\r
- validates_associated :repository, :wiki\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
-\r
- # returns latest created projects\r
- # non public projects will be returned only if user is a member of those\r
- def self.latest(user=nil, count=5)\r
- find(:all, :limit => count, :conditions => visible_by(user), :order => "projects.created_on DESC") \r
- end \r
-\r
- def self.visible_by(user=nil)\r
- if user && !user.memberships.empty?\r
- return ["projects.is_public = ? or projects.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')})", true]\r
- else\r
- return ["projects.is_public = ?", true]\r
- end\r
- end\r
- \r
- # Returns an array of all custom fields enabled for project issues\r
- # (explictly associated custom fields and custom fields enabled for all projects)\r
- def custom_fields_for_issues(tracker)\r
- tracker.custom_fields.find(:all, :include => :projects, \r
- :conditions => ["is_for_all=? or project_id=?", true, self.id])\r
- #(CustomField.for_all + custom_fields).uniq\r
- end\r
- \r
- def all_custom_fields\r
- @all_custom_fields ||= IssueCustomField.find(:all, :include => :projects, \r
- :conditions => ["is_for_all=? or project_id=?", true, self.id])\r
- end\r
-\r
-protected\r
- def validate\r
- errors.add(parent_id, " must be a root project") if parent and parent.parent\r
- errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Project < ActiveRecord::Base
+ has_many :versions, :dependent => :destroy, :order => "versions.effective_date DESC, versions.name DESC"
+ has_many :members, :dependent => :delete_all, :include => :user, :conditions => "users.status=#{User::STATUS_ACTIVE}"
+ has_many :users, :through => :members
+ has_many :custom_values, :dependent => :delete_all, :as => :customized
+ has_many :issues, :dependent => :destroy, :order => "issues.created_on DESC", :include => [:status, :tracker]
+ has_many :queries, :dependent => :delete_all
+ has_many :documents, :dependent => :destroy
+ has_many :news, :dependent => :delete_all, :include => :author
+ has_many :issue_categories, :dependent => :delete_all, :order => "issue_categories.name"
+ has_one :repository, :dependent => :destroy
+ has_one :wiki, :dependent => :destroy
+ has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'
+ acts_as_tree :order => "name", :counter_cache => true
+
+ validates_presence_of :name, :description
+ validates_uniqueness_of :name
+ validates_associated :custom_values, :on => :update
+ validates_associated :repository, :wiki
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+
+ # returns latest created projects
+ # non public projects will be returned only if user is a member of those
+ def self.latest(user=nil, count=5)
+ find(:all, :limit => count, :conditions => visible_by(user), :order => "projects.created_on DESC")
+ end
+
+ def self.visible_by(user=nil)
+ if user && !user.memberships.empty?
+ return ["projects.is_public = ? or projects.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')})", true]
+ else
+ return ["projects.is_public = ?", true]
+ end
+ end
+
+ # Returns an array of all custom fields enabled for project issues
+ # (explictly associated custom fields and custom fields enabled for all projects)
+ def custom_fields_for_issues(tracker)
+ tracker.custom_fields.find(:all, :include => :projects,
+ :conditions => ["is_for_all=? or project_id=?", true, self.id])
+ #(CustomField.for_all + custom_fields).uniq
+ end
+
+ def all_custom_fields
+ @all_custom_fields ||= IssueCustomField.find(:all, :include => :projects,
+ :conditions => ["is_for_all=? or project_id=?", true, self.id])
+ end
+
+protected
+ def validate
+ errors.add(parent_id, " must be a root project") if parent and parent.parent
+ errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class ProjectCustomField < CustomField\r
- def type_name\r
- :label_project_plural\r
- end\r
-end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class ProjectCustomField < CustomField
+ def type_name
+ :label_project_plural
+ end
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Role < ActiveRecord::Base\r
- before_destroy :check_integrity \r
- has_and_belongs_to_many :permissions\r
- has_many :workflows, :dependent => :delete_all\r
- has_many :members\r
- acts_as_list\r
-\r
- validates_presence_of :name\r
- validates_uniqueness_of :name\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
-\r
-private\r
- def check_integrity\r
- raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Role < ActiveRecord::Base
+ before_destroy :check_integrity
+ has_and_belongs_to_many :permissions
+ has_many :workflows, :dependent => :delete_all
+ has_many :members
+ acts_as_list
+
+ validates_presence_of :name
+ validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+
+private
+ def check_integrity
+ raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require 'rexml/document'\r
-\r
-module SvnRepos\r
-\r
- class CommandFailed < StandardError #:nodoc:\r
- end\r
-\r
- class Base\r
- \r
- def initialize(url, login=nil, password=nil)\r
- @url = url\r
- @login = login if login && !login.empty?\r
- @password = (password || "") if @login \r
- end\r
- \r
- # Returns the entry identified by path and revision identifier\r
- # or nil if entry doesn't exist in the repository\r
- def entry(path=nil, identifier=nil)\r
- e = entries(path, identifier)\r
- e ? e.first : nil\r
- end\r
- \r
- # Returns an Entries collection\r
- # or nil if the given path doesn't exist in the repository\r
- def entries(path=nil, identifier=nil)\r
- path ||= ''\r
- identifier = 'HEAD' unless identifier and identifier > 0\r
- entries = Entries.new\r
- cmd = "svn list --xml #{target(path)}@#{identifier}"\r
- cmd << " --username #{@login} --password #{@password}" if @login\r
- shellout(cmd) do |io|\r
- begin\r
- doc = REXML::Document.new(io)\r
- doc.elements.each("lists/list/entry") do |entry|\r
- entries << Entry.new({:name => entry.elements['name'].text,\r
- :path => ((path.empty? ? "" : "#{path}/") + entry.elements['name'].text),\r
- :kind => entry.attributes['kind'],\r
- :size => (entry.elements['size'] and entry.elements['size'].text).to_i,\r
- :lastrev => Revision.new({\r
- :identifier => entry.elements['commit'].attributes['revision'],\r
- :time => Time.parse(entry.elements['commit'].elements['date'].text),\r
- :author => (entry.elements['commit'].elements['author'] ? entry.elements['commit'].elements['author'].text : "anonymous")\r
- })\r
- })\r
- end\r
- rescue\r
- end\r
- end\r
- return nil if $? && $?.exitstatus != 0\r
- entries.sort_by_name\r
- rescue Errno::ENOENT => e\r
- raise CommandFailed\r
- end\r
-\r
- def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})\r
- path ||= ''\r
- identifier_from = 'HEAD' unless identifier_from and identifier_from.to_i > 0\r
- identifier_to = 1 unless identifier_to and identifier_to.to_i > 0\r
- revisions = Revisions.new\r
- cmd = "svn log --xml -r #{identifier_from}:#{identifier_to}"\r
- cmd << " --username #{@login} --password #{@password}" if @login\r
- cmd << " --verbose " if options[:with_paths]\r
- cmd << target(path)\r
- shellout(cmd) do |io|\r
- begin\r
- doc = REXML::Document.new(io)\r
- doc.elements.each("log/logentry") do |logentry|\r
- paths = []\r
- logentry.elements.each("paths/path") do |path|\r
- paths << {:action => path.attributes['action'],\r
- :path => path.text\r
- }\r
- end\r
- paths.sort! { |x,y| x[:path] <=> y[:path] }\r
- \r
- revisions << Revision.new({:identifier => logentry.attributes['revision'],\r
- :author => (logentry.elements['author'] ? logentry.elements['author'].text : "anonymous"),\r
- :time => Time.parse(logentry.elements['date'].text),\r
- :message => logentry.elements['msg'].text,\r
- :paths => paths\r
- })\r
- end\r
- rescue\r
- end\r
- end\r
- return nil if $? && $?.exitstatus != 0\r
- revisions\r
- rescue Errno::ENOENT => e\r
- raise CommandFailed \r
- end\r
- \r
- def diff(path, identifier_from, identifier_to=nil)\r
- path ||= ''\r
- if identifier_to and identifier_to.to_i > 0\r
- identifier_to = identifier_to.to_i \r
- else\r
- identifier_to = identifier_from.to_i - 1\r
- end\r
- cmd = "svn diff -r "\r
- cmd << "#{identifier_to}:"\r
- cmd << "#{identifier_from}"\r
- cmd << "#{target(path)}@#{identifier_from}"\r
- cmd << " --username #{@login} --password #{@password}" if @login\r
- diff = []\r
- shellout(cmd) do |io|\r
- io.each_line do |line|\r
- diff << line\r
- end\r
- end\r
- return nil if $? && $?.exitstatus != 0\r
- diff\r
- rescue Errno::ENOENT => e\r
- raise CommandFailed \r
- end\r
- \r
- def cat(path, identifier=nil)\r
- identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"\r
- cmd = "svn cat #{target(path)}@#{identifier}"\r
- cmd << " --username #{@login} --password #{@password}" if @login\r
- cat = nil\r
- shellout(cmd) do |io|\r
- cat = io.read\r
- end\r
- return nil if $? && $?.exitstatus != 0\r
- cat\r
- rescue Errno::ENOENT => e\r
- raise CommandFailed \r
- end\r
- \r
- private\r
- def target(path)\r
- " \"" << "#{@url}/#{path}".gsub(/["'?<>\*]/, '') << "\""\r
- end\r
- \r
- def logger\r
- RAILS_DEFAULT_LOGGER\r
- end\r
- \r
- def shellout(cmd, &block)\r
- logger.debug "Shelling out: #{cmd}" if logger && logger.debug?\r
- IO.popen(cmd, "r+") do |io|\r
- io.close_write\r
- block.call(io) if block_given?\r
- end\r
- end\r
- end\r
- \r
- class Entries < Array\r
- def sort_by_name\r
- sort {|x,y| \r
- if x.kind == y.kind\r
- x.name <=> y.name\r
- else\r
- x.kind <=> y.kind\r
- end\r
- } \r
- end\r
- \r
- def revisions\r
- revisions ||= Revisions.new(collect{|entry| entry.lastrev})\r
- end\r
- end\r
- \r
- class Entry\r
- attr_accessor :name, :path, :kind, :size, :lastrev\r
- def initialize(attributes={})\r
- self.name = attributes[:name] if attributes[:name]\r
- self.path = attributes[:path] if attributes[:path]\r
- self.kind = attributes[:kind] if attributes[:kind]\r
- self.size = attributes[:size].to_i if attributes[:size]\r
- self.lastrev = attributes[:lastrev]\r
- end\r
- \r
- def is_file?\r
- 'file' == self.kind\r
- end\r
- \r
- def is_dir?\r
- 'dir' == self.kind\r
- end\r
- end\r
- \r
- class Revisions < Array\r
- def latest\r
- sort {|x,y| x.time <=> y.time}.last \r
- end \r
- end\r
- \r
- class Revision\r
- attr_accessor :identifier, :author, :time, :message, :paths\r
- def initialize(attributes={})\r
- self.identifier = attributes[:identifier]\r
- self.author = attributes[:author]\r
- self.time = attributes[:time]\r
- self.message = attributes[:message] || ""\r
- self.paths = attributes[:paths]\r
- end\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require 'rexml/document'
+
+module SvnRepos
+
+ class CommandFailed < StandardError #:nodoc:
+ end
+
+ class Base
+
+ def initialize(url, login=nil, password=nil)
+ @url = url
+ @login = login if login && !login.empty?
+ @password = (password || "") if @login
+ end
+
+ # Returns the entry identified by path and revision identifier
+ # or nil if entry doesn't exist in the repository
+ def entry(path=nil, identifier=nil)
+ e = entries(path, identifier)
+ e ? e.first : nil
+ end
+
+ # Returns an Entries collection
+ # or nil if the given path doesn't exist in the repository
+ def entries(path=nil, identifier=nil)
+ path ||= ''
+ identifier = 'HEAD' unless identifier and identifier > 0
+ entries = Entries.new
+ cmd = "svn list --xml #{target(path)}@#{identifier}"
+ cmd << " --username #{@login} --password #{@password}" if @login
+ shellout(cmd) do |io|
+ begin
+ doc = REXML::Document.new(io)
+ doc.elements.each("lists/list/entry") do |entry|
+ entries << Entry.new({:name => entry.elements['name'].text,
+ :path => ((path.empty? ? "" : "#{path}/") + entry.elements['name'].text),
+ :kind => entry.attributes['kind'],
+ :size => (entry.elements['size'] and entry.elements['size'].text).to_i,
+ :lastrev => Revision.new({
+ :identifier => entry.elements['commit'].attributes['revision'],
+ :time => Time.parse(entry.elements['commit'].elements['date'].text),
+ :author => (entry.elements['commit'].elements['author'] ? entry.elements['commit'].elements['author'].text : "anonymous")
+ })
+ })
+ end
+ rescue
+ end
+ end
+ return nil if $? && $?.exitstatus != 0
+ entries.sort_by_name
+ rescue Errno::ENOENT => e
+ raise CommandFailed
+ end
+
+ def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
+ path ||= ''
+ identifier_from = 'HEAD' unless identifier_from and identifier_from.to_i > 0
+ identifier_to = 1 unless identifier_to and identifier_to.to_i > 0
+ revisions = Revisions.new
+ cmd = "svn log --xml -r #{identifier_from}:#{identifier_to}"
+ cmd << " --username #{@login} --password #{@password}" if @login
+ cmd << " --verbose " if options[:with_paths]
+ cmd << target(path)
+ shellout(cmd) do |io|
+ begin
+ doc = REXML::Document.new(io)
+ doc.elements.each("log/logentry") do |logentry|
+ paths = []
+ logentry.elements.each("paths/path") do |path|
+ paths << {:action => path.attributes['action'],
+ :path => path.text
+ }
+ end
+ paths.sort! { |x,y| x[:path] <=> y[:path] }
+
+ revisions << Revision.new({:identifier => logentry.attributes['revision'],
+ :author => (logentry.elements['author'] ? logentry.elements['author'].text : "anonymous"),
+ :time => Time.parse(logentry.elements['date'].text),
+ :message => logentry.elements['msg'].text,
+ :paths => paths
+ })
+ end
+ rescue
+ end
+ end
+ return nil if $? && $?.exitstatus != 0
+ revisions
+ rescue Errno::ENOENT => e
+ raise CommandFailed
+ end
+
+ def diff(path, identifier_from, identifier_to=nil)
+ path ||= ''
+ if identifier_to and identifier_to.to_i > 0
+ identifier_to = identifier_to.to_i
+ else
+ identifier_to = identifier_from.to_i - 1
+ end
+ cmd = "svn diff -r "
+ cmd << "#{identifier_to}:"
+ cmd << "#{identifier_from}"
+ cmd << "#{target(path)}@#{identifier_from}"
+ cmd << " --username #{@login} --password #{@password}" if @login
+ diff = []
+ shellout(cmd) do |io|
+ io.each_line do |line|
+ diff << line
+ end
+ end
+ return nil if $? && $?.exitstatus != 0
+ diff
+ rescue Errno::ENOENT => e
+ raise CommandFailed
+ end
+
+ def cat(path, identifier=nil)
+ identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
+ cmd = "svn cat #{target(path)}@#{identifier}"
+ cmd << " --username #{@login} --password #{@password}" if @login
+ cat = nil
+ shellout(cmd) do |io|
+ cat = io.read
+ end
+ return nil if $? && $?.exitstatus != 0
+ cat
+ rescue Errno::ENOENT => e
+ raise CommandFailed
+ end
+
+ private
+ def target(path)
+ " \"" << "#{@url}/#{path}".gsub(/["'?<>\*]/, '') << "\""
+ end
+
+ def logger
+ RAILS_DEFAULT_LOGGER
+ end
+
+ def shellout(cmd, &block)
+ logger.debug "Shelling out: #{cmd}" if logger && logger.debug?
+ IO.popen(cmd, "r+") do |io|
+ io.close_write
+ block.call(io) if block_given?
+ end
+ end
+ end
+
+ class Entries < Array
+ def sort_by_name
+ sort {|x,y|
+ if x.kind == y.kind
+ x.name <=> y.name
+ else
+ x.kind <=> y.kind
+ end
+ }
+ end
+
+ def revisions
+ revisions ||= Revisions.new(collect{|entry| entry.lastrev})
+ end
+ end
+
+ class Entry
+ attr_accessor :name, :path, :kind, :size, :lastrev
+ def initialize(attributes={})
+ self.name = attributes[:name] if attributes[:name]
+ self.path = attributes[:path] if attributes[:path]
+ self.kind = attributes[:kind] if attributes[:kind]
+ self.size = attributes[:size].to_i if attributes[:size]
+ self.lastrev = attributes[:lastrev]
+ end
+
+ def is_file?
+ 'file' == self.kind
+ end
+
+ def is_dir?
+ 'dir' == self.kind
+ end
+ end
+
+ class Revisions < Array
+ def latest
+ sort {|x,y| x.time <=> y.time}.last
+ end
+ end
+
+ class Revision
+ attr_accessor :identifier, :author, :time, :message, :paths
+ def initialize(attributes={})
+ self.identifier = attributes[:identifier]
+ self.author = attributes[:author]
+ self.time = attributes[:time]
+ self.message = attributes[:message] || ""
+ self.paths = attributes[:paths]
+ end
+ end
end
\ No newline at end of file
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Tracker < ActiveRecord::Base\r
- before_destroy :check_integrity \r
- has_many :issues\r
- has_many :workflows, :dependent => :delete_all\r
- has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'\r
- acts_as_list\r
-\r
- validates_presence_of :name\r
- validates_uniqueness_of :name\r
- validates_format_of :name, :with => /^[\w\s\'\-]*$/i\r
-\r
-private\r
- def check_integrity\r
- raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Tracker < ActiveRecord::Base
+ before_destroy :check_integrity
+ has_many :issues
+ has_many :workflows, :dependent => :delete_all
+ has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
+ acts_as_list
+
+ validates_presence_of :name
+ validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+
+private
+ def check_integrity
+ raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])
end
end
-# redMine - project management software\r
-# Copyright (C) 2006-2007 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-require "digest/sha1"\r
-\r
-class User < ActiveRecord::Base\r
- has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => :delete_all\r
- has_many :projects, :through => :memberships\r
- has_many :custom_values, :dependent => :delete_all, :as => :customized\r
- has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'\r
- belongs_to :auth_source\r
- \r
- attr_accessor :password, :password_confirmation\r
- attr_accessor :last_before_login_on\r
- # Prevents unauthorized assignments\r
- attr_protected :login, :admin, :password, :password_confirmation, :hashed_password\r
- \r
- validates_presence_of :login, :firstname, :lastname, :mail\r
- validates_uniqueness_of :login, :mail \r
- # Login must contain lettres, numbers, underscores only\r
- validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i\r
- validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i\r
- validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i\r
- # Password length between 4 and 12\r
- validates_length_of :password, :in => 4..12, :allow_nil => true\r
- validates_confirmation_of :password, :allow_nil => true\r
- validates_associated :custom_values, :on => :update\r
-\r
- # Account statuses\r
- STATUS_ACTIVE = 1\r
- STATUS_REGISTERED = 2\r
- STATUS_LOCKED = 3\r
-\r
- def before_save\r
- # update hashed_password if password was set\r
- self.hashed_password = User.hash_password(self.password) if self.password\r
- end\r
-\r
- def self.active\r
- with_scope :find => { :conditions => [ "status = ?", STATUS_ACTIVE ] } do \r
- yield \r
- end \r
- end\r
- \r
- def self.find_active(*args)\r
- active do\r
- find(*args)\r
- end\r
- end\r
- \r
- # Returns the user that matches provided login and password, or nil\r
- def self.try_to_login(login, password)\r
- user = find(:first, :conditions => ["login=?", login])\r
- if user\r
- # user is already in local database\r
- return nil if !user.active?\r
- if user.auth_source\r
- # user has an external authentication method\r
- return nil unless user.auth_source.authenticate(login, password)\r
- else\r
- # authentication with local password\r
- return nil unless User.hash_password(password) == user.hashed_password \r
- end\r
- else\r
- # user is not yet registered, try to authenticate with available sources\r
- attrs = AuthSource.authenticate(login, password)\r
- if attrs\r
- onthefly = new(*attrs)\r
- onthefly.login = login\r
- onthefly.language = Setting.default_language\r
- if onthefly.save\r
- user = find(:first, :conditions => ["login=?", login])\r
- logger.info("User '#{user.login}' created on the fly.") if logger\r
- end\r
- end\r
- end \r
- user.update_attribute(:last_login_on, Time.now) if user\r
- user\r
- \r
- rescue => text\r
- raise text\r
- end\r
- \r
- # Return user's full name for display\r
- def display_name\r
- firstname + " " + lastname\r
- end\r
- \r
- def name\r
- display_name\r
- end\r
- \r
- def active?\r
- self.status == STATUS_ACTIVE\r
- end\r
-\r
- def registered?\r
- self.status == STATUS_REGISTERED\r
- end\r
- \r
- def locked?\r
- self.status == STATUS_LOCKED\r
- end\r
-\r
- def check_password?(clear_password)\r
- User.hash_password(clear_password) == self.hashed_password\r
- end\r
- \r
- def role_for_project(project_id)\r
- @role_for_projects ||=\r
- begin\r
- roles = {}\r
- self.memberships.each { |m| roles.store m.project_id, m.role_id }\r
- roles\r
- end\r
- @role_for_projects[project_id]\r
- end\r
- \r
- def pref\r
- self.preference ||= UserPreference.new(:user => self)\r
- end\r
- \r
-private\r
- # Return password digest\r
- def self.hash_password(clear_password)\r
- Digest::SHA1.hexdigest(clear_password || "")\r
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require "digest/sha1"
+
+class User < ActiveRecord::Base
+ has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => :delete_all
+ has_many :projects, :through => :memberships
+ has_many :custom_values, :dependent => :delete_all, :as => :customized
+ has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
+ belongs_to :auth_source
+
+ attr_accessor :password, :password_confirmation
+ attr_accessor :last_before_login_on
+ # Prevents unauthorized assignments
+ attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
+
+ validates_presence_of :login, :firstname, :lastname, :mail
+ validates_uniqueness_of :login, :mail
+ # Login must contain lettres, numbers, underscores only
+ validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
+ validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
+ validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
+ # Password length between 4 and 12
+ validates_length_of :password, :in => 4..12, :allow_nil => true
+ validates_confirmation_of :password, :allow_nil => true
+ validates_associated :custom_values, :on => :update
+
+ # Account statuses
+ STATUS_ACTIVE = 1
+ STATUS_REGISTERED = 2
+ STATUS_LOCKED = 3
+
+ def before_save
+ # 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
+ end
+
+ # Returns the user that matches provided login and password, or nil
+ def self.try_to_login(login, password)
+ user = find(:first, :conditions => ["login=?", login])
+ if user
+ # user is already in local database
+ return nil if !user.active?
+ if user.auth_source
+ # user has an external authentication method
+ return nil unless user.auth_source.authenticate(login, password)
+ else
+ # authentication with local password
+ return nil unless User.hash_password(password) == user.hashed_password
+ end
+ else
+ # user is not yet registered, try to authenticate with available sources
+ attrs = AuthSource.authenticate(login, password)
+ if attrs
+ onthefly = new(*attrs)
+ onthefly.login = login
+ onthefly.language = Setting.default_language
+ if onthefly.save
+ user = find(:first, :conditions => ["login=?", login])
+ logger.info("User '#{user.login}' created on the fly.") if logger
+ end
+ end
+ end
+ user.update_attribute(:last_login_on, Time.now) if user
+ user
+
+ rescue => text
+ raise text
+ end
+
+ # Return user's full name for display
+ def display_name
+ firstname + " " + lastname
+ end
+
+ def name
+ display_name
+ end
+
+ def active?
+ self.status == STATUS_ACTIVE
+ end
+
+ def registered?
+ self.status == STATUS_REGISTERED
+ end
+
+ def locked?
+ self.status == STATUS_LOCKED
+ end
+
+ def check_password?(clear_password)
+ User.hash_password(clear_password) == self.hashed_password
+ end
+
+ def role_for_project(project_id)
+ @role_for_projects ||=
+ begin
+ roles = {}
+ self.memberships.each { |m| roles.store m.project_id, m.role_id }
+ roles
+ end
+ @role_for_projects[project_id]
+ end
+
+ def pref
+ self.preference ||= UserPreference.new(:user => self)
+ end
+
+private
+ # Return password digest
+ def self.hash_password(clear_password)
+ Digest::SHA1.hexdigest(clear_password || "")
end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class UserCustomField < CustomField\r
- def type_name\r
- :label_user_plural\r
- end\r
-end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class UserCustomField < CustomField
+ def type_name
+ :label_user_plural
+ end
+end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Version < ActiveRecord::Base\r
- before_destroy :check_integrity\r
- belongs_to :project\r
- has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'\r
- has_many :attachments, :as => :container, :dependent => :destroy\r
-\r
- validates_presence_of :name\r
- validates_uniqueness_of :name, :scope => [:project_id]\r
- validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date\r
- \r
-private\r
- def check_integrity\r
- raise "Can't delete version" if self.fixed_issues.find(:first)\r
- end\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Version < ActiveRecord::Base
+ before_destroy :check_integrity
+ belongs_to :project
+ has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
+ has_many :attachments, :as => :container, :dependent => :destroy
+
+ validates_presence_of :name
+ validates_uniqueness_of :name, :scope => [:project_id]
+ validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date
+
+private
+ def check_integrity
+ raise "Can't delete version" if self.fixed_issues.find(:first)
+ end
end
-# redMine - project management software\r
-# Copyright (C) 2006 Jean-Philippe Lang\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-class Workflow < ActiveRecord::Base\r
- belongs_to :role\r
- belongs_to :old_status, :class_name => 'IssueStatus', :foreign_key => 'old_status_id'\r
- belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id'\r
-\r
- validates_presence_of :role, :old_status, :new_status\r
+# redMine - project management software
+# Copyright (C) 2006 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Workflow < ActiveRecord::Base
+ belongs_to :role
+ belongs_to :old_status, :class_name => 'IssueStatus', :foreign_key => 'old_status_id'
+ belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id'
+
+ validates_presence_of :role, :old_status, :new_status
end
-<center>\r
-<div class="box login">\r
+<center>
+<div class="box login">
<h2 class="icon22 icon22-authent"><%=l(:label_please_login)%></h2>
-\r
-<% form_tag({:action=> "login"}, :class => "tabular") do %>\r
-<p><label for="login"><%=l(:field_login)%>:</label>\r
-<%= text_field_tag 'login', nil, :size => 25 %></p>\r
-\r
-<p><label for="password"><%=l(:field_password)%>:</label>\r
-<%= password_field_tag 'password', nil, :size => 25 %></p>\r
-\r
+
+<% form_tag({:action=> "login"}, :class => "tabular") do %>
+<p><label for="login"><%=l(:field_login)%>:</label>
+<%= text_field_tag 'login', nil, :size => 25 %></p>
+
+<p><label for="password"><%=l(:field_password)%>:</label>
+<%= password_field_tag 'password', nil, :size => 25 %></p>
+
<p><center><input type="submit" name="login" value="<%=l(:button_login)%> »" class="primary" /></center>
-<% end %>\r
-\r
-<br>\r
-<% links = []\r
- links << link_to(l(:label_register), :action => 'register') if Setting.self_registration?\r
- links << link_to(l(:label_password_lost), :action => 'lost_password') if Setting.lost_password?\r
-%>\r
-<%= links.join(" | ") %>\r
-</p>\r
+<% end %>
+
+<br>
+<% links = []
+ links << link_to(l(:label_register), :action => 'register') if Setting.self_registration?
+ links << link_to(l(:label_password_lost), :action => 'lost_password') if Setting.lost_password?
+%>
+<%= links.join(" | ") %>
+</p>
-</div>\r
+</div>
</center>
\ No newline at end of file
-<center>\r
-<div class="box login">\r
-<h2><%=l(:label_password_lost)%></h2>\r
-\r
-<% form_tag({:action=> "lost_password"}, :class => "tabular") do %>\r
-\r
-<p><label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>\r
-<%= text_field_tag 'mail', nil, :size => 40 %></p>\r
-\r
-<p><center><%= submit_tag l(:button_submit) %></center></p>\r
-\r
-<% end %>\r
-</div>\r
+<center>
+<div class="box login">
+<h2><%=l(:label_password_lost)%></h2>
+
+<% form_tag({:action=> "lost_password"}, :class => "tabular") do %>
+
+<p><label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>
+<%= text_field_tag 'mail', nil, :size => 40 %></p>
+
+<p><center><%= submit_tag l(:button_submit) %></center></p>
+
+<% end %>
+</div>
</center>
\ No newline at end of file
<center>
<div class="box login">
<h2><%=l(:label_password_lost)%></h2>
-\r
-<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />\r
+
+<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
<%= error_messages_for 'user' %>
-\r
+
<% form_tag({:token => @token.value}, :class => "tabular") do %>
-\r
+
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password', nil, :size => 25 %></p>\r
-\r
+ <%= password_field_tag 'new_password', nil, :size => 25 %></p>
+
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>\r
+ <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
<p><center><%= submit_tag l(:button_save) %></center></p>
- <% end %>\r
- \r
+ <% end %>
+
</div>
</center>
\ No newline at end of file
<!--[form:user]-->
<p><label for="user_login"><%=l(:field_login)%> <span class="required">*</span></label>
<%= text_field 'user', 'login', :size => 25 %></p>
-\r
+
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
<%= password_field_tag 'password', nil, :size => 25 %></p>
<p><label for="user_firstname"><%=l(:field_firstname)%> <span class="required">*</span></label>
<%= text_field 'user', 'firstname' %></p>
-\r
+
<p><label for="user_lastname"><%=l(:field_lastname)%> <span class="required">*</span></label>
<%= text_field 'user', 'lastname' %></p>
<p><label for="user_mail"><%=l(:field_mail)%> <span class="required">*</span></label>
-<%= text_field 'user', 'mail' %></p>\r
-\r
+<%= text_field 'user', 'mail' %></p>
+
<p><label for="user_language"><%=l(:field_language)%></label>
-<%= select("user", "language", lang_options_for_select) %></p>\r
-\r
+<%= select("user", "language", lang_options_for_select) %></p>
+
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
-<% end %>\r
-\r
+<% end %>
+
<p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
-<%= check_box 'user', 'mail_notification' %></p>\r
+<%= check_box 'user', 'mail_notification' %></p>
<!--[eoform:user]-->
</div>
-<h2><%= @user.display_name %></h2>\r
-\r
-<p>\r
-<%= mail_to @user.mail unless @user.pref.hide_mail %>\r
-<ul>\r
- <li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>\r
-<% for custom_value in @custom_values %>\r
-<% if !custom_value.value.empty? %>\r
- <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>\r
-<% end %>\r
-<% end %>\r
-</ul>\r
-</p>\r
-\r
-<h3><%=l(:label_project_plural)%></h3>\r
-<p>\r
-<% for membership in @user.memberships %>\r
- <%= membership.project.name %> (<%= membership.role.name %>, <%= format_date(membership.created_on) %>)\r
- <br />\r
-<% end %>\r
-</p>\r
-\r
-<h3><%=l(:label_activity)%></h3>\r
-<p>\r
-<%=l(:label_reported_issues)%>: <%= Issue.count(["author_id=?", @user.id]) %>\r
+<h2><%= @user.display_name %></h2>
+
+<p>
+<%= mail_to @user.mail unless @user.pref.hide_mail %>
+<ul>
+ <li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
+<% 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 %>
+</ul>
+</p>
+
+<h3><%=l(:label_project_plural)%></h3>
+<p>
+<% for membership in @user.memberships %>
+ <%= membership.project.name %> (<%= membership.role.name %>, <%= format_date(membership.created_on) %>)
+ <br />
+<% end %>
+</p>
+
+<h3><%=l(:label_activity)%></h3>
+<p>
+<%=l(:label_reported_issues)%>: <%= Issue.count(["author_id=?", @user.id]) %>
</p>
\ No newline at end of file
-<h2><%=l(:label_administration)%></h2>\r
-\r
-<p class="icon22 icon22-projects">\r
-<%= link_to l(:label_project_plural), :controller => 'admin', :action => 'projects' %> |\r
-<%= link_to l(:label_new), :controller => 'projects', :action => 'add' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-users">\r
-<%= link_to l(:label_user_plural), :controller => 'users' %> |\r
-<%= link_to l(:label_new), :controller => 'users', :action => 'add' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-role">\r
-<%= link_to l(:label_role_and_permissions), :controller => 'roles' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-tracker">\r
-<%= link_to l(:label_tracker_plural), :controller => 'trackers' %> |\r
-<%= link_to l(:label_issue_status_plural), :controller => 'issue_statuses' %> |\r
-<%= link_to l(:label_workflow), :controller => 'roles', :action => 'workflow' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-workflow">\r
-<%= link_to l(:label_custom_field_plural), :controller => 'custom_fields' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-options">\r
-<%= link_to l(:label_enumerations), :controller => 'enumerations' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-notifications">\r
-<%= link_to l(:field_mail_notification), :controller => 'admin', :action => 'mail_options' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-authent">\r
-<%= link_to l(:label_authentication), :controller => 'auth_sources' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-settings">\r
-<%= link_to l(:label_settings), :controller => 'settings' %>\r
-</p>\r
-\r
-<p class="icon22 icon22-info">\r
-<%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %>\r
+<h2><%=l(:label_administration)%></h2>
+
+<p class="icon22 icon22-projects">
+<%= link_to l(:label_project_plural), :controller => 'admin', :action => 'projects' %> |
+<%= link_to l(:label_new), :controller => 'projects', :action => 'add' %>
+</p>
+
+<p class="icon22 icon22-users">
+<%= link_to l(:label_user_plural), :controller => 'users' %> |
+<%= link_to l(:label_new), :controller => 'users', :action => 'add' %>
+</p>
+
+<p class="icon22 icon22-role">
+<%= link_to l(:label_role_and_permissions), :controller => 'roles' %>
+</p>
+
+<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' %>
+</p>
+
+<p class="icon22 icon22-workflow">
+<%= link_to l(:label_custom_field_plural), :controller => 'custom_fields' %>
+</p>
+
+<p class="icon22 icon22-options">
+<%= link_to l(:label_enumerations), :controller => 'enumerations' %>
+</p>
+
+<p class="icon22 icon22-notifications">
+<%= link_to l(:field_mail_notification), :controller => 'admin', :action => 'mail_options' %>
+</p>
+
+<p class="icon22 icon22-authent">
+<%= link_to l(:label_authentication), :controller => 'auth_sources' %>
+</p>
+
+<p class="icon22 icon22-settings">
+<%= link_to l(:label_settings), :controller => 'settings' %>
+</p>
+
+<p class="icon22 icon22-info">
+<%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %>
</p>
\ No newline at end of file
-<h2><%=l(:label_information_plural)%></h2>\r
-\r
+<h2><%=l(:label_information_plural)%></h2>
+
<p><%=l(:field_version)%>: <strong>redMine <%= Redmine::VERSION %></strong> (<%= @db_adapter_name %>)</p>
\ No newline at end of file
-<h2><%=l(:field_mail_notification)%></h2>\r
-\r
-<% form_tag ({:action => 'mail_options'}, :id => 'mail_options_form') do %>\r
-\r
-<div class="box">\r
-<p><%=l(:text_select_mail_notifications)%></p>\r
-\r
-<% actions = @actions.group_by {|p| p.group_id } %>\r
-<% actions.keys.sort.each do |group_id| %>\r
-<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>\r
-<% actions[group_id].each do |p| %>\r
- <div style="width:170px;float:left;"><%= check_box_tag "action_ids[]", p.id, p.mail_enabled? %>\r
- <%= l(p.description.to_sym) %>\r
- </div>\r
-<% end %>\r
-<div class="clear"></div>\r
-</fieldset>\r
-<% end %>\r
-\r
-<br />\r
-<p><%= check_all_links 'mail_options_form' %></p>\r
-</div>\r
-\r
-<%= submit_tag l(:button_save) %>\r
-<% end %>\r
+<h2><%=l(:field_mail_notification)%></h2>
+
+<% form_tag ({:action => 'mail_options'}, :id => 'mail_options_form') do %>
+
+<div class="box">
+<p><%=l(:text_select_mail_notifications)%></p>
+
+<% actions = @actions.group_by {|p| p.group_id } %>
+<% actions.keys.sort.each do |group_id| %>
+<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>
+<% actions[group_id].each do |p| %>
+ <div style="width:170px;float:left;"><%= check_box_tag "action_ids[]", p.id, p.mail_enabled? %>
+ <%= l(p.description.to_sym) %>
+ </div>
+<% end %>
+<div class="clear"></div>
+</fieldset>
+<% end %>
+
+<br />
+<p><%= check_all_links 'mail_options_form' %></p>
+</div>
+
+<%= submit_tag l(:button_save) %>
+<% end %>
<table class="list">
<thead><tr>
- <%= sort_header_tag('name', :caption => l(:label_project)) %>\r
- <th><%=l(:field_description)%></th>\r
+ <%= sort_header_tag('name', :caption => l(:label_project)) %>
+ <th><%=l(:field_description)%></th>
<th><%=l(:field_is_public)%></th>
- <th><%=l(:label_subproject_plural)%></th>\r
- <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>\r
+ <th><%=l(:label_subproject_plural)%></th>
+ <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
<th></th>
</tr></thead>
<tbody>
<% for project in @projects %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <td><%= link_to project.name, :controller => 'projects', :action => 'settings', :id => project %>\r
- <td><%=h project.description %>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to project.name, :controller => 'projects', :action => 'settings', :id => project %>
+ <td><%=h project.description %>
<td align="center"><%= image_tag 'true.png' if project.is_public? %>
- <td align="center"><%= project.children.size %>\r
- <td align="center"><%= format_date(project.created_on) %>\r
+ <td align="center"><%= project.children.size %>
+ <td align="center"><%= format_date(project.created_on) %>
<td align="center">
- <%= button_to l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => "button-small" %>\r
- </td>\r
+ <%= button_to l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => "button-small" %>
+ </td>
</tr>
<% end %>
</tbody>
-<h2>404</h2>\r
-\r
-<p><%= l(:notice_file_not_found) %></p>\r
-<p><a href="javascript:history.back()">Back</a></p>\r
+<h2>404</h2>
+
+<p><%= l(:notice_file_not_found) %></p>
+<p><a href="javascript:history.back()">Back</a></p>
<!--[form:custom_field]-->
<div class="box">
<p><%= f.text_field :name, :required => true %></p>
-<p><%= f.select :field_format, custom_field_formats_for_select, {}, :onchange => "toggle_custom_field_format();" %></p>\r
+<p><%= f.select :field_format, custom_field_formats_for_select, {}, :onchange => "toggle_custom_field_format();" %></p>
<p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
<%= f.text_field :min_length, :size => 5, :no_label => true %> -
<%= f.text_field :max_length, :size => 5, :no_label => true %><br>(<%=l(:text_min_max_length_info)%>)</p>
-<p><%= f.text_field :regexp, :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>\r
+<p><%= f.text_field :regexp, :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
<p id="custom_field_possible_values"><label><%= l(:field_possible_values) %> <%= image_to_function "add.png", "addValueField();return false" %></label>
<% (@custom_field.possible_values.to_a + [""]).each do |value| %>
<span><%= text_field_tag 'custom_field[possible_values][]', value, :size => 30 %> <%= image_to_function "delete.png", "deleteValueField(this);return false" %><br /></span>
<% end %>
</p>
-</div>\r
+</div>
<%= javascript_tag "toggle_custom_field_format();" %>
<!--[eoform:custom_field]-->
<div class="box">
<% case @custom_field.type.to_s
-when "IssueCustomField" %>\r
- \r
- <fieldset><legend><%=l(:label_tracker_plural)%></legend>\r
+when "IssueCustomField" %>
+
+ <fieldset><legend><%=l(:label_tracker_plural)%></legend>
<% for tracker in @trackers %>
- <%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>\r
+ <%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
<% end %>
- </fieldset>\r
+ </fieldset>
<p><%= f.check_box :is_required %></p>
<p><%= f.check_box :is_for_all %></p>
<li><%= link_to l(:label_project_plural), {}, :id=> "tab-ProjectCustomField", :onclick => "showTab('ProjectCustomField'); this.blur(); return false;" %></li>
<li><%= link_to l(:label_user_plural), {}, :id=> "tab-UserCustomField", :onclick => "showTab('UserCustomField'); this.blur(); return false;" %></li>
</ul>
-</div>\r
+</div>
<% %w(IssueCustomField ProjectCustomField UserCustomField).each do |type| %>
<div id="tab-content-<%= type %>" class="tab-content">
-<table class="list"> \r
+<table class="list">
<thead><tr>
- <th width="30%"><%=l(:field_name)%></th>\r
- <th><%=l(:field_field_format)%></th>\r
+ <th width="30%"><%=l(:field_name)%></th>
+ <th><%=l(:field_field_format)%></th>
<th><%=l(:field_is_required)%></th>
- <% if type == 'IssueCustomField' %>\r
- <th><%=l(:field_is_for_all)%></th>\r
+ <% if type == 'IssueCustomField' %>
+ <th><%=l(:field_is_for_all)%></th>
<th><%=l(:label_used_by)%></th>
- <% end %>\r
- <th width="10%"></th>\r
+ <% end %>
+ <th width="10%"></th>
</tr></thead>
<tbody>
<% for custom_field in (@custom_fields_by_type[type] || []) %>
- <tr class="<%= cycle("odd", "even") %>">\r
+ <tr class="<%= cycle("odd", "even") %>">
<td><%= link_to custom_field.name, :action => 'edit', :id => custom_field %></td>
- <td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format][:name]) %></td>\r
+ <td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format][:name]) %></td>
<td align="center"><%= image_tag 'true.png' if custom_field.is_required? %></td>
- <% if type == 'IssueCustomField' %>\r
- <td align="center"><%= image_tag 'true.png' if custom_field.is_for_all? %></td>\r
+ <% if type == 'IssueCustomField' %>
+ <td align="center"><%= image_tag 'true.png' if custom_field.is_for_all? %></td>
<td align="center"><%= custom_field.projects.count.to_s + ' ' + lwr(:label_project, custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
<% end %>
<td align="center">
-<p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br />\r
-<% unless document.description.empty? %><%=h(truncate(document.description, 250)) %><br /><% end %>\r
+<p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br />
+<% unless document.description.empty? %><%=h(truncate(document.description, 250)) %><br /><% end %>
<em><%= format_time(document.created_on) %></em></p>
\ No newline at end of file
<%= error_messages_for 'document' %>
<div class="box">
<!--[form:document]-->
-<p><label for="document_category_id"><%=l(:field_category)%></label>\r
-<select name="document[category_id]">\r
+<p><label for="document_category_id"><%=l(:field_category)%></label>
+<select name="document[category_id]">
<%= options_from_collection_for_select @categories, "id", "name", @document.category_id %>
-</select></p>\r
-\r
+</select></p>
+
<p><label for="document_title"><%=l(:field_title)%> <span class="required">*</span></label>
<%= text_field 'document', 'title', :size => 60 %></p>
-<div class="contextual">\r
-<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit' %>\r
-<%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
-</div>\r
-\r
-<h2><%= @document.title %></h2>\r
-\r
-<p><em><%= @document.category.name %><br />\r
-<%= format_date @document.created_on %></em></p>\r
-<%= textilizable @document.description %>\r
-<br />\r
-\r
-<h3><%= l(:label_attachment_plural) %></h3>\r
+<div class="contextual">
+<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit' %>
+<%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+</div>
+
+<h2><%= @document.title %></h2>
+
+<p><em><%= @document.category.name %><br />
+<%= format_date @document.created_on %></em></p>
+<%= textilizable @document.description %>
+<br />
+
+<h3><%= l(:label_attachment_plural) %></h3>
<ul class="documents">
<% for attachment in @attachments %>
- <li>\r
- <div class="contextual">\r
- <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy_attachment', :id => @document, :attachment_id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
- </div>\r
- <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %>\r
- (<%= number_to_human_size attachment.filesize %>)<br />\r
+ <li>
+ <div class="contextual">
+ <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy_attachment', :id => @document, :attachment_id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ </div>
+ <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %>
+ (<%= number_to_human_size attachment.filesize %>)<br />
<em><%= attachment.author.display_name %>, <%= format_date(attachment.created_on) %></em><br />
- <%= lwr(:label_download, attachment.downloads) %>\r
- </li>\r
+ <%= lwr(:label_download, attachment.downloads) %>
+ </li>
+<% end %>
+</ul>
+<br />
+
+
+<% if authorize_for('documents', 'add_attachment') %>
+ <% form_tag ({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular") do %>
+ <p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
+ <%= image_to_function "add.png", "addFileField();return false" %></label>
+ <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
+ <%= submit_tag l(:button_add) %>
+ <% end %>
<% end %>
-</ul>\r
-<br />\r
-\r
-\r
-<% if authorize_for('documents', 'add_attachment') %>\r
- <% form_tag ({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular") do %>\r
- <p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>\r
- <%= image_to_function "add.png", "addFileField();return false" %></label>\r
- <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>\r
- <%= submit_tag l(:button_add) %>\r
- <% end %> \r
-<% end %>\r
<h2><%=l(:label_enumerations)%></h2>
-<% Enumeration::OPTIONS.each do |option, name| %>\r
-\r
- <% if params[:opt]==option %> \r
- \r
- <h3><%= l(name) %></h3>\r
- <ul>\r
- <% for value in Enumeration.find(:all, :conditions => ["opt = ?", option]) %> \r
- <li><%= link_to value.name, :action => 'edit', :id => value %></li> \r
- <% end %>\r
- </ul>\r
- <p><%= link_to l(:label_enumeration_new), { :action => 'new', :opt => option }, :class => "icon icon-add" %></p> \r
- \r
- <% else %> \r
- <h3><%= link_to l(name), :opt => option %></h3>\r
- <% end %>\r
- \r
+<% Enumeration::OPTIONS.each do |option, name| %>
+
+ <% if params[:opt]==option %>
+
+ <h3><%= l(name) %></h3>
+ <ul>
+ <% for value in Enumeration.find(:all, :conditions => ["opt = ?", option]) %>
+ <li><%= link_to value.name, :action => 'edit', :id => value %></li>
+ <% end %>
+ </ul>
+ <p><%= link_to l(:label_enumeration_new), { :action => 'new', :opt => option }, :class => "icon icon-add" %></p>
+
+ <% else %>
+ <h3><%= link_to l(name), :opt => option %></h3>
+ <% end %>
+
<% end %>
\ No newline at end of file
<%= text_field 'issue_status', 'name' %></p>
<p><label for="issue_status_is_closed"><%=l(:field_is_closed)%></label>
-<%= check_box 'issue_status', 'is_closed' %></p>\r
-\r
+<%= check_box 'issue_status', 'is_closed' %></p>
+
<p><label for="issue_status_is_default"><%=l(:field_is_default)%></label>
-<%= check_box 'issue_status', 'is_default' %></p>\r
-\r
+<%= check_box 'issue_status', 'is_default' %></p>
+
<p><label for="issue_status_html_color"><%=l(:field_html_color)%><span class="required"> *</span></label>
-#<%= text_field 'issue_status', 'html_color', :maxlength => 6 %></p>\r
+#<%= text_field 'issue_status', 'html_color', :maxlength => 6 %></p>
<!--[eoform:issue_status]-->
</div>
\ No newline at end of file
<table class="list">
<thead><tr>
- <th><%=l(:field_status)%></th>\r
- <th><%=l(:field_is_default)%></th>\r
- <th><%=l(:field_is_closed)%></th>\r
+ <th><%=l(:field_status)%></th>
+ <th><%=l(:field_is_default)%></th>
+ <th><%=l(:field_is_closed)%></th>
<th><%=l(:button_sort)%></th>
<th></th>
</tr></thead>
<tbody>
<% for status in @issue_statuses %>
<tr class="<%= cycle("odd", "even") %>">
- <td><div class="square" style="background:#<%= status.html_color %>;"></div> <%= link_to status.name, :action => 'edit', :id => status %></td>\r
- <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>\r
- <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>\r
+ <td><div class="square" style="background:#<%= status.html_color %>;"></div> <%= link_to status.name, :action => 'edit', :id => status %></td>
+ <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
+ <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
<td align="center">
<%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => status, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
<%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => status, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
<%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => status, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
</td>
<td align="center">
- <%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %>\r
+ <%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
</td>
</tr>
<% end %>
</tbody>
</table>
-\r
+
<%= pagination_links_full @issue_status_pages %>
\ No newline at end of file
-<% if authorize_for('projects', 'add_issue') %>\r
-<% form_tag({ :controller => 'projects', :action => 'add_issue', :id => @project }, :method => 'get') do %>\r
-<%= l(:label_issue_new) %>: <%= select_tag 'tracker_id', ("<option></option>" + options_from_collection_for_select(trackers, 'id', 'name')), :onchange => "if (this.value!='') {this.form.submit();}" %>\r
-<% end %>\r
-<% end %>\r
+<% if authorize_for('projects', 'add_issue') %>
+<% form_tag({ :controller => 'projects', :action => 'add_issue', :id => @project }, :method => 'get') do %>
+<%= l(:label_issue_new) %>: <%= select_tag 'tracker_id', ("<option></option>" + options_from_collection_for_select(trackers, 'id', 'name')), :onchange => "if (this.value!='') {this.form.submit();}" %>
+<% end %>
+<% end %>
-<% for journal in journals %>\r
- <h4><%= format_time(journal.created_on) %> - <%= journal.user.name %></h4>\r
- <ul>\r
- <% for detail in journal.details %>\r
- <li><%= show_detail(detail) %></li>\r
- <% end %>\r
- </ul>\r
- <% if journal.notes? %>\r
- <%= textilizable journal.notes %>\r
- <% end %>\r
-<% end %>\r
+<% for journal in journals %>
+ <h4><%= format_time(journal.created_on) %> - <%= journal.user.name %></h4>
+ <ul>
+ <% for detail in journal.details %>
+ <li><%= show_detail(detail) %></li>
+ <% end %>
+ </ul>
+ <% if journal.notes? %>
+ <%= textilizable journal.notes %>
+ <% end %>
+<% end %>
-<% if issues.length > 0 %>\r
- <table class="list"> \r
- <thead><tr>\r
- <th>#</th>\r
- <th><%=l(:field_tracker)%></th>\r
- <th><%=l(:field_subject)%></th>\r
- </tr></thead>\r
- <tbody> \r
+<% if issues.length > 0 %>
+ <table class="list">
+ <thead><tr>
+ <th>#</th>
+ <th><%=l(:field_tracker)%></th>
+ <th><%=l(:field_subject)%></th>
+ </tr></thead>
+ <tbody>
<% for issue in issues %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <th align="center">\r
- <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>\r
- </th>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <th align="center">
+ <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>
+ </th>
<td><p class="small"><%= issue.project.name %> - <%= issue.tracker.name %><br />
- <%= issue.status.name %> - <%= format_time(issue.updated_on) %></p></td>\r
- <td>\r
- <p class="small"><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></p>\r
+ <%= issue.status.name %> - <%= format_time(issue.updated_on) %></p></td>
+ <td>
+ <p class="small"><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></p>
</td>
</tr>
- <% end %>\r
+ <% end %>
</tbody>
- </table>\r
-<% else %>\r
- <i><%=l(:label_no_data)%></i>\r
+ </table>
+<% else %>
+ <i><%=l(:label_no_data)%></i>
<% end %>
\ No newline at end of file
-<%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %></strong>: <%=h issue.subject %><br />\r
-<br />\r
-<strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br />\r
-<strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br />\r
-<strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br />\r
-<strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %>\r
+<%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %></strong>: <%=h issue.subject %><br />
+<br />
+<strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br />
+<strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br />
+<strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br />
+<strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %>
<h2><%=l(:label_issue)%> #<%= @issue.id %>: <%=h @issue.subject %></h2>
-\r
-<%= error_messages_for 'issue' %>\r
-<% form_tag({:action => 'change_status', :id => @issue}, :class => "tabular") do %>\r
-\r
-<%= hidden_field_tag 'confirm', 1 %>\r
+
+<%= error_messages_for 'issue' %>
+<% form_tag({:action => 'change_status', :id => @issue}, :class => "tabular") do %>
+
+<%= hidden_field_tag 'confirm', 1 %>
<%= hidden_field_tag 'new_status_id', @new_status.id %>
-<div class="box">\r
-<p><label><%=l(:label_issue_status_new)%></label> <%= @new_status.name %></p>\r
-\r
+<div class="box">
+<p><label><%=l(:label_issue_status_new)%></label> <%= @new_status.name %></p>
+
<p><label for="issue_assigned_to_id"><%=l(:field_assigned_to)%></label>
-<select name="issue[assigned_to_id]">\r
-<option value=""></option>\r
+<select name="issue[assigned_to_id]">
+<option value=""></option>
<%= options_from_collection_for_select @assignable_to, "id", "display_name", @issue.assigned_to_id %></p>
-</select></p>\r
+</select></p>
<p><label for="issue_done_ratio"><%=l(:field_done_ratio)%></label>
<%= select("issue", "done_ratio", ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) ) %>
</select></p>
-\r
+
<p><label for="issue_fixed_version"><%=l(:field_fixed_version)%></label>
-<select name="issue[fixed_version_id]">\r
-<option value="">--none--</option>\r
-<%= options_from_collection_for_select @issue.project.versions, "id", "name", @issue.fixed_version_id %>\r
+<select name="issue[fixed_version_id]">
+<option value="">--none--</option>
+<%= options_from_collection_for_select @issue.project.versions, "id", "name", @issue.fixed_version_id %>
</select></p>
<p><label for="notes"><%= l(:field_notes) %></label>
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %></p>
</div>
-\r
+
<%= hidden_field 'issue', 'lock_version' %>
-<%= submit_tag l(:button_save) %>\r
-<% end %>\r
+<%= submit_tag l(:button_save) %>
+<% end %>
-<h3><%=l(:label_history)%></h3>\r
-<div id="history">\r
-<%= render :partial => 'history', :locals => { :journals => @journals } %>\r
-</div>\r
-<br />\r
+<h3><%=l(:label_history)%></h3>
+<div id="history">
+<%= render :partial => 'history', :locals => { :journals => @journals } %>
+</div>
+<br />
<p><%= link_to l(:button_back), :action => 'show', :id => @issue %></p>
\ No newline at end of file
-<div class="contextual">\r
-<%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %>\r
-</div>\r
-\r
-<h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %></h2>\r
+<div class="contextual">
+<%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %>
+</div>
-<div class="box">\r
-<table width="100%">\r
-<tr>\r
- <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td>\r
- <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td>\r
-</tr>\r
-<tr>\r
- <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? @issue.assigned_to.name : "-" %></td>\r
- <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>\r
-</tr>\r
-<tr>\r
- <td><b><%=l(:field_author)%> :</b></td><td><%= link_to_user @issue.author %></td>\r
- <td><b><%=l(:field_start_date)%> :</b></td><td><%= format_date(@issue.start_date) %></td>\r
-</tr>\r
-<tr>\r
- <td><b><%=l(:field_created_on)%> :</b></td><td><%= format_date(@issue.created_on) %></td>\r
- <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td>\r
-</tr>\r
-<tr>\r
- <td><b><%=l(:field_updated_on)%> :</b></td><td><%= format_date(@issue.updated_on) %></td>\r
- <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td>\r
-</tr>\r
-<tr>\r
- <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? @issue.fixed_version.name : "-" %></td>\r
- <td></td><td></td>\r
-</tr>\r
-<tr>\r
-<% n = 0\r
-for custom_value in @custom_values %>\r
- <td><b><%= custom_value.custom_field.name %> :</b></td><td><%=h show_value custom_value %></td>\r
-<% n = n + 1\r
- if (n > 1) \r
- n = 0 %>\r
- </tr><tr>\r
- <%end\r
-end %>\r
-</tr>\r
-</table>\r
-<hr />\r
-<br />\r
-\r
-<b><%=l(:field_description)%> :</b><br /><br />\r
-<%= textilizable @issue.description %>\r
-<br />\r
-\r
-<div class="contextual">\r
-<%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %>\r
-<%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %>\r
-<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
-</div>\r
-\r
-<% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %>\r
- <% form_tag ({:controller => 'issues', :action => 'change_status', :id => @issue}) do %>\r
- <%=l(:label_change_status)%> :\r
- <select name="new_status_id">\r
- <%= options_from_collection_for_select @status_options, "id", "name" %>\r
- </select>\r
- <%= submit_tag l(:button_change) %>\r
- <% end %>\r
-<% end %>\r
- \r
-</div>\r
-\r
-<div id="history" class="box">\r
-<h3><%=l(:label_history)%>\r
-<% if @journals_count > @journals.length %>(<%= l(:label_last_changes, @journals.length) %>)<% end %></h3>\r
-<%= render :partial => 'history', :locals => { :journals => @journals } %>\r
-<% if @journals_count > @journals.length %>\r
- <p><center><small><%= link_to l(:label_change_view_all), :action => 'history', :id => @issue %></small></center></p>\r
+<h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %></h2>
+
+<div class="box">
+<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_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td>
+</tr>
+<tr>
+ <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? @issue.assigned_to.name : "-" %></td>
+ <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
+</tr>
+<tr>
+ <td><b><%=l(:field_author)%> :</b></td><td><%= link_to_user @issue.author %></td>
+ <td><b><%=l(:field_start_date)%> :</b></td><td><%= format_date(@issue.start_date) %></td>
+</tr>
+<tr>
+ <td><b><%=l(:field_created_on)%> :</b></td><td><%= format_date(@issue.created_on) %></td>
+ <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td>
+</tr>
+<tr>
+ <td><b><%=l(:field_updated_on)%> :</b></td><td><%= format_date(@issue.updated_on) %></td>
+ <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td>
+</tr>
+<tr>
+ <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? @issue.fixed_version.name : "-" %></td>
+ <td></td><td></td>
+</tr>
+<tr>
+<% n = 0
+for custom_value in @custom_values %>
+ <td><b><%= custom_value.custom_field.name %> :</b></td><td><%=h show_value custom_value %></td>
+<% n = n + 1
+ if (n > 1)
+ n = 0 %>
+ </tr><tr>
+ <%end
+end %>
+</tr>
+</table>
+<hr />
+<br />
+
+<b><%=l(:field_description)%> :</b><br /><br />
+<%= textilizable @issue.description %>
+<br />
+
+<div class="contextual">
+<%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %>
+<%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %>
+<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+</div>
+
+<% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %>
+ <% form_tag ({:controller => 'issues', :action => 'change_status', :id => @issue}) do %>
+ <%=l(:label_change_status)%> :
+ <select name="new_status_id">
+ <%= options_from_collection_for_select @status_options, "id", "name" %>
+ </select>
+ <%= submit_tag l(:button_change) %>
+ <% end %>
+<% end %>
+
+</div>
+
+<div id="history" class="box">
+<h3><%=l(:label_history)%>
+<% if @journals_count > @journals.length %>(<%= l(:label_last_changes, @journals.length) %>)<% end %></h3>
+<%= render :partial => 'history', :locals => { :journals => @journals } %>
+<% if @journals_count > @journals.length %>
+ <p><center><small><%= link_to l(:label_change_view_all), :action => 'history', :id => @issue %></small></center></p>
+<% end %>
+</div>
+
+<div class="box">
+<h3><%=l(:label_attachment_plural)%></h3>
+<table width="100%">
+<% for attachment in @issue.attachments %>
+<tr>
+<td><%= link_to attachment.filename, { :action => 'download', :id => @issue, :attachment_id => attachment }, :class => 'icon icon-attachment' %> (<%= number_to_human_size(attachment.filesize) %>)</td>
+<td><%= format_date(attachment.created_on) %></td>
+<td><%= attachment.author.display_name %></td>
+<td><div class="contextual"><%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></div></td>
+</tr>
<% end %>
-</div>\r
-\r
-<div class="box">\r
-<h3><%=l(:label_attachment_plural)%></h3>\r
-<table width="100%">\r
-<% for attachment in @issue.attachments %>\r
-<tr>\r
-<td><%= link_to attachment.filename, { :action => 'download', :id => @issue, :attachment_id => attachment }, :class => 'icon icon-attachment' %> (<%= number_to_human_size(attachment.filesize) %>)</td>\r
-<td><%= format_date(attachment.created_on) %></td>\r
-<td><%= attachment.author.display_name %></td>\r
-<td><div class="contextual"><%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></div></td>\r
-</tr>\r
+</table>
+<br />
+<% if authorize_for('issues', 'add_attachment') %>
+ <% form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") do %>
+ <p id="attachments_p"><label><%=l(:label_attachment_new)%>
+ <%= image_to_function "add.png", "addFileField();return false" %></label>
+ <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
+ <%= submit_tag l(:button_add) %>
+ <% end %>
+<% end %>
+</div>
+
+<% if authorize_for('issues', 'add_note') %>
+ <div class="box">
+ <h3><%= l(:label_add_note) %></h3>
+ <% form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) do %>
+ <p><label for="notes"><%=l(:field_notes)%></label>
+ <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p>
+ <%= submit_tag l(:button_add) %>
+ <% end %>
+ </div>
<% end %>
-</table>\r
-<br />\r
-<% if authorize_for('issues', 'add_attachment') %>\r
- <% form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") do %>\r
- <p id="attachments_p"><label><%=l(:label_attachment_new)%>\r
- <%= image_to_function "add.png", "addFileField();return false" %></label>\r
- <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>\r
- <%= submit_tag l(:button_add) %>\r
- <% end %> \r
-<% end %>\r
-</div>\r
-\r
-<% if authorize_for('issues', 'add_note') %>\r
- <div class="box">\r
- <h3><%= l(:label_add_note) %></h3>\r
- <% form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) do %>\r
- <p><label for="notes"><%=l(:field_notes)%></label>\r
- <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p>\r
- <%= submit_tag l(:button_add) %>\r
- <% end %> \r
- </div>\r
-<% end %>\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
-<head>\r
-<title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title>\r
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />\r
-<meta name="description" content="redMine" />\r
-<meta name="keywords" content="issue,bug,tracker" />\r
-<!--[if IE]>\r
- <style type="text/css">\r
- body {behavior: url(<%= stylesheet_path "csshover.htc" %>);}\r
- </style>\r
-<![endif]-->\r
-<%= stylesheet_link_tag "application" %>\r
-<%= stylesheet_link_tag "print", :media => "print" %>\r
-<%= javascript_include_tag :defaults %>\r
-<%= javascript_include_tag 'menu' %>\r
-<%= stylesheet_link_tag 'jstoolbar' %>\r
-<!-- page specific tags --><%= yield :header_tags %>\r
-</head>\r
-\r
-<body>\r
-<div id="container" >\r
-\r
- <div id="header">\r
- <div style="float: left;">\r
- <h1><%= Setting.app_title %></h1>\r
- <h2><%= Setting.app_subtitle %></h2>\r
- </div>\r
- <div style="float: right; padding-right: 1em; padding-top: 0.2em;">\r
- <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %>\r
- </div>\r
- </div> \r
- \r
- <div id="navigation">\r
- <ul>\r
- <li><%= link_to l(:label_home), { :controller => 'welcome' }, :class => "icon icon-home" %></li>\r
- <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li>\r
- <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li>\r
- \r
- <% unless @project.nil? || @project.id.nil? %>\r
- <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li>\r
- <% end %>\r
- \r
- <% if loggedin? %>\r
- <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li>\r
- <% end %>\r
- \r
- <% if admin_loggedin? %>\r
- <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>\r
- <% end %>\r
- \r
- <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li>\r
- \r
- <% if loggedin? %>\r
- <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li> \r
- <% else %> \r
- <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li>\r
- <% end %>\r
- </ul> \r
- </div>\r
-\r
- <% if admin_loggedin? %>\r
- <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)">\r
- <a class="menuItem" href="<%= url_for :controller => 'admin', :action => 'projects' %>" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">▶</span></a>\r
- <a class="menuItem" href="<%= url_for :controller => 'users' %>" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">▶</span></a>\r
- <%= link_to l(:label_role_and_permissions), {:controller => 'roles' }, :class => "menuItem" %>\r
- <a class="menuItem" href="<%= url_for :controller => 'trackers' %>" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">▶</span></a>\r
- <%= link_to l(:label_custom_field_plural), {:controller => 'custom_fields' }, :class => "menuItem" %>\r
- <%= link_to l(:label_enumerations), {:controller => 'enumerations' }, :class => "menuItem" %>\r
- <%= link_to l(:field_mail_notification), {:controller => 'admin', :action => 'mail_options' }, :class => "menuItem" %>\r
- <%= link_to l(:label_authentication), {:controller => 'auth_sources' }, :class => "menuItem" %>\r
- <%= link_to l(:label_settings), {:controller => 'settings' }, :class => "menuItem" %>\r
- <%= link_to l(:label_information_plural), {:controller => 'admin', :action => 'info' }, :class => "menuItem" %>\r
- </div>\r
- <div id="menuTrackers" class="menu">\r
- <%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses' }, :class => "menuItem" %>\r
- <%= link_to l(:label_workflow), {:controller => 'roles', :action => 'workflow' }, :class => "menuItem" %>\r
- </div>\r
- <div id="menuProjects" class="menu"><%= link_to l(:label_new), {:controller => 'projects', :action => 'add' }, :class => "menuItem" %></div>\r
- <div id="menuUsers" class="menu"><%= link_to l(:label_new), {:controller => 'users', :action => 'add' }, :class => "menuItem" %></a></div>\r
- <% end %>\r
- \r
- <% unless @project.nil? || @project.id.nil? %>\r
- <div id="menuProject" class="menu" onmouseover="menuMouseover(event)">\r
- <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 }, :class => "menuItem" %>\r
- <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %>\r
- <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %>\r
- <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>\r
- <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %>\r
- </div>\r
- <% end %>\r
-\r
- \r
- <div id="subcontent">\r
- \r
- <% unless @project.nil? || @project.id.nil? %>\r
- <h2><%= @project.name %></h2>\r
- <ul class="menublock">\r
- <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li>\r
- <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li>\r
- <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li>\r
- <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></li>\r
- <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li>\r
- <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li>\r
- <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li>\r
- <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li>\r
- <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li>\r
- <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>\r
- <li><%= link_to l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil if @project.wiki and !@project.wiki.new_record? %></li>\r
- <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>\r
- <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>\r
- <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li>\r
- <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li>\r
- <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>\r
- </ul>\r
- <% end %>\r
- \r
- <% if loggedin? and @logged_in_user.memberships.length > 0 %>\r
- <h2><%=l(:label_my_projects) %></h2>\r
- <ul class="menublock">\r
- <% for membership in @logged_in_user.memberships %> \r
- <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li>\r
- <% end %>\r
- </ul>\r
- <% end %>\r
- </div>\r
-\r
- <div id="content">\r
- <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %> \r
- <%= @content_for_layout %> \r
- </div>\r
- \r
- <div id="footer">\r
- <p><a href="http://redmine.rubyforge.org/">redMine</a> <small><%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang</small></p>\r
- </div>\r
-\r
-</div>\r
-</body>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<meta name="description" content="redMine" />
+<meta name="keywords" content="issue,bug,tracker" />
+<!--[if IE]>
+ <style type="text/css">
+ body {behavior: url(<%= stylesheet_path "csshover.htc" %>);}
+ </style>
+<![endif]-->
+<%= stylesheet_link_tag "application" %>
+<%= stylesheet_link_tag "print", :media => "print" %>
+<%= javascript_include_tag :defaults %>
+<%= javascript_include_tag 'menu' %>
+<%= stylesheet_link_tag 'jstoolbar' %>
+<!-- page specific tags --><%= yield :header_tags %>
+</head>
+
+<body>
+<div id="container" >
+
+ <div id="header">
+ <div style="float: left;">
+ <h1><%= Setting.app_title %></h1>
+ <h2><%= Setting.app_subtitle %></h2>
+ </div>
+ <div style="float: right; padding-right: 1em; padding-top: 0.2em;">
+ <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %>
+ </div>
+ </div>
+
+ <div id="navigation">
+ <ul>
+ <li><%= link_to l(:label_home), { :controller => 'welcome' }, :class => "icon icon-home" %></li>
+ <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li>
+ <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li>
+
+ <% unless @project.nil? || @project.id.nil? %>
+ <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li>
+ <% end %>
+
+ <% if loggedin? %>
+ <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li>
+ <% end %>
+
+ <% if admin_loggedin? %>
+ <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
+ <% end %>
+
+ <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li>
+
+ <% if loggedin? %>
+ <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li>
+ <% else %>
+ <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li>
+ <% end %>
+ </ul>
+ </div>
+
+ <% if admin_loggedin? %>
+ <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)">
+ <a class="menuItem" href="<%= url_for :controller => 'admin', :action => 'projects' %>" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">▶</span></a>
+ <a class="menuItem" href="<%= url_for :controller => 'users' %>" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">▶</span></a>
+ <%= link_to l(:label_role_and_permissions), {:controller => 'roles' }, :class => "menuItem" %>
+ <a class="menuItem" href="<%= url_for :controller => 'trackers' %>" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">▶</span></a>
+ <%= link_to l(:label_custom_field_plural), {:controller => 'custom_fields' }, :class => "menuItem" %>
+ <%= link_to l(:label_enumerations), {:controller => 'enumerations' }, :class => "menuItem" %>
+ <%= link_to l(:field_mail_notification), {:controller => 'admin', :action => 'mail_options' }, :class => "menuItem" %>
+ <%= link_to l(:label_authentication), {:controller => 'auth_sources' }, :class => "menuItem" %>
+ <%= link_to l(:label_settings), {:controller => 'settings' }, :class => "menuItem" %>
+ <%= link_to l(:label_information_plural), {:controller => 'admin', :action => 'info' }, :class => "menuItem" %>
+ </div>
+ <div id="menuTrackers" class="menu">
+ <%= link_to l(:label_issue_status_plural), {:controller => 'issue_statuses' }, :class => "menuItem" %>
+ <%= link_to l(:label_workflow), {:controller => 'roles', :action => 'workflow' }, :class => "menuItem" %>
+ </div>
+ <div id="menuProjects" class="menu"><%= link_to l(:label_new), {:controller => 'projects', :action => 'add' }, :class => "menuItem" %></div>
+ <div id="menuUsers" class="menu"><%= link_to l(:label_new), {:controller => 'users', :action => 'add' }, :class => "menuItem" %></a></div>
+ <% end %>
+
+ <% unless @project.nil? || @project.id.nil? %>
+ <div id="menuProject" class="menu" onmouseover="menuMouseover(event)">
+ <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 }, :class => "menuItem" %>
+ <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %>
+ <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %>
+ <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>
+ <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %>
+ </div>
+ <% end %>
+
+
+ <div id="subcontent">
+
+ <% unless @project.nil? || @project.id.nil? %>
+ <h2><%= @project.name %></h2>
+ <ul class="menublock">
+ <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li>
+ <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li>
+ <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li>
+ <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></li>
+ <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li>
+ <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li>
+ <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li>
+ <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li>
+ <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li>
+ <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
+ <li><%= link_to l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil if @project.wiki and !@project.wiki.new_record? %></li>
+ <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>
+ <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
+ <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li>
+ <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li>
+ <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>
+ </ul>
+ <% end %>
+
+ <% if loggedin? and @logged_in_user.memberships.length > 0 %>
+ <h2><%=l(:label_my_projects) %></h2>
+ <ul class="menublock">
+ <% for membership in @logged_in_user.memberships %>
+ <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+
+ <div id="content">
+ <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>
+ <%= @content_for_layout %>
+ </div>
+
+ <div id="footer">
+ <p><a href="http://redmine.rubyforge.org/">redMine</a> <small><%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang</small></p>
+ </div>
+
+</div>
+</body>
</html>
\ No newline at end of file
-<%=l(:label_issue)%> #<%= issue.id %> - <%= issue.subject %>\r
-<%=l(:field_author)%>: <%= issue.author.display_name %>\r
-<%=l(:field_status)%>: <%= issue.status.name %>\r
+<%=l(:label_issue)%> #<%= issue.id %> - <%= issue.subject %>
+<%=l(:field_author)%>: <%= issue.author.display_name %>
+<%=l(:field_status)%>: <%= issue.status.name %>
+
+<%= issue.description %>
-<%= issue.description %>\r
-\r
http://<%= Setting.host_name %>/issues/show/<%= issue.id %>
\ No newline at end of file
-<%= @added_to %>\r
-<%= @attachments.size %> files(s) added.\r
-<% @attachments.each do |attachment | %>\r
-- <%= attachment.filename %><% end %>\r
-\r
+<%= @added_to %>
+<%= @attachments.size %> files(s) added.
+<% @attachments.each do |attachment | %>
+- <%= attachment.filename %><% end %>
+
<%= @url %>
\ No newline at end of file
-<%= @added_to %>\r
-<%= @attachments.size %> files(s) added.\r
-<% @attachments.each do |attachment | %>\r
-- <%= attachment.filename %><% end %>\r
-\r
+<%= @added_to %>
+<%= @attachments.size %> files(s) added.
+<% @attachments.each do |attachment | %>
+- <%= attachment.filename %><% end %>
+
<%= @url %>
\ No newline at end of file
-<%= @added_to %>\r
-<%= @attachments.size %> files(s) added.\r
-<% @attachments.each do |attachment | %>\r
-- <%= attachment.filename %><% end %>\r
-\r
+<%= @added_to %>
+<%= @attachments.size %> files(s) added.
+<% @attachments.each do |attachment | %>
+- <%= attachment.filename %><% end %>
+
<%= @url %>
\ No newline at end of file
-<%= @added_to %>\r
-<%= @attachments.size %> fichier(s) ajouté(s).\r
-<% @attachments.each do |attachment | %>\r
-- <%= attachment.filename %><% end %>\r
-\r
+<%= @added_to %>
+<%= @attachments.size %> fichier(s) ajouté(s).
+<% @attachments.each do |attachment | %>
+- <%= attachment.filename %><% end %>
+
<%= @url %>
\ No newline at end of file
-<%= @added_to %>\r
-<%= @attachments.size %> ファイルが追加されました。\r
-<% @attachments.each do |attachment | %>\r
-- <%= attachment.filename %><% end %>\r
-\r
+<%= @added_to %>
+<%= @attachments.size %> ファイルが追加されました。
+<% @attachments.each do |attachment | %>
+- <%= attachment.filename %><% end %>
+
<%= @url %>
\ No newline at end of file
-A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):\r
-<%= l(:field_title) %>: <%= @document.title %>\r
-\r
+A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):
+<%= l(:field_title) %>: <%= @document.title %>
+
http://<%= Setting.host_name %>/documents/show/<%= @document.id %>
\ No newline at end of file
-A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):\r
-<%= l(:field_title) %>: <%= @document.title %>\r
-\r
+A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):
+<%= l(:field_title) %>: <%= @document.title %>
+
http://<%= Setting.host_name %>/documents/show/<%= @document.id %>
\ No newline at end of file
-A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):\r
-<%= l(:field_title) %>: <%= @document.title %>\r
-\r
+A document has been added to <%= @document.project.name %> (<%= @document.category.name %>):
+<%= l(:field_title) %>: <%= @document.title %>
+
http://<%= Setting.host_name %>/documents/show/<%= @document.id %>
\ No newline at end of file
-Un document a été ajouté à <%= @document.project.name %> (<%= @document.category.name %>):\r
-<%= l(:field_title) %>: <%= @document.title %>\r
-\r
+Un document a été ajouté à <%= @document.project.name %> (<%= @document.category.name %>):
+<%= l(:field_title) %>: <%= @document.title %>
+
http://<%= Setting.host_name %>/documents/show/<%= @document.id %>
\ No newline at end of file
-文書が <%= @document.project.name %> (<%= @document.category.name %>) に追加されました:\r
-<%= l(:field_title) %>: <%= @document.title %>\r
-\r
+文書が <%= @document.project.name %> (<%= @document.category.name %>) に追加されました:
+<%= l(:field_title) %>: <%= @document.title %>
+
http://<%= Setting.host_name %>/documents/show/<%= @document.id %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been reported.\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been reported.
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been reported.\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been reported.
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been reported.\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been reported.
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Une nouvelle demande (#<%= @issue.id %>) a été soumise.\r
-----------------------------------------\r
+Une nouvelle demande (#<%= @issue.id %>) a été soumise.
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-問題 #<%= @issue.id %> が報告されました。\r
-----------------------------------------\r
+問題 #<%= @issue.id %> が報告されました。
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been updated.\r
-<%= @journal.user.name %>\r
-<% for detail in @journal.details %>\r
-<%= show_detail(detail, true) %>\r
-<% end %>\r
-<%= @journal.notes if @journal.notes? %>\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been updated.
+<%= @journal.user.name %>
+<% for detail in @journal.details %>
+<%= show_detail(detail, true) %>
+<% end %>
+<%= @journal.notes if @journal.notes? %>
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been updated.\r
-<%= @journal.user.name %>\r
-<% for detail in @journal.details %>\r
-<%= show_detail(detail, true) %>\r
-<% end %>\r
-<%= @journal.notes if @journal.notes? %>\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been updated.
+<%= @journal.user.name %>
+<% for detail in @journal.details %>
+<%= show_detail(detail, true) %>
+<% end %>
+<%= @journal.notes if @journal.notes? %>
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-Issue #<%= @issue.id %> has been updated.\r
-<%= @journal.user.name %>\r
-<% for detail in @journal.details %>\r
-<%= show_detail(detail, true) %>\r
-<% end %>\r
-<%= @journal.notes if @journal.notes? %>\r
-----------------------------------------\r
+Issue #<%= @issue.id %> has been updated.
+<%= @journal.user.name %>
+<% for detail in @journal.details %>
+<%= show_detail(detail, true) %>
+<% end %>
+<%= @journal.notes if @journal.notes? %>
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-La demande #<%= @issue.id %> a été mise à jour.\r
-<%= @journal.user.name %>\r
-<% for detail in @journal.details %>\r
-<%= show_detail(detail, true) %>\r
-<% end %>\r
-<%= @journal.notes if @journal.notes? %>\r
-----------------------------------------\r
+La demande #<%= @issue.id %> a été mise à jour.
+<%= @journal.user.name %>
+<% for detail in @journal.details %>
+<%= show_detail(detail, true) %>
+<% end %>
+<%= @journal.notes if @journal.notes? %>
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-問題 #<%= @issue.id %> が更新されました。\r
-<%= @journal.user.name %>\r
-<% for detail in @journal.details %>\r
-<%= show_detail(detail, true) %>\r
-<% end %>\r
-<%= @journal.notes if @journal.notes? %>\r
-----------------------------------------\r
+問題 #<%= @issue.id %> が更新されました。
+<%= @journal.user.name %>
+<% for detail in @journal.details %>
+<%= show_detail(detail, true) %>
+<% end %>
+<%= @journal.notes if @journal.notes? %>
+----------------------------------------
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
\ No newline at end of file
-To change your password, use the following link:\r
-\r
+To change your password, use the following link:
+
http://<%= Setting.host_name %>/account/lost_password?token=<%= @token.value %>
\ No newline at end of file
-To change your password, use the following link:\r
-\r
+To change your password, use the following link:
+
http://<%= Setting.host_name %>/account/lost_password?token=<%= @token.value %>
\ No newline at end of file
-To change your password, use the following link:\r
-\r
+To change your password, use the following link:
+
http://<%= Setting.host_name %>/account/lost_password?token=<%= @token.value %>
\ No newline at end of file
-Pour changer votre mot de passe, utilisez le lien suivant:\r
-\r
+Pour changer votre mot de passe, utilisez le lien suivant:
+
http://<%= Setting.host_name %>/account/lost_password?token=<%= @token.value %>
\ No newline at end of file
-パスワードを変更するには、以下のリンクをたどってください:\r
-\r
+パスワードを変更するには、以下のリンクをたどってください:
+
http://<%= Setting.host_name %>/account/lost_password?token=<%= @token.value %>
\ No newline at end of file
-To activate your redMine account, use the following link:\r
-\r
+To activate your redMine account, use the following link:
+
http://<%= Setting.host_name %>/account/register?token=<%= @token.value %>
\ No newline at end of file
-To activate your redMine account, use the following link:\r
-\r
+To activate your redMine account, use the following link:
+
http://<%= Setting.host_name %>/account/register?token=<%= @token.value %>
\ No newline at end of file
-To activate your redMine account, use the following link:\r
-\r
+To activate your redMine account, use the following link:
+
http://<%= Setting.host_name %>/account/register?token=<%= @token.value %>
\ No newline at end of file
-Pour activer votre compte sur redMine, utilisez le lien suivant:\r
-\r
+Pour activer votre compte sur redMine, utilisez le lien suivant:
+
http://<%= Setting.host_name %>/account/register?token=<%= @token.value %>
\ No newline at end of file
-redMine アカウントをアクティブにするには、以下のリンクをたどってください:\r
-\r
+redMine アカウントをアクティブにするには、以下のリンクをたどってください:
+
http://<%= Setting.host_name %>/account/register?token=<%= @token.value %>
\ No newline at end of file
-<div id="block_<%= block_name %>" class="mypage-box">\r
-\r
- <div style="float:right;margin-right:16px;z-index:500;">\r
- <%= link_to_remote "", {\r
- :url => { :action => "remove_block", :block => block_name },\r
- :complete => "removeBlock('block_#{block_name}')",\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')" },\r
- :class => "close-icon"\r
- %> \r
- </div>\r
- \r
- <div class="handle">\r
- <%= render :partial => "my/blocks/#{block_name}", :locals => { :user => user } %>\r
- </div>\r
+<div id="block_<%= block_name %>" class="mypage-box">
+
+ <div style="float:right;margin-right:16px;z-index:500;">
+ <%= link_to_remote "", {
+ :url => { :action => "remove_block", :block => block_name },
+ :complete => "removeBlock('block_#{block_name}')",
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" },
+ :class => "close-icon"
+ %>
+ </div>
+
+ <div class="handle">
+ <%= render :partial => "my/blocks/#{block_name}", :locals => { :user => user } %>
+ </div>
</div>
\ No newline at end of file
<h2><%=l(:label_my_account)%></h2>
-\r
-<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />\r
-<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>\r
+
+<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
+<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
<%= error_messages_for 'user' %>
-\r
-<div class="box">\r
+
+<div class="box">
<h3><%=l(:label_information_plural)%></h3>
<% labelled_tabular_form_for :user, @user, :url => { :action => "account" } do |f| %>
<% end %>
<center><%= submit_tag l(:button_save) %></center>
-<% end %>\r
-</div>\r
-\r
+<% end %>
+</div>
+
-<% unless @user.auth_source_id %>\r
- <div class="box">\r
- <h3><%=l(:field_password)%></h3>\r
+<% unless @user.auth_source_id %>
+ <div class="box">
+ <h3><%=l(:field_password)%></h3>
<% form_tag({:action => 'change_password'}, :class => "tabular") do %>
-\r
+
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
<%= password_field_tag 'password', nil, :size => 25 %></p>
-\r
+
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password', nil, :size => 25 %></p>\r
-\r
+ <%= password_field_tag 'new_password', nil, :size => 25 %></p>
+
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>\r
+ <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
<center><%= submit_tag l(:button_save) %></center>
- <% end %>\r
+ <% end %>
</div>
-<% end %>\r
+<% end %>
-<h3><%= l(:label_calendar) %></h3>\r
-\r
-<%\r
-@date_from = Date.today - (Date.today.cwday-1)\r
-@date_to = Date.today + (7-Date.today.cwday)\r
-@issues = Issue.find :all,\r
- :conditions => ["issues.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to],\r
- :include => [:project, :tracker] unless @user.projects.empty?\r
-@issues ||= []\r
-%>\r
-\r
-<table class="list with-cells">\r
-<thead><tr>\r
-<th></th>\r
-<% 1.upto(7) do |d| %>\r
- <th align="center" width="14%"><%= day_name(d) %></th>\r
-<% end %>\r
-</tr></thead>\r
-<tbdoy>\r
-<tr height="100">\r
-<% day = @date_from\r
-while day <= @date_to\r
- if day.cwday == 1 %>\r
- <th valign="middle"><%= day.cweek %></th>\r
- <% end %> \r
- <td valign="top" width="14%" class="<%= day.month==@month ? "even" : "odd" %>">\r
- <p align="right"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> \r
- <% day_issues = []\r
- @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } \r
- day_issues.each do |i| %> \r
- <%= if day == i.start_date and day == i.due_date\r
- image_tag('arrow_bw.png')\r
- elsif day == i.start_date\r
- image_tag('arrow_from.png') \r
- elsif day == i.due_date\r
- image_tag('arrow_to.png') \r
- end %>\r
- <small><%= link_to "#{i.tracker.name} ##{i.id}", :controller => 'issues', :action => 'show', :id => i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />\r
- <% end %>\r
- </td>\r
- <%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %>\r
- <%\r
- day = day + 1\r
-end %>\r
-</tr>\r
-</tbody>\r
+<h3><%= l(:label_calendar) %></h3>
+
+<%
+@date_from = Date.today - (Date.today.cwday-1)
+@date_to = Date.today + (7-Date.today.cwday)
+@issues = Issue.find :all,
+ :conditions => ["issues.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to],
+ :include => [:project, :tracker] unless @user.projects.empty?
+@issues ||= []
+%>
+
+<table class="list with-cells">
+<thead><tr>
+<th></th>
+<% 1.upto(7) do |d| %>
+ <th align="center" width="14%"><%= day_name(d) %></th>
+<% end %>
+</tr></thead>
+<tbdoy>
+<tr height="100">
+<% day = @date_from
+while day <= @date_to
+ if day.cwday == 1 %>
+ <th valign="middle"><%= day.cweek %></th>
+ <% end %>
+ <td valign="top" width="14%" class="<%= day.month==@month ? "even" : "odd" %>">
+ <p align="right"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p>
+ <% day_issues = []
+ @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day }
+ day_issues.each do |i| %>
+ <%= if day == i.start_date and day == i.due_date
+ image_tag('arrow_bw.png')
+ elsif day == i.start_date
+ image_tag('arrow_from.png')
+ elsif day == i.due_date
+ image_tag('arrow_to.png')
+ end %>
+ <small><%= link_to "#{i.tracker.name} ##{i.id}", :controller => 'issues', :action => 'show', :id => i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />
+ <% end %>
+ </td>
+ <%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %>
+ <%
+ day = day + 1
+end %>
+</tr>
+</tbody>
</table>
\ No newline at end of file
-<h3><%=l(:label_document_plural)%></h3>\r
-\r
-<%= render(:partial => 'documents/document',\r
- :collection => Document.find(:all,\r
- :limit => 10,\r
- :order => 'documents.created_on DESC',\r
- :conditions => "documents.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",\r
+<h3><%=l(:label_document_plural)%></h3>
+
+<%= render(:partial => 'documents/document',
+ :collection => Document.find(:all,
+ :limit => 10,
+ :order => 'documents.created_on DESC',
+ :conditions => "documents.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:include => [:project])) unless @user.projects.empty? %>
\ No newline at end of file
-<h3><%=l(:label_assigned_to_me_issues)%></h3>\r
-<% assigned_issues = Issue.find(:all, \r
- :conditions => ["assigned_to_id=?", user.id],\r
- :limit => 10, \r
- :include => [ :status, :project, :tracker ], \r
- :order => 'issues.updated_on DESC') %>\r
-<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>\r
-<% if assigned_issues.length > 0 %>\r
-<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>\r
-<% end %>\r
+<h3><%=l(:label_assigned_to_me_issues)%></h3>
+<% assigned_issues = Issue.find(:all,
+ :conditions => ["assigned_to_id=?", user.id],
+ :limit => 10,
+ :include => [ :status, :project, :tracker ],
+ :order => 'issues.updated_on DESC') %>
+<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
+<% if assigned_issues.length > 0 %>
+<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>
+<% end %>
-<h3><%=l(:label_reported_issues)%></h3>\r
-<% reported_issues = Issue.find(:all, \r
- :conditions => ["author_id=?", user.id],\r
- :limit => 10, \r
- :include => [ :status, :project, :tracker ], \r
- :order => 'issues.updated_on DESC') %>\r
-<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>\r
-<% if reported_issues.length > 0 %>\r
-<p><%=lwr(:label_last_updates, reported_issues.length)%></p>\r
+<h3><%=l(:label_reported_issues)%></h3>
+<% reported_issues = Issue.find(:all,
+ :conditions => ["author_id=?", user.id],
+ :limit => 10,
+ :include => [ :status, :project, :tracker ],
+ :order => 'issues.updated_on DESC') %>
+<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>
+<% if reported_issues.length > 0 %>
+<p><%=lwr(:label_last_updates, reported_issues.length)%></p>
<% end %>
\ No newline at end of file
-<h3><%=l(:label_news_latest)%></h3>\r
-\r
-<%= render (:partial => 'news/news', \r
- :collection => News.find(:all,\r
- :limit => 10,\r
- :order => 'news.created_on DESC',\r
- :conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",\r
+<h3><%=l(:label_news_latest)%></h3>
+
+<%= render (:partial => 'news/news',
+ :collection => News.find(:all,
+ :limit => 10,
+ :order => 'news.created_on DESC',
+ :conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
:include => [:project, :author])) unless @user.projects.empty? %>
\ No newline at end of file
-<div class="contextual">\r
- <%= link_to l(:label_personalize_page), :action => 'page_layout' %>\r
-</div>\r
-\r
-<h2><%=l(:label_my_page)%></h2>\r
-\r
-<div id="list-top">\r
- <% @blocks['top'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <div class="mypage-box"> \r
- <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>\r
- </div>\r
- <% end if @blocks['top'] %>\r
-</div>\r
-\r
-<div id="list-left" class="splitcontentleft">\r
- <% @blocks['left'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <div class="mypage-box"> \r
- <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>\r
- </div>\r
- <% end if @blocks['left'] %>\r
-</div>\r
-\r
-<div id="list-right" class="splitcontentright">\r
- <% @blocks['right'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <div class="mypage-box"> \r
- <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>\r
- </div>\r
- <% end if @blocks['right'] %>\r
-</div>\r
-\r
+<div class="contextual">
+ <%= link_to l(:label_personalize_page), :action => 'page_layout' %>
+</div>
+
+<h2><%=l(:label_my_page)%></h2>
+
+<div id="list-top">
+ <% @blocks['top'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['top'] %>
+</div>
+
+<div id="list-left" class="splitcontentleft">
+ <% @blocks['left'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['left'] %>
+</div>
+
+<div id="list-right" class="splitcontentright">
+ <% @blocks['right'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['right'] %>
+</div>
+
-<script language="JavaScript">\r
-//<![CDATA[\r
-function recreateSortables() {\r
- Sortable.destroy('list-top');\r
- Sortable.destroy('list-left');\r
- Sortable.destroy('list-right');\r
- \r
- Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=top', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-top",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})\r
- Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=left', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-left",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})\r
- Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=right', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-right",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})\r
-}\r
-\r
-function updateSelect() {\r
- s = $('block-select')\r
- for (var i = 0; i < s.options.length; i++) {\r
- if ($('block_' + s.options[i].value)) {\r
- s.options[i].disabled = true;\r
- } else {\r
- s.options[i].disabled = false;\r
- }\r
- }\r
- s.options[0].selected = true;\r
-}\r
-\r
-function afterAddBlock() {\r
- recreateSortables();\r
- updateSelect();\r
-}\r
-\r
-function removeBlock(block) {\r
- $(block).parentNode.removeChild($(block));\r
- updateSelect();\r
-}\r
-//]]>\r
-</script>\r
-\r
-<div class="contextual">\r
-<span id="indicator" style="display:none"><%= image_tag "loading.gif", :align => "absmiddle" %></span>\r
-<% form_tag({:action => "add_block"}, :id => "block-form") do %>\r
-<%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %>\r
-<%= link_to_remote l(:button_add),\r
- {:url => { :action => "add_block" },\r
- :with => "Form.serialize('block-form')",\r
- :update => "list-top",\r
- :position => :top,\r
- :complete => "afterAddBlock();",\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')"\r
- }, :class => 'icon icon-add'\r
- %>\r
-<% end %>\r
-<%= link_to l(:button_save), {:action => 'page_layout_save'}, :class => 'icon icon-save' %>\r
-<%= link_to l(:button_cancel), {:action => 'page'}, :class => 'icon icon-cancel' %>\r
-</div>\r
-\r
-<h2><%=l(:label_my_page)%></h2>\r
-\r
-<div id="list-top" class="block-receiver">\r
- <% @blocks['top'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>\r
- <% end if @blocks['top'] %>\r
-</div>\r
-\r
-<div id="list-left" class="splitcontentleft block-receiver">\r
- <% @blocks['left'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>\r
- <% end if @blocks['left'] %>\r
-</div>\r
-\r
-<div id="list-right" class="splitcontentright block-receiver">\r
- <% @blocks['right'].each do |b| \r
- next unless MyController::BLOCKS.keys.include? b %>\r
- <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>\r
- <% end if @blocks['right'] %>\r
-</div>\r
-\r
-<%= sortable_element 'list-top',\r
- :tag => 'div',\r
- :only => 'mypage-box',\r
- :handle => "handle",\r
- :dropOnEmpty => true,\r
- :containment => ['list-top', 'list-left', 'list-right'],\r
- :constraint => false,\r
- :complete => visual_effect(:highlight, 'list-top'), \r
- :url => { :action => "order_blocks", :group => "top" },\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')"\r
- %>\r
- \r
- \r
-<%= sortable_element 'list-left', \r
- :tag => 'div',\r
- :only => 'mypage-box',\r
- :handle => "handle",\r
- :dropOnEmpty => true,\r
- :containment => ['list-top', 'list-left', 'list-right'],\r
- :constraint => false,\r
- :complete => visual_effect(:highlight, 'list-left'), \r
- :url => { :action => "order_blocks", :group => "left" },\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')" %>\r
- \r
-<%= sortable_element 'list-right', \r
- :tag => 'div',\r
- :only => 'mypage-box',\r
- :handle => "handle",\r
- :dropOnEmpty => true,\r
- :containment => ['list-top', 'list-left', 'list-right'],\r
- :constraint => false,\r
- :complete => visual_effect(:highlight, 'list-right'), \r
- :url => { :action => "order_blocks", :group => "right" },\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')" %>\r
- \r
+<script language="JavaScript">
+//<![CDATA[
+function recreateSortables() {
+ Sortable.destroy('list-top');
+ Sortable.destroy('list-left');
+ Sortable.destroy('list-right');
+
+ Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=top', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-top",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
+ Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=left', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-left",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
+ Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=right', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-right",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
+}
+
+function updateSelect() {
+ s = $('block-select')
+ for (var i = 0; i < s.options.length; i++) {
+ if ($('block_' + s.options[i].value)) {
+ s.options[i].disabled = true;
+ } else {
+ s.options[i].disabled = false;
+ }
+ }
+ s.options[0].selected = true;
+}
+
+function afterAddBlock() {
+ recreateSortables();
+ updateSelect();
+}
+
+function removeBlock(block) {
+ $(block).parentNode.removeChild($(block));
+ updateSelect();
+}
+//]]>
+</script>
+
+<div class="contextual">
+<span id="indicator" style="display:none"><%= image_tag "loading.gif", :align => "absmiddle" %></span>
+<% form_tag({:action => "add_block"}, :id => "block-form") do %>
+<%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %>
+<%= link_to_remote l(:button_add),
+ {:url => { :action => "add_block" },
+ :with => "Form.serialize('block-form')",
+ :update => "list-top",
+ :position => :top,
+ :complete => "afterAddBlock();",
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')"
+ }, :class => 'icon icon-add'
+ %>
+<% end %>
+<%= link_to l(:button_save), {:action => 'page_layout_save'}, :class => 'icon icon-save' %>
+<%= link_to l(:button_cancel), {:action => 'page'}, :class => 'icon icon-cancel' %>
+</div>
+
+<h2><%=l(:label_my_page)%></h2>
+
+<div id="list-top" class="block-receiver">
+ <% @blocks['top'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['top'] %>
+</div>
+
+<div id="list-left" class="splitcontentleft block-receiver">
+ <% @blocks['left'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['left'] %>
+</div>
+
+<div id="list-right" class="splitcontentright block-receiver">
+ <% @blocks['right'].each do |b|
+ next unless MyController::BLOCKS.keys.include? b %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['right'] %>
+</div>
+
+<%= sortable_element 'list-top',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-top'),
+ :url => { :action => "order_blocks", :group => "top" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')"
+ %>
+
+
+<%= sortable_element 'list-left',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-left'),
+ :url => { :action => "order_blocks", :group => "left" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" %>
+
+<%= sortable_element 'list-right',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-right'),
+ :url => { :action => "order_blocks", :group => "right" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" %>
+
<%= javascript_tag "updateSelect()" %>
\ No newline at end of file
-<p><%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %><br />\r
-<% unless news.summary.empty? %><%=h news.summary %><br /><% end %>\r
-<em><%= news.author.name %>, <%= format_time(news.created_on) %></em><br />\r
-<%= news.comments_count %> <%= lwr(:label_comment, news.comments_count).downcase %><br /></p>\r
+<p><%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %><br />
+<% unless news.summary.empty? %><%=h news.summary %><br /><% end %>
+<em><%= news.author.name %>, <%= format_time(news.created_on) %></em><br />
+<%= news.comments_count %> <%= lwr(:label_comment, news.comments_count).downcase %><br /></p>
-<div class="contextual">\r
-<%= link_to_if_authorized l(:button_edit), {:controller => 'news', :action => 'edit', :id => @news}, :class => 'icon icon-edit' %>\r
-<%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
-</div>\r
-\r
-<h2><%=h @news.title %></h2>\r
-\r
-<p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %>\r
-<%= @news.author.display_name %>, <%= format_time(@news.created_on) %></em></p>\r
-<br />\r
+<div class="contextual">
+<%= link_to_if_authorized l(:button_edit), {:controller => 'news', :action => 'edit', :id => @news}, :class => 'icon icon-edit' %>
+<%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+</div>
+
+<h2><%=h @news.title %></h2>
+
+<p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %>
+<%= @news.author.display_name %>, <%= format_time(@news.created_on) %></em></p>
+<br />
<%= textilizable auto_link @news.description %>
-<br />\r
-\r
-<div id="comments" style="margin-bottom:16px;">\r
-<h3 class="icon22 icon22-comment"><%= l(:label_comment_plural) %></h3>\r
-<% @news.comments.each do |comment| %>\r
- <% next if comment.new_record? %>\r
- <h4><%= format_time(comment.created_on) %> - <%= comment.author.name %></h4>\r
- <div class="contextual">\r
- <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
- </div>\r
- <%= simple_format(auto_link(h comment.comment))%>\r
-<% end if @news.comments_count > 0 %>\r
-</div>\r
-\r
-<% if authorize_for 'news', 'add_comment' %>\r
-<% form_tag({:action => 'add_comment', :id => @news}) do %>\r
-<%= error_messages_for 'comment' %>\r
-<p><label for="comment_comment"><%= l(:label_comment_add) %></label><br />\r
-<%= text_area 'comment', 'comment', :cols => 60, :rows => 6 %></p>\r
-<%= submit_tag l(:button_add) %>\r
-<% end %>\r
+<br />
+
+<div id="comments" style="margin-bottom:16px;">
+<h3 class="icon22 icon22-comment"><%= l(:label_comment_plural) %></h3>
+<% @news.comments.each do |comment| %>
+ <% next if comment.new_record? %>
+ <h4><%= format_time(comment.created_on) %> - <%= comment.author.name %></h4>
+ <div class="contextual">
+ <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ </div>
+ <%= simple_format(auto_link(h comment.comment))%>
+<% end if @news.comments_count > 0 %>
+</div>
+
+<% if authorize_for 'news', 'add_comment' %>
+<% form_tag({:action => 'add_comment', :id => @news}) do %>
+<%= error_messages_for 'comment' %>
+<p><label for="comment_comment"><%= l(:label_comment_add) %></label><br />
+<%= text_area 'comment', 'comment', :cols => 60, :rows => 6 %></p>
+<%= submit_tag l(:button_add) %>
+<% end %>
<% end %>
\ No newline at end of file
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p>
<p><%= f.text_field :homepage, :size => 40 %></p>
<p><%= f.check_box :is_public %></p>
-\r
+
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
-<% end %>\r
+<% end %>
<% unless @custom_fields.empty? %>
<p><label><%=l(:label_custom_field_plural)%></label>
<% for custom_field in @custom_fields %>
- <%= check_box_tag "custom_field_ids[]", custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>\r
- <%= custom_field.name %> \r
+ <%= check_box_tag "custom_field_ids[]", custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
+ <%= custom_field.name %>
<% end %></p>
-<% end %>\r
+<% end %>
<!--[eoform:project]-->
</div>
-<h2><%=l(:label_activity)%>: <%= "#{month_name(@month).downcase} #{@year}" %></h2>\r
-\r
-<div>\r
-<div class="rightbox">\r
-<% form_tag do %>\r
-<p><%= select_month(@month, :prefix => "month", :discard_type => true) %>\r
-<%= select_year(@year, :prefix => "year", :discard_type => true) %></p>\r
-<p>\r
- <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br />\r
- <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br />\r
- <%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br />\r
- <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%>\r
-</p>\r
-<p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p>\r
-<% end %>\r
-</div>\r
-\r
-<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>\r
- <h3><%= day_name(day.cwday) %> <%= day.day %></h3>\r
- <ul>\r
- <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>\r
- <li><p>\r
- <% if e.is_a? Issue %>\r
- <%= e.created_on.strftime("%H:%M") %> <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %> (<%= e.status.name %>): <%=h e.subject %><br />\r
- <i><%= e.author.name %></i>\r
- <% elsif e.is_a? News %>\r
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_news)%>: <%= link_to h(e.title), :controller => 'news', :action => 'show', :id => e %><br />\r
- <% unless e.summary.empty? %><%=h e.summary %><br /><% end %>\r
- <i><%= e.author.name %></i>\r
- <% elsif (e.is_a? Attachment) and (e.container.is_a? Version) %>\r
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (<%=h e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br />\r
- <i><%= e.author.name %></i>\r
- <% elsif (e.is_a? Attachment) and (e.container.is_a? Document) %>\r
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%>: <%= e.filename %> (<%= link_to h(e.container.title), :controller => 'documents', :action => 'show', :id => e.container %>)<br />\r
- <i><%= e.author.name %></i>\r
- <% elsif e.is_a? Document %>\r
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br />\r
- <% end %>\r
- </p></li>\r
- \r
- <% end %>\r
- </ul>\r
-<% end %>\r
-<% if @events_by_day.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-\r
-<div style="float:left;">\r
-<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), \r
- {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},\r
- {:href => url_for(:action => 'activity', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}\r
- %>\r
-</div>\r
-<div style="float:right;">\r
-<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), \r
- {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},\r
- {:href => url_for(:action => 'activity', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}\r
- %> \r
-</div>\r
-<br />\r
+<h2><%=l(:label_activity)%>: <%= "#{month_name(@month).downcase} #{@year}" %></h2>
+
+<div>
+<div class="rightbox">
+<% form_tag do %>
+<p><%= select_month(@month, :prefix => "month", :discard_type => true) %>
+<%= select_year(@year, :prefix => "year", :discard_type => true) %></p>
+<p>
+ <%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%><br />
+ <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%><br />
+ <%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%><br />
+ <%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%>
+</p>
+<p class="textcenter"><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
+<% end %>
+</div>
+
+<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
+ <h3><%= day_name(day.cwday) %> <%= day.day %></h3>
+ <ul>
+ <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
+ <li><p>
+ <% if e.is_a? Issue %>
+ <%= e.created_on.strftime("%H:%M") %> <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %> (<%= e.status.name %>): <%=h e.subject %><br />
+ <i><%= e.author.name %></i>
+ <% elsif e.is_a? News %>
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_news)%>: <%= link_to h(e.title), :controller => 'news', :action => 'show', :id => e %><br />
+ <% unless e.summary.empty? %><%=h e.summary %><br /><% end %>
+ <i><%= e.author.name %></i>
+ <% elsif (e.is_a? Attachment) and (e.container.is_a? Version) %>
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (<%=h e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br />
+ <i><%= e.author.name %></i>
+ <% elsif (e.is_a? Attachment) and (e.container.is_a? Document) %>
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%>: <%= e.filename %> (<%= link_to h(e.container.title), :controller => 'documents', :action => 'show', :id => e.container %>)<br />
+ <i><%= e.author.name %></i>
+ <% elsif e.is_a? Document %>
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %><br />
+ <% end %>
+ </p></li>
+
+ <% end %>
+ </ul>
+<% end %>
+<% if @events_by_day.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+
+<div style="float: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) }},
+ {:href => url_for(:action => 'activity', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}
+ %>
+</div>
+<div style="float: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) }},
+ {:href => url_for(:action => 'activity', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}
+ %>
+</div>
+<br />
</div>
\ No newline at end of file
<h2><%=l(:label_document_new)%></h2>
-\r
-<% form_tag( { :action => 'add_document', :id => @project }, :class => "tabular", :multipart => true) do %>\r
+
+<% form_tag( { :action => 'add_document', :id => @project }, :class => "tabular", :multipart => true) do %>
<%= render :partial => 'documents/form' %>
-<div class="box">\r
+<div class="box">
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
<%= image_to_function "add.png", "addFileField();return false" %></label>
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
</div>
-\r
+
<%= submit_tag l(:button_create) %>
<% end %>
-\r
+
-<h2><%=l(:label_attachment_new)%></h2>\r
-\r
-<%= error_messages_for 'attachment' %>\r
-<div class="box">\r
-<% form_tag({ :action => 'add_file', :id => @project }, :multipart => true, :class => "tabular") do %>\r
-\r
-<p><label for="version_id"><%=l(:field_version)%> <span class="required">*</span></label>\r
-<%= select_tag "version_id", options_from_collection_for_select(@versions, "id", "name") %></p>\r
-\r
-<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>\r
-<%= image_to_function "add.png", "addFileField();return false" %></label>\r
-<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>\r
-</div>\r
-<%= submit_tag l(:button_add) %>\r
+<h2><%=l(:label_attachment_new)%></h2>
+
+<%= error_messages_for 'attachment' %>
+<div class="box">
+<% form_tag({ :action => 'add_file', :id => @project }, :multipart => true, :class => "tabular") do %>
+
+<p><label for="version_id"><%=l(:field_version)%> <span class="required">*</span></label>
+<%= select_tag "version_id", options_from_collection_for_select(@versions, "id", "name") %></p>
+
+<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
+<%= image_to_function "add.png", "addFileField();return false" %></label>
+<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
+</div>
+<%= submit_tag l(:button_add) %>
<% end %>
\ No newline at end of file
<h2><%=l(:label_issue_new)%>: <%= @tracker.name %></h2>
-\r
+
<% labelled_tabular_form_for :issue, @issue, :url => {:action => 'add_issue'}, :html => {:multipart => true} do |f| %>
<%= error_messages_for 'issue' %>
<div class="box">
<%= hidden_field_tag 'tracker_id', @tracker.id %>
<div class="splitcontentleft">
-<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>\r
-<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>\r
-<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %></p>\r
+<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
+<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
+<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %></p>
</div>
<div class="splitcontentright">
<p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
<div class="clear">
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
<p><%= f.text_area :description, :cols => 60, :rows => 10, :required => true, :class => 'wiki-edit' %></p>
-\r
+
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
-<% end %>\r
-\r
+<% end %>
+
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
<%= image_to_function "add.png", "addFileField();return false" %></label>
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
</div>
<!--[eoform:issue]-->
</div>
-<%= submit_tag l(:button_create) %>\r
+<%= submit_tag l(:button_create) %>
<% end %>
<% if Setting.text_formatting == 'textile' %>
-<h2><%= l(:label_query_new) %></h2>\r
-\r
-<% form_tag({:action => 'add_query', :id => @project}) do %>\r
- <%= render :partial => 'queries/form', :locals => {:query => @query} %>\r
- <%= submit_tag l(:button_create) %>\r
+<h2><%= l(:label_query_new) %></h2>
+
+<% form_tag({:action => 'add_query', :id => @project}) do %>
+ <%= render :partial => 'queries/form', :locals => {:query => @query} %>
+ <%= submit_tag l(:button_create) %>
<% end %>
\ No newline at end of file
-<h2><%= l(:label_calendar) %></h2>\r
-\r
-<% form_tag({:action => 'calendar', :id => @project}) do %>\r
-<table width="100%">\r
-<tr>\r
-<td align="left" style="width:150px">\r
- <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), \r
- {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},\r
- {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}\r
- %>\r
-</td>\r
-<td align="center">\r
- <%= select_month(@month, :prefix => "month", :discard_type => true) %>\r
- <%= select_year(@year, :prefix => "year", :discard_type => true) %>\r
- <%= submit_tag l(:button_submit), :class => "button-small" %>\r
-</td>\r
-<td align="right" style="width:150px">\r
- <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), \r
- {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},\r
- {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}\r
- %> \r
-</td>\r
-</tr>\r
-</table>\r
-<% end %>\r
-<br />\r
-\r
-<table class="list with-cells">\r
-<thead>\r
-<tr>\r
-<th></th>\r
-<% 1.upto(7) do |d| %>\r
- <th style="width:14%"><%= day_name(d) %></th>\r
-<% end %>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr style="height:100px">\r
-<% day = @date_from\r
-while day <= @date_to\r
- if day.cwday == 1 %>\r
- <th><%= day.cweek %></th>\r
- <% end %> \r
- <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>">\r
- <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> \r
- <% day_issues = []\r
- @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } \r
- day_issues.each do |i| %>\r
- <div class="tooltip">\r
- <%= if day == i.start_date and day == i.due_date\r
- image_tag('arrow_bw.png')\r
- elsif day == i.start_date\r
- image_tag('arrow_from.png') \r
- elsif day == i.due_date\r
- image_tag('arrow_to.png') \r
- end %>\r
- <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i } %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>\r
- <span class="tip">\r
- <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>\r
- </span> \r
- </div>\r
- <% end %>\r
- </td>\r
- <%= '</tr><tr style="height:100px">' if day.cwday >= 7 and day!=@date_to %>\r
- <%\r
- day = day + 1\r
-end %>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br />\r
-<%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br />\r
+<h2><%= l(:label_calendar) %></h2>
+
+<% form_tag({:action => 'calendar', :id => @project}) do %>
+<table width="100%">
+<tr>
+<td align="left" style="width:150px">
+ <%= 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))}
+ %>
+</td>
+<td align="center">
+ <%= select_month(@month, :prefix => "month", :discard_type => true) %>
+ <%= select_year(@year, :prefix => "year", :discard_type => true) %>
+ <%= submit_tag l(:button_submit), :class => "button-small" %>
+</td>
+<td align="right" style="width:150px">
+ <%= 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))}
+ %>
+</td>
+</tr>
+</table>
+<% end %>
+<br />
+
+<table class="list with-cells">
+<thead>
+<tr>
+<th></th>
+<% 1.upto(7) do |d| %>
+ <th style="width:14%"><%= day_name(d) %></th>
+<% end %>
+</tr>
+</thead>
+<tbody>
+<tr style="height:100px">
+<% day = @date_from
+while day <= @date_to
+ if day.cwday == 1 %>
+ <th><%= day.cweek %></th>
+ <% end %>
+ <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>">
+ <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p>
+ <% day_issues = []
+ @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day }
+ day_issues.each do |i| %>
+ <div class="tooltip">
+ <%= if day == i.start_date and day == i.due_date
+ image_tag('arrow_bw.png')
+ elsif day == i.start_date
+ image_tag('arrow_from.png')
+ elsif day == i.due_date
+ image_tag('arrow_to.png')
+ end %>
+ <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i } %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>
+ <span class="tip">
+ <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>
+ </span>
+ </div>
+ <% end %>
+ </td>
+ <%= '</tr><tr style="height:100px">' if day.cwday >= 7 and day!=@date_to %>
+ <%
+ day = day + 1
+end %>
+</tr>
+</tbody>
+</table>
+
+<%= 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 />
\ No newline at end of file
-<h2><%=l(:label_change_log)%></h2>\r
-\r
-<div>\r
-\r
-<div class="rightbox" style="width:140px;">\r
-<% form_tag do %>\r
-<p><strong><%=l(:label_tracker_plural)%></strong></p>\r
-<% @trackers.each do |tracker| %>\r
- <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>\r
- <%= tracker.name %><br />\r
-<% end %>\r
-<p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p>\r
-<% end %>\r
-</div>\r
-\r
-<% if @fixed_issues.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-\r
-<% ver_id = nil\r
- @fixed_issues.each do |issue| %> \r
- <% unless ver_id == issue.fixed_version_id %>\r
- <% if ver_id %></ul><% end %>\r
- <h3 class="icon22 icon22-package"><%= issue.fixed_version.name %></h3>\r
- <p><%= format_date(issue.fixed_version.effective_date) %><br />\r
- <%=h issue.fixed_version.description %></p>\r
- <ul>\r
- <% ver_id = issue.fixed_version_id\r
- end %>\r
- <li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>\r
-<% end %>\r
+<h2><%=l(:label_change_log)%></h2>
+
+<div>
+
+<div class="rightbox" style="width:140px;">
+<% form_tag do %>
+<p><strong><%=l(:label_tracker_plural)%></strong></p>
+<% @trackers.each do |tracker| %>
+ <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>
+ <%= tracker.name %><br />
+<% end %>
+<p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p>
+<% end %>
+</div>
+
+<% if @fixed_issues.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+
+<% ver_id = nil
+ @fixed_issues.each do |issue| %>
+ <% unless ver_id == issue.fixed_version_id %>
+ <% if ver_id %></ul><% end %>
+ <h3 class="icon22 icon22-package"><%= issue.fixed_version.name %></h3>
+ <p><%= format_date(issue.fixed_version.effective_date) %><br />
+ <%=h issue.fixed_version.description %></p>
+ <ul>
+ <% ver_id = issue.fixed_version_id
+ end %>
+ <li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>
+<% end %>
</div>
\ No newline at end of file
-<h2><%=l(:label_confirmation)%></h2>\r
-<div class="box">\r
-<center>\r
-<p><strong><%= @project.name %></strong><br />\r
-<%=l(:text_project_destroy_confirmation)%></p>\r
-\r
-<p>\r
- <% form_tag({:controller => 'projects', :action => 'destroy', :id => @project}) do %>\r
- <%= hidden_field_tag "confirm", 1 %>\r
- <%= submit_tag l(:button_delete) %>\r
- <% end %>\r
-</p>\r
-</center>\r
+<h2><%=l(:label_confirmation)%></h2>
+<div class="box">
+<center>
+<p><strong><%= @project.name %></strong><br />
+<%=l(:text_project_destroy_confirmation)%></p>
+
+<p>
+ <% form_tag({:controller => 'projects', :action => 'destroy', :id => @project}) do %>
+ <%= hidden_field_tag "confirm", 1 %>
+ <%= submit_tag l(:button_delete) %>
+ <% end %>
+</p>
+</center>
</div>
\ No newline at end of file
-<div class="contextual">\r
-<%= l(:label_export_to) %>\r
-<%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :output => 'pdf'}, :class => 'icon icon-pdf' %>\r
-</div>\r
-\r
-<h2><%= l(:label_gantt) %></h2>\r
-\r
-<table width="100%">\r
-<tr>\r
-<td align="left">\r
-<% form_tag do %>\r
-<p>\r
-<input type="text" name="months" size="2" value="<%= @months %>" />\r
-<%= l(:label_months_from) %>\r
-<%= select_month(@month_from, :prefix => "month", :discard_type => true) %>\r
-<%= select_year(@year_from, :prefix => "year", :discard_type => true) %>\r
-<%= hidden_field_tag 'zoom', @zoom %>\r
-<%= submit_tag l(:button_submit), :class => "button-small" %>\r
-</p>\r
-<% end %>\r
-</td>\r
-<td align="right">\r
-<%= if @zoom < 4\r
- link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months}\r
- else\r
- image_tag 'zoom_in_g.png'\r
- end %>\r
-<%= if @zoom > 1\r
- link_to image_tag('zoom_out.png'), :zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months\r
- else\r
- image_tag 'zoom_out_g.png'\r
- end %>\r
-</td>\r
-</tr>\r
-</table>\r
-<br />\r
-\r
-<% zoom = 1\r
-@zoom.times { zoom = zoom * 2 }\r
-\r
-subject_width = 260\r
-header_heigth = 18\r
-\r
-headers_heigth = header_heigth\r
-show_weeks = false\r
-show_days = false\r
-\r
-if @zoom >1\r
- show_weeks = true\r
- headers_heigth = 2*header_heigth\r
- if @zoom > 2\r
- show_days = true\r
- headers_heigth = 3*header_heigth\r
- end\r
-end\r
-\r
-g_width = (@date_to - @date_from + 1)*zoom\r
-g_height = [(20 * @issues.length + 6)+150, 206].max\r
-t_height = g_height + headers_heigth\r
-%>\r
-\r
-<table width="100%" style="border:0; border-collapse: collapse;">\r
-<tr>\r
-<td style="width:260px;">\r
-\r
-<div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">\r
-<div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_heigth %>px;background: #eee;" class="gantt_hdr"></div>\r
-<div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>\r
-<%\r
-#\r
-# Tasks subjects\r
-#\r
-top = headers_heigth + 8\r
-@issues.each do |i| %>\r
- <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;">\r
- <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>:\r
- <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>\r
- </div>\r
-<% top = top + 20\r
-end %>\r
-</div>\r
-</td>\r
-<td>\r
-\r
-<div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">\r
-<div style="width:<%= g_width-1 %>px;height:<%= headers_heigth %>px;background: #eee;" class="gantt_hdr"> </div>\r
-<% \r
-#\r
-# Months headers\r
-#\r
-month_f = @date_from\r
-left = 0\r
-height = (show_weeks ? header_heigth : header_heigth + g_height)\r
-@months.times do \r
- width = ((month_f >> 1) - month_f) * zoom - 1\r
- %>\r
- <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">\r
- <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months }, :title => "#{month_name(month_f.month)} #{month_f.year}"%>\r
- </div>\r
- <% \r
- left = left + width + 1\r
- month_f = month_f >> 1\r
-end %>\r
-\r
-<% \r
-#\r
-# Weeks headers\r
-#\r
-if show_weeks\r
- left = 0\r
- height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)\r
- if @date_from.cwday == 1\r
- # @date_from is monday\r
- week_f = @date_from\r
- else\r
- # find next monday after @date_from\r
- week_f = @date_from + (7 - @date_from.cwday + 1)\r
- width = (7 - @date_from.cwday + 1) * zoom-1\r
- %>\r
- <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> </div>\r
- <% \r
- left = left + width+1\r
- end %>\r
- <%\r
- while week_f <= @date_to\r
- width = (week_f + 6 <= @date_to) ? 7 * zoom -1 : (@date_to - week_f + 1) * zoom-1\r
- %>\r
- <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">\r
- <small><%= week_f.cweek if width >= 16 %></small>\r
- </div>\r
- <% \r
- left = left + width+1\r
- week_f = week_f+7\r
- end\r
-end %>\r
-\r
-<% \r
-#\r
-# Days headers\r
-#\r
-if show_days\r
- left = 0\r
- height = g_height + header_heigth - 1\r
- wday = @date_from.cwday\r
- (@date_to - @date_from + 1).to_i.times do \r
- width = zoom - 1\r
- %>\r
- <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">\r
- <%= day_name(wday)[0,1] %>\r
- </div>\r
- <% \r
- left = left + width+1\r
- wday = wday + 1\r
- wday = 1 if wday > 7\r
- end\r
-end %>\r
-\r
-<%\r
-#\r
-# Today red line\r
-#\r
-if Date.today >= @date_from and Date.today <= @date_to %>\r
- <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_heigth + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div>\r
-<% end %>\r
-\r
-<%\r
-#\r
-# Tasks\r
-#\r
-top = headers_heigth + 10\r
-@issues.each do |i| %>\r
- <%\r
- i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )\r
- i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )\r
- \r
- i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor\r
- i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )\r
- i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )\r
- \r
- i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today\r
- \r
- i_left = ((i_start_date - @date_from)*zoom).floor \r
- i_width = ((i_end_date - i_start_date + 1)*zoom).floor - 2 # total width of the issue (- 2 for left and right borders)\r
- d_width = ((i_done_date - i_start_date)*zoom).floor - 2 # done width\r
- l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor - 2 : 0 # delay width\r
- %>\r
- <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo"> </div>\r
- <% if l_width > 0 %>\r
- <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late"> </div>\r
- <% end %>\r
- <% if d_width > 0 %>\r
- <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done"> </div>\r
- <% end %>\r
- <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">\r
- <%= i.status.name %>\r
- <%= (i.done_ratio).to_i %>%\r
- </div>\r
- <% # === tooltip === %>\r
- <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">\r
- <span class="tip">\r
- <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>\r
- </span></div>\r
- <% top = top + 20\r
-end %>\r
-</div>\r
-</td>\r
-</tr>\r
-</table>\r
-\r
-<table width="100%">\r
-<tr>\r
-<td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months %></td>\r
-<td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months %></td>\r
-</tr>\r
+<div class="contextual">
+<%= l(:label_export_to) %>
+<%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :output => 'pdf'}, :class => 'icon icon-pdf' %>
+</div>
+
+<h2><%= l(:label_gantt) %></h2>
+
+<table width="100%">
+<tr>
+<td align="left">
+<% form_tag do %>
+<p>
+<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" %>
+</p>
+<% end %>
+</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}
+ 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
+ else
+ image_tag 'zoom_out_g.png'
+ end %>
+</td>
+</tr>
+</table>
+<br />
+
+<% zoom = 1
+@zoom.times { zoom = zoom * 2 }
+
+subject_width = 260
+header_heigth = 18
+
+headers_heigth = header_heigth
+show_weeks = false
+show_days = false
+
+if @zoom >1
+ show_weeks = true
+ headers_heigth = 2*header_heigth
+ if @zoom > 2
+ show_days = true
+ headers_heigth = 3*header_heigth
+ end
+end
+
+g_width = (@date_to - @date_from + 1)*zoom
+g_height = [(20 * @issues.length + 6)+150, 206].max
+t_height = g_height + headers_heigth
+%>
+
+<table width="100%" style="border:0; border-collapse: collapse;">
+<tr>
+<td style="width:260px;">
+
+<div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
+<div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_heigth %>px;background: #eee;" class="gantt_hdr"></div>
+<div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
+<%
+#
+# Tasks subjects
+#
+top = headers_heigth + 8
+@issues.each do |i| %>
+ <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;">
+ <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>:
+ <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>
+ </div>
+<% top = top + 20
+end %>
+</div>
+</td>
+<td>
+
+<div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
+<div style="width:<%= g_width-1 %>px;height:<%= headers_heigth %>px;background: #eee;" class="gantt_hdr"> </div>
+<%
+#
+# Months headers
+#
+month_f = @date_from
+left = 0
+height = (show_weeks ? header_heigth : header_heigth + g_height)
+@months.times do
+ width = ((month_f >> 1) - month_f) * zoom - 1
+ %>
+ <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 }, :title => "#{month_name(month_f.month)} #{month_f.year}"%>
+ </div>
+ <%
+ left = left + width + 1
+ month_f = month_f >> 1
+end %>
+
+<%
+#
+# Weeks headers
+#
+if show_weeks
+ left = 0
+ height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
+ if @date_from.cwday == 1
+ # @date_from is monday
+ week_f = @date_from
+ else
+ # find next monday after @date_from
+ week_f = @date_from + (7 - @date_from.cwday + 1)
+ width = (7 - @date_from.cwday + 1) * zoom-1
+ %>
+ <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
+ %>
+ <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
+ <small><%= week_f.cweek if width >= 16 %></small>
+ </div>
+ <%
+ left = left + width+1
+ week_f = week_f+7
+ end
+end %>
+
+<%
+#
+# Days headers
+#
+if show_days
+ left = 0
+ height = g_height + header_heigth - 1
+ wday = @date_from.cwday
+ (@date_to - @date_from + 1).to_i.times do
+ width = zoom - 1
+ %>
+ <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">
+ <%= day_name(wday)[0,1] %>
+ </div>
+ <%
+ left = left + width+1
+ wday = wday + 1
+ wday = 1 if wday > 7
+ end
+end %>
+
+<%
+#
+# Today red line
+#
+if Date.today >= @date_from and Date.today <= @date_to %>
+ <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_heigth + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div>
+<% end %>
+
+<%
+#
+# Tasks
+#
+top = headers_heigth + 10
+@issues.each do |i| %>
+ <%
+ i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
+ i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
+
+ i_done_date = i.start_date + ((i.due_date - i.start_date+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 = ((i_start_date - @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
+ %>
+ <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;" class="task task_todo"> </div>
+ <% if l_width > 0 %>
+ <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= l_width %>px;" class="task task_late"> </div>
+ <% end %>
+ <% if d_width > 0 %>
+ <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done"> </div>
+ <% end %>
+ <div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">
+ <%= i.status.name %>
+ <%= (i.done_ratio).to_i %>%
+ </div>
+ <% # === tooltip === %>
+ <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
+ <span class="tip">
+ <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>
+ </span></div>
+ <% top = top + 20
+end %>
+</div>
+</td>
+</tr>
+</table>
+
+<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 %></td>
+<td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months %></td>
+</tr>
</table>
\ No newline at end of file
<table class="list">
<thead><tr>
- <%= sort_header_tag('name', :caption => l(:label_project)) %>\r
- <th><%=l(:field_description)%></th>\r
+ <%= sort_header_tag('name', :caption => l(:label_project)) %>
+ <th><%=l(:field_description)%></th>
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
</tr></thead>
<tbody>
<% for project in @projects %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <td><%= link_to project.name, :action => 'show', :id => project %></td>\r
- <td><%=h project.description %></td>\r
- <td align="center"><%= format_date(project.created_on) %></td>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to project.name, :action => 'show', :id => project %></td>
+ <td><%=h project.description %></td>
+ <td align="center"><%= format_date(project.created_on) %></td>
</tr>
<% end %>
</tbody>
-</table>\r
-\r
+</table>
+
<%= pagination_links_full @project_pages %>
[ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ]
\ No newline at end of file
-<div class="contextual">\r
-<%= link_to_if_authorized l(:label_document_new), {:controller => 'projects', :action => 'add_document', :id => @project}, :class => 'icon icon-add' %>\r
-</div>\r
-\r
-<h2><%=l(:label_document_plural)%></h2>\r
-\r
-<% if @documents.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-\r
-<% documents = @documents.group_by {|d| d.category } %>\r
-<% documents.each do |category, docs| %>\r
- <h3><%= category.name %></h3>\r
- <%= render :partial => 'documents/document', :collection => docs %>\r
+<div class="contextual">
+<%= link_to_if_authorized l(:label_document_new), {:controller => 'projects', :action => 'add_document', :id => @project}, :class => 'icon icon-add' %>
+</div>
+
+<h2><%=l(:label_document_plural)%></h2>
+
+<% if @documents.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+
+<% documents = @documents.group_by {|d| d.category } %>
+<% documents.each do |category, docs| %>
+ <h3><%= category.name %></h3>
+ <%= render :partial => 'documents/document', :collection => docs %>
<% end %>
\ No newline at end of file
-<div class="contextual">\r
-<%= link_to_if_authorized l(:label_attachment_new), {:controller => 'projects', :action => 'add_file', :id => @project}, :class => 'icon icon-add' %>\r
-</div>\r
-\r
-<h2><%=l(:label_attachment_plural)%></h2>\r
-\r
-<% delete_allowed = authorize_for('versions', 'destroy_file') %>\r
-\r
-<table class="list">\r
- <thead><tr>\r
- <th><%=l(:field_version)%></th>\r
- <th><%=l(:field_filename)%></th>\r
- <th><%=l(:label_date)%></th>\r
- <th><%=l(:field_filesize)%></th>\r
- <th>D/L</th>\r
- <th>MD5</th>\r
- <% if delete_allowed %><th></th><% end %>\r
- </tr></thead>\r
- <tbody>\r
-<% for version in @versions %> \r
- <% unless version.attachments.empty? %>\r
- <tr><th colspan="7" align="left"><span class="icon icon-package"><b><%= version.name %></b></span></th></tr>\r
+<div class="contextual">
+<%= link_to_if_authorized l(:label_attachment_new), {:controller => 'projects', :action => 'add_file', :id => @project}, :class => 'icon icon-add' %>
+</div>
+
+<h2><%=l(:label_attachment_plural)%></h2>
+
+<% delete_allowed = authorize_for('versions', 'destroy_file') %>
+
+<table class="list">
+ <thead><tr>
+ <th><%=l(:field_version)%></th>
+ <th><%=l(:field_filename)%></th>
+ <th><%=l(:label_date)%></th>
+ <th><%=l(:field_filesize)%></th>
+ <th>D/L</th>
+ <th>MD5</th>
+ <% if delete_allowed %><th></th><% end %>
+ </tr></thead>
+ <tbody>
+<% for version in @versions %>
+ <% unless version.attachments.empty? %>
+ <tr><th colspan="7" align="left"><span class="icon icon-package"><b><%= version.name %></b></span></th></tr>
<% for file in version.attachments %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <td></td>\r
- <td><%= link_to file.filename, :controller => 'versions', :action => 'download', :id => version, :attachment_id => file %></td>\r
- <td align="center"><%= format_date(file.created_on) %></td>\r
- <td align="center"><%= number_to_human_size(file.filesize) %></td>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <td></td>
+ <td><%= link_to file.filename, :controller => 'versions', :action => 'download', :id => version, :attachment_id => file %></td>
+ <td align="center"><%= format_date(file.created_on) %></td>
+ <td align="center"><%= number_to_human_size(file.filesize) %></td>
<td align="center"><%= file.downloads %></td>
- <td align="center"><small><%= file.digest %></small></td>\r
- <% if delete_allowed %>\r
- <td align="center">\r
- <div class="contextual">\r
- <%= link_to_if_authorized '', {:controller => 'versions', :action => 'destroy_file', :id => version, :attachment_id => file}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
- </div>\r
- </td>\r
+ <td align="center"><small><%= file.digest %></small></td>
+ <% if delete_allowed %>
+ <td align="center">
+ <div class="contextual">
+ <%= link_to_if_authorized '', {:controller => 'versions', :action => 'destroy_file', :id => version, :attachment_id => file}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ </div>
+ </td>
<% end %>
</tr>
- <% end\r
- reset_cycle %>\r
- <% end %>\r
-<% end %>\r
- </tbody>\r
+ <% end
+ reset_cycle %>
+ <% end %>
+<% end %>
+ </tbody>
</table>
\ No newline at end of file
-<% if @query.new_record? %>\r
- <div class="contextual">\r
- <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>\r
- </div>\r
- <h2><%=l(:label_issue_plural)%></h2>\r
- \r
- <% form_tag({:action => 'list_issues'}, :id => 'query_form') do %>\r
- <%= render :partial => 'queries/filters', :locals => {:query => @query} %>\r
- <% end %>\r
- <div class="contextual">\r
- <%= link_to_remote l(:button_apply), \r
- { :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },\r
- :update => "content",\r
- :with => "Form.serialize('query_form')"\r
- }, :class => 'icon icon-edit' %> \r
- \r
- <%= link_to l(:button_clear), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, :class => 'icon icon-del' %>\r
- <% if authorize_for('projects', 'add_query') %>\r
- \r
- <%= link_to_remote l(:button_save), \r
- { :url => { :controller => 'projects', :action => "add_query", :id => @project },\r
- :method => 'get',\r
- :update => "content",\r
- :with => "Form.serialize('query_form')"\r
- }, :class => 'icon icon-save' %>\r
- <% end %>\r
- </div>\r
- <br />\r
-<% else %>\r
- <div class="contextual">\r
- <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>\r
- <% if authorize_for('projects', 'add_query') %>\r
- <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %>\r
- <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
- <% end %>\r
- </div> \r
- <h2><%= @query.name %></h2>\r
-<% end %>\r
-<%= error_messages_for 'query' %>\r
-<% if @query.valid? %>\r
-<% if @issues.empty? %>\r
-<p><i><%= l(:label_no_data) %></i></p>\r
-<% else %>\r
- \r
-<% form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) do %> \r
-<table class="list">\r
- <thead><tr>\r
- <th></th>\r
- <%= sort_header_tag('issues.id', :caption => '#') %>\r
- <%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>\r
- <%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>\r
- <%= sort_header_tag('issues.priority_id', :caption => l(:field_priority)) %>\r
- <th><%=l(:field_subject)%></th>\r
- <%= sort_header_tag('users.lastname', :caption => l(:field_author)) %>\r
- <%= sort_header_tag('issues.updated_on', :caption => l(:field_updated_on)) %>\r
- </tr></thead>\r
- <tbody>\r
+<% if @query.new_record? %>
+ <div class="contextual">
+ <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
+ </div>
+ <h2><%=l(:label_issue_plural)%></h2>
+
+ <% form_tag({:action => 'list_issues'}, :id => 'query_form') do %>
+ <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
+ <% end %>
+ <div class="contextual">
+ <%= link_to_remote l(:button_apply),
+ { :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },
+ :update => "content",
+ :with => "Form.serialize('query_form')"
+ }, :class => 'icon icon-edit' %>
+
+ <%= link_to l(:button_clear), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, :class => 'icon icon-del' %>
+ <% if authorize_for('projects', 'add_query') %>
+
+ <%= link_to_remote l(:button_save),
+ { :url => { :controller => 'projects', :action => "add_query", :id => @project },
+ :method => 'get',
+ :update => "content",
+ :with => "Form.serialize('query_form')"
+ }, :class => 'icon icon-save' %>
+ <% end %>
+ </div>
+ <br />
+<% else %>
+ <div class="contextual">
+ <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
+ <% if authorize_for('projects', 'add_query') %>
+ <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %>
+ <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ <% end %>
+ </div>
+ <h2><%= @query.name %></h2>
+<% end %>
+<%= error_messages_for 'query' %>
+<% if @query.valid? %>
+<% if @issues.empty? %>
+<p><i><%= l(:label_no_data) %></i></p>
+<% else %>
+
+<% form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) do %>
+<table class="list">
+ <thead><tr>
+ <th></th>
+ <%= sort_header_tag('issues.id', :caption => '#') %>
+ <%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>
+ <%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>
+ <%= sort_header_tag('issues.priority_id', :caption => l(:field_priority)) %>
+ <th><%=l(:field_subject)%></th>
+ <%= sort_header_tag('users.lastname', :caption => l(:field_author)) %>
+ <%= sort_header_tag('issues.updated_on', :caption => l(:field_updated_on)) %>
+ </tr></thead>
+ <tbody>
<% for issue in @issues %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <th style="width:15px;"><%= check_box_tag "issue_ids[]", issue.id, false, :id => "issue_#{issue.id}" %></th>\r
- <td align="center"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>\r
- <td align="center"><%= issue.tracker.name %></td>\r
- <td><div class="square" style="background:#<%= issue.status.html_color %>;"></div> <%= issue.status.name %></td>\r
- <td align="center"><%= issue.priority.name %></td>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <th style="width:15px;"><%= check_box_tag "issue_ids[]", issue.id, false, :id => "issue_#{issue.id}" %></th>
+ <td align="center"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
+ <td align="center"><%= issue.tracker.name %></td>
+ <td><div class="square" style="background:#<%= issue.status.html_color %>;"></div> <%= issue.status.name %></td>
+ <td align="center"><%= issue.priority.name %></td>
<td><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></td>
<td align="center"><%= issue.author.display_name %></td>
<td align="center"><%= format_time(issue.updated_on) %></td>
</tr>
- <% end %>\r
+ <% end %>
</tbody>
-</table>\r
-<div class="contextual">\r
-<%= l(:label_export_to) %>\r
-<%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'icon icon-csv' %>,\r
-<%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'icon icon-pdf' %>\r
-</div>\r
-<p><%= submit_tag l(:button_move), :class => "button-small" %>\r
- \r
-<%= pagination_links_full @issue_pages %>\r
-[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]\r
-</p>\r
-<% end %>\r
-<% end %>\r
+</table>
+<div class="contextual">
+<%= l(:label_export_to) %>
+<%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'icon icon-csv' %>,
+<%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'icon icon-pdf' %>
+</div>
+<p><%= submit_tag l(:button_move), :class => "button-small" %>
+
+<%= pagination_links_full @issue_pages %>
+[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
+</p>
+<% end %>
+<% end %>
<% end %>
\ No newline at end of file
-<h2><%=l(:label_member_plural)%></h2>\r
-\r
-<% if @members.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-\r
-<% members = @members.group_by {|m| m.role } %>\r
-<% members.keys.sort{|x,y| x.position <=> y.position}.each do |role| %>\r
-<h3><%= role.name %></h3>\r
-<ul>\r
-<% members[role].each do |m| %>\r
-<li><%= link_to m.user.display_name, :controller => 'account', :action => 'show', :id => m.user %> (<%= format_date m.created_on %>)</li>\r
-<% end %>\r
-</ul>\r
-<% end %>\r
+<h2><%=l(:label_member_plural)%></h2>
+
+<% if @members.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+
+<% members = @members.group_by {|m| m.role } %>
+<% members.keys.sort{|x,y| x.position <=> y.position}.each do |role| %>
+<h3><%= role.name %></h3>
+<ul>
+<% members[role].each do |m| %>
+<li><%= link_to m.user.display_name, :controller => 'account', :action => 'show', :id => m.user %> (<%= format_date m.created_on %>)</li>
+<% end %>
+</ul>
+<% end %>
<% if @news.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
<%= render :partial => 'news/news', :collection => @news %>
-<%= pagination_links_full @news_pages %>\r
+<%= pagination_links_full @news_pages %>
-<h2><%=l(:label_roadmap)%></h2>\r
-\r
-<div>\r
-\r
-<div class="rightbox" style="width:140px;">\r
-<% form_tag do %>\r
-<p><strong><%=l(:label_tracker_plural)%></strong></p>\r
-<% @trackers.each do |tracker| %>\r
- <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>\r
- <%= tracker.name %><br />\r
-<% end %>\r
-<p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p>\r
-<% end %>\r
-</div>\r
-\r
-<% if @versions.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-\r
-<% @versions.each do |version| %> \r
- <h3 class="icon22 icon22-package"><%= version.name %></h3>\r
- <p><%= format_date(version.effective_date) %><br />\r
- <%=h version.description %></p>\r
- <ul>\r
- <% version.fixed_issues.find(:all, :conditions => ["issues.tracker_id in (#{@selected_tracker_ids.join(',')})"]).each do |issue| %>\r
- <li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>\r
- <% end %>\r
- </ul>\r
-<% end %>\r
+<h2><%=l(:label_roadmap)%></h2>
+
+<div>
+
+<div class="rightbox" style="width:140px;">
+<% form_tag do %>
+<p><strong><%=l(:label_tracker_plural)%></strong></p>
+<% @trackers.each do |tracker| %>
+ <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>
+ <%= tracker.name %><br />
+<% end %>
+<p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p>
+<% end %>
+</div>
+
+<% if @versions.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+
+<% @versions.each do |version| %>
+ <h3 class="icon22 icon22-package"><%= version.name %></h3>
+ <p><%= format_date(version.effective_date) %><br />
+ <%=h version.description %></p>
+ <ul>
+ <% version.fixed_issues.find(:all, :conditions => ["issues.tracker_id in (#{@selected_tracker_ids.join(',')})"]).each do |issue| %>
+ <li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>
+ <% end %>
+ </ul>
+<% end %>
</div>
\ No newline at end of file
-<h2><%= l(:label_search) %></h2>\r
-\r
-<div class="box">\r
-<% form_tag({:action => 'search', :id => @project}, :method => :get) do %>\r
-<p><%= text_field_tag 'q', @question, :size => 30 %>\r
-<%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label>\r
-<%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label>\r
-<%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label>\r
-<% if @project.wiki %>\r
-<%= check_box_tag 'scope[]', 'wiki', (@scope.include? 'wiki') %> <label><%= l(:label_wiki) %></label>\r
-<% end %>\r
-<br />\r
-<%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p>\r
-<%= submit_tag l(:button_submit), :name => 'submit' %>\r
-<% end %>\r
-</div>\r
-\r
-<% if @results %>\r
- <h3><%= lwr(:label_result, @results.length) %></h3>\r
- <ul>\r
- <% @results.each do |e| %>\r
- <li><p>\r
- <% if e.is_a? Issue %>\r
- <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %>: <%= highlight_tokens(h(e.subject), @tokens) %><br />\r
- <%= highlight_tokens(e.description, @tokens) %><br />\r
- <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>\r
- <% elsif e.is_a? News %>\r
- <%=l(:label_news)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'news', :action => 'show', :id => e %><br />\r
- <%= highlight_tokens(e.description, @tokens) %><br />\r
- <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>\r
- <% elsif e.is_a? Document %>\r
- <%=l(:label_document)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'documents', :action => 'show', :id => e %><br />\r
- <%= highlight_tokens(e.description, @tokens) %><br />\r
- <i><%= format_time(e.created_on) %></i>\r
- <% elsif e.is_a? WikiPage %>\r
- <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %><br />\r
- <%= highlight_tokens(e.content.text, @tokens) %><br />\r
- <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i>\r
- <% end %>\r
- </p></li> \r
- <% end %>\r
- </ul>\r
+<h2><%= l(:label_search) %></h2>
+
+<div class="box">
+<% form_tag({:action => 'search', :id => @project}, :method => :get) do %>
+<p><%= text_field_tag 'q', @question, :size => 30 %>
+<%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label>
+<%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label>
+<%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label>
+<% if @project.wiki %>
+<%= check_box_tag 'scope[]', 'wiki', (@scope.include? 'wiki') %> <label><%= l(:label_wiki) %></label>
+<% end %>
+<br />
+<%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p>
+<%= submit_tag l(:button_submit), :name => 'submit' %>
+<% end %>
+</div>
+
+<% if @results %>
+ <h3><%= lwr(:label_result, @results.length) %></h3>
+ <ul>
+ <% @results.each do |e| %>
+ <li><p>
+ <% if e.is_a? Issue %>
+ <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %>: <%= highlight_tokens(h(e.subject), @tokens) %><br />
+ <%= highlight_tokens(e.description, @tokens) %><br />
+ <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>
+ <% elsif e.is_a? News %>
+ <%=l(:label_news)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'news', :action => 'show', :id => e %><br />
+ <%= highlight_tokens(e.description, @tokens) %><br />
+ <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>
+ <% elsif e.is_a? Document %>
+ <%=l(:label_document)%>: <%= link_to highlight_tokens(h(e.title), @tokens), :controller => 'documents', :action => 'show', :id => e %><br />
+ <%= highlight_tokens(e.description, @tokens) %><br />
+ <i><%= format_time(e.created_on) %></i>
+ <% elsif e.is_a? WikiPage %>
+ <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %><br />
+ <%= highlight_tokens(e.content.text, @tokens) %><br />
+ <i><%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %></i>
+ <% end %>
+ </p></li>
+ <% end %>
+ </ul>
<% end %>
\ No newline at end of file
</div>
<div id="tab-content-info" class="tab-content">
-<% if authorize_for('projects', 'edit') %>\r
+<% if authorize_for('projects', 'edit') %>
<% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<% end %>
</div>
-<div id="tab-content-members" class="tab-content" style="display:none;">\r
-<%= error_messages_for 'member' %>\r
-<table class="list">\r
+<div id="tab-content-members" class="tab-content" style="display:none;">
+<%= error_messages_for 'member' %>
+<table class="list">
<thead><th><%= l(:label_user) %></th><th><%= l(:label_role) %></th><th></th></thead>
<tbody>
- <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %>\r
- <% unless member.new_record? %>\r
- <tr class="<%= cycle 'odd', 'even' %>">\r
- <td><%= member.user.display_name %></td>\r
- <td align="center">\r
+ <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %>
+ <% unless member.new_record? %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td><%= member.user.display_name %></td>
+ <td align="center">
<% if authorize_for('members', 'edit') %>
- <% form_tag({:controller => 'members', :action => 'edit', :id => member}) do %>\r
- <select name="member[role_id]">\r
+ <% form_tag({:controller => 'members', :action => 'edit', :id => member}) do %>
+ <select name="member[role_id]">
<%= options_from_collection_for_select @roles, "id", "name", member.role_id %>
- </select>\r
+ </select>
<%= submit_tag l(:button_change), :class => "button-small" %>
<% end %>
<% end %>
- </td>\r
+ </td>
<td align="center">
<%= link_to_if_authorized l(:button_delete), {:controller => 'members', :action => 'destroy', :id => member}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
- </td>\r
- </tr> \r
+ </td>
+ </tr>
<% end %>
- </tbody>\r
-<% end; reset_cycle %>\r
+ </tbody>
+<% end; reset_cycle %>
</table>
-<% if authorize_for('projects', 'add_member') %>\r
- <label><%=l(:label_member_new)%></label><br/>\r
- <% form_tag({:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}) do %>\r
- <select name="member[user_id]">\r
+<% if authorize_for('projects', 'add_member') %>
+ <label><%=l(:label_member_new)%></label><br/>
+ <% form_tag({:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}) do %>
+ <select name="member[user_id]">
<%= options_from_collection_for_select @users, "id", "display_name", @member.user_id %>
- </select>\r
- <select name="member[role_id]">\r
+ </select>
+ <select name="member[role_id]">
<%= options_from_collection_for_select @roles, "id", "name", @member.role_id %>
- </select>\r
- <%= submit_tag l(:button_add) %>\r
+ </select>
+ <%= submit_tag l(:button_add) %>
<% end %>
-<% end %>\r
+<% end %>
</div>
<div id="tab-content-versions" class="tab-content" style="display:none;">
<table class="list">
<thead><th><%= l(:label_version) %></th><th><%= l(:field_effective_date) %></th><th><%= l(:field_description) %></th><th></th><th></th></thead>
- <tbody>\r
-<% for version in @project.versions %>\r
- <tr class="<%= cycle 'odd', 'even' %>">\r
- <td><%=h version.name %></td>\r
- <td align="center"><%= format_date(version.effective_date) %></td>\r
+ <tbody>
+<% for version in @project.versions %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td><%=h version.name %></td>
+ <td align="center"><%= format_date(version.effective_date) %></td>
<td><%=h version.description %></td>
<td align="center"><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></td>
<td align="center"><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></td>
- </td>\r
- </tr>\r
+ </td>
+ </tr>
<% end; reset_cycle %>
- </tbody>\r
-</table>\r
-<%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %>\r
-</div>\r
+ </tbody>
+</table>
+<%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %>
+</div>
<div id="tab-content-categories" class="tab-content" style="display:none;">
<table class="list">
<thead><th><%= l(:label_issue_category) %></th><th></th></thead>
- <tbody>\r
-<% for @category in @project.issue_categories %>\r
- <% unless @category.new_record? %>\r
- <tr class="<%= cycle 'odd', 'even' %>">\r
- <td>\r
- <% form_tag({:controller => 'issue_categories', :action => 'edit', :id => @category}) do %>\r
- <%= text_field 'category', 'name', :size => 25 %>\r
- <% if authorize_for('issue_categories', 'edit') %>\r
- <%= submit_tag l(:button_save), :class => "button-small" %>\r
+ <tbody>
+<% for @category in @project.issue_categories %>
+ <% unless @category.new_record? %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td>
+ <% form_tag({:controller => 'issue_categories', :action => 'edit', :id => @category}) do %>
+ <%= text_field 'category', 'name', :size => 25 %>
+ <% if authorize_for('issue_categories', 'edit') %>
+ <%= submit_tag l(:button_save), :class => "button-small" %>
+ <% end %>
<% end %>
- <% end %>\r
- </td>\r
+ </td>
<td align="center">
<%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => @category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
- </td>\r
- </tr>\r
- <% end %>\r
-<% end %>\r
+ </td>
+ </tr>
+ <% end %>
+<% end %>
</tbody>
</table>
-<% if authorize_for('projects', 'add_issue_category') %>\r
+<% if authorize_for('projects', 'add_issue_category') %>
<% form_tag({:action => 'add_issue_category', :tab => 'categories', :id => @project}) do %>
<label for="issue_category_name"><%=l(:label_issue_category_new)%></label><br/>
- <%= error_messages_for 'issue_category' %>\r
+ <%= error_messages_for 'issue_category' %>
<%= text_field 'issue_category', 'name', :size => 25 %>
- <%= submit_tag l(:button_create) %>\r
- <% end %>\r
-<% end %>\r
-</div>\r
+ <%= submit_tag l(:button_create) %>
+ <% end %>
+<% end %>
+</div>
<%= tab = params[:tab] ? h(params[:tab]) : 'info'
javascript_tag "showTab('#{tab}');" %>
\ No newline at end of file
-<h2><%=l(:label_overview)%></h2> \r
- \r
-<div class="splitcontentleft">\r
- <%= simple_format(auto_link(h(@project.description))) %> \r
- <ul>\r
- <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>\r
- <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>\r
- <% for custom_value in @custom_values %>\r
- <% if !custom_value.value.empty? %>\r
- <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>\r
- <% end %>\r
- <% end %>\r
- </ul> \r
-\r
- <div class="box">\r
- <div class="contextual">\r
- <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>\r
- </div>\r
- <h3 class="icon22 icon22-tracker"><%=l(:label_tracker_plural)%></h3>\r
- <ul>\r
- <% for tracker in @trackers %> \r
- <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "tracker_id" => tracker.id %>:\r
- <%= @open_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_open_issues, @open_issues_by_tracker[tracker] || 0) %>\r
- <%= l(:label_on) %> <%= @total_issues_by_tracker[tracker] || 0 %></li>\r
- <% end %>\r
- </ul>\r
- <p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p>\r
+<h2><%=l(:label_overview)%></h2>
+
+<div class="splitcontentleft">
+ <%= simple_format(auto_link(h(@project.description))) %>
+ <ul>
+ <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
+ <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
+ <% 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 %>
+ </ul>
+
+ <div class="box">
+ <div class="contextual">
+ <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
+ </div>
+ <h3 class="icon22 icon22-tracker"><%=l(:label_tracker_plural)%></h3>
+ <ul>
+ <% for tracker in @trackers %>
+ <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "tracker_id" => tracker.id %>:
+ <%= @open_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_open_issues, @open_issues_by_tracker[tracker] || 0) %>
+ <%= l(:label_on) %> <%= @total_issues_by_tracker[tracker] || 0 %></li>
+ <% end %>
+ </ul>
+ <p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p>
</div>
-</div>\r
-\r
-<div class="splitcontentright">\r
- <div class="box">\r
- <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3> \r
- <% for member in @members %>\r
- <%= link_to_user member.user %> (<%= member.role.name %>)<br /> \r
- <% end %> \r
- </div>\r
- \r
- <% if @subprojects %>\r
- <div class="box">\r
- <h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3> \r
- <% for subproject in @subprojects %>\r
- <%= link_to subproject.name, :action => 'show', :id => subproject %><br /> \r
- <% end %> \r
- </div>\r
- <% end %>\r
- \r
- <div class="box">\r
- <h3><%=l(:label_news_latest)%></h3> \r
+</div>
+
+<div class="splitcontentright">
+ <div class="box">
+ <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3>
+ <% for member in @members %>
+ <%= link_to_user member.user %> (<%= member.role.name %>)<br />
+ <% end %>
+ </div>
+
+ <% if @subprojects %>
+ <div class="box">
+ <h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3>
+ <% for subproject in @subprojects %>
+ <%= link_to subproject.name, :action => 'show', :id => subproject %><br />
+ <% end %>
+ </div>
+ <% end %>
+
+ <div class="box">
+ <h3><%=l(:label_news_latest)%></h3>
<%= render :partial => 'news/news', :collection => @news %>
- <p class="textcenter"><small><%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %></small></p>\r
- </div> \r
+ <p class="textcenter"><small><%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %></small></p>
+ </div>
</div>
\ No newline at end of file
-<script type="text/javascript">\r
-//<![CDATA[\r
-function add_filter() {\r
- select = $('add_filter_select');\r
- field = select.value\r
- Element.show('tr_' + field);\r
- check_box = $('cb_' + field);\r
- check_box.checked = true;\r
- toggle_filter(field);\r
- select.selectedIndex = 0;\r
- \r
- for (i=0; i<select.options.length; i++) {\r
- if (select.options[i].value == field) {\r
- select.options[i].disabled = true;\r
- } \r
- }\r
-}\r
-\r
-function toggle_filter(field) {\r
- check_box = $('cb_' + field);\r
- \r
- if (check_box.checked) {\r
- Element.show("operators_" + field);\r
- toggle_operator(field);\r
- } else {\r
- Element.hide("operators_" + field);\r
- Element.hide("div_values_" + field);\r
- }\r
-}\r
-\r
-function toggle_operator(field) {\r
- operator = $("operators_" + field);\r
- switch (operator.value) {\r
- case "!*":\r
- case "*":\r
- case "t":\r
- case "o":\r
- case "c":\r
- Element.hide("div_values_" + field);\r
- break;\r
- default:\r
- Element.show("div_values_" + field);\r
- break;\r
- }\r
-}\r
-\r
-function toggle_multi_select(field) {\r
- select = $('values_' + field);\r
- if (select.multiple == true) {\r
- select.multiple = false;\r
- } else {\r
- select.multiple = true;\r
- }\r
-}\r
-//]]>\r
-</script>\r
-\r
-<fieldset style="margin:0;"><legend><%= l(:label_filter_plural) %></legend>\r
-<table width="100%">\r
-<tr>\r
-<td>\r
-<table style="padding:0;">\r
-<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>\r
- <% field = filter[0]\r
- options = filter[1] %>\r
- <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>">\r
- <td valign="top" style="width:200px;">\r
- <%= check_box_tag 'fields[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>\r
- <label for="cb_<%= field %>"><%= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>\r
- </td>\r
- <td valign="top" style="width:150px;">\r
- <%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>\r
- </td>\r
- <td valign="top"> \r
- <div id="div_values_<%= field %>">\r
- <% case options[:type]\r
- when :list, :list_optional, :list_status %>\r
- <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;">\r
- <%= options_for_select options[:values], query.values_for(field) %> \r
- </select>\r
- <%= link_to_function image_tag('expand.png'), "toggle_multi_select('#{field}');" %>\r
- <% when :date, :date_past %>\r
- <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>\r
- <% when :text %>\r
- <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30, :class => "select-small" %>\r
- <% end %>\r
- </div>\r
- <script type="text/javascript">toggle_filter('<%= field %>');</script>\r
- </td>\r
- </tr>\r
-<% end %>\r
-</table>\r
-</td>\r
-<td align="right" valign="top">\r
-<%= l(:label_filter_add) %>:\r
-<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [l(("field_"+field[0].to_s.gsub(/\_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), :onchange => "add_filter();", :class => "select-small" %>\r
-</td>\r
-</tr>\r
-</table>\r
+<script type="text/javascript">
+//<![CDATA[
+function add_filter() {
+ select = $('add_filter_select');
+ field = select.value
+ Element.show('tr_' + field);
+ check_box = $('cb_' + field);
+ check_box.checked = true;
+ toggle_filter(field);
+ select.selectedIndex = 0;
+
+ for (i=0; i<select.options.length; i++) {
+ if (select.options[i].value == field) {
+ select.options[i].disabled = true;
+ }
+ }
+}
+
+function toggle_filter(field) {
+ check_box = $('cb_' + field);
+
+ if (check_box.checked) {
+ Element.show("operators_" + field);
+ toggle_operator(field);
+ } else {
+ Element.hide("operators_" + field);
+ Element.hide("div_values_" + field);
+ }
+}
+
+function toggle_operator(field) {
+ operator = $("operators_" + field);
+ switch (operator.value) {
+ case "!*":
+ case "*":
+ case "t":
+ case "o":
+ case "c":
+ Element.hide("div_values_" + field);
+ break;
+ default:
+ Element.show("div_values_" + field);
+ break;
+ }
+}
+
+function toggle_multi_select(field) {
+ select = $('values_' + field);
+ if (select.multiple == true) {
+ select.multiple = false;
+ } else {
+ select.multiple = true;
+ }
+}
+//]]>
+</script>
+
+<fieldset style="margin:0;"><legend><%= l(:label_filter_plural) %></legend>
+<table width="100%">
+<tr>
+<td>
+<table style="padding:0;">
+<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
+ <% field = filter[0]
+ options = filter[1] %>
+ <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>">
+ <td valign="top" style="width:200px;">
+ <%= check_box_tag 'fields[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
+ <label for="cb_<%= field %>"><%= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
+ </td>
+ <td valign="top" style="width:150px;">
+ <%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>
+ </td>
+ <td valign="top">
+ <div id="div_values_<%= field %>">
+ <% case options[:type]
+ when :list, :list_optional, :list_status %>
+ <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;">
+ <%= options_for_select options[:values], query.values_for(field) %>
+ </select>
+ <%= link_to_function image_tag('expand.png'), "toggle_multi_select('#{field}');" %>
+ <% when :date, :date_past %>
+ <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>
+ <% when :text %>
+ <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30, :class => "select-small" %>
+ <% end %>
+ </div>
+ <script type="text/javascript">toggle_filter('<%= field %>');</script>
+ </td>
+ </tr>
+<% end %>
+</table>
+</td>
+<td align="right" valign="top">
+<%= l(:label_filter_add) %>:
+<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [l(("field_"+field[0].to_s.gsub(/\_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), :onchange => "add_filter();", :class => "select-small" %>
+</td>
+</tr>
+</table>
</fieldset>
\ No newline at end of file
-<% if @statuses.empty? or rows.empty? %>\r
- <p><i><%=l(:label_no_data)%></i></p>\r
-<% else %>\r
-<% col_width = 70 / (@statuses.length+3) %>\r
-<table class="list">\r
-<thead><tr>\r
-<th style="width:25%"></th>\r
-<% for status in @statuses %>\r
-<th style="text-align:left;width:<%= col_width %>%"><div class="square" style="background:#<%= status.html_color %>;"></div> <small><%= status.name %></small></th>\r
-<% end %>\r
-<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_open_issues_plural)%></strong></th>\r
-<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_closed_issues_plural)%></strong></th>\r
-<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_total)%></strong></th>\r
-</tr></thead>\r
-<tbody>\r
-<% for row in rows %>\r
-<tr class="<%= cycle("odd", "even") %>">\r
- <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id %></td>\r
- <% for status in @statuses %>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }), \r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "status_id" => status.id, \r
- "#{field_name}" => row.id %></td>\r
- <% end %>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "o" %></td>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "c" %></td>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "*" %></td> \r
-</tr>\r
-<% end %>\r
-</tbody>\r
-</table>\r
-<% end\r
+<% if @statuses.empty? or rows.empty? %>
+ <p><i><%=l(:label_no_data)%></i></p>
+<% else %>
+<% col_width = 70 / (@statuses.length+3) %>
+<table class="list">
+<thead><tr>
+<th style="width:25%"></th>
+<% for status in @statuses %>
+<th style="text-align:left;width:<%= col_width %>%"><div class="square" style="background:#<%= status.html_color %>;"></div> <small><%= status.name %></small></th>
+<% end %>
+<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_open_issues_plural)%></strong></th>
+<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_closed_issues_plural)%></strong></th>
+<th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_total)%></strong></th>
+</tr></thead>
+<tbody>
+<% for row in rows %>
+<tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id %></td>
+ <% for status in @statuses %>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "status_id" => status.id,
+ "#{field_name}" => row.id %></td>
+ <% end %>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "o" %></td>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "c" %></td>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "*" %></td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<% end
reset_cycle %>
\ No newline at end of file
-<% if @statuses.empty? or rows.empty? %>\r
- <p><i><%=l(:label_no_data)%></i></p>\r
-<% else %>\r
-<table class="list">\r
-<thead><tr>\r
-<th style="width:25%"></th>\r
-<th align="center" style="width:25%"><%=l(:label_open_issues_plural)%></th>\r
-<th align="center" style="width:25%"><%=l(:label_closed_issues_plural)%></th>\r
-<th align="center" style="width:25%"><%=l(:label_total)%></th>\r
-</tr></thead>\r
-<tbody>\r
-<% for row in rows %>\r
-<tr class="<%= cycle("odd", "even") %>">\r
- <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id %></td>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "o" %></td>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "c" %></td>\r
- <td align="center"><%= link_to (aggregate data, { field_name => row.id }),\r
- :controller => 'projects', :action => 'list_issues', :id => @project, \r
- :set_filter => 1, \r
- "#{field_name}" => row.id,\r
- "status_id" => "*" %></td> \r
-</tr>\r
-<% end %>\r
-</tbody>\r
-</table>\r
-<% end\r
+<% if @statuses.empty? or rows.empty? %>
+ <p><i><%=l(:label_no_data)%></i></p>
+<% else %>
+<table class="list">
+<thead><tr>
+<th style="width:25%"></th>
+<th align="center" style="width:25%"><%=l(:label_open_issues_plural)%></th>
+<th align="center" style="width:25%"><%=l(:label_closed_issues_plural)%></th>
+<th align="center" style="width:25%"><%=l(:label_total)%></th>
+</tr></thead>
+<tbody>
+<% for row in rows %>
+<tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id %></td>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "o" %></td>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "c" %></td>
+ <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
+ :controller => 'projects', :action => 'list_issues', :id => @project,
+ :set_filter => 1,
+ "#{field_name}" => row.id,
+ "status_id" => "*" %></td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<% end
reset_cycle %>
\ No newline at end of file
-<h2><%=l(:label_report_plural)%></h2>\r
-\r
-<div class="contextual">\r
-<%= link_to_if_authorized l(:label_query_new), {:controller => 'projects', :action => 'add_query', :id => @project}, :class => 'icon icon-add' %>\r
-</div>\r
-<h3><%= l(:label_query_plural) %></h3>\r
-\r
-<% if @queries.empty? %><p><i><%=l(:label_no_data)%></i></p><% end %>\r
-<ul>\r
-<% @queries.each do |query| %>\r
- <li><%= link_to query.name, :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => query %></li>\r
-<% end %>\r
-</ul>\r
-\r
-<div class="splitcontentleft">\r
-<h3><%=l(:field_tracker)%> <%= link_to image_tag('zoom_in.png'), :detail => 'tracker' %></h3>\r
-<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>\r
-<br />\r
-<h3><%=l(:field_author)%> <%= link_to image_tag('zoom_in.png'), :detail => 'author' %></h3>\r
-<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>\r
-<br />\r
-</div>\r
-\r
-<div class="splitcontentright">\r
-<h3><%=l(:field_priority)%> <%= link_to image_tag('zoom_in.png'), :detail => 'priority' %></h3>\r
-<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>\r
-<br />\r
-<h3><%=l(:field_category)%> <%= link_to image_tag('zoom_in.png'), :detail => 'category' %></h3>\r
-<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>\r
-<br />\r
-</div>\r
-\r
+<h2><%=l(:label_report_plural)%></h2>
+
+<div class="contextual">
+<%= link_to_if_authorized l(:label_query_new), {:controller => 'projects', :action => 'add_query', :id => @project}, :class => 'icon icon-add' %>
+</div>
+<h3><%= l(:label_query_plural) %></h3>
+
+<% if @queries.empty? %><p><i><%=l(:label_no_data)%></i></p><% end %>
+<ul>
+<% @queries.each do |query| %>
+ <li><%= link_to query.name, :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => query %></li>
+<% end %>
+</ul>
+
+<div class="splitcontentleft">
+<h3><%=l(:field_tracker)%> <%= link_to image_tag('zoom_in.png'), :detail => 'tracker' %></h3>
+<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
+<br />
+<h3><%=l(:field_author)%> <%= link_to image_tag('zoom_in.png'), :detail => 'author' %></h3>
+<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
+<br />
+</div>
+
+<div class="splitcontentright">
+<h3><%=l(:field_priority)%> <%= link_to image_tag('zoom_in.png'), :detail => 'priority' %></h3>
+<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
+<br />
+<h3><%=l(:field_category)%> <%= link_to image_tag('zoom_in.png'), :detail => 'category' %></h3>
+<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
+<br />
+</div>
+
-<h2><%=l(:label_report_plural)%></h2>\r
-\r
-<h3><%=@report_title%></h3>\r
-<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>\r
-<br />\r
-<%= link_to l(:button_back), :action => 'issue_report' %>\r
-\r
+<h2><%=l(:label_report_plural)%></h2>
+
+<h3><%=@report_title%></h3>
+<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
+<br />
+<%= link_to l(:button_back), :action => 'issue_report' %>
+
-<table class="list">\r
-<thead><tr>\r
-<th><%= l(:field_name) %></th>\r
-<th><%= l(:field_filesize) %></th>\r
-<th><%= l(:label_revision) %></th>\r
-<th><%= l(:field_author) %></th>\r
-<th><%= l(:label_date) %></th>\r
-</tr></thead>\r
-<tbody>\r
-<% total_size = 0\r
-@entries.each do |entry| %>\r
-<tr class="<%= cycle 'odd', 'even' %>">\r
-<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'revisions'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td>\r
-<td align="right"><%= number_to_human_size(entry.size) unless entry.is_dir? %></td>\r
-<td align="right"><%= link_to entry.lastrev.identifier, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier %></td>\r
-<td align="center"><em><%=h entry.lastrev.author %></em></td>\r
-<td align="center"><%= format_time(entry.lastrev.time) %></td>\r
-</tr>\r
-<% total_size += entry.size\r
-end %>\r
-</tbody>\r
-</table>\r
+<table class="list">
+<thead><tr>
+<th><%= l(:field_name) %></th>
+<th><%= l(:field_filesize) %></th>
+<th><%= l(:label_revision) %></th>
+<th><%= l(:field_author) %></th>
+<th><%= l(:label_date) %></th>
+</tr></thead>
+<tbody>
+<% total_size = 0
+@entries.each do |entry| %>
+<tr class="<%= cycle 'odd', 'even' %>">
+<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'revisions'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td>
+<td align="right"><%= number_to_human_size(entry.size) unless entry.is_dir? %></td>
+<td align="right"><%= link_to entry.lastrev.identifier, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier %></td>
+<td align="center"><em><%=h entry.lastrev.author %></em></td>
+<td align="center"><%= format_time(entry.lastrev.time) %></td>
+</tr>
+<% total_size += entry.size
+end %>
+</tbody>
+</table>
<p class="textright"><em><%= l(:label_total) %>: <%= number_to_human_size(total_size) %></em></p>
\ No newline at end of file
-<%= link_to 'root', :action => 'browse', :id => @project, :path => '', :rev => @rev %>\r
-<% \r
-dirs = path.split('/')\r
-if 'file' == kind\r
- filename = dirs.pop\r
-end\r
-link_path = ''\r
-dirs.each do |dir| \r
- link_path << '/' unless link_path.empty?\r
- link_path << "#{dir}" \r
- %>\r
- / <%= link_to h(dir), :action => 'browse', :id => @project, :path => link_path, :rev => @rev %>\r
-<% end %>\r
-<% if filename %>\r
- / <%= link_to h(filename), :action => 'revisions', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %>\r
-<% end %>\r
-\r
+<%= link_to 'root', :action => 'browse', :id => @project, :path => '', :rev => @rev %>
+<%
+dirs = path.split('/')
+if 'file' == kind
+ filename = dirs.pop
+end
+link_path = ''
+dirs.each do |dir|
+ link_path << '/' unless link_path.empty?
+ link_path << "#{dir}"
+ %>
+ / <%= link_to h(dir), :action => 'browse', :id => @project, :path => link_path, :rev => @rev %>
+<% end %>
+<% if filename %>
+ / <%= link_to h(filename), :action => 'revisions', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %>
+<% end %>
+
<%= "@ #{revision}" if revision %>
\ No newline at end of file
-<div class="contextual">\r
-<% form_tag do %>\r
-<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>\r
-<%= submit_tag 'OK' %></p>\r
-<% end %>\r
-</div>\r
-\r
-<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>\r
-\r
-<%= render :partial => 'dir_list' %>\r
-\r
-<% content_for :header_tags do %>\r
-<%= stylesheet_link_tag "scm" %>\r
+<div class="contextual">
+<% form_tag do %>
+<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %></p>
+<% end %>
+</div>
+
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
+
+<%= render :partial => 'dir_list' %>
+
+<% content_for :header_tags do %>
+<%= stylesheet_link_tag "scm" %>
<% end %>
\ No newline at end of file
-<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>\r
-\r
-<% parsing = false\r
-line_num_l = 0\r
-line_num_r = 0 %>\r
-<% @diff.each do |line| %>\r
-<% \r
- if line =~ /^Index: (.*)$/\r
- if parsing %>\r
- </tbody></table>\r
- <%\r
- end\r
- parsing = false %>\r
- <table class="list"><thead>\r
- <tr><th colspan="3" class="list-filename"><%= l(:label_attachment) %>: <%= $1 %></th></tr>\r
- <tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr>\r
- </thead><tbody>\r
- <%\r
- next\r
- elsif line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/\r
- line_num_l = $2.to_i\r
- line_num_r = $5.to_i\r
- parsing = true\r
- next\r
- elsif line =~ /^_+$/\r
- # We have reached the 'Properties' section.\r
- parsing = false\r
- next\r
- end\r
- next unless parsing\r
-%>\r
-\r
-<tr>\r
-\r
-<% case line[0, 1] \r
- when " " %>\r
-<th class="line-num"><%= line_num_l %></th>\r
-<th class="line-num"><%= line_num_r %></th>\r
-<td class="line-code">\r
-<% line_num_l = line_num_l + 1\r
- line_num_r = line_num_r + 1\r
- \r
- when "-" %>\r
-<th class="line-num"></th>\r
-<th class="line-num"><%= line_num_r %></th>\r
-<td class="line-code" style="background: #fdd;">\r
-<% line_num_r = line_num_r + 1\r
-\r
- when "+" %>\r
-<th class="line-num"><%= line_num_l %></th>\r
-<th class="line-num"></th>\r
-<td class="line-code" style="background: #dfd;">\r
-<% line_num_l = line_num_l + 1\r
-\r
- else\r
- next\r
- end %>\r
- \r
-<%= h(line[1..-1]).gsub(/\s/, " ") %></td></tr>\r
-\r
-<% end %>\r
-</tbody>\r
-</table>\r
-\r
-<% content_for :header_tags do %>\r
-<%= stylesheet_link_tag "scm" %>\r
-<% end %>\r
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
+
+<% parsing = false
+line_num_l = 0
+line_num_r = 0 %>
+<% @diff.each do |line| %>
+<%
+ if line =~ /^Index: (.*)$/
+ if parsing %>
+ </tbody></table>
+ <%
+ end
+ parsing = false %>
+ <table class="list"><thead>
+ <tr><th colspan="3" class="list-filename"><%= l(:label_attachment) %>: <%= $1 %></th></tr>
+ <tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr>
+ </thead><tbody>
+ <%
+ next
+ elsif line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
+ line_num_l = $2.to_i
+ line_num_r = $5.to_i
+ parsing = true
+ next
+ elsif line =~ /^_+$/
+ # We have reached the 'Properties' section.
+ parsing = false
+ next
+ end
+ next unless parsing
+%>
+
+<tr>
+
+<% case line[0, 1]
+ when " " %>
+<th class="line-num"><%= line_num_l %></th>
+<th class="line-num"><%= line_num_r %></th>
+<td class="line-code">
+<% line_num_l = line_num_l + 1
+ line_num_r = line_num_r + 1
+
+ when "-" %>
+<th class="line-num"></th>
+<th class="line-num"><%= line_num_r %></th>
+<td class="line-code" style="background: #fdd;">
+<% line_num_r = line_num_r + 1
+
+ when "+" %>
+<th class="line-num"><%= line_num_l %></th>
+<th class="line-num"></th>
+<td class="line-code" style="background: #dfd;">
+<% line_num_l = line_num_l + 1
+
+ else
+ next
+ end %>
+
+<%= h(line[1..-1]).gsub(/\s/, " ") %></td></tr>
+
+<% end %>
+</tbody>
+</table>
+
+<% content_for :header_tags do %>
+<%= stylesheet_link_tag "scm" %>
+<% end %>
-<div class="contextual">\r
-<% form_tag do %>\r
-<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>\r
-<%= submit_tag 'OK' %></p>\r
-<% end %>\r
-</div>\r
-\r
-<h2><%= l(:label_revision) %> <%= @revision.identifier %></h2>\r
-\r
-<p><em><%= @revision.author %>, <%= format_time(@revision.time) %></em></p>\r
-<%= textilizable @revision.message %>\r
-\r
-<div style="float:right;">\r
-<div class="square action_A"></div> <div style="float:left;"><%= l(:label_added) %> </div>\r
-<div class="square action_M"></div> <div style="float:left;"><%= l(:label_modified) %> </div>\r
-<div class="square action_D"></div> <div style="float:left;"><%= l(:label_deleted) %> </div>\r
-</div>\r
-\r
-<h3><%= l(:label_attachment_plural) %></h3>\r
-<table class="list">\r
-<tbody>\r
-<% @revision.paths.each do |path| %>\r
-<tr class="<%= cycle 'odd', 'even' %>">\r
-<td><div class="square action_<%= path[:action] %>"></div> <%= path[:path] %></td>\r
-<td>\r
-<% if path[:action] == "M" %>\r
-<%= link_to 'View diff', :action => 'diff', :id => @project, :path => path[:path].gsub(/^\//, ''), :rev => @revision.identifier %>\r
-<% end %>\r
-</td>\r
-</tr>\r
-<% end %>\r
-</tbody>\r
-</table>\r
-<p><%= lwr(:label_modification, @revision.paths.length) %></p>\r
-\r
-<% content_for :header_tags do %>\r
-<%= stylesheet_link_tag "scm" %>\r
+<div class="contextual">
+<% form_tag do %>
+<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %></p>
+<% end %>
+</div>
+
+<h2><%= l(:label_revision) %> <%= @revision.identifier %></h2>
+
+<p><em><%= @revision.author %>, <%= format_time(@revision.time) %></em></p>
+<%= textilizable @revision.message %>
+
+<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>
+
+<h3><%= l(:label_attachment_plural) %></h3>
+<table class="list">
+<tbody>
+<% @revision.paths.each do |path| %>
+<tr class="<%= cycle 'odd', 'even' %>">
+<td><div class="square action_<%= path[:action] %>"></div> <%= path[:path] %></td>
+<td>
+<% if path[:action] == "M" %>
+<%= link_to 'View diff', :action => 'diff', :id => @project, :path => path[:path].gsub(/^\//, ''), :rev => @revision.identifier %>
+<% end %>
+</td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<p><%= lwr(:label_modification, @revision.paths.length) %></p>
+
+<% content_for :header_tags do %>
+<%= stylesheet_link_tag "scm" %>
<% end %>
\ No newline at end of file
-<div class="contextual">\r
-<% form_tag do %>\r
-<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>\r
-<%= submit_tag 'OK' %></p>\r
-<% end %>\r
-</div>\r
-\r
-<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => @entry.kind, :revision => @rev } %></h2>\r
-\r
-<% if @entry.is_file? %>\r
-<h3><%=h @entry.name %></h3>\r
-<p><%= link_to 'Download', {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }, :class => "icon file" %> (<%= number_to_human_size @entry.size %>)</p>\r
-<% end %>\r
-\r
-<h3>Revisions</h3>\r
-\r
-<table class="list">\r
-<thead><tr>\r
-<th>#</th>\r
-<th><%= l(:field_author) %></th>\r
-<th><%= l(:label_date) %></th>\r
-<th><%= l(:field_description) %></th>\r
-<th></th>\r
-</tr></thead>\r
-<tbody>\r
-<% @revisions.each do |revision| %>\r
-<tr class="<%= cycle 'odd', 'even' %>">\r
-<th align="center"><%= link_to revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier %></th>\r
-<td align="center"><em><%=h revision.author %></em></td>\r
-<td align="center"><%= format_time(revision.time) %></td>\r
-<td style="width:70%"><%= textilizable(revision.message) %></td>\r
-<td align="center"><%= link_to 'Diff', :action => 'diff', :id => @project, :path => @path, :rev => revision.identifier if @entry.is_file? && revision != @revisions.last %></td>\r
-</tr>\r
-<% end %>\r
-</tbody>\r
-</table>\r
-<p><%= lwr(:label_modification, @revisions.length) %></p>\r
-\r
-<% content_for :header_tags do %>\r
-<%= stylesheet_link_tag "scm" %>\r
+<div class="contextual">
+<% form_tag do %>
+<p><%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %></p>
+<% end %>
+</div>
+
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => @entry.kind, :revision => @rev } %></h2>
+
+<% if @entry.is_file? %>
+<h3><%=h @entry.name %></h3>
+<p><%= link_to 'Download', {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }, :class => "icon file" %> (<%= number_to_human_size @entry.size %>)</p>
+<% end %>
+
+<h3>Revisions</h3>
+
+<table class="list">
+<thead><tr>
+<th>#</th>
+<th><%= l(:field_author) %></th>
+<th><%= l(:label_date) %></th>
+<th><%= l(:field_description) %></th>
+<th></th>
+</tr></thead>
+<tbody>
+<% @revisions.each do |revision| %>
+<tr class="<%= cycle 'odd', 'even' %>">
+<th align="center"><%= link_to revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier %></th>
+<td align="center"><em><%=h revision.author %></em></td>
+<td align="center"><%= format_time(revision.time) %></td>
+<td style="width:70%"><%= textilizable(revision.message) %></td>
+<td align="center"><%= link_to 'Diff', :action => 'diff', :id => @project, :path => @path, :rev => revision.identifier if @entry.is_file? && revision != @revisions.last %></td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<p><%= lwr(:label_modification, @revisions.length) %></p>
+
+<% content_for :header_tags do %>
+<%= stylesheet_link_tag "scm" %>
<% end %>
\ No newline at end of file
<%= error_messages_for 'role' %>
<div class="box">
-<!--[form:role]-->\r
-<p><%= f.text_field :name, :required => true %></p>\r
-\r
-<h3><%=l(:label_permissions)%></h3>\r
-<% permissions = @permissions.group_by {|p| p.group_id } %>\r
+<!--[form:role]-->
+<p><%= f.text_field :name, :required => true %></p>
+
+<h3><%=l(:label_permissions)%></h3>
+<% permissions = @permissions.group_by {|p| p.group_id } %>
<% permissions.keys.sort.each do |group_id| %>
-<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>\r
-<% permissions[group_id].each do |p| %>\r
- <div style="width:170px;float:left;"><%= check_box_tag "permission_ids[]", p.id, (@role.permissions.include? p) %>\r
- <%= l(p.description.to_sym) %>\r
- </div>\r
+<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>
+<% permissions[group_id].each do |p| %>
+ <div style="width:170px;float:left;"><%= check_box_tag "permission_ids[]", p.id, (@role.permissions.include? p) %>
+ <%= l(p.description.to_sym) %>
+ </div>
+<% end %>
+<div class="clear"></div>
+</fieldset>
<% end %>
-<div class="clear"></div>\r
-</fieldset>\r
-<% end %>\r
<br />
-<%= check_all_links 'role_form' %>\r
+<%= check_all_links 'role_form' %>
<!--[eoform:role]-->
</div>
<% labelled_tabular_form_for :role, @role, :url => { :action => 'edit' }, :html => {:id => 'role_form'} do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
-<% end %>\r
+<% end %>
<%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => role, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
</td>
<td align="center">
- <%= button_to l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small" %>\r
+ <%= button_to l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
</tr>
<% end %>
</tbody>
</table>
-\r
+
<%= pagination_links_full @role_pages %>
\ No newline at end of file
<h2><%=l(:label_role_new)%></h2>
-\r
+
<% labelled_tabular_form_for :role, @role, :url => { :action => 'new' }, :html => {:id => 'role_form'} do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>
-<h2><%=l(:label_workflow)%></h2>\r
-\r
-<p><%=l(:text_workflow_edit)%>:</p>\r
-\r
-<% form_tag ({:action => 'workflow'}, :method => 'get') do %>\r
-<div style="float:left;margin-right:10px;">\r
-<p><label for="role_id"><%=l(:label_role)%></label><br/>\r
-<select id="role_id" name="role_id">\r
- <%= options_from_collection_for_select @roles, "id", "name", (@role.id unless @role.nil?) %>\r
-</select></p>\r
-</div>\r
-\r
-<div>\r
-<p><label for="tracker_id"><%=l(:label_tracker)%></label><br/>\r
-<select id="tracker_id" name="tracker_id">\r
- <%= options_from_collection_for_select @trackers, "id", "name", (@tracker.id unless @tracker.nil?) %>\r
-</select>\r
-\r
-<%= submit_tag l(:button_edit) %>\r
-</p>\r
-</div>\r
-<% end %>\r
- \r
- \r
-\r
-<% unless @tracker.nil? or @role.nil? %>\r
-<div class="box">\r
- <% form_tag ({:action => 'workflow', :role_id => @role, :tracker_id => @tracker }, :id => 'workflow_form' ) do %>\r
- <table>\r
- <tr>\r
- <td align="center"><strong><%=l(:label_current_status)%></strong></td>\r
- <td align="center" colspan="<%= @statuses.length %>"><strong><%=l(:label_new_statuses_allowed)%></strong></td>\r
- </tr>\r
- <tr>\r
- <td></td>\r
- <% for new_status in @statuses %>\r
- <td width="80" align="center"><%= new_status.name %></td>\r
- <% end %>\r
- </tr>\r
- \r
- <% for old_status in @statuses %>\r
- <tr>\r
- <td><div class="square" style="background:#<%= old_status.html_color %>;"></div> <%= old_status.name %></td> \r
- <% for new_status in @statuses %>\r
- <td align="center">\r
- \r
- <input type="checkbox"\r
- name="issue_status[<%= old_status.id %>][]"\r
- value="<%= new_status.id %>"\r
- <%if old_status.new_statuses_allowed_to(@role, @tracker).include? new_status%>checked="checked"<%end%>\r
- <%if old_status==new_status%>disabled<%end%>\r
- > \r
- </td>\r
- <% end %> \r
- \r
- </tr>\r
- <% end %>\r
- </table>\r
-<br />\r
-<p>\r
-<a href="javascript:checkAll('workflow_form', true)"><%=l(:button_check_all)%></a> |\r
-<a href="javascript:checkAll('workflow_form', false)"><%=l(:button_uncheck_all)%></a>\r
-</p>\r
-<br />\r
+<h2><%=l(:label_workflow)%></h2>
+
+<p><%=l(:text_workflow_edit)%>:</p>
+
+<% form_tag ({:action => 'workflow'}, :method => 'get') do %>
+<div style="float:left;margin-right:10px;">
+<p><label for="role_id"><%=l(:label_role)%></label><br/>
+<select id="role_id" name="role_id">
+ <%= options_from_collection_for_select @roles, "id", "name", (@role.id unless @role.nil?) %>
+</select></p>
+</div>
+
+<div>
+<p><label for="tracker_id"><%=l(:label_tracker)%></label><br/>
+<select id="tracker_id" name="tracker_id">
+ <%= options_from_collection_for_select @trackers, "id", "name", (@tracker.id unless @tracker.nil?) %>
+</select>
+
+<%= submit_tag l(:button_edit) %>
+</p>
+</div>
+<% end %>
+
+
+
+<% unless @tracker.nil? or @role.nil? %>
+<div class="box">
+ <% form_tag ({:action => 'workflow', :role_id => @role, :tracker_id => @tracker }, :id => 'workflow_form' ) do %>
+ <table>
+ <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>
+ </tr>
+ <tr>
+ <td></td>
+ <% for new_status in @statuses %>
+ <td width="80" align="center"><%= new_status.name %></td>
+ <% end %>
+ </tr>
+
+ <% for old_status in @statuses %>
+ <tr>
+ <td><div class="square" style="background:#<%= old_status.html_color %>;"></div> <%= old_status.name %></td>
+ <% for new_status in @statuses %>
+ <td align="center">
+
+ <input type="checkbox"
+ name="issue_status[<%= old_status.id %>][]"
+ value="<%= new_status.id %>"
+ <%if old_status.new_statuses_allowed_to(@role, @tracker).include? new_status%>checked="checked"<%end%>
+ <%if old_status==new_status%>disabled<%end%>
+ >
+ </td>
+ <% end %>
+
+ </tr>
+ <% end %>
+ </table>
+<br />
+<p>
+<a href="javascript:checkAll('workflow_form', true)"><%=l(:button_check_all)%></a> |
+<a href="javascript:checkAll('workflow_form', false)"><%=l(:button_uncheck_all)%></a>
+</p>
+<br />
<%= submit_tag l(:button_save) %>
-<% end %>\r
-\r
-<% end %>\r
+<% end %>
+
+<% end %>
</div>
\ No newline at end of file
<%= error_messages_for 'tracker' %>
<div class="box">
<!--[form:tracker]-->
-<p><%= f.text_field :name, :required => true %></p>\r
+<p><%= f.text_field :name, :required => true %></p>
<p><%= f.check_box :is_in_chlog %></p>
-<p><%= f.check_box :is_in_roadmap %></p>\r
+<p><%= f.check_box :is_in_roadmap %></p>
<!--[eoform:tracker]-->
</div>
<table class="list">
<thead><tr>
- <th><%=l(:label_tracker)%></th>\r
+ <th><%=l(:label_tracker)%></th>
<th><%=l(:button_sort)%></th>
<th></th>
</tr></thead>
<%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => tracker, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
</td>
<td align="center">
- <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %>\r
+ <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
</td>
</tr>
<% end %>
</tbody>
</table>
-\r
+
<%= pagination_links_full @tracker_pages %>
\ No newline at end of file
<div class="box">
<h3><%=l(:label_information_plural)%></h3>
<p><%= f.text_field :login, :required => true, :size => 25 %></p>
-<p><%= f.text_field :firstname, :required => true %></p>\r
+<p><%= f.text_field :firstname, :required => true %></p>
<p><%= f.text_field :lastname, :required => true %></p>
-<p><%= f.text_field :mail, :required => true %></p>\r
-<p><%= f.select :language, lang_options_for_select %></p>\r
-\r
+<p><%= f.text_field :mail, :required => true %></p>
+<p><%= f.select :language, lang_options_for_select %></p>
+
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
-<% end if @custom_values%>\r
-\r
-<p><%= f.check_box :admin %></p>\r
-<p><%= f.check_box :mail_notification %></p>\r
+<% end if @custom_values%>
+
+<p><%= f.check_box :admin %></p>
+<p><%= f.check_box :mail_notification %></p>
</div>
<div class="box">
-<div class="box" style="margin-top: 16px;">\r
-<h3><%= l(:label_project_plural) %></h3>\r
-\r
-<% @user.memberships.each do |membership| %>\r
-<% form_tag({ :action => 'edit_membership', :id => @user, :membership_id => membership }, :class => "tabular") do %>\r
-<p style="margin:0;padding-top:0;">\r
- <label><%= membership.project.name %></label>\r
- <select name="membership[role_id]">\r
- <%= options_from_collection_for_select @roles, "id", "name", membership.role_id %>\r
- </select>\r
- <%= submit_tag l(:button_change), :class => "button-small" %>\r
- <%= link_to l(:button_delete), {:action => 'destroy_membership', :id => @user, :membership_id => membership }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>\r
-</p>\r
-<% end %>\r
-<% end %>\r
-<hr />\r
-<p>\r
-<label><%=l(:label_project_new)%></label><br/>\r
-<% form_tag({ :action => 'edit_membership', :id => @user }) do %>\r
-<select name="membership[project_id]">\r
-<%= options_from_collection_for_select @projects, "id", "name", @membership.project_id %>\r
-</select>\r
-<select name="membership[role_id]">\r
-<%= options_from_collection_for_select @roles, "id", "name", @membership.role_id %>\r
-</select>\r
-<%= submit_tag l(:button_add) %>\r
-<% end %>\r
-</p>\r
+<div class="box" style="margin-top: 16px;">
+<h3><%= l(:label_project_plural) %></h3>
+
+<% @user.memberships.each do |membership| %>
+<% form_tag({ :action => 'edit_membership', :id => @user, :membership_id => membership }, :class => "tabular") do %>
+<p style="margin:0;padding-top:0;">
+ <label><%= membership.project.name %></label>
+ <select name="membership[role_id]">
+ <%= options_from_collection_for_select @roles, "id", "name", membership.role_id %>
+ </select>
+ <%= submit_tag l(:button_change), :class => "button-small" %>
+ <%= link_to l(:button_delete), {:action => 'destroy_membership', :id => @user, :membership_id => membership }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+</p>
+<% end %>
+<% end %>
+<hr />
+<p>
+<label><%=l(:label_project_new)%></label><br/>
+<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
+<select name="membership[project_id]">
+<%= options_from_collection_for_select @projects, "id", "name", @membership.project_id %>
+</select>
+<select name="membership[role_id]">
+<%= options_from_collection_for_select @roles, "id", "name", @membership.role_id %>
+</select>
+<%= submit_tag l(:button_add) %>
+<% end %>
+</p>
</div>
\ No newline at end of file
</div>
<h2><%=l(:label_user_plural)%></h2>
-\r
-<table class="list"> \r
+
+<table class="list">
<thead><tr>
- <%= sort_header_tag('login', :caption => l(:field_login)) %>\r
- <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>\r
- <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>\r
- <th><%=l(:field_mail)%></th>\r
- <%= sort_header_tag('admin', :caption => l(:field_admin)) %>\r
- <%= sort_header_tag('status', :caption => l(:field_status)) %>\r
- <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>\r
- <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on)) %>\r
- <th></th>\r
+ <%= sort_header_tag('login', :caption => l(:field_login)) %>
+ <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
+ <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
+ <th><%=l(:field_mail)%></th>
+ <%= sort_header_tag('admin', :caption => l(:field_admin)) %>
+ <%= sort_header_tag('status', :caption => l(:field_status)) %>
+ <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
+ <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on)) %>
+ <th></th>
</tr></thead>
<tbody>
<% for user in @users %>
- <tr class="<%= cycle("odd", "even") %>">\r
- <td><%= link_to user.login, :action => 'edit', :id => user %></td>\r
- <td><%= user.firstname %></td>\r
- <td><%= user.lastname %></td>\r
- <td><%= user.mail %></td>\r
- <td align="center"><%= image_tag 'true.png' if user.admin? %></td>\r
- <td align="center"><%= image_tag 'locked.png' if user.locked? %><%= image_tag 'user_new.png' if user.registered? %></td>\r
- <td align="center"><%= format_time(user.created_on) %></td>\r
- <td align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>\r
- <td align="center">\r
- <% form_tag({:action => 'edit', :id => user}) do %>\r
- <% if user.locked? %>\r
- <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %>\r
- <%= submit_tag l(:button_unlock), :class => "button-small" %>\r
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= link_to user.login, :action => 'edit', :id => user %></td>
+ <td><%= user.firstname %></td>
+ <td><%= user.lastname %></td>
+ <td><%= user.mail %></td>
+ <td align="center"><%= image_tag 'true.png' if user.admin? %></td>
+ <td align="center"><%= image_tag 'locked.png' if user.locked? %><%= image_tag 'user_new.png' if user.registered? %></td>
+ <td align="center"><%= format_time(user.created_on) %></td>
+ <td align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
+ <td align="center">
+ <% form_tag({:action => 'edit', :id => user}) do %>
+ <% if user.locked? %>
+ <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %>
+ <%= submit_tag l(:button_unlock), :class => "button-small" %>
<% elsif user.registered? %>
<%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %>
<%= submit_tag l(:button_activate), :class => "button-small" %>
- <% else %>\r
- <%= hidden_field_tag 'user[status]', User::STATUS_LOCKED %>\r
- <%= submit_tag l(:button_lock), :class => "button-small" %>\r
- <% end %>\r
- <% end %> \r
+ <% else %>
+ <%= hidden_field_tag 'user[status]', User::STATUS_LOCKED %>
+ <%= submit_tag l(:button_lock), :class => "button-small" %>
+ <% end %>
+ <% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
-\r
-<p><%= pagination_links_full @user_pages %>\r
-[ <%= @user_pages.current.first_item %> - <%= @user_pages.current.last_item %> / <%= @user_count %> ]\r
+
+<p><%= pagination_links_full @user_pages %>
+[ <%= @user_pages.current.first_item %> - <%= @user_pages.current.last_item %> / <%= @user_count %> ]
</p>
\ No newline at end of file
-<h2><%= l(:label_home) %></h2>\r
-\r
-<div class="splitcontentleft">\r
- <p><%= Setting.welcome_text %></p>\r
- <div class="box">\r
+<h2><%= l(:label_home) %></h2>
+
+<div class="splitcontentleft">
+ <p><%= Setting.welcome_text %></p>
+ <div class="box">
<h3><%=l(:label_news_latest)%></h3>
- <%= render :partial => 'news/news', :collection => @news %>\r
- </div>\r
-</div>\r
-\r
-<div class="splitcontentright">\r
- <div class="box">\r
- <h3 class="icon22 icon22-projects"><%=l(:label_project_latest)%></h3>\r
+ <%= render :partial => 'news/news', :collection => @news %>
+ </div>
+</div>
+
+<div class="splitcontentright">
+ <div class="box">
+ <h3 class="icon22 icon22-projects"><%=l(:label_project_latest)%></h3>
<ul>
- <% for project in @projects %>\r
- <li>\r
- <%= link_to project.name, :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>)<br />\r
- <%=h project.description %>\r
- </li>\r
- <% end %>\r
- </ul>\r
- </div> \r
-</div> \r
-\r
-<% content_for :header_tags do %>\r
-<%= auto_discovery_link_tag(:rss, {:controller => 'feeds' , :action => 'news' }) %>\r
+ <% for project in @projects %>
+ <li>
+ <%= link_to project.name, :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>)<br />
+ <%=h project.description %>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+</div>
+
+<% content_for :header_tags do %>
+<%= auto_discovery_link_tag(:rss, {:controller => 'feeds' , :action => 'news' }) %>
<% end %>
\ No newline at end of file
-<fieldset class="preview"><legend><%= l(:label_preview) %></legend>\r
-<%= textilizable @text %>\r
-</fieldset>\r
+<fieldset class="preview"><legend><%= l(:label_preview) %></legend>
+<%= textilizable @text %>
+</fieldset>
-<div class="contextual">\r
-<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>\r
-</div>\r
-\r
-<h2><%= @page.pretty_title %></h2>\r
-\r
-<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>\r
-<%= error_messages_for 'content' %>\r
-<div class="contextual">\r
-<%= l(:setting_text_formatting) %>:\r
-<%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' },\r
- :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %>\r
-</div>\r
-<p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %></p>\r
-<p><label><%= l(:field_comment) %></label><br /><%= f.text_field :comment, :size => 120 %></p>\r
-<p><%= submit_tag l(:button_save) %>\r
- <%= link_to_remote l(:label_preview), \r
- { :url => { :controller => 'wiki', :action => 'preview', :id => @project },\r
- :method => 'get',\r
- :update => 'preview',\r
- :with => "Form.serialize('wiki_form')",\r
- :loading => "Element.show('indicator')",\r
- :loaded => "Element.hide('indicator')"\r
- } %>\r
- <span id="indicator" style="display:none"><%= image_tag "loading.gif", :align => "absmiddle" %></span>\r
-</p>\r
-\r
-<% end %>\r
-\r
-<% if Setting.text_formatting == 'textile' %>\r
-<%= javascript_include_tag 'jstoolbar' %>\r
-<script type="text/javascript">\r
-//<![CDATA[\r
-if (document.getElementById) { \r
- if (document.getElementById('content_text')) { \r
- var commentTb = new jsToolBar(document.getElementById('content_text')); \r
- commentTb.draw(); \r
- }\r
-}\r
-//]]>\r
-</script>\r
-<% end %>\r
-\r
+<div class="contextual">
+<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>
+</div>
+
+<h2><%= @page.pretty_title %></h2>
+
+<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>
+<%= error_messages_for 'content' %>
+<div class="contextual">
+<%= l(:setting_text_formatting) %>:
+<%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' },
+ :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %>
+</div>
+<p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %></p>
+<p><label><%= l(:field_comment) %></label><br /><%= f.text_field :comment, :size => 120 %></p>
+<p><%= submit_tag l(:button_save) %>
+ <%= link_to_remote l(:label_preview),
+ { :url => { :controller => 'wiki', :action => 'preview', :id => @project },
+ :method => 'get',
+ :update => 'preview',
+ :with => "Form.serialize('wiki_form')",
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')"
+ } %>
+ <span id="indicator" style="display:none"><%= image_tag "loading.gif", :align => "absmiddle" %></span>
+</p>
+
+<% end %>
+
+<% if Setting.text_formatting == 'textile' %>
+<%= javascript_include_tag 'jstoolbar' %>
+<script type="text/javascript">
+//<![CDATA[
+if (document.getElementById) {
+ if (document.getElementById('content_text')) {
+ var commentTb = new jsToolBar(document.getElementById('content_text'));
+ commentTb.draw();
+ }
+}
+//]]>
+</script>
+<% end %>
+
<div id="preview" class="wiki"></div>
\ No newline at end of file
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
-<head>\r
-<title><%=h @page.pretty_title %></title>\r
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />\r
-<style>\r
-body { font:80% Verdana,Tahoma,Arial,sans-serif; }\r
-h1, h2, h3, h4 { font-family: Trebuchet MS,Georgia,"Times New Roman",serif; }\r
-</style>\r
-</head>\r
-<body>\r
-<%= textilizable @content.text, :wiki_links => :local %>\r
-</body>\r
-</html>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title><%=h @page.pretty_title %></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<style>
+body { font:80% Verdana,Tahoma,Arial,sans-serif; }
+h1, h2, h3, h4 { font-family: Trebuchet MS,Georgia,"Times New Roman",serif; }
+</style>
+</head>
+<body>
+<%= textilizable @content.text, :wiki_links => :local %>
+</body>
+</html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
-<head>\r
-<title><%=h @wiki.project.name %></title>\r
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />\r
-<style>\r
-body { font:80% Verdana,Tahoma,Arial,sans-serif; }\r
-h1, h2, h3, h4 { font-family: Trebuchet MS,Georgia,"Times New Roman",serif; }\r
-</style>\r
-</head>\r
-<body>\r
-\r
-<strong><%= l(:label_page_index) %></strong>\r
-<ul>\r
-<% @pages.each do |page| %>\r
- <li><a href="#<%= page.title %>"><%= page.pretty_title %></a></li>\r
-<% end %>\r
-</ul>\r
-\r
-<% @pages.each do |page| %>\r
-<hr />\r
-<%= textilizable page.content.text, :wiki_links => :anchor %>\r
-<% end %>\r
-\r
-</body>\r
-</html>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title><%=h @wiki.project.name %></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<style>
+body { font:80% Verdana,Tahoma,Arial,sans-serif; }
+h1, h2, h3, h4 { font-family: Trebuchet MS,Georgia,"Times New Roman",serif; }
+</style>
+</head>
+<body>
+
+<strong><%= l(:label_page_index) %></strong>
+<ul>
+<% @pages.each do |page| %>
+ <li><a href="#<%= page.title %>"><%= page.pretty_title %></a></li>
+<% end %>
+</ul>
+
+<% @pages.each do |page| %>
+<hr />
+<%= textilizable page.content.text, :wiki_links => :anchor %>
+<% end %>
+
+</body>
+</html>
-<div class="contextual">\r
-<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>\r
-</div>\r
-\r
-<h2><%= @page.pretty_title %></h2>\r
-\r
-<h3><%= l(:label_history) %></h3>\r
-\r
-<table class="list">\r
-<thead><tr>\r
- <th>#</th>\r
- <th><%= l(:field_updated_on) %></th>\r
- <th><%= l(:field_author) %></th>\r
- <th><%= l(:field_comment) %></th>\r
-</tr></thead>\r
-<tbody>\r
-<% @versions.each do |ver| %>\r
-<tr class="<%= cycle("odd", "even") %>">\r
- <th align="center"><%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %></th>\r
- <td align="center"><%= format_time(ver.updated_on) %></td>\r
- <td><em><%= ver.author ? ver.author.name : "anonyme" %></em></td>\r
- <td><%=h ver.comment %></td>\r
-</tr>\r
-<% end %>\r
-</tbody>\r
-</table>\r
-\r
+<div class="contextual">
+<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>
+</div>
+
+<h2><%= @page.pretty_title %></h2>
+
+<h3><%= l(:label_history) %></h3>
+
+<table class="list">
+<thead><tr>
+ <th>#</th>
+ <th><%= l(:field_updated_on) %></th>
+ <th><%= l(:field_author) %></th>
+ <th><%= l(:field_comment) %></th>
+</tr></thead>
+<tbody>
+<% @versions.each do |ver| %>
+<tr class="<%= cycle("odd", "even") %>">
+ <th align="center"><%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %></th>
+ <td align="center"><%= format_time(ver.updated_on) %></td>
+ <td><em><%= ver.author ? ver.author.name : "anonyme" %></em></td>
+ <td><%=h ver.comment %></td>
+</tr>
+<% end %>
+</tbody>
+</table>
+
<p><%= link_to l(:button_back), :action => 'index', :page => @page.title %></p>
\ No newline at end of file
-<div class="contextual">\r
-<%= link_to(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') if @content.version == @page.content.version %>\r
-<%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %>\r
-<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>\r
-</div>\r
-\r
-<% if @content.version != @page.content.version %>\r
- <p> \r
- <%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %>\r
- <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> - \r
- <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %>\r
- <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %>\r
- <br />\r
- <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br />\r
- <%=h @content.comment %>\r
- </p>\r
- <hr />\r
-<% end %>\r
-\r
-<div class="wiki">\r
-<% cache "wiki/show/#{@page.id}/#{@content.version}" do %>\r
-<%= textilizable @content.text %>\r
-<% end %>\r
-</div>\r
-\r
-<div class="contextual">\r
-<%= l(:label_export_to) %>\r
-<%= link_to 'HTML', {:export => 'html', :version => @content.version}, :class => 'icon icon-html' %>,\r
-<%= link_to 'TXT', {:export => 'txt', :version => @content.version}, :class => 'icon icon-txt' %>\r
+<div class="contextual">
+<%= link_to(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') if @content.version == @page.content.version %>
+<%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %>
+<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>
+</div>
+
+<% if @content.version != @page.content.version %>
+ <p>
+ <%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %>
+ <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> -
+ <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %>
+ <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %>
+ <br />
+ <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br />
+ <%=h @content.comment %>
+ </p>
+ <hr />
+<% end %>
+
+<div class="wiki">
+<% cache "wiki/show/#{@page.id}/#{@content.version}" do %>
+<%= textilizable @content.text %>
+<% end %>
+</div>
+
+<div class="contextual">
+<%= l(:label_export_to) %>
+<%= link_to 'HTML', {:export => 'html', :version => @content.version}, :class => 'icon icon-html' %>,
+<%= link_to 'TXT', {:export => 'txt', :version => @content.version}, :class => 'icon icon-txt' %>
</div>
\ No newline at end of file
-<div class="contextual">\r
-<% unless @pages.empty? %>\r
-<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %>\r
-<% end %>\r
-</div>\r
-\r
-<h2><%= l(:label_page_index) %></h2>\r
-\r
-<% if @pages.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>\r
-<ul><% @pages.each do |page| %>\r
- <li><%= link_to page.pretty_title, :action => 'index', :page => page.title %> -\r
- <%= l(:label_last_updates) %>: <%= format_time(page.updated_on) %></li>\r
+<div class="contextual">
+<% unless @pages.empty? %>
+<%= l(:label_export_to) %> <%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'icon icon-html' %>
+<% end %>
+</div>
+
+<h2><%= l(:label_page_index) %></h2>
+
+<% if @pages.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
+<ul><% @pages.each do |page| %>
+ <li><%= link_to page.pretty_title, :action => 'index', :page => page.title %> -
+ <%= l(:label_last_updates) %>: <%= format_time(page.updated_on) %></li>
<% end %></ul>
\ No newline at end of file