ref: refs/heads/master
commit 83e7b776dd7a8ea65f79abe1a0ddb980b214954c
Author: mzugec
Date: Fri Jul 10 17:25:59 2009 +0200
removed debuging
---
.../app/controllers/system_time_controller.rb | 56 +++++++------------
1 files changed, 21 insertions(+), 35 deletions(-)
diff --git a/plugins/systemtime/app/controllers/system_time_controller.rb b/plugins/systemtime/app/controllers/system_time_controller.rb
index 387f53b..acbd384 100644
--- a/plugins/systemtime/app/controllers/system_time_controller.rb
+++ b/plugins/systemtime/app/controllers/system_time_controller.rb
@@ -4,32 +4,6 @@ class SystemTimeController < ApplicationController
before_filter :login_required
layout 'main'
- #helpers
- private
- def fill_valid_timezones
- @@timezones.each do |region|
- @valid.push(region.name)
- end
- end
-
- def fill_current_region
- @@timezones.each do |region|
- region.entries.each do |entry|
- if entry.id == @systemtime.timezone
- @region = region
- end
- end
- end
- end
-
- def fill_date_and_time (timedate)
- @time = timedate[timedate.index(" - ")+3,8]
- @date = timedate[0..timedate.index(" - ")-1]
- #convert date to format for datepicker
- @date.sub!(/^(\d+)-(\d+)-(\d+)/,'\3/\2/\1')
- end
-
- public
@@timezones = {}
# Initialize GetText and Content-Type.
@@ -37,6 +11,10 @@ class SystemTimeController < ApplicationController
def index
proxy = YaST::ServiceResource.proxy_for('org.opensuse.yast.modules.yapi.time')
+ unless proxy
+ redirect_to "/404"
+ return
+ end
@permissions = proxy.permissions
begin
@@ -53,11 +31,22 @@ class SystemTimeController < ApplicationController
return
end
- @valid = []
+ @valid = []
+ #find current region
@@timezones = @systemtime.timezones
- fill_valid_timezones
- fill_current_region
- fill_date_and_time(@systemtime.time)
+ @@timezones.each do |region|
+ @valid.push(region.name)
+ region.entries.each do |entry|
+ if entry.id == @systemtime.timezone
+ @region = region
+ end
+ end
+ end
+ @time = @systemtime.time[@systemtime.time.index(" - ")+3,8]
+ @date = @systemtime.time[0..@systemtime.time.index(" - ")-1]
+ #convert date to format for datepicker
+ @date.sub!(/^(\d+)-(\d+)-(\d+)/,'\3/\2/\1')
+
end
def commit_time
@@ -79,17 +68,14 @@ class SystemTimeController < ApplicationController
response = true
begin
response = t.save
- rescue Timeout::Error => e
- #do nothing as if you move time to future it throws this exception
rescue ActiveResource::ClientError => e
flash[:error] = YaST::ServiceResource.error(e)
response = false
end
- if response
- flash[:notice] = _('Settings have been written.')
+ if !response
redirect_to :action => :index
else
-
+ flash[:notice] = _('Settings have been written.')
redirect_to :action => :index
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org