选择人机界面的简便化
戻る
新程序:直接按选择键选择
mscengine_nm.pl
sub mscengine_nm {
my $self = shift;
my(%t,$q,$template,$table,@rec);
# Get CGI query object
$q = $self->query();
$t{html} = $q->param("tmpl");
$t{html} = $t{html} . '.htm';
$template = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{id} = $q->param("id");
$t{name} = $q->param("name");
$t{series} = $q->param("series");
$t{title} = $q->param("title");
$t{table} = $q->param("table");
$t{item} = $q->param("item");
$t{sth} = $self->dbh->prepare("SELECT id,name,memo FROM $t{table}");
$t{sth}->execute;
while ( @rec = $t{sth}->fetchrow_array ) {
my $row_ref = (); # この初期化はとても重要!
$$row_ref{id} = $rec[0];
$$row_ref{mname} = $rec[1];
$$row_ref{memo} = $rec[2];
$$row_ref{title} = $t{title};
$$row_ref{aid} = $t{id};
$$row_ref{name} = $t{name};
$$row_ref{series} = $t{series};
$$row_ref{item} = $t{item};
push(@loop, $row_ref);
}
$t{sth}->finish;
$template->param(THIS_LOOP => \@loop);
$template->param(aid => $t{id});
$template->param(name => $t{name});
$template->param(series => $t{series});
return $template->output;
}
1;
mscengine_nm.htm
主機の選択
主機の選択
mode:modeengine_nm
aid==>
name==>
series==>
老程序:先用radio点击选出,然后在回到最上面按选择
mscengine_nm.pl
sub mscengine_nm {
my $self = shift;
my(%t,$q,$template,$table,@rec);
# Get CGI query object
$q = $self->query();
$t{html} = $q->param("tmpl");
$t{html} = $t{html} . '.htm';
$template = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{id} = $q->param("id");
$t{name} = $q->param("name");
$t{series} = $q->param("series");
$t{title} = $q->param("title");
$t{table} = $q->param("table");
$t{item} = $q->param("item");
$t{sth} = $self->dbh->prepare("SELECT id,name FROM $t{table}");
$t{sth}->execute;
while ( @rec = $t{sth}->fetchrow_array ) {
my $row_ref = (); # この初期化はとても重要!
$$row_ref{id} = $rec[0];
$$row_ref{Line} = $rec[1];
push(@loop, $row_ref);
}
$t{sth}->finish;
$template->param(aid => $t{id});
$template->param(name => $t{name});
$template->param(series => $t{series});
$template->param(title => $t{title});
$template->param(item => $t{item});
$template->param(THIS_LOOP => \@loop);
return $template->output;
}
1;
mscengine_nm.htm
主機の選択
主機の選択
mode:modeengine_nm
aid==>
name==>
series==>
mscengine_nm1.pl
sub mscengine_nm1 {
my $self = shift;
my(%t,$q,$template,$table,@rec);
# Get CGI query object
$q = $self->query();
$t{html} = $q->param("tmpl");
$t{html} = $t{html} . '.htm';
$template = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{title} = $q->param("title");
$t{aid} = $q->param("aid");
$t{id} = $q->param("id");
$t{name} = $q->param("name");
$t{series} = $q->param("series");
$t{item} = $q->param("item");
$t{sql} = 'UPDATE main_type1 set ' . $t{item} . ' = "';
$t{sql} .= $t{id} . '" where id = ' . $t{aid};
$t{DO} = $self->dbh->do($t{sql});
$template->param(aid => $t{aid});
$template->param(id => $t{id});
$template->param(name => $t{name});
$template->param(series => $t{series});
$template->param(sql => $t{sql});
$template->param(DO => $t{DO});
$template->param(title => $t{title});
return $template->output;
}
1;
mscengine_nm1.htm
主機の選択確定
主機の選択確定
mode:modeengine_nm1
aid==>
id==>
name==>
series==>
sql==>
DO==>
戻る