ref: refs/heads/master
commit f670adf638a13357645fca9c0399135a7de7c62a
Author: Josef Reidinger
Date: Mon Nov 30 14:11:38 2009 +0100
disable ntp if not available (bnc#552071)
---
.../app/controllers/systemtime_controller.rb | 12 ++++++++++++
.../systemtime/app/views/systemtime/index.rhtml | 8 ++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/plugins/systemtime/app/controllers/systemtime_controller.rb b/plugins/systemtime/app/controllers/systemtime_controller.rb
index 1ad1e38..cd0dff3 100644
--- a/plugins/systemtime/app/controllers/systemtime_controller.rb
+++ b/plugins/systemtime/app/controllers/systemtime_controller.rb
@@ -36,6 +36,17 @@ class SystemtimeController < ApplicationController
proxy.date = ""
end
+ def available_ntp
+ begin
+ ntp = load_proxy 'org.opensuse.yast.modules.yapi.ntp'
+ rescue Exception => e #available call, so don't show anything, just log
+ logger.warn e
+ return false
+ end
+ return false unless ntp
+ return ntp.respond_to? :synchronize
+ end
+
public
# cannot move to initialize, it is not finded - http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html#ApplicationCont...
@@ -71,6 +82,7 @@ class SystemtimeController < ApplicationController
@utcstatus = systemtime.utcstatus
@time = systemtime.time
@date = systemtime.date
+ @ntp = available_ntp
fill_valid_timezones
begin
fill_current_region
diff --git a/plugins/systemtime/app/views/systemtime/index.rhtml b/plugins/systemtime/app/views/systemtime/index.rhtml
index 369899c..9589a22 100644
--- a/plugins/systemtime/app/views/systemtime/index.rhtml
+++ b/plugins/systemtime/app/views/systemtime/index.rhtml
@@ -67,7 +67,9 @@
</fieldset>
<fieldset>
<p>
- <input type="radio" name="timeconfig" value="manual" onclick="enable();" id="timeconfig_manual">
+
+ >
<%=_("Manually configure time")%>
</p>
<% #TODO for tooltip _("Manual time configuration table, where user selects data and time for target machine")
@@ -81,7 +83,9 @@
<%= text_field_tag "currenttime", @time, :disabled=> "true"%>
</p>
<p>
- <input id="timeconfig" type="radio" name="timeconfig" value="ntp_sync" onclick="disable();"> <%=_("Synchronize via Network Time Protocol (NTP)")%>
+
+ > <%=_("Synchronize via Network Time Protocol (NTP)")%>
</p>
</fieldset>
<%= form_send_buttons :disabled => disabled, :class => "button" %>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org