% if ($dt->is_container) {
% # START IF CONTAINER
<% $dt->get_name %>: |
<%perl>
# Find a suitable element to display
my($disp_buf, $value_buf);
foreach my $field ($dt->get_fields) {
# next if $field->get_widget_type !~ /^text/;
if (my $value = $field->get_value) {
$disp_buf = $field->get_name;
$value_buf = substr($value, 0, 64);
last;
}
}
%perl>
% if ($value_buf) {
<% $disp_buf %>: <% escape_html($value_buf) %> |
% } # if ($value_buf)
% my $at = $dt->get_element_type;
% 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 SECTION
|
<& '/widgets/profile/imageSubmit.mc',
formName => 'theForm',
callback => 'container_prof|bulk_edit_cb',
image => 'bulk_edit_lgreen',
value => $dt->get_id,
useHidden => !$no_hide++
&> |
|
<%perl>;
} else {
# START ELSE ( FIELD ELEMENT DISPLAY )
my $at_obj = $dt->get_field_type;
$no_del = $at_obj->get_required && $at_obj->is_active
&& $dt->get_object_order == 1;
my $vals = { props => {
type => $at_obj->get_widget_type,
disp => $at_obj->get_name,
length => $at_obj->get_length,
size => $at_obj->get_length,
cols => $at_obj->get_cols,
rows => $at_obj->get_rows,
maxlength => $at_obj->get_max_length,
precision => $at_obj->get_precision,
vals => $at_obj->get_vals,
multiple => $at_obj->get_multiple,
}};
my $key = $widget . '|' . $dt->get_id;
# Get the value.
$vals->{value} = $dt->get_value(ISO_8601_FORMAT)
|| $at_obj->get_default_val;
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} ) {
if ($vals->{props}{type} eq 'codeselect') {
$vals->{props}{vals} = eval_codeselect($tmp);
} else {
my $val_prop;
foreach my $line (split /\n/, $tmp) {
# (c.f. comp/widgets/profile/displayAttrs.mc)
my ($v, $l) = split /\s*(?{props}{vals} = $val_prop;
}
}
%perl>
<% $vals->{props}{disp} %>: |
% # This 100% is necessary to get the autosizing textareas to work in IE.
<& '/widgets/profile/displayFormElement.mc',
key => $key,
vals => $vals,
useTable => 0,
localize => 0
&>
|
% if ($dt->is_autopopulated()) {
<& '/widgets/profile/hidden.mc',
name => "$widget|lock_val_cb",
value => $dt->get_id,
&>
Lock Val:
<& '/widgets/profile/checkbox.mc',
name => "$widget|lock_val_" . $dt->get_id,
checked => ($dt->is_locked ? 1 : 0),
&>
|
% } else {
|
% }
|
% # END FIELD AREA
% } # END ELSE (FIELD ELEMENT 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 ELEMENTS
% if (scalar @elements) {
|
<& '/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 &>
|
% }
% # DISPLAY IF NO ELEMENTS
% if (!$total) {