To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / vendor / plugins / redmine_bibliography / app / controllers / publications_controller.rb @ 386:8ed0a0a268e0

History | View | Annotate | Download (1.38 KB)

1 385:a6f8c0584a92 luis
# vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
2
3 328:aed18b463206 luis
class PublicationsController < ApplicationController
4
5 385:a6f8c0584a92 luis
  # parse string with bibtex authors
6
  # return an ordered array
7
  def parse_authors
8
9
  end
10
11
  def parse_bibtex_file
12
13
  end
14
15 384:4be6b16bc6f9 luis
  def parse_bibtex_text
16
    bibtex_entry = params[:bibtex_entry]
17
18 385:a6f8c0584a92 luis
    if bibtex_entry
19
      bib = BibTeX.parse bibtex_entry
20
21
      # parses the bibtex entries
22
      bib.data.map do |d|
23
        result = ''
24
        if d.class == BibTeX::Entry
25
          #    d.replace!(bib.strings)
26
          result = [d.author, '. ', d.title].join
27
        end
28 384:4be6b16bc6f9 luis
29 385:a6f8c0584a92 luis
        logger.error result
30 384:4be6b16bc6f9 luis
      end
31
    end
32
  end
33
34 385:a6f8c0584a92 luis
  def new
35
    session[:publication_params] ||= {}
36
    @publication = Publication.new
37 386:8ed0a0a268e0 luis
    @publication.current_step = session[:publication_step]
38 384:4be6b16bc6f9 luis
39
    if request.post?
40
      parse_bibtex_text
41
      @publication = Publication.new(params[:publication])
42
43
      if @publication.save
44
        logger.error "GRAVOU XXXdsfgXXX"
45
      else
46
        logger.error "nao gravou"
47
      end
48
49 376:ad71d0604ac2 luis
    end
50 384:4be6b16bc6f9 luis
51 328:aed18b463206 luis
  end
52
53
  def create
54 384:4be6b16bc6f9 luis
55 376:ad71d0604ac2 luis
    logger.error "AAAA create"
56 384:4be6b16bc6f9 luis
57 334:d750431a4102 luis
    @publication.save
58 329:4575b631f6ce luis
  end
59
60
  def index
61
    @publications = Publication.find(:all)
62 328:aed18b463206 luis
  end
63
64
  def edit
65 384:4be6b16bc6f9 luis
    logger.error "AAAA edit"
66 376:ad71d0604ac2 luis
67 328:aed18b463206 luis
  end
68
69
  def update
70 384:4be6b16bc6f9 luis
71
    logger.error "AAAA update"
72 376:ad71d0604ac2 luis
73
74 328:aed18b463206 luis
  end
75 329:4575b631f6ce luis
76
  def show
77
    @publication = Publication.find(params[id])
78
    @authors = @publication.authors
79
  end
80
81
82 328:aed18b463206 luis
end