1 package HTMLProjectCreator
;
3 # ************************************************************
4 # Description : An HTML project creator to display all settings
5 # Author : Justin Michel & Chad Elliott
6 # Create Date : 8/25/2003
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
19 @ISA = qw(XMLProjectBase ProjectCreator);
21 # ************************************************************
23 # ************************************************************
25 my $style_indent = .5;
27 # ************************************************************
29 # ************************************************************
35 return lc($_[1]) cmp lc($_[2]);
40 my($self, $hash, $nodes, $level) = @_;
42 foreach my $key (sort keys %$hash) {
43 push(@
$nodes, [$level, $key]);
44 $self->label_nodes($$hash{$key}, $nodes, $level + 1);
50 my($self, $hash, $current, $count) = @_;
52 foreach my $key (keys %$hash) {
53 $self->count_levels($$hash{$key}, $current + 1, $count);
55 $$count = $current if ($current > $$count);
60 my($self, $name) = @_;
63 if ($name eq 'inheritance_nodes') {
64 ## Get the nodes with numeric labels for the level
66 $self->label_nodes($self->get_inheritance_tree(), \
@nodes, 0);
68 ## Push each node onto the value array
70 for(my $i = 0; $i <= $#nodes; ++$i) {
71 my $file = $nodes[$i]->[1];
72 my $dir = $self->mpc_dirname($file);
73 my $base = $self->mpc_basename($file);
75 ## Relative paths do not work at all in a web browser
76 $file = $base if ($dir eq '.');
78 my $path = ($base eq $file ?
$self->getcwd() . '/' : '');
82 ## If this is the first node, then replace the base filename
83 ## with the actual project name.
84 $name = $self->project_name();
87 ## This is a base project, so we use the basename and
88 ## remove the file extension.
90 $name =~ s/\.[^\.]+$//;
93 ## Create the div and a tags.
94 push(@
$value, '<a href="file://' . $path . $file .
95 '" onClick="return popup(this, \'Project File\')" ' .
97 '<div class="tree' . $nodes[$i]->[0] . '">' .
98 $name . '</div></a>');
101 elsif ($name eq 'tree_styles') {
102 ## Count the number of levels deep the inheritance goes
104 $self->count_levels($self->get_inheritance_tree(), 0, \
$count);
109 my $inc = ($count ne 0 ?
int(($max - $start) / $count) : $max);
111 ## Push each tree style onto the value array
113 for(my $i = 0; $i < $count; ++$i) {
114 push(@
$value, ".tree$i { background-color: #" .
115 sprintf("%02x%02x%02x", 0, $start, $start) . ';' .
116 ($margin != 0 ?
" margin-left: $margin" . 'in;' : '') .
119 $margin += $style_indent;
127 sub project_file_extension
{