This file is indexed.

/usr/share/perl5/OAR/Monika/monikaCGI.pm is in oar-web-status 2.5.7-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
## This package inherits CGI.pm and adds support for color management

package OAR::Monika::monikaCGI;
use strict;
use File::Basename;
use Sort::Naturally;
#use warnings;
use base qw(CGI);
use Data::Dumper;

## class constructor
sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;
  my $self  = $class->SUPER::new();
  $self->{USED_COLORS} = {};
  $self->{COLOR_POOL}  = [];
  bless ($self, $class);
  return $self;
}

## get the color for a key
sub getColor {
  my $self = shift;
  my $key = shift;
  if (not $self->{USED_COLORS}->{$key}) {
    $self->{USED_COLORS}->{$key} = $self->getColorFromPool($key);
  }
  return $self->{USED_COLORS}->{$key};
}

## set a color for a key
sub setColor {
  my $self = shift;
  my $key = shift;
  my $color = shift;
  $self->{USED_COLORS}->{$key} = $color;
  return 1;
}

## set color pool
sub setColorPool {
  my $self = shift;
  $self->{COLOR_POOL} = shift;
  return 1;
}

## get a color from color pool, and rotate the pool by one.
sub getColorFromPool {
  my $self = shift;
  my $key = shift;
  my $color_pool = $self->{COLOR_POOL};
  my $color = $color_pool->[$key % ($#{$color_pool}+1)];
  #my $color = shift @$color_pool;
  #push @$color_pool,$color;
  return $color;
}

## print a HTML <TD> with a background color corresponding to the text
## given as parameter
sub colorTd {
  my $self = shift;
  my $txt = shift;
  my $width;
  my $href;
  my $title;
  if (@_) {
    $width = shift;
  } else {
    $width = undef;
  }
  if (@_) {
    $href = shift;
  } else {
    $href = undef;
  }
  if (@_) {
    $title = shift;
  } else {
    $title = undef;
  }
  my $txt2;
  if ($href) {
    $txt2 = $self->a({-href => $href,
		      -title => $title
		     },
		     $self->b($txt)
		    );
  } else {
    $txt2 = $self->b($txt);
  }
  return $self->td({
		    -bgcolor => $self->getColor($txt),
		    -width => $width,
		    -align => "center"
		   }, $txt2);
}

# print a HTML <TD> with a background color corresponding to the text
## given as parameter
sub colorjavascriptTd {
  my $self = shift;
  my $txt = shift;
  my $width;
  my $href;
  my $title;
  my $javascript;
  if (@_) {
    $width = shift;
  } else {
    $width = undef;
  }
  if (@_) {
    $javascript = shift;
  } else {
    $javascript = undef;
  }
  if (@_) {
    $href = shift;
  } else {
    $href = undef;
  }
  if (@_) {
    $title = shift;
  } else {
    $title = undef;
  }
  
  my $txt2;
  if ($href) {
    $txt2 = $self->a({-href => $href,
		      -title => $title,
		     },
		     $self->b($txt)
		    );
  } else {
    $txt2 = $self->b($txt);
  }
  if ($javascript) {
      return $self->td({-class => "fixed_td",
		   -bgcolor => $self->getColor($txt),
		    -width => $width,
		    -align => "center",
            -onmouseout => "return nd()",
            -onmouseover => "return overlib('$javascript')"
		   }, $txt2);
  } else {   
      return $self->td({
		    -bgcolor => $self->getColor($txt),
		    -width => $width,
		    -align => "center"
		   }, $txt2);
  }
 }


## debug function: show color settings
sub colorTable {
  my $self = shift;
  my $output = "";
  $output .= $self->start_table({-border => "1", -align => "center"});
  foreach my $key (keys %{$self->{USED_COLORS}}) {
    $output .= $self->start_Tr();
    $output .= $self->td({-bgcolor => $self->{USED_COLORS}->{$key}, -width => "20"},"");
    $output .= $self->td({-align => "center"},$key);
    $output .= $self->end_Tr();
  }
  my $i=0;
  foreach my $color (@{$self->{COLOR_POOL}}) {
    $output .= $self->start_Tr();
    $output .= $self->td({-bgcolor => $color, -width => "20"},"");
    $output .= $self->td({-align => "center"},"Pool ".$i++);
    $output .= $self->end_Tr();

  }
  $output .= $self->end_table();
}

sub nodeReservationTable {
  my $self = shift;
  my $nodes = shift;
  my $nodelist = shift;
  my $output = "";
  my @names;
  if (defined $nodelist) {
    @names = @$nodelist;
  } else {
    @names = keys %$nodes;
  }
  my $is_sorted = 1;
  #@names = sort {$a <=> $b or $a cmp $b} @names or $is_sorted = 0;
  @names = sort {$a <=> $b or Sort::Naturally::ncmp($a,$b)} @names or $is_sorted = 0;
  $output .= $self->start_table({-border=>"1",
				 -align => "center"
				});
  $output .= $self->start_Tr();
  my $i=1;
  ## each nodes get printed in the right order
  foreach my $name (@names) {
#    $output .= $self->start_td({-align => "center",});
#	$output .= $self->start_form({ action => "input_button.htm"});
#	$output .= $self->start_form();
#	$output .= $self->input({
#							type => "button",
#							name => "lien",
#							value => "$name",
#							onclick => "self.location.href = '".$self->self_url(-query=>0)."?node=".$name."'"
#							});
#	$output .= $self->end_form();
#	$output .= $self->end_td({-align => "center",});

    $output .= $self->start_td({-align => "center",
			       });
    #$output .= $self->b($self->small($self->small($self->a({ -href => $self->self_url(-query=>0)."?node=".$name,
    my $cgiName = File::Basename::basename($self->self_url(-query=>0));
    $output .= $self->b($self->small($self->small($self->a({ -href => $cgiName."?node=".$name, -title => "click to see node details" },$$nodes{$name}->displayHTMLname()))));
    $output .= $self->end_td();

    $output .= $self->start_td();
    ## print this node status sub table
    $output .= $$nodes{$name}->htmlTable($self);
    $output .= $self->end_td();
    ## 10 nodes per line
    if ($i++ % OAR::Monika::Conf::myself()->nodes_per_line() == 0) {
      $output .= $self->end_Tr();
      $output .= $self->start_Tr();
    }
  }
  $output .= $self->end_Tr();
  $output .= $self->end_table();
  return $output;
}


## print page head
sub page_head {
  my $self = shift;
  my $title = shift;
  my $output = "";

  $output .= $self->header();
  $output .= $self->start_html(-title => $title,
			       -link => "black",
			       -vlink => "black",
			       -alink => "darkblue"
			      );
}


## that's all
return 1;