|
From: <jas...@us...> - 2003-04-27 00:46:43
|
Update of /cvsroot/genex/genex-server/Mason/workspace
In directory sc8-pr-cvs1:/tmp/cvs-serv10973
Added Files:
sample-protocols.html.in physicalbioassay-insert.html.in
Log Message:
new
--- NEW FILE: sample-protocols.html.in ---
<h1 align="center"><% $name %></h1>
<form action="<% $action %>"
method="post" enctype="multipart/form-data">
<div align="center">
% if ($error) {
<h2><% $data %></h2>
% } elsif ($submit) {
<h2><% $data %></h2>
% } elsif ($sample_fk) {
<h2>Associating Protocol Application Events with Sample <% $sample_name %></h2>
<table bgcolor="#D8E4F7" width="444" border="1">
<theader>
<th colspan="100"><b>Protocol Application Entries</b></th>
</theader>
<& comps/objs2table.mason, objects=>\@protocol_app_dbs,
check=>1, check_header=>'Include', check_name=>'include_protocol'
&>
</table>
<input type="submit" name="submit"
value="Add Protocols to Sample" size="33">
<& comps/hiddenlist.mason, name=>'debug', value=>$debug &>
<& comps/hiddenlist.mason, name=>'sample_fk', value=>$sample_fk &>
<hr noshade size=5>
% } else {
<h2>Choose a Sample</h2>
<p>In order to associate <b>Protocol Applications</b> with
a <b>Sample</b>, your must first choose the <b>Sample</b>
entry which is being applied</p>
<p>Then you will have the opportunity to associate the
<b>Protocol Applications</b> events events for this
<b>Sample</b></p>
<& comps/fkey-menu.mason,
class=>'Sample',
script=>'sample-insert.html',
cgi_param_name=>'sample_fk',
array_ref=>\@samples,
entry_name=>$cur_class &>
<hr noshade size=5>
<input type="submit" name="sample"
value="Choose Sample" size="33">
<& comps/hiddenlist.mason, name=>'debug', value=>$debug &>
<hr noshade size=5>
% }
</div>
</form>
<%args>
$debug => 0
$submit => ''
$sample => ''
$sample_fk => ''
$include_protocol => ''
</%args>
<%attr>
action=>"$Bio::Genex::Config->{GENEX_WORKSPACE_URL}/sample-protocols.html"
name=>'GeneX DB Sample Protocols Page'
path=>"$Bio::Genex::Config->{GENEX_WORKSPACE_URL}/sample-protocols.html"
</%attr>
<%once>
use lib qw(%%GENEX_EXTRALIBS%%);
use Bio::Genex;
use Bio::Genex::Config;
use Bio::Genex::Sample;
use Bio::Genex::ProtocolApplication;
use Bio::Genex::ProtocolApplicationLink;
use Bio::Genex::Protocol;
# use Apache::DB ();
</%once>
<%init>;
my $name = $m->current_comp->attr('name');
my $path = $m->current_comp->attr('path');
my $action = $m->current_comp->attr('action');
my $cur_class = 'Sample';
my $other_class = 'ProtocolStepApplication';
# Apache::DB->init;
# Apache::DB->handler;
my $no_type = 'NONE';
my $data = '';
my $error;
my @samples;
my @protocol_app_dbs;
my $sample_name;
my $sample_db;
if ($sample) {
$sample_db = Bio::Genex::Sample->new(dbh=>$dbh,id=>$sample_fk);
$sample_name = $sample_db->name;
@protocol_app_dbs = Bio::Genex::ProtocolApplication->get_all_objects($dbh);
} elsif ($submit) {
my @pks;
my @protocol_pks = ref($include_protocol) eq 'ARRAY' ? @{$include_protocol}
: $include_protocol;
foreach my $proto_pk (@protocol_pks) {
my $proto_db =
Bio::Genex::ProtocolApplicationLink->new(proto_app_fk=>$proto_pk,
other_fk=>$sample_fk,
);
my $pk = $proto_db->insert_db($dbh);
unless (defined $pk) {
$error = 1;
$data = <<EOE;
<p>Inserting Protocol Application: $proto_pk, Sample: $sample_fk</p>
<p>Error output = <$DBI::errstr></p>
EOE
goto ERROR;
}
push(@pks,$pk);
}
$data = "Protocols Successfully Added with primary keys: " . join(' ', @pks);
} else {
my @samp_dbs = Bio::Genex::Sample->get_all_objects($dbh);
foreach my $samp_db (@samp_dbs) {
push(@samples,[$samp_db->smp_pk,
$samp_db->name,
]);
}
}
ERROR : {
$data = qq[<font color="red"><h2>ERROR</h2><b>$data</b></font>]
if $error;
}
</%init>
--- NEW FILE: physicalbioassay-insert.html.in ---
<h1 align="center"><% $name %></h1>
<form action="<% $action %>"
method="post" enctype="multipart/form-data">
<div align="center">
% if ($error) {
<% $data %>
% } elsif ($submit) {
<h2><% $data %></h2>
% } else {
<& comps/ro_rw_group.mason, type=>$cur_class &>
<hr noshade size=5>
<& comps/value-input.mason,
value_name=>"Name",
cgi_param_name=>"pba_name",
entry_name=>$cur_class &>
<hr noshade size=5>
<& comps/fkey-menu.mason,
class=>"ExperimentSet",
script=>"experimentset-create.html",
cgi_param_name=>"es_fk",
array_ref=>\@experiments,
entry_name=>$cur_class &>
<hr noshade size=5>
<& comps/fkey-menu.mason,
class=>"Array",
script=>"array-insert.html",
cgi_param_name=>"array_fk",
array_ref=>\@arrays,
entry_name=>$cur_class &>
<hr noshade size=5>
<& comps/textarea-input.mason,
cgi_param_name=>"pba_desc",
entry_name=>$cur_class,
value_name=>"Physical BioAssay Description",
&>
<hr noshade size=5>
<& comps/contacts.mason, type=>"$cur_class" &>
<hr noshade size=5>
<input type="submit" name="submit" value="Create Physical BioAssay" size="33">
<& comps/hiddenlist.mason, name=>"debug", value=>$debug &>
<hr noshade size=5>
% }
</div>
</form>
<%args>
$debug => 0
$submit => ''
$provider => ''
$read_group => ''
$write_group => ''
$pba_desc => ''
$es_fk => ''
$array_fk => ''
$pba_name => ''
</%args>
<%attr>
action=>"$Bio::Genex::Config->{GENEX_WORKSPACE_URL}/physicalbioassay-insert.html"
name=>'GeneX DB Physical BioAssay Creation Page'
path=>"$Bio::Genex::Config->{GENEX_WORKSPACE_URL}/physicalbioassay-insert.html"
</%attr>
<%once>
use lib qw(%%GENEX_EXTRALIBS%%);
use Bio::Genex;
use Bio::Genex::Connect;
use Bio::Genex::Config;
use Bio::Genex::Contact;
use Bio::Genex::GroupSec;
use Bio::Genex::PhysicalBioAssay;
use Bio::Genex::ControlledVocab;
# use Apache::DB ();
</%once>
<%init>;
my $name = $m->current_comp->attr('name');
my $path = $m->current_comp->attr('path');
my $action = $m->current_comp->attr('action');
my $error;
# Apache::DB->init;
# Apache::DB->handler;
my $data = '';
my $cur_class = 'PhysicalBioAssay';
$dbh->assert_table_defined($cur_class);
my @experiments;
my @arrays;
if ($submit) {
# handle required arguments
unless ($es_fk) {
$error = 1;
$data = <<EOE;
<p>Required argument <b>es_fk</b> not provided</p>
EOE
goto ERROR;
}
unless ($array_fk) {
$error = 1;
$data = <<EOE;
<p>Required argument <b>array_fk</b> not provided</p>
EOE
goto ERROR;
}
unless ($pba_name) {
$error = 1;
$data = <<EOE;
<p>Required argument <b>pba_name</b> not provided</p>
EOE
goto ERROR;
}
my @pks;
my $pba_db = Bio::Genex::PhysicalBioAssay->new();
$pba_db->name($pba_name);
$pba_db->ro_groupname($read_group);
$pba_db->rw_groupname($write_group);
$pba_db->es_fk($es_fk);
$pba_db->array_fk($array_fk);
if ($provider) {
$pba_db->provider_con_fk($provider);
}
if ($pba_desc) {
$pba_desc =~ s/\'//;
$pba_db->description($pba_desc);
}
my $pk = $pba_db->insert_db($dbh);
unless (defined $pk) {
$error = 1;
$data = <<EOE;
<p>DBI Error while Inserting $cur_class</p>
<p>Error output = <$DBI::errstr></p>
EOE
goto ERROR;
} else {
$data = "$cur_class, $pba_name, Successfully Created with pkey: $pk";
}
} else {
my @exp_dbs = Bio::Genex::ExperimentSet->get_all_objects($dbh);
foreach my $exp_db (@exp_dbs) {
push(@experiments,[$exp_db->es_pk,
$exp_db->name,
]);
}
my @array_dbs = Bio::Genex::Array->get_all_objects($dbh);
foreach my $array_db (@array_dbs) {
push(@arrays,[$array_db->array_pk,
$array_db->name,
]);
}
}
ERROR : {
$data = qq[<font color="red"><h2>ERROR</h2><b>$data</b></font>]
if $error;
}
</%init>
|