ref: refs/heads/network
commit 1dd01a686db7a85dd213a6e7f0d8b0869e62a148
Author: Josef Reidinger
Date: Tue Sep 29 17:22:35 2009 +0200
Add javascript which disable editing time unless manual time settings is choosen.
---
.../systemtime/app/views/systemtime/index.rhtml | 24 +++++++++++++++----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/plugins/systemtime/app/views/systemtime/index.rhtml b/plugins/systemtime/app/views/systemtime/index.rhtml
index e0ac413..e4abf6a 100644
--- a/plugins/systemtime/app/views/systemtime/index.rhtml
+++ b/plugins/systemtime/app/views/systemtime/index.rhtml
@@ -1,4 +1,5 @@
-<% if @permissions %>
+<% if @permissions %>
+ <% disabled = ! @permissions[:write] %>
<% content_for :head do %>
<%= javascript_include_tag :defaults %>
@@ -25,9 +26,22 @@
return true;
};
<% end -%>
+ <% javascript_tag do -%>
+ function enable() {
+ if ( !<%= disabled %> ){
+ $("#date_date")[0].disabled = false;
+ $("#currenttime")[0].disabled = false;
+ }
+ };
+ function disable() {
+ $("#date_date")[0].disabled = true;
+ $("#currenttime")[0].disabled = true;
+ }
+
+ <% end -%>
<% end %>
- <% disabled = ! @permissions[:write] %>
+
<div class='plugin-icon'><img src='/icons/yast-ntp-client.png' alt="time module"/></div>
<div class='plugin-content'>
@@ -67,11 +81,11 @@
<% end %>
<div>
- <input type="radio" name="timeconfig" value="none" checked="true"/>
+ <input type="radio" name="timeconfig" value="none" checked="true" onclick="disable();"/>
<%=_("Don't set time")%>
- <input type="radio" name="timeconfig" value="manual"/>
+ <input type="radio" name="timeconfig" value="manual" onclick="enable();"/>
<%=_("Manually configure time")%>
- <input type="radio" name="timeconfig" value="ntp_sync"/>
+ <input type="radio" name="timeconfig" value="ntp_sync" onclick="disable();"/>
<%=_("Synchronize via NTP")%>
</div>
<% #TODO for tooltip _("Manual time configuration table, where user selects data and time for target machine")
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org