%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeCustomFields' );
-<table>
-% my $i = 0;
+% if ( $WRAP ) {
+<<% $WRAP %> class="edit-custom-fields">
+% }
% while ( my $CustomField = $CustomFields->Next ) {
% next unless $CustomField->CurrentUserHasRight('ModifyCustomField');
-% my $escaped_name = lc $CustomField->Name;
-% $escaped_name =~ s/[^a-z0-9_-]/_/g;
-% my $type = $CustomField->Type || 'Unknown';
-% $i++;
-% if ( $single_column || $i % 2 ) {
-<tr class="edit-custom-field">
-% }
- <td class="cflabel cftype-<% $type %> cfname-<% $escaped_name %>" id="<% $CFIDPrefix %>cflabel-<% $CustomField->Id %>" >
- <b><% loc($CustomField->Name) %></b><br />
- <i><% $CustomField->FriendlyType %></i>
- </td>
- <td class="entry cftype-<% $type %> cfname-<% $escaped_name %>" id="<% $CFIDPrefix %>cfentry-<% $CustomField->Id %>">
+% my $Type = $CustomField->Type || 'Unknown';
+ <<% $FIELD %> class="edit-custom-field cftype-<% $Type %>">
+ <<% $CELL %> class="cflabel">
+ <span class="name"><% loc($CustomField->Name) %></span><br />
+ <span class="type"><% $CustomField->FriendlyType %></span>
+ </<% $CELL %>>
+ <<% $CELL %> class="entry">
% my $default = $m->notes('Field-' . $CustomField->Id);
% $default ||= $ARGS{"CustomField-". $CustomField->Id };
<& /Elements/EditCustomField,
&>
% if (my $msg = $m->notes('InvalidField-' . $CustomField->Id)) {
<br />
- <span class="cfinvalidfield cftype-<% $type %> cfname-<% $escaped_name %>"><% $msg %></span>
+ <span class="cfinvalidfield"><% $msg %></span>
% }
- </td>
-
-% if ($single_column || not $i % 2 ) {
-</tr>
-% }
-
+ </<% $CELL %>>
+ </<% $FIELD %>>
% }
-%# close row if required
-% if ( !$single_column || $i % 2 ) {
-</tr>
+% if ( $WRAP ) {
+</<% $WRAP %>>
% }
-
-</table>
% $m->callback( %ARGS, CallbackName => 'AfterCustomFields', TicketObj => $TicketObj, QueueObj => $QueueObj );
<%INIT>
my $CustomFields;
$m->callback( %ARGS, CallbackName => 'MassageCustomFields', CustomFields => $CustomFields );
-my $single_column = RT->Config->Get('EditCustomFieldsSingleColumn');
+$AsTable ||= $InTable;
+my $FIELD = $AsTable ? 'tr' : 'div';
+my $CELL = $AsTable ? 'td' : 'div';
+my $WRAP = '';
+if ( $AsTable ) {
+ $WRAP = 'table' unless $InTable;
+} else {
+ $WRAP = 'div';
+}
+
+# show hints for missing required fields
+if ( $TicketObj ) {
+ foreach my $field ( $TicketObj->MissingRequiredFields ) {
+ $m->notes('InvalidField-' . $field->Id => 'Required to resolve');
+ }
+}
</%INIT>
<%ARGS>
$QueueObj => undef
$OnCreate => undef
$DefaultsFromTopArguments => 1
-$CFIDPrefix => ''
+$AsTable => 0
+$InTable => 0
</%ARGS>