<%perl>
# Show the story summary if needed.
if ($show_summary) {
my $type = $tile->get_object_type;
# Nab the story from the story_prof widget.
my $asset = get_state_data($type.'_prof', $type);
$m->comp('/widgets/summary/summary.mc', asset => $asset, number => 1);
}
# COUNT FOR REORDER JAVA SCRIPT
my $total = scalar @tiles;
my $diff = $total ? $tiles[-1]->get_place - $total + 1 : 0;
my $ord_vals = [ map { [ $_ - 1, $_ ] } 1..$total ];
my $x=0;
%perl>
% # check if we should display
% if (@tiles || $elem_opts ) {
% $m->comp("/widgets/wrappers/sharky/table_top.mc",
% caption => $title,
% number => $num++
% );
% # COLUMN HEADER ROW
% my $rowspan = scalar(@tiles) + 2;
% $rowspan++ if ($repeatable_opts);
% $rowspan += scalar(@tiles) if ($agent->{browser} eq "Internet Explorer");
% if (scalar(@tiles)) { # suppress labels if no results
% # START BULK EDIT PULLDOWN
% my $opts = $repeatable_elem_opts->($dt);
% # Only show this if there is anything to add.
% if (scalar(@{$dt->get_possible_data()}) or scalar(@{$dt->get_possible_containers()})) {
%$m->comp("/widgets/wrappers/sharky/table_bottom.mc");
%# end element display
% }
%### Start Related Story Section ###
% if ($is_related_story) {
<& /widgets/wrappers/sharky/table_top.mc,
caption => 'Related Story',
number => $num++
&>
% $related_summary->($tile, 'story', $widget);
<& /widgets/wrappers/sharky/table_bottom.mc &>
% }
%### End Related Story Section ###
%### Start Related Media Section ###
% if ($is_related_media) {
<& /widgets/wrappers/sharky/table_top.mc,
caption => 'Related Media ',
number => $num++
&>
% $related_summary->($tile, 'media', $widget);
<& /widgets/wrappers/sharky/table_bottom.mc &>
% }
%### End Related Media Section ###
% if ($show_summary) {
% }
%# this script creates an array with the names
%# of select boxes that need ordering
");
return $num;
%perl>
<%args>
$widget
$num => undef
$title => undef
$show_summary => undef
%args>
<%init>
# the tile object
my $tile = get_state_data($widget, 'tile');
$title ||= $tile->get_name;
my $start = get_state_data($widget, 'start');
# the contained tiles
my @tiles = $tile->get_tiles();
my $elem_opts;
my $repeatable_opts = [];
# the possible data options
my @pos_data = $tile->get_possible_data();
foreach (@pos_data) {
my $key = 'data_' . $_->get_id();
my $disp = $_->get_meta('html_info')->{disp};
$elem_opts->{$key} = $disp;
if ($_->get_quantifier()) {
push @$repeatable_opts, [$_->get_name(), $disp];
}
}
push @$repeatable_opts, ['_super_bulk_edit', '- Super Bulk Edit -'];
# the container options
my @pos_cont = $tile->get_possible_containers();
foreach (@pos_cont) {
next unless chk_authz($_, READ, 1);
my $key = 'cont_' . $_->get_id();
$elem_opts->{$key} = $_->get_name();
}
my $at_id = $tile->get_element_id;
my $at = Bric::Biz::AssetType->lookup({'id' => $at_id});
# Uncomment this when the related_tile flag is in at_type.
my $is_related_story = $at->is_related_story ? 1 : 0;
my $is_related_media = $at->is_related_media ? 1 : 0;
# browser spacing stuff
my $agent = $m->comp("/widgets/util/detectAgent.mc");
my $ieSpacer = ($agent->{browser} eq "Internet Explorer")
? qq{
}
: '';
my $shim = ($agent->{browser} eq "Netscape") ? -4 : 4;
%init>
<%once>
my $repeatable_elem_opts = sub {
my ($t) = @_;
my $id = $t->get_id;
my @opts;
foreach ($t->get_possible_data()) {
if ($_->get_quantifier()) {
# Pass the name with the tile ID as the value
push @opts, [$_->get_name(), $_->get_meta('html_info')->{disp}];
}
}
push @opts, ['_super_bulk_edit', '- Super Bulk Edit -'];
return \@opts;
};
my $related_summary = sub {
my ($tile, $type, $widget) = @_;
my $rel = $type eq 'story' ? $tile->get_related_story
: $tile->get_related_media;
my $button = $m->scomp( '/widgets/profile/imageSubmit.mc',
formName => "theForm",
callback => $widget ."|pick_related_".$type."_cb",
image => "edit_lgreen",
vspace => 4,
);
$m->out('