Apache-TopicMaps
view release on metacpan or search on metacpan
lib/Apache/TopicMaps/text/html/topic.pm view on Meta::CPAN
# if $r->config(XY) dispatch to that!
if(!$USEM)
{
foreach my $at_topic (keys %{$user_data->{AT}})
{
my $ar_href= $user_data->{AT}->{$at_topic};
foreach my $ar_topic ( keys %$ar_href )
{
my $aref = $ar_href->{$ar_topic};
$r->print(qq{<table border="1">\n<tr><td bgcolor="#CCCCCC">IT IS } . make_label($tm,$ar_topic) . " of</td></tr>\n");
foreach my $href ( @$aref )
{
$r->print('<tr>');
foreach my $pr_topic ( keys %$href )
{
my $p_topic = $href->{$pr_topic};
$r->print("<td>".make_label($tm,$pr_topic)." PLAYED-BY ");
$r->print(" ".make_label($tm,$p_topic)."</td>");
}
$r->print("</tr>\n");
}
$r->print("</table>\n");
$r->print('<p> </p>');
}
}
}
if(!$USEM)
{
$r->print(qq{
</body>
</html>
});
#$tm->dump();
return OK;
}
my $d = $mason_dir .'/index.mhtml';
my %hash = ( topic => $topic , topicmap => $tm , r => $r);
my $interp = HTML::Mason::Interp->new();
my $component = $interp->make_component( comp_file => $d);
$interp->exec($component, %hash);
return OK;
}
1;
sub make_label
{
my ($tm,$topic) = @_;
my $x = "no-label";
my $names = $tm->get_property($topic, $SAM ."::BaseNames");
if(!$names) { $names = $tm->get_property($topic, $SAM ."::SubjectIndicators"); }
if(!$names) { $names = [ $tm->get_property($topic, $SAM ."::SubjectAddress")] };
if(!$names) { $names = $tm->get_property($topic, $SAM ."::SourceLocators") };
if($names) { $x = join( " , ",@$names) . "[$topic]"; };
my $url = "topic?topic=" . uri_escape( $tm->get_sidp_string($topic) );
my $s = qq{<a href="$url">$x</a>};
return ($s);
}
( run in 1.823 second using v1.01-cache-2.11-cpan-39bf76dae61 )