Revision 1081:b56a4c5afa35
| .hgignore | ||
|---|---|---|
| 35 | 35 |
Gemfile.lock |
| 36 | 36 |
Gemfile.local |
| 37 | 37 |
|
| 38 |
re:^config\.ru$ |
|
| app/controllers/projects_controller.rb | ||
|---|---|---|
| 111 | 111 |
end |
| 112 | 112 |
# end of code to be removed |
| 113 | 113 |
|
| 114 |
|
|
| 115 |
if validate_parent_id && @project.save |
|
| 114 |
if validate_is_public_key && validate_parent_id && @project.save |
|
| 116 | 115 |
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
| 117 | 116 |
# Add current user as a project member if he is not admin |
| 118 | 117 |
unless User.current.admin? |
| ... | ... | |
| 300 | 299 |
render_404 |
| 301 | 300 |
end |
| 302 | 301 |
|
| 302 |
def validate_is_public_key |
|
| 303 |
# Although is_public isn't mandatory in the project model (it gets |
|
| 304 |
# defaulted), it must be present in params -- it can be true or |
|
| 305 |
# false, but it must be there. This permits us to make forms in |
|
| 306 |
# which the user _has_ to select public or private (rather than |
|
| 307 |
# defaulting it) if we want to |
|
| 308 |
if params.nil? || params[:project].nil? || !params[:project].has_key?(:is_public) |
|
| 309 |
@project.errors.add :is_public, :public_or_private |
|
| 310 |
return false |
|
| 311 |
end |
|
| 312 |
true |
|
| 313 |
end |
|
| 314 |
|
|
| 303 | 315 |
# Validates parent_id param according to user's permissions |
| 304 | 316 |
# TODO: move it to Project model in a validation that depends on User.current |
| 305 | 317 |
def validate_parent_id |
| app/views/activities/_busy.html.erb | ||
|---|---|---|
| 1 | 1 |
<% events = @events_by_day %> |
| 2 | 2 |
<% if (events.nil?) |
| 3 |
activity = Redmine::Activity::Fetcher.new(User.current)
|
|
| 3 |
activity = Redmine::Activity::Fetcher.new(User.anonymous)
|
|
| 4 | 4 |
events = activity.events(Date.today - 14, Date.today + 1) |
| 5 | 5 |
end |
| 6 | 6 |
%> |
| app/views/activities/_busy_institution.html.erb | ||
|---|---|---|
| 1 | 1 |
<% events = @events_by_day %> |
| 2 | 2 |
<% if (events.nil?) |
| 3 |
activity = Redmine::Activity::Fetcher.new(User.current) |
|
| 4 |
events = activity.events(Date.today - 14, Date.today + 1) |
|
| 3 |
activity = Redmine::Activity::Fetcher.new(User.anonymous) |
|
| 4 |
days = Setting.activity_days_default.to_i |
|
| 5 |
events = activity.events(Date.today - days, Date.today + 1) |
|
| 5 | 6 |
end |
| 6 | 7 |
%> |
| 7 | 8 |
|
| ... | ... | |
| 24 | 25 |
<% end %> |
| 25 | 26 |
</ul> |
| 26 | 27 |
<% end %> |
| 28 |
|
|
| app/views/projects/_form.html.erb | ||
|---|---|---|
| 21 | 21 |
<br /> |
| 22 | 22 |
<em> <%= l(:text_project_homepage_info) %></em> |
| 23 | 23 |
</p> |
| 24 |
<p><%= f.check_box :is_public %> |
|
| 24 |
<p> |
|
| 25 |
<%= label(:project, :is_public_1, l(:field_public_or_private) + content_tag("span", " *", :class => "required")) %>
|
|
| 26 |
<% |
|
| 27 |
# if the project hasn't been created fully yet, then we don't |
|
| 28 |
# want to set either public or private (make the user decide) |
|
| 29 |
initialised = !@project.id.nil? |
|
| 30 |
%> |
|
| 31 |
<%= f.radio_button :is_public, 1, :checked => (initialised && @project.is_public?) %> |
|
| 32 |
<%= l(:text_project_public_info) %> |
|
| 25 | 33 |
<br /> |
| 26 |
<em> <%= l(:text_project_visibility_info) %></em> |
|
| 34 |
<%= f.radio_button :is_public, 0, :checked => (initialised && !@project.is_public?) %> |
|
| 35 |
<%= l(:text_project_private_info) %> |
|
| 36 |
<br> |
|
| 37 |
<em><%= l(:text_project_visibility_info) %></em> |
|
| 27 | 38 |
</p> |
| 28 | 39 |
<%= wikitoolbar_for 'project_description' %> |
| 29 | 40 |
|
| app/views/projects/_members_box.html.erb | ||
|---|---|---|
| 1 | 1 |
<% if @users_by_role.any? %> |
| 2 |
<div class="members box">
|
|
| 2 |
<div id="memberbox"><div class="box">
|
|
| 3 | 3 |
<h3><%=l(:label_member_plural)%></h3> |
| 4 | 4 |
<p><% @users_by_role.keys.sort.each do |role| %> |
| 5 | 5 |
<%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %><br />
|
| 6 | 6 |
<% end %></p> |
| 7 |
</div> |
|
| 7 |
</div></div>
|
|
| 8 | 8 |
<% end %> |
| app/views/projects/explore.html.erb | ||
|---|---|---|
| 1 |
<% content_for :header_tags do %> |
|
| 2 |
<%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> |
|
| 3 |
<% end %> |
|
| 1 | 4 |
|
| 5 |
<% cache(:action => 'explore', :action_suffix => 'tags', :expires_in => 1.hour) do %> |
|
| 2 | 6 |
<h2><%= l(:label_explore_projects) %></h2> |
| 3 |
|
|
| 4 | 7 |
<div class="tags box"> |
| 5 | 8 |
<h3><%=l(:label_project_tags_all)%></h3> |
| 6 | 9 |
<%= render :partial => 'projects/tagcloud' %> |
| 7 | 10 |
</div> |
| 11 |
<% end %> |
|
| 12 |
|
|
| 8 | 13 |
<div class="splitcontentleft"> |
| 14 |
<% cache(:action => 'explore', :action_suffix => 'busy_institutions', :expires_in => 1.hour) do %> |
|
| 9 | 15 |
<div class="institutions box"> |
| 10 | 16 |
<h3><%=l(:label_institutions_busy)%></h3> |
| 11 | 17 |
<%= render :partial => 'activities/busy_institution' %> |
| 12 | 18 |
</div> |
| 19 |
<% end %> |
|
| 13 | 20 |
<div class="projects box"> |
| 14 | 21 |
<h3><%=l(:label_project_latest)%></h3> |
| 15 | 22 |
<%= render :partial => 'projects/latest' %> |
| 16 | 23 |
</div> |
| 17 | 24 |
</div> |
| 18 | 25 |
<div class="splitcontentright"> |
| 26 |
<% cache(:action => 'explore', :action_suffix => 'busy_projects', :expires_in => 1.hour) do %> |
|
| 19 | 27 |
<div class="projects box"> |
| 20 | 28 |
<h3><%=l(:label_projects_busy)%></h3> |
| 21 | 29 |
<%= render :partial => 'activities/busy' %> |
| 22 | 30 |
</div> |
| 31 |
<% end %> |
|
| 23 | 32 |
</div> |
| app/views/projects/new.html.erb | ||
|---|---|---|
| 3 | 3 |
<% labelled_tabular_form_for @project do |f| %> |
| 4 | 4 |
<%= render :partial => 'form', :locals => { :f => f } %>
|
| 5 | 5 |
<%= submit_tag l(:button_create) %> |
| 6 |
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> |
|
| 7 | 6 |
<%= javascript_tag "Form.Element.focus('project_name');" %>
|
| 8 | 7 |
<% end %> |
| config/environment.rb | ||
|---|---|---|
| 36 | 36 |
|
| 37 | 37 |
# Enable page/fragment caching by setting a file-based store |
| 38 | 38 |
# (remember to create the caching directory and make it readable to the application) |
| 39 |
# config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
|
|
| 39 |
config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
|
|
| 40 |
|
|
| 41 |
# And for direct uses of the cache |
|
| 42 |
config.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
|
|
| 40 | 43 |
|
| 41 | 44 |
# Activate observers that should always be running |
| 42 | 45 |
# config.active_record.observers = :cacher, :garbage_collector |
| config/locales/en.yml | ||
|---|---|---|
| 130 | 130 |
circular_dependency: "This relation would create a circular dependency" |
| 131 | 131 |
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" |
| 132 | 132 |
must_accept_terms_and_conditions: "You must accept the Terms and Conditions" |
| 133 |
public_or_private: "You must select either public or private" |
|
| 133 | 134 |
|
| 134 | 135 |
actionview_instancetag_blank_option: Please select |
| 135 | 136 |
|
| ... | ... | |
| 328 | 329 |
field_root_directory: Root directory |
| 329 | 330 |
field_cvsroot: CVSROOT |
| 330 | 331 |
field_cvs_module: Module |
| 332 |
field_public_or_private: "Public or Private?" |
|
| 331 | 333 |
|
| 332 | 334 |
setting_external_repository: "Select this if the project's main repository is hosted somewhere else" |
| 333 | 335 |
setting_external_repository_url: "The URL of the existing external repository. Must be publicly accessible without a password" |
| ... | ... | |
| 546 | 548 |
label_home: Home |
| 547 | 549 |
label_home_heading: Welcome! |
| 548 | 550 |
label_my_page: My page |
| 549 |
label_my_account: My account
|
|
| 551 |
label_my_account: Account
|
|
| 550 | 552 |
label_my_projects: My projects |
| 551 | 553 |
label_my_page_block: My page block |
| 552 | 554 |
label_administration: Administration |
| ... | ... | |
| 891 | 893 |
button_expand_all: Expand all |
| 892 | 894 |
button_delete: Delete |
| 893 | 895 |
button_create: Create |
| 894 |
button_create_and_continue: Create and continue
|
|
| 896 |
button_create_and_continue: Create and Add Another
|
|
| 895 | 897 |
button_test: Test |
| 896 | 898 |
button_edit: Edit |
| 897 | 899 |
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
|
| ... | ... | |
| 966 | 968 |
text_caracters_minimum: "Must be at least %{count} characters long."
|
| 967 | 969 |
text_length_between: "Length between %{min} and %{max} characters."
|
| 968 | 970 |
text_project_name_info: "This will be the name of your project as it appears throughout this site.<br /> You can change it at any time, in the project's settings." |
| 969 |
text_project_visibility_info: "If your project is not public, it will be visible only to you and to users that you have added as project members.<br/>You can change this later if you wish." |
|
| 971 |
text_project_public_info: "Public: visible to anybody browsing the site." |
|
| 972 |
text_project_private_info: "Private: visible only to you, and to users you have added as project members." |
|
| 973 |
text_project_visibility_info: "You can change whether your project is public or private later if you wish." |
|
| 970 | 974 |
text_user_ssamr_description_info: 'Please describe your current research or development interests.<br/>This information will be used at registration to determine that you are a real person – so please be descriptive, or your application may be delayed or rejected.<br/>After registration, the description is publicly visible in your profile and you can edit it at any time.' |
| 971 | 975 |
text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.' |
| 972 | 976 |
|
| public/stylesheets/application.css | ||
|---|---|---|
| 256 | 256 |
.highlight.token-3 { background-color: #aaf;}
|
| 257 | 257 |
|
| 258 | 258 |
.box{
|
| 259 |
padding:6px; |
|
| 260 |
margin-bottom: 10px; |
|
| 261 |
background-color:#f6f6f6; |
|
| 262 |
color:#505050; |
|
| 263 |
line-height:1.5em; |
|
| 264 |
border: 1px solid #e4e4e4; |
|
| 259 |
padding:6px;
|
|
| 260 |
margin-bottom: 10px;
|
|
| 261 |
background-color:#f6f6f6;
|
|
| 262 |
color:#505050;
|
|
| 263 |
line-height:1.5em;
|
|
| 264 |
border: 1px solid #e4e4e4;
|
|
| 265 | 265 |
} |
| 266 | 266 |
|
| 267 | 267 |
.box h4 {
|
| 268 |
margin-top: 0; |
|
| 269 |
padding-top: 0; |
|
| 268 |
margin-top: 0;
|
|
| 269 |
padding-top: 0;
|
|
| 270 | 270 |
} |
| 271 | 271 |
|
| 272 | 272 |
div.square {
|
| ... | ... | |
| 344 | 344 |
div#members dt .email { color: #777; font-size: 80%; }
|
| 345 | 345 |
div#members dd .roles { font-style: italic; }
|
| 346 | 346 |
|
| 347 |
div#memberbox h3 {
|
|
| 348 |
background: url(../images/group.png) no-repeat 0% 50%; |
|
| 349 |
padding-left: 20px; |
|
| 350 |
} |
|
| 351 |
div#memberbox p {
|
|
| 352 |
padding-left: 20px; |
|
| 353 |
margin-left: 0; |
|
| 354 |
} |
|
| 355 |
|
|
| 356 |
div.issues ul {
|
|
| 357 |
padding-left: 20px; |
|
| 358 |
margin-left: 0; |
|
| 359 |
list-style-type: none; |
|
| 360 |
} |
|
| 361 |
div.issues p {
|
|
| 362 |
padding-left: 20px; |
|
| 363 |
margin-left: 0; |
|
| 364 |
} |
|
| 365 |
|
|
| 347 | 366 |
.projects .latest .title { margin-right: 0.5em; }
|
| 348 | 367 |
.tipoftheday .tip { margin-left: 2em; margin-top: 0.5em; }
|
| 349 | 368 |
|
| public/themes/soundsoftware/stylesheets/application.css | ||
|---|---|---|
| 147 | 147 |
*/ |
| 148 | 148 |
/* h4 { border-bottom: dotted 1px #c0c0c0; } */
|
| 149 | 149 |
|
| 150 |
.wiki p { margin-left: 3em; margin-right: 3em; }
|
|
| 150 |
.wiki p, .wiki li { margin-left: 30px; margin-right: 3em; }
|
|
| 151 |
|
|
| 152 |
.repository-info .wiki p { margin-left: 0 }
|
|
| 151 | 153 |
|
| 152 | 154 |
div.issue { background: #fdfaf0; border: 1px solid #a9b680; border-left: 4px solid #a9b680; }
|
| 153 | 155 |
|
| public/themes/soundsoftware/stylesheets/fonts-generic.css | ||
|---|---|---|
| 1 |
@import url(fonts.css); |
|
| 1 |
@import url(fonts.css?2);
|
|
| 2 | 2 |
|
| 3 | 3 |
h1, #project-ancestors-title, #top-menu a {
|
| 4 | 4 |
font-family: Insider, 'Gill Sans', Tahoma, sans-serif; |
| public/themes/soundsoftware/stylesheets/fonts-mac.css | ||
|---|---|---|
| 1 |
@import url(fonts.css); |
|
| 1 |
@import url(fonts.css?2);
|
|
| 2 | 2 |
|
| 3 | 3 |
h1, #project-ancestors-title, #top-menu a {
|
| 4 | 4 |
font-family: Insider, "Lucida Grande", sans-serif; |
| public/themes/soundsoftware/stylesheets/fonts-ms.css | ||
|---|---|---|
| 1 |
@import url(fonts.css); |
|
| 1 |
@import url(fonts.css?2);
|
|
| 2 | 2 |
|
| 3 | 3 |
/* IE likes us to separate out normal & bold into different fonts |
| 4 | 4 |
rather than use the selectors on the same font */ |
| vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb | ||
|---|---|---|
| 3 | 3 |
|
| 4 | 4 |
class PublicationsController < ApplicationController |
| 5 | 5 |
unloadable |
| 6 |
|
|
| 6 |
|
|
| 7 | 7 |
model_object Publication |
| 8 |
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 ]
|
|
| 8 |
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 ] |
|
| 9 | 9 |
before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ] |
| 10 |
|
|
| 10 |
|
|
| 11 | 11 |
def new |
| 12 | 12 |
find_project_by_project_id |
| 13 | 13 |
@publication = Publication.new |
| 14 |
|
|
| 14 |
|
|
| 15 | 15 |
# we'll always want a new publication to have its bibtex entry |
| 16 | 16 |
@publication.build_bibtex_entry |
| 17 |
|
|
| 17 |
|
|
| 18 | 18 |
# and at least one author |
| 19 |
# @publication.authorships.build.build_author
|
|
| 19 |
# @publication.authorships.build.build_author |
|
| 20 | 20 |
@author_options = [["#{User.current.name} (@#{User.current.mail.partition('@')[2]})", "#{User.current.class.to_s}_#{User.current.id.to_s}"]]
|
| 21 |
|
|
| 22 |
|
|
| 23 | 21 |
end |
| 24 | 22 |
|
| 25 |
def create
|
|
| 23 |
def create |
|
| 26 | 24 |
@project = Project.find(params[:project_id]) |
| 27 | 25 |
|
| 28 | 26 |
@author_options = [] |
| 29 | 27 |
|
| 30 | 28 |
@publication = Publication.new(params[:publication]) |
| 31 | 29 |
@publication.projects << @project unless @project.nil? |
| 32 |
|
|
| 33 |
if @publication.save
|
|
| 30 |
|
|
| 31 |
if @publication.save |
|
| 34 | 32 |
@publication.notify_authors_publication_added(@project) |
| 35 |
|
|
| 33 |
|
|
| 36 | 34 |
flash[:notice] = "Successfully created publication." |
| 37 | 35 |
redirect_to :action => :show, :id => @publication, :project_id => @project |
| 38 | 36 |
else |
| ... | ... | |
| 52 | 50 |
|
| 53 | 51 |
def new_from_bibfile |
| 54 | 52 |
@publication.current_step = session[:publication_step] |
| 55 |
|
|
| 53 |
|
|
| 56 | 54 |
# contents of the paste text area |
| 57 | 55 |
bibtex_entry = params[:bibtex_entry] |
| 58 | 56 |
|
| 59 | 57 |
# method for creating "pasted" bibtex entries |
| 60 | 58 |
if bibtex_entry |
| 61 |
parse_bibtex_list bibtex_entry
|
|
| 59 |
parse_bibtex_list bibtex_entry |
|
| 62 | 60 |
end |
| 63 | 61 |
end |
| 64 | 62 |
|
| 65 | 63 |
def get_bibtex_required_fields |
| 66 | 64 |
|
| 67 | 65 |
unless params[:value].empty? |
| 68 |
fields = BibtexEntryType.fields(params[:value])
|
|
| 66 |
fields = BibtexEntryType.fields(params[:value]) |
|
| 69 | 67 |
end |
| 70 | 68 |
|
| 71 | 69 |
respond_to do |format| |
| 72 | 70 |
format.js {
|
| 73 |
render(:update) {|page|
|
|
| 71 |
render(:update) {|page|
|
|
| 74 | 72 |
if params[:value].empty? |
| 75 | 73 |
page << "hideOnLoad();" |
| 76 | 74 |
else |
| ... | ... | |
| 78 | 76 |
end |
| 79 | 77 |
} |
| 80 | 78 |
} |
| 81 |
|
|
| 79 |
|
|
| 82 | 80 |
end |
| 83 | 81 |
end |
| 84 | 82 |
|
| ... | ... | |
| 92 | 90 |
end |
| 93 | 91 |
end |
| 94 | 92 |
|
| 95 |
def edit
|
|
| 93 |
def edit |
|
| 96 | 94 |
find_project_by_project_id unless params[:project_id].nil? |
| 97 |
|
|
| 95 |
|
|
| 98 | 96 |
@edit_view = true; |
| 99 | 97 |
@publication = Publication.find(params[:id]) |
| 100 | 98 |
@selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type |
| 101 | 99 |
|
| 102 |
@author_options = []
|
|
| 103 |
|
|
| 104 |
@bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id)
|
|
| 100 |
@author_options = [] |
|
| 101 |
|
|
| 102 |
@bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) |
|
| 105 | 103 |
end |
| 106 | 104 |
|
| 107 |
def update |
|
| 108 |
@publication = Publication.find(params[:id]) |
|
| 109 |
|
|
| 105 |
def update |
|
| 106 |
@publication = Publication.find(params[:id]) |
|
| 110 | 107 |
@author_options = [] |
| 111 | 108 |
|
| 112 |
logger.error { "INSIDE THE UPDATE ACTION IN THE PUBLICATION CONTROLLER" }
|
|
| 113 |
|
|
| 114 | 109 |
if @publication.update_attributes(params[:publication]) |
| 115 | 110 |
flash[:notice] = "Successfully updated Publication." |
| 116 | 111 |
|
| 112 |
# expires the previosly cached entries |
|
| 113 |
Rails.cache.delete "publication-#{@publication.id}-ieee"
|
|
| 114 |
Rails.cache.delete "publication-#{@publication.id}-bibtex"
|
|
| 115 |
|
|
| 117 | 116 |
if !params[:project_id].nil? |
| 118 | 117 |
redirect_to :action => :show, :id => @publication, :project_id => params[:project_id] |
| 119 | 118 |
else |
| ... | ... | |
| 121 | 120 |
end |
| 122 | 121 |
else |
| 123 | 122 |
render :action => 'edit' |
| 124 |
end
|
|
| 123 |
end |
|
| 125 | 124 |
end |
| 126 | 125 |
|
| 126 |
|
|
| 127 | 127 |
def show |
| 128 | 128 |
find_project_by_project_id unless params[:project_id].nil? |
| 129 |
|
|
| 129 |
|
|
| 130 | 130 |
if @publication.nil? |
| 131 | 131 |
@publications = Publication.all |
| 132 | 132 |
render "index", :alert => 'The publication was not found!' |
| ... | ... | |
| 142 | 142 |
return authors_entry.split(" and ")
|
| 143 | 143 |
end |
| 144 | 144 |
|
| 145 |
# parses a list of bibtex
|
|
| 145 |
# parses a list of bibtex |
|
| 146 | 146 |
def parse_bibtex_list(bibtex_list) |
| 147 | 147 |
bibliography = BibTeX.parse bibtex_list |
| 148 | 148 |
|
| ... | ... | |
| 155 | 155 |
create_bibtex_entry d |
| 156 | 156 |
end |
| 157 | 157 |
end |
| 158 |
end
|
|
| 158 |
end |
|
| 159 | 159 |
|
| 160 |
def create_bibtex_entry(d)
|
|
| 160 |
def create_bibtex_entry(d) |
|
| 161 | 161 |
@publication = Publication.new |
| 162 |
@bentry = BibtexEntry.new
|
|
| 162 |
@bentry = BibtexEntry.new |
|
| 163 | 163 |
authors = [] |
| 164 | 164 |
institution = "" |
| 165 | 165 |
email = "" |
| ... | ... | |
| 177 | 177 |
else |
| 178 | 178 |
@bentry[field] = d[field] |
| 179 | 179 |
end |
| 180 |
end
|
|
| 180 |
end |
|
| 181 | 181 |
|
| 182 | 182 |
@publication.bibtex_entry = @bentry |
| 183 | 183 |
@publication.save |
| 184 | 184 |
|
| 185 |
# what is this for???
|
|
| 185 |
# what is this for??? |
|
| 186 | 186 |
# @created_publications << @publication.id |
| 187 | 187 |
|
| 188 | 188 |
# need to save all authors |
| 189 |
# and establish the author-publication association
|
|
| 190 |
# via the authorships table
|
|
| 189 |
# and establish the author-publication association |
|
| 190 |
# via the authorships table |
|
| 191 | 191 |
authors.each_with_index.map do |authorname, idx| |
| 192 | 192 |
author = Author.new(:name => authorname) |
| 193 | 193 |
if author.save! |
| 194 |
# todo: catch the errors... |
|
| 194 | 195 |
puts "SAVED" |
| 195 | 196 |
else |
| 196 | 197 |
puts "NOT SAVED" |
| 197 | 198 |
end |
| 198 | 199 |
|
| 199 | 200 |
author.authorships.create!( |
| 200 |
:publication => @publication,
|
|
| 201 |
:institution => institution,
|
|
| 202 |
:email => email,
|
|
| 203 |
:order => idx)
|
|
| 201 |
:publication => @publication, |
|
| 202 |
:institution => institution, |
|
| 203 |
:email => email, |
|
| 204 |
:order => idx) |
|
| 204 | 205 |
end |
| 205 | 206 |
end |
| 206 | 207 |
|
| ... | ... | |
| 211 | 212 |
|
| 212 | 213 |
def import |
| 213 | 214 |
@publication = Publication.new |
| 214 |
|
|
| 215 |
|
|
| 215 |
|
|
| 216 |
|
|
| 216 | 217 |
end |
| 217 |
|
|
| 218 |
|
|
| 218 | 219 |
def autocomplete_for_project |
| 219 | 220 |
@publication = Publication.find(params[:id]) |
| 220 |
|
|
| 221 |
@projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects
|
|
| 221 |
|
|
| 222 |
@projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects |
|
| 222 | 223 |
logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results"
|
| 223 | 224 |
render :layout => false |
| 224 | 225 |
end |
| 225 | 226 |
|
| 226 |
def autocomplete_for_author
|
|
| 227 |
def autocomplete_for_author |
|
| 227 | 228 |
@results = [] |
| 228 |
|
|
| 229 |
|
|
| 229 | 230 |
object_id = params[:object_id] |
| 230 | 231 |
@object_name = "publications[authorships_attributes][#{object_id}][search_results]"
|
| 231 |
|
|
| 232 |
|
|
| 232 | 233 |
# cc 20110909 -- revert to like instead of like_unique -- see #289 |
| 233 | 234 |
authorships_list = Authorship.like(params[:q]).find(:all, :limit => 100) |
| 234 | 235 |
users_list = User.active.like(params[:q]).find(:all, :limit => 100) |
| 235 | 236 |
|
| 236 | 237 |
logger.debug "Query for \"#{params[:q]}\" returned \"#{authorships_list.size}\" authorships and \"#{users_list.size}\" users"
|
| 237 |
|
|
| 238 |
|
|
| 238 | 239 |
@results = users_list |
| 239 | 240 |
|
| 240 |
# TODO: can be optimized…
|
|
| 241 |
authorships_list.each do |authorship|
|
|
| 241 |
# TODO: can be optimized… |
|
| 242 |
authorships_list.each do |authorship| |
|
| 242 | 243 |
flag = true |
| 243 |
|
|
| 244 |
|
|
| 244 | 245 |
users_list.each do |user| |
| 245 | 246 |
if authorship.name == user.name && authorship.email == user.mail && authorship.institution == user.institution |
| 246 | 247 |
Rails.logger.debug { "Rejecting Authorship #{authorship.id}" }
|
| ... | ... | |
| 252 | 253 |
@results << authorship if flag |
| 253 | 254 |
end |
| 254 | 255 |
|
| 255 |
render :layout => false
|
|
| 256 |
render :layout => false |
|
| 256 | 257 |
end |
| 257 |
|
|
| 258 |
|
|
| 258 |
|
|
| 259 | 259 |
def get_user_info |
| 260 | 260 |
object_id = params[:object_id] |
| 261 | 261 |
value = params[:value] |
| ... | ... | |
| 266 | 266 |
name_field = "publication_authorships_attributes_#{object_id}_name_on_paper".to_sym
|
| 267 | 267 |
email_field = "publication_authorships_attributes_#{object_id}_email".to_sym
|
| 268 | 268 |
institution_field = "publication_authorships_attributes_#{object_id}_institution".to_sym
|
| 269 |
|
|
| 269 |
|
|
| 270 | 270 |
yes_radio = "publication_authorships_attributes_#{object_id}_identify_author_yes".to_sym
|
| 271 |
|
|
| 271 |
|
|
| 272 | 272 |
respond_to do |format| |
| 273 | 273 |
format.js {
|
| 274 |
render(:update) {|page|
|
|
| 274 |
render(:update) {|page|
|
|
| 275 | 275 |
page[name_field].value = item.name |
| 276 | 276 |
page[email_field].value = item.mail |
| 277 | 277 |
page[institution_field].value = item.institution |
| ... | ... | |
| 293 | 293 |
end |
| 294 | 294 |
|
| 295 | 295 |
def add_project |
| 296 |
@projects = Project.find(params[:publication][:project_ids])
|
|
| 296 |
@projects = Project.find(params[:publication][:project_ids]) |
|
| 297 | 297 |
@publication.projects << @projects |
| 298 |
@project = Project.find(params[:project_id])
|
|
| 299 |
|
|
| 300 |
# TODO luisf should also respond to HTML???
|
|
| 298 |
@project = Project.find(params[:project_id]) |
|
| 299 |
|
|
| 300 |
# TODO luisf should also respond to HTML??? |
|
| 301 | 301 |
respond_to do |format| |
| 302 | 302 |
format.html { redirect_to :back }
|
| 303 |
format.js {
|
|
| 304 |
render(:update) {|page|
|
|
| 305 |
page[:add_project_form].reset
|
|
| 303 |
format.js {
|
|
| 304 |
render(:update) {|page|
|
|
| 305 |
page[:add_project_form].reset |
|
| 306 | 306 |
page.replace_html :list_projects, :partial => 'list_projects' |
| 307 | 307 |
} |
| 308 | 308 |
} |
| 309 | 309 |
end |
| 310 | 310 |
end |
| 311 |
|
|
| 312 |
|
|
| 311 |
|
|
| 312 |
|
|
| 313 | 313 |
def remove_project |
| 314 | 314 |
@project = Project.find(params[:project_id]) |
| 315 | 315 |
proj = Project.find(params[:remove_project_id]) |
| ... | ... | |
| 319 | 319 |
@publication.projects.delete proj if request.post? |
| 320 | 320 |
end |
| 321 | 321 |
else |
| 322 |
logger.error { "Cannot remove project from publication list" }
|
|
| 322 |
logger.error { "Cannot remove project from publication list" }
|
|
| 323 | 323 |
end |
| 324 |
|
|
| 324 |
|
|
| 325 | 325 |
logger.error { "CURRENT project name#{proj.name} and wanna delete #{@project.name}" }
|
| 326 |
|
|
| 327 |
render(:update) {|page|
|
|
| 326 |
|
|
| 327 |
render(:update) {|page|
|
|
| 328 | 328 |
page.replace_html "list_projects", :partial => 'list_projects', :id => @publication |
| 329 |
}
|
|
| 329 |
} |
|
| 330 | 330 |
end |
| 331 |
|
|
| 331 |
|
|
| 332 | 332 |
def destroy |
| 333 | 333 |
find_project_by_project_id |
| 334 |
|
|
| 334 |
|
|
| 335 | 335 |
@publication.destroy |
| 336 |
|
|
| 336 |
|
|
| 337 | 337 |
flash[:notice] = "Successfully deleted Publication." |
| 338 | 338 |
redirect_to :controller => :publications, :action => 'index', :project_id => @project |
| 339 | 339 |
end |
| vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb | ||
|---|---|---|
| 12 | 12 |
def projects_check_box_tags(name, projects) |
| 13 | 13 |
s = '' |
| 14 | 14 |
projects.sort.each do |project| |
| 15 |
if User.current.allowed_to?(:edit_publication, project)
|
|
| 15 |
if User.current.allowed_to?(:edit_publication, project) |
|
| 16 | 16 |
s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n"
|
| 17 | 17 |
s << '<br />' |
| 18 | 18 |
end |
| 19 | 19 |
end |
| 20 | 20 |
|
| 21 |
s
|
|
| 21 |
s |
|
| 22 | 22 |
end |
| 23 |
|
|
| 23 |
|
|
| 24 | 24 |
def choose_author_link(object_name, items) |
| 25 | 25 |
# called by autocomplete_for_author (publications' action/view) |
| 26 | 26 |
# creates the select list based on the results array |
| 27 | 27 |
# results is an array with both Users and Authorships objects |
| 28 |
|
|
| 28 |
|
|
| 29 | 29 |
@author_options = [] |
| 30 | 30 |
@results.each do |result| |
| 31 | 31 |
email_bit = result.mail.partition('@')[2]
|
| ... | ... | |
| 34 | 34 |
end |
| 35 | 35 |
@author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"]
|
| 36 | 36 |
end |
| 37 |
|
|
| 37 |
|
|
| 38 | 38 |
if @results.size > 0 |
| 39 | 39 |
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} )
|
| 40 | 40 |
s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q')
|
| 41 | 41 |
else |
| 42 | 42 |
s = "<em>No Authors found that match your search… sorry!</em>" |
| 43 |
end
|
|
| 43 |
end |
|
| 44 | 44 |
end |
| 45 | 45 |
|
| 46 | 46 |
def link_to_remove_fields(name, f) |
| 47 | 47 |
f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') |
| 48 | 48 |
end |
| 49 |
|
|
| 49 |
|
|
| 50 | 50 |
def link_to_add_author_fields(name, f, association, action) |
| 51 | 51 |
new_object = f.object.class.reflect_on_association(association).klass.new |
| 52 | 52 |
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
| 53 | 53 |
render(association.to_s.singularize + "_fields", :f => builder) |
| 54 |
end
|
|
| 54 |
end |
|
| 55 | 55 |
link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" })
|
| 56 |
end
|
|
| 56 |
end |
|
| 57 | 57 |
|
| 58 | 58 |
def sanitized_object_name(object_name) |
| 59 | 59 |
object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") |
| ... | ... | |
| 62 | 62 |
def sanitized_method_name(method_name) |
| 63 | 63 |
method_name.sub(/\?$/, "") |
| 64 | 64 |
end |
| 65 |
|
|
| 65 |
|
|
| 66 | 66 |
def form_tag_name(object_name, method_name) |
| 67 | 67 |
str = "#{object_name.to_s}[#{sanitized_method_name(method_name.to_s)}]"
|
| 68 |
str.to_sym
|
|
| 68 |
str.to_sym |
|
| 69 | 69 |
end |
| 70 |
|
|
| 71 |
def form_tag_id(object_name, method_name)
|
|
| 70 |
|
|
| 71 |
def form_tag_id(object_name, method_name) |
|
| 72 | 72 |
str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}"
|
| 73 | 73 |
str.to_sym |
| 74 | 74 |
end |
| 75 |
|
|
| 75 |
|
|
| 76 | 76 |
def form_object_id(object_name) |
| 77 | 77 |
str = object_name.split("\[").last().gsub("\]","")
|
| 78 | 78 |
str.to_sym |
| 79 | 79 |
end |
| 80 | 80 |
|
| 81 |
def render_authorships_list(publication)
|
|
| 81 |
def render_authorships_list(publication) |
|
| 82 | 82 |
s = '<p>' |
| 83 |
|
|
| 83 |
|
|
| 84 | 84 |
publication.authorships.each do |authorship| |
| 85 | 85 |
s << link_to_authorship(authorship) |
| 86 | 86 |
s << "<br /><em>#{authorship.institution}</em></p>"
|
| 87 |
end
|
|
| 87 |
end |
|
| 88 | 88 |
|
| 89 |
s
|
|
| 89 |
s |
|
| 90 | 90 |
end |
| 91 |
|
|
| 92 |
|
|
| 93 |
def render_projects_list(publication, show_delete_icon) |
|
| 91 |
|
|
| 92 |
def render_projects_list(publication, show_delete_icon) |
|
| 94 | 93 |
s= "" |
| 95 |
|
|
| 94 |
|
|
| 96 | 95 |
publication.projects.visible.each do |proj| |
| 97 | 96 |
s << link_to_project(proj, {}, :class => 'publication_project')
|
| 98 |
|
|
| 99 |
if show_delete_icon
|
|
| 97 |
|
|
| 98 |
if show_delete_icon |
|
| 100 | 99 |
if User.current.allowed_to?(:edit_publication, @project) |
| 101 | 100 |
if @project == proj |
| 101 |
# todo: move this message to yml file |
|
| 102 | 102 |
confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' |
| 103 | 103 |
else |
| 104 | 104 |
confirm_msg = false |
| 105 |
end
|
|
| 106 |
|
|
| 107 |
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')
|
|
| 105 |
end |
|
| 106 |
|
|
| 107 |
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')
|
|
| 108 | 108 |
end |
| 109 | 109 |
end |
| 110 |
|
|
| 111 |
s << "<br />" |
|
| 112 |
end |
|
| 113 | 110 |
|
| 114 |
s |
|
| 111 |
s << "<br />" |
|
| 112 |
end |
|
| 113 |
|
|
| 114 |
s |
|
| 115 | 115 |
end |
| 116 |
|
|
| 116 |
|
|
| 117 |
def print_ieee_format(publication) |
|
| 118 |
Rails.cache.fetch("publication-#{publication.id}-ieee") do
|
|
| 119 |
publication.print_entry(:ieee) |
|
| 120 |
end |
|
| 121 |
end |
|
| 122 |
|
|
| 123 |
def print_bibtex_format(publication) |
|
| 124 |
Rails.cache.fetch("publication-#{publication.id}-bibtex") do
|
|
| 125 |
publication.print_entry(:bibtex) |
|
| 126 |
end |
|
| 127 |
end |
|
| 128 |
|
|
| 129 |
|
|
| 117 | 130 |
def show_bibtex_fields(bibtex_entry) |
| 118 | 131 |
s = "" |
| 119 | 132 |
bibtex_entry.attributes.keys.sort.each do |key| |
| 120 | 133 |
value = bibtex_entry.attributes[key].to_s |
| 121 | 134 |
next if key == 'id' or key == 'publication_id' or value == "" |
| 122 |
s << "<h4>" + l("field_#{key}") + "</h4>"
|
|
| 135 |
s << "<h4>" + l("field_#{key}") + "</h4>"
|
|
| 123 | 136 |
s << "<p>" |
| 124 | 137 |
if key == "entry_type" |
| 125 | 138 |
s << bibtex_entry.entry_type_label |
| ... | ... | |
| 129 | 142 |
s << "</p>" |
| 130 | 143 |
end |
| 131 | 144 |
s |
| 132 |
end
|
|
| 145 |
end |
|
| 133 | 146 |
end |
| 134 | 147 |
|
| vendor/plugins/redmine_bibliography/app/models/author.rb | ||
|---|---|---|
| 1 | 1 |
class Author < ActiveRecord::Base |
| 2 |
unloadable |
|
| 3 |
|
|
| 2 | 4 |
has_many :authorships, :dependent => :destroy |
| 3 | 5 |
has_many :publications, :through => :authorships |
| 4 | 6 |
|
| vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb | ||
|---|---|---|
| 1 | 1 |
class BibtexEntryType < ActiveRecord::Base |
| 2 |
unloadable |
|
| 2 | 3 |
|
| 3 | 4 |
@@fields = Hash['article', ['journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ], |
| 4 | 5 |
'book' , [ 'editor', 'publisher', 'volume', 'series', 'address', 'edition', 'month', 'year', 'note' ], |
| vendor/plugins/redmine_bibliography/app/models/publication.rb | ||
|---|---|---|
| 2 | 2 |
|
| 3 | 3 |
class Publication < ActiveRecord::Base |
| 4 | 4 |
unloadable |
| 5 |
|
|
| 5 |
|
|
| 6 | 6 |
has_many :authorships, :dependent => :destroy, :order => "auth_order ASC" |
| 7 | 7 |
has_many :authors, :through => :authorships, :uniq => true |
| 8 |
|
|
| 8 |
|
|
| 9 | 9 |
has_one :bibtex_entry, :dependent => :destroy |
| 10 | 10 |
|
| 11 | 11 |
validates_presence_of :title |
| ... | ... | |
| 14 | 14 |
accepts_nested_attributes_for :authorships |
| 15 | 15 |
accepts_nested_attributes_for :authors, :allow_destroy => true |
| 16 | 16 |
accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true |
| 17 |
|
|
| 17 |
|
|
| 18 | 18 |
has_and_belongs_to_many :projects, :uniq => true |
| 19 |
|
|
| 19 |
|
|
| 20 | 20 |
before_save :set_initial_author_order |
| 21 | 21 |
|
| 22 | 22 |
# Ensure error message uses proper text instead of |
| ... | ... | |
| 30 | 30 |
end |
| 31 | 31 |
end |
| 32 | 32 |
|
| 33 |
def notify_authors_publication_added(project)
|
|
| 33 |
def notify_authors_publication_added(project) |
|
| 34 | 34 |
self.authors.each do |author| |
| 35 | 35 |
Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." }
|
| 36 | 36 |
Mailer.deliver_publication_added(author.user, self, project) unless author.user.nil? |
| 37 | 37 |
end |
| 38 | 38 |
end |
| 39 |
|
|
| 40 |
def notify_authors_publication_updated(project)
|
|
| 39 |
|
|
| 40 |
def notify_authors_publication_updated(project) |
|
| 41 | 41 |
self.authors.each do |author| |
| 42 | 42 |
Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." }
|
| 43 | 43 |
Mailer.deliver_publication_updated(author.user, self, project) unless author.user.nil? |
| 44 | 44 |
end |
| 45 | 45 |
end |
| 46 |
|
|
| 47 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 | 48 |
def set_initial_author_order |
| 49 | 49 |
authorships = self.authorships |
| 50 |
|
|
| 50 |
|
|
| 51 | 51 |
logger.debug { "Publication \"#{self.title}\" has #{authorships.size} authors." }
|
| 52 |
|
|
| 52 |
|
|
| 53 | 53 |
authorships.each_with_index do |authorship, index| |
| 54 | 54 |
if authorship.auth_order.nil? |
| 55 | 55 |
authorship.auth_order = index |
| 56 | 56 |
end |
| 57 |
end
|
|
| 57 |
end |
|
| 58 | 58 |
end |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 59 |
|
|
| 60 |
def print_bibtex_author_names |
|
| 61 |
# this authors are correctly sorted because the authorships model |
|
| 62 |
# already outputs the author names ASC by auth_order |
|
| 63 |
self.authorships.map{|a| a.name_on_paper}.join(' and ')
|
|
| 64 |
end |
|
| 65 |
|
|
| 66 |
def print_entry(style) |
|
| 67 |
bib = BibTeX::Entry.new |
|
| 68 |
|
|
| 69 |
bib.author = self.print_bibtex_author_names |
|
| 70 |
bib.title = self.title |
|
| 71 |
|
|
| 72 |
self.bibtex_entry.attributes.keys.sort.each do |key| |
|
| 73 |
value = self.bibtex_entry.attributes[key].to_s |
|
| 74 |
next if key == 'id' or key == 'publication_id' or value == "" |
|
| 75 |
|
|
| 76 |
if key == "entry_type" |
|
| 77 |
bib.type = BibtexEntryType.find(self.bibtex_entry.entry_type).name |
|
| 78 |
else |
|
| 79 |
bib[key.to_sym] = value |
|
| 80 |
end |
|
| 81 |
end |
|
| 82 |
|
|
| 83 |
if style == :ieee |
|
| 84 |
CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html |
|
| 85 |
else |
|
| 86 |
bibtex = bib.to_s :include => :meta_content |
|
| 87 |
bibtex.strip! |
|
| 88 |
logger.error { bibtex }
|
|
| 89 |
end |
|
| 90 |
end |
|
| 63 | 91 |
end |
| vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb | ||
|---|---|---|
| 1 |
<% content_for :header_tags do %> |
|
| 2 |
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> |
|
| 3 |
<%= javascript_include_tag 'bibtex', :plugin => 'redmine_bibliography' -%> |
|
| 4 |
<% end %> |
|
| 5 |
|
|
| 1 | 6 |
<% if @project.publications.any? %> |
| 2 | 7 |
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> |
| 3 | 8 |
<div id="bibliography"> |
| 4 | 9 |
<div class="box"> |
| 5 | 10 |
<h3><%=l(:label_related_publication_plural)%></h3> |
| 6 | 11 |
|
| 7 |
<dl> |
|
| 12 |
<dl>
|
|
| 8 | 13 |
<% @project.publications.each do |publication| %> |
| 9 |
<dt> |
|
| 10 |
<span class="authors">
|
|
| 11 |
<%= publication.authorships.map { |a| h a.name_on_paper }.join(', ') %><% if !publication.authorships.empty? %>.<% end %>
|
|
| 12 |
</span>
|
|
| 13 |
<span class="title"><%= link_to publication.title, :controller => 'publications', :action => 'show', :id => publication, :project_id => @project %></span>
|
|
| 14 |
<% if publication.bibtex_entry.year.to_s != "" %> |
|
| 15 |
<span class="year">
|
|
| 16 |
(<%= publication.bibtex_entry.year %>)
|
|
| 17 |
</span>
|
|
| 18 |
<% end %>
|
|
| 19 |
</dt><dd></dd>
|
|
| 14 |
<dt>
|
|
| 15 |
<%= print_ieee_format(publication) %>
|
|
| 16 |
</dt>
|
|
| 17 |
<dd>
|
|
| 18 |
<%= link_to("[More Details]", {:controller => :publications, :action => :show, :id => publication.id, :project_id => @project.id}) -%>
|
|
| 19 |
|
|
| 20 |
<%= link_to_function "[B<small>IB</small>T<sub>E</sub>X]", onclick="toggleBibtex(this)" -%>
|
|
| 21 |
</dd>
|
|
| 22 |
<dd class="bibtex-textarea collapsed" style="display: none;">
|
|
| 23 |
<textarea readonly> <%= print_bibtex_format(publication) %> </textarea>
|
|
| 24 |
</dd>
|
|
| 20 | 25 |
<% end -%> |
| 21 |
</dl> |
|
| 26 |
</dl>
|
|
| 22 | 27 |
</div> |
| 23 | 28 |
</div> |
| 24 |
<% end %> |
|
| 29 |
<% end -%> |
|
| vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb | ||
|---|---|---|
| 1 |
<%= f.error_messages %>
|
|
| 1 |
<%= f.error_messages %> |
|
| 2 | 2 |
|
| 3 | 3 |
<h3><%= f.text_field :title, :required => true, :size => 70 %></h3> |
| 4 | 4 |
|
| 5 |
<div class="splitcontentleft">
|
|
| 5 |
<div class="splitcontentleft"> |
|
| 6 | 6 |
<h3><%= l(:label_publication_other_details) %></h3> |
| 7 | 7 |
<div class="box tabular"> |
| 8 | 8 |
<% f.fields_for :bibtex_entry do |builder| -%> |
| ... | ... | |
| 14 | 14 |
<br /> |
| 15 | 15 |
<em><%= l(:text_external_url) %></em> |
| 16 | 16 |
</p> |
| 17 |
<p> |
|
| 18 |
<%= f.text_field :doi, :size => 70 %> |
|
| 19 |
<br /> |
|
| 20 |
<em><%= l(:text_doi) %></em> |
|
| 21 |
</p> |
|
| 17 | 22 |
|
| 18 | 23 |
</div> |
| 19 | 24 |
</div> |
| 20 | 25 |
|
| 21 | 26 |
<div class="splitcontentright"> |
| 22 |
<h3><%= l(:authors) %></h3>
|
|
| 27 |
<h3><%= l(:authors) %></h3> |
|
| 23 | 28 |
<div class="box tabular"> |
| 24 | 29 |
<% f.fields_for :authorships do |builder| -%> |
| 25 | 30 |
<%= render "authorship_fields", :f => builder %> |
| vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb | ||
|---|---|---|
| 1 |
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> |
|
| 2 |
|
|
| 3 | 1 |
<h2><%=l(:label_publication_show)%></h2> |
| 4 | 2 |
|
| 5 | 3 |
<div class="box"> |
| 6 |
<h3> |
|
| 7 |
<%= h @publication.title %> |
|
| 8 |
</h3> |
|
| 4 |
<h3>Publication Info</h3> |
|
| 5 |
<p><%= print_ieee_format(@publication)%></p> |
|
| 6 |
|
|
| 7 |
<h3>B<small>IB</small>T<sub>E</sub>X Format</h3> |
|
| 8 |
<pre><%=h print_bibtex_format(@publication) %></pre> |
|
| 9 |
</div> |
|
| 10 |
|
|
| 11 |
<div class="box"> |
|
| 9 | 12 |
|
| 10 | 13 |
<h4><%= l(:authors) %></h4> |
| 11 | 14 |
<ul id="authorships"> |
| 12 | 15 |
<% for authorship in @publication.authorships.find(:all, :order => :auth_order) %> |
| 13 | 16 |
<% content_tag_for :li, authorship do %> |
| 14 |
<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
|
|
| 17 |
<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> |
|
| 15 | 18 |
<span class="handle">[drag to reorder]</span> |
| 16 | 19 |
<%- end -%> |
| 17 | 20 |
<%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br /> |
| 18 | 21 |
<%- end -%> |
| 19 | 22 |
<%- end -%> |
| 20 | 23 |
</ul> |
| 24 |
|
|
| 21 | 25 |
<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> |
| 22 | 26 |
<%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %>
|
| 23 | 27 |
<%- end -%> |
| ... | ... | |
| 26 | 30 |
<%= show_bibtex_fields(@publication.bibtex_entry) %> |
| 27 | 31 |
<%- end -%> |
| 28 | 32 |
|
| 33 |
<%- unless @publication.external_url.blank? -%> |
|
| 34 |
<p> |
|
| 35 |
<b><%= l(:field_external_url) %>:</b> <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} -%>
|
|
| 36 |
</p> |
|
| 37 |
<%- end -%> |
|
| 29 | 38 |
|
| 30 |
<% unless @publication.external_url.blank? %> |
|
| 31 |
<h4> |
|
| 32 |
<%= l(:field_external_url) %> |
|
| 33 |
</h4> |
|
| 39 |
|
|
| 40 |
<% unless @publication.doi.blank? %> |
|
| 34 | 41 |
<p> |
| 35 |
<%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} %>
|
|
| 42 |
<b><%= l(:field_doi)-%>:</b> <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%>
|
|
| 36 | 43 |
</p> |
| 37 | 44 |
<% end %> |
| 38 | 45 |
|
| 39 | 46 |
<br / > |
| 40 |
<% if User.current.allowed_to?(:add_publication, @project) %>
|
|
| 47 |
<% if User.current.allowed_to?(:add_publication, @project) %> |
|
| 41 | 48 |
<%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> |
|
| 42 | 49 |
<%= link_to "Delete", {:controller => 'publications', :action => 'destroy', :id => @publication, :project_id => @project },
|
| 43 | 50 |
:confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %> | |
| ... | ... | |
| 53 | 60 |
<p id="list_projects"> |
| 54 | 61 |
<%= render :partial => 'list_projects' %> |
| 55 | 62 |
</p> |
| 56 |
|
|
| 63 |
|
|
| 57 | 64 |
<%- if User.current.allowed_to?(:edit_publication, @project) -%> |
| 58 |
<%= render :partial => 'add_project_form' %>
|
|
| 65 |
<%= render :partial => 'add_project_form' %> |
|
| 59 | 66 |
<%- end -%> |
| 60 | 67 |
<% end %> |
| vendor/plugins/redmine_bibliography/assets/javascripts/bibtex.js | ||
|---|---|---|
| 1 |
function toggleBibtex(el) {
|
|
| 2 |
var dd = Element.up(el).next('dd')
|
|
| 3 |
|
|
| 4 |
dd.toggleClassName('collapsed');
|
|
| 5 |
Effect.toggle(dd, 'slide', {duration:0.2});
|
|
| 6 |
} |
|
| vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css | ||
|---|---|---|
| 32 | 32 |
min-width: 150px; |
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 |
div#bibliography dl { margin-left: 2em; }
|
|
| 36 |
div#bibliography .box dl { margin-left: 0; }
|
|
| 37 |
div#bibliography dt { margin-bottom: 0px; padding-left: 20px }
|
|
| 38 |
div#bibliography .box dt { margin-bottom: 0px; padding-left: 10px }
|
|
| 39 |
div#bibliography dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
|
|
| 40 |
div#bibliography .box dd { margin-bottom: 0.6em; padding-left: 0; }
|
|
| 35 |
|
|
| 36 |
div#bibliography dd { margin-bottom: 1em; font-size: 0.9em; }
|
|
| 37 |
|
|
| 41 | 38 |
div#bibliography dd .authors { font-style: italic; }
|
| 42 |
div#bibliography dt .title { font-style: italic; }
|
|
| 43 | 39 |
div#bibliography dd span.authors { color: #808080; }
|
| 44 | 40 |
div#bibliography dd span.year { padding-left: 0.6em; }
|
| 45 | 41 |
|
| 46 |
div#bibliography h3 { background: url(../../../images/table_multiple.png) no-repeat 0% 50%; padding-left: 20px; }
|
|
| 42 |
div#bibliography .box dt {
|
|
| 43 |
background: url(../../../images/document.png) no-repeat 0% 4px; |
|
| 44 |
padding-left: 20px; |
|
| 45 |
margin-left: 0; |
|
| 46 |
} |
|
| 47 |
div#bibliography .box dd {
|
|
| 48 |
padding-left: 20px; |
|
| 49 |
margin-left: 0; |
|
| 50 |
} |
|
| 51 |
|
|
| 52 |
div#bibliography h3 {
|
|
| 53 |
background: url(../../../images/table_multiple.png) no-repeat 0% 50%; |
|
| 54 |
padding-left: 20px; |
|
| 55 |
} |
|
| 56 |
|
|
| 57 |
div#bibliography textarea {
|
|
| 58 |
width: 90%; |
|
| 59 |
height: 200px; |
|
| 60 |
font: normal 8px; |
|
| 61 |
padding: 2px 10px; |
|
| 62 |
border: solid 1px #ddd; |
|
| 63 |
} |
|
| vendor/plugins/redmine_bibliography/config/locales/en.yml | ||
|---|---|---|
| 12 | 12 |
label_my_publications_box: "My Publications" |
| 13 | 13 |
view_all_publications: "View All Project's Publications" |
| 14 | 14 |
publications: Publications |
| 15 |
|
|
| 16 |
|
|
| 15 |
|
|
| 17 | 16 |
identify_author_question: Is the right person selected above? |
| 18 | 17 |
identify_author_yes: "Yes" |
| 19 | 18 |
identify_author_correct: "Yes, but I need to correct some details below" |
| ... | ... | |
| 25 | 24 |
label_all_publications_for_project: Publications associated with %{project}
|
| 26 | 25 |
label_authors_show: "Authorships associated with this author" |
| 27 | 26 |
label_authors_index: "List of authors" |
| 28 |
|
|
| 27 |
|
|
| 29 | 28 |
field_authorship_publication_title: "Publication" |
| 30 | 29 |
field_authorship_name: "Name on Paper" |
| 31 | 30 |
field_authorship_email: "Email" |
| 32 | 31 |
field_authorship_institution: "Institution" |
| 33 |
|
|
| 32 |
|
|
| 34 | 33 |
field_external_url: "External URL" |
| 34 |
field_doi: "DOI" |
|
| 35 | 35 |
field_publication_title: Title |
| 36 | 36 |
field_publication_authors: Authors |
| 37 | 37 |
field_publication_projects: "Associated projects" |
| 38 | 38 |
field_author_name: Author |
| 39 | 39 |
field_author_user: User Name |
| 40 | 40 |
field_author_username: "Associated user" |
| 41 |
field_author_publications: "Publications by this Author"
|
|
| 41 |
field_author_publications: "Publications by this Author" |
|
| 42 | 42 |
field_identify_author_yes: "Yes" |
| 43 | 43 |
field_identify_author_correct: "Corrections" |
| 44 | 44 |
field_identify_author_no: "No" |
| 45 |
|
|
| 45 |
|
|
| 46 | 46 |
label_author_is_me: "(I am this author)" |
| 47 | 47 |
label_add_me_as_author: "Add me as an author" |
| 48 | 48 |
label_add_an_author: "Add an author" |
| ... | ... | |
| 54 | 54 |
label_author_information: "Author Information" |
| 55 | 55 |
|
| 56 | 56 |
remove_author: "Remove this author" |
| 57 |
|
|
| 57 |
|
|
| 58 | 58 |
label_publication_plural: "Publications" |
| 59 | 59 |
label_related_publication_plural: "Related publications" |
| 60 | 60 |
label_publication_new: "Create New Publication" |
| ... | ... | |
| 67 | 67 |
label_publication_project_index: "Projects associated with this publication" |
| 68 | 68 |
label_publication_index: "View all publications" |
| 69 | 69 |
label_publication_other_details: "Details" |
| 70 |
|
|
| 70 |
|
|
| 71 | 71 |
text_external_url: "Link to the publication or to an external page about it." |
| 72 |
text_doi: "DOI (Digital Object Identifier)." |
|
| 72 | 73 |
text_author_name_on_paper: "Author's name as it appears on the paper." |
| 73 | 74 |
text_author_institution: "Author's institution as on the paper." |
| 74 | 75 |
text_author_email: "Author's email address as on the paper." |
| 75 |
|
|
| 76 |
|
|
| 76 | 77 |
text_author_search: "Search existing authors" |
| 77 |
|
|
| 78 |
|
|
| 78 | 79 |
# authorships model |
| 79 | 80 |
field_institution: "Institution" |
| 80 |
field_name_on_paper: "Name"
|
|
| 81 |
field_name_on_paper: "Name" |
|
| 81 | 82 |
field_email: "Email Address" |
| 82 |
|
|
| 83 |
|
|
| 83 | 84 |
# bibtex_entries model |
| 84 | 85 |
field_entry_type: "Publication Type" |
| 85 |
field_id: "id"
|
|
| 86 |
field_id: "id" |
|
| 86 | 87 |
field_publication_id: "Publication_id" |
| 87 | 88 |
field_address: "Address" |
| 88 | 89 |
field_annote: "Annote" |
| ... | ... | |
| 122 | 123 |
field_bibtex_proceedings: Conference proceedings |
| 123 | 124 |
field_bibtex_techreport: Technical report |
| 124 | 125 |
field_bibtex_unpublished: Unpublished |
| 125 |
|
|
| 126 |
|
|
| 126 | 127 |
label_author_1: First author |
| 127 | 128 |
label_author_2: Second author |
| 128 | 129 |
label_author_3: Third author |
| ... | ... | |
| 146 | 147 |
|
| 147 | 148 |
mail_subject_publication_added: "You have been added as an author to a new publication" |
| 148 | 149 |
mail_body_publication_added: "A new publication (%{publication}) has been added to the project '%{project}.'"
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| vendor/plugins/redmine_bibliography/db/migrate/008_add_doi_and_timestamp_columns_to_publications.rb | ||
|---|---|---|
| 1 |
class AddDoiAndTimestampColumnsToPublications < ActiveRecord::Migration |
|
| 2 |
def self.up |
|
| 3 |
add_column :publications, :doi, :string |
|
| 4 |
add_timestamps :publications |
|
| 5 |
|
|
| 6 |
end |
|
| 7 |
|
|
| 8 |
def self.down |
|
| 9 |
remove_column :publications, :doi |
|
| 10 |
remove_timestamps :publications |
|
| 11 |
end |
|
| 12 |
end |
|
| vendor/plugins/redmine_bibliography/db/migrate/009_add_timestamp_columns_to_authors.rb | ||
|---|---|---|
| 1 |
class AddTimestampColumnsToAuthors < ActiveRecord::Migration |
|
| 2 |
def self.up |
|
| 3 |
add_timestamps :authors |
|
| 4 |
end |
|
| 5 |
|
|
| 6 |
def self.down |
|
| 7 |
remove_timestamps :authors |
|
| 8 |
end |
|
| 9 |
end |
|
| vendor/plugins/redmine_bibliography/init.rb | ||
|---|---|---|
| 1 | 1 |
require 'redmine' |
| 2 | 2 |
require 'dispatcher' |
| 3 | 3 |
|
| 4 |
RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' |
|
| 4 |
require 'bibtex' |
|
| 5 |
require 'citeproc' |
|
| 5 | 6 |
|
| 6 | 7 |
# Patches to the Redmine core. |
| 7 | 8 |
Dispatcher.to_prepare :redmine_model_dependencies do |
| ... | ... | |
| 21 | 22 |
Mailer.send(:include, Bibliography::MailerPatch) |
| 22 | 23 |
end |
| 23 | 24 |
|
| 24 |
|
|
| 25 |
unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) |
|
| 26 |
ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) |
|
| 27 |
end |
|
| 25 | 28 |
end |
| 26 | 29 |
|
| 27 | 30 |
|
| ... | ... | |
| 47 | 50 |
# extending the Project Menu |
| 48 | 51 |
menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] },
|
| 49 | 52 |
:if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? }
|
| 50 |
|
|
| 53 |
|
|
| 51 | 54 |
end |
| vendor/plugins/redmine_bibliography/lib/bibliography/projects_helper_patch.rb | ||
|---|---|---|
| 1 |
module Bibliography |
|
| 2 |
module ProjectsHelperPatch |
|
| 3 |
|
|
| 4 |
def self.included(base) # :nodoc: |
|
| 5 |
base.send(:include, InstanceMethods) |
|
| 6 |
base.send(:include, PublicationsHelper) |
|
| 7 |
|
|
| 8 |
base.class_eval do |
|
| 9 |
unloadable |
|
| 10 |
end |
|
| 11 |
end |
|
| 12 |
|
|
| 13 |
module InstanceMethods |
|
| 14 |
end |
|
| 15 |
end |
|
| 16 |
end |
|
| 17 |
|
|
| vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb | ||
|---|---|---|
| 1 | 1 |
require_dependency 'user' |
| 2 | 2 |
|
| 3 | 3 |
module Bibliography |
| 4 |
module UserAuthorPatch
|
|
| 4 |
module UserAuthorPatch |
|
| 5 | 5 |
def self.included(base) |
| 6 |
base.send(:include, InstanceMethods)
|
|
| 7 |
extend ClassMethods
|
|
| 8 |
|
|
| 6 |
base.send(:include, InstanceMethods) |
|
| 7 |
extend ClassMethods |
|
| 8 |
|
|
| 9 | 9 |
end #self.included |
| 10 |
|
|
| 10 |
|
|
| 11 | 11 |
module ClassMethods |
| 12 |
end
|
|
| 13 |
|
|
| 12 |
end |
|
| 13 |
|
|
| 14 | 14 |
module InstanceMethods |
| 15 | 15 |
|
| 16 | 16 |
def institution |
| ... | ... | |
| 18 | 18 |
institution_name = self.ssamr_user_detail.institution_name |
| 19 | 19 |
else |
| 20 | 20 |
institution_name = "No Institution Set" |
| 21 |
end
|
|
| 22 |
return institution_name
|
|
| 21 |
end |
|
| 22 |
return institution_name |
|
| 23 | 23 |
end |
| 24 | 24 |
|
| 25 | 25 |
def get_author_info |
| 26 | 26 |
# TODO: DELETE THIS METHOD?? |
| 27 |
info = {
|
|
| 27 |
info = {
|
|
| 28 | 28 |
:name_on_paper => self.name, |
| 29 | 29 |
:email => self.mail, |
| 30 | 30 |
:institution => "", |
| 31 | 31 |
:author_user_id => self.id, |
| 32 |
:is_user => "1"
|
|
| 32 |
:is_user => "1" |
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
if not self.ssamr_user_detail.nil? |
| 36 | 36 |
info[:institution] = self.ssamr_user_detail.institution_name |
| 37 | 37 |
end |
| 38 | 38 |
|
| 39 |
return info
|
|
| 39 |
return info |
|
| 40 | 40 |
end |
| 41 |
|
|
| 41 |
|
|
| 42 | 42 |
end #InstanceMethods |
| 43 |
|
|
| 43 |
|
|
| 44 | 44 |
end #UserPublicationsPatch |
| 45 | 45 |
end #RedmineBibliography |
| vendor/plugins/redmine_tags/app/controllers/tags_controller.rb | ||
|---|---|---|
| 1 |
class TagsController < ApplicationController |
|
| 2 |
|
|
| 3 |
def index |
|
| 4 |
respond_to do |format| |
|
| 5 |
format.html {
|
|
| 6 |
render :template => 'tags/index.html.erb', :layout => !request.xhr? |
|
| 7 |
} |
|
| 8 |
format.api {
|
|
| 9 |
} |
|
| 10 |
format.atom {
|
|
| 11 |
} |
|
| 12 |
end |
|
| 13 |
end |
|
| 14 |
|
|
| 15 |
end |
|
| vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb | ||
|---|---|---|
| 6 | 6 |
</p> |
| 7 | 7 |
<div id="project_tag_candidates" class="autocomplete"></div> |
| 8 | 8 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' -%> |
| 9 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}', true)" -%>
|
|
| 9 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags')}', true)" -%>
|
|
| 10 | 10 |
</div> |
| 11 | 11 |
<%- end -%> |
| 12 | 12 |
</p> |
| vendor/plugins/redmine_tags/app/views/projects/_filter_tags.html.erb | ||
|---|---|---|
| 7 | 7 |
<div id="project_tag_candidates" class="autocomplete"></div> |
| 8 | 8 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
| 9 | 9 |
|
| 10 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => Project.first.id)}')" %>
|
|
| 10 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}')" %>
|
|
| 11 | 11 |
</div> |
| 12 | 12 |
<% end -%> |
| 13 | 13 |
</p> |
| vendor/plugins/redmine_tags/app/views/projects/_tagcloud.html.erb | ||
|---|---|---|
| 1 |
<% content_for :header_tags do %> |
|
| 2 |
<%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> |
|
| 3 |
<% end %> |
|
| 4 | 1 |
|
| 5 | 2 |
<div id="tags"> |
| 6 | 3 |
<%= render_tags_list(Project.available_tags, :style => :cloud) %> |
| vendor/plugins/redmine_tags/app/views/projects/_tags_form.html.erb | ||
|---|---|---|
| 6 | 6 |
</p> |
| 7 | 7 |
<div id="project_tag_candidates" class="autocomplete"></div> |
| 8 | 8 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
| 9 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => Project.first.id)}', false)" %>
|
|
| 9 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}', false)" %>
|
|
| 10 | 10 |
</div> |
| 11 | 11 |
<% end -%> |
| vendor/plugins/redmine_tags/app/views/tags/index.html.erb | ||
|---|---|---|
| 1 |
<% content_for :header_tags do %> |
|
| 2 |
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
|
| 3 |
<%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> |
|
| 4 |
<% end %> |
|
| 5 |
|
|
| 6 |
|
|
| 7 |
<div style="clear:both;"></div> |
|
| 8 |
<h2> |
|
| 9 |
<%= l("label_project_tags_all") %>
|
|
| 10 |
</h2> |
|
| 11 |
|
|
| 12 |
<%= render_tags_list(Project.available_tags, :style => :cloud) %> |
|
| 13 |
|
|
Also available in: Unified diff