#!/usr/bin/perl -wT -I. use CGI; use Tinderbox3::Header; use Tinderbox3::DB; use Tinderbox3::Login; use strict; # # Init # my $p = new CGI; my $dbh = get_dbh(); my ($login, $cookie) = check_session($p, $dbh); my $tree = $p->param('tree') || ""; # For edit_machine my $machine_id = Tinderbox3::DB::update_machine_action($p, $dbh, $login); # Get patch from DB my $machine_info = $dbh->selectrow_arrayref("SELECT tree_name, machine_name, os, os_version, compiler, clobber, commands, visible FROM tbox_machine WHERE machine_id = ?", undef, $machine_id); if (!defined($machine_info)) { die "Could not get machine!"; } my ($machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible); ($tree, $machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible) = @{$machine_info}; my %machine_config; my $sth = $dbh->prepare("SELECT name, value FROM tbox_machine_config WHERE machine_id = ? ORDER BY name"); $sth->execute($machine_id); while (my $row = $sth->fetchrow_arrayref) { $machine_config{$row->[0]} = $row->[1]; } header($p, $login, $cookie, "Edit Machine $machine_name", $tree, $machine_id, $machine_name); # # Edit patch form # print < @{[$p->hidden(-name=>'tree', -default=>$tree)]} @{[$p->hidden(-name=>'machine_id', -default=>$machine_id)]}
Machine Name:@{[$p->escapeHTML($machine_name)]}
OS:@{[$p->escapeHTML("$os $os_version")]}
Compiler:@{[$p->escapeHTML($compiler)]}
Clobber:@{[$clobber ? 'Clobber' : 'Depend']}
Commands@{[$p->textfield(-name=>'commands', -default=>$commands)]}
Visible:
.mozconfig (set to blank to use default):
@{[$p->textarea(-name=>'machine_config0_val', -default=>$machine_config{mozconfig}, -rows=>5, -columns=>100)]}
EOM print "

Machine Config:
"; print "(Empty a line to use default for tree)
"; print "\n"; my $config_num = 1; foreach my $var (sort keys %machine_config) { my $value = $machine_config{$var}; if ($var ne "mozconfig") { print ""; print "\n"; $config_num++; } } foreach my $i ($config_num..($config_num+2)) { print ""; print "\n"; } print "
VarValue
", $p->textfield(-name=>"machine_config$config_num", -default=>$var, -override=>1), "", $p->textfield(-name=>"machine_config${config_num}_val", -default=>$value, -override=>1), "
", $p->textfield(-name=>"machine_config$i", -override=>1), "", $p->textfield(-name=>"machine_config${i}_val", -override=>1), "

\n"; if (!$login) { print login_fields(); } print <
@{[$p->hidden(-name => 'tree', -default => $tree, -override => 1)]}@{[$p->hidden(-name => 'action', -default => 'delete_machine', -override => 1)]}@{[$p->hidden(-name => 'machine_id', -default => $machine_id, -override => 1)]}
EOM footer($p); $dbh->disconnect;