Index: /trunk/nagios-velvice/make-package-debian
===================================================================
--- /trunk/nagios-velvice/make-package-debian	(revision 321)
+++ /trunk/nagios-velvice/make-package-debian	(revision 322)
@@ -43,5 +43,5 @@
 Tag: implemented-in::perl, interface::commandline, role::program
 Priority: optional
-Depends: perl, perl-base, perl-modules, libnagios-object-perl, libhtml-parser-perl, liburi-encode-perl, libcolor-calc-perl, libyaml-syck-perl
+Depends: perl, perl-base, perl-modules, libnagios-object-perl, libhtml-parser-perl, liburi-encode-perl, libcolor-calc-perl, libyaml-syck-perl, libdatetime-event-recurrence-perl, libdatetime-set-perl
 Suggests: libyaml-shell-perl | yamllint, nagios3, nagios3-cgi
 Architecture: all
Index: /trunk/nagios-velvice/velvice.cgi
===================================================================
--- /trunk/nagios-velvice/velvice.cgi	(revision 321)
+++ /trunk/nagios-velvice/velvice.cgi	(revision 322)
@@ -12,8 +12,9 @@
 #
 # apt-get install perl-modules libnagios-object-perl libhtml-parser-perl liburi-encode-perl libcolor-calc-perl libyaml-syck-perl
+# apt-get install libdatetime-event-recurrence-perl libdatetime-set-perl
 
 use strict;
 use warnings;
-use version; our $VERSION = version->declare('0.8.10');
+use version; our $VERSION = version->declare('0.9.0');
 
 use CGI;
@@ -51,4 +52,38 @@
 $config->{'color-downtime'}{'factor'}     ||=  0.7;
 $config->{'remote-action'}                ||= {};
+$config->{'refresh'}                      ||=  0;
+
+sub hostmapping {
+   my $host = shift;
+
+   return exists $config->{'host-mapping'}{$host} ? $config->{'host-mapping'}{$host} : $host;
+   }
+
+sub downtime {
+   my ($time_change) = @_;
+
+   my $now = time;
+   return sprintf '%.1f', ($now - $time_change) / (60 * 3600);
+   }
+
+sub alertcolor {
+   my ($status, $downtime) = @_;
+
+   my $color = '#0000FF';
+   $color = $STATUS_DB{$status}->{'color'} if exists $STATUS_DB{$status};
+
+   $downtime = $downtime - $config->{'color-downtime'}{'day-min'}; # same color first days
+   $downtime = $config->{'color-downtime'}{'day-max'} if $downtime > $config->{'color-downtime'}{'day-max'}; # max 50 days for color
+   $downtime =  0 if $downtime <  0;
+
+   my $factor = ($downtime * $config->{'color-downtime'}{'factor'}) / $config->{'color-downtime'}{'day-max'};
+   return Color::Calc::color_light_html($color, $factor);
+   }
+
+sub nosbreak {
+   my ($str) = @_;
+   
+   return $str =~ s/\s/\&nbsp;/gr;
+   }
 
 my $log = Nagios::StatusLog->new(
@@ -57,35 +92,26 @@
    );
 
-sub hostmapping {
-   my $host = shift;
-
-   return exists $config->{'host-mapping'}{$host} ? $config->{'host-mapping'}{$host} : $host;
-   }
-
-sub downtime {
-   my ($time_change) = @_;
-
-   my $now = time;
-   return sprintf '%.1f', ($now - $time_change) / (60 * 3600);
-   }
-
-sub alertcolor {
-   my ($status, $downtime) = @_;
-
-   my $color = '#0000FF';
-   $color = $STATUS_DB{$status}->{'color'} if exists $STATUS_DB{$status};
-
-   $downtime = $downtime - $config->{'color-downtime'}{'day-min'}; # same color first days
-   $downtime = $config->{'color-downtime'}{'day-max'} if $downtime > $config->{'color-downtime'}{'day-max'}; # max 50 days for color
-   $downtime =  0 if $downtime <  0;
-
-   my $factor = ($downtime * $config->{'color-downtime'}{'factor'}) / $config->{'color-downtime'}{'day-max'};
-   return Color::Calc::color_light_html($color, $factor);
-   }
-
-sub nosbreak {
-   my ($str) = @_;
-   
-   return $str =~ s/\s/\&nbsp;/gr;
+# refresh configuration
+if (exists $config->{'refreshments'}) {
+   require DateTime::Event::Recurrence;
+   require DateTime::SpanSet;
+
+   my @refreshments;
+   SET:
+   for my $set (@{$config->{'refreshments'}}) {
+      my $start   = DateTime::Event::Recurrence->weekly(days => $set->{'days'}, hours => $set->{'start'});
+      my $end     = DateTime::Event::Recurrence->weekly(days => $set->{'days'}, hours => $set->{'end'});
+      my $spanset = DateTime::SpanSet->from_sets(start_set => $start, end_set => $end);
+      push @refreshments, {refresh => $set->{'refresh'}, spanset => $spanset};
+      }
+
+   my $now = DateTime->now();
+   SET:
+   for my $set (@refreshments) {
+      next SET if not $set->{'spanset'}->contains($now);
+ 
+      $config->{'refresh'} = $set->{'refresh'};
+      last SET;
+      }
    }
 
@@ -145,4 +171,5 @@
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Refresh"      content="$config->{'refresh'}">
  <title>Nagios  Velvice</title>
  <link rel="stylesheet"    type="text/css"  href="$config->{'nagios-server'}{'stylesheets'}/velvice.css">
Index: /trunk/nagios-velvice/velvice.sample.yml
===================================================================
--- /trunk/nagios-velvice/velvice.sample.yml	(revision 321)
+++ /trunk/nagios-velvice/velvice.sample.yml	(revision 322)
@@ -34,2 +34,33 @@
       status: ALL
       style: bold
+
+refreshments:
+   -
+      refresh: 300
+      days:  [ 1 .. 5 ]
+      start: [  9, 13 ]
+      end:   [ 12, 18 ]
+
+   -
+      refresh: 600
+      days:  [ 1 .. 5 ]
+      start: [ 12, 18 ]
+      end:   [ 13, 20 ]
+
+   -
+      refresh: 900
+      days:  [ 1 .. 5 ]
+      start: [ 7, 20 ]
+      end:   [ 9, 24 ]
+
+   -
+      refresh: 900
+      days:  [ 6, 7 ]
+      start: [  7 ]
+      end:   [ 24 ]
+
+   -
+      refresh: 1200
+      days:  [  1 .. 7 ]
+      start: [  0 ]
+      end:   [ 24 ]
