Commit 3cc0d8679a26274f38228a31f6c9e5d0c449edb1

Authored by Diego Camarinha
Committed by Paulo Meireles
1 parent a45410ce

[Mezuro] Inserted license combo box in project content.

plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... ... @@ -9,6 +9,14 @@ class MezuroPlugin::Helpers::ContentViewerHelper
9 9 [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]]
10 10 end
11 11  
  12 + def self.create_license_options
  13 + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml")
  14 + options = options.split(";")
  15 + formated_options = []
  16 + options.each { |option| formated_options << [option, option] }
  17 + formated_options
  18 + end
  19 +
12 20 def self.generate_chart(values)
13 21 Gchart.line(
14 22 :title_color => 'FF0000',
... ... @@ -31,4 +39,10 @@ class MezuroPlugin::Helpers::ContentViewerHelper
31 39 def self.format_name(metric_result)
32 40 metric_result.metric.name.delete("() ")
33 41 end
  42 +
  43 + def self.get_license_option(selected)
  44 + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml")
  45 + options.split(";")
  46 + selected_option = options.find { |license| license == selected }
  47 + end
34 48 end
... ...
plugins/mezuro/licenses.yaml.example 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +Academic Free License 3.0 (AFL-3.0);
  2 +Affero GNU Public License (AGPL-3.0);
  3 +Adaptive Public License (APL-1.0);
  4 +Apache License 2.0 (Apache-2.0);
  5 +Apple Public Source License (APSL-2.0);
  6 +Artistic license 2.0 (Artistic-2.0);
  7 +Attribution Assurance Licenses (AAL);
  8 +BSD 3-Clause "New" or "Revised" License (BSD-3-Clause);
  9 +BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause);
  10 +Boost Software License (BSL-1.0);
  11 +Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1);
  12 +Common Development and Distribution License 1.0 (CDDL-1.0);
  13 +Common Public Attribution License 1.0 (CPAL-1.0);
  14 +CUA Office Public License Version 1.0 (CUA-OPL-1.0);
  15 +EU DataGrid Software License (EUDatagrid);
  16 +Eclipse Public License 1.0 (EPL-1.0);
  17 +Educational Community License, Version 2.0 (ECL-2.0);
  18 +Eiffel Forum License V2.0 (EFL-2.0);
  19 +Entessa Public License (Entessa);
  20 +European Union Public License, Version 1.1 (EUPL-1.1);
  21 +Fair License (FAIR);
  22 +Frameworx License (Frameworx-1.0);
  23 +GNU Affero General Public License v3 (AGPL-3.0);
  24 +GNU General Public License version 2.0 (GPL-2.0);
  25 +GNU General Public License version 3.0 (GPL-3.0);
  26 +GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1);
  27 +GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0);
  28 +Historical Permission Notice and Disclaimer (HPND);
  29 +IBM Public License 1.0 (IPL-1.0);
  30 +IPA Font License (IPA);
  31 +ISC License (ISC);
  32 +LaTeX Project Public License 1.3c (LPPL-1.3c);
  33 +Lucent Public License Version 1.02 (LPL-1.02);
  34 +MirOS Licence (MirOS);
  35 +Microsoft Public License (Ms-PL);
  36 +Microsoft Reciprocal License (Ms-RL);
  37 +MIT license (MIT);
  38 +Motosoto License (Motosoto);
  39 +Mozilla Public License 2.0 (MPL-2.0);
  40 +Multics License (Multics);
  41 +NASA Open Source Agreement 1.3 (NASA 1.3);
  42 +NTP License (NTP);
  43 +Naumen Public License (Naumen);
  44 +Nethack General Public License (NGPL);
  45 +Nokia Open Source License (Nokia);
  46 +Non-Profit Open Software License 3.0 (NPOSL-3.0);
  47 +OCLC Research Public License 2.0 (OCLC-2.0);
  48 +Open Font License 1.1 (OFL 1.1);
  49 +Open Group Test Suite License (OGTSL);
  50 +Open Software License 3.0 (OSL-3.0);
  51 +PHP License 3.0 (PHP-3.0);
  52 +The PostgreSQL License (PostgreSQL);
  53 +Python License (Python-2.0);
  54 +CNRI Python license (CNRI-Python);
  55 +Q Public License (QPL-1.0);
  56 +RealNetworks Public Source License V1.0 (RPSL-1.0);
  57 +Reciprocal Public License 1.5 (RPL-1.5);
  58 +Ricoh Source Code Public License (RSCPL);
  59 +Simple Public License 2.0 (SimPL-2.0);
  60 +Sleepycat License (Sleepycat);
  61 +Sun Public License 1.0 (SPL-1.0);
  62 +Sybase Open Watcom Public License 1.0 (Watcom-1.0);
  63 +University of Illinois/NCSA Open Source License (NCSA);
  64 +Vovida Software License v. 1.0 (VSL-1.0);
  65 +W3C License (W3C);
  66 +wxWindows Library License (WXwindows);
  67 +X.Net License (Xnet);
  68 +Zope Public License 2.0 (ZPL-2.0);
  69 +zlib/libpng license (Zlib);
... ...
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
... ... @@ -24,7 +24,9 @@
24 24 <%= required f.text_field(:name) %>
25 25 <% end %>
26 26  
27   -<%= f.text_field :project_license %><br/>
  27 +<% selected = (@project.nil? ? "" : @project.license) %>
  28 +<%= required labelled_form_field _('License'),
  29 + f.select(:project_license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options ,{:selected => selected}) %><br/>
28 30  
29 31 <%= f.text_field :description %><br/>
30 32  
... ...