# HG changeset patch
# User Chris Cannam
<%= 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 @@ -129,6 +142,6 @@ s << "
" end s - end + end end diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/app/models/author.rb --- a/vendor/plugins/redmine_bibliography/app/models/author.rb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/author.rb Thu Nov 22 17:26:15 2012 +0000 @@ -1,4 +1,6 @@ class Author < ActiveRecord::Base + unloadable + has_many :authorships, :dependent => :destroy has_many :publications, :through => :authorships diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb --- a/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Thu Nov 22 17:26:15 2012 +0000 @@ -1,4 +1,5 @@ class BibtexEntryType < ActiveRecord::Base + unloadable @@fields = Hash['article', ['journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ], 'book' , [ 'editor', 'publisher', 'volume', 'series', 'address', 'edition', 'month', 'year', 'note' ], diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Thu Nov 22 17:26:15 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,9 +14,9 @@ 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 # Ensure error message uses proper text instead of @@ -30,34 +30,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 + # already outputs the author names ASC by auth_order + self.authorships.map{|a| a.name_on_paper}.join(' and ') + 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| + value = self.bibtex_entry.attributes[key].to_s + next if key == 'id' or key == 'publication_id' or value == "" + + if key == "entry_type" + bib.type = BibtexEntryType.find(self.bibtex_entry.entry_type).name + else + bib[key.to_sym] = value + end + end + + if style == :ieee + 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 diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Thu Nov 22 17:26:15 2012 +0000 @@ -1,24 +1,29 @@ +<% content_for :header_tags do %> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_include_tag 'bibtex', :plugin => 'redmine_bibliography' -%> +<% end %> + <% if @project.publications.any? %> <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
+ <%= f.text_field :doi, :size => 70 %>
+
+ <%= l(:text_doi) %>
+
<%= print_ieee_format(@publication)%>
+ +<%=h print_bibtex_format(@publication) %>+
+ <%= l(:field_external_url) %>: <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} -%> +
+<%- end -%> -<% unless @publication.external_url.blank? %> -- <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} %> + <%= l(:field_doi)-%>: <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%>
<% end %><%= 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 d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/assets/javascripts/bibtex.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/javascripts/bibtex.js Thu Nov 22 17:26:15 2012 +0000 @@ -0,0 +1,6 @@ +function toggleBibtex(el) { + var dd = Element.up(el).next('dd') + + dd.toggleClassName('collapsed'); + Effect.toggle(dd, 'slide', {duration:0.2}); +} \ No newline at end of file diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css --- a/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Thu Nov 22 17:26:15 2012 +0000 @@ -32,15 +32,32 @@ min-width: 150px; } -div#bibliography dl { margin-left: 2em; } -div#bibliography .box dl { margin-left: 0; } -div#bibliography dt { margin-bottom: 0px; padding-left: 20px } -div#bibliography .box dt { margin-bottom: 0px; padding-left: 10px } -div#bibliography dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; } -div#bibliography .box dd { margin-bottom: 0.6em; padding-left: 0; } + +div#bibliography dd { margin-bottom: 1em; font-size: 0.9em; } + div#bibliography dd .authors { font-style: italic; } -div#bibliography dt .title { font-style: italic; } div#bibliography dd span.authors { color: #808080; } div#bibliography dd span.year { padding-left: 0.6em; } -div#bibliography h3 { background: url(../../../images/table_multiple.png) no-repeat 0% 50%; padding-left: 20px; } +div#bibliography .box dt { + background: url(../../../images/document.png) no-repeat 0% 4px; + padding-left: 20px; + margin-left: 0; +} +div#bibliography .box dd { + padding-left: 20px; + margin-left: 0; +} + +div#bibliography h3 { + background: url(../../../images/table_multiple.png) no-repeat 0% 50%; + padding-left: 20px; +} + +div#bibliography textarea { + width: 90%; + height: 200px; + font: normal 8px; + padding: 2px 10px; + border: solid 1px #ddd; +} diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/config/locales/en.yml --- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Thu Nov 22 17:26:15 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 d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/db/migrate/008_add_doi_and_timestamp_columns_to_publications.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/008_add_doi_and_timestamp_columns_to_publications.rb Thu Nov 22 17:26:15 2012 +0000 @@ -0,0 +1,12 @@ +class AddDoiAndTimestampColumnsToPublications < ActiveRecord::Migration + def self.up + add_column :publications, :doi, :string + add_timestamps :publications + + end + + def self.down + remove_column :publications, :doi + remove_timestamps :publications + end +end diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/db/migrate/009_add_timestamp_columns_to_authors.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/009_add_timestamp_columns_to_authors.rb Thu Nov 22 17:26:15 2012 +0000 @@ -0,0 +1,9 @@ +class AddTimestampColumnsToAuthors < ActiveRecord::Migration + def self.up + add_timestamps :authors + end + + def self.down + remove_timestamps :authors + end +end diff -r d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/init.rb --- a/vendor/plugins/redmine_bibliography/init.rb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Thu Nov 22 17:26:15 2012 +0000 @@ -1,7 +1,8 @@ require 'redmine' require 'dispatcher' -RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' +require 'bibtex' +require 'citeproc' # Patches to the Redmine core. Dispatcher.to_prepare :redmine_model_dependencies do @@ -21,7 +22,9 @@ Mailer.send(:include, Bibliography::MailerPatch) end - + unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) + ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) + end end @@ -47,5 +50,5 @@ # 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? } - + end diff -r d78b06240b73 -r b56a4c5afa35 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 22 17:26:15 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 d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb --- a/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Thu Nov 22 17:26:15 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 d78b06240b73 -r b56a4c5afa35 vendor/plugins/redmine_tags/app/controllers/tags_controller.rb --- a/vendor/plugins/redmine_tags/app/controllers/tags_controller.rb Tue Nov 13 10:12:31 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 d78b06240b73 -r b56a4c5afa35 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 Tue Nov 13 10:12:31 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Thu Nov 22 17:26:15 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 << "
---|