ref: refs/heads/network commit 1a19f979bb55197d77c78acd9b6378f974ad8e15 Author: Michal Zugec <mzugec@suse.cz> Date: Wed Sep 16 15:05:03 2009 +0200 network: write interfaces --- .../network/app/controllers/network_controller.rb | 11 +++++++++-- plugins/network/app/views/network/index.html.erb | 19 +++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/plugins/network/app/controllers/network_controller.rb b/plugins/network/app/controllers/network_controller.rb index 46b30f1..4f2b713 100644 --- a/plugins/network/app/controllers/network_controller.rb +++ b/plugins/network/app/controllers/network_controller.rb @@ -17,7 +17,7 @@ class NetworkController < ApplicationController def index @ifcs = load_proxy "org.opensuse.yast.modules.yapi.network.interfaces", :all - @iface = params[:interface] || @ifcs[0].id + @iface = params[:interface] || @ifcs[0].id #FIXME: first configured interface ifc = load_proxy "org.opensuse.yast.modules.yapi.network.interfaces", @iface return false unless ifc @@ -80,11 +80,18 @@ class NetworkController < ApplicationController hn.name = params["name"] hn.domain = params["domain"] - + ifc = load_proxy "org.opensuse.yast.modules.yapi.network.interfaces", params["interface"] + return false unless ifc + ifc.bootproto=params["conf_mode"] + if ifc.bootproto=="static" + ifc.ipaddr=params["ip"]+"/"+params["netmask"] + end + begin rt.save dns.save hn.save + ifc.save flash[:notice] = _('Settings have been written.') rescue ActiveResource::ClientError => e flash[:error] = YaST::ServiceResource.error(e) diff --git a/plugins/network/app/views/network/index.html.erb b/plugins/network/app/views/network/index.html.erb index edef995..055cbd8 100644 --- a/plugins/network/app/views/network/index.html.erb +++ b/plugins/network/app/views/network/index.html.erb @@ -4,15 +4,8 @@ <% disabled = ! @permissions[:write] %> -<% form_for(:network, @network, :url => { :action => "update" }, :html => { :method => :put } ) do |n| %> -<%#= n.error_messages %> -<!-- ~/svn/web-client/plugins/systemtime/app/views/systemtime/index.rhtml --> - -<!-- -TODO: we can't do form-in-form, use some AJAX trick instead -//--> -<%# form_tag("/network", :method => "get") do |f| %> +<% form_tag("/network", :method => "get") do |f| %> <!-- (collection, value, text, selected) --> <div class="table"> <table class="list" cellpadding="0" cellspacing="0"> @@ -22,11 +15,17 @@ TODO: we can't do form-in-form, use some AJAX trick instead <tr> <td class="first" width="120"><%= select_tag(:interface, options_from_collection_for_select(@ifcs, :id, :id, @iface)) %></td> - <td class="last"><%#= submit_tag("Select") %></td> + <td class="last"><%= submit_tag("Select") %></td> </tr> </table> </div> -<%# end %> +<% end %> + +<% form_for(:network, @network, :url => { :action => "update" }, :html => { :method => :put } ) do |n| %> +<%= n.error_messages %> +<!-- ~/svn/web-client/plugins/systemtime/app/views/systemtime/index.rhtml --> + +<input type="hidden" id="interface" name="interface" value="<%= @iface %>"> <div class="table"> <table class="list" cellpadding="0" cellspacing="0"> -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org