X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FTicket%2FElements%2FEditCustomFields;h=2eba6c81d6a6d4ab9fab483f2b8fee25f3a3df38;hb=b8988e1d3ac75af63c85e8563e57701030315a9e;hp=943170677d975713d75999843bb4fcdcb2b816f3;hpb=e02e5448d8fdad322dbe5562f92d9623e5d6f0dd;p=freeside.git diff --git a/rt/share/html/Ticket/Elements/EditCustomFields b/rt/share/html/Ticket/Elements/EditCustomFields index 943170677..2eba6c81d 100755 --- a/rt/share/html/Ticket/Elements/EditCustomFields +++ b/rt/share/html/Ticket/Elements/EditCustomFields @@ -2,7 +2,7 @@ %# %# 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) @@ -46,22 +46,18 @@ %# %# 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, @@ -73,22 +69,15 @@ &> % 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; @@ -103,11 +92,21 @@ if ($TicketObj && !$OnCreate) { $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 -foreach my $field ( $TicketObj->MissingRequiredFields ) { - $m->notes('InvalidField-' . $field->Id => 'Required to resolve'); +if ( $TicketObj ) { + foreach my $field ( $TicketObj->MissingRequiredFields ) { + $m->notes('InvalidField-' . $field->Id => 'Required to resolve'); + } } </%INIT> @@ -117,5 +116,6 @@ $TicketObj => undef $QueueObj => undef $OnCreate => undef $DefaultsFromTopArguments => 1 -$CFIDPrefix => '' +$AsTable => 0 +$InTable => 0 </%ARGS>