# HG changeset patch
# User luisf
<%= l(:text_project_homepage_info) %>
<%= f.check_box :is_public %> +
+<%= label(:project, :is_public_1, l(:field_public_or_private) + content_tag("span", " *", :class => "required")) %>
+<%
+ # if the project hasn't been created fully yet, then we don't
+ # want to set either public or private (make the user decide)
+ initialised = !@project.id.nil?
+%>
+ <%= f.radio_button :is_public, 1, :checked => (initialised && @project.is_public?) %>
+ <%= l(:text_project_public_info) %>
- <%= l(:text_project_visibility_info) %>
+ <%= f.radio_button :is_public, 0, :checked => (initialised && !@project.is_public?) %>
+ <%= l(:text_project_private_info) %>
+
+ <%= l(:text_project_visibility_info) %>
<% @users_by_role.keys.sort.each do |role| %>
<%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %>
<% end %>
'
-
+
publication.authorships.each do |authorship|
s << link_to_authorship(authorship)
s << "
#{authorship.institution}
" if key == "entry_type" s << bibtex_entry.entry_type_label @@ -140,6 +142,6 @@ s << "
" end s - end + end end diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Thu Nov 29 14:38:12 2012 +0000 @@ -2,10 +2,10 @@ class Publication < ActiveRecord::Base unloadable - + has_many :authorships, :dependent => :destroy, :order => "auth_order ASC" has_many :authors, :through => :authorships, :uniq => true - + has_one :bibtex_entry, :dependent => :destroy validates_presence_of :title @@ -14,11 +14,30 @@ accepts_nested_attributes_for :authorships accepts_nested_attributes_for :authors, :allow_destroy => true accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true - + has_and_belongs_to_many :projects, :uniq => true - + 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! @@ -30,62 +49,62 @@ end end - def notify_authors_publication_added(project) + def notify_authors_publication_added(project) self.authors.each do |author| Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } Mailer.deliver_publication_added(author.user, self, project) unless author.user.nil? end end - - def notify_authors_publication_updated(project) + + def notify_authors_publication_updated(project) self.authors.each do |author| Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } Mailer.deliver_publication_updated(author.user, self, project) unless author.user.nil? end end - - + + def set_initial_author_order authorships = self.authorships - + logger.debug { "Publication \"#{self.title}\" has #{authorships.size} authors." } - + authorships.each_with_index do |authorship, index| if authorship.auth_order.nil? authorship.auth_order = index end - end + end end - + def print_bibtex_author_names - # this authors are correctly sorted because the authorships model + # this authors are correctly sorted because the authorships model # already outputs the author names ASC by auth_order self.authorships.map{|a| a.name_on_paper}.join(' and ') - end - + end + def print_entry(style) bib = BibTeX::Entry.new bib.author = self.print_bibtex_author_names bib.title = self.title - self.bibtex_entry.attributes.keys.sort.each do |key| + self.bibtex_entry.attributes.keys.sort.each do |key| value = self.bibtex_entry.attributes[key].to_s next if key == 'id' or key == 'publication_id' or value == "" - if key == "entry_type" + if key == "entry_type" bib.type = BibtexEntryType.find(self.bibtex_entry.entry_type).name else bib[key.to_sym] = value - end + end end - + if style == :ieee - CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html - else + CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html + else bibtex = bib.to_s :include => :meta_content bibtex.strip! logger.error { bibtex } - end + end end end diff -r 6b67deb0674b -r 8b57fd618c84 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 Thu Nov 29 14:38:12 2012 +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 +%> + +<%= l(:label_activity_my_recent_none) %>
+ <% end %> + +<% else %> + + <% if !@project.nil? %> +<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
+ +<% @activity.event_types.each do |t| %>
+<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
+
+
+<% end %>
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
+<% end %> +<% end %> + +<% html_title(l(:label_activity), @author) -%> diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -9,18 +9,18 @@
+ <%= f.text_field :doi, :size => 70 %>
+
+ <%= l(:text_doi) %>
+
<%= print_ieee_format(@publication)%>
+ +<%=h print_bibtex_format(@publication) %>
<%= render :partial => 'list_projects' %>
- + <%- if User.current.allowed_to?(:edit_publication, @project) -%> - <%= render :partial => 'add_project_form' %> + <%= render :partial => 'add_project_form' %> <%- end -%> <% end %> diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css --- a/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Thu Nov 29 14:38:12 2012 +0000 @@ -33,18 +33,20 @@ } -div#bibliography dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; } +div#bibliography dd { margin-bottom: 1em; font-size: 0.9em; } div#bibliography dd .authors { font-style: italic; } div#bibliography dd span.authors { color: #808080; } div#bibliography dd span.year { padding-left: 0.6em; } div#bibliography .box dt { - background: url(../../../images/document.png) no-repeat 0% 50%; padding-left: 20px; - margin-left: 2em; + background: url(../../../images/document.png) no-repeat 0% 4px; + padding-left: 20px; + margin-left: 0; } div#bibliography .box dd { - margin-left: 25px; + padding-left: 20px; + margin-left: 0; } div#bibliography h3 { @@ -58,4 +60,4 @@ font: normal 8px; padding: 2px 10px; border: solid 1px #ddd; -} \ No newline at end of file +} diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/config/locales/en.yml --- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Thu Nov 29 14:38:12 2012 +0000 @@ -12,8 +12,7 @@ label_my_publications_box: "My Publications" view_all_publications: "View All Project's Publications" publications: Publications - - + identify_author_question: Is the right person selected above? identify_author_yes: "Yes" identify_author_correct: "Yes, but I need to correct some details below" @@ -25,24 +24,25 @@ label_all_publications_for_project: Publications associated with %{project} label_authors_show: "Authorships associated with this author" label_authors_index: "List of authors" - + field_authorship_publication_title: "Publication" field_authorship_name: "Name on Paper" field_authorship_email: "Email" field_authorship_institution: "Institution" - + field_external_url: "External URL" + field_doi: "DOI" field_publication_title: Title field_publication_authors: Authors field_publication_projects: "Associated projects" field_author_name: Author field_author_user: User Name field_author_username: "Associated user" - field_author_publications: "Publications by this Author" + field_author_publications: "Publications by this Author" field_identify_author_yes: "Yes" field_identify_author_correct: "Corrections" field_identify_author_no: "No" - + label_author_is_me: "(I am this author)" label_add_me_as_author: "Add me as an author" label_add_an_author: "Add an author" @@ -54,7 +54,7 @@ label_author_information: "Author Information" remove_author: "Remove this author" - + label_publication_plural: "Publications" label_related_publication_plural: "Related publications" label_publication_new: "Create New Publication" @@ -67,22 +67,23 @@ label_publication_project_index: "Projects associated with this publication" label_publication_index: "View all publications" label_publication_other_details: "Details" - + text_external_url: "Link to the publication or to an external page about it." + text_doi: "DOI (Digital Object Identifier)." text_author_name_on_paper: "Author's name as it appears on the paper." text_author_institution: "Author's institution as on the paper." text_author_email: "Author's email address as on the paper." - + text_author_search: "Search existing authors" - + # authorships model field_institution: "Institution" - field_name_on_paper: "Name" + field_name_on_paper: "Name" field_email: "Email Address" - + # bibtex_entries model field_entry_type: "Publication Type" - field_id: "id" + field_id: "id" field_publication_id: "Publication_id" field_address: "Address" field_annote: "Annote" @@ -122,7 +123,7 @@ field_bibtex_proceedings: Conference proceedings field_bibtex_techreport: Technical report field_bibtex_unpublished: Unpublished - + label_author_1: First author label_author_2: Second author label_author_3: Third author @@ -146,6 +147,6 @@ mail_subject_publication_added: "You have been added as an author to a new publication" mail_body_publication_added: "A new publication (%{publication}) has been added to the project '%{project}.'" - - - + + + diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/init.rb --- a/vendor/plugins/redmine_bibliography/init.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Thu Nov 29 14:38:12 2012 +0000 @@ -4,9 +4,6 @@ require 'bibtex' require 'citeproc' - -RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' - # Patches to the Redmine core. Dispatcher.to_prepare :redmine_model_dependencies do require_dependency 'project' @@ -25,7 +22,9 @@ Mailer.send(:include, Bibliography::MailerPatch) end - + unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) + ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) + end end @@ -41,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 + + + diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/lib/bibliography/projects_helper_patch.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/projects_helper_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -0,0 +1,17 @@ +module Bibliography + module ProjectsHelperPatch + + def self.included(base) # :nodoc: + base.send(:include, InstanceMethods) + base.send(:include, PublicationsHelper) + + base.class_eval do + unloadable + end + end + + module InstanceMethods + end + end +end + diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb --- a/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -1,16 +1,16 @@ require_dependency 'user' module Bibliography - module UserAuthorPatch + module UserAuthorPatch def self.included(base) - base.send(:include, InstanceMethods) - extend ClassMethods - + base.send(:include, InstanceMethods) + extend ClassMethods + end #self.included - + module ClassMethods - end - + end + module InstanceMethods def institution @@ -18,28 +18,28 @@ institution_name = self.ssamr_user_detail.institution_name else institution_name = "No Institution Set" - end - return institution_name + end + return institution_name end def get_author_info # TODO: DELETE THIS METHOD?? - info = { + info = { :name_on_paper => self.name, :email => self.mail, :institution => "", :author_user_id => self.id, - :is_user => "1" + :is_user => "1" } if not self.ssamr_user_detail.nil? info[:institution] = self.ssamr_user_detail.institution_name end - return info + return info end - + end #InstanceMethods - + end #UserPublicationsPatch end #RedmineBibliography diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_tags/app/controllers/tags_controller.rb --- a/vendor/plugins/redmine_tags/app/controllers/tags_controller.rb Mon Nov 19 18:58:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -class TagsController < ApplicationController - - def index - respond_to do |format| - format.html { - render :template => 'tags/index.html.erb', :layout => !request.xhr? - } - format.api { - } - format.atom { - } - end - end - -end diff -r 6b67deb0674b -r 8b57fd618c84 vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb --- a/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -6,7 +6,7 @@ <%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' -%> - <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}', true)" -%> + <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags')}', true)" -%>" << l("tags") << " | " s << "" << l("label_managers") << " | " s << sort_header_tag('created_on', :default_order => 'desc') s << sort_header_tag('updated_on', :default_order => 'desc') - + s << "
---|