# HG changeset patch # User Chris Cannam # Date 1358785423 0 # Node ID 820314b808cf110f7aafa1b6fb1c54a9505c7396 # Parent a943f341c99d796c7c75ad1d16969ebe5aa2ef7d# Parent 4d1a31b309877981ee80cb46c89e81950aba6108 Merge from branch cannam diff -r a943f341c99d -r 820314b808cf app/helpers/activities_helper.rb --- a/app/helpers/activities_helper.rb Mon Jan 21 14:12:05 2013 +0000 +++ b/app/helpers/activities_helper.rb Mon Jan 21 16:23:43 2013 +0000 @@ -5,7 +5,9 @@ # Transform events list into hash from project id to number of # occurrences of project in list (there is surely a tidier way # to do this, e.g. chunk() in Ruby 1.9 but not in 1.8) - phash = events.map { |e| e.project unless !e.respond_to?(:project) }.sort.group_by { |p| p.id } + phash = events.map do |e| + e.project unless !e.respond_to?(:project) + end.select { |p| !p.nil? }.sort.group_by { |p| p.id } phash = phash.merge(phash) { |k,v| v.length } threshold = phash.values.sort.last(count).first busy = phash.keys.select { |k| phash[k] >= threshold }.sample(count) diff -r a943f341c99d -r 820314b808cf config/environment.rb --- a/config/environment.rb Mon Jan 21 14:12:05 2013 +0000 +++ b/config/environment.rb Mon Jan 21 16:23:43 2013 +0000 @@ -5,7 +5,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.15' unless defined? RAILS_GEM_VERSION if RUBY_VERSION >= '1.9' Encoding.default_external = 'UTF-8' diff -r a943f341c99d -r 820314b808cf extra/soundsoftware/reposman-soundsoftware.rb --- a/extra/soundsoftware/reposman-soundsoftware.rb Mon Jan 21 14:12:05 2013 +0000 +++ b/extra/soundsoftware/reposman-soundsoftware.rb Mon Jan 21 16:23:43 2013 +0000 @@ -222,7 +222,7 @@ log('No project found, perhaps you forgot to "Enable WS for repository management"', :exit => true) end -log("retrieved #{projects.size} projects", :level => 1) +log("found #{projects.size} projects at " + Time.now.inspect); def set_owner_and_rights(project, repos_path, &block) if mswin? @@ -253,13 +253,13 @@ end projects.each do |project| - log("treating project #{project.name}", :level => 1) + log("inspecting project #{project.name}", :level => 1) if project.identifier.empty? - log("\tno identifier for project #{project.name}") + log("\tno identifier for project #{project.name}!") next elsif not project.identifier.match(/^[a-z0-9\-]+$/) - log("\tinvalid identifier for project #{project.name} : #{project.identifier}"); + log("\tinvalid identifier for project #{project.name} : #{project.identifier}!"); next; end @@ -282,31 +282,31 @@ if project.respond_to?(:repository) repos_url = project.repository.url; - log("\texisting url for project #{project.identifier} is #{repos_url}"); + log("\texisting url for project #{project.identifier} is #{repos_url}", :level => 2); if repos_url.match(/^file:\//) || repos_url.match(/^\//) repos_url = repos_url.gsub(/^file:\/*/, "/"); - log("\tthis is a local file path, at #{repos_url}"); + log("\tthis is a local file path, at #{repos_url}", :level => 2); if repos_url.slice(0, $repos_base.length) != $repos_base - log("\tit is in the wrong place: replacing it"); # leave repos_path set to our original suggestion + log("\tpreparing to replace incorrect repo location #{repos_url} for #{project.name} with #{repos_path}"); create_repos = true else if !File.directory?(repos_url) - log("\tit doesn't exist; we should create it"); + log("\tpreparing to create repo for #{project.name} at #{repos_url}"); repos_path = repos_url create_repos = true else - log("\tit exists and is in the right place"); + log("\tit exists and is in the right place", :level => 2); end end else - log("\tthis is a remote path, leaving alone"); + log("\tthis is a remote path, leaving alone", :level => 2); end else - log("\tproject #{project.identifier} has no repository registered") + log("\tpreparing to set repo location and create for #{project.name} at #{repos_url}") # if File.directory?(repos_path) # log("\trepository path #{repos_path} already exists, not creating") # else @@ -360,3 +360,5 @@ end end +log("project review completed at " + Time.now.inspect); + diff -r a943f341c99d -r 820314b808cf vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Jan 21 14:12:05 2013 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Jan 21 16:23:43 2013 +0000 @@ -19,6 +19,25 @@ before_save :set_initial_author_order + named_scope :visible, lambda {|*args| { :include => :projects, + :conditions => Project.allowed_to_condition(args.shift || User.current, :view_publication, *args) } } + + acts_as_activity_provider :type => 'publication', + :timestamp => "#{Publication.table_name}.created_at", + :find_options => { + :include => :projects, + :conditions => "#{Project.table_name}.id = projects_publications.project_id" + } + + acts_as_event :title => Proc.new {|o| o.title }, + :datetime => :created_at, + :type => 'publications', + :author => nil, + #todo - need too move the cache from the helper to the model + :description => Proc.new {|o| o.print_entry(:ieee)}, + :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }} + + # Ensure error message uses proper text instead of # bibtex_entry.entry_type (#268). There has to be a better way to # do this! diff -r a943f341c99d -r 820314b808cf vendor/plugins/redmine_bibliography/app/views/activities/_recent.html.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/activities/_recent.html.erb Mon Jan 21 16:23:43 2013 +0000 @@ -0,0 +1,92 @@ +<% events = @events_by_day %> +<% max = 5 %> +<% if (events.nil?) + activity = Redmine::Activity::Fetcher.new(User.current, :project => @project) + + if @project + # Don't show news (duplicated with News box) or wiki edits (too + # tedious) in project front page + activity.scope = [ "changesets", "files", "issues", "documents" ] + end + + events = activity.events(Date.today - 28, Date.today + 1) + + if defined? user + events = events.select { |e| + + if e.class != Publication + user.member_of? e.project + else + e.projects.map {|p| user.member_of? p } + end + } + + end + + events = events.first(max) + + end +%> + +
+ +<% if @project.nil? %> + <%= content_tag('h3', l(:label_activity_my_recent)) %> +
+<% end %> + +<% if events.empty? %> + + <% if @project.nil? %> +

<%= l(:label_activity_my_recent_none) %>

+ <% end %> + +<% else %> + + <% if !@project.nil? %> +
+ <%= content_tag('h3', l(:label_activity_recent)) %> + <% end %> + +
+ <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> + <%- if e.class != Publication -%> +
+ <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <%= format_time(e.event_datetime) %> + <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %> + <% if e.respond_to?(:event_author) %> + <%= e.event_author %> + <% end %> +
+
<%= link_to format_activity_title(e.event_title), e.event_url %> + <%= format_activity_description(e.event_description) %> +
+ <% else -%> +
+ <%= format_time(e.event_datetime) %> + <%= link_to format_activity_title(e.event_title), e.event_url %> + was added to the following + <% if e.projects.count > 1 %> + projects: + <%- else -%> + project: + <%- end -%> + <%= content_tag('span', e.projects.join(', ')) -%> <% if e.respond_to?(:event_author) %> + <%= e.event_author %> + <% end %> +
+
<%= link_to format_activity_title(e.event_title), e.event_url %> + <%= format_activity_description(e.event_description) %> +
+ <% end -%> + <% end -%> +
+ +
+ +<% end %> + +<% if events.empty? and @project.nil? %>
<% end %> + +
diff -r a943f341c99d -r 820314b808cf vendor/plugins/redmine_bibliography/app/views/activities/index.html.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/activities/index.html.erb Mon Jan 21 16:23:43 2013 +0000 @@ -0,0 +1,91 @@ +

<%= + if @author.nil? + if @institution_name.blank? + l(:label_activity) + else + l(:label_institution_activity, h(@institution_name)) + end + else + l(:label_user_activity, link_to_user(@author)) + end + %>

+

<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>

+ +
+<% @events_by_day.keys.sort.reverse.each do |day| %> +

<%= format_activity_day(day) %>

+
+<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> + <%- if e.class != Publication -%> +
+ <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <%= format_time(e.event_datetime, false) %> + <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> + <%= link_to format_activity_title(e.event_title), e.event_url %> +
+
+ <%= format_activity_description(e.event_description) %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> +
+ <%- else -%> +
+ <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <%= format_time(e.event_datetime, false) %> + <%= link_to format_activity_title(e.event_title), e.event_url %> + was added to the following + <% if e.projects.count > 1 %> + projects: + <%- else -%> + project: + <%- end -%> + <%= content_tag('span', e.projects.join(', ')) -%> +
+
+ <%= e.event_description -%> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> +
+ <% end -%> +<%- end -%> +
+<% end -%> +
+ +<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %> + +
+<%= link_to_content_update("\xc2\xab " + l(:label_previous), + params.merge(:from => @date_to - @days - 1), + :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %> +
+
+<%= link_to_content_update(l(:label_next) + " \xc2\xbb", + params.merge(:from => @date_to + @days - 1), + :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %> +
+  +<% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %> +<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> +<% end %> + +<% content_for :sidebar do %> +<% form_tag({}, :method => :get) do %> +

<%= l(:label_activity) %>

+

<% @activity.event_types.each do |t| %> +<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> + +
+<% end %>

+<% if @project && @project.descendants.active.any? %> + <%= hidden_field_tag 'with_subprojects', 0 %> +

+<% end %> +<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> +

<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>

+<% end %> +<% end %> + +<% html_title(l(:label_activity), @author) -%> diff -r a943f341c99d -r 820314b808cf vendor/plugins/redmine_bibliography/init.rb --- a/vendor/plugins/redmine_bibliography/init.rb Mon Jan 21 14:12:05 2013 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Mon Jan 21 16:23:43 2013 +0000 @@ -40,15 +40,22 @@ settings :default => { 'menu' => 'Publications' }, :partial => 'settings/bibliography' project_module :redmine_bibliography do + permission :view_publication, {:publications => :show}, :public => :true permission :publications, { :publications => :index }, :public => true permission :edit_publication, {:publications => [:edit, :update]} permission :add_publication, {:publications => [:new, :create]} permission :delete_publication, {:publications => :destroy} + end # extending the Project Menu menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] }, :if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? } + activity_provider :publication, :class_name => 'Publication', :default => true + end + + +