Mercurial > hg > soundsoftware-site
changeset 689:a8e402f48723 cannam
Merge from branch "live"
author | Chris Cannam |
---|---|
date | Fri, 16 Sep 2011 15:51:18 +0100 |
parents | 7fc15203288c (current diff) cdddec376920 (diff) |
children | 76be9c574f4f d6bb0e402676 |
files | |
diffstat | 77 files changed, 2141 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +202986dd17e4e02b3622b65cf38f358b67a393e8 bibliography_plugin_alpha
--- a/app/models/project.rb Fri Sep 09 13:20:34 2011 +0100 +++ b/app/models/project.rb Fri Sep 16 15:51:18 2011 +0100 @@ -597,7 +597,8 @@ 'custom_field_values', 'custom_fields', 'tracker_ids', - 'issue_custom_field_ids' + 'issue_custom_field_ids', + 'has_welcome_page' safe_attributes 'enabled_module_names', :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) }
--- a/app/models/ssamr_user_detail.rb Fri Sep 09 13:20:34 2011 +0100 +++ b/app/models/ssamr_user_detail.rb Fri Sep 16 15:51:18 2011 +0100 @@ -10,5 +10,15 @@ institution_id.blank? and other_institution.blank? end - + def institution_name() + if not self.institution_type.nil? + if self.institution_type + Institution.find(self.institution_id).name + else + self.other_institution + end + else + "" + end + end end
--- a/app/models/user.rb Fri Sep 09 13:20:34 2011 +0100 +++ b/app/models/user.rb Fri Sep 16 15:51:18 2011 +0100 @@ -54,6 +54,8 @@ has_one :ssamr_user_detail, :dependent => :destroy, :class_name => 'SsamrUserDetail' accepts_nested_attributes_for :ssamr_user_detail + + has_one :author # Active non-anonymous users scope named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}"
--- a/public/stylesheets/application.css Fri Sep 09 13:20:34 2011 +0100 +++ b/public/stylesheets/application.css Fri Sep 16 15:51:18 2011 +0100 @@ -251,6 +251,11 @@ border: 1px solid #e4e4e4; } +.box h4 { +margin-top: 0; +padding-top: 0; +} + div.square { border: 1px solid #999; float: left; @@ -400,13 +405,16 @@ p.pagination {margin-top:8px;} /***** Tabular forms ******/ -.tabular p{ +.tabular p, .tabular ul{ margin: 0; padding: 5px 0 8px 0; padding-left: 180px; /*width of left column containing the label elements*/ height: 1%; clear:left; } +.tabular ul{ +margin-top: -4px; +} html>body .tabular p {overflow:hidden;} @@ -419,6 +427,15 @@ margin*/ } +.tabular .splitcontentleft .box p, .tabular .splitcontentright .box p, .splitcontentleft .tabular p, .splitcontentright .tabular p, .tabular .splitcontentleft .box ul, .tabular .splitcontentright .box ul, .splitcontentleft .tabular ul, .splitcontentright .tabular ul { +padding-left: 120px; +} + +.tabular .splitcontentleft .box label, .tabular .splitcontentright .box label, .splitcontentleft .tabular label, .splitcontentright .tabular label { +margin-left: -120px; +width: 115px; +} + .tabular label.floating{ font-weight: normal; margin-left: 0px;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/README.rdoc Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ += bibliography + +Description goes here
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/authors_controller.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,13 @@ +class AuthorsController < ApplicationController + helper :publications + include PublicationsHelper + + def index + @authors = Author.find(:all) + end + + def show + @author = Author.find(params[:id]) + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/authorships_controller.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,10 @@ +class AuthorshipsController < ApplicationController + + def index + + end + + + def update + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/bibtex_entries_controller.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +class BibtexEntriesController < ApplicationController + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,343 @@ +# -*- coding: utf-8 -*- +# vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb + +class PublicationsController < ApplicationController + unloadable + + model_object Publication + before_filter :find_model_object, :except => [:new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ] + before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ] + + def new + find_project_by_project_id + @publication = Publication.new + + # we'll always want a new publication to have its bibtex entry + @publication.build_bibtex_entry + + # and at least one author + # @publication.authorships.build.build_author + @author_options = [["#{User.current.name} (@#{User.current.mail.partition('@')[2]})", "#{User.current.class.to_s}_#{User.current.id.to_s}"]] + + + end + + def create + @project = Project.find(params[:project_id]) + + @author_options = [] + + @publication = Publication.new(params[:publication]) + @publication.projects << @project unless @project.nil? + + if @publication.save + @publication.notify_authors_publication_added(@project) + + flash[:notice] = "Successfully created publication." + redirect_to :action => :show, :id => @publication, :project_id => @project + else + render :action => 'new', :project_id => @project + end + end + + def index + if !params[:project_id].nil? + find_project_by_project_id + @project = Project.find(params[:project_id]) + @publications = Publication.find :all, :joins => :projects, :conditions => ["project_id = ?", @project.id] + else + @publications = Publication.find :all + end + end + + def new_from_bibfile + @publication.current_step = session[:publication_step] + + # contents of the paste text area + bibtex_entry = params[:bibtex_entry] + + # method for creating "pasted" bibtex entries + if bibtex_entry + parse_bibtex_list bibtex_entry + end + end + + def get_bibtex_required_fields + + fields = BibtexEntryType.fields(params[:value]) + all_fields = BibtexEntryType.all_fields + + respond_to do |format| + format.js { + render(:update) {|page| + all_fields.each_with_index do |field, idx| + unless fields.include? field + page["publication_bibtex_entry_attributes_#{field}"].up('p').hide() + else + page["publication_bibtex_entry_attributes_#{field}"].up('p').show() + end + end + } + } + end + end + + def add_author + if (request.xhr?) + render :text => User.find(params[:user_id]).name + else + # No? Then render an action. + #render :action => 'view_attribute', :attr => @name + logger.error { "Error while adding Author to publication." } + end + end + + def edit + find_project_by_project_id unless params[:project_id].nil? + + @edit_view = true; + @publication = Publication.find(params[:id]) + @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type + + @author_options = [] + + @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) + end + + def update + @publication = Publication.find(params[:id]) + + @author_options = [] + + logger.error { "INSIDE THE UPDATE ACTION IN THE PUBLICATION CONTROLLER" } + + if @publication.update_attributes(params[:publication]) + flash[:notice] = "Successfully updated Publication." + + if !params[:project_id].nil? + redirect_to :action => :show, :id => @publication, :project_id => params[:project_id] + else + redirect_to :action => :show, :id => @publication + end + else + render :action => 'edit' + end + end + + def show + find_project_by_project_id unless params[:project_id].nil? + + if @publication.nil? + @publications = Publication.all + render "index", :alert => 'The publication was not found!' + else + @authors = @publication.authors + @bibtext_entry = @publication.bibtex_entry + end + end + + # parse string with bibtex authors + def parse_authors(authors_entry) + # in bibtex the authors are always seperated by "and" + return authors_entry.split(" and ") + end + + # parses a list of bibtex + def parse_bibtex_list(bibtex_list) + bibliography = BibTeX.parse bibtex_list + + no_entries = bibliography.data.length + + # parses the bibtex entries + bibliography.data.map do |d| + + if d.class == BibTeX::Entry + create_bibtex_entry d + end + end + end + + def create_bibtex_entry(d) + @publication = Publication.new + @bentry = BibtexEntry.new + authors = [] + institution = "" + email = "" + + d.fields.keys.map do |field| + case field.to_s + when "author" + authors = parse_authors d[field] + when "title" + @publication.title = d[field] + when "institution" + institution = d[field] + when "email" + email = d[field] + else + @bentry[field] = d[field] + end + end + + @publication.bibtex_entry = @bentry + @publication.save + + # what is this for??? + # @created_publications << @publication.id + + # need to save all authors + # and establish the author-publication association + # via the authorships table + authors.each_with_index.map do |authorname, idx| + author = Author.new(:name => authorname) + if author.save! + puts "SAVED" + else + puts "NOT SAVED" + end + + author.authorships.create!( + :publication => @publication, + :institution => institution, + :email => email, + :order => idx) + end + end + + # parses the bibtex file + def parse_bibtex_file + + end + + def import + @publication = Publication.new + + + end + + def autocomplete_for_project + @publication = Publication.find(params[:id]) + + @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects + logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results" + render :layout => false + end + + def autocomplete_for_author + @results = [] + + object_id = params[:object_id] + @object_name = "publications[authorships_attributes][#{object_id}][search_results]" + + # cc 20110909 -- revert to like instead of like_unique -- see #289 + authorships_list = Authorship.like(params[:q]).find(:all, :limit => 100) + users_list = User.active.like(params[:q]).find(:all, :limit => 100) + + logger.debug "Query for \"#{params[:q]}\" returned \"#{authorships_list.size}\" authorships and \"#{users_list.size}\" users" + + @results = users_list + + # TODO: can be optimized… + authorships_list.each do |authorship| + flag = true + + users_list.each do |user| + if authorship.name == user.name && authorship.email == user.mail && authorship.institution == user.institution + Rails.logger.debug { "Rejecting Authorship #{authorship.id}" } + flag = false + break + end + end + + @results << authorship if flag + end + + render :layout => false + end + + + def get_user_info + object_id = params[:object_id] + value = params[:value] + classname = Kernel.const_get(value.split('_')[0]) + + item = classname.find(value.split('_')[1]) + + name_field = "publication_authorships_attributes_#{object_id}_name_on_paper".to_sym + email_field = "publication_authorships_attributes_#{object_id}_email".to_sym + institution_field = "publication_authorships_attributes_#{object_id}_institution".to_sym + + yes_radio = "publication_authorships_attributes_#{object_id}_identify_author_yes".to_sym + + respond_to do |format| + format.js { + render(:update) {|page| + page[name_field].value = item.name + page[email_field].value = item.mail + page[institution_field].value = item.institution + + page[yes_radio].checked = true + page[name_field].readOnly = true + page[email_field].readOnly = true + page[institution_field].readOnly = true + } + } + end + end + + def sort_author_order + params[:authorships].each_with_index do |id, index| + Authorship.update_all(['auth_order=?', index+1], ['id=?', id]) + end + render :nothing => true + end + + def add_project + @projects = Project.find(params[:publication][:project_ids]) + @publication.projects << @projects + @project = Project.find(params[:project_id]) + + # TODO luisf should also respond to HTML??? + respond_to do |format| + format.html { redirect_to :back } + format.js { + render(:update) {|page| + page[:add_project_form].reset + page.replace_html :list_projects, :partial => 'list_projects' + } + } + end + end + + + def remove_project + @project = Project.find(params[:project_id]) + proj = Project.find(params[:remove_project_id]) + + if @publication.projects.length > 1 + if @publication.projects.exists? proj + @publication.projects.delete proj if request.post? + end + else + logger.error { "Cannot remove project from publication list" } + end + + logger.error { "CURRENT project name#{proj.name} and wanna delete #{@project.name}" } + + render(:update) {|page| + page.replace_html "list_projects", :partial => 'list_projects', :id => @publication + } + end + + def destroy + find_project_by_project_id + + @publication.destroy + + flash[:notice] = "Successfully deleted Publication." + redirect_to :controller => :publications, :action => 'index', :project_id => @project + end + + private + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,28 @@ +module AuthorsHelper + unloadable + + def render_author_publications(author) + s = "" + pubs = [] + + author.publications.each do |pub| + pubs << link_to(pub.title, pub) + end + + if pubs.size < 3 + s << '<nobr>' << pubs.join(', ') << '</nobr>' + else + s << pubs.join(', ') + end + s + end + + + # Generates a link to an author + # todo: test options + def link_to_author(author, options={}, html_options = nil) + url = {:controller => 'authors', :action => 'show', :id => author}.merge(options) + link_to(h(author.name), url, html_options) + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,2 @@ +module AuthorshipsHelper +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/bibtex_entries_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +module BibtexEntriesHelper + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/my_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,38 @@ +module MyHelper + + def get_my_publications() + if not User.current.author.nil? + @my_publications = Publication.all(:include => :authors, :conditions => "authors.id = #{User.current.author.id}") + else + @my_publications = [] + end + end + + def render_publications_projects(publication) + s = "" + projs = [] + + publication.projects.each do |proj| + projs << link_to(proj.name, proj) + end + + s << projs.join(', ') + + s + end + + def render_publications_authors(publication) + s = "" + auths = [] + + publication.authorships.each do |auth| + auths << h(auth.name_on_paper) + end + + s << auths.join(', ') + + s + end + + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +require 'bibtex' + +module PublicationsHelper + + def link_to_publication(publication, options={}, html_options = nil) + url = {:controller => 'publications', :action => 'show', :id => publication}.merge(options) + link_to(h(publication.title), url, html_options) + end + + def projects_check_box_tags(name, projects) + s = '' + projects.sort.each do |project| + s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n" + end + s + end + + def choose_author_link(object_name, items) + # called by autocomplete_for_author (publications' action/view) + # creates the select list based on the results array + # results is an array with both Users and Authorships objects + + @author_options = [] + @results.each do |result| + email_bit = result.mail.partition('@')[2] + if email_bit != "": + email_bit = "(@#{email_bit})" + end + @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"] + end + + if @results.size > 0 + s = select_tag( form_tag_name(object_name, :author_search_results), options_for_select(@author_options), { :id => form_tag_id(object_name, :author_search_results), :size => 3} ) + s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q') + else + s = "<em>No Authors found that match your search… sorry!</em>" + end + end + + def link_to_remove_fields(name, f) + f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') + end + + def link_to_add_fields(name, f, association) + new_object = f.object.class.reflect_on_association(association).klass.new + fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| + render(association.to_s.singularize + "_fields", :f => builder) + end + link_to_function(name, h("add_fields(this, '#{association}', '#{escape_javascript(fields)}')"), { :class => 'icon icon-add', :id => "add_another_author" }) + end + + def sanitized_object_name(object_name) + object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") + end + + def sanitized_method_name(method_name) + method_name.sub(/\?$/, "") + end + + def form_tag_name(object_name, method_name) + str = "#{object_name.to_s}[#{sanitized_method_name(method_name.to_s)}]" + str.to_sym + end + + def form_tag_id(object_name, method_name) + str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}" + str.to_sym + end + + def form_object_id(object_name) + str = object_name.split("\[").last().gsub("\]","") + str.to_sym + end + + def render_projects_list(publication) + logger.error { "PROJECT NAME #{@project.name unless @project.nil?}" } + + s = "" + + publication.projects.each do |proj| + s << link_to_project(proj, {}, :class => 'publication_project') + + if User.current.allowed_to?(:edit_publication, @project) + if @project == proj + confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' + else + confirm_msg = false + end + + s << link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj, :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del') + end + + s << "<br />" + + end + + s + end + + def show_bibtex_fields(bibtex_entry) + s = "" + bibtex_entry.attributes.keys.sort.each do |key| + value = bibtex_entry.attributes[key].to_s + next if key == 'id' or key == 'publication_id' or value == "" + s << "<h4>" + l("field_#{key}") + "</h4>" + s << "<p>" + if key == "entry_type" + s << bibtex_entry.entry_type_label + else + s << value + end + s << "</p>" + end + s + end +end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/author.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,18 @@ +class Author < ActiveRecord::Base + has_many :authorships, :dependent => :destroy + has_many :publications, :through => :authorships + + belongs_to :user + + def <=>(author) + name.downcase <=> author.name.downcase + end + + named_scope :like, lambda {|q| + s = "%#{q.to_s.strip.downcase}%" + {:conditions => ["LOWER(name) LIKE :s", {:s => s}], + :order => 'name' + } + } + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/authorship.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,71 @@ +class Authorship < ActiveRecord::Base + unloadable + + belongs_to :author + belongs_to :publication + + accepts_nested_attributes_for :author + accepts_nested_attributes_for :publication + + validates_presence_of :name_on_paper + + attr_accessor :is_user, :author_user_id, :search_name, :identify_author, :search_results + before_save :associate_author_user + + named_scope :like_unique, lambda {|q| + s = "%#{q.to_s.strip.downcase}%" + {:conditions => ["LOWER(name_on_paper) LIKE :s OR LOWER(email) LIKE :s", {:s => s}], + :order => 'name_on_paper', + :group => "name_on_paper, institution, email" + } + } + + named_scope :like, lambda {|q| + s = "%#{q.to_s.strip.downcase}%" + {:conditions => ["LOWER(name_on_paper) LIKE :s OR LOWER(email) LIKE :s", {:s => s}], + :order => 'name_on_paper' + } + } + + def name + return self.name_on_paper + end + + def <=>(authorship) + name.downcase <=> authorship.name.downcase + end + + def mail + return self.email + end + + protected + def associate_author_user + case self.identify_author + when "no" + author = Author.new + author.save + self.author_id = author.id + else + selected = self.search_results + selected_classname = Kernel.const_get(selected.split('_')[0]) + selected_id = selected.split('_')[1] + object = selected_classname.find(selected_id) + + if object.respond_to? :name_on_paper + # Authorship + self.author_id = object.author.id + else + # User + unless object.author.nil? + self.author_id = object.author.id + else + author = Author.new + object.author = author + object.save + self.author_id = object.author.id + end + end + end + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,16 @@ +class BibtexEntry < ActiveRecord::Base + unloadable + + belongs_to :publication + validates_presence_of :entry_type + + def entry_type_name + entry_type = self.entry_type + BibtexEntryType.find(entry_type).name + end + + def entry_type_label + entry_type = self.entry_type + BibtexEntryType.find(entry_type).label + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,35 @@ +class BibtexEntryType < ActiveRecord::Base + + @@all_fields = [ "editor", "publisher", "chapter", "pages", "volume", "series", "address", "edition", "month", "year", "type", "note", "number", "journal", "howpublished", "key", "school" ] + + @@fields = Hash['article', ['journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ], + 'book' , [ 'editor', 'publisher', 'volume', 'series', 'address', 'edition', 'month', 'year', 'note' ], + 'booklet' , [ 'howpublished', 'address', 'year', 'month', 'note', 'key' ], + 'conference', [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ], + 'inbook', [ 'editor', 'publisher', 'chapter', 'pages', 'volume', 'series', 'address', 'edition', 'year', 'note' ], + 'incollection', [ 'editor', 'publisher', 'chapter', 'pages', 'volume', 'series', 'address', 'edition', 'year', 'note' ], + 'inproceedings', [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ], + 'manual', [ 'organization', 'address', 'edition', 'month', 'year', 'note' ], + 'masterthesis', [ 'school', 'year', 'address', 'month', 'note' ], + 'misc', [ 'howpublished', 'month', 'year', 'note' ], + 'phdthesis', [ 'school', 'year', 'address', 'month', 'note' ], + 'proceedings', [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ], + 'techreport', [ 'year', 'type', 'number', 'address', 'month', 'note' ], + 'unpublished', [ 'note', 'month', 'year' ]] + + def redundant? + name == 'conference' # conference is a duplicate of inproceedings + end + + def label + l("field_bibtex_#{name}") + end + + def self.fields (type) + @@fields[ self.find(type).name ] + end + + def self.all_fields + @@all_fields + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,63 @@ +# vendor/plugins/redmine_bibliography/app/models/publication.rb + +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 + validates_length_of :authorships, :minimum => 1, :message => l("error_no_authors") + + 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 + # bibtex_entry.entry_type (#268). There has to be a better way to + # do this! + def self.human_attribute_name(k) + if k == 'bibtex_entry.entry_type' + l(:field_entry_type) + else + super + end + end + + 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) + 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,26 @@ +<h2><%=l(:label_authors_index)%></h2> + +<table class="list authors"> + <thead><tr> + <th><%=l(:field_author_name)%></th> + <th><%=l(:field_author_username)%></th> + <th><%=l(:field_author_publications)%></th> + </tr></thead> + <tbody> + + <% @authors.each do |author|%> + <tr id="author-<%= author.id %>" class="<%= cycle('odd', 'even') %>"> + <td class="title"> + <%= link_to_author author %> + </td> + <td class="username "> + <%= link_to author.user unless author.user.nil? %> + </td> + <td class="project"> + <%= render_author_publications(author) %> + </td> + </tr> + <% end %> + </tbody> +</table> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,24 @@ +<h2><%=l(:label_authors_show)%></h2> + +<div class="splitcontentleft"> + <table class="list authors"> + <thead> + <tr> + <th><%=l(:field_authorship_publication_title)%></th> + <th><%=l(:field_authorship_name)%></th> + <th><%=l(:field_authorship_email)%></th> + <th><%=l(:field_authorship_institution)%></th> + </tr> + </thead> + + <% @author.authorships.each do |authorship| %> + <tr id="authorship-<%= authorship.id %>" class="<%= cycle('odd', 'even') %>"> + <td class="title"><%= link_to_publication(authorship.publication) %></td> + <td class="name"><%= h authorship.name_on_paper %></td> + <td class="email"><%= h authorship.email %></td> + <td class="institution"><%= h authorship.institution %></td> + </tr> + <% end %> + </tbody> + </table> +</div> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/authorships/update.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +<h2>Authorships#update</h2>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +<%= l(:mail_body_publication_added, :publication => @publication.title, :project => @project.name) %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,2 @@ +<%= l(:mail_body_publication_added, :publication => @publication.title, :project => @project.name) %> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/my/blocks/_publications_box.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,30 @@ +<% get_my_publications %> + +<h3><%=l(:label_my_publications_box) %> <%= "(" + @my_publications.count.to_s + ")" %> </h3> + +<table class="list publications"> + <thead><tr> + <th><%=l(:field_publication_title)%></th> + <th><%=l(:field_publication_authors)%></th> + <th><%=l(:field_publication_projects)%></th> + </tr></thead> + <tbody> + + <% @my_publications.each do |publication|%> + <tr id="publication-<%= publication.id %>" class="<%= cycle('odd', 'even') %>"> + <td class="title"> + <%= link_to publication.title, publication %> + </td> + <td class="authors"> + <%= render_publications_authors(publication) %> + </td> + <td class="project"> + <%= render_publications_projects(publication) %> + </td> + </tr> + <% end %> + </tbody> +</table> + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,26 @@ +<% if @project.publications.any? %> +<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <div id="bibliography"> + <div class="box"> + <h3><%=l(:label_related_publication_plural)%></h3> + + <dl> + <% @project.publications.each do |publication| %> + <dt> + <%= link_to publication.title, :controller => 'publications', :action => 'show', :id => publication, :project_id => @project %> + </dt> + <dd> + <span class="authors"> + <%= publication.authorships.map { |a| h a.name_on_paper }.join(', ') %> + </span> + <% if publication.bibtex_entry.year.to_s != "" %> + <span class="year"> + <%= publication.bibtex_entry.year %> + </span> + <% end %> + </dd> + <% end -%> + </dl> + </div> +</div> +<% end %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/projects/show.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,119 @@ +<div class="contextual"> + <% if User.current.allowed_to?(:add_subprojects, @project) %> + <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %> + <% end %> + + <% if @project.module_enabled? :redmine_bibliography %> + <% if User.current.allowed_to?(:add_publication, @project) %> + <%= link_to l(:label_add_publication_to_project), {:controller => 'publications', :action => 'new', :project_id => @project}, :class => 'icon icon-add' %> + <% end %> + <% end %> +</div> + +<% if @project.has_welcome_page %> +<% page = @project.wiki.find_page("Overview") %> +<% end %> + +<% if page %> + +<% if @project.module_enabled? :wiki %> +<% if User.current.allowed_to?(:edit_wiki_pages, @project) %> +<div class="contextual"> +<%= link_to(l(:button_welcome_page_edit_this), {:controller => 'wiki', :action => 'edit', :project_id => @project, :id => Wiki.titleize("Overview")}, :class => 'icon icon-edit') %> +</div> +<% end %> +<% end %> + +<div class="contextual" style="clear: right"> +<ul> +<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %> +<% if @subprojects.any? %> + <li><%=l(:label_subproject_plural)%>: + <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li> +<% end %> +</ul> +</div> + +<%= render(:partial => "wiki/content", :locals => {:content => page.content_for_version()}) %> + +<% else %> + +<h2><%=l(:label_overview)%></h2> + +<div class="splitcontentleft"> + <div class="wiki"> + <%= textilizable @project.description %> + </div> + <ul> + <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %> + <% if @subprojects.any? %> + <li><%=l(:label_subproject_plural)%>: + <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li> + <% end %> + <% @project.visible_custom_field_values.each do |custom_value| %> + <% if !custom_value.value.blank? %> + <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> + <% end %> + <% end %> + </ul> + + <% if User.current.allowed_to?(:view_issues, @project) %> + <div class="issues box"> + <h3><%=l(:label_issue_tracking)%></h3> + <ul> + <% for tracker in @trackers %> + <li><%= link_to tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, + :set_filter => 1, + "tracker_id" => tracker.id %>: + <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, + :total => @total_issues_by_tracker[tracker].to_i) %> + </li> + <% end %> + </ul> + <p> + <%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %> + <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %> + | <%= link_to(l(:label_calendar), :controller => 'calendars', :action => 'show', :project_id => @project) %> + <% end %> + <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> + | <%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %> + <% end %> + </p> + </div> + <% end %> + <%= call_hook(:view_projects_show_left, :project => @project) %> +</div> + +<div class="splitcontentright"> + + <%= render :partial => 'bibliography_box' %> + + <%= render :partial => 'members_box' %> + + <% if @news.any? && authorize_for('news', 'index') %> + <div class="news box"> + <h3><%=l(:label_news_latest)%></h3> + <%= render :partial => 'news/news', :collection => @news %> + <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p> + </div> + <% end %> + <%= call_hook(:view_projects_show_right, :project => @project) %> +</div> + +<% content_for :sidebar do %> + <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %> + <h3><%= l(:label_spent_time) %></h3> + <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> + <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | + <%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %></p> + <% end %> + <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> +<% end %> + +<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %> +<% end %> + +<% html_title(l(:label_overview)) -%>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_add_project_form.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,29 @@ +<% form_remote_for(:publication, + :url => {:controller => 'publications', :action => 'add_project', :id => @publication, :project_id => @project}, + :method => :post, + :html => { :id => 'add_project_form' }, + :loading => "$('project-add-submit').disable()", + :complete => "$('project-add-submit').enable()") do |f| %> + <fieldset><legend><%=l(:label_add_project_to_publication)%></legend> + <p> + <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %> + </p> + + <%= observe_field(:project_search, + :frequency => 0.5, + :update => :projects, + :url => { :controller => 'publications', :action => 'autocomplete_for_project', :id => @publication }, + :with => 'q') + %> + + <div id="projects"> + <% if params[:q] && params[:q].length > 1 %> + <%= projects_check_box_tags 'project[project_ids][]', @projects %> + <% end %> + </div> + + <p><%= submit_tag l(:button_add), :id => 'project-add-submit' %></p> + + + </fieldset> + <% end %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,59 @@ +<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + + +<div id="authors" class="fields"> +<!-- <h4><%= l("label_author_1") %></h4> --> + + <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> > + <p> + <%= f.text_field :search_name, :size => 25 %> + <%= observe_field( form_tag_id(f.object_name, :search_name), :frequency => 0.5, :update => form_tag_id( f.object_name, :search_results), :url => { :controller => 'publications', :action => 'autocomplete_for_author', :object_name => form_object_id(f.object_name) }, :with => 'q' ) %> + </p> + <%# link_to_function l(:label_author_is_me), "update_author_info(this," + User.current.get_author_info.to_json + ")", :id => "add_me_as_author" %> + + <p> + <%= f.select :search_results, options_for_select(@author_options), {}, {:size => 5, + :onChange => remote_function( :url => { :controller => :publications, :action => :get_user_info, :object_id => form_object_id(f.object_name) }, :with => "'value=' + + value" )} %> + </p> + + <p style="margin-bottom: -2.5em; padding-bottom; 0"><label><%= l(:identify_author_question) %></label></p> + <p class="author_identify"> + <label class='inline'><%= radio_button_tag(:identify_author, "yes", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_yes ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_yes) %> </label><br /> + + <label class='inline'><%= radio_button_tag(:identify_author, "correct", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_corrections ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_correct) %> </label><br /> + + <label class='inline'><%= radio_button_tag(:identify_author, "no", true, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_no ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_no) %> </label><br /> + </p> + </div> + + <div class='author_edit' id="<%= form_tag_id( f.object_name, :edit_author_info ) %>"> + <p> + <%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_name_on_paper") %></p> + <p><%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></p> + <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p> + </p> + </div> + + + <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none"> + + </div> + + <p> + + <% if params[:action] == 'new' %> + <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + <% else %> +<%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + + <% end %> + + + <%= link_to_remove_fields l("remove_author"), f %> + </p> +</div> +<br/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,80 @@ +<p> + <label for="bibtex_entry_type"><%=l("field_entry_type")%> <span class="required">*</span></label> + <%= f.collection_select :entry_type, + BibtexEntryType.find(:all).reject { |x| x.redundant? }, + :id, + :label, + { :selected => @selected_bibtex_entry_type_id, :prompt => true }, + :onChange => remote_function( :url => { :controller => :publications, :action => :get_bibtex_required_fields}, :with => "'value=' + value" ) + %> +</p> +<p> + <%= f.text_field :year, :size => 4, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :month, :size => 4, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :chapter, :size => 15, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :editor, :size => 33, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :booktitle, :size => 33, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :publisher,:size => 33, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :pages, :size => 12, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :address, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :annote, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :crossref, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :edition, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :eprint, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :howpublished, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :journal, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :key, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :note, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :number, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :organization, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :school, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :series, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :type, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :url, :class => 'bibtex' %> +</p> +<p> + <%= f.text_field :volume, :class => 'bibtex' %> +</p> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,31 @@ +<%= f.error_messages %> + +<h3><%= f.text_field :title, :required => true, :size => 70 %></h3> + +<div class="splitcontentleft"> + <h3><%= l(:label_publication_other_details) %></h3> + <div class="box tabular"> + <% f.fields_for :bibtex_entry do |builder| -%> + <%= render :partial => 'bibtex_fields', :locals => { :f => builder} %> + <%- end -%> + + <p> + <%= f.text_field :external_url, :size => 70 %> + <br /> + <em><%= l(:text_external_url) %></em> + </p> + + </div> +</div> + +<div class="splitcontentright"> + <h3><%= l(:authors) %></h3> + <div class="box tabular"> + <% f.fields_for :authorships do |builder| -%> + <%= render "authorship_fields", :f => builder %> + <%- end -%> + <%= link_to_add_fields l(:label_add_an_author), f, :authorships %> + </div> +</div> + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_identify_author_form.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,25 @@ +<legend><%= "Identify Authors in the system…" %></legend> + +<%= link_to_remote "It's me!", + { :url => { :controller => 'publications', + :action => 'add_me_as_author', + :project_id => @project }, :method => 'post'}, + { :class => 'icon icon-add', :id => "add_me_as_author" } %> + +<p> + <%= label_tag "author_search", l(:label_project_search) %><%= text_field_tag 'author_search', nil %> +</p> + +<%= observe_field( form_tag_id(f.object_name, :name), + :frequency => 0.5, + :update => :identify_author, + :url => { :controller => 'publications', :action => 'autocomplete_for_author' }, + :with => 'q') +%> + +<div id="identify_author"> + <% if params[:q] && params[:q].length > 1 %> + <%= select_author_links 'author[author_ids][]', @authors %> + <% end %> +</div> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +<%= render_projects_list(@publication) %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,9 @@ +<h3>New Bibtex</h3> + +<h4>Paste your Bibtex entries here</h4> +<p> + <%=label_tag :bibtex_entry %> + <%=text_area_tag :bibtex_entry%> +</p> + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_review_bibtex_step.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,2 @@ +<h2>Review new entries</h2> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/add_project.rjs Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +page.replace_html :list_projects, :partial => 'list_projects' +page[:add_project_form].reset +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,4 @@ +<% if params[:q] && params[:q].length > 1 %> + <%= choose_author_link @object_name, @results %> +<% end %> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_project.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +<% if params[:q] && params[:q].length > 1 %> + <%= projects_check_box_tags 'publication[project_ids][]', @projects %> +<% end %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/create.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +<h2>Publications#create</h2>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,18 @@ +<% content_for :header_tags do %> + <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_tag 'Event.observe(window, "load", function(e){show_all_required_bibtex_fields(' + @bibtype_fields.to_json + ')});' %> +<% end %> + +<h2><%=l(:label_publication_show)%></h2> + +<% form_for @publication, :url => { :project_id => @project, :action => :update }, :builder => TabularFormBuilder do |f| -%> + <%= render :partial => 'form', :locals => { :f => f } %> + + <div style="clear:both"></div> + <%= f.submit %> +<% end %> +<p> + <%= link_to l(:label_publication_show), { :controller => "publications", :action => "show", :id => @publication, :project_id => @project_id } %> | + <%= link_to l(:label_publication_index), { :controller => "publications", :action => "index", :project_id => @project } %> +</p>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/import.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,12 @@ +<h1>New Publication</h1> + +<% form_for @publication, :url => { :action => "create" } do |f| %> + <% f.error_messages %> + + <%= render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %> + + <p><%= f.submit "Submit" %></p> + <p><%= f.submit "Back", :name => "back_button" unless @publication.first_step? %></p> + +<% end %> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,42 @@ +<div class="contextual"> + <% if User.current.allowed_to?(:add_publication, @project) %> + <%= link_to l(:label_publication_new), {:controller => 'publications', :action => 'new', :project_id => @project}, :class => 'icon icon-add' %> + <% end %> +</div> + + <% if @project %> + <h3><%= l(:label_all_publications_for_project, :project => @project.name) %></h3> + <% else %> + <h3><%= l(:label_all_publications) %></h3> + <% end %> + + <div class="autoscroll"> + <table class="list publications"> + <thead><tr> + <th><%= l(:title) %></th> + <th><%= l(:authors) %></th> + <th><%= l(:year) %></th> + </tr></thead> + + <% @publications.each do |publication| %> + <tr class="<%= cycle('odd', 'even') %>"> + <td class="firstcol title" align="top"><%= link_to publication.title, :controller => "publications", :action => "show", :id => publication, :project_id => @project %></td> + <td class="authors" align="top"> + <% publication.authorships.each do |authorship| %> + <%# if authorship.author.user.nil? || !authorship.author.user.active? %> + <%= h authorship.name_on_paper %> + <%# else %> + <%#= link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user) %> + <%# end %> + + <em><%= authorship.institution %></em><br/> + <% end %> + <td class="year"><%= publication.bibtex_entry.year %></td> + </tr> + <% end %> + </table> + </div> + +<% content_for :sidebar do %> +<% end %> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,13 @@ +<% content_for :header_tags do %> + <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_tag 'Event.observe(window, "load", hide_all_bibtex_required_fields);' %> +<% end %> + +<h2><%=l(:label_publication_new)%></h2> + +<% form_for @publication, :url => { :project_id => @project, :action => :create }, :builder => TabularFormBuilder do |f| -%> + <%= render :partial => 'form', :locals => { :f => f } %> + <div style="clear:both"></div> + <%= f.submit %> +<% end %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,60 @@ +<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + +<h2><%=l(:label_publication_show)%></h2> + +<div class="box"> +<h3> + <%= h @publication.title %> +</h3> + +<h4><%= l(:authors) %></h4> +<ul id="authorships"> + <% for authorship in @publication.authorships.find(:all, :order => :auth_order) %> + <% content_tag_for :li, authorship do %> + <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> + <span class="handle">[drag to reorder]</span> + <%- end -%> + <%= h authorship.name_on_paper %> <em><%= h authorship.institution %></em> <br /> + <%- end -%> + <%- end -%> +</ul> +<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> + <%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %> +<%- end -%> + +<%- if @publication.bibtex_entry != nil -%> + <%= show_bibtex_fields(@publication.bibtex_entry) %> +<%- end -%> + + +<% unless @publication.external_url.blank? %> + <h4> + <%= l(:field_external_url) %> + </h4> + <p> + <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} %> + </p> +<% end %> + +<br / > + <% if User.current.allowed_to?(:add_publication, @project) %> + <%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> | + <%= link_to "Delete", {:controller => 'publications', :action => 'destroy', :id => @publication, :project_id => @project }, + :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %> | + <% end %> + <%= link_to l(:view_all_publications), {:controller => 'publications', :action => 'index', :project_id => @project } %> +</div> + +<% projects = Project.active.find(:all, :limit => 100, :order => 'name ASC') - @publication.projects %> + +<% content_for :sidebar do %> + <h3><%=l(:label_publication_project_index)%></h3> + + <p id="list_projects"> + <%= render :partial => 'list_projects' %> + </p> + + <%- if User.current.allowed_to?(:edit_publication, @project) -%> + <%= render :partial => 'add_project_form' %> + <%- end -%> +<% end %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/update.html.erb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,1 @@ +<h2>Publications#update</h2>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/settings/_bibliography.rhtml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +<p><label>Menu caption</label> +<%= text_field_tag 'settings[menu]', @settings['menu'], :size => 30 %> +<br /><em>Clear this field if you don't want to add a tab to the project menu</em></p>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,72 @@ +function remove_fields(link) { + $(link).previous("input[type=hidden]").value = "1"; + $(link).up(".fields").hide(); +} + +function add_fields(link, association, content) { + var new_id = new Date().getTime(); + var regexp = new RegExp("new_" + association, "g") + $(link).insert({ + before: content.replace(regexp, new_id) + }); +} + +function identify_author_status(status, object_id) { + $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) { + if(status == "no"){ + s.value = ""; + s.readOnly = false; + }; + + if(status == "correct"){s.readOnly = false;}; + if(status == "yes"){s.readOnly = true;}; + }); +} + +function toggle_div(div_id){ + Effect.toggle(div_id, "appear", {duration:0.3}); +} + +function toggle_input_field(field){ + if (field.classNames().inspect().include("readonly") == false){ + field.readOnly = true; + field.addClassName('readonly'); + } else { + field.readOnly = false; + field.removeClassName('readonly'); + }; +} + +function toggle_edit_save_button(object_id){ + $button = $('publication_authorships_attributes_' + object_id + '_edit_save_button'); + if ($button.value == "Edit author"){ + $button.value = "Save author"; + } else { + $button.value = "Edit author"; + }; +} + +function toggle_save_author(form_object_id, $this){ + $('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('input').each(function(s) { + toggle_input_field(s, $this); + }); + $('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('p.description').each(function(s) { + s.toggle(); + }); + toggle_edit_save_button(form_object_id); + toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author"); +} + +function edit_author(form_object_id){} + +function hide_all_bibtex_required_fields() { + $$('input.bibtex').each(function(s){ + s.up('p').hide(); + })} + +function show_all_required_bibtex_fields(entrytype_fields) { + $$('input.bibtex').each(function(s){ + if(entrytype_fields.indexOf(s.id.split('_').last()) == -1){s.up('p').hide()}; + }) +} + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,45 @@ +li .handle { + font-size: 12px; + cursor: move; + color: #777; +} + +input.readonly { + border: none; + padding: 0; + margin: 0; + background-color: transparent; +} + +.tabular .author_identify label { + font-weight: normal; +} + +.tabular .author_edit p { + padding-bottom: 0; +} + +.tabular .author_edit .description { + padding-top: 0; + font-style: italic; +} + +.publication_project { + margin-right: 18px; +} + +#authors select { + 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 .authors { 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; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,148 @@ +# English strings go here for Rails i18n +en: + project_module_redmine_bibliography: Bibliography + + title: "Title" + authors: "Authors" + author: "Author" + name: "Name" + year: "Year" + publications_box: "My Publications" + label_my_publications_box: "My Publications" + view_all_publications: "View All Project's 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" + identify_author_no: "No, the author was not found in the search" + + error_no_authors: "Please add at least one author to this publication." + + label_all_publications: All Publications + label_all_publications_for_project: Publications associated with %{project} + label_authors_show: "Authorships by this author" + label_authors_index: "List of authors" + + field_authorship_publication_title: "Publication Title" + field_authorship_name: "Name" + field_authorship_email: "Email Address" + field_authorship_institution: "Institution" + + field_external_url: "External URL" + 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_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" + label_add_another_author: "Add another author" + field_search_name: "Search by name" + field_search_results: "" + label_save_author: "Save author" + label_edit_author: "Edit author" + 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" + label_publication_index: "List of Publication" + label_add_publication_to_project: "Add publication to this project" + label_publication_edit: "Edit Publication" + label_publication_show: "Publication Details" + label_add_project_to_publication: "Add this publication to a project" + label_project_search: "Find project by name: " + 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_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_email: "Email Address" + + # bibtex_entries model + field_entry_type: "Publication Type" + field_id: "id" + field_publication_id: "Publication_id" + field_address: "Address" + field_annote: "Annote" + field_booktitle: "Book Title" + field_chapter: "Chapter" + field_crossref: "Cross Reference" + field_edition: "Edition" + field_editor: "Editor" + field_eprint: "eprint" + field_howpublished: "How was it Published" + field_journal: "Journal" + field_key: "Key" + field_month: "Month" + field_note: "Note" + field_number: "Number" + field_organization: "Organization" + field_pages: "Pages" + field_publisher: "Publisher" + field_school: "School" + field_series: "Series" + field_type: "Type" + field_url: "URL" + field_volume: "Volume" + field_year: "Year" + + field_bibtex_article: Journal article + field_bibtex_book: Book + field_bibtex_booklet: Booklet + field_bibtex_conference: Article in conference proceedings + field_bibtex_inbook: Book chapter or part + field_bibtex_incollection: Part of a collection + field_bibtex_inproceedings: Article in conference proceedings + field_bibtex_manual: Technical manual + field_bibtex_masterthesis: "Master's thesis" + field_bibtex_misc: Other + field_bibtex_phdthesis: "PhD thesis" + 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 + label_author_4: Fourth author + label_author_5: Fifth author + label_author_6: Sixth author + label_author_7: Seventh author + label_author_8: Eighth author + label_author_9: Ninth author + label_author_10: Tenth author + label_author_11: Eleventh author + label_author_12: Twelfth author + label_author_13: Thirteenth author + label_author_14: Fourteenth author + label_author_15: Fifteenth author + label_author_16: Sixteenth author + label_author_17: Seventeenth author + label_author_18: Eighteenth author + label_author_19: Nineteenth author + label_author_20: Twentieth author + + 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}.'" + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/config/routes.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,3 @@ +ActionController::Routing::Routes.draw do |map| + map.resources :publications, :collection => { :sort_author_order => :post } +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/001_create_authors.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,12 @@ +class CreateAuthors < ActiveRecord::Migration + def self.up + create_table :authors do |t| + t.column :user_id, :integer + t.column :name, :string + end + end + + def self.down + drop_table :authors + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/002_create_publications.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,12 @@ +class CreatePublications < ActiveRecord::Migration + def self.up + create_table :publications do |t| + t.column :title, :string + t.column :reviewed, :boolean, :default => false + end + end + + def self.down + drop_table :publications + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/003_create_authorships.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,16 @@ +class CreateAuthorships < ActiveRecord::Migration + def self.up + create_table :authorships do |t| + t.column :author_id, :integer + t.column :publication_id, :integer + t.column :name_on_paper, :string + t.column :auth_order, :integer + t.column :institution, :string + t.column :email, :string + end + end + + def self.down + drop_table :authorships + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/004_create_bibtex_entries.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,35 @@ +class CreateBibtexEntries < ActiveRecord::Migration + def self.up + create_table :bibtex_entries do |t| + t.column :publication_id, :integer + t.column :entry_type, :integer + t.column :address, :string + t.column :annote, :string + t.column :booktitle, :string + t.column :chapter, :string + t.column :crossref, :string + t.column :edition, :string + t.column :editor, :string + t.column :eprint, :string + t.column :howpublished, :string + t.column :journal, :string + t.column :key, :string + t.column :month, :string + t.column :note, :text + t.column :number, :string + t.column :organization, :string + t.column :pages, :string + t.column :publisher, :string + t.column :school, :string + t.column :series, :string + t.column :type, :string + t.column :url, :string + t.column :volume, :integer + t.column :year, :integer + end + end + + def self.down + drop_table :bibtex_entries + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/005_create_projects_publications_join_table.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,12 @@ +class CreateProjectsPublicationsJoinTable < ActiveRecord::Migration + def self.up + create_table :projects_publications, :id => false do |t| + t.integer :project_id + t.integer :publication_id + end + end + + def self.down + drop_table :projects_publications + end +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/006_create_bibtex_entry_types.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,13 @@ +class CreateBibtexEntryTypes < ActiveRecord::Migration + def self.up + create_table :bibtex_entry_types do |t| + t.string :name + + t.timestamps + end + end + + def self.down + drop_table :bibtex_entry_types + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/migrate/007_add_external_url_column_to_publications.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,9 @@ +class AddExternalUrlColumnToPublications < ActiveRecord::Migration + def self.up + add_column :publications, :external_url, :string + end + + def self.down + remove_column :publications, :external_url + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,14 @@ +inproceedings +conference +article +masterthesis +phdthesis +book +booklet +inbook +incollection +manual +techreport +proceedings +unpublished +misc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,51 @@ +require 'redmine' +require 'dispatcher' + +RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' + +# Patches to the Redmine core. +Dispatcher.to_prepare :redmine_model_dependencies do + require_dependency 'project' + require_dependency 'user' + require_dependency 'mailer' + + unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch + Project.send(:include, Bibliography::ProjectPublicationsPatch) + end + + unless User.included_modules.include? Bibliography::UserAuthorPatch + User.send(:include, Bibliography::UserAuthorPatch) + end + + unless Mailer.included_modules.include? Bibliography::MailerPatch + Mailer.send(:include, Bibliography::MailerPatch) + end + + +end + + +# Plugin Info +Redmine::Plugin.register :redmine_bibliography do + name 'Redmine Bibliography plugin' + author 'Chris Cannam, Luis Figueira' + description 'This is a bibliography management plugin for Redmine' + version '0.0.1' + url 'http://example.com/path/to/plugin' + author_url 'http://example.com/about' + + settings :default => { 'menu' => 'Bibliography' }, :partial => 'settings/bibliography' + + project_module :redmine_bibliography do + 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? } + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lang/en.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,2 @@ +# English strings go here +my_label: "My label"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,31 @@ +require_dependency 'mailer' + +module Bibliography + module MailerPatch + def self.included(base) # :nodoc: + + # Builds a tmail object used to email the specified user that a publication was created and the user is + # an author of that publication + # + # Example: + # publication_added(user) => tmail object + # Mailer.deliver_add_to_project(user) => sends an email to the registered user + def publication_added(user, publication, project) + + @publication = publication + @project = project + + set_language_if_valid user.language + recipients user.mail + subject l(:mail_subject_publication_added, Setting.app_title) + body :publication_url => url_for( :controller => 'publications', :action => 'show', :id => publication.id ), + :publication_title => publication.title + + render_multipart('publication_added', body) + + end + + + end + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,25 @@ +require_dependency 'project' + +module Bibliography + module ProjectPublicationsPatch + def self.included(base) + base.class_eval do + has_and_belongs_to_many :publications, :uniq => true + + named_scope :like, lambda {|q| + s = "%#{q.to_s.strip.downcase}%" + {:conditions => ["LOWER(name) LIKE :s OR LOWER(homepage) LIKE :s", {:s => s}], + :order => 'name' + } + } + end + end #self.included + + module ProjectMethods + + + + + end #ProjectMethods + end #ProjectPublicationsPatch +end #RedmineBibliography \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,45 @@ +require_dependency 'user' + +module Bibliography + module UserAuthorPatch + def self.included(base) + base.send(:include, InstanceMethods) + extend ClassMethods + + end #self.included + + module ClassMethods + end + + module InstanceMethods + + def institution + unless self.ssamr_user_detail.nil? + institution_name = self.ssamr_user_detail.institution_name + else + institution_name = "No Institution Set" + end + return institution_name + end + + def get_author_info + # TODO: DELETE THIS METHOD?? + info = { + :name_on_paper => self.name, + :email => self.mail, + :institution => "", + :author_user_id => self.id, + :is_user => "1" + } + + if not self.ssamr_user_detail.nil? + info[:institution] = self.ssamr_user_detail.institution_name + end + + return info + end + + end #InstanceMethods + + end #UserPublicationsPatch +end #RedmineBibliography
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/tasks/seed_bibtex_entry_types.rake Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,20 @@ +namespace :redmine do + namespace :plugins do + namespace :redmine_bibliography do + + task :seed_bibtex_entry_types => :environment do + desc "Seeds the Bibtex Entry Types Table" + + quoted = ActiveRecord::Base.connection.quote_table_name('bibtex_entry_types') + ActiveRecord::Base.connection.execute("TRUNCATE #{quoted}") + + open(File.dirname(__FILE__) + "/../../db/seed_data/bibtex_entry_types_list.txt") do |bibtex_entry_types| + bibtex_entry_types.read.each_line do |bibtex_entry_type| + BibtexEntryType.create(:name => bibtex_entry_type.chomp) + end + end + end + + end + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/fixtures/authors.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,17 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 + user_id: + name: MyString +two: + id: 2 + user_id: + name: MyString +one: + id: 3 + user_id: + name: MyString +two: + id: 4 + user_id: + name: MyString
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/fixtures/authorships.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,33 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 + author_id: 1 + publication_id: 1 + name_on_paper: Yih-Farn R. Chen + order: 1 + institution: + email: MyString +two: + id: 2 + author_id: 2 + publication_id: 1 + name_on_paper: Glenn S. Fowler + order: 2 + institution: + email: MyString +three: + id: 3 + author_id: 1 + publication_id: 1 + name_on_paper: Yih-Farn R. Chen + order: 1 + institution: + email: MyString +four: + id: 4 + author_id: 2 + publication_id: 1 + name_on_paper: Glenn S. Fowler + order: 2 + institution: + email: MyString
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/fixtures/bibtex_entries.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,6 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 + entry_type: InProceedings + booktitle: International Conference on Software Maintenance + year: 1995
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/fixtures/publications.yml Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 + title: Test Fixture Title No1 + bibtex_entry_id: 1 +two: + id: 2 + title: MyString + bibtex_entry_id: MyString
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/functional/authors_controller_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,8 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AuthorsControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/functional/authorships_controller_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,8 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AuthorshipsControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/functional/publications_controller_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,8 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class PublicationsControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/test_helper.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,24 @@ +# Load the normal Rails helper +require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper') +require 'publications_controller' + +# Ensure that we are using the temporary fixture path +Engines::Testing.set_fixture_path + +class BibliographyControllerTest < ActionController::TestCase + fixtures :all + + def setup + end + + def test_publication + + end + + + def test_routing + assert_routing( + {:method => :get, :path => '/requirements'}, + :controller => 'requirements', :action => 'index' + ) + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/unit/author_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AuthorTest < ActiveSupport::TestCase + fixtures :authors + + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/unit/authorship_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AuthorshipTest < ActiveSupport::TestCase + fixtures :authorships + + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/unit/bibtex_entry_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class BibtexEntryTest < ActiveSupport::TestCase + fixtures :bibtex_entries + + # Replace this with your real tests. + def test_truth + assert true + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/test/unit/publication_test.rb Fri Sep 16 15:51:18 2011 +0100 @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class PublicationTest < ActiveSupport::TestCase + fixtures :publications + + # Replace this with your real tests. + def test_truth + assert true + end +end