[Bps-public-commit] r19135 - in RT-FormTools: .
sartak at bestpractical.com
sartak at bestpractical.com
Fri Apr 10 18:40:48 EDT 2009
Author: sartak
Date: Fri Apr 10 18:40:48 2009
New Revision: 19135
Modified:
RT-FormTools/ (props changed)
RT-FormTools/html/FormTools/Field
Log:
r82053 at onn: sartak | 2009-04-10 18:40:45 -0400
Handle readonly multi-value fields
Modified: RT-FormTools/html/FormTools/Field
==============================================================================
--- RT-FormTools/html/FormTools/Field (original)
+++ RT-FormTools/html/FormTools/Field Fri Apr 10 18:40:48 2009
@@ -17,6 +17,8 @@
my $field_label ||= $label;
my $cf;
+my @values;
+
$queue = $ticket->QueueObj
if !$queue && $ticket;
@@ -41,7 +43,11 @@
$m->notes( cfs_on_page => [ @{$m->notes('cfs_on_page')||[]}, $cf->id ] );
$field_label ||= $cf->Name;
- $default ||= $ticket->FirstCustomFieldValue($name) if $ticket;
+
+ if ($ticket) {
+ @values = map { $_->Content } @{ $cf->ValuesForObject($ticket)->ItemsArrayRef };
+ $default ||= $values[0];
+ }
}
@@ -85,7 +91,15 @@
% } elsif ($render_as eq 'readonly') {
-<span class="readonly"><% $default %></span>
+% if (@values > 1) {
+ <ul>
+% for (@values) {
+ <li class="readonly"><% $_ %></span>
+% }
+ </ul>
+% } else {
+ <span class="readonly"><% $default %></span>
+% }
% } else {
@@ -162,7 +176,17 @@
($default ? (Default => $default) : ()) &>
% } elsif ($render_as eq 'readonly') {
+
+% if (@values > 1) {
+ <ul>
+% for (@values) {
+ <li class="readonly"><% $_ %></span>
+% }
+ </ul>
+% } else {
<span class="readonly"><% $default %></span>
+% }
+
% } else {
% die "'$render_as' isn't a valid rendering option for field '$name'";
%}
More information about the Bps-public-commit
mailing list