Some cosmetic edits
[clearscm.git] / clearadm / lib / ClearadmWeb.pm
index d449473..17ccb6e 100644 (file)
@@ -48,7 +48,7 @@ use strict;
 use base 'Exporter';
 
 use CGI qw (
-  :standard 
+  :standard
    start_a
    end_a
    start_div
@@ -82,7 +82,7 @@ my $clearadm = Clearadm->new;
 our $APPNAME= 'Clearadm';
 our $VERSION  = '$Revision: 1.46 $';
    ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
-  
+
 our @EXPORT = qw (
   autoScale
   displayError
@@ -160,74 +160,74 @@ our @PREDEFINED_MULTIPLIERS = (
 
 sub dbug ($) {
   my ($msg) = @_;
-  
+
   display font ({-class => 'error'}, '<br>DEBUG: '). $msg;
-  
+
   return;
 } # dbug
 
 sub displayError ($) {
   my ($msg) = @_;
-  
+
   display font ({-class => 'error'}, 'Error: ') . $msg;
-  
+
   return
 } # displayError;
 
 sub setField ($;$) {
   my ($field, $label) = @_;
-  
+
   $label ||= 'Unknown';
 
   my $undef = font {-class => 'unknown'}, $label;
-  
+
   return defined $field ? $field : $undef;
 } # setField
 
 sub setFields ($%) {
   my ($label, %rec) = @_;
-  
+
   $rec{$_} = setField ($rec{$_}, $label)
     foreach keys %rec;
-    
+
   return %rec;
 } # setFields;
 
 sub dumpVars (%) {
   my (%vars) = @_;
-  
+
   foreach (keys %vars) {
     dbug "$_: $vars{$_}";
   } # foreach
-  
+
   return;
 } # dumpVars
 
 sub graphError ($) {
   my ($msg) = @_;
-  
+
   use GD;
-  
+
   # Make the image fit the message. It seems that characters are ~ 7px wide.
   my $imageLength = length ($msg) * 7;
-  
+
   my $errorImage = GD::Image->new ($imageLength, 20);
 
   # Allocate some colors
   my $white = $errorImage->colorAllocate (255, 255, 255);
   my $red   = $errorImage->colorAllocate (255, 0, 0);
-  
+
   # Allow the text to shine through
   $errorImage->transparent($white);
   $errorImage->interlaced('true');
 
-  # Now put out the message  
+  # Now put out the message
   $errorImage->string (gdMediumBoldFont, 0, 0, $msg, $red);
 
   # And return it
   print "Content-type: image/png\n\n";
   print $errorImage->png;
-  
+
   # Since we've "returned" the error in the form of an image, there's nothing
   # left for us to do so we can exit
   exit;
@@ -235,29 +235,29 @@ sub graphError ($) {
 
 sub autoScale ($) {
   my ($amount) = @_;
-  
+
   my $kbyte = 1024;
   my $meg   = (1024 * $kbyte);
   my $gig   = (1024 * $meg);
-  
+
   my $size = $amount > $gig
            ? sprintf ('%.2f Gig',   $amount / $gig)
            : $amount > $meg
            ? sprintf ('%.2f Meg',   $amount / $meg)
            : sprintf ('%.2f Kbyte', $amount / $kbyte);
-           
-  return $size;         
+
+  return $size;
 } # autoScale
 
 sub _makeAlertlogSelection ($$) {
   my ($name, $default) = @_;
-  
+
   $default ||= 'All';
 
   my %values;
 
   $values{All} = 'All';
-  
+
   $values{$$_{$name}} = $$_{$name}
     foreach ($clearadm->FindAlertlog);
 
@@ -266,128 +266,128 @@ sub _makeAlertlogSelection ($$) {
     class   => 'dropdown',
     values  => [sort keys %values],
     default => $default,
-  };  
-  
+  };
+
   return $dropdown;
 } # _makeAlertlogSelection
 
 sub _makeRunlogSelection ($$) {
   my ($name, $default) = @_;
-  
+
   $default ||= 'All';
 
   my @values = sort $clearadm->GetUniqueList ('runlog', $name);
-  
+
   unshift @values, 'All';
-  
+
   my %values;
-  
+
   foreach (@values) {
      unless ($_ eq '') {
        $values{$_} = $_;
      } else {
        $values{NULL} = '<NULL>';
-     } #if 
+     } #if
   } # foreach
-  
+
   my $dropdown = popup_menu {
     name    => $name,
     class   => 'dropdown',
     values  => \@values,
     default => $default,
     labels  => \%values,
-  };  
-  
+  };
+
   return $dropdown;
 } # _makeRunlogSelection
 
 sub _makeRunlogSelectionNumeric ($$) {
   my ($name, $default) = @_;
-  
+
   $default ||= 'All';
 
   my @values = sort {$a <=> $b} $clearadm->GetUniqueList ('runlog', $name);
-  
+
   unshift @values, 'All';
-  
+
   my $dropdown = popup_menu {
     name    => $name,
     class   => 'dropdown',
     values  => [@values],
     default => $default,
-  };  
-  
+  };
+
   return $dropdown;
 } # _makeRunlogSelection
 
 sub makeAlertDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
 
   my @values;
 
   push @values, $$_{name}
     foreach ($clearadm->FindAlert);
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name    => 'alert',
     class   => 'dropdown',
     values  => [sort @values],
     default => $default,
-  };  
-  
+  };
+
   return $dropdown;
 } # makeAlertDropdown
 
 sub makeMultiplierDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name    => 'multiplier',
     class   => 'dropdown',
     values  => [sort @PREDEFINED_MULTIPLIERS],
     default => $default,
-  };     
+  };
 
   return $dropdown;
 } # makeMultiplierDropdown
 
 sub makeNoMoreThanDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name    => 'nomorethan',
     class   => 'dropdown',
     values  => [sort @PREDEFINED_NOTMORETHAN],
     default => $default,
-  };     
+  };
 
   return $dropdown;
 } # makeNoMorThanDropdown
+
 sub makeFilesystemDropdown ($;$$$) {
   my ($system, $label, $default, $onchange) = @_;
 
   $label ||= '';
-  
+
   my %filesystems;
-  
+
   foreach ($clearadm->FindFilesystem ($system)) {
     my %filesystem = %{$_};
-    
+
     my $value = "$filesystem{filesystem} ($filesystem{mount})";
 
     $filesystems{$filesystem{filesystem}} = $value;
   } # foreach
-  
+
   my $dropdown .= "$label ";
      $dropdown .= popup_menu {
     name     => 'filesystem',
@@ -397,15 +397,15 @@ sub makeFilesystemDropdown ($;$$$) {
     onChange => ($onchange) ? $onchange : '',
     default  => $default,
   };
-    
-  return span {id => 'filesystems'}, $dropdown;  
+
+  return span {id => 'filesystems'}, $dropdown;
 } # makeFilesystemDropdown
 
 sub makeIntervalDropdown (;$$$) {
   my ($label, $default, $onchange) = @_;
-  
+
   $label ||= '';
-  
+
   my @intervals = (
     'Minute',
     'Hour',
@@ -415,7 +415,7 @@ sub makeIntervalDropdown (;$$$) {
 
   $default = ucfirst lc $default
     if $default;
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name     => 'scaling',
@@ -425,49 +425,49 @@ sub makeIntervalDropdown (;$$$) {
     default  => $default,
     onchange => $onchange,
   };
-   
-   return span {id => 'scaling'}, $dropdown; 
+
+   return span {id => 'scaling'}, $dropdown;
 } # makeIntervalDropdown;
 
 sub makeNotificationDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
 
   my @values;
-  
-  push @values, $$_{name} 
+
+  push @values, $$_{name}
     foreach ($clearadm->FindNotification);
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name    => 'notification',
     class   => 'dropdown',
     values  => [sort @values],
     default => $default,
-  };  
-  
+  };
+
   return $dropdown;
 } # makeNotificationDropdown
 
 sub makeRestartableDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
 
   my @values = (
     'true',
     'false',
   );
-  
+
   my $dropdown  = "$label ";
      $dropdown .= popup_menu {
     name    => 'restartable',
     class   => 'dropdown',
     values  => [@values],
     default => $default,
-  };  
-  
+  };
+
   return $dropdown;
 } # makeRestartableDropdown
 
@@ -475,16 +475,16 @@ sub makeSystemDropdown (;$$$%) {
   my ($label, $default, $onchange, %systems) = @_;
 
   $label ||= '';
-  
+
   foreach ($clearadm->FindSystem) {
     my %system = %{$_};
-    
+
     my $value  = $system{name};
        $value .= $system{alias} ? " ($system{alias})" : '';
 
     $systems{$system{name}} = $value;
   } # foreach
-  
+
   my $systemDropdown .= "$label ";
      $systemDropdown .= popup_menu {
        name     => 'system',
@@ -494,28 +494,28 @@ sub makeSystemDropdown (;$$$%) {
        onchange => ($onchange) ? $onchange : '',
        default  => $default,
     };
-    
+
   return span {id => 'systems'}, $systemDropdown;
 } # makeSystemDropdown
 
 sub makeTaskDropdown (;$$) {
   my ($label, $default) = @_;
-  
+
   $label ||= '';
 
   my @values;
 
   push @values, $$_{name}
     foreach ($clearadm->FindTask);
-  
+
   my $taskDropdown  = "$label ";
      $taskDropdown .= popup_menu {
     name    => 'task',
     class   => 'dropdown',
     values  => [sort @values],
     default => $default,
-  };  
-  
+  };
+
   return $taskDropdown;
 } # makeTaskDropdown
 
@@ -532,11 +532,11 @@ sub makeTimeDropdown ($$$;$$$$$) {
   ) = @_;
 
   $label ||= '';
-    
+
   my @times;
-  
+
   $name ||= lc $label;
-  
+
   push @times, 'Earliest';
 
   if ($table =~ /loadavg/i) {
@@ -545,14 +545,14 @@ sub makeTimeDropdown ($$$;$$$$$) {
   } elsif ($table =~ /filesystem/i) {
     push @times, $$_{timestamp}
       foreach ($clearadm->GetFS ($system, $filesystem, undef, undef, undef, $interval));
-  } # if  
+  } # if
 
   push @times, 'Latest';
-  
+
   unless ($default) {
     $default = $name eq 'start' ? 'Earliest' : 'Latest';
   } # unless
-  
+
   my $timeDropdown = "$label ";
      $timeDropdown .= span {id => $elementID}, popup_menu {
     name    => $name,
@@ -560,8 +560,8 @@ sub makeTimeDropdown ($$$;$$$$$) {
     values  => [@times],
     default => $default,
   };
-  
-  return $timeDropdown;   
+
+  return $timeDropdown;
 } # makeTimeDropdown
 
 sub heading (;$$) {
@@ -572,7 +572,7 @@ sub heading (;$$) {
   } else {
     $title = $APPNAME;
   } # if
-  
+
   display header;
   display start_html {
        -title  => $title,
@@ -589,21 +589,21 @@ sub heading (;$$) {
   }, $title;
 
   return if $type;
-  
+
   my $ieTableWrapStart = '<!--[if gt IE 6]><!--></a><!--<![endif]--><!--'
                        . '[if lt IE 7]><table border="0" cellpadding="0" '
                        . 'cellspacing="0"><tr><td><![endif]-->';
   my $ieTableWrapEnd   = '<!--[if lte IE 6]></td></tr></table></a><![endif]-->';
-            
+
   # Menubar
   display div {id=>'mastheadlogo'}, h1 {class => 'title'}, $APPNAME;
   display start_div {class => 'menu'};
-  
+
   # Home
   display ul li a {href => '/clearadm'}, 'Home';
-  
+
   my @allSystems = $clearadm->FindSystem;
-  
+
   # Systems
   display start_ul;
     display start_li;
@@ -614,7 +614,7 @@ sub heading (;$$) {
             my $sysName  = ucfirst $system{name};
                $sysName .= " ($system{alias})"
                  if $system{alias};
-                 
+
             display li a {
               href => "systemdetails.cgi?system=$system{name}"
             }, ucfirst "&nbsp;$sysName";
@@ -624,7 +624,7 @@ sub heading (;$$) {
         display end_li;
     display end_li;
   display end_ul;
-  
+
   # Filesystems
   display start_ul;
     display start_li;
@@ -635,7 +635,7 @@ sub heading (;$$) {
             my $sysName  = ucfirst $system{name};
                $sysName .= " ($system{alias})"
                  if $system{alias};
-                             
+
             display li a {
               href => "filesystems.cgi?system=$system{name}"
             }, ucfirst "&nbsp;$sysName";
@@ -644,7 +644,7 @@ sub heading (;$$) {
         display $ieTableWrapEnd;
     display end_li;
   display end_ul;
-  
+
   # Servers
   display start_ul;
     display start_li;
@@ -658,7 +658,7 @@ sub heading (;$$) {
         display end_ul;
         display $ieTableWrapEnd;
         display end_li;
-        
+
         display start_li;
         display start_a {href => 'views.cgi'};
         display "<span class='drop'><span>View</span>&raquo;</span>$ieTableWrapStart";
@@ -671,7 +671,7 @@ sub heading (;$$) {
       display $ieTableWrapEnd;
     display end_li;
   display end_ul;
+
   # Vobs
   display start_ul;
     display start_li;
@@ -684,8 +684,8 @@ sub heading (;$$) {
       display end_ul;
       display $ieTableWrapEnd;
     display end_li;
-  display end_ul;  
-  
+  display end_ul;
+
   # Views
   display start_ul;
     display start_li;
@@ -696,7 +696,7 @@ sub heading (;$$) {
       display end_ul;
       display $ieTableWrapEnd;
     display end_li;
-  display end_ul;  
+  display end_ul;
 
   # Configure
   display start_ul;
@@ -710,8 +710,8 @@ sub heading (;$$) {
       display end_ul;
       display $ieTableWrapEnd;
     display end_li;
-  display end_ul;  
-  
+  display end_ul;
+
   # Logs
   display start_ul;
     display start_li;
@@ -722,8 +722,8 @@ sub heading (;$$) {
       display end_ul;
       display $ieTableWrapEnd;
     display end_li;
-  display end_ul;  
-        
+  display end_ul;
+
   # Help
   display start_ul;
     display start_li;
@@ -735,15 +735,15 @@ sub heading (;$$) {
     display end_li;
   display end_ul;
   display end_div;
-  
+
   display start_div {class => 'page'};
-  
+
   return;
 } # heading
 
 sub displayAlert (;$) {
   my ($alert) = @_;
-  
+
   display start_table {cellspacing => 1};
 
   display start_Tr;
@@ -753,15 +753,15 @@ sub displayAlert (;$) {
     display th {class => 'labelCentered'}, 'Who';
     display th {class => 'labelCentered'}, 'Category';
   display end_Tr;
-  
+
   foreach ($clearadm->FindAlert ($alert)) {
     my %alert = %{$_};
-   
+
     $alert{who} = setField $alert{who}, 'System Administrator';
-    
+
     display start_Tr;
       my $areYouSure = "Are you sure you want to delete the $alert{name} alert?";
-                   
+
       my $actions = start_form {
         method => 'post',
         action => 'processalert.cgi',
@@ -782,7 +782,7 @@ sub displayAlert (;$) {
           alt      => 'Delete',
           value    => 'Delete',
           title    => 'Cannot delete predefined alert',
-        };     
+        };
         $actions .= input {
           name     => 'edit',
           disabled => 'true',
@@ -812,10 +812,10 @@ sub displayAlert (;$) {
         };
       } # if
 
-      display end_form;     
+      display end_form;
 
       my $who = $alert{who};
-      
+
       if ($who =~ /^([a-zA-Z0-9._-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})$/) {
         $who = a {href => "mailto:$1\@$2"}, $who;
       } # if
@@ -829,8 +829,8 @@ sub displayAlert (;$) {
     display end_Tr;
   } # foreach
 
-  display end_table; 
-  
+  display end_table;
+
   display p {class => 'center'}, a {
     href => 'processalert.cgi?action=Add',
   }, 'New alert ', img {
@@ -843,18 +843,18 @@ sub displayAlert (;$) {
 
 sub displayAlertlog (%) {
   my (%opts) = @_;
-  
+
   my $optsChanged;
-  
+
   unless (($opts{oldalert}        and $opts{alert}         and
            $opts{oldalert}        eq  $opts{alert})        and
           ($opts{oldsystem}       and $opts{system}        and
            $opts{oldsystem}       eq  $opts{system})       and
           ($opts{oldnotification} and $opts{notification}  and
            $opts{oldnotification} eq  $opts{notification})) {
-    $optsChanged = 1;           
+    $optsChanged = 1;
   } # unless
-  
+
   my $condition;
 
   unless ($opts{id}) {
@@ -881,7 +881,7 @@ sub displayAlertlog (%) {
     $opts{start} = 0;
   } # if
 
-  my $next = $opts{start} + $opts{page} < $total 
+  my $next = $opts{start} + $opts{page} < $total
            ? $opts{start} + $opts{page}
            : $opts{start};
   my $prev = $opts{start} - $opts{page} >= 0
@@ -896,14 +896,14 @@ sub displayAlertlog (%) {
      $opts .= " of $total";
 
   display start_form {
-    method => 'post', 
+    method => 'post',
     action => 'alertlog.cgi'
   };
 
   # Hidden fields to pass along
   display input {name  => 'prev', type  => 'hidden', value => $prev};
   display input {name  => 'next', type  => 'hidden', value => $next};
-  
+
   display input {
     name  => 'oldalert',
     type  => 'hidden',
@@ -942,7 +942,7 @@ sub displayAlertlog (%) {
         disabled => 'disabled',
       };
     } # unless
-  
+
     $caption .= td {align => 'center'}, $opts;
 
     unless ($opts{id}) {
@@ -1013,9 +1013,9 @@ sub displayAlertlog (%) {
       type    => 'button',
       value   => 'Clear All Events',
       onclick => "return AreYouSure('Are you sure you want to delete all alerts?');",
-    }; 
+    };
   display end_Tr;
-  
+
   my $i = $opts{start};
 
   foreach ($clearadm->FindAlertlog (
@@ -1026,10 +1026,10 @@ sub displayAlertlog (%) {
     $opts{page},
     )) {
     my %alertlog = setFields 'N/A', %{$_};
-     
+
     display start_Tr;
       my %system = $clearadm->GetSystem ($alertlog{system});
-    
+
       display td {class => 'dataCentered'}, ++$i;
       display td {class => 'dataCentered'}, a {
         href => "deletealertlog.cgi?alertlogid=$alertlog{id}"
@@ -1059,8 +1059,8 @@ sub displayAlertlog (%) {
 
   display end_form;
 
-  display end_table; 
-  
+  display end_table;
+
   return;
 } # displayAlertlog
 
@@ -1068,7 +1068,7 @@ sub displayFilesystem ($) {
   my ($systemName) = @_;
 
   display start_table {cellspacing => 1, width => '98%'};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Action';
     display th {class => 'labelCentered'}, 'Name';
@@ -1082,16 +1082,16 @@ sub displayFilesystem ($) {
     display th {class => 'labelCentered'}, 'Threshold';
     display th {class => 'labelCentered'}, 'Usage';
   display end_Tr;
-  
+
   foreach ($clearadm->FindSystem ($systemName)) {
     my %system = %{$_};
-  
+
     %system = setFields ('N/A', %system);
 
     my $admin = ($system{email} !~ 'N/A')
               ? a {-href => "mailto:$system{email}"}, $system{admin}
               : $system{admin};
-              
+
     foreach ($clearadm->FindFilesystem ($system{name})) {
       my %filesystem = %{$_};
 
@@ -1101,9 +1101,9 @@ sub displayFilesystem ($) {
       my $used = autoScale $fs{used};
       my $free = autoScale $fs{free};
 
-      # TODO: Note that this percentages does not agree with df output. I'm not 
+      # TODO: Note that this percentages does not agree with df output. I'm not
       # sure why.
-      my $usedPct = $fs{size} == 0 ? 0 
+      my $usedPct = $fs{size} == 0 ? 0
                   : sprintf ('%.0f',
                      (($fs{reserve} + $fs{used}) / $fs{size} * 100));
 
@@ -1112,19 +1112,19 @@ sub displayFilesystem ($) {
                     href => "systemdetails.cgi?system=$system{name}"
                   }, $system{alias}
                 : $system{alias};
-                  
-      my $class         = $usedPct < $filesystem{threshold} 
+
+      my $class         = $usedPct < $filesystem{threshold}
                         ? 'data'
                         : 'dataAlert';
-      my $classRight    = $usedPct < $filesystem{threshold} 
+      my $classRight    = $usedPct < $filesystem{threshold}
                         ? 'dataRight'
                         : 'dataRightAlert';
-      my $classCentered = $usedPct < $filesystem{threshold} 
+      my $classCentered = $usedPct < $filesystem{threshold}
                         ? 'dataCentered'
                         : 'dataCenteredAlert';
       my $classRightTop = $usedPct < $filesystem{threshold}
                         ? 'dataRightTop'
-                        : 'dataRightAlertTop'; 
+                        : 'dataRightAlertTop';
 
       display start_Tr;
         display start_td {class => 'dataCentered'};
@@ -1138,7 +1138,7 @@ sub displayFilesystem ($) {
           method => 'post',
           action => "processfilesystem.cgi",
         };
-        
+
         display input {
           type  => 'hidden',
           name  => 'system',
@@ -1149,7 +1149,7 @@ sub displayFilesystem ($) {
           name  => 'filesystem',
           value => $filesystem{filesystem},
         };
-        
+
         display input {
           name    => 'delete',
           type    => 'image',
@@ -1167,20 +1167,20 @@ sub displayFilesystem ($) {
           value   => 'Edit',
           title   => 'Edit',
         };
-        
+
         if ($filesystem{notification}) {
           display a {
             href => "alertlog.cgi?system=$filesystem{system}"}, img {
             src    => 'alert.png',
             border => 0,
             alt    => 'Alert!',
-            title  => 'This filesystem has alerts', 
+            title  => 'This filesystem has alerts',
           };
-        } # if        
-                
+        } # if
+
         display end_form;
-        
-        display end_td;      
+
+        display end_td;
         display td {class => $class},
           a {-href => "systemdetails.cgi?system=$system{name}"}, $system{name};
         display td {class => $class}, $alias;
@@ -1189,11 +1189,11 @@ sub displayFilesystem ($) {
         display td {class => $class}, $filesystem{mount};
         display td {class => $class}, $filesystem{fstype};
         display td {class => $classCentered}, $filesystem{filesystemHist};
-        display td {class => $classRightTop}, "$used ($usedPct%)<br>", 
+        display td {class => $classRightTop}, "$used ($usedPct%)<br>",
           font {class => 'unknown'}, "$fs{timestamp}";
         display td {class => $classRightTop}, "$filesystem{threshold}%";
         display td {class => $class},
-          a {href => 
+          a {href =>
             "plot.cgi?type=filesystem&system=$system{name}"
           . "&filesystem=$filesystem{filesystem}&scaling=Day&points=7"
           }, img {
@@ -1206,13 +1206,13 @@ sub displayFilesystem ($) {
   } # foreach
 
   display end_table;
-  
+
   return;
 } # displayFilesystem
 
 sub displayNotification (;$) {
   my ($notification) = @_;
-  
+
   display start_table {cellspacing => 1};
 
   display start_Tr;
@@ -1223,14 +1223,14 @@ sub displayNotification (;$) {
     display th {class => 'labelCentered'}, 'Not More Than';
     display th {class => 'labelCentered'}, 'Category';
   display end_Tr;
-  
+
   foreach ($clearadm->FindNotification ($notification)) {
     my %notification= setFields 'N/A', %{$_};
-  
+
     display start_Tr;
     my $areYouSure = "Are you sure you want to delete the $notification{name} "
                    . 'notification?';
-                   
+
     my $actions = start_form {
       method => 'post',
       action => 'processnotification.cgi',
@@ -1241,7 +1241,7 @@ sub displayNotification (;$) {
       type   => 'hidden',
       value  => $notification{name},
     };
-  
+
     if (InArray $notification{name}, @PREDEFINED_NOTIFICATIONS) {
       $actions .= input {
         name     => 'delete',
@@ -1251,7 +1251,7 @@ sub displayNotification (;$) {
         alt      => 'Delete',
         value    => 'Delete',
         title    => 'Cannot delete predefined notification',
-      };     
+      };
       $actions .= input {
         name     => 'edit',
         disabled => 'true',
@@ -1280,8 +1280,8 @@ sub displayNotification (;$) {
         title   => 'Edit',
       };
     } # if
-                
-    display end_form;     
+
+    display end_form;
 
     display td {class => 'dataCentered'}, $actions;
     display td {class => 'data'},         $notification{name};
@@ -1291,15 +1291,15 @@ sub displayNotification (;$) {
     display td {class => 'data'},         $notification{cond};
     display td {class => 'data'},         $notification{nomorethan};
     display td {class => 'data'},
-      (InArray $notification{name}, @PREDEFINED_NOTIFICATIONS) 
+      (InArray $notification{name}, @PREDEFINED_NOTIFICATIONS)
       ? 'Predefined'
       : 'User Defined';
-      
+
     display end_Tr;
   } # foreach
 
   display end_table;
-  
+
   display p {class => 'center'}, a {
     href => 'processnotification.cgi?action=Add',
   }, 'New notification', img {
@@ -1312,9 +1312,9 @@ sub displayNotification (;$) {
 
 sub displayRunlog (%) {
   my (%opts) = @_;
-  
+
   my $optsChanged;
-  
+
   unless (($opts{oldtask}   and $opts{task}    or
            $opts{oldtask}   eq  $opts{task})   and
           ($opts{oldsystem} and $opts{system}  or
@@ -1323,29 +1323,29 @@ sub displayRunlog (%) {
            $opts{oldnot}    eq  $opts{not})    and
           ($opts{oldstatus} and $opts{status}  or
            $opts{oldstatus} eq  $opts{status})) {
-    $optsChanged = 1;           
+    $optsChanged = 1;
   } # unless
-            
-  my $condition;  
+
+  my $condition;
 
   unless ($opts{id}) {
     $condition  = "task like '%";
     $condition .= $opts{task} ? $opts{task} : '';
     $condition .= "%'";
-    
+
     if ($opts{system}) {
       if ($opts{system} eq '<NULL>') {
         $condition .= ' and system is null';
         undef $opts{system}
       } elsif ($opts{system} ne 'All') {
-        $condition .= " and system like '%$opts{system}%'";;        
+        $condition .= " and system like '%$opts{system}%'";;
       } # if
     } # if
 
     if (defined $opts{status}) {
       $condition .= ' and ';
       unless ($opts{not}) {
-        $condition .= "status=$opts{status}";    
+        $condition .= "status=$opts{status}";
       } else {
         $condition .= "status<>$opts{status}";
       } # unless
@@ -1353,13 +1353,13 @@ sub displayRunlog (%) {
   } # unless
 
   my $total = $clearadm->Count ('runlog', $condition);
-  
+
   $opts{start} = $opts{'nextArrow.x'} ? $opts{next} : $opts{prev};
   $opts{start} ||= 0;
   $opts{start} = 0
     if $optsChanged;
-    
-  my $next = $opts{start} + $opts{page} < $total 
+
+  my $next = $opts{start} + $opts{page} < $total
            ? $opts{start} + $opts{page}
            : $opts{start};
   my $prev = $opts{start} - $opts{page} >= 0
@@ -1374,7 +1374,7 @@ sub displayRunlog (%) {
      $opts .= " of $total";
 
   display start_form {
-    method => 'post', 
+    method => 'post',
     action => 'runlog.cgi'
   };
 
@@ -1408,7 +1408,7 @@ sub displayRunlog (%) {
       disabled => 'disabled',
     };
   } # unless
-  
+
   $caption .= td {align => 'center'}, $opts;
 
   unless ($opts{id}) {
@@ -1444,12 +1444,12 @@ sub displayRunlog (%) {
     display th {class => 'labelCentered'}, 'Status';
     display th {class => 'labelCentered'}, 'Message';
   display end_Tr;
-  
+
   display start_Tr;
     $opts{not} ||= 'false';
 
     display start_form {
-      method => 'post', 
+      method => 'post',
       action => 'runlog.cgi'
     };
     display td {
@@ -1482,20 +1482,20 @@ sub displayRunlog (%) {
       type  => 'submit',
       value => 'Update',
     };
-    
+
     display end_form;
   display end_Tr;
 
   my $i = $opts{start};
 
   my $status;
-  
+
   if (defined $opts{status}) {
     if ($opts{status} !~ /all/i) {
       $status = $opts{not} ne 'true' ? $opts{status} : "!$opts{status}";
     } # if
   } # if
-  
+
   foreach ($clearadm->FindRunlog (
     $opts{task},
     $opts{system},
@@ -1505,8 +1505,8 @@ sub displayRunlog (%) {
     $opts{page},
     )) {
     my %runlog = setFields 'N/A', %{$_};
-    my $class         = $runlog{status} == 0 
+
+    my $class         = $runlog{status} == 0
                       ? 'data'
                       : 'dataAlert';
     my $classCentered = $runlog{status} == 0
@@ -1515,7 +1515,7 @@ sub displayRunlog (%) {
     my $classRight    = $runlog{status} == 0
                       ? 'dataRight'
                       : 'dataAlertRight';
-   
+
     display start_Tr;
       display td {class => 'dataCentered'}, ++$i;
       display td {class => 'dataCentered'}, $runlog{id};
@@ -1530,16 +1530,16 @@ sub displayRunlog (%) {
       display td {class => 'dataCentered'}, $runlog{started};
       display td {class => 'dataCentered'}, $runlog{ended};
       display td {class => $classRight},    $runlog{status};
-     
+
       my $message = $runlog{message};
          $message =~ s/\r\n/<br>/g;
-     
+
       display td {class => $class, width => '50%'},         $message;
     display end_Tr;
   } # foreach
 
   display end_table;
-  
+
   return;
 } # displayRunlog
 
@@ -1555,14 +1555,14 @@ sub displaySchedule () {
     display th {class => 'labelCentered'}, 'Frequency';
     display th {class => 'labelCentered'}, 'Category';
   display end_Tr;
-  
+
   foreach ($clearadm->FindSchedule) {
     my %schedule = setFields 'N/A', %{$_};
-  
+
     display start_Tr;
     my $areYouSure = "Are you sure you want to delete the $schedule{name} "
                    . "schedule?";
-                   
+
     my $actions = start_form {
       method => 'post',
       action => 'processschedule.cgi',
@@ -1573,7 +1573,7 @@ sub displaySchedule () {
       type   => 'hidden',
       value  => $schedule{name},
     };
-  
+
     if (InArray $schedule{name}, @PREDEFINED_SCHEDULES) {
       $actions .= input {
         name     => 'delete',
@@ -1583,7 +1583,7 @@ sub displaySchedule () {
         alt      => 'Delete',
         value    => 'Delete',
         title    => 'Cannot delete predefined schedule',
-      };     
+      };
       $actions .= input {
         name     => 'edit',
         disabled => 'true',
@@ -1612,9 +1612,9 @@ sub displaySchedule () {
         title   => 'Edit',
       };
     } # if
-                
-    display end_form; 
-    
+
+    display end_form;
+
     display td {class => 'dataCentered'}, $actions;
     display td {class => 'dataCentered'}, checkbox {
       disabled => 'disabled',
@@ -1629,15 +1629,15 @@ sub displaySchedule () {
     }, $schedule{notification};
     display td {class => 'data'},         $schedule{frequency};
     display td {class => 'data'},
-      (InArray $schedule{name}, @PREDEFINED_SCHEDULES) 
-        ? 'Predefined' 
-        : 'User Defined';    
-      
+      (InArray $schedule{name}, @PREDEFINED_SCHEDULES)
+        ? 'Predefined'
+        : 'User Defined';
+
     display end_Tr;
   } # foreach
 
   display end_table;
-  
+
   display p {class => 'center'}, a {
     href => 'processschedule.cgi?action=Add',
   }, 'New schedule', img {
@@ -1650,17 +1650,17 @@ sub displaySchedule () {
 
 sub displaySystem ($) {
   my ($systemName) = @_;
-    
+
   my %system = $clearadm->GetSystem ($systemName);
-  
+
   unless (%system) {
     displayError "Nothing known about system $systemName";
     return;
   } # unless
-  
+
   my $lastheardfromClass = 'dataCentered';
   my $lastheardfromData  = $system{lastheardfrom};
-  
+
   my %load = $clearadm->GetLatestLoadavg ($systemName);
 
   unless ($clearadm->SystemAlive (%system)) {
@@ -1676,18 +1676,18 @@ sub displaySystem ($) {
   my $admin = ($system{email})
             ? a {-href => "mailto:$system{email}"}, $system{admin}
             : $system{admin};
-                    
+
   $system{alias}  = setField $system{alias},  'N/A';
   $system{region} = setField $system{region}, 'N/A';
 
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     my $areYouSure = 'Are you sure you want to delete this system?\n'
                    . "Doing so will remove all records related to $system{name}"
                    . '\nincluding filesystem records and history as well as '
                    . 'loadavg history.';
-                   
+
     my $actions = start_form {
       method => 'post',
       action => 'processsystem.cgi',
@@ -1698,7 +1698,7 @@ sub displaySystem ($) {
       type   => 'hidden',
       value  => $system{name},
     };
-  
+
     $actions .= input {
       name    => 'delete',
       type    => 'image',
@@ -1719,18 +1719,18 @@ sub displaySystem ($) {
     $actions .= checkbox {
       disabled => 'disabled',
       checked  => $system{active} eq 'true' ? 1 : 0,
-    };    
-    
+    };
+
     if ($system{notification}) {
       $actions .= a {
         href => "alertlog.cgi?system=$system{name}"}, img {
         src    => 'alert.png',
         border => 0,
         alt    => 'Alert!',
-        title  => 'This system has alerts', 
+        title  => 'This system has alerts',
       };
     } # if
-                
+
     display th {class => 'label'},                      "$actions Name:";
     display end_form;
     display td {class => 'dataCentered', colspan => 2}, $system{name};
@@ -1741,12 +1741,12 @@ sub displaySystem ($) {
     display th {class => 'label', colspan => 2},        'Type:';
     display td {class => 'dataCentered'},               $system{type};
   display end_Tr;
-  
+
   display start_Tr;
     display th {class => 'label'},               'OS Version:';
-    display td {class => 'data', colspan => 10}, $system{os}; 
+    display td {class => 'data', colspan => 10}, $system{os};
   display end_Tr;
-  
+
   display start_Tr;
     display th {class => 'label'}, 'Last Contacted:';
     display td {
@@ -1762,23 +1762,23 @@ sub displaySystem ($) {
     display td {class => 'dataCentered'}, $system{loadavgHist};
     display th {class => 'label'},        'Load Avg:';
     display td {class => 'data'},
-      a {href => 
+      a {href =>
         "plot.cgi?type=loadavg&system=$system{name}&scaling=Hour&points=24"
         }, img {
           src    => "plotloadavg.cgi?system=$system{name}&tiny=1",
           border => 0,
       };
-    
+
   my $description = $system{description};
   $description =~ s/\r\n/<br>/g;
-   
+
   display start_Tr;
     display th {class => 'label'},               'Description:';
-    display td {class => 'data', colSpan => 10}, $description; 
+    display td {class => 'data', colSpan => 10}, $description;
   display end_Tr;
-  
+
   display end_table;
-  
+
   display p {class => 'center'}, a {
     href => 'processsystem.cgi?action=Add',
   }, 'New system', img {
@@ -1786,11 +1786,11 @@ sub displaySystem ($) {
     border => 0,
   };
 
-  display h1 {class => 'center'}, 
+  display h1 {class => 'center'},
     'Filesystem Details: ' . ucfirst $system{name};
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Action';
     display th {class => 'labelCentered'}, 'Filesystem';
@@ -1803,32 +1803,32 @@ sub displaySystem ($) {
     display th {class => 'labelCentered'}, 'Threshold';
     display th {class => 'labelCentered'}, 'History';
     display th {class => 'labelCentered'}, 'Usage';
-  display end_Tr;  
-  
+  display end_Tr;
+
   foreach ($clearadm->FindFilesystem ($system{name})) {
     my %filesystem = %{$_};
-    
+
     my %fs = $clearadm->GetLatestFS (
-      $filesystem{system}, 
+      $filesystem{system},
       $filesystem{filesystem}
     );
-    
+
     my $size = autoScale $fs{size};
     my $used = autoScale $fs{used};
-    my $free = autoScale $fs{free};  
+    my $free = autoScale $fs{free};
 
-    # TODO: Note that this percentages does not agree with df output. I'm not 
+    # TODO: Note that this percentages does not agree with df output. I'm not
     # sure why.
-    my $usedPct = $fs{size} == 0 ? 0 
+    my $usedPct = $fs{size} == 0 ? 0
                 : sprintf ('%.0f',
                    (($fs{reserve} + $fs{used}) / $fs{size} * 100));
-    
-    my $class         = $usedPct < $filesystem{threshold} 
+
+    my $class         = $usedPct < $filesystem{threshold}
                       ? 'data'
                       : 'dataAlert';
     my $classCentered = $class . 'Centered';
     my $classRight    = $class . 'Right';
-    
+
     display start_Tr;
         display start_td {class => 'data'};
 
@@ -1841,7 +1841,7 @@ sub displaySystem ($) {
           method => 'post',
           action => 'processfilesystem.cgi',
         };
-        
+
         display input {
           type  => 'hidden',
           name  => 'system',
@@ -1852,7 +1852,7 @@ sub displaySystem ($) {
           name  => 'filesystem',
           value => $filesystem{filesystem},
         };
-        
+
         display input {
           name    => 'delete',
           type    => 'image',
@@ -1870,18 +1870,18 @@ sub displaySystem ($) {
           value   => 'Edit',
           title   => 'Edit',
         };
-        
+
         if ($filesystem{notification}) {
           display a {
             href => "alertlog.cgi?system=$filesystem{system}"}, img {
             src    => 'alert.png',
             border => 0,
             alt    => 'Alert!',
-            title  => 'This filesystem has alerts', 
+            title  => 'This filesystem has alerts',
           };
-        } # if        
+        } # if
 
-        display end_form;    
+        display end_form;
       display td {class => $class},         $filesystem{filesystem};
       display td {class => $classCentered}, $filesystem{fstype};
       display td {class => $class},         $filesystem{mount};
@@ -1891,8 +1891,8 @@ sub displaySystem ($) {
       display td {class => $classRight},    "$usedPct%";
       display td {class => $classRight},    "$filesystem{threshold}%";
       display td {class => $classCentered}, $filesystem{filesystemHist};
-      display td {class => $classCentered},        
-        a {href => 
+      display td {class => $classCentered},
+        a {href =>
           "plot.cgi?type=filesystem&system=$system{name}"
         . "&filesystem=$filesystem{filesystem}"
         . "&scaling=Day&points=7"
@@ -1906,13 +1906,13 @@ sub displaySystem ($) {
   } # foreach
 
   display end_table;
-  
+
   return;
 } # displaySystem
 
 sub displayTask (;$) {
   my ($task) = @_;
-  
+
   display start_table {cellspacing => 1, width => '98%'};
 
   display start_Tr;
@@ -1924,16 +1924,16 @@ sub displayTask (;$) {
     display th {class => 'labelCentered'}, 'Restartable';
     display th {class => 'labelCentered'}, 'Category';
   display end_Tr;
-  
+
   foreach ($clearadm->FindTask ($task)) {
     my %task = %{$_};
-    
+
     $task{system} = 'All Systems'
       unless $task{system};
-   
+
     display start_Tr;
       my $areYouSure = "Are you sure you want to delete the $task{name} task?";
-                   
+
       my $actions = start_form {
         method => 'post',
         action => 'processtask.cgi',
@@ -1954,7 +1954,7 @@ sub displayTask (;$) {
           alt      => 'Delete',
           value    => 'Delete',
           title    => 'Cannot delete predefined task',
-        };     
+        };
         $actions .= input {
           name     => 'edit',
           disabled => 'true',
@@ -1984,34 +1984,34 @@ sub displayTask (;$) {
         };
       } # if
 
-      display end_form;     
+      display end_form;
 
       display td {class => 'dataCentered'}, $actions;
       display td {class => 'data'},         $task{name};
-      display td {class => 'data'},         $task{system};      
+      display td {class => 'data'},         $task{system};
       display td {class => 'data'},         $task{description};
       display td {class => 'data'},         $task{command};
       display td {class => 'dataCentered'}, $task{restartable};
-      display td {class => 'data'},         
+      display td {class => 'data'},
         (InArray $task{name}, @PREDEFINED_TASKS) ? 'Predefined' : 'User Defined';
     display end_Tr;
   } # foreach
 
-  display end_table; 
-  
+  display end_table;
+
   display p {class => 'center'}, a {
     href => 'processtask.cgi?action=Add',
   }, 'New task', img {
     src    => 'add.png',
     border => 0,
   };
-  
+
   return;
 } # DisplayAlerts
 
 sub editAlert (;$) {
   my ($alert) = @_;
-  
+
   display start_form (
     -method   => 'post',
     -action   => 'processalert.cgi',
@@ -2022,10 +2022,10 @@ sub editAlert (;$) {
 
   if ($alert) {
     %alert = $clearadm->GetAlert ($alert);
-  
+
     return
-      unless %alert;      
-      
+      unless %alert;
+
     display input {
       name  => 'oldname',
       type  => 'hidden',
@@ -2034,21 +2034,21 @@ sub editAlert (;$) {
   } else {
     $alert= '';
   } # if
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
     value => 'Post',
   };
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Name';
     display th {class => 'labelCentered'}, 'Type';
     display th {class => 'labelCentered'}, 'Who';
   display end_Tr;
-  
+
   display start_Tr;
     display td {
       class => 'data',
@@ -2080,26 +2080,26 @@ sub editAlert (;$) {
     };
   display end_Tr;
   display end_table;
-  
+
   display '<center>';
   display p submit ({value => $alert ? 'Update' : 'Add'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editAlert
 
 sub editFilesystem ($$) {
   my ($system, $filesystem) = @_;
-  
+
   display start_form (
     -method => 'post',
     -action => 'processfilesystem.cgi',
   );
 
   display start_table {width => '800px', cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Filesystem';
     display th {class => 'labelCentered'}, 'Type';
@@ -2110,11 +2110,11 @@ sub editFilesystem ($$) {
     display th {class => 'labelCentered'}, 'Used %';
     display th {class => 'labelCentered'}, 'History';
     display th {class => 'labelCentered'}, 'Threshold';
-  display end_Tr;  
-  
+  display end_Tr;
+
   my %filesystem = $clearadm->GetFilesystem ($system, $filesystem);
   my %fs         = $clearadm->GetLatestFS   ($system, $filesystem);
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
@@ -2124,13 +2124,13 @@ sub editFilesystem ($$) {
     name  => 'system',
     type  => 'hidden',
     value => $filesystem{system},
-  };  
+  };
   display input {
     name  => 'filesystem',
     type  => 'hidden',
     value => $filesystem{filesystem},
-  } ; 
-  
+  } ;
+
   my $size = autoScale $fs{size};
   my $used = autoScale $fs{used};
   my $free = autoScale $fs{free};
@@ -2142,11 +2142,11 @@ sub editFilesystem ($$) {
     display td {class => 'dataRight'},    $size;
     display td {class => 'dataRight'},    $used;
     display td {class => 'dataRight'},    $free;
-    # TODO: Note that this percentages does not agree with df output. I'm not 
+    # TODO: Note that this percentages does not agree with df output. I'm not
     # sure why.
     display td {class => 'dataCentered'},
       sprintf ('%.0f%%', (($fs{reserve} + $fs{used}) / $fs{size} * 100));
-      
+
     my $historyDropdown = popup_menu {
       name    => 'filesystemHist',
       class   => 'dropdown',
@@ -2166,34 +2166,34 @@ sub editFilesystem ($$) {
       ],
       default => $system ? $filesystem{filesystemHist} : '6 months',
     };
-        
+
     display td {
       class => 'dataRight',
-    }, $historyDropdown; 
-  
+    }, $historyDropdown;
+
     my $thresholdDropdown = popup_menu {
       name    => 'threshold',
       class   => 'dropdown',
       values  => [1 .. 100],
       default => $filesystem{threshold},
-    };        
+    };
     display td {class => 'dataCentered'}, $thresholdDropdown . '%';
   display end_Tr;
-  
-  display end_table; 
-  
+
+  display end_table;
+
   display '<center>';
   display p submit ({value => 'Update'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editFilesytem
 
 sub editNotification (;$) {
   my ($notification) = @_;
-  
+
   display start_form (
     -method   => 'post',
     -action   => 'processnotification.cgi',
@@ -2204,10 +2204,10 @@ sub editNotification (;$) {
 
   if ($notification) {
     %notification = $clearadm->GetNotification ($notification);
-  
+
     return
-      unless %notification;      
-      
+      unless %notification;
+
     display input {
       name  => 'oldname',
       type  => 'hidden',
@@ -2216,22 +2216,22 @@ sub editNotification (;$) {
   } else {
     $notification = '';
   } # if
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
     value => 'Post',
   };
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Name';
     display th {class => 'labelCentered'}, 'Alert';
     display th {class => 'labelCentered'}, 'Condition';
     display th {class => 'labelCentered'}, 'Not More Than';
   display end_Tr;
-  
+
   display start_Tr;
     display td {
       class => 'data',
@@ -2243,13 +2243,13 @@ sub editNotification (;$) {
       type      => 'text',
       value     => $notification ? $notification{name} : '',
     };
-    
+
     display td {
       class => 'dataCentered',
-    }, makeAlertDropdown undef, $notification{alert} 
+    }, makeAlertDropdown undef, $notification{alert}
        ? $notification{alert}
        : 'Email admin';
-    
+
     display td {
       class => 'data',
     }, input {
@@ -2263,22 +2263,22 @@ sub editNotification (;$) {
     display td {
       class => 'dataCentered',
     }, makeNoMoreThanDropdown undef, $notification{nomorethan};
-    
+
   display end_Tr;
   display end_table;
-  
+
   display '<center>';
   display p submit ({value => $notification ? 'Update' : 'Add'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editNotification
 
 sub editSchedule (;$) {
   my ($schedule) = @_;
-  
+
   display start_form (
     -method   => 'post',
     -action   => 'processschedule.cgi',
@@ -2289,10 +2289,10 @@ sub editSchedule (;$) {
 
   if ($schedule) {
     %schedule = $clearadm->GetSchedule ($schedule);
-  
+
     return
-      unless %schedule;      
-      
+      unless %schedule;
+
     display input {
       name  => 'oldname',
       type  => 'hidden',
@@ -2301,15 +2301,15 @@ sub editSchedule (;$) {
   } else {
     $schedule = '';
   } # if
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
     value => 'Post',
   };
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Active';
     display th {class => 'labelCentered'}, 'Name';
@@ -2317,7 +2317,7 @@ sub editSchedule (;$) {
     display th {class => 'labelCentered'}, 'Notification';
     display th {class => 'labelCentered'}, 'Frequency';
   display end_Tr;
-  
+
   display start_Tr;
     display td {
       class => 'dataCentered',
@@ -2339,21 +2339,21 @@ sub editSchedule (;$) {
     };
     display td {
       class => 'dataCentered',
-    }, makeTaskDropdown undef, $schedule{task}; 
+    }, makeTaskDropdown undef, $schedule{task};
     display td {
       class => 'dataCentered',
-    }, makeNotificationDropdown undef, $schedule{notification}; 
-    
+    }, makeNotificationDropdown undef, $schedule{notification};
+
     my $nbr        = 5;
     my $multiplier = 'minutes';
-    
+
     if ($schedule{frequency} =~ /(\d+)\s(\S+)/ ) {
       $nbr        = $1;
       $multiplier = $2;
-      
+
       $multiplier .= 's' if $nbr == 1;
     } # if
-        
+
     display td {
       class => 'data',
     }, input {
@@ -2363,25 +2363,25 @@ sub editSchedule (;$) {
       size      => 1,
       type      => 'text',
       value     => $nbr,
-    }, 
+    },
       ' ',
       makeMultiplierDropdown undef, $multiplier;
-    
+
   display end_Tr;
   display end_table;
-  
+
   display '<center>';
   display p submit ({value => $schedule ? 'Update' : 'Add'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editSchedule
 
 sub editSystem (;$) {
   my ($system) = @_;
-  
+
   display start_form (
     -method   => 'post',
     -action   => 'processsystem.cgi',
@@ -2389,13 +2389,13 @@ sub editSystem (;$) {
   );
 
   my %system;
-  
+
   if ($system) {
     %system = $clearadm->GetSystem ($system);
-  
+
     return
       unless %system;
-      
+
     display input {
       name  => 'name',
       type  => 'hidden',
@@ -2404,15 +2404,15 @@ sub editSystem (;$) {
   } else {
     $system = '';
   } # if
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
     value => 'Post',
   };
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'label'}, checkbox ({
       name    => 'active',
@@ -2420,7 +2420,7 @@ sub editSystem (;$) {
       checked => $system{active} eq 'false' ? 0 : 1,
       label   => '',
     }) . ' Name: ';
-    
+
     if ($system) {
       display td {class => 'data'},  $system{name};
     } else {
@@ -2434,7 +2434,7 @@ sub editSystem (;$) {
         type      => 'text',
       };
     } # if
-    
+
     display th {class => 'label'}, 'Alias:';
     display td {
       class => 'data',
@@ -2456,24 +2456,24 @@ sub editSystem (;$) {
       name      => 'port',
       size      => 4,
       type      => 'text',
-      value     => $system 
+      value     => $system
                  ? $system{port}
                  : $Clearadm::CLEAROPTS{CLEARADM_PORT},
     };
-    
+
     my $systemTypeDropdown = popup_menu {
       name    => 'type',
       class   => 'dropdown',
       values  => ['Unix', 'Linux', 'Windows'],
       default => $system ? $system{type} : 'Linux',
     };
-    
+
     display th {class => 'label'}, 'Type:';
     display td {
       class   => 'dataRight',
     },  $systemTypeDropdown;
   display end_Tr;
-  
+
   display start_Tr;
     display th {class => 'label'}, 'Admin:';
     display td {
@@ -2507,11 +2507,11 @@ sub editSystem (;$) {
       name      => 'loadavgThreshold',
       size      => 3,
       type      => 'text',
-      value     => $system 
+      value     => $system
                  ? $system{loadavgThreshold}
                  : $Clearadm::CLEAROPTS{CLEARADM_LOADAVG_THRESHOLD},
     };
-        
+
     my $historyDropdown = popup_menu {
       name    => 'loadavgHist',
       class   => 'dropdown',
@@ -2531,15 +2531,15 @@ sub editSystem (;$) {
       ],
       default => $system ? $system{loadavgHist} : '6 months',
     };
-        
+
     display th {class => 'label'}, 'History:';
     display td {
       class => 'dataRight',
-    }, $historyDropdown; 
-    
+    }, $historyDropdown;
+
   my $description = $system ? $system{description} : '';
      $description =~ s/\r\n/<br>/g;
-     
+
   display start_Tr;
     display th {class => 'label'}, 'Description:';
     display td {
@@ -2554,19 +2554,19 @@ sub editSystem (;$) {
     };
   display end_Tr;
   display end_table;
-  
+
   display '<center>';
   display p submit ({value => $system ? 'Update' : 'Add'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editSystem
 
 sub editTask (;$) {
   my ($task) = @_;
-  
+
   display start_form (
     -method   => 'post',
     -action   => 'processtask.cgi',
@@ -2577,10 +2577,10 @@ sub editTask (;$) {
 
   if ($task) {
     %task = $clearadm->GetTask ($task);
-  
+
     return
       unless %task;
-      
+
     display input {
       name  => 'oldname',
       type  => 'hidden',
@@ -2589,15 +2589,15 @@ sub editTask (;$) {
   } else {
     $task = '';
   } # if
-  
+
   display input {
     name  => 'action',
     type  => 'hidden',
     value => 'Post',
   };
-  
+
   display start_table {cellspacing => 1};
-  
+
   display start_Tr;
     display th {class => 'labelCentered'}, 'Name';
     display th {class => 'labelCentered'}, 'System';
@@ -2605,7 +2605,7 @@ sub editTask (;$) {
     display th {class => 'labelCentered'}, 'Command';
     display th {class => 'labelCentered'}, 'Restartable';
   display end_Tr;
-  
+
   display start_Tr;
     display td {
       class => 'data',
@@ -2625,8 +2625,8 @@ sub editTask (;$) {
         'Localhost'   => 'Localhost',
       ),
     );
-        
-    display td {class => 'data'}, $systemDropdown;      
+
+    display td {class => 'data'}, $systemDropdown;
 
     display td {
       class => 'data',
@@ -2638,7 +2638,7 @@ sub editTask (;$) {
       type      => 'text',
       value     => $task ? $task{description} : '',
     };
-    
+
     display td {
       class => 'data',
     }, input {
@@ -2653,50 +2653,50 @@ sub editTask (;$) {
     display td {
       class => 'dataCentered',
     }, makeRestartableDropdown undef, $task{restartable};
-    
+
   display end_Tr;
   display end_table;
-  
+
   display '<center>';
   display p submit ({value => $task ? 'Update' : 'Add'}),  reset;
   display '</center>';
-  
+
   display end_form;
-  
+
   return;
 } # editTask
 
 sub footing () {
   my $clearscm = a {-href => 'http://clearscm.com'}, 'ClearSCM, Inc.';
-  
+
   # Figure out which script by using CLEARADM_BASE.
-  my $script = basename (url {-absolute => 1}); 
+  my $script = basename (url {-absolute => 1});
      $script = 'index.cgi'
        if $script eq 'clearadm';
 
   my $scriptFullPath = "$Clearadm::CLEAROPTS{CLEARADM_BASE}/$script";
-  
-  my ($year, $mon, $mday, $hour, $min, $sec) = 
+
+  my ($year, $mon, $mday, $hour, $min, $sec) =
     ymdhms ((stat ($scriptFullPath))[9]);
 
   my $dateModified = "$mon/$mday/$year @ $hour:$min";
-  
+
   $script = a {
     -href => "http://clearscm.com/php/scm_man.php?file=clearadm/$script"
   }, $script;
-  
+
   display end_div;
-  
+
   display start_div {-class => 'copyright'};
     display "$script: Last modified: $dateModified";
     display br "Copyright &copy; $year, $clearscm - All rights reserved";
   display end_div;
-  
+
   print end_html;
-  
+
   return;
 } # footing
-    
+
 1;
 
 =pod
@@ -2725,13 +2725,13 @@ L<GD>
 
 =head2 ClearSCM Perl Modules
 
-=begin man 
+=begin man
 
  Clearadm
  DateUtils
  Display
  Utils
+
 =end man
 
 =begin html