Revision 393:9595ab4cac6b vendor/plugins/redmine_bibliography/app/controllers

View differences:

vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
5 5
  # parse string with bibtex authors
6 6
  # return an ordered array
7 7
  def parse_authors
8
    
8

  
9 9
  end
10 10

  
11 11
  def parse_bibtex_file
12
  
12

  
13 13
  end
14 14

  
15 15
  def parse_bibtex_text
......
17 17

  
18 18
    if bibtex_entry
19 19
      bib = BibTeX.parse bibtex_entry
20
      
20

  
21 21
      # parses the bibtex entries
22 22
      bib.data.map do |d|
23 23
        result = ''
24 24
        if d.class == BibTeX::Entry
25
          @bentry = BibtexEntry.new
25 26
          #    d.replace!(bib.strings)
26
          
27
          result = [author, '. ', d.title].join
28
        end
27

  
28
          d.fields.keys.map do |k|
29
            @bentry[k] = d[k]
30
          end
31
        end                
29 32
      end
30 33

  
31
    end
32
  end 
34
      @publication.bibtex_entry = @bentry
35

  
36
      logger.error @publication.bibtex_entry
37

  
38
    end 
39
  end
33 40

  
34 41
  def new 
35 42
    @publication = Publication.new
36 43
    @publication.current_step = session[:publication_step]
37
        
44

  
38 45
  end
39 46

  
40 47
  def create    
......
43 50

  
44 51
    parse_bibtex_text
45 52

  
53
    if @publication.save
54
      logger.error "SAVED"
55
    else
56
      logger.error "NOT SAVED"
57
    end
58

  
46 59
    if params[:back_button]
47 60
      @publication.previous_step
48 61
    else
49 62
      @publication.next_step
50 63
    end
51
    
64

  
52 65
    session[:publication_step] = @publication.current_step
53
    
66

  
54 67
    render "new"
55 68
  end
56 69

  
......
75 88
    @authors = @publication.authors
76 89
  end
77 90

  
78

  
79 91
end

Also available in: Unified diff