diff vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 684:cd7e10c4ab86 feature_36

Feature #238 - Edit Publication now showing the correct fields.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 16 Sep 2011 13:17:28 +0100
parents c3e6c51170fa
children 4481db876cdb
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Sep 16 11:14:10 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Sep 16 13:17:28 2011 +0100
@@ -63,7 +63,7 @@
   end
 
   def get_bibtex_required_fields
-    all_fields = [ "editor", "publisher", "chapter", "pages", "volume", "series", "address", "edition", "year", "type", "note", "number", "journal", "howpublished", "key", "school", "month" ]
+    all_fields = [ "editor", "publisher", "chapter", "pages", "volume", "series", "address", "edition", "month", "year", "type", "note", "number", "journal", "howpublished", "key", "school" ]
 
     fields = Hash.new
     fields[ 'article' ] = [ 'journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ]
@@ -112,11 +112,32 @@
     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 = []  
+    
+    
+    fields = Hash.new
+    fields[ 'article' ] = [ 'journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ]
+    fields[ 'book' ] = [ 'editor', 'publisher', 'volume', 'series', 'address', 'edition', 'month', 'year', 'note' ]
+    fields[ 'booklet' ] = [ 'howpublished', 'address', 'year', 'month', 'note', 'key' ]
+    fields[ 'conference' ] = [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ]
+    fields[ 'inbook' ] = [ 'editor', 'publisher', 'chapter', 'pages', 'volume', 'series', 'address', 'edition', 'year', 'note' ]
+    fields[ 'incollection' ] = [ 'editor', 'publisher', 'chapter', 'pages', 'volume', 'series', 'address', 'edition', 'year', 'note' ]
+    fields[ 'inproceedings' ] = [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ]
+    fields[ 'manual' ] = [ 'organization', 'address', 'edition', 'month', 'year', 'note' ]
+    fields[ 'masterthesis' ] = [ 'school', 'year', 'address', 'month', 'note' ]
+    fields[ 'misc' ] = [ 'howpublished', 'month', 'year', 'note' ]
+    fields[ 'phdthesis' ] = [ 'school', 'year', 'address', 'month', 'note' ]
+    fields[ 'proceedings' ] = [ 'booktitle', 'year', 'editor', 'pages', 'organization', 'publisher', 'address', 'month', 'note' ]
+    fields[ 'techreport' ] = [ 'year', 'type', 'number', 'address', 'month', 'note' ]
+    fields[ 'unpublished' ] = [ 'note', 'month', 'year' ]
+    
+    entrytype = BibtexEntryType.find(@selected_bibtex_entry_type_id).name
+    
+    @bibtype_fields = fields[entrytype]
+    
   end
 
   def update    
@@ -141,7 +162,7 @@
 
   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!'