% if (ENABLE_HTMLAREA) { % # HTMLAREA code here, only used if textarea is in the page with wysiwyg on. <& /widgets/htmlarea/load.mc &> % } <%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; # Check if we should display elements. if (@tiles || @$elem_opts ) { $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => $title, id => 'containerprof', number => $num++ ); % # COLUMN HEADER ROW % my $rowspan = scalar(@tiles) + 2; % $rowspan++ if ($repeatable_opts); % $rowspan += scalar(@tiles) if $agent->ie; % if (scalar(@tiles)) { # suppress labels if no results % } # END if (scalar(@tiles)) { % # BEGIN FOREACH TILES % my $no_hide; % 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 && $dt->get_object_order == 1; 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; } my $textareatopalign; $textareatopalign = qq{ valign="top"} if ($vals->{props}{type} eq 'textarea'); % # 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"><%$lang->maketext('Name')%> class="medHeader" align="center"><%$lang->maketext('Content')%> > <%$lang->maketext('Position')%> > <%$lang->maketext('Delete')%>
<% $dt->get_name %>:  <%perl> # Find a suitable tile to display my($disp_buf, $value_buf); foreach my $tile ($dt->get_tiles) { next if $tile->is_container; my $props = $tile->get_element_data_obj->get_meta('html_info'); if (my $data = $dt->get_data($tile->get_key_name)) { next unless $props->{type} =~ /^text/; $disp_buf = $props->{disp}; $value_buf = substr($data, 0, 64); last; } } % if ($value_buf) { % } # if ($value_buf) % # 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()})) { % }
<% $disp_buf %>: <% escape_html($value_buf) %>
% 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; }
<% $lang->maketext($at->is_related_media ? "URL" : "Title" )%>: > <% $info %>
<& '/widgets/profile/imageSubmit.mc', formName => 'theForm', callback => 'container_prof|edit_cb', image => 'edit_lgreen', vspace => 3, value => $dt->get_id, useHidden => 0 &>
% } else { <& '/widgets/profile/imageSubmit.mc', formName => 'theForm', callback => 'container_prof|edit_cb', image => 'edit_lgreen', vspace => 3, value => $dt->get_id, useHidden => 0 &> % }
- or - <& '/widgets/profile/imageSubmit.mc', formName => 'theForm', callback => 'container_prof|bulk_edit_cb', image => 'bulk_edit_lgreen', value => $dt->get_id, useHidden => !$no_hide++ &> <& '/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, localize => 0 &>  Lock Val: is_locked ? ' CHECKED' : '' %>> 
% my $f_key = "$widget|reorder_" . ($dt->is_container ? 'con' : 'dat') . % $dt->get_id; <& /widgets/profile/displayFormElement.mc, key => $f_key, vals => { value => $dt->get_place - $diff, props => { type => 'select', vals => $ord_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 &>  
    <%$lang->maketext('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) {
<%$lang->maketext('Delete this Element')%>
<& '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|up_cb", image => "cancel_red", &>
% } % if (ENABLE_HTMLAREA) { % # HTMLAREA code here, only used if textarea is in the page with wysiwyg on. <& /widgets/htmlarea/timeout.mc &> % } %# 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}; push @$elem_opts, [ $key => $disp ]; if ($_->get_quantifier()) { push @$repeatable_opts, [$_->get_key_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(); push @$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 = detect_agent(); my $ieSpacer = $agent->ie ? qq{} : ''; my $shim = $agent->nav4 ? -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 push @opts, [$_->get_key_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(''); if ($rel) { my $thumb = ''; if (USE_THUMBNAILS && $type ne 'story') { if ($thumb = $rel->thumbnail_uri) { $thumb = qq{ }; } } # 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 => $thumb . $button ); $m->out('
'); $m->out('     No related '.ucfirst($type)); $m->out("$button"); } $m->out('
'); };