% if ($dt->is_container) {
% # START IF CONTAINER
<% $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;
}
}
%perl>
% if ($value_buf) {
<% $disp_buf %>: <% escape_html($value_buf) %> |
% } # if ($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;
}
%perl>
> <% $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
&>
% }
|
% # 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()})) {
- 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,
&>
|
% }
|
<%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;
}
%perl>
<% $vals->{props}{disp} %>: |
|
% # END DATA AREA
% } # END ELSE (DATA TILE DISPLAY)
% # ORDER TABLE CELL
% my $f_key = "$widget|reorder_" . ($dt->is_container ? 'con' : 'dat') .
% $dt->get_id;
<& /widgets/profile/displayFormElement.mc,
key => $f_key,
vals => {
value => $num++,
js => 'onChange="reorder(this, \'theForm\')"',
props => {
type => 'select',
vals => $ord_vals,
},
},
useTable => 0
&>
|
% # DELETE TABLE CELL
% if ($no_del) {
% } elsif ($dt->is_container) {
% # START IF CONTAINER
<& '/widgets/profile/checkbox.mc',
name => 'container_prof|delete_cont' . $dt->get_id,
value => 1
&>
% } else {
<& '/widgets/profile/checkbox.mc',
name => 'container_prof|delete_data' . $dt->get_id,
value => 1
&>
% }
|
% }
% # END FOREACH TILES
|
% if (scalar @tiles) {
<& '/widgets/profile/button.mc',
disp => $lang->maketext("Reorder"),
widget => 'container_prof',
cb => 'reorder_cb',
button => 'reorder_lgreen',
useTable => 0 &>
|
<& '/widgets/profile/button.mc',
disp => $lang->maketext("Delete"),
widget => 'container_prof',
cb => 'delete_cb',
button => 'delete_red',
useTable => 0 &>
|
% } else {
|
%}
% # DISPLAY IF NO TILES
% if (!$total) {