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 @ 385:a6f8c0584a92

History | View | Annotate | Download (1.32 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 384:4be6b16bc6f9 luis
38
    if request.post?
39
      parse_bibtex_text
40
      @publication = Publication.new(params[:publication])
41
42
      if @publication.save
43
        logger.error "GRAVOU XXXdsfgXXX"
44
      else
45
        logger.error "nao gravou"
46
      end
47
48 376:ad71d0604ac2 luis
    end
49 384:4be6b16bc6f9 luis
50 328:aed18b463206 luis
  end
51
52
  def create
53 384:4be6b16bc6f9 luis
54 376:ad71d0604ac2 luis
    logger.error "AAAA create"
55 384:4be6b16bc6f9 luis
56 334:d750431a4102 luis
    @publication.save
57 329:4575b631f6ce luis
  end
58
59
  def index
60
    @publications = Publication.find(:all)
61 328:aed18b463206 luis
  end
62
63
  def edit
64 384:4be6b16bc6f9 luis
    logger.error "AAAA edit"
65 376:ad71d0604ac2 luis
66 328:aed18b463206 luis
  end
67
68
  def update
69 384:4be6b16bc6f9 luis
70
    logger.error "AAAA update"
71 376:ad71d0604ac2 luis
72
73 328:aed18b463206 luis
  end
74 329:4575b631f6ce luis
75
  def show
76
    @publication = Publication.find(params[id])
77
    @authors = @publication.authors
78
  end
79
80
81 328:aed18b463206 luis
end