Commit 794a4d5abb0a273d994d69707f1b20096779e055
Committed by
Paulo Meireles
Exists in
master
and in
29 other branches
Merge branch 'mezuro-dev' of gitorious.org:+mezuro/noosfero/mezuro into mezuro-dev
Showing
30 changed files
with
232 additions
and
225 deletions
Show diff stats
plugins/mezuro/SERVICE
plugins/mezuro/controllers/myprofile/mezuro_plugin_base_tool_controller.rb
@@ -2,16 +2,9 @@ class MezuroPluginBaseToolController < MezuroPluginMyprofileController | @@ -2,16 +2,9 @@ class MezuroPluginBaseToolController < MezuroPluginMyprofileController | ||
2 | 2 | ||
3 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') | 3 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
4 | 4 | ||
5 | - def choose_base_tool | ||
6 | - @configuration_content = profile.articles.find(params[:id]) | ||
7 | - @base_tools = Kalibro::BaseTool.all_names | ||
8 | - end | ||
9 | - | ||
10 | def choose_metric | 5 | def choose_metric |
11 | @configuration_content = profile.articles.find(params[:id]) | 6 | @configuration_content = profile.articles.find(params[:id]) |
12 | - @base_tool = params[:base_tool] | ||
13 | - base_tool = Kalibro::BaseTool.find_by_name(@base_tool) | ||
14 | - @supported_metrics = base_tool.nil? ? [] : base_tool.supported_metrics | 7 | + @base_tools = Kalibro::BaseTool.all |
15 | end | 8 | end |
16 | 9 | ||
17 | end | 10 | end |
plugins/mezuro/lib/kalibro/base_tool.rb
@@ -10,6 +10,11 @@ class Kalibro::BaseTool < Kalibro::Model | @@ -10,6 +10,11 @@ class Kalibro::BaseTool < Kalibro::Model | ||
10 | new request("BaseTool", :get_base_tool, {:base_tool_name => base_tool_name})[:base_tool] | 10 | new request("BaseTool", :get_base_tool, {:base_tool_name => base_tool_name})[:base_tool] |
11 | end | 11 | end |
12 | 12 | ||
13 | + def self.all | ||
14 | + basetools = all_names | ||
15 | + basetools.map{ |name| find_by_name(name) } | ||
16 | + end | ||
17 | + | ||
13 | def supported_metric=(value) | 18 | def supported_metric=(value) |
14 | @supported_metric = Kalibro::NativeMetric.to_objects_array value | 19 | @supported_metric = Kalibro::NativeMetric.to_objects_array value |
15 | end | 20 | end |
plugins/mezuro/lib/kalibro/model.rb
@@ -88,7 +88,7 @@ class Kalibro::Model | @@ -88,7 +88,7 @@ class Kalibro::Model | ||
88 | end | 88 | end |
89 | 89 | ||
90 | def self.client(endpoint) | 90 | def self.client(endpoint) |
91 | - service_address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") | 91 | + service_address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yml") |
92 | Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") | 92 | Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") |
93 | end | 93 | end |
94 | 94 |
plugins/mezuro/lib/mezuro_plugin.rb
@@ -14,8 +14,12 @@ class MezuroPlugin < Noosfero::Plugin | @@ -14,8 +14,12 @@ class MezuroPlugin < Noosfero::Plugin | ||
14 | _("A metric analizer plugin.") | 14 | _("A metric analizer plugin.") |
15 | end | 15 | end |
16 | 16 | ||
17 | - def content_types | ||
18 | - [MezuroPlugin::ConfigurationContent, MezuroPlugin::ProjectContent] | 17 | + def control_panel_buttons |
18 | + if context.profile.is_a?(Community) | ||
19 | + {:title => _('Mezuro Project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' } | ||
20 | + else | ||
21 | + {:title => _('Mezuro Configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' } | ||
22 | + end | ||
19 | end | 23 | end |
20 | 24 | ||
21 | def stylesheet? | 25 | def stylesheet? |
plugins/mezuro/lib/mezuro_plugin/configuration_content.rb
@@ -7,7 +7,7 @@ class MezuroPlugin::ConfigurationContent < Article | @@ -7,7 +7,7 @@ class MezuroPlugin::ConfigurationContent < Article | ||
7 | after_destroy :remove_kalibro_configuration_from_service | 7 | after_destroy :remove_kalibro_configuration_from_service |
8 | 8 | ||
9 | def self.short_description | 9 | def self.short_description |
10 | - 'Kalibro configuration' | 10 | + 'Mezuro configuration' |
11 | end | 11 | end |
12 | 12 | ||
13 | def self.description | 13 | def self.description |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
@@ -11,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -11,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def self.create_license_options | 13 | def self.create_license_options |
14 | - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | 14 | + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml") |
15 | options = options.split(";") | 15 | options = options.split(";") |
16 | formated_options = [] | 16 | formated_options = [] |
17 | options.each { |option| formated_options << [option, option] } | 17 | options.each { |option| formated_options << [option, option] } |
@@ -50,7 +50,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -50,7 +50,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
50 | end | 50 | end |
51 | 51 | ||
52 | def self.get_license_option(selected) | 52 | def self.get_license_option(selected) |
53 | - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | 53 | + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml") |
54 | options.split(";") | 54 | options.split(";") |
55 | selected_option = options.find { |license| license == selected } | 55 | selected_option = options.find { |license| license == selected } |
56 | end | 56 | end |
plugins/mezuro/lib/mezuro_plugin/project_content.rb
@@ -7,7 +7,7 @@ class MezuroPlugin::ProjectContent < Article | @@ -7,7 +7,7 @@ class MezuroPlugin::ProjectContent < Article | ||
7 | validate_on_create :validate_repository_url | 7 | validate_on_create :validate_repository_url |
8 | 8 | ||
9 | def self.short_description | 9 | def self.short_description |
10 | - 'Kalibro project' | 10 | + 'Mezuro project' |
11 | end | 11 | end |
12 | 12 | ||
13 | def self.description | 13 | def self.description |
plugins/mezuro/licenses.yaml.example
@@ -1,69 +0,0 @@ | @@ -1,69 +0,0 @@ | ||
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); |
@@ -0,0 +1,69 @@ | @@ -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); |
3.82 KB
plugins/mezuro/public/style.css
@@ -30,3 +30,8 @@ a:link,active,visited .ancestor{ | @@ -30,3 +30,8 @@ a:link,active,visited .ancestor{ | ||
30 | font-style: underline; | 30 | font-style: underline; |
31 | display: inline; | 31 | display: inline; |
32 | } | 32 | } |
33 | + | ||
34 | +.controller-profile_editor a.control-panel-mezuro, | ||
35 | + .controller-profile_editor .msie6 a.control-panel-mezuro { | ||
36 | + background-image: url(icons/mezuro.png) | ||
37 | +} |
plugins/mezuro/service.yaml.example
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +http://localhost:8080/KalibroService/ |
plugins/mezuro/test/features/echo_port_test.rb
@@ -9,7 +9,7 @@ class EchoPortTest < ActiveSupport::TestCase | @@ -9,7 +9,7 @@ class EchoPortTest < ActiveSupport::TestCase | ||
9 | 9 | ||
10 | def setup | 10 | def setup |
11 | @port = Kalibro::Client::Port.new('Echo') | 11 | @port = Kalibro::Client::Port.new('Echo') |
12 | - address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") | 12 | + address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yml") |
13 | address['KalibroService'] = 'KalibroFake' | 13 | address['KalibroService'] = 'KalibroFake' |
14 | @port.service_address=(address); | 14 | @port.service_address=(address); |
15 | end | 15 | end |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_base_tool_controller_test.rb
@@ -22,20 +22,12 @@ class MezuroPluginBaseToolControllerTest < ActionController::TestCase | @@ -22,20 +22,12 @@ class MezuroPluginBaseToolControllerTest < ActionController::TestCase | ||
22 | @content.save | 22 | @content.save |
23 | end | 23 | end |
24 | 24 | ||
25 | - should 'test choose base tool' do | ||
26 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name}) | ||
27 | - get :choose_base_tool, :profile => @profile.identifier, :id => @content.id | ||
28 | - assert_equal [@base_tool.name], assigns(:base_tools) | ||
29 | - assert_equal @content, assigns(:configuration_content) | ||
30 | - assert_response 200 | ||
31 | - end | ||
32 | - | ||
33 | should 'test choose metric' do | 25 | should 'test choose metric' do |
26 | + Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name}) | ||
34 | Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | 27 | Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) |
35 | - get :choose_metric, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name | 28 | + get :choose_metric, :profile => @profile.identifier, :id => @content.id |
29 | + assert_equal @base_tool.name, assigns(:base_tools).first.name | ||
36 | assert_equal @content, assigns(:configuration_content) | 30 | assert_equal @content, assigns(:configuration_content) |
37 | - assert_equal @base_tool.name, assigns(:base_tool) | ||
38 | - assert_equal @base_tool.supported_metric[0].name, assigns(:supported_metrics)[0].name | ||
39 | assert_response 200 | 31 | assert_response 200 |
40 | end | 32 | end |
41 | 33 |
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
@@ -14,7 +14,7 @@ class ConfigurationContentTest < ActiveSupport::TestCase | @@ -14,7 +14,7 @@ class ConfigurationContentTest < ActiveSupport::TestCase | ||
14 | end | 14 | end |
15 | 15 | ||
16 | should 'provide proper short description' do | 16 | should 'provide proper short description' do |
17 | - assert_equal 'Kalibro configuration', MezuroPlugin::ConfigurationContent.short_description | 17 | + assert_equal 'Mezuro configuration', MezuroPlugin::ConfigurationContent.short_description |
18 | end | 18 | end |
19 | 19 | ||
20 | should 'provide proper description' do | 20 | should 'provide proper description' do |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
@@ -16,7 +16,7 @@ class ProjectContentTest < ActiveSupport::TestCase | @@ -16,7 +16,7 @@ class ProjectContentTest < ActiveSupport::TestCase | ||
16 | end | 16 | end |
17 | 17 | ||
18 | should 'provide proper short description' do | 18 | should 'provide proper short description' do |
19 | - assert_equal 'Kalibro project', MezuroPlugin::ProjectContent.short_description | 19 | + assert_equal 'Mezuro project', MezuroPlugin::ProjectContent.short_description |
20 | end | 20 | end |
21 | 21 | ||
22 | should 'provide proper description' do | 22 | should 'provide proper description' do |
plugins/mezuro/test/unit/mezuro_plugin_test.rb
@@ -18,14 +18,6 @@ class MezuroPluginTest < ActiveSupport::TestCase | @@ -18,14 +18,6 @@ class MezuroPluginTest < ActiveSupport::TestCase | ||
18 | assert_equal _('A metric analizer plugin.'), MezuroPlugin.plugin_description | 18 | assert_equal _('A metric analizer plugin.'), MezuroPlugin.plugin_description |
19 | end | 19 | end |
20 | 20 | ||
21 | - should 'have configuration content type' do | ||
22 | - assert_includes @plugin.content_types, MezuroPlugin::ConfigurationContent | ||
23 | - end | ||
24 | - | ||
25 | - should 'have project content type' do | ||
26 | - assert_includes @plugin.content_types, MezuroPlugin::ProjectContent | ||
27 | - end | ||
28 | - | ||
29 | should 'have stylesheet' do | 21 | should 'have stylesheet' do |
30 | assert @plugin.stylesheet? | 22 | assert @plugin.stylesheet? |
31 | end | 23 | end |
plugins/mezuro/views/content_viewer/_metric_configuration_form.rhtml
0 → 100644
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
2 | + <%= hidden_field_tag :id, @configuration_content.id %> | ||
3 | + <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
4 | + | ||
5 | + <% f.fields_for :metric do |m| %> | ||
6 | + | ||
7 | + <% @metric.language.each do |language| %> | ||
8 | + <%= m.hidden_field :language, :multiple => true, :value => language %> | ||
9 | + <% end %> | ||
10 | + | ||
11 | + <%= m.hidden_field "scope", :value => @metric.scope %> | ||
12 | + <p> | ||
13 | + <b><%= m.label :origin, "Collector Name:" %></b> | ||
14 | + <%= @metric.origin %> | ||
15 | + <%= m.hidden_field "origin", :value => @metric.origin %> | ||
16 | + </p> | ||
17 | + <p> | ||
18 | + <b><%= m.label :metric_name, "Metric Name:" %></b> | ||
19 | + <%= @metric.name %> | ||
20 | + <%= m.hidden_field "name", :value => @metric.name %> | ||
21 | + </p> | ||
22 | + <% end %> | ||
23 | + <p> | ||
24 | + <b><%= f.label :code, "Code:" %></b> | ||
25 | + <%= @metric_configuration.code %> | ||
26 | + <%= f.hidden_field "code", :value => @metric_configuration.code %> | ||
27 | + </p> | ||
28 | + <p> | ||
29 | + <b><%= f.label :aggregation_form, "Aggregation Form:" %></b> | ||
30 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
31 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
32 | + </p> | ||
33 | + <p> | ||
34 | + <b><%= f.label :weight, "Weight:" %></b> | ||
35 | + <%= f.text_field "weight", :value => @metric_configuration.weight %> | ||
36 | + </p> | ||
37 | + | ||
38 | + <p> | ||
39 | + <%= f.submit "Save" %> | ||
40 | + </p> | ||
41 | +<% end %> |
plugins/mezuro/views/content_viewer/_metric_configuration_view.rhtml
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +<p> | ||
2 | + <b>Collector Name:</b> <%= @metric.origin %> | ||
3 | +</p> | ||
4 | +<p> | ||
5 | + <b>Metric Name:</b> <%= @metric.name %> | ||
6 | +</p> | ||
7 | +<p> | ||
8 | + <b>Code:</b> <%= @metric_configuration.code %> | ||
9 | +</p> | ||
10 | +<p> | ||
11 | + <b>Aggregation Form:</b> <%= @metric_configuration.aggregation_form %> | ||
12 | +</p> | ||
13 | +<p> | ||
14 | + <b>Weight:</b> <%= @metric_configuration.weight %> | ||
15 | +</p> |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
1 | <% @configuration_content = @page | 1 | <% @configuration_content = @page |
2 | @kalibro_configuration = @page.kalibro_configuration %> | 2 | @kalibro_configuration = @page.kalibro_configuration %> |
3 | +<% owner = (not user.nil?) && user.id == @profile.id %> | ||
4 | + | ||
3 | <% unless @page.errors[:base].nil? %> | 5 | <% unless @page.errors[:base].nil? %> |
4 | <% if @page.errors[:base] =~ /There is no configuration named/ %> | 6 | <% if @page.errors[:base] =~ /There is no configuration named/ %> |
5 | <h3>Warning:</h3> | 7 | <h3>Warning:</h3> |
6 | - <p>This Configuration doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | 8 | + <p>This Configuration doesn't exist on the Web Service.</p> |
9 | + <% if owner %> | ||
10 | + <p> Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | ||
11 | + <% end %> | ||
7 | <% else %> | 12 | <% else %> |
8 | <%= @page.errors[:base] %> | 13 | <%= @page.errors[:base] %> |
9 | <% end %> | 14 | <% end %> |
@@ -22,42 +27,44 @@ | @@ -22,42 +27,44 @@ | ||
22 | 27 | ||
23 | <br/> | 28 | <br/> |
24 | 29 | ||
25 | - <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_base_tool", | 30 | + <% if owner %> |
31 | + <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_base_tool", | ||
26 | :profile => @page.profile.identifier, | 32 | :profile => @page.profile.identifier, |
27 | - :action => "choose_base_tool", | 33 | + :action => "choose_metric", |
28 | :id => @configuration_content.id %><br/> | 34 | :id => @configuration_content.id %><br/> |
35 | + <% end %> | ||
29 | 36 | ||
30 | <table> | 37 | <table> |
31 | <tr class="titles"> | 38 | <tr class="titles"> |
32 | <td><h5>Metric Name</h5></td> | 39 | <td><h5>Metric Name</h5></td> |
33 | <td><h5>Collector Name</h5></td> | 40 | <td><h5>Collector Name</h5></td> |
34 | <td><h5>Metric Code</h5></td> | 41 | <td><h5>Metric Code</h5></td> |
35 | - <td/><td/> | 42 | + <td/> |
36 | </tr> | 43 | </tr> |
37 | <% @kalibro_configuration.metric_configurations.each do |metric_configuration| %> | 44 | <% @kalibro_configuration.metric_configurations.each do |metric_configuration| %> |
38 | <tr class="metric"> | 45 | <tr class="metric"> |
39 | - <td><%= metric_configuration.metric.name %></td> | ||
40 | <% if metric_configuration.metric.instance_of? Kalibro::NativeMetric %> | 46 | <% if metric_configuration.metric.instance_of? Kalibro::NativeMetric %> |
47 | + <td><%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "edit_metric_configuration", | ||
48 | + :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, | ||
49 | + :profile => @page.profile.identifier %></td> | ||
41 | <td> | 50 | <td> |
42 | <%= metric_configuration.metric.origin %> | 51 | <%= metric_configuration.metric.origin %> |
43 | </td> | 52 | </td> |
44 | <td><%= metric_configuration.code %></td> | 53 | <td><%= metric_configuration.code %></td> |
45 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", :action => "edit_metric_configuration", | ||
46 | - :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, | ||
47 | - :profile => @page.profile.identifier %></td> | ||
48 | <% else %> | 54 | <% else %> |
55 | + <td><%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", | ||
56 | + :action => "edit_compound_metric_configuration", :metric_name => metric_configuration.metric.name, | ||
57 | + :id => @configuration_content.id, :profile => @page.profile.identifier %></td> | ||
49 | <td> | 58 | <td> |
50 | Compound Metric | 59 | Compound Metric |
51 | </td> | 60 | </td> |
52 | <td><%= metric_configuration.code %></td> | 61 | <td><%= metric_configuration.code %></td> |
53 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", | ||
54 | - :action => "edit_compound_metric_configuration", :metric_name => metric_configuration.metric.name, | ||
55 | - :id => @configuration_content.id, :profile => @page.profile.identifier %></td> | ||
56 | <% end %> | 62 | <% end %> |
57 | - | ||
58 | - <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove_metric_configuration", | 63 | + <% if owner %> |
64 | + <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove_metric_configuration", | ||
59 | :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, | 65 | :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, |
60 | :profile => @page.profile.identifier %></td> | 66 | :profile => @page.profile.identifier %></td> |
67 | + <% end %> | ||
61 | </tr> | 68 | </tr> |
62 | <% end %> | 69 | <% end %> |
63 | </table> | 70 | </table> |
plugins/mezuro/views/mezuro_plugin_base_tool/choose_base_tool.html.erb
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -<h2><%= @configuration_content.name%> Configuration</h2> | ||
2 | - | ||
3 | -<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound_metric_configuration", | ||
4 | - :id => @configuration_content.id %> | ||
5 | - | ||
6 | -<h5>Base Tools:</h5> | ||
7 | -<table id="project_info"> | ||
8 | - <% @base_tools.each do |base_tool| %> | ||
9 | - <tr> | ||
10 | - <td> | ||
11 | - <%= link_to base_tool, :controller => "mezuro_plugin_base_tool", :action => "choose_metric", :base_tool => base_tool, | ||
12 | - :id => @configuration_content.id %> | ||
13 | - </td> | ||
14 | - </tr> | ||
15 | - <% end %> | ||
16 | -</table> |
plugins/mezuro/views/mezuro_plugin_base_tool/choose_metric.html.erb
1 | -<h2><%= @configuration_content.name %> Configuration</h2> | 1 | +<h2><%= @configuration_content.name%> Configuration</h2> |
2 | 2 | ||
3 | -<table id="project_info"> | ||
4 | - <tr> | ||
5 | - <h5>Metric Collector: <%= @base_tool %></h5> | ||
6 | - </tr> | ||
7 | - <tr> | ||
8 | - <h5>Choose a metric to add:</h5> | ||
9 | - </tr> | ||
10 | - <% @supported_metrics.each do |metric| %> | ||
11 | - <tr class="metric" title="<%= metric.name %>"> | ||
12 | - <td> | ||
13 | - <%= link_to metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "new_metric_configuration", | ||
14 | - :metric_name => metric.name, :base_tool => @base_tool, :id => @configuration_content.id %> | ||
15 | - </td> | ||
16 | - </tr> | ||
17 | - <% end %> | ||
18 | -</table> | 3 | +<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound_metric_configuration", |
4 | + :id => @configuration_content.id %> | ||
5 | + | ||
6 | +<h5>Base Tools:</h5> | ||
7 | +<% @base_tools.each do |base_tool| %> | ||
8 | + <h4><%= link_to base_tool.name, "#", :onclick => "jQuery(\"\##{base_tool.name}\").toggle();"%></h4> | ||
9 | + <hr/> | ||
10 | + | ||
11 | + <div id="<%=base_tool.name%>" style="display:none"> | ||
12 | + <% base_tool.supported_metrics.each do |metric| %> | ||
13 | +       <%= link_to metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "new_metric_configuration", | ||
14 | + :metric_name => metric.name, :base_tool => base_tool.name, :id => @configuration_content.id %> | ||
15 | + <hr size="1" width="93%"/> | ||
16 | + <% end %> | ||
17 | + </div> | ||
18 | +<% end %> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound_metric_configuration.html.erb
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </p> | 23 | </p> |
24 | <p> | 24 | <p> |
25 | <%= m.label :script, "Script:" %> | 25 | <%= m.label :script, "Script:" %> |
26 | - <%= m.text_area "script", :value => @metric.script %> | 26 | + <%= m.text_area "script", :value => @metric.script, :rows => 5 %> |
27 | </p> | 27 | </p> |
28 | <% end %> | 28 | <% end %> |
29 | <p> | 29 | <p> |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_metric_configuration.html.erb
@@ -4,54 +4,14 @@ | @@ -4,54 +4,14 @@ | ||
4 | 4 | ||
5 | <h2><%= @configuration_content.name %> Configuration</h2> | 5 | <h2><%= @configuration_content.name %> Configuration</h2> |
6 | 6 | ||
7 | -<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | ||
8 | - <%= hidden_field_tag :id, @configuration_content.id %> | ||
9 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | ||
10 | - | ||
11 | - <% f.fields_for :metric do |m| %> | ||
12 | - | ||
13 | - <% @metric.language.each do |language| %> | ||
14 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | ||
15 | - <% end %> | ||
16 | - | ||
17 | - <%= m.hidden_field "scope", :value => @metric.scope %> | ||
18 | - <p> | ||
19 | - <%= m.label :origin, "Collector Name:" %> | ||
20 | - <%= @metric.origin %> | ||
21 | - <%= m.hidden_field "origin", :value => @metric.origin %> | ||
22 | - </p> | ||
23 | - <p> | ||
24 | - <%= m.label :metric_name, "Metric Name:" %> | ||
25 | - <%= @metric.name %> | ||
26 | - <%= m.hidden_field "name", :value => @metric.name %> | ||
27 | - </p> | ||
28 | - <!--<p>--> | ||
29 | - <% m.label :description, "Description:" %> | ||
30 | - <% @metric.description %> | ||
31 | - <% m.hidden_field "description", :value => @metric.description %> | ||
32 | - <!--</p>--> | ||
33 | - <% end %> | ||
34 | - <p> | ||
35 | - <%= f.label :code, "Code:" %> | ||
36 | - <%= @metric_configuration.code %> | ||
37 | - <%= f.hidden_field "code", :value => @metric_configuration.code %> | ||
38 | - </p> | ||
39 | - <p> | ||
40 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
41 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
42 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
43 | - </p> | ||
44 | - <p> | ||
45 | - <%= f.label :weight, "Weight:" %> | ||
46 | - <%= f.text_field "weight", :value => @metric_configuration.weight %> | ||
47 | - </p> | 7 | +<% owner = (not user.nil?) && user.id == @profile.id %> |
48 | 8 | ||
49 | - <p> | ||
50 | - <%= f.submit "Save" %> | ||
51 | - </p> | 9 | +<% if owner %> |
10 | + <%= render :partial => "content_viewer/metric_configuration_form" %> | ||
11 | +<% else %> | ||
12 | + <%= render :partial => "content_viewer/metric_configuration_view" %> | ||
52 | <% end %> | 13 | <% end %> |
53 | 14 | ||
54 | - | ||
55 | <h5> Ranges </h5><br/> | 15 | <h5> Ranges </h5><br/> |
56 | 16 | ||
57 | <table id="ranges"> | 17 | <table id="ranges"> |
@@ -83,6 +43,8 @@ | @@ -83,6 +43,8 @@ | ||
83 | </table> | 43 | </table> |
84 | 44 | ||
85 | <br/> | 45 | <br/> |
86 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | 46 | +<% if owner %> |
47 | + <%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | ||
48 | +<% end %> | ||
87 | <div id="range_form" style="display:none"></div> | 49 | <div id="range_form" style="display:none"></div> |
88 | 50 |
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound_metric_configuration.html.erb
plugins/mezuro/views/mezuro_plugin_project/_project_result.rhtml
1 | <% unless @content.errors[:base].nil? %> | 1 | <% unless @content.errors[:base].nil? %> |
2 | <%= @content.errors[:base] %> | 2 | <%= @content.errors[:base] %> |
3 | <% else %> | 3 | <% else %> |
4 | - <p> Choose a date to see specific project results: </p> | ||
5 | - <div id="datepicker" data-date="<%= @project_result.date %>"> | ||
6 | - <input id="datepicker_field" style="display:none"/> | ||
7 | - </div> | ||
8 | - | 4 | + <div id="current_project_date" data-date="<%= @project_result.date %>"/> |
5 | + | ||
9 | <h4><%= _('Last Result') %></h4> | 6 | <h4><%= _('Last Result') %></h4> |
10 | 7 | ||
11 | <table> | 8 | <table> |
@@ -21,19 +18,24 @@ | @@ -21,19 +18,24 @@ | ||
21 | <td><%= _('Analysis time') %></td> | 18 | <td><%= _('Analysis time') %></td> |
22 | <td><%= @project_result.formatted_analysis_time %></td> | 19 | <td><%= @project_result.formatted_analysis_time %></td> |
23 | </tr> | 20 | </tr> |
21 | + <tr> | ||
22 | + <td>Click to choose specific date:</td> | ||
23 | + <td><%= link_to(image_tag('/images/calendar_date_select/calendar.png', :width => 20, :height => 20, :onClick => "$( 'datepicker' ).toggle();"), "javascript:void(0)") %></td> | ||
24 | + </tr> | ||
24 | </table> | 25 | </table> |
25 | - | ||
26 | - | 26 | + |
27 | + <div id="datepicker"></div> | ||
28 | + | ||
27 | <script> | 29 | <script> |
28 | - jQuery(document).ready(function($) { | ||
29 | - $("#datepicker").datepicker({ altField: '#datepicker_field', showOn: 'button', dateFormat: "yy-mm-dd", | ||
30 | - buttonImageOnly: true, buttonImage: '/images/calendar_date_select/calendar.png', | ||
31 | - onSelect: function(dateText, inst) { | ||
32 | - reloadProjectWithDate(dateText) } }); | ||
33 | - var date = jQuery("#datepicker").attr('data-date').substr(0,10); | ||
34 | - $("#datepicker").datepicker( "setDate" , date ); | ||
35 | - | ||
36 | - }); | 30 | + jQuery(document).ready(function($) { |
31 | + $("#datepicker").datepicker({ | ||
32 | + onSelect: function(dateText, inst) { | ||
33 | + reloadProjectWithDate(dateText) } }); | ||
34 | + $("#datepicker").toggle(); | ||
35 | + var date = jQuery("#current_project_date").attr('data-date').substr(0,10); | ||
36 | + $("#datepicker").datepicker( "setDate" , date ); | ||
37 | + | ||
38 | + }); | ||
37 | </script> | 39 | </script> |
38 | - | 40 | + |
39 | <% end %> | 41 | <% end %> |
plugins/mezuro/views/mezuro_plugin_range/_range.html.erb
@@ -12,6 +12,13 @@ | @@ -12,6 +12,13 @@ | ||
12 | <%=range.grade%> | 12 | <%=range.grade%> |
13 | </td> | 13 | </td> |
14 | <td bgcolor="#<%= range.color[2..-1] %>"></td> | 14 | <td bgcolor="#<%= range.color[2..-1] %>"></td> |
15 | - <td><%= link_to_remote "Edit", :url => {:action =>"edit_range", :controller => "mezuro_plugin_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | ||
16 | - <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning %></td> | 15 | + <% if (not user.nil?) && user.id == @profile.id %> |
16 | + <td><%= link_to_remote "Edit", :url => {:action =>"edit_range", :controller => "mezuro_plugin_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning} %> | ||
17 | + </td> | ||
18 | + <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning %> | ||
19 | + </td> | ||
20 | + <% else %> | ||
21 | + <td></td> | ||
22 | + <td></td> | ||
23 | + <% end %> | ||
17 | </tr> | 24 | </tr> |
plugins/mezuro/views/mezuro_plugin_range/_range_form.html.erb
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <%= f.label :beginning, "(*) Beginning:" %> | 14 | <%= f.label :beginning, "(*) Beginning:" %> |
15 | </td> | 15 | </td> |
16 | <td> | 16 | <td> |
17 | - <%= f.text_field :beginning, :value => @range.beginning %> | 17 | + <%= f.text_field :beginning, :value => @range.beginning , :id => 'beginning' %> <%= link_to('-∞', 'javascript:void(0)', :onClick => "jQuery( '#beginning' ).val('-INF');") %> |
18 | </td> | 18 | </td> |
19 | </tr> | 19 | </tr> |
20 | <tr> | 20 | <tr> |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | <%= f.label :end, "(*) End:" %> | 22 | <%= f.label :end, "(*) End:" %> |
23 | </td> | 23 | </td> |
24 | <td> | 24 | <td> |
25 | - <%= f.text_field :end, :value => @range.end %> | 25 | + <%= f.text_field :end, :value => @range.end, :id => "end" %> <%= link_to('+∞', 'javascript:void(0)', :onClick => "jQuery( '#end' ).val('+INF');") %> |
26 | </td> | 26 | </td> |
27 | </tr> | 27 | </tr> |
28 | <tr> | 28 | <tr> |
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | <%= f.label :comments, "Comments:" %> | 46 | <%= f.label :comments, "Comments:" %> |
47 | </td> | 47 | </td> |
48 | <td> | 48 | <td> |
49 | - <%= f.text_field :comments %> | 49 | + <%= f.text_area :comments, :rows => 3 %> |
50 | </td> | 50 | </td> |
51 | </tr> | 51 | </tr> |
52 | </table> | 52 | </table> |