[yast-commit] <web-client> jr-yastmodel : clean systemtime plugin to demonstrate yast model
ref: refs/heads/jr-yastmodel commit 8bc8ec72d19a55340b8b15af37d18bb92eaf5f66 Author: Josef Reidinger <jreidinger@suse.cz> Date: Tue Dec 22 16:36:06 2009 +0100 clean systemtime plugin to demonstrate yast model rewrite test to use http mock create ntp model move functionality from lib and controller to time model TODO: create tests for models --- .../app/controllers/systemtime_controller.rb | 91 +- plugins/systemtime/app/models/ntp.rb | 10 + plugins/systemtime/app/models/stime.rb | 4 - plugins/systemtime/app/models/systemtime.rb | 34 + .../systemtime/app/views/systemtime/index.rhtml | 196 +- plugins/systemtime/lib/systemtime.rb | 16 - plugins/systemtime/test/fixtures/ntp.xml | 6 + plugins/systemtime/test/fixtures/success.xml | 2064 ++++++++++++++++++++ .../test/functional/systemtime_controller_test.rb | 129 +-- webclient/lib/yast_model/base.rb | 4 +- 10 files changed, 2258 insertions(+), 296 deletions(-) diff --git a/plugins/systemtime/app/controllers/systemtime_controller.rb b/plugins/systemtime/app/controllers/systemtime_controller.rb index 7fff4aa..ffaf698 100644 --- a/plugins/systemtime/app/controllers/systemtime_controller.rb +++ b/plugins/systemtime/app/controllers/systemtime_controller.rb @@ -11,40 +11,21 @@ require 'systemtime' class SystemtimeController < ApplicationController before_filter :login_required layout 'main' - include ProxyLoader #helpers private - # Fills @+valid+ field that represents valid regions with informations from - # @+timezone+ field. - def fill_valid_timezones - @valid = @@timezones.collect { |region| region.name } - end - - # Fills current region name in field @+region+. Requires filled @+timezones+ - # and @+timezone+ fields - # throws:: Exception if current timezone is not in any known region. @+region+ - # field in this case is +nil+. - def fill_current_region - @region = @@timezones.find { |region| - region.entries.find { |entry| entry.id==@timezone } } - raise _("Unknown timezone %s on host") % @timezone unless @region - end - - def clear_time(proxy) - proxy.time = "" - proxy.date = "" - end - def available_ntp begin - ntp = load_proxy 'org.opensuse.yast.modules.yapi.ntp' + unless Ntp.permissions[:available] && Ntp.permissions[:synchronize] + logger.info "ntp doesn't have permissions available : #{Ntp.permissions[:available]} synchronize: #{Ntp.permissions[:synchronize]}" + return false + end + ntp = Ntp.find :one 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 + return ntp.available? end public @@ -64,22 +45,9 @@ class SystemtimeController < ApplicationController # fields is filled. In case of errors redirect to help page, main page or just # show flash with partial problem. def index - @ntp = available_ntp - systemtime = Stime.find :one - @permissions = Stime.permissions - @@timezones = systemtime.timezones - @timezone = systemtime.timezone - @utcstatus = systemtime.utcstatus - @time = systemtime.time - @date = systemtime.date - fill_valid_timezones - begin - fill_current_region - rescue Exception => e - flash[:warning] = e.message - logger.warn e - redirect_to root_path - end + @ntp_available = available_ntp + @stime = Systemtime.find :one + @permissions = Systemtime.permissions end # Update time handler. Sets to backend new timezone and time. @@ -87,18 +55,16 @@ class SystemtimeController < ApplicationController # still shows problems. Now it invalidate session for logged user.If # everything goes fine it redirect to index def update - t = Stime.find :one - - fill_proxy_with_timezone t, params, t.timezones - clear_time t #do nothing + t = Systemtime.find :one + t.load_timezone params + t.clear_time #do not set time by default case params[:timeconfig] when "manual" - fill_proxy_with_time t,params + t.load_time params when "ntp_sync" - ntp = load_proxy 'org.opensuse.yast.modules.yapi.ntp' - return false unless ntp - ntp.synchronize = true - ntp.synchronize_utc = (t.utcstatus=="UTC") + ntp = Ntp.find :one + ntp.actions.synchronize = true + ntp.actions.synchronize_utc = (t.utcstatus=="UTC") begin ntp.save #FIXME check return value rescue Timeout::Error => e @@ -109,18 +75,17 @@ class SystemtimeController < ApplicationController else logger.error "Unknown value for timeconfig #{params[:timeconfig]}" end - t.timezones = [] #save bandwitch begin - t.save + t.save #TODO check return value flash[:notice] = _('Time settings have been written.') rescue Timeout::Error => e #do nothing as if you move time to future it throws this exception log.debug "Time moved to future" flash[:notice] = _('Time settings have been written.') - end + end redirect_success end @@ -129,20 +94,16 @@ class SystemtimeController < ApplicationController #AJAX function that renders new timezones for selected region. Expected # initialized values from index call. def timezones_for_region - if @@timezones.empty? - # since while calling this function there is different instance of the class - # than when calling index, @@timezones were empty; reinitialize them - # possible FIXME: how does it increase the amount of data transferred? - systemtime = Stime.find :one + #FIXME do not use AJAX use java script instead as reload of data is not needed + # since while calling this function there is different instance of the class + # than when calling index, @@timezones were empty; reinitialize them + # possible FIXME: how does it increase the amount of data transferred? + systemtime = Systemtime.find :one - @@timezones = systemtime.timezones - end + timezones = systemtime.timezones - region = @@timezones.find { |r| r.name == params[:value] } #possible FIXME later it gets class, not a string - - unless region - return false; #possible FIXME: is returnign false for AJAX correct? - end + region = timezones.find { |r| r.name == params[:value] } #possible FIXME later it gets class, not a string + return false unless region #possible FIXME: is returnign false for AJAX correct? render(:partial => 'timezones', :locals => {:region => region, :default => region.central, diff --git a/plugins/systemtime/app/models/ntp.rb b/plugins/systemtime/app/models/ntp.rb new file mode 100644 index 0000000..5abd214 --- /dev/null +++ b/plugins/systemtime/app/models/ntp.rb @@ -0,0 +1,10 @@ +class Ntp < ActiveResource::Base + extend YastModel::Base + model_interface :"org.opensuse.yast.modules.yapi.ntp" + + def available? + ret = actions.respond_to? :synchronize + Rails.logger.info "ntp available : #{ret}" + return ret + end +end diff --git a/plugins/systemtime/app/models/stime.rb b/plugins/systemtime/app/models/stime.rb deleted file mode 100644 index 540b6b5..0000000 --- a/plugins/systemtime/app/models/stime.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Stime < ActiveResource::Base - extend YastModel::Base - model_interface :"org.opensuse.yast.modules.yapi.time" -end diff --git a/plugins/systemtime/app/models/systemtime.rb b/plugins/systemtime/app/models/systemtime.rb new file mode 100644 index 0000000..4cfbd8e --- /dev/null +++ b/plugins/systemtime/app/models/systemtime.rb @@ -0,0 +1,34 @@ +class Systemtime < ActiveResource::Base + extend YastModel::Base + model_interface :"org.opensuse.yast.modules.yapi.time" + + def region + reg = self.timezones.find { |region| + region.entries.find { |entry| entry.id==self.timezone } } + raise _("Unknown timezone %s on host") % timezone unless reg + return reg + end + + def regions + return @regions if @regions + @regions = self.timezones.collect { |region| region.name } + end + + def load_timezone(params) + treg = self.timezones.find { |reg| reg.name == params[:region] } || Hash.new + + tmz = treg.entries.find { |e| e.name == params[:timezone]} + self.timezone = tmz.id if tmz + self.utcstatus = params[:utc] == "true" + end + + def load_time(params) + self.date = params[:date][:date] + self.time = params[:currenttime] + end + + def clear_time + self.date = nil + self.time = nil + end +end diff --git a/plugins/systemtime/app/views/systemtime/index.rhtml b/plugins/systemtime/app/views/systemtime/index.rhtml index d2aab05..0038312 100644 --- a/plugins/systemtime/app/views/systemtime/index.rhtml +++ b/plugins/systemtime/app/views/systemtime/index.rhtml @@ -1,112 +1,110 @@ -<% if @permissions %> - <% disabled = ! @permissions[:write] %> +<% disabled = !@permissions[:write] %> - <% content_for :head do %> - <%= javascript_include_tag :defaults %> - <link rel="stylesheet" href="/inc/smoothness/jquery.ui.custom.css" type="text/css" media="screen" title="default" charset="utf-8" /> +<% content_for :head do %> + <%= javascript_include_tag :defaults %> + <link rel="stylesheet" href="/inc/smoothness/jquery.ui.custom.css" type="text/css" media="screen" title="default" charset="utf-8" /> - <% javascript_tag do -%> - $(document).ready( function() { - $("#date_date").datepicker( { dateFormat: 'dd/mm/yy'} ); - }); - <% end -%> + <% javascript_tag do -%> + $(document).ready( function() { + $("#date_date").datepicker( { dateFormat: 'dd/mm/yy'} ); + }); + <% end -%> - <!-- FIXME move javascript function outside of index --> - <% javascript_tag do -%> - function submitTime() { - if (!$("#timeconfig_manual")[0].checked){ - return true; - } - if (!$("#date_date")[0].value.match( /^\d{2}\/\d{2}\/\d{4}$/)){ - alert ("<%= _("Invalid date format. Correct one is dd/mm/yyyy") %>"); - return false; - } - if (!$("#currenttime")[0].value.match( /^\d{2}:\d{2}:\d{2}$/)) { - alert ("<%= _("Invalid time format. Correct one is hh:mm:ss") %>"); - return false; - } - $('#progress').show(); + <!-- FIXME move javascript function outside of index --> + <% javascript_tag do -%> + function submitTime() { + if (!$("#timeconfig_manual")[0].checked){ 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; + } + if (!$("#date_date")[0].value.match( /^\d{2}\/\d{2}\/\d{4}$/)){ + alert ("<%= _("Invalid date format. Correct one is dd/mm/yyyy") %>"); + return false; + } + if (!$("#currenttime")[0].value.match( /^\d{2}:\d{2}:\d{2}$/)) { + alert ("<%= _("Invalid time format. Correct one is hh:mm:ss") %>"); + return false; + } + $('#progress').show(); + 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 %> - - <div class='plugin-icon'><img src='/icons/yast-ntp-client.png' alt="time module"/><%=_("Time")%></div> - - <div class="plugin-content grid_12"> - <% form_tag '/systemtime/update', {:class => 'container', :onsubmit => "submitTime();"} do %> - <% #TODO tooltip for form <div> _("Table for settings timezone for target machine.") </div> - %> - <fieldset id="" class=""> - <p> - <label for="region"><%=_("Region")%></label> - <%= select_tag "region", options_for_select(@valid, @region.name), :disabled => disabled %> - </p> - <p> - <label for="timezone"><%=_("Timezone")%></label> - <span id="timezones"> - <%= render(:partial => 'timezones', - :locals => {:region => @region, :default => @timezone, - :disabled => disabled}) %> - </span> - </p> - <% unless @utcstatus.nil? %> + <% end -%> +<% end %> + +<div class='plugin-icon'><img src='/icons/yast-ntp-client.png' alt="time module"/><%=_("Time")%></div> + +<div class="plugin-content grid_12"> + <% form_tag '/systemtime/update', {:class => 'container', :onsubmit => "submitTime();"} do %> + <% #TODO tooltip for form <div> _("Table for settings timezone for target machine.") </div> + %> + <fieldset id="" class=""> <p> - <% #don't use check_box helper as it generate also hidden opposite value - %> - <input type="checkbox" name="utc" id="utc" value="true" - <%= "checked=\"checked\"" if @utcstatus %> - <%= "disabled=\"disabled\"" if disabled %> /> - <span class="form-details"><%=_("Hardware clock is set to UTC")%></span> + <label for="region"><%=_("Region")%></label> + <%= select_tag "region", options_for_select(@stime.regions, @stime.region.name), :disabled => disabled %> </p> - <% end %> - </fieldset> - <fieldset> <p> - <input type="radio" name="timeconfig" value="manual" onclick="enable();" id="timeconfig_manual" - <%= "disabled=\"disabled\"" if disabled %> - > - <%=_("Manually configure time")%> - </p> - <% #TODO for tooltip _("Manual time configuration table, where user selects data and time for target machine") + <label for="timezone"><%=_("Timezone")%></label> + <span id="timezones"> + <%= render(:partial => 'timezones', + :locals => {:region => @stime.region, :default => @stime.timezone, + :disabled => disabled}) %> + </span> + </p> + <% unless @stime.utcstatus.nil? %> + <p> + <% #don't use check_box helper as it generate also hidden opposite value %> - <p> - <label for="date_date"><%= _("Date") %></label> - <%= text_field "date","date", :disabled=> "true", :value => @date %> - </p> - <p> - <label for="currenttime"><%= _("Time") %></label> - <%= text_field_tag "currenttime", @time, :disabled=> "true"%> - </p> - <p> - <input id="timeconfig" type="radio" name="timeconfig" value="ntp_sync" onclick="disable();" - <%= "disabled=\"disabled\"" if disabled || !@ntp %> - > <%=_("Synchronize via Network Time Protocol (NTP)")%> - </p> - </fieldset> - <%= form_send_buttons :disabled => disabled, :class => "button" %> - <% end %> - </div> - + <input type="checkbox" name="utc" id="utc" value="true" + <%= "checked=\"checked\"" if @stime.utcstatus %> + <%= "disabled=\"disabled\"" if disabled %> /> + <span class="form-details"><%=_("Hardware clock is set to UTC")%></span> + </p> + <% end %> +</fieldset> +<fieldset> + <p> + <input type="radio" name="timeconfig" value="manual" onclick="enable();" id="timeconfig_manual" + <%= "disabled=\"disabled\"" if disabled %> + > + <%=_("Manually configure time")%> + </p> + <% #TODO for tooltip _("Manual time configuration table, where user selects data and time for target machine") + %> + <p> + <label for="date_date"><%= _("Date") %></label> + <%= text_field "date","date", :disabled=> "true", :value => @stime.date %> + </p> + <p> + <label for="currenttime"><%= _("Time") %></label> + <%= text_field_tag "currenttime", @stime.time, :disabled=> "true"%> + </p> + <p> + <input id="timeconfig" type="radio" name="timeconfig" value="ntp_sync" onclick="disable();" + <%= "disabled=\"disabled\"" if disabled || !@ntp_available %> + > <%=_("Synchronize via Network Time Protocol (NTP)")%> + </p> +</fieldset> + <%= form_send_buttons :disabled => disabled, :class => "button" %> + <% end %> +</div> - <%= observe_field(:region, - :frequency => 0.25, - :update => :timezones, - :url => { :action => :timezones_for_region }, - :with => "'disabled=' + "+ (disabled ? "true":"false")+" + '&value=' +value") %> -<% end %> + +<%= observe_field(:region, + :frequency => 0.25, + :update => :timezones, + :url => { :action => :timezones_for_region }, + :with => "'disabled=' + "+ (disabled ? "true":"false")+" + '&value=' +value") %> diff --git a/plugins/systemtime/lib/systemtime.rb b/plugins/systemtime/lib/systemtime.rb deleted file mode 100644 index 9fe22c3..0000000 --- a/plugins/systemtime/lib/systemtime.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Systemtime - -#fills proxy with time parameters and set rest parameters to empty value -def fill_proxy_with_time(proxy,params) - proxy.date = params[:date][:date] - proxy.time = params[:currenttime] -end - -#fills proxy with timezone parameters and set rest parameters to empty value -def fill_proxy_with_timezone(proxy,params,timezones) - region = timezones.find { |reg| reg.name == params[:region] } || Hash.new - - tmz = region.entries.find { |e| e.name == params[:timezone]} - proxy.timezone = tmz.id if tmz - proxy.utcstatus = params[:utc] == "true" -end diff --git a/plugins/systemtime/test/fixtures/ntp.xml b/plugins/systemtime/test/fixtures/ntp.xml new file mode 100644 index 0000000..d750e75 --- /dev/null +++ b/plugins/systemtime/test/fixtures/ntp.xml @@ -0,0 +1,6 @@ +<ntp> + <actions> + <synchronize_utc type="boolean">true</synchronize_utc> + <synchronize type="boolean">false</synchronize> + </actions> +</ntp> diff --git a/plugins/systemtime/test/fixtures/success.xml b/plugins/systemtime/test/fixtures/success.xml new file mode 100644 index 0000000..6674d4e --- /dev/null +++ b/plugins/systemtime/test/fixtures/success.xml @@ -0,0 +1,2064 @@ +<systemtime> + <timezones type="array"> + <timezones> + <name>Africa</name> + <entries type="array"> + <entries> + <name>Maputo</name> + <id>Africa/Maputo</id> + </entries> + <entries> + <name>Johannesburg</name> + <id>Africa/Johannesburg</id> + </entries> + <entries> + <name>Casablanca</name> + <id>Africa/Casablanca</id> + </entries> + <entries> + <name>Banjul</name> + <id>Africa/Banjul</id> + </entries> + <entries> + <name>Windhoek</name> + <id>Africa/Windhoek</id> + </entries> + <entries> + <name>Maseru</name> + <id>Africa/Maseru</id> + </entries> + <entries> + <name>Luanda</name> + <id>Africa/Luanda</id> + </entries> + <entries> + <name>Lagos</name> + <id>Africa/Lagos</id> + </entries> + <entries> + <name>Kigali</name> + <id>Africa/Kigali</id> + </entries> + <entries> + <name>Douala</name> + <id>Africa/Douala</id> + </entries> + <entries> + <name>Asmara</name> + <id>Africa/Asmara</id> + </entries> + <entries> + <name>Malabo</name> + <id>Africa/Malabo</id> + </entries> + <entries> + <name>Lusaka</name> + <id>Africa/Lusaka</id> + </entries> + <entries> + <name>Kinshasa</name> + <id>Africa/Kinshasa</id> + </entries> + <entries> + <name>El Aaiun</name> + <id>Africa/El_Aaiun</id> + </entries> + <entries> + <name>Ceuta</name> + <id>Africa/Ceuta</id> + </entries> + <entries> + <name>Nouakchott</name> + <id>Africa/Nouakchott</id> + </entries> + <entries> + <name>Lubumbashi</name> + <id>Africa/Lubumbashi</id> + </entries> + <entries> + <name>Dar es Salaam</name> + <id>Africa/Dar_es_Salaam</id> + </entries> + <entries> + <name>Dakar</name> + <id>Africa/Dakar</id> + </entries> + <entries> + <name>Reunion</name> + <id>Indian/Reunion</id> + </entries> + <entries> + <name>Ndjamena</name> + <id>Africa/Ndjamena</id> + </entries> + <entries> + <name>Mbabane</name> + <id>Africa/Mbabane</id> + </entries> + <entries> + <name>Khartoum</name> + <id>Africa/Khartoum</id> + </entries> + <entries> + <name>Addis Ababa</name> + <id>Africa/Addis_Ababa</id> + </entries> + <entries> + <name>Ouagadougou</name> + <id>Africa/Ouagadougou</id> + </entries> + <entries> + <name>Harare</name> + <id>Africa/Harare</id> + </entries> + <entries> + <name>Bissau</name> + <id>Africa/Bissau</id> + </entries> + <entries> + <name>Bangui</name> + <id>Africa/Bangui</id> + </entries> + <entries> + <name>Bamako</name> + <id>Africa/Bamako</id> + </entries> + <entries> + <name>Tunis</name> + <id>Africa/Tunis</id> + </entries> + <entries> + <name>Monrovia</name> + <id>Africa/Monrovia</id> + </entries> + <entries> + <name>Djibouti</name> + <id>Africa/Djibouti</id> + </entries> + <entries> + <name>Brazzaville</name> + <id>Africa/Brazzaville</id> + </entries> + <entries> + <name>Algiers</name> + <id>Africa/Algiers</id> + </entries> + <entries> + <name>Abidjan</name> + <id>Africa/Abidjan</id> + </entries> + <entries> + <name>Porto-Novo</name> + <id>Africa/Porto-Novo</id> + </entries> + <entries> + <name>Nairobi</name> + <id>Africa/Nairobi</id> + </entries> + <entries> + <name>Lome</name> + <id>Africa/Lome</id> + </entries> + <entries> + <name>Gaborone</name> + <id>Africa/Gaborone</id> + </entries> + <entries> + <name>Accra</name> + <id>Africa/Accra</id> + </entries> + <entries> + <name>Antananarivo</name> + <id>Indian/Antananarivo</id> + </entries> + <entries> + <name>Sao Tome</name> + <id>Africa/Sao_Tome</id> + </entries> + <entries> + <name>Libreville</name> + <id>Africa/Libreville</id> + </entries> + <entries> + <name>Freetown</name> + <id>Africa/Freetown</id> + </entries> + <entries> + <name>Bujumbura</name> + <id>Africa/Bujumbura</id> + </entries> + <entries> + <name>Tripoli</name> + <id>Africa/Tripoli</id> + </entries> + <entries> + <name>Niamey</name> + <id>Africa/Niamey</id> + </entries> + <entries> + <name>Mogadishu</name> + <id>Africa/Mogadishu</id> + </entries> + <entries> + <name>Kampala</name> + <id>Africa/Kampala</id> + </entries> + <entries> + <name>Conakry</name> + <id>Africa/Conakry</id> + </entries> + <entries> + <name>Cairo</name> + <id>Africa/Cairo</id> + </entries> + <entries> + <name>Blantyre</name> + <id>Africa/Blantyre</id> + </entries> + </entries> + <central>Africa/Kampala</central> + </timezones> + <timezones> + <name>Argentina</name> + <entries type="array"> + <entries> + <name>San Juan</name> + <id>America/Argentina/San_Juan</id> + </entries> + <entries> + <name>Mendoza</name> + <id>America/Argentina/Mendoza</id> + </entries> + <entries> + <name>La Rioja</name> + <id>America/Argentina/La_Rioja</id> + </entries> + <entries> + <name>Jujuy</name> + <id>America/Argentina/Jujuy</id> + </entries> + <entries> + <name>Buenos Aires</name> + <id>America/Argentina/Buenos_Aires</id> + </entries> + <entries> + <name>Rio Gallegos</name> + <id>America/Argentina/Rio_Gallegos</id> + </entries> + <entries> + <name>Ushuaia</name> + <id>America/Argentina/Ushuaia</id> + </entries> + <entries> + <name>San Luis</name> + <id>America/Argentina/San_Luis</id> + </entries> + <entries> + <name>Cordoba</name> + <id>America/Argentina/Cordoba</id> + </entries> + <entries> + <name>Tucuman</name> + <id>America/Argentina/Tucuman</id> + </entries> + <entries> + <name>Catamarca</name> + <id>America/Argentina/Catamarca</id> + </entries> + </entries> + <central>America/Argentina/Buenos_Aires</central> + </timezones> + <timezones> + <name>Asia</name> + <entries type="array"> + <entries> + <name>Yerevan</name> + <id>Asia/Yerevan</id> + </entries> + <entries> + <name>Ulan Bator</name> + <id>Asia/Ulaanbaatar</id> + </entries> + <entries> + <name>Magadan</name> + <id>Asia/Magadan</id> + </entries> + <entries> + <name>Choibalsan</name> + <id>Asia/Choibalsan</id> + </entries> + <entries> + <name>Baghdad</name> + <id>Asia/Baghdad</id> + </entries> + <entries> + <name>Mideast Riyadh87</name> + <id>Mideast/Riyadh87</id> + </entries> + <entries> + <name>Yakutsk</name> + <id>Asia/Yakutsk</id> + </entries> + <entries> + <name>Pontianak</name> + <id>Asia/Pontianak</id> + </entries> + <entries> + <name>Mideast Riyadh88</name> + <id>Mideast/Riyadh88</id> + </entries> + <entries> + <name>Dushanbe</name> + <id>Asia/Dushanbe</id> + </entries> + <entries> + <name>Singapore</name> + <id>Asia/Singapore</id> + </entries> + <entries> + <name>Mideast Riyadh89</name> + <id>Mideast/Riyadh89</id> + </entries> + <entries> + <name>Vientiane</name> + <id>Asia/Vientiane</id> + </entries> + <entries> + <name>Tehran</name> + <id>Asia/Tehran</id> + </entries> + <entries> + <name>Damascus</name> + <id>Asia/Damascus</id> + </entries> + <entries> + <name>Karachi</name> + <id>Asia/Karachi</id> + </entries> + <entries> + <name>Baku</name> + <id>Asia/Baku</id> + </entries> + <entries> + <name>Hongkong</name> + <id>Asia/Hong_Kong</id> + </entries> + <entries> + <name>Sakhalin</name> + <id>Asia/Sakhalin</id> + </entries> + <entries> + <name>Tashkent</name> + <id>Asia/Tashkent</id> + </entries> + <entries> + <name>Qatar</name> + <id>Asia/Qatar</id> + </entries> + <entries> + <name>Seoul</name> + <id>Asia/Seoul</id> + </entries> + <entries> + <name>Harbin</name> + <id>Asia/Harbin</id> + </entries> + <entries> + <name>Oral</name> + <id>Asia/Oral</id> + </entries> + <entries> + <name>Jayapura</name> + <id>Asia/Jayapura</id> + </entries> + <entries> + <name>Beijing</name> + <id>Asia/Beijing</id> + </entries> + <entries> + <name>Shanghai</name> + <id>Asia/Shanghai</id> + </entries> + <entries> + <name>Dubai</name> + <id>Asia/Dubai</id> + </entries> + <entries> + <name>Urumqi</name> + <id>Asia/Urumqi</id> + </entries> + <entries> + <name>Afghanistan</name> + <id>Asia/Kabul</id> + </entries> + <entries> + <name>Bangkok</name> + <id>Asia/Bangkok</id> + </entries> + <entries> + <name>Samarkand</name> + <id>Asia/Samarkand</id> + </entries> + <entries> + <name>Amman</name> + <id>Asia/Amman</id> + </entries> + <entries> + <name>Taipei</name> + <id>Asia/Taipei</id> + </entries> + <entries> + <name>Krasnoyarsk</name> + <id>Asia/Krasnoyarsk</id> + </entries> + <entries> + <name>Vladivostok</name> + <id>Asia/Vladivostok</id> + </entries> + <entries> + <name>Kuching</name> + <id>Asia/Kuching</id> + </entries> + <entries> + <name>Muscat</name> + <id>Asia/Muscat</id> + </entries> + <entries> + <name>Omsk</name> + <id>Asia/Omsk</id> + </entries> + <entries> + <name>Aqtau</name> + <id>Asia/Aqtau</id> + </entries> + <entries> + <name>Myanmar</name> + <id>Asia/Rangoon</id> + </entries> + <entries> + <name>Gaza</name> + <id>Asia/Gaza</id> + </entries> + <entries> + <name>Israel</name> + <id>Asia/Jerusalem</id> + </entries> + <entries> + <name>Chongqing</name> + <id>Asia/Chongqing</id> + </entries> + <entries> + <name>Brunei</name> + <id>Asia/Brunei</id> + </entries> + <entries> + <name>Qyzylorda</name> + <id>Asia/Qyzylorda</id> + </entries> + <entries> + <name>Aqtobe</name> + <id>Asia/Aqtobe</id> + </entries> + <entries> + <name>Kuwait</name> + <id>Asia/Kuwait</id> + </entries> + <entries> + <name>Kamchatka</name> + <id>Asia/Kamchatka</id> + </entries> + <entries> + <name>Colombo</name> + <id>Asia/Colombo</id> + </entries> + <entries> + <name>Riyadh</name> + <id>Asia/Riyadh</id> + </entries> + <entries> + <name>Beirut</name> + <id>Asia/Beirut</id> + </entries> + <entries> + <name>Kashgar</name> + <id>Asia/Kashgar</id> + </entries> + <entries> + <name>Almaty</name> + <id>Asia/Almaty</id> + </entries> + <entries> + <name>Thimphu</name> + <id>Asia/Thimphu</id> + </entries> + <entries> + <name>Manila</name> + <id>Asia/Manila</id> + </entries> + <entries> + <name>Macao</name> + <id>Asia/Macau</id> + </entries> + <entries> + <name>Bishkek</name> + <id>Asia/Bishkek</id> + </entries> + <entries> + <name>Ashgabat</name> + <id>Asia/Ashgabat</id> + </entries> + <entries> + <name>Nicosia</name> + <id>Asia/Nicosia</id> + </entries> + <entries> + <name>Jakarta</name> + <id>Asia/Jakarta</id> + </entries> + <entries> + <name>Makassar</name> + <id>Asia/Makassar</id> + </entries> + <entries> + <name>Phnom Penh</name> + <id>Asia/Phnom_Penh</id> + </entries> + <entries> + <name>Aden</name> + <id>Asia/Aden</id> + </entries> + <entries> + <name>Anadyr</name> + <id>Asia/Anadyr</id> + </entries> + <entries> + <name>Dhaka</name> + <id>Asia/Dhaka</id> + </entries> + <entries> + <name>Kuala Lumpur</name> + <id>Asia/Kuala_Lumpur</id> + </entries> + <entries> + <name>Irkutsk</name> + <id>Asia/Irkutsk</id> + </entries> + <entries> + <name>Tbilisi</name> + <id>Asia/Tbilisi</id> + </entries> + <entries> + <name>Yekaterinburg</name> + <id>Asia/Yekaterinburg</id> + </entries> + <entries> + <name>Japan</name> + <id>Asia/Tokyo</id> + </entries> + <entries> + <name>Katmandu</name> + <id>Asia/Katmandu</id> + </entries> + <entries> + <name>Kolkata</name> + <id>Asia/Kolkata</id> + </entries> + <entries> + <name>Dili</name> + <id>Asia/Dili</id> + </entries> + <entries> + <name>Pyongyang</name> + <id>Asia/Pyongyang</id> + </entries> + <entries> + <name>Hovd</name> + <id>Asia/Hovd</id> + </entries> + <entries> + <name>Novosibirsk</name> + <id>Asia/Novosibirsk</id> + </entries> + <entries> + <name>Saigon</name> + <id>Asia/Ho_Chi_Minh</id> + </entries> + <entries> + <name>Bahrain</name> + <id>Asia/Bahrain</id> + </entries> + </entries> + <central>Asia/Kolkata</central> + </timezones> + <timezones> + <name>Atlantic</name> + <entries type="array"> + <entries> + <name>Stanley</name> + <id>Atlantic/Stanley</id> + </entries> + <entries> + <name>St Helena</name> + <id>Atlantic/St_Helena</id> + </entries> + <entries> + <name>Jan Mayen</name> + <id>Atlantic/Jan_Mayen</id> + </entries> + <entries> + <name>Miquelon</name> + <id>America/Miquelon</id> + </entries> + <entries> + <name>Canary Islands</name> + <id>Atlantic/Canary</id> + </entries> + <entries> + <name>Bermuda</name> + <id>Atlantic/Bermuda</id> + </entries> + <entries> + <name>Iceland</name> + <id>Atlantic/Reykjavik</id> + </entries> + <entries> + <name>Greenland (Thule)</name> + <id>America/Thule</id> + </entries> + <entries> + <name>Greenland (Nuuk)</name> + <id>America/Godthab</id> + </entries> + <entries> + <name>Faroe Islands</name> + <id>Atlantic/Faroe</id> + </entries> + <entries> + <name>Greenland (Scoresbysund)</name> + <id>America/Scoresbysund</id> + </entries> + <entries> + <name>Madeira</name> + <id>Atlantic/Madeira</id> + </entries> + <entries> + <name>Azores</name> + <id>Atlantic/Azores</id> + </entries> + <entries> + <name>South Georgia</name> + <id>Atlantic/South_Georgia</id> + </entries> + <entries> + <name>Cape Verde</name> + <id>Atlantic/Cape_Verde</id> + </entries> + <entries> + <name>Greenland (Danmarkshavn)</name> + <id>America/Danmarkshavn</id> + </entries> + </entries> + <central>Atlantic/Madeira</central> + </timezones> + <timezones> + <name>Australia</name> + <entries type="array"> + <entries> + <name>New South Wales (Sydney)</name> + <id>Australia/Sydney</id> + </entries> + <entries> + <name>Lindeman</name> + <id>Australia/Lindeman</id> + </entries> + <entries> + <name>Northern Territory (Darwin)</name> + <id>Australia/Darwin</id> + </entries> + <entries> + <name>South Australia (Adelaide)</name> + <id>Australia/Adelaide</id> + </entries> + <entries> + <name>Tasmania (Hobart)</name> + <id>Australia/Hobart</id> + </entries> + <entries> + <name>Eucla</name> + <id>Australia/Eucla</id> + </entries> + <entries> + <name>New South Wales (Broken Hill)</name> + <id>Australia/Broken_Hill</id> + </entries> + <entries> + <name>Tasmania (Currie)</name> + <id>Australia/Currie</id> + </entries> + <entries> + <name>Western Australia (Perth)</name> + <id>Australia/Perth</id> + </entries> + <entries> + <name>Victoria (Melbourne)</name> + <id>Australia/Melbourne</id> + </entries> + <entries> + <name>Lord Howe Island</name> + <id>Australia/Lord_Howe</id> + </entries> + <entries> + <name>Queensland (Brisbane)</name> + <id>Australia/Brisbane</id> + </entries> + </entries> + <central>Australia/Sydney</central> + </timezones> + <timezones> + <name>Brazil</name> + <entries type="array"> + <entries> + <name>Porto Velho</name> + <id>America/Porto_Velho</id> + </entries> + <entries> + <name>Eirunepe</name> + <id>America/Eirunepe</id> + </entries> + <entries> + <name>Bahia</name> + <id>America/Bahia</id> + </entries> + <entries> + <name>Fernando de Noronha</name> + <id>America/Noronha</id> + </entries> + <entries> + <name>Cuiaba</name> + <id>America/Cuiaba</id> + </entries> + <entries> + <name>Campo Grande</name> + <id>America/Campo_Grande</id> + </entries> + <entries> + <name>Boa Vista</name> + <id>America/Boa_Vista</id> + </entries> + <entries> + <name>Recife</name> + <id>America/Recife</id> + </entries> + <entries> + <name>Manaus</name> + <id>America/Manaus</id> + </entries> + <entries> + <name>Araguaina</name> + <id>America/Araguaina</id> + </entries> + <entries> + <name>Maceio</name> + <id>America/Maceio</id> + </entries> + <entries> + <name>Sao Paulo</name> + <id>America/Sao_Paulo</id> + </entries> + <entries> + <name>Rio Branco</name> + <id>America/Rio_Branco</id> + </entries> + <entries> + <name>Belem</name> + <id>America/Belem</id> + </entries> + <entries> + <name>Fortaleza</name> + <id>America/Fortaleza</id> + </entries> + </entries> + <central>America/Sao_Paulo</central> + </timezones> + <timezones> + <name>Canada</name> + <entries type="array"> + <entries> + <name>Saskatchewan (Regina)</name> + <id>America/Regina</id> + </entries> + <entries> + <name>Rankin Inlet</name> + <id>America/Rankin_Inlet</id> + </entries> + <entries> + <name>Thunder Bay</name> + <id>America/Thunder_Bay</id> + </entries> + <entries> + <name>Resolute</name> + <id>America/Resolute</id> + </entries> + <entries> + <name>Goose Bay</name> + <id>America/Goose_Bay</id> + </entries> + <entries> + <name>Dawson Creek</name> + <id>America/Dawson_Creek</id> + </entries> + <entries> + <name>Atikokan</name> + <id>America/Atikokan</id> + </entries> + <entries> + <name>Yukon (Whitehorse)</name> + <id>America/Whitehorse</id> + </entries> + <entries> + <name>Swift Current</name> + <id>America/Swift_Current</id> + </entries> + <entries> + <name>Newfoundland (St Johns)</name> + <id>America/St_Johns</id> + </entries> + <entries> + <name>Iqaluit</name> + <id>America/Iqaluit</id> + </entries> + <entries> + <name>Blanc-Sablon</name> + <id>America/Blanc-Sablon</id> + </entries> + <entries> + <name>Glace Bay</name> + <id>America/Glace_Bay</id> + </entries> + <entries> + <name>Yellowknife</name> + <id>America/Yellowknife</id> + </entries> + <entries> + <name>Inuvik</name> + <id>America/Inuvik</id> + </entries> + <entries> + <name>Dawson</name> + <id>America/Dawson</id> + </entries> + <entries> + <name>Rainy River</name> + <id>America/Rainy_River</id> + </entries> + <entries> + <name>Pangnirtung</name> + <id>America/Pangnirtung</id> + </entries> + <entries> + <name>Nipigon</name> + <id>America/Nipigon</id> + </entries> + <entries> + <name>Eastern (Toronto)</name> + <id>America/Toronto</id> + </entries> + <entries> + <name>Montreal</name> + <id>America/Montreal</id> + </entries> + <entries> + <name>Moncton</name> + <id>America/Moncton</id> + </entries> + <entries> + <name>Mountain (Edmonton)</name> + <id>America/Edmonton</id> + </entries> + <entries> + <name>Cambridge Bay</name> + <id>America/Cambridge_Bay</id> + </entries> + <entries> + <name>Central (Winnipeg)</name> + <id>America/Winnipeg</id> + </entries> + <entries> + <name>Pacific (Vancouver)</name> + <id>America/Vancouver</id> + </entries> + <entries> + <name>Atlantic (Halifax)</name> + <id>America/Halifax</id> + </entries> + </entries> + <central>America/Winnipeg</central> + </timezones> + <timezones> + <name>Central and South America</name> + <entries type="array"> + <entries> + <name>Stanley</name> + <id>Atlantic/Stanley</id> + </entries> + <entries> + <name>Uruguay</name> + <id>America/Montevideo</id> + </entries> + <entries> + <name>Martinique</name> + <id>America/Martinique</id> + </entries> + <entries> + <name>Managua</name> + <id>America/Managua</id> + </entries> + <entries> + <name>La Paz</name> + <id>America/La_Paz</id> + </entries> + <entries> + <name>Grenada</name> + <id>America/Grenada</id> + </entries> + <entries> + <name>Cayman Islands</name> + <id>America/Cayman</id> + </entries> + <entries> + <name>Caracas</name> + <id>America/Caracas</id> + </entries> + <entries> + <name>Anguilla</name> + <id>America/Anguilla</id> + </entries> + <entries> + <name>Saint Lucia</name> + <id>America/St_Lucia</id> + </entries> + <entries> + <name>Costa Rica</name> + <id>America/Costa_Rica</id> + </entries> + <entries> + <name>Havana</name> + <id>America/Havana</id> + </entries> + <entries> + <name>Aruba</name> + <id>America/Aruba</id> + </entries> + <entries> + <name>St Thomas</name> + <id>America/St_Thomas</id> + </entries> + <entries> + <name>Port-au-Prince</name> + <id>America/Port-au-Prince</id> + </entries> + <entries> + <name>Guyana</name> + <id>America/Guyana</id> + </entries> + <entries> + <name>Guatemala</name> + <id>America/Guatemala</id> + </entries> + <entries> + <name>El Salvador</name> + <id>America/El_Salvador</id> + </entries> + <entries> + <name>Dominica</name> + <id>America/Dominica</id> + </entries> + <entries> + <name>Paramaribo</name> + <id>America/Paramaribo</id> + </entries> + <entries> + <name>Panama</name> + <id>America/Panama</id> + </entries> + <entries> + <name>Guayaquil</name> + <id>America/Guayaquil</id> + </entries> + <entries> + <name>Grand Turk</name> + <id>America/Grand_Turk</id> + </entries> + <entries> + <name>Bogota</name> + <id>America/Bogota</id> + </entries> + <entries> + <name>Belize</name> + <id>America/Belize</id> + </entries> + <entries> + <name>St Vincent</name> + <id>America/St_Vincent</id> + </entries> + <entries> + <name>Saint Kitts and Nevis</name> + <id>America/St_Kitts</id> + </entries> + <entries> + <name>Curacao</name> + <id>America/Curacao</id> + </entries> + <entries> + <name>Galapagos</name> + <id>Pacific/Galapagos</id> + </entries> + <entries> + <name>Puerto Rico</name> + <id>America/Puerto_Rico</id> + </entries> + <entries> + <name>Montserrat</name> + <id>America/Montserrat</id> + </entries> + <entries> + <name>Jamaica</name> + <id>America/Jamaica</id> + </entries> + <entries> + <name>Barbados</name> + <id>America/Barbados</id> + </entries> + <entries> + <name>Antigua</name> + <id>America/Antigua</id> + </entries> + <entries> + <name>Nassau</name> + <id>America/Nassau</id> + </entries> + <entries> + <name>Asuncion</name> + <id>America/Asuncion</id> + </entries> + <entries> + <name>Easter Island</name> + <id>Pacific/Easter</id> + </entries> + <entries> + <name>Tegucigalpa</name> + <id>America/Tegucigalpa</id> + </entries> + <entries> + <name>Lima</name> + <id>America/Lima</id> + </entries> + <entries> + <name>Guadeloupe</name> + <id>America/Guadeloupe</id> + </entries> + <entries> + <name>Tortola</name> + <id>America/Tortola</id> + </entries> + <entries> + <name>Santo Domingo</name> + <id>America/Santo_Domingo</id> + </entries> + <entries> + <name>Chile Continental</name> + <id>America/Santiago</id> + </entries> + <entries> + <name>Port of Spain</name> + <id>America/Port_of_Spain</id> + </entries> + <entries> + <name>Cayenne</name> + <id>America/Cayenne</id> + </entries> + </entries> + <central>America/La_Paz</central> + </timezones> + <timezones> + <name>Etc</name> + <entries type="array"> + <entries> + <name>Zulu</name> + <id>Etc/Zulu</id> + </entries> + <entries> + <name>UTC</name> + <id>Etc/UTC</id> + </entries> + <entries> + <name>Greenwich</name> + <id>Etc/Greenwich</id> + </entries> + <entries> + <name>GMT-9</name> + <id>Etc/GMT-9</id> + </entries> + <entries> + <name>GMT-14</name> + <id>Etc/GMT-14</id> + </entries> + <entries> + <name>GMT+7</name> + <id>Etc/GMT+7</id> + </entries> + <entries> + <name>UCT</name> + <id>Etc/UCT</id> + </entries> + <entries> + <name>GMT-0</name> + <id>Etc/GMT-0</id> + </entries> + <entries> + <name>GMT+8</name> + <id>Etc/GMT+8</id> + </entries> + <entries> + <name>GMT-1</name> + <id>Etc/GMT-1</id> + </entries> + <entries> + <name>GMT+9</name> + <id>Etc/GMT+9</id> + </entries> + <entries> + <name>GMT-2</name> + <id>Etc/GMT-2</id> + </entries> + <entries> + <name>GMT+0</name> + <id>Etc/GMT+0</id> + </entries> + <entries> + <name>GMT-3</name> + <id>Etc/GMT-3</id> + </entries> + <entries> + <name>GMT+10</name> + <id>Etc/GMT+10</id> + </entries> + <entries> + <name>GMT+1</name> + <id>Etc/GMT+1</id> + </entries> + <entries> + <name>GMT-4</name> + <id>Etc/GMT-4</id> + </entries> + <entries> + <name>GMT+2</name> + <id>Etc/GMT+2</id> + </entries> + <entries> + <name>GMT+11</name> + <id>Etc/GMT+11</id> + </entries> + <entries> + <name>Universal</name> + <id>Etc/Universal</id> + </entries> + <entries> + <name>GMT0</name> + <id>Etc/GMT0</id> + </entries> + <entries> + <name>GMT-5</name> + <id>Etc/GMT-5</id> + </entries> + <entries> + <name>GMT-10</name> + <id>Etc/GMT-10</id> + </entries> + <entries> + <name>GMT+3</name> + <id>Etc/GMT+3</id> + </entries> + <entries> + <name>GMT+12</name> + <id>Etc/GMT+12</id> + </entries> + <entries> + <name>GMT-6</name> + <id>Etc/GMT-6</id> + </entries> + <entries> + <name>GMT-11</name> + <id>Etc/GMT-11</id> + </entries> + <entries> + <name>GMT+4</name> + <id>Etc/GMT+4</id> + </entries> + <entries> + <name>GMT-7</name> + <id>Etc/GMT-7</id> + </entries> + <entries> + <name>GMT-12</name> + <id>Etc/GMT-12</id> + </entries> + <entries> + <name>GMT+5</name> + <id>Etc/GMT+5</id> + </entries> + <entries> + <name>GMT-8</name> + <id>Etc/GMT-8</id> + </entries> + <entries> + <name>GMT-13</name> + <id>Etc/GMT-13</id> + </entries> + <entries> + <name>GMT+6</name> + <id>Etc/GMT+6</id> + </entries> + <entries> + <name>GMT</name> + <id>Etc/GMT</id> + </entries> + </entries> + <central>Etc/GMT</central> + </timezones> + <timezones> + <name>Europe</name> + <entries type="array"> + <entries> + <name>Uzhgorod</name> + <id>Europe/Uzhgorod</id> + </entries> + <entries> + <name>Russia (Moscow)</name> + <id>Europe/Moscow</id> + </entries> + <entries> + <name>Jersey</name> + <id>Europe/Jersey</id> + </entries> + <entries> + <name>Belgium</name> + <id>Europe/Brussels</id> + </entries> + <entries> + <name>Netherlands</name> + <id>Europe/Amsterdam</id> + </entries> + <entries> + <name>Miquelon</name> + <id>America/Miquelon</id> + </entries> + <entries> + <name>Ukraine (Zaporozhye)</name> + <id>Europe/Zaporozhye</id> + </entries> + <entries> + <name>France</name> + <id>Europe/Paris</id> + </entries> + <entries> + <name>Norway</name> + <id>Europe/Oslo</id> + </entries> + <entries> + <name>Malta</name> + <id>Europe/Malta</id> + </entries> + <entries> + <name>Finland</name> + <id>Europe/Helsinki</id> + </entries> + <entries> + <name>Greece</name> + <id>Europe/Athens</id> + </entries> + <entries> + <name>Canary Islands</name> + <id>Atlantic/Canary</id> + </entries> + <entries> + <name>Macedonia</name> + <id>Europe/Skopje</id> + </entries> + <entries> + <name>Monaco</name> + <id>Europe/Monaco</id> + </entries> + <entries> + <name>Iceland</name> + <id>Atlantic/Reykjavik</id> + </entries> + <entries> + <name>San Marino</name> + <id>Europe/San_Marino</id> + </entries> + <entries> + <name>Italy</name> + <id>Europe/Rome</id> + </entries> + <entries> + <name>Portugal</name> + <id>Europe/Lisbon</id> + </entries> + <entries> + <name>Turkey</name> + <id>Europe/Istanbul</id> + </entries> + <entries> + <name>Ireland</name> + <id>Europe/Dublin</id> + </entries> + <entries> + <name>Slovakia</name> + <id>Europe/Bratislava</id> + </entries> + <entries> + <name>Germany</name> + <id>Europe/Berlin</id> + </entries> + <entries> + <name>Spain</name> + <id>Europe/Madrid</id> + </entries> + <entries> + <name>Isle of Man</name> + <id>Europe/Isle_of_Man</id> + </entries> + <entries> + <name>Guernsey</name> + <id>Europe/Guernsey</id> + </entries> + <entries> + <name>Denmark</name> + <id>Europe/Copenhagen</id> + </entries> + <entries> + <name>Switzerland</name> + <id>Europe/Zurich</id> + </entries> + <entries> + <name>Croatia</name> + <id>Europe/Zagreb</id> + </entries> + <entries> + <name>Estonia</name> + <id>Europe/Tallinn</id> + </entries> + <entries> + <name>Ukraine (Kiev)</name> + <id>Europe/Kiev</id> + </entries> + <entries> + <name>Poland</name> + <id>Europe/Warsaw</id> + </entries> + <entries> + <name>Lithuania</name> + <id>Europe/Vilnius</id> + </entries> + <entries> + <name>Vatican</name> + <id>Europe/Vatican</id> + </entries> + <entries> + <name>Czech Republic</name> + <id>Europe/Prague</id> + </entries> + <entries> + <name>Aaland Islands</name> + <id>Europe/Mariehamn</id> + </entries> + <entries> + <name>Russia (Kaliningrad)</name> + <id>Europe/Kaliningrad</id> + </entries> + <entries> + <name>Gibraltar</name> + <id>Europe/Gibraltar</id> + </entries> + <entries> + <name>Serbia</name> + <id>Europe/Belgrade</id> + </entries> + <entries> + <name>Austria</name> + <id>Europe/Vienna</id> + </entries> + <entries> + <name>Liechtenstein</name> + <id>Europe/Vaduz</id> + </entries> + <entries> + <name>Luxembourg</name> + <id>Europe/Luxembourg</id> + </entries> + <entries> + <name>Slovenia</name> + <id>Europe/Ljubljana</id> + </entries> + <entries> + <name>Andorra</name> + <id>Europe/Andorra</id> + </entries> + <entries> + <name>Azores</name> + <id>Atlantic/Azores</id> + </entries> + <entries> + <name>Ukraine (Simferopol)</name> + <id>Europe/Simferopol</id> + </entries> + <entries> + <name>Belarus</name> + <id>Europe/Minsk</id> + </entries> + <entries> + <name>United Kingdom</name> + <id>Europe/London</id> + </entries> + <entries> + <name>Romania</name> + <id>Europe/Bucharest</id> + </entries> + <entries> + <name>Russia (Volgograd)</name> + <id>Europe/Volgograd</id> + </entries> + <entries> + <name>Albania</name> + <id>Europe/Tirane</id> + </entries> + <entries> + <name>Sweden</name> + <id>Europe/Stockholm</id> + </entries> + <entries> + <name>Bulgaria</name> + <id>Europe/Sofia</id> + </entries> + <entries> + <name>Bosnia & Herzegovina</name> + <id>Europe/Sarajevo</id> + </entries> + <entries> + <name>Russia (Samara)</name> + <id>Europe/Samara</id> + </entries> + <entries> + <name>Latvia</name> + <id>Europe/Riga</id> + </entries> + <entries> + <name>Montenegro</name> + <id>Europe/Podgorica</id> + </entries> + <entries> + <name>Moldova</name> + <id>Europe/Chisinau</id> + </entries> + <entries> + <name>Hungary</name> + <id>Europe/Budapest</id> + </entries> + </entries> + <central>Europe/Prague</central> + </timezones> + <timezones> + <name>Global</name> + <entries type="array"> + <entries> + <name>NZ</name> + <id>NZ</id> + </entries> + <entries> + <name>GMT+0</name> + <id>GMT+0</id> + </entries> + <entries> + <name>GMT0</name> + <id>GMT0</id> + </entries> + <entries> + <name>Antarctica (Syowa)</name> + <id>Antarctica/Syowa</id> + </entries> + <entries> + <name>Antarctica (Mawson)</name> + <id>Antarctica/Mawson</id> + </entries> + <entries> + <name>Navajo</name> + <id>Navajo</id> + </entries> + <entries> + <name>MST</name> + <id>MST</id> + </entries> + <entries> + <name>GMT</name> + <id>GMT</id> + </entries> + <entries> + <name>CST6CDT</name> + <id>CST6CDT</id> + </entries> + <entries> + <name>Arctic Longyearbyen</name> + <id>Arctic/Longyearbyen</id> + </entries> + <entries> + <name>Universal</name> + <id>Universal</id> + </entries> + <entries> + <name>UTC</name> + <id>UTC</id> + </entries> + <entries> + <name>Antarctica (Casey)</name> + <id>Antarctica/Casey</id> + </entries> + <entries> + <name>PST8PDT</name> + <id>PST8PDT</id> + </entries> + <entries> + <name>NZ-CHAT</name> + <id>NZ-CHAT</id> + </entries> + <entries> + <name>Greenland (Thule)</name> + <id>America/Thule</id> + </entries> + <entries> + <name>Greenland (Nuuk)</name> + <id>America/Godthab</id> + </entries> + <entries> + <name>Zulu</name> + <id>Zulu</id> + </entries> + <entries> + <name>WET</name> + <id>WET</id> + </entries> + <entries> + <name>W-SU</name> + <id>W-SU</id> + </entries> + <entries> + <name>UCT</name> + <id>UCT</id> + </entries> + <entries> + <name>MET</name> + <id>MET</id> + </entries> + <entries> + <name>Greenwich</name> + <id>Greenwich</id> + </entries> + <entries> + <name>EST</name> + <id>EST</id> + </entries> + <entries> + <name>Greenland (Scoresbysund)</name> + <id>America/Scoresbysund</id> + </entries> + <entries> + <name>CET</name> + <id>CET</id> + </entries> + <entries> + <name>Antarctica (Vostok)</name> + <id>Antarctica/Vostok</id> + </entries> + <entries> + <name>Antarctica (South Pole)</name> + <id>Antarctica/South_Pole</id> + </entries> + <entries> + <name>Antarctica (Rothera)</name> + <id>Antarctica/Rothera</id> + </entries> + <entries> + <name>Antarctica (Palmer)</name> + <id>Antarctica/Palmer</id> + </entries> + <entries> + <name>Antarctica (McMurdo)</name> + <id>Antarctica/McMurdo</id> + </entries> + <entries> + <name>MST7MDT</name> + <id>MST7MDT</id> + </entries> + <entries> + <name>HST</name> + <id>HST</id> + </entries> + <entries> + <name>EET</name> + <id>EET</id> + </entries> + <entries> + <name>Antarctica (DumontDUrville)</name> + <id>Antarctica/DumontDUrville</id> + </entries> + <entries> + <name>Antarctica (Davis)</name> + <id>Antarctica/Davis</id> + </entries> + <entries> + <name>Greenland (Danmarkshavn)</name> + <id>America/Danmarkshavn</id> + </entries> + <entries> + <name>GMT-0</name> + <id>GMT-0</id> + </entries> + <entries> + <name>EST5EDT</name> + <id>EST5EDT</id> + </entries> + </entries> + <central>America/Godthab</central> + </timezones> + <timezones> + <name>Indian Ocean</name> + <entries type="array"> + <entries> + <name>Maldives</name> + <id>Indian/Maldives</id> + </entries> + <entries> + <name>Mauritius</name> + <id>Indian/Mauritius</id> + </entries> + <entries> + <name>Reunion</name> + <id>Indian/Reunion</id> + </entries> + <entries> + <name>Comoro</name> + <id>Indian/Comoro</id> + </entries> + <entries> + <name>Cocos Islands</name> + <id>Indian/Cocos</id> + </entries> + <entries> + <name>Mayotte</name> + <id>Indian/Mayotte</id> + </entries> + <entries> + <name>Mahe</name> + <id>Indian/Mahe</id> + </entries> + <entries> + <name>Chagos</name> + <id>Indian/Chagos</id> + </entries> + <entries> + <name>Kerguelen</name> + <id>Indian/Kerguelen</id> + </entries> + <entries> + <name>Christmas Island</name> + <id>Indian/Christmas</id> + </entries> + </entries> + <central>Indian/Maldives</central> + </timezones> + <timezones> + <name>Mexico</name> + <entries type="array"> + <entries> + <name>Cancun</name> + <id>America/Cancun</id> + </entries> + <entries> + <name>Mazatlan</name> + <id>America/Mazatlan</id> + </entries> + <entries> + <name>Hermosillo</name> + <id>America/Hermosillo</id> + </entries> + <entries> + <name>Merida</name> + <id>America/Merida</id> + </entries> + <entries> + <name>Monterrey</name> + <id>America/Monterrey</id> + </entries> + <entries> + <name>Chihuahua</name> + <id>America/Chihuahua</id> + </entries> + <entries> + <name>Mexico City</name> + <id>America/Mexico_City</id> + </entries> + <entries> + <name>Tijuana</name> + <id>America/Tijuana</id> + </entries> + </entries> + <central>America/Mexico_City</central> + </timezones> + <timezones> + <name>Pacific</name> + <entries type="array"> + <entries> + <name>Port_Moresby</name> + <id>Pacific/Port_Moresby</id> + </entries> + <entries> + <name>Palau</name> + <id>Pacific/Palau</id> + </entries> + <entries> + <name>Nauru</name> + <id>Pacific/Nauru</id> + </entries> + <entries> + <name>Guam</name> + <id>Pacific/Guam</id> + </entries> + <entries> + <name>Efate</name> + <id>Pacific/Efate</id> + </entries> + <entries> + <name>Gambier</name> + <id>Pacific/Gambier</id> + </entries> + <entries> + <name>Funafuti</name> + <id>Pacific/Funafuti</id> + </entries> + <entries> + <name>Fiji</name> + <id>Pacific/Fiji</id> + </entries> + <entries> + <name>Kosrae</name> + <id>Pacific/Kosrae</id> + </entries> + <entries> + <name>Chatham</name> + <id>Pacific/Chatham</id> + </entries> + <entries> + <name>Apia</name> + <id>Pacific/Apia</id> + </entries> + <entries> + <name>Wake</name> + <id>Pacific/Wake</id> + </entries> + <entries> + <name>Samoa</name> + <id>Pacific/Pago_Pago</id> + </entries> + <entries> + <name>Wallis</name> + <id>Pacific/Wallis</id> + </entries> + <entries> + <name>Pohnpei</name> + <id>Pacific/Ponape</id> + </entries> + <entries> + <name>New Zealand</name> + <id>Pacific/Auckland</id> + </entries> + <entries> + <name>Tongatapu</name> + <id>Pacific/Tongatapu</id> + </entries> + <entries> + <name>Tarawa</name> + <id>Pacific/Tarawa</id> + </entries> + <entries> + <name>Kiritimati</name> + <id>Pacific/Kiritimati</id> + </entries> + <entries> + <name>Guadalcanal</name> + <id>Pacific/Guadalcanal</id> + </entries> + <entries> + <name>Chuuk</name> + <id>Pacific/Truk</id> + </entries> + <entries> + <name>Midway</name> + <id>Pacific/Midway</id> + </entries> + <entries> + <name>Majuro</name> + <id>Pacific/Majuro</id> + </entries> + <entries> + <name>Kwajalein</name> + <id>Pacific/Kwajalein</id> + </entries> + <entries> + <name>Rarotonga</name> + <id>Pacific/Rarotonga</id> + </entries> + <entries> + <name>Noumea</name> + <id>Pacific/Noumea</id> + </entries> + <entries> + <name>Norfolk</name> + <id>Pacific/Norfolk</id> + </entries> + <entries> + <name>Niue</name> + <id>Pacific/Niue</id> + </entries> + <entries> + <name>Enderbury</name> + <id>Pacific/Enderbury</id> + </entries> + <entries> + <name>Tahiti</name> + <id>Pacific/Tahiti</id> + </entries> + <entries> + <name>Pitcairn</name> + <id>Pacific/Pitcairn</id> + </entries> + <entries> + <name>Saipan</name> + <id>Pacific/Saipan</id> + </entries> + <entries> + <name>Marquesas</name> + <id>Pacific/Marquesas</id> + </entries> + <entries> + <name>Johnston</name> + <id>Pacific/Johnston</id> + </entries> + <entries> + <name>Fakaofo</name> + <id>Pacific/Fakaofo</id> + </entries> + <entries> + <name>Dili</name> + <id>Pacific/Dili</id> + </entries> + </entries> + <central>Pacific/Tahiti</central> + </timezones> + <timezones> + <name>Russia</name> + <entries type="array"> + <entries> + <name>Moscow</name> + <id>Europe/Moscow</id> + </entries> + <entries> + <name>Yekaterinburg</name> + <id>Asia/Yekaterinburg</id> + </entries> + <entries> + <name>Sakhalin</name> + <id>Asia/Sakhalin</id> + </entries> + <entries> + <name>Kamchatka</name> + <id>Asia/Kamchatka</id> + </entries> + <entries> + <name>Irkutsk</name> + <id>Asia/Irkutsk</id> + </entries> + <entries> + <name>Yakutsk</name> + <id>Asia/Yakutsk</id> + </entries> + <entries> + <name>Vladivostok</name> + <id>Asia/Vladivostok</id> + </entries> + <entries> + <name>Anadyr</name> + <id>Asia/Anadyr</id> + </entries> + <entries> + <name>Omsk</name> + <id>Asia/Omsk</id> + </entries> + <entries> + <name>Kaliningrad</name> + <id>Europe/Kaliningrad</id> + </entries> + <entries> + <name>Novosibirsk</name> + <id>Asia/Novosibirsk</id> + </entries> + <entries> + <name>Krasnoyarsk</name> + <id>Asia/Krasnoyarsk</id> + </entries> + <entries> + <name>Magadan</name> + <id>Asia/Magadan</id> + </entries> + <entries> + <name>Volgograd</name> + <id>Europe/Volgograd</id> + </entries> + <entries> + <name>Samara</name> + <id>Europe/Samara</id> + </entries> + </entries> + <central>Asia/Novosibirsk</central> + </timezones> + <timezones> + <name>USA</name> + <entries type="array"> + <entries> + <name>Hawaii (Honolulu)</name> + <id>Pacific/Honolulu</id> + </entries> + <entries> + <name>Central (Chicago)</name> + <id>America/Chicago</id> + </entries> + <entries> + <name>Alaska (Anchorage)</name> + <id>America/Anchorage</id> + </entries> + <entries> + <name>Kentucky (Monticello)</name> + <id>America/Kentucky/Monticello</id> + </entries> + <entries> + <name>Juneau</name> + <id>America/Juneau</id> + </entries> + <entries> + <name>Indiana (Petersburg)</name> + <id>America/Indiana/Petersburg</id> + </entries> + <entries> + <name>East Indiana (Indianapolis)</name> + <id>America/Indiana/Indianapolis</id> + </entries> + <entries> + <name>Shiprock</name> + <id>America/Shiprock</id> + </entries> + <entries> + <name>Pacific (Los Angeles)</name> + <id>America/Los_Angeles</id> + </entries> + <entries> + <name>Indiana (Marengo)</name> + <id>America/Indiana/Marengo</id> + </entries> + <entries> + <name>Samoa (Pago Pago)</name> + <id>Pacific/Pago_Pago</id> + </entries> + <entries> + <name>Virgin Islands (St Thomas)</name> + <id>America/St_Thomas</id> + </entries> + <entries> + <name>North Dakota (New Salem)</name> + <id>America/North_Dakota/New_Salem</id> + </entries> + <entries> + <name>Indiana (Vevay)</name> + <id>America/Indiana/Vevay</id> + </entries> + <entries> + <name>Mountain (Denver)</name> + <id>America/Denver</id> + </entries> + <entries> + <name>Menominee</name> + <id>America/Menominee</id> + </entries> + <entries> + <name>Indiana (Winamac)</name> + <id>America/Indiana/Winamac</id> + </entries> + <entries> + <name>Boise</name> + <id>America/Boise</id> + </entries> + <entries> + <name>Arizona (Phoenix)</name> + <id>America/Phoenix</id> + </entries> + <entries> + <name>Indiana (Vincennes)</name> + <id>America/Indiana/Vincennes</id> + </entries> + <entries> + <name>Aleutian (Adak)</name> + <id>America/Adak</id> + </entries> + <entries> + <name>Eastern (New York)</name> + <id>America/New_York</id> + </entries> + <entries> + <name>Michigan (Detroit)</name> + <id>America/Detroit</id> + </entries> + <entries> + <name>Puerto Rico</name> + <id>America/Puerto_Rico</id> + </entries> + <entries> + <name>Nome</name> + <id>America/Nome</id> + </entries> + <entries> + <name>Kentucky (Louisville)</name> + <id>America/Kentucky/Louisville</id> + </entries> + <entries> + <name>Yakutat</name> + <id>America/Yakutat</id> + </entries> + <entries> + <name>North Dakota (Center)</name> + <id>America/North_Dakota/Center</id> + </entries> + <entries> + <name>Indiana Starke (Knox)</name> + <id>America/Indiana/Knox</id> + </entries> + <entries> + <name>Indiana (Tell City)</name> + <id>America/Indiana/Tell_City</id> + </entries> + </entries> + <central>America/Chicago</central> + </timezones> + </timezones> + <timezone>Europe/Prague</timezone> + <time>12:18:00</time> + <utcstatus type="boolean">false</utcstatus> + <date>07/02/2009</date> +</systemtime> diff --git a/plugins/systemtime/test/functional/systemtime_controller_test.rb b/plugins/systemtime/test/functional/systemtime_controller_test.rb index 70e2995..5fa63d5 100644 --- a/plugins/systemtime/test/functional/systemtime_controller_test.rb +++ b/plugins/systemtime/test/functional/systemtime_controller_test.rb @@ -2,148 +2,57 @@ require File.expand_path(File.dirname(__FILE__) + "/../test_helper") require 'test/unit' require File.expand_path( File.join("test","validation_assert"), RailsParent.parent ) require 'mocha' +require 'yast_mock' class SystemtimeControllerTest < ActionController::TestCase - - class Proxy - attr_accessor :result, :permissions, :timeout - def find - return result - end - end - - class NtpProxy - attr_accessor :result, :permissions, :timeout - def find - return result - end - end - - class Ntp - attr_accessor :synchronize, :synchronize_utc - - def initialize - @synchronize = false - @synchronize_utc = true - end - - def save - end - end - - class Region - attr_accessor :name, :central, :entries - def initialize (name, central, entries) - @name = name - @central = central - @entries = entries - end - end - - class Entry - attr_accessor :id, :name - def initialize (id,name) - @id = id - @name = name - end - end - - - - class Result - attr_accessor :time, :date, :timezone, :utcstatus, :timezones, :saved - - def fill - @timezones = [ - Region.new("Europe","Europe/Prague",[ Entry.new("Europe/Prague","Czech Republic" )]) -] - @time = "12:18:00" - @date = "07/02/2009" - @utcstatus = false - @timezone = "Europe/Prague" - end - - def save - @saved = true - end - end - + def setup SystemtimeController.any_instance.stubs(:login_required) @controller = SystemtimeController.new @request = ActionController::TestRequest.new # http://railsforum.com/viewtopic.php?id=1719 @request.session[:account_id] = 1 # defined in fixtures - @permissions = { :read => true, :write => true } - @result = Result.new - @result.fill - @proxy = Proxy.new - @proxy.permissions = @permissions - @proxy.result = @result + response_time = IO.read(File.join(File.dirname(__FILE__),"..","fixtures","success.xml")) + response_ntp = IO.read(File.join(File.dirname(__FILE__),"..","fixtures","ntp.xml")) + ActiveResource::HttpMock.set_authentification + ActiveResource::HttpMock.respond_to do |mock| + header = ActiveResource::HttpMock.authentification_header + mock.resources :"org.opensuse.yast.modules.yapi.time" => "/systemtime", :"org.opensuse.yast.modules.yapi.ntp" => "/ntp" + mock.permissions "org.opensuse.yast.modules.yapi.time", { :read => true, :write => true } + mock.permissions "org.opensuse.yast.modules.yapi.ntp", { :available => true, :synchronize => true } + mock.get "/systemtime.xml", header, response_time, 200 + mock.post "/systemtime.xml", header, response_time, 200 + mock.get "/ntp.xml", header, response_ntp, 200 + mock.post "/ntp.xml", header, response_ntp, 200 + end end def test_index - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) -#debugger - get :index - assert_response :success - assert_valid_markup - assert assigns(:permissions) - assert assigns(:permissions)[:read] - assert assigns(:permissions)[:write] - assert assigns(:time) - assert assigns(:date) - assert_equal assigns(:timezone), "Europe/Prague" - end - - def test_access_without_write_permissions - @permissions[:write] = false - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) - get :index - assert_response :success assert_valid_markup - assert assigns(:permissions) - assert assigns(:permissions)[:read] - assert !assigns(:permissions)[:write] - assert assigns(:time) + assert assigns(:stime) end - def test_commit - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) - post :update, { :currenttime => "2009-07-02 - 12:18:00", :date => { :date => "2009-07-02 - 12:18:00/2009-07-02 - 12:18:00" } } + post :update, { :currenttime => "12:18:00", :date => { :date => "2009-07-02" } } assert_response :redirect assert_redirected_to :controller => "controlpanel", :action => "index" - - assert @result.saved - assert_equal false,@result.utcstatus end def test_commit_wizard - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) session[:wizard_current] = "test" session[:wizard_steps] = "systemtime,language" - post :update, { :currenttime => "2009-07-02 - 12:18:00", :date => { :date => "2009-07-02 - 12:18:00/2009-07-02 - 12:18:00" }} + post :update, { :currenttime => "12:18:00", :date => { :date => "2009-07-02" }} assert_response :redirect assert_redirected_to :controller => "controlpanel", :action => "nextstep" - - assert @result.saved - assert_equal false, @result.utcstatus end - def test_ntp_force - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) - ntpproxy = NtpProxy.new - ntpproxy.result = Ntp.new - YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.ntp').returns(ntpproxy) + def test_ntp post :update, { :timeconfig => "ntp_sync" } assert_response :redirect assert_redirected_to :controller => "controlpanel", :action => "index" - assert ntpproxy.result.synchronize - assert !ntpproxy.result.synchronize_utc end end diff --git a/webclient/lib/yast_model/base.rb b/webclient/lib/yast_model/base.rb index c1f0adf..a968e18 100644 --- a/webclient/lib/yast_model/base.rb +++ b/webclient/lib/yast_model/base.rb @@ -7,8 +7,8 @@ module YastModel def site ret = super - if ret.nil? || ret != URI.parse(YaST::ServiceResource::Session.site) || - password != YaST::ServiceResource::Session.auth_token + if ret.nil? || ret != URI.parse(YaST::ServiceResource::Session.site) || password != YaST::ServiceResource::Session.auth_token + Rails.logger.debug "set new site for interface #{@interface}" set_site end return super -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Josef Reidinger