')
+ second_part = rest.join(" ")
+ part_to_throw_away, *after_img = second_part.split('Imprimir Currículo')
+ string = first_part_to_keep + after_img.join(" ")
+ end
+
+ def remove_further_informations(string = "")
+ first_part_to_keep, *rest = string.split('
',2)
+ string = first_part_to_keep + after_img.join(" ")
+ end
+end
diff --git a/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb b/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb
new file mode 100755
index 0000000..902baba
--- /dev/null
+++ b/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb
@@ -0,0 +1,49 @@
+class LattesCurriculumPlugin < Noosfero::Plugin
+
+ def self.plugin_name
+ "LattesCurriculumPlugin"
+ end
+
+ def self.plugin_description
+ _("A plugin that imports the lattes curriculum into the users profiles")
+ end
+
+ def js_files
+ ["singup_complement.js"]
+ end
+
+ def stylesheet?
+ true
+ end
+
+ def signup_extra_contents
+ lambda {
+ content_tag(:div, labelled_form_field(_('URL Lattes'), text_field(:profile_data, :lattes_url, :id => 'lattes_id_field')) +
+ content_tag(:small, _('The Lattes url is the link for your own curriculum so it\'ll be shown on your profile.'),
+ :class => 'signup-form', :id => 'lattes-id-balloon'), :id => 'signup-lattes-id')
+ }
+ end
+
+ def profile_info_extra_contents
+ if context.profile.person?
+ lattes_url = context.profile.lattes_url
+ lambda {
+ content_tag('div', labelled_form_field(_('URL Lattes'), text_field_tag('profile_data[lattes_url]', lattes_url, :id => 'lattes_url_field', :disabled => false)) +
+ content_tag(:small, _('The url lattes is the link for your lattes curriculum.')))
+ }
+ end
+ end
+
+ def profile_tabs
+ unless context.profile.lattes_url.nil?
+ href = context.profile.lattes_url
+ html_parser = Html_parser.new
+ {
+ :title => _("Lattes"),
+ :id => 'lattes_tab',
+ :content => lambda{html_parser.get_html(href)},
+ :start => false
+ }
+ end
+ end
+end
diff --git a/plugins/lattes_curriculum/public/images/grey-bg.png b/plugins/lattes_curriculum/public/images/grey-bg.png
new file mode 100644
index 0000000..1e73fba
--- /dev/null
+++ b/plugins/lattes_curriculum/public/images/grey-bg.png
@@ -0,0 +1,12 @@
+8950 4e47 0d0a 1a0a 0000 000d 4948 4452
+0000 0009 0000 0027 0806 0000 00dd 3762
+5600 0000 0173 5247 4200 aece 1ce9 0000
+0006 624b 4744 00ff 00ff 00ff a0bd a793
+0000 0009 7048 5973 0000 0dd7 0000 0dd7
+0142 289b 7800 0000 0774 494d 4507 dc05
+040f 1a01 22dc e3a3 0000 003b 4944 4154
+38cb 635c 30bd f53f 0301 c0c4 4004 188c
+8a58 18fe 13a3 8808 552c ff87 6810 101b
+4eff 87af efa8 1704 c33e 1550 29b7 0c4a
+dffd 1fa2 b905 009c 4210 1067 9fec 9d00
+0000 0049 454e 44ae 4260 82
\ No newline at end of file
diff --git a/plugins/lattes_curriculum/public/singup_complement.js b/plugins/lattes_curriculum/public/singup_complement.js
new file mode 100644
index 0000000..1ca7d94
--- /dev/null
+++ b/plugins/lattes_curriculum/public/singup_complement.js
@@ -0,0 +1,16 @@
+jQuery(function($) {
+ $(document).ready(function(){
+ $('#lattes_id_field').blur(function() {
+ var value = this.value
+
+ })
+
+ $('#lattes_id_field').focus(function() {
+ $('#lattes-id-balloon').fadeIn('slow')
+ })
+
+ $('#lattes_id_field').blur(function() {
+ $('#lattes-id-balloon').fadeOut('slow')
+ })
+ })
+})
\ No newline at end of file
diff --git a/plugins/lattes_curriculum/public/style.css b/plugins/lattes_curriculum/public/style.css
new file mode 100644
index 0000000..66630e9
--- /dev/null
+++ b/plugins/lattes_curriculum/public/style.css
@@ -0,0 +1,37 @@
+#signup-form label[for="lattes_id_field"],
+{
+ display: block;
+}
+
+#signup-form small#lattes-id-balloon
+{
+ display: none;
+ width: 142px;
+ height: 69px;
+ color: #FFFFFF;
+ font-weight: bold;
+ font-size: 11px;
+ padding: 5px 10px 45px 10px;
+ margin: 0;
+ line-height: 1.5em;
+ background: transparent url(/images/gray-balloon.png) bottom center no-repeat;
+ position: absolute;
+ z-index: 2;
+ right: -150px;
+ top: -75px;
+}
+
+#signup-form .formfield.checking {
+ border-color: transparent;
+ background-image: none;
+}
+
+#signup-form small#lattes-id-balloon
+{
+ top: -80px;
+}
+
+#signup-form #signup-lattes-id
+{
+ position: relative;
+}
diff --git a/plugins/lattes_curriculum/test/unit/html_parser_test.rb b/plugins/lattes_curriculum/test/unit/html_parser_test.rb
new file mode 100644
index 0000000..a1dfa70
--- /dev/null
+++ b/plugins/lattes_curriculum/test/unit/html_parser_test.rb
@@ -0,0 +1,21 @@
+require "test_helper"
+
+class HtmlParserTest < ActiveSupport::TestCase
+
+ def setup
+ @parser = Html_parser.new
+ end
+
+ should 'be not nil the instance' do
+ assert_not_nil @parser
+ end
+
+ should 'be not nil the return get_html' do
+ assert_not_nil @parser.get_html("http://lattes.cnpq.br/2193972715230641")
+ end
+
+ should 'return a string the return get_html' do
+ assert_equal "", @parser.get_html()
+ end
+
+end
diff --git a/plugins/lattes_curriculum/test/unit/lattes_curriculum_test.rb b/plugins/lattes_curriculum/test/unit/lattes_curriculum_test.rb
new file mode 100644
index 0000000..ce76cb2
--- /dev/null
+++ b/plugins/lattes_curriculum/test/unit/lattes_curriculum_test.rb
@@ -0,0 +1,25 @@
+require "test_helper"
+
+class LattesCurriculumPluginTest < ActiveSupport::TestCase
+
+ def setup
+ @plugin = LattesCurriculumPlugin.new
+ end
+
+ should 'be a noosfero plugin' do
+ assert_kind_of Noosfero::Plugin, @plugin
+ end
+
+ should 'have name' do
+ assert_equal 'LattesCurriculumPlugin', LattesCurriculumPlugin.plugin_name
+ end
+
+ should 'have description' do
+ assert_equal _('A plugin that imports the lattes curriculum into the users profiles'), LattesCurriculumPlugin.plugin_description
+ end
+
+ should 'have stylesheet' do
+ assert @plugin.stylesheet?
+ end
+
+end
--
libgit2 0.21.2