To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / plugins / redmine_bibliography / lib / bibliography / user_author_patch.rb @ 1069:734fe0c6b3e4
History | View | Annotate | Download (1.07 KB)
| 1 |
require_dependency 'user'
|
|---|---|
| 2 |
|
| 3 |
module Bibliography |
| 4 |
module UserAuthorPatch |
| 5 |
def self.included(base) |
| 6 |
base.send(:include, InstanceMethods) |
| 7 |
extend ClassMethods
|
| 8 |
|
| 9 |
end #self.included |
| 10 |
|
| 11 |
module ClassMethods |
| 12 |
end
|
| 13 |
|
| 14 |
module InstanceMethods |
| 15 |
|
| 16 |
def institution |
| 17 |
unless self.ssamr_user_detail.nil? |
| 18 |
institution_name = self.ssamr_user_detail.institution_name
|
| 19 |
else
|
| 20 |
institution_name = "No Institution Set"
|
| 21 |
end
|
| 22 |
return institution_name
|
| 23 |
end
|
| 24 |
|
| 25 |
def get_author_info |
| 26 |
# TODO: DELETE THIS METHOD??
|
| 27 |
info = {
|
| 28 |
:name_on_paper => self.name, |
| 29 |
:email => self.mail, |
| 30 |
:institution => "", |
| 31 |
:author_user_id => self.id, |
| 32 |
:is_user => "1" |
| 33 |
} |
| 34 |
|
| 35 |
if not self.ssamr_user_detail.nil? |
| 36 |
info[:institution] = self.ssamr_user_detail.institution_name |
| 37 |
end
|
| 38 |
|
| 39 |
return info
|
| 40 |
end
|
| 41 |
|
| 42 |
end #InstanceMethods |
| 43 |
|
| 44 |
end #UserPublicationsPatch |
| 45 |
end #RedmineBibliography |