+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2009 SonarSource SA
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-class PluginsController < ApplicationController
-
- SECTION=Navigation::SECTION_CONFIGURATION
- before_filter :admin_required
-
- verify :method => :post, :only => [:cancel, :install], :redirect_to => {:action => :index}
-
- def index
- @user_plugins=Plugin.user_plugins
- @core_plugins=Plugin.core_plugins
- end
-
- def updates
- @downloads=java_facade.getPluginDownloads()
-
- @center=nil
- @sonar_updates=[]
- @plugin_updates=[]
-
- finder=load_update_finder()
- if finder
- @center=finder.getCenter()
- @sonar_updates=finder.findSonarUpdates()
- @plugin_updates=finder.findPluginUpdates()
- end
- end
-
- def available
- @downloads=java_facade.getPluginDownloads()
- @center=nil
- @updates_by_category={}
-
- finder=load_update_finder()
- if finder
- @center=finder.getCenter()
- finder.findAvailablePlugins().each do |update|
- category=update.getPlugin().getCategory()||''
- @updates_by_category[category]||=[]
- @updates_by_category[category]<<update
- end
- end
- end
-
- def cancel
- java_facade.cancelPluginDownloads()
- flash[:notice]="Plugin downloads are canceled."
- redirect_to :action => 'index'
- end
-
- def install
- key=params[:key]
- version=params[:version]
- if key && version
- begin
- java_facade.downloadPlugin(key, version)
- rescue Exception => e
- flash[:error]=e.message
- end
- end
- redirect_to :action => (params[:from] || 'index')
- end
-
- private
- def load_update_finder
- @finder=java_facade.getUpdateFinder(params[:reload]=='true')
- end
-end
\ No newline at end of file
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2009 SonarSource SA
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+class UpdatecenterController < ApplicationController
+
+ SECTION=Navigation::SECTION_CONFIGURATION
+ before_filter :admin_required
+
+ verify :method => :post, :only => [:cancel, :install], :redirect_to => {:action => :index}
+
+ def index
+ @user_plugins=Plugin.user_plugins
+ @core_plugins=Plugin.core_plugins
+ end
+
+ def updates
+ @downloads=java_facade.getPluginDownloads()
+
+ @center=nil
+ @sonar_updates=[]
+ @plugin_updates=[]
+
+ finder=load_update_finder()
+ if finder
+ @center=finder.getCenter()
+ @sonar_updates=finder.findSonarUpdates()
+ @plugin_updates=finder.findPluginUpdates()
+ end
+ end
+
+ def available
+ @downloads=java_facade.getPluginDownloads()
+ @center=nil
+ @updates_by_category={}
+
+ finder=load_update_finder()
+ if finder
+ @center=finder.getCenter()
+ finder.findAvailablePlugins().each do |update|
+ category=update.getPlugin().getCategory()||''
+ @updates_by_category[category]||=[]
+ @updates_by_category[category]<<update
+ end
+ end
+ end
+
+ def cancel
+ java_facade.cancelPluginDownloads()
+ flash[:notice]="Plugin downloads are canceled."
+ redirect_to :action => 'index'
+ end
+
+ def install
+ key=params[:key]
+ version=params[:version]
+ if key && version
+ begin
+ java_facade.downloadPlugin(key, version)
+ rescue Exception => e
+ flash[:error]=e.message
+ end
+ end
+ redirect_to :action => (params[:from] || 'index')
+ end
+
+ private
+ def load_update_finder
+ @finder=java_facade.getUpdateFinder(params[:reload]=='true')
+ end
+end
\ No newline at end of file
<li class="<%= 'selected' if request.request_uri.include?('/settings') -%>"><a href="<%= ApplicationController.root_context -%>/settings/index">Settings</a></li>
<li class="<%= 'selected' if controller.controller_path=='backup' -%>"><a href="<%= ApplicationController.root_context -%>/backup">Backup</a></li>
<li class="<%= 'selected' if controller.controller_path=='system' -%>"><a href="<%= ApplicationController.root_context -%>/system">System info</a></li>
- <li class="<%= 'selected' if controller.controller_path=='plugins' -%>"><a href="<%= ApplicationController.root_context -%>/plugins">Upgrades (BETA)</a></li>
+ <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter">Upgrades (BETA)</a></li>
<% end %>
<% end %>
+++ /dev/null
-<script>
- function showPlugin(key) {
- $('show-' + key).hide();
- $('detail-' + key).show();
- return false;
- }
- function checkTermsConditions(key) {
- var tc=$('tc-' + key)
- if (tc!=null && !tc.checked) {
- alert('Please accept the Terms and Conditions');
- return false;
- }
- return true;
- }
-</script>
-
-
-<% if @downloads.size>0 %>
-<form action="<%= ApplicationController.root_context -%>/plugins/cancel" method="post" class="warning">
-<p>Sonar needs to be restarted in order to install the following plugins: <ul>
- <% @downloads.each do |download| -%>
- <li><%= download -%></li>
- <% end %>
- </ul>
- <input type="submit" value="Cancel downloads"></input>
-</p>
-</form>
-<% end %>
\ No newline at end of file
+++ /dev/null
-<p class="notes">
- <% if @center.nil? %>
- <p>Not connected to update center. Please check your internet connection and logs.</p>
- <% else %>
- Updated on <%= @center.getDate() %>. <%= link_to 'Refresh', :action => action, :reload => true %>
- <% end %>
-</p>
\ No newline at end of file
+++ /dev/null
-<ul class="tabs">
- <li>
- <a href="<%= url_for :action => 'index' -%>">Installed</a>
- </li>
- <li>
- <a href="<%= url_for :action => 'updates' -%>">Updates</a>
- </li>
- <li>
- <a href="<%= url_for :action => 'available' -%>" class="selected">Available</a>
- </li>
-</ul>
-<div class="tabs-panel">
-
-<%= render :partial => 'plugins/downloads' %>
-
-<% if @center %>
- <% @updates_by_category.keys.sort_by{|c| c.downcase }.each do |category|
- updates=@updates_by_category[category]
- %>
- <table class="data width100" id="category-<%= u category -%>">
- <thead>
- <tr>
- <th colspan="2"><h2><%= category -%></h2></th>
- </tr>
- </thead>
- <tbody>
- <% updates.each do |update|
- plugin=update.getPlugin()
- %>
- <tr class="<%= cycle('even','odd', :name => category) -%>">
- <td width="10%" nowrap>
- <b><%= h(plugin.getName()) -%></b>
- </td>
- <td>
- <%= plugin.getDescription() %> <a href="#" onClick="showPlugin('<%= plugin.getKey() -%>');" id="show-<%= plugin.getKey() -%>">More</a>
- <div id="detail-<%= plugin.getKey() -%>" style="display:none">
- <% if plugin.getLicense() %>
- <p>
- License: <%= h(plugin.getLicense()) %>
- </p>
- <% end %>
- <% if plugin.getOrganization() %>
- <p>
- By: <%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external' %>
- </p>
- <% end %>
- <% if plugin.getHomepageUrl() || plugin.getIssueTrackerUrl() %>
- <p>
- <% if plugin.getHomepageUrl() %>
- <%= link_to 'Plugin details', plugin.getHomepageUrl(), :class=>'external' %> |
- <% end %>
- <% if plugin.getIssueTrackerUrl() %>
- <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' %>
- <% end %>
- </p>
- <%
- end
- if update.isCompatible()
- %>
- <p>
- Version: <%= update.getRelease().getVersion() -%>
- </p>
- <div>
- <% if plugin.getTermsConditionsUrl() %>
- <input type="checkbox" id="tc-<%= plugin.getKey() -%>"></input> I accept the <%= link_to 'Terms and Conditions', plugin.getTermsConditionsUrl(), :class => 'external' %>
- <% end %>
- <form method="post" action="<%= ApplicationController.root_context -%>/plugins/install?from=available&key=<%= plugin.getKey() -%>&version=<%= update.getRelease().getVersion() -%>" style="display: inline-block">
- <input type="submit" value="Install" onClick="return checkTermsConditions('<%= plugin.getKey() -%>')"></input>
- </form>
-
- </div>
- <% elsif update.requiresSonarUpgrade
- %>
- <p>
- Version: <%= update.getRelease().getVersion() -%> (not compatible, needs Sonar upgrade)
- </p>
- <%
- end
- %>
- </div>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table><br/>
- <% end %>
-<% end %>
-<%= render :partial => 'plugins/status', :locals => {:action => 'available' } %>
-</div>
\ No newline at end of file
+++ /dev/null
-<ul class="tabs">
-<li>
-<a href="<%= url_for :action => 'index' -%>" class="selected">Installed</a>
-</li>
-<li>
-<a href="<%= url_for :action => 'updates' -%>">Updates</a>
-</li>
-<li>
-<a href="<%= url_for :action => 'available' -%>">Available</a>
-</li>
-</ul>
-<div class="tabs-panel">
-
-<h2>User-installed plugins</h2>
-<table class="data width100" id="user-plugins">
- <thead>
- <tr>
- <th>Plugin</th>
- <th>Version</th>
- <th>Description</th>
- <th>Organization</th>
- <th>Links</th>
- </tr>
- </thead>
- <tbody>
- <% if @user_plugins.empty? %>
- <tr class="even"><td colspan="5">No plugins</td></tr>
- <% else
- @user_plugins.each do |plugin|
- %>
- <tr class="<%= cycle('even','odd', :name => 'user') -%> id="<%= u plugin.plugin_key -%>">
- <td width="1%" nowrap><b><%= h(plugin.name) -%></b></td>
- <td><%= plugin.version || '-' %></td>
- <td><%= plugin.description %></td>
-
- <td>
- <% if plugin.organization %>
- <%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' %>
- <% end %>
- </td>
- <td><%= link_to 'Details', plugin.homepage, :class => 'external' if plugin.homepage %></td>
- </tr>
- <% end %>
- <% end %>
- </tbody>
-</table>
-<div class="break30"> </div>
-
-<h2>System plugins</h2>
-<table class="data width100" id="core-plugins">
- <thead><tr>
- <th>Plugin</th>
- <th>Description</th>
- </tr></thead>
- <tbody>
- <%
- @core_plugins.each do |plugin|
- %>
- <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.plugin_key -%>">
- <td width="1%" nowrap><b><%= plugin.name -%></b></td>
- <td><%= plugin.description %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
-</div>
\ No newline at end of file
+++ /dev/null
-<ul class="tabs">
- <li>
- <a href="<%= url_for :action => 'index' -%>">Installed</a>
- </li>
- <li>
- <a href="<%= url_for :action => 'updates' -%>" class="selected">Updates</a>
- </li>
- <li>
- <a href="<%= url_for :action => 'available' -%>">Available</a>
- </li>
-</ul>
-<div class="tabs-panel">
-<%= render :partial => 'plugins/downloads' %>
-
-<% if @center %>
- <table class="data width100" id="plugin-updates">
- <thead>
- <tr>
- <th colspan="3"><h2>User-installed plugins</h2></th>
- </tr>
- </thead>
- <tbody>
- <% if @plugin_updates.empty? %>
- <tr class="even">
- <td colspan="3" >No updates</td>
- </tr>
- <% end %>
- <% @plugin_updates.each do |update|
- %>
- <tr class="<%= cycle('even','odd', :name => 'user-plugins') -%>">
- <td><%= h(update.getPlugin().getName()) -%></td>
- <td>
-
- </td>
- <td>
-
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <br/>
- <table class="data width100" id="system-updates">
- <thead>
- <tr>
- <th colspan="2"><h2>System</h2></th>
- </tr>
- </thead>
- <tbody>
- <%
- if @sonar_updates.empty? %>
- <tr class="even">
- <td colspan="3" >No updates</td>
- </tr>
- <% end %>
- <% @sonar_updates.each do |update|
- sonar_release=update.getRelease()
- %>
- <tr class="<%= cycle('even','odd', :name => 'system') -%>">
- <td>Sonar <%= sonar_release.getVersion() -%></td>
- <td><%= sonar_release.getDescription() -%></td>
- <td>
- <%= link_to 'Release Notes', sonar_release.getChangelogUrl(), :class => 'external' if sonar_release.getChangelogUrl() %>
- <%= link_to 'Download', sonar_release.getDownloadUrl(), :class => 'external' if sonar_release.getDownloadUrl() %>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <br/>
-<% end %>
-<%= render :partial => 'plugins/status', :locals => {:action => 'updates' } %>
-</div>
\ No newline at end of file
--- /dev/null
+<script>
+ function showPlugin(key) {
+ $('show-' + key).hide();
+ $('detail-' + key).show();
+ return false;
+ }
+ function checkTermsConditions(key) {
+ var tc=$('tc-' + key)
+ if (tc!=null && !tc.checked) {
+ alert('Please accept the Terms and Conditions');
+ return false;
+ }
+ return true;
+ }
+</script>
+
+
+<% if @downloads.size>0 %>
+<form action="<%= ApplicationController.root_context -%>/plugins/cancel" method="post" class="warning">
+<p>Sonar needs to be restarted in order to install the following plugins: <ul>
+ <% @downloads.each do |download| -%>
+ <li><%= download -%></li>
+ <% end %>
+ </ul>
+ <input type="submit" value="Cancel downloads"></input>
+</p>
+</form>
+<% end %>
\ No newline at end of file
--- /dev/null
+<p class="notes">
+ <% if @center.nil? %>
+ <p>Not connected to update center. Please check your internet connection and logs.</p>
+ <% else %>
+ Updated on <%= @center.getDate() %>. <%= link_to 'Refresh', :action => action, :reload => true %>
+ <% end %>
+</p>
\ No newline at end of file
--- /dev/null
+<ul class="tabs">
+ <li>
+ <a href="<%= url_for :action => 'index' -%>">Installed</a>
+ </li>
+ <li>
+ <a href="<%= url_for :action => 'updates' -%>">Updates</a>
+ </li>
+ <li>
+ <a href="<%= url_for :action => 'available' -%>" class="selected">Available</a>
+ </li>
+</ul>
+<div class="tabs-panel">
+
+<%= render :partial => 'updatecenter/downloads' %>
+
+<% if @center %>
+ <% @updates_by_category.keys.sort_by{|c| c.downcase }.each do |category|
+ updates=@updates_by_category[category]
+ %>
+ <table class="data width100" id="category-<%= u category -%>">
+ <thead>
+ <tr>
+ <th colspan="2"><h2><%= category -%></h2></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% updates.each do |update|
+ plugin=update.getPlugin()
+ %>
+ <tr class="<%= cycle('even','odd', :name => category) -%>">
+ <td width="10%" nowrap>
+ <b><%= h(plugin.getName()) -%></b>
+ </td>
+ <td>
+ <%= plugin.getDescription() %> <a href="#" onClick="showPlugin('<%= plugin.getKey() -%>');" id="show-<%= plugin.getKey() -%>">More</a>
+ <div id="detail-<%= plugin.getKey() -%>" style="display:none">
+ <% if plugin.getLicense() %>
+ <p>
+ License: <%= h(plugin.getLicense()) %>
+ </p>
+ <% end %>
+ <% if plugin.getOrganization() %>
+ <p>
+ By: <%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external' %>
+ </p>
+ <% end %>
+ <% if plugin.getHomepageUrl() || plugin.getIssueTrackerUrl() %>
+ <p>
+ <% if plugin.getHomepageUrl() %>
+ <%= link_to 'Plugin details', plugin.getHomepageUrl(), :class=>'external' %> |
+ <% end %>
+ <% if plugin.getIssueTrackerUrl() %>
+ <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' %>
+ <% end %>
+ </p>
+ <%
+ end
+ if update.isCompatible()
+ %>
+ <p>
+ Version: <%= update.getRelease().getVersion() -%>
+ </p>
+ <div>
+ <% if plugin.getTermsConditionsUrl() %>
+ <input type="checkbox" id="tc-<%= plugin.getKey() -%>"></input> I accept the <%= link_to 'Terms and Conditions', plugin.getTermsConditionsUrl(), :class => 'external' %>
+ <% end %>
+ <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=available&key=<%= plugin.getKey() -%>&version=<%= update.getRelease().getVersion() -%>" style="display: inline-block">
+ <input type="submit" value="Install" onClick="return checkTermsConditions('<%= plugin.getKey() -%>')"></input>
+ </form>
+
+ </div>
+ <% elsif update.requiresSonarUpgrade
+ %>
+ <p>
+ Version: <%= update.getRelease().getVersion() -%> (not compatible, needs Sonar upgrade)
+ </p>
+ <%
+ end
+ %>
+ </div>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table><br/>
+ <% end %>
+<% end %>
+<%= render :partial => 'updatecenter/status', :locals => {:action => 'available' } %>
+</div>
\ No newline at end of file
--- /dev/null
+<ul class="tabs">
+<li>
+<a href="<%= url_for :action => 'index' -%>" class="selected">Installed</a>
+</li>
+<li>
+<a href="<%= url_for :action => 'updates' -%>">Updates</a>
+</li>
+<li>
+<a href="<%= url_for :action => 'available' -%>">Available</a>
+</li>
+</ul>
+<div class="tabs-panel">
+
+<h2>User-installed plugins</h2>
+<table class="data width100" id="user-plugins">
+ <thead>
+ <tr>
+ <th>Plugin</th>
+ <th>Version</th>
+ <th>Description</th>
+ <th>Organization</th>
+ <th>Links</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% if @user_plugins.empty? %>
+ <tr class="even"><td colspan="5">No plugins</td></tr>
+ <% else
+ @user_plugins.each do |plugin|
+ %>
+ <tr class="<%= cycle('even','odd', :name => 'user') -%> id="<%= u plugin.plugin_key -%>">
+ <td width="1%" nowrap><b><%= h(plugin.name) -%></b></td>
+ <td><%= plugin.version || '-' %></td>
+ <td><%= plugin.description %></td>
+
+ <td>
+ <% if plugin.organization %>
+ <%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' %>
+ <% end %>
+ </td>
+ <td><%= link_to 'Details', plugin.homepage, :class => 'external' if plugin.homepage %></td>
+ </tr>
+ <% end %>
+ <% end %>
+ </tbody>
+</table>
+<div class="break30"> </div>
+
+<h2>System plugins</h2>
+<table class="data width100" id="core-plugins">
+ <thead><tr>
+ <th>Plugin</th>
+ <th>Description</th>
+ </tr></thead>
+ <tbody>
+ <%
+ @core_plugins.each do |plugin|
+ %>
+ <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.plugin_key -%>">
+ <td width="1%" nowrap><b><%= plugin.name -%></b></td>
+ <td><%= plugin.description %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+</div>
\ No newline at end of file
--- /dev/null
+<ul class="tabs">
+ <li>
+ <a href="<%= url_for :action => 'index' -%>">Installed</a>
+ </li>
+ <li>
+ <a href="<%= url_for :action => 'updates' -%>" class="selected">Updates</a>
+ </li>
+ <li>
+ <a href="<%= url_for :action => 'available' -%>">Available</a>
+ </li>
+</ul>
+<div class="tabs-panel">
+<%= render :partial => 'updatecenter/downloads' %>
+
+<% if @center %>
+ <table class="data width100" id="plugin-updates">
+ <thead>
+ <tr>
+ <th colspan="3"><h2>User-installed plugins</h2></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% if @plugin_updates.empty? %>
+ <tr class="even">
+ <td colspan="3" >No updates</td>
+ </tr>
+ <% end %>
+ <% @plugin_updates.each do |update|
+ %>
+ <tr class="<%= cycle('even','odd', :name => 'user-plugins') -%>">
+ <td><%= h(update.getPlugin().getName()) -%></td>
+ <td>
+
+ </td>
+ <td>
+
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ <br/>
+ <table class="data width100" id="system-updates">
+ <thead>
+ <tr>
+ <th colspan="2"><h2>System</h2></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%
+ if @sonar_updates.empty? %>
+ <tr class="even">
+ <td colspan="3" >No updates</td>
+ </tr>
+ <% end %>
+ <% @sonar_updates.each do |update|
+ sonar_release=update.getRelease()
+ %>
+ <tr class="<%= cycle('even','odd', :name => 'system') -%>">
+ <td>Sonar <%= sonar_release.getVersion() -%></td>
+ <td><%= sonar_release.getDescription() -%></td>
+ <td>
+ <%= link_to 'Release Notes', sonar_release.getChangelogUrl(), :class => 'external' if sonar_release.getChangelogUrl() %>
+ <%= link_to 'Download', sonar_release.getDownloadUrl(), :class => 'external' if sonar_release.getDownloadUrl() %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ <br/>
+<% end %>
+<%= render :partial => 'updatecenter/status', :locals => {:action => 'updates' } %>
+</div>
\ No newline at end of file