[Rt-commit] rt branch, 3.8-edit-custom-fields-enhancements, created. rt-3.8.8-201-g07407fb

Kevin Falcone falcone at bestpractical.com
Wed Nov 24 15:05:07 EST 2010


The branch, 3.8-edit-custom-fields-enhancements has been created
        at  07407fb17635470e7085960b81d8f55e9c3e9cb7 (commit)

- Log -----------------------------------------------------------------
commit 93d684c3df7f085435537e801ec22541d7228630
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Nov 23 10:08:31 2010 -0500

    Add classes and ids to the Custom Field Editing page
    
    backport the Type that 3.9 adds, but also add the CF Name
    so you can style a custom field based on that.  Use the CF's Id
    as the css id so that we can change these with javascript.

diff --git a/share/html/Ticket/Elements/EditCustomFields b/share/html/Ticket/Elements/EditCustomFields
index be4b8fd..1b02bb9 100755
--- a/share/html/Ticket/Elements/EditCustomFields
+++ b/share/html/Ticket/Elements/EditCustomFields
@@ -50,15 +50,18 @@
 % my $i = 0;
 % while ( my $CustomField = $CustomFields->Next ) {
 % next unless $CustomField->CurrentUserHasRight('ModifyCustomField');
+% my $escaped_name = lc $CustomField->Name;
+% $escaped_name =~ s/[^a-z0-9_-]/_/;
+% my $type = $CustomField->Type || 'Unknown';
 % $i++;
 % if ( $i % 2 ) {
-<tr>
+<tr class="edit-custom-field">
 % }
-    <td class="cflabel">
+    <td class="cflabel <% $type %> <% $escaped_name %>" id="cflabel-<% $CustomField->Id %>" >
       <b><% loc($CustomField->Name) %></b><br />
       <i><% $CustomField->FriendlyType %></i>
     </td>
-    <td class="entry">
+    <td class="entry <% $type %> <% $escaped_name %>" id="cfentry-<% $CustomField->Id %>">
 % my $default = $m->notes('Field-' . $CustomField->Id);
 % $default ||= $ARGS{"CustomField-". $CustomField->Id };
       <& /Elements/EditCustomField, 
@@ -70,7 +73,7 @@
       &>
 %  if (my $msg = $m->notes('InvalidField-' . $CustomField->Id)) {
         <br />
-        <span class="cfinvalidfield"><% $msg %></span>
+        <span class="cfinvalidfield <% $type %> <% $escaped_name %>"><% $msg %></span>
 %  }
     </td>
 

commit 07407fb17635470e7085960b81d8f55e9c3e9cb7
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Nov 24 15:04:40 2010 -0500

    Add EditCustomFieldsSingleColumn config option
    
    This defaults to 0 and keeps the current behavior, but allows you to
    change it to 1 and get your Ticket Custom Field editing pages in a
    single column table.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index ded24b1..6fbfe5f 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1097,6 +1097,16 @@ displayed in kilobytes. If set to C<'b'>, then sizes will be bytes.
 
 Set($AttachmentUnits, undef);
 
+=item C<$EditCustomFieldsSingleColumn>
+
+When displaying a list of Ticket Custom Fields for editing, RT defaults
+to a 2 column list.  If you set this to 1, it will instead display the
+Custom Fields in a single column.
+
+=cut
+
+Set($EditCustomFieldsSingleColumn, 0);
+
 =item C<$RedistributeAutoGeneratedMessages>
 
 Should RT redistribute correspondence that it identifies as
diff --git a/share/html/Ticket/Elements/EditCustomFields b/share/html/Ticket/Elements/EditCustomFields
index 1b02bb9..dc8b231 100755
--- a/share/html/Ticket/Elements/EditCustomFields
+++ b/share/html/Ticket/Elements/EditCustomFields
@@ -54,7 +54,7 @@
 % $escaped_name =~ s/[^a-z0-9_-]/_/;
 % my $type = $CustomField->Type || 'Unknown';
 % $i++;
-% if ( $i % 2 ) {
+% if ( $single_column || $i % 2 ) {
 <tr class="edit-custom-field">
 % }
     <td class="cflabel <% $type %> <% $escaped_name %>" id="cflabel-<% $CustomField->Id %>" >
@@ -77,14 +77,14 @@
 %  }
     </td>
 
-% unless ( $i % 2 ) {
+% if ($single_column || not $i % 2 ) {
 </tr>
 % }
 
 % }
 
 %# close row if required
-% if ( $i % 2 ) {
+% if ( !$single_column || $i % 2 ) {
 </tr>
 % }
 
@@ -103,6 +103,8 @@ if ($TicketObj && !$OnCreate) {
 
 $m->callback( %ARGS, CallbackName => 'MassageCustomFields', CustomFields => $CustomFields );
 
+my $single_column = RT->Config->Get('EditCustomFieldsSingleColumn');
+
 </%INIT>
 <%ARGS>
 $NamePrefix => ''

-----------------------------------------------------------------------


More information about the Rt-commit mailing list