\n" * ancestors.size)
+ @project = original_project
+ end
+
+ if t == TRUE
+ a << "
"
+ a << l("label_my_project_plural")
+ a << "
"
+ a << s
+ else
+ a = s
+ end
+
+ a
+ end
+
+ # Renders a tree of projects that the current user does not belong
+ # to, or of all projects if the current user is not logged in. The
+ # given collection may be a subset of the whole project tree
+ # (eg. some intermediate nodes are private and can not be seen). We
+ # are potentially interested in various things: the project name,
+ # description, manager(s), creation date, last activity date,
+ # general activity level, whether there is anything actually hosted
+ # here for the project, etc.
+ def render_project_table(projects)
+
+ s = ""
+ s << "
"
+ s << "
"
+ s << "
"
+
+ s << sort_header_tag('name', :caption => l("field_name"))
+ s << "
" << l("label_managers") << "
"
+ s << sort_header_tag('created_on', :default_order => 'desc')
+ s << sort_header_tag('updated_on', :default_order => 'desc')
+
+ s << "
"
+
+ original_project = @project
+
+ projects.each do |project|
+ s << render_project_in_table(project, cycle('odd', 'even'), 0)
+ end
+
+ s << "
"
+
+ @project = original_project
+
+ s
+ end
+
+
+ def render_project_in_table(project, oddeven, level)
+
+ # set the project environment to please macros.
+ @project = project
+
+ classes = (level == 0 ? 'root' : 'child')
+
+ s = ""
+
+ s << "
"
+ s << textilizable(project.short_description, :project => project)
+ s << "
"
+ end
+
+ s << "
"
+
+ u = project.users_by_role
+ if u
+ u.keys.each do |r|
+ if r.allowed_to?(:edit_project)
+ mgrs = []
+ u[r].sort.each do |m|
+ mgrs << link_to_user(m)
+ end
+ if mgrs.size < 3
+ s << '' << mgrs.join(', ') << ''
+ else
+ s << mgrs.join(', ')
+ end
+ end
+ end
+ end
+
+ s << "
"
+ s << "
" << format_date(project.created_on) << "
"
+ s << "
" << format_date(project.updated_on) << "
"
+
+ s << "
"
+
+ project.children.each do |child|
+ s << render_project_in_table(child, oddeven, level + 1)
+ end
+
+ s
+ end
+
+
# Returns a set of options for a select field, grouped by project.
def version_options_for_select(versions, selected=nil)
grouped = Hash.new {|h,k| h[k] = []}
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/institution.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/institution.rb Mon Jun 06 14:41:04 2011 +0100
@@ -0,0 +1,2 @@
+class Institution < ActiveRecord::Base
+end
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/issue.rb
--- a/app/models/issue.rb Mon Jun 06 14:24:13 2011 +0100
+++ b/app/models/issue.rb Mon Jun 06 14:41:04 2011 +0100
@@ -564,7 +564,8 @@
# Returns a string of css classes that apply to the issue
def css_classes
- s = "issue status-#{status.position} priority-#{priority.position}"
+ s = "issue status-#{status.position} "
+ s << "priority-#{priority.position}"
s << ' closed' if closed?
s << ' overdue' if overdue?
s << ' child' if child?
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/project.rb
--- a/app/models/project.rb Mon Jun 06 14:24:13 2011 +0100
+++ b/app/models/project.rb Mon Jun 06 14:41:04 2011 +0100
@@ -85,6 +85,7 @@
named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
named_scope :all_public, { :conditions => { :is_public => true } }
named_scope :visible, lambda {|*args| {:conditions => Project.visible_condition(args.shift || User.current, *args) }}
+ named_scope :visible_roots, lambda { { :conditions => Project.root_visible_by(User.current) } }
def initialize(attributes = nil)
super
@@ -133,6 +134,10 @@
allowed_to_condition(user, :view_project, options)
end
+ def self.root_visible_by(user=nil)
+ return "#{Project.table_name}.parent_id IS NULL AND " + visible_by(user)
+ end
+
# Returns a SQL conditions string used to find all projects for which +user+ has the given +permission+
#
# Valid options:
@@ -463,7 +468,14 @@
# Returns a short description of the projects (first lines)
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ ## Original Redmine code: this truncates to the CR that is more
+ ## than "length" characters from the start.
+ # description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ ## That's too much for us, and also we want to omit images and the
+ ## like. Truncate instead to the first CR that follows _any_
+ ## non-blank text, and to the next word break beyond "length"
+ ## characters if the result is still longer than that.
+ description.gsub(/![^\s]+!/, '').gsub(/^(\s*[^\n\r]*).*$/m, '\1').gsub(/^(.{#{length}}\b).*$/m, '\1 ...').strip if description
end
def css_classes
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/repository/.svn/all-wcprops
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/repository/.svn/all-wcprops Mon Jun 06 14:41:04 2011 +0100
@@ -0,0 +1,47 @@
+K 25
+svn:wc:ra_dav:version-url
+V 46
+/svn/!svn/ver/4982/trunk/app/models/repository
+END
+subversion.rb
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/4962/trunk/app/models/repository/subversion.rb
+END
+bazaar.rb
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/4982/trunk/app/models/repository/bazaar.rb
+END
+git.rb
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/4975/trunk/app/models/repository/git.rb
+END
+mercurial.rb
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/!svn/ver/4975/trunk/app/models/repository/mercurial.rb
+END
+filesystem.rb
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/4975/trunk/app/models/repository/filesystem.rb
+END
+cvs.rb
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/4982/trunk/app/models/repository/cvs.rb
+END
+darcs.rb
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/4982/trunk/app/models/repository/darcs.rb
+END
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/ssamr_user_detail.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/ssamr_user_detail.rb Mon Jun 06 14:41:04 2011 +0100
@@ -0,0 +1,14 @@
+class SsamrUserDetail < ActiveRecord::Base
+ belongs_to :user
+
+ validates_presence_of :description
+
+ validate :check_institution
+
+ def check_institution()
+ errors.add(:institution_id, "Please insert an institution") if
+ institution_id.blank? and other_institution.blank?
+ end
+
+
+end
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/models/user.rb
--- a/app/models/user.rb Mon Jun 06 14:24:13 2011 +0100
+++ b/app/models/user.rb Mon Jun 06 14:41:04 2011 +0100
@@ -52,6 +52,9 @@
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
+ has_one :ssamr_user_detail, :dependent => :destroy, :class_name => 'SsamrUserDetail'
+ accepts_nested_attributes_for :ssamr_user_detail
+
# Active non-anonymous users scope
named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}"
@@ -63,6 +66,9 @@
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
+
+ # TODO: is this validation correct validates_presence_of :ssamr_user_detail
+
validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false
validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false
# Login must contain lettres, numbers, underscores only
@@ -76,6 +82,8 @@
before_destroy :remove_references_before_destroy
+ validates_acceptance_of :terms_and_conditions, :on => :create, :message => :must_accept_terms_and_conditions
+
named_scope :in_group, lambda {|group|
group_id = group.is_a?(Group) ? group.id : group.to_i
{ :conditions => ["#{User.table_name}.id IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id] }
@@ -107,6 +115,10 @@
write_attribute(:mail, arg.to_s.strip)
end
+ def description=(arg)
+ write_attribute(:description, arg.to_s.strip)
+ end
+
def identity_url=(url)
if url.blank?
write_attribute(:identity_url, '')
diff -r cbce1fd3b1b7 -r 753f1380d6bc app/views/account/register.rhtml
--- a/app/views/account/register.rhtml Mon Jun 06 14:24:13 2011 +0100
+++ b/app/views/account/register.rhtml Mon Jun 06 14:41:04 2011 +0100
@@ -1,3 +1,6 @@
+<%= javascript_include_tag "ssamr_institutions" %>
+<%= javascript_include_tag "ssamr_registration" %>
+
<%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>