From 60b51bc9387530c368d3d11b9e0dedda322ce4d9 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sun, 15 Aug 2010 02:04:19 +0200 Subject: [PATCH] Added most of the information requested in #5420 to the admin/info view. --- app/controllers/admin_controller.rb | 31 ++++++++++++++++++++++++++++- app/views/admin/_plugins.rhtml | 13 ++++++++++++ app/views/admin/info.rhtml | 18 ++++++++++++++++- app/views/admin/plugins.rhtml | 14 +------------ config/locales/en.yml | 6 ++++++ 5 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 app/views/admin/_plugins.rhtml diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 2dc3ab1ca..8012b86d5 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +require 'rake' +require 'rails/info' class AdminController < ApplicationController layout 'admin' @@ -75,12 +77,39 @@ class AdminController < ApplicationController end def info - @db_adapter_name = ActiveRecord::Base.connection.adapter_name @checklist = [ [:text_default_administrator_account_changed, User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?], [:text_file_repository_writable, File.writable?(Attachment.storage_path)], [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], [:text_rmagick_available, Object.const_defined?(:Magick)] ] + + app_servers = { + 'Mongrel' => {:name => 'Mongrel', :version => Proc.new{Mongrel::Const::MONGREL_VERSION}}, + 'Thin' => {:name => 'Thin', :version => Proc.new{Thin::VERSION::STRING}}, + 'Unicorn' => {:name => 'Unicorn', :version =>Proc.new{Unicorn::Const::UNICORN_VERSION}}, + 'PhusionPassenger' => {:name => 'Phusion Passenger', :version => Proc.new{PhusionPassenger::VERSION_STRING}}, + 'RailsFCGIHandler' => {:name => 'FastCGI'} + # TOOD: find a way to test for CGI + } + app_server = (Object.constants & app_servers.keys).collect do |server| + name = app_servers[server][:name].underscore.humanize + version = app_servers[server][:version].call if app_servers[server][:version] + [name, version].compact.join(" ") + end.join(",") + app_server = l(:label_unknown) unless app_server.present? + + + + @infolist = Rails::Info.properties.dup + @infolist.insert(3, ['Rake version', RAKEVERSION]) + @infolist.insert(11, [:text_log_file, Rails.configuration.log_path]) + + @infolist += [ + [:text_app_server, app_server], + [:text_redmine_username, Etc.getlogin] + ] + + @pluginlist = Redmine::Plugin.all end end diff --git a/app/views/admin/_plugins.rhtml b/app/views/admin/_plugins.rhtml new file mode 100644 index 000000000..53ae74568 --- /dev/null +++ b/app/views/admin/_plugins.rhtml @@ -0,0 +1,13 @@ + +<% plugins.each do |plugin| %> + + + + + + +<% end %> +
<%=h plugin.name %> + <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %> + <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %> + <%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %><%=h plugin.version %><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %>
diff --git a/app/views/admin/info.rhtml b/app/views/admin/info.rhtml index eef1a674f..5bad6b16d 100644 --- a/app/views/admin/info.rhtml +++ b/app/views/admin/info.rhtml @@ -1,6 +1,6 @@

<%=l(:label_information_plural)%>

-

<%= Redmine::Info.versioned_name %> (<%= @db_adapter_name %>)

+

<%= Redmine::Info.versioned_name %>

<% @checklist.each do |label, result| %> @@ -11,4 +11,20 @@ <% end %>
+

<%=l(:label_environment)%>

+ +<% @infolist.each do |label, info| %> + + + + +<% end %> +
<%= label.is_a?(Symbol) ? l(label) : h(label) %><%= h(info) %>
+ + +<% if @pluginlist.any? %> +

<%= l(:label_plugins) %>

+<%= render :partial => 'admin/plugins', :locals => {:plugins => @pluginlist} %> +<% end %> + <% html_title(l(:label_information_plural)) -%> diff --git a/app/views/admin/plugins.rhtml b/app/views/admin/plugins.rhtml index 4ee6c142c..9dcbe4e83 100644 --- a/app/views/admin/plugins.rhtml +++ b/app/views/admin/plugins.rhtml @@ -1,19 +1,7 @@

<%= l(:label_plugins) %>

<% if @plugins.any? %> - - <% @plugins.each do |plugin| %> - - - - - - - <% end %> -
<%=h plugin.name %> - <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %> - <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %> - <%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %><%=h plugin.version %><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %>
+<%= render :partial => 'admin/plugins', :locals => {:plugins => @plugins} %> <% else %>

<%= l(:label_no_data) %>

<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b3d87515d..0ef7255ae 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -763,6 +763,9 @@ en: label_profile: Profile label_subtask_plural: Subtasks label_project_copy_notifications: Send email notifications during the project copy + label_unknown: Unknown + label_plugin_name: Plugin name + label_plugin_version: Plugin version button_login: Login button_submit: Submit @@ -857,6 +860,9 @@ en: text_file_repository_writable: Attachments directory writable text_plugin_assets_writable: Plugin assets directory writable text_rmagick_available: RMagick available (optional) + text_app_server: Application server + text_redmine_username: System user + text_log_file: Log file text_destroy_time_entries_question: "{{hours}} hours were reported on the issues you are about to delete. What do you want to do ?" text_destroy_time_entries: Delete reported hours text_assign_time_entries_to_project: Assign reported hours to the project