<%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 $x=0; % # 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 % } # END if (scalar(@tiles)) { % # BEGIN FOREACH TILES % foreach my $dt (@tiles) { % my $no_del; % # START CONTENT ROWS % if ($dt->is_container) { % # START IF CONTAINER <%perl>; } else { # START ELSE ( DATA TILE DISPLAY ) my $at_obj = $dt->get_element_data_obj(); $no_del = $at_obj->get_required; my $meta = $at_obj->get_meta('html_info'); my $vals = { props => { %$meta } }; my $key = $widget . '|' . $dt->get_id; # Get the value. $vals->{value} = $dt->get_data(ISO_8601_FORMAT); $vals->{value} = $vals->{props}{value} unless defined $vals->{value}; if ($vals->{props}{type} eq 'checkbox') { $vals->{props}{chk} = $vals->{value}; $vals->{value} = 1; } # Set the array of possible values, if necessary. if ( my $tmp = $vals->{props}{vals} ) { my $val_prop; foreach my $line (split /\n/, $tmp) { my ($v, $l) = split /\s*,\s*/, $line; chomp $v; push @$val_prop, [$v, $l]; } $vals->{props}{vals} = $val_prop; } % # END DATA AREA % } # END ELSE (DATA TILE DISPLAY) % # ORDER TABLE CELL % # DELETE TABLE CELL <% $ieSpacer %> % } % # END FOREACH TILES % if (scalar @tiles) { % } else {   %} % # DISPLAY IF NO TILES % if (!$total) { % } % # END TILE DISPLAY
class="medHeader" valign="middle">Name class="medHeader" align="center">Content > Position > Delete
<% $dt->get_name() %>:  % # START OPTIONAL BULK EDIT PULLDOWN % if (my $opts = $repeatable_elem_opts->($dt)) { % } # END IF OPTIONAL BULK EDIT PULLDOWN
% my $at = $dt->get_element; % if ($at->is_related_media || $at->is_related_story) { > <%perl> my $info = ''; if ($at->is_related_media) { my $rel = $dt->get_related_media; $info = $rel->get_uri if $rel; } else { my $rel = $dt->get_related_story; $info = $rel->get_title if $rel; }
<% ($at->is_related_media) ? "URL:" : "Title:" %> > <% $info %>
<& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "container_prof|edit". $dt->get_id() ."_cb", image => "edit_lgreen", vspace => 3 &>
% } else { <& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "container_prof|edit". $dt->get_id() ."_cb", image => "edit_lgreen", vspace => 3 &> % }
- or - <& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "container_prof|bulk_edit-" . $dt->get_id() ."_cb", image => "bulk_edit_lgreen" &> <& '/widgets/profile/select.mc', name => $widget.'|bulk_edit_tile_field-'.$dt->get_id, options => $opts, useTable => 0, &>
<% $vals->{props}{disp} %>:  % if ($dt->is_autopopulated()) { % } else { % }
<& '/widgets/profile/displayFormElement.mc', key => $key, vals => $vals, useTable => 0 &>  Lock Val: is_locked ? ' CHECKED' : '' %>> 
% my $f_key; % if ($dt->is_container) { % $f_key = "$widget|reorder_con" . $dt->get_id(); % } else { % $f_key = "$widget|reorder_dat" . $dt->get_id(); % } % my $vals = []; % foreach (1 .. $total) { % my $val = $_ - 1; % push @$vals, [$val, $_]; %} <& '/widgets/profile/displayFormElement.mc', key => $f_key, vals => { value => $dt->get_place(), props => { type => 'select', vals => $vals, }, js => 'onChange="reorder(this, \'theForm\')"' }, useTable => 0 &> % if ($no_del) {   % } elsif ($dt->is_container) { % # START IF CONTAINER % } else { % }
<& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "container_prof|reorder_cb", image => "reorder_lgreen", vspace => 3, hspace => 2 &>  
    No elements have been added.
%# Begin element picker % if ($elem_opts) { % if ($repeatable_opts) { % } % } %# end data display
align="right" class="medHeader"><& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|add_element_cb", image => "add_element_lgreen", vspace => 3, hspace => 4 &> <& /widgets/profile/select.mc, name => $widget.'|add_element', options => $elem_opts, useTable => 0, multiple => 0, size => 1, &> class="medHeader"> % if ($repeatable_opts) {
<& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|bulk_edit_this_cb", image => "bulk_edit_lgreen", vspace => 3, hspace => 4 &> <& /widgets/profile/select.mc, name => $widget.'|bulk_edit_field', options => $repeatable_opts, useTable => 0, &>
% } else {   % }
%$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) {
Delete this Element
<& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|up_cb", image => "cancel_red", &>
% } %# this script creates an array with the names %# of select boxes that need ordering "); return $num; <%args> $widget $num => undef $title => undef $show_summary => undef <%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()) { $repeatable_opts->{$_->get_name()} = $disp; } } # the container options my @pos_cont = $tile->get_possible_containers(); foreach (@pos_cont) { 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; <%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 $opts->{$_->get_name()} = $_->get_meta('html_info')->{disp}; } } 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(''); if ($rel) { # The summary info $m->out(''); } else { $m->out('
'); $m->comp('/widgets/summary/summary.mc', asset => $rel, type => $type, header => 'Currently Related '.ucfirst($type), frame => 0, button => $button ); $m->out('
'); $m->out('     No related '.ucfirst($type)); $m->out("$button"); } $m->out('
'); };