[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.6-90-g054c5f3

Alex M Vandiver alexmv at bestpractical.com
Fri Nov 13 16:15:06 EST 2009


The branch, 3.8-trunk has been updated
       via  054c5f3bb927914c91a167b8f749ef5a69937673 (commit)
      from  e221be4bb8168d36c6cf40f83f3d02d9d738273a (commit)

Summary of changes:
 lib/RT/CustomField_Overlay.pm             |   12 ------------
 share/html/Elements/EditCustomFieldSelect |   29 ++++++++++++++++++++---------
 2 files changed, 20 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit 054c5f3bb927914c91a167b8f749ef5a69937673
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Nov 13 16:09:36 2009 -0500

    Move all JS for hierarchical CFs onto derivative field; remove DerivativeCFs method
    
    Oracle does not allow for SQL queries which attemt to match on the
    'Content' field of attrbiutes, as it is a CLOB column -- additionally,
    searches on it are not likely to be well-indexed.  Because of this, we
    move all code involving hierarchical CFs onto display of the
    derivative field, instead of being split between base and derivative
    field; this saves us the need to list all derivative CFs.
    
    As part of this, remove the (non-functioning under Oracle) and
    now-unused DerivativeCFs method on CustomField.

diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index e0df9ad..9286d7a 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -1289,16 +1289,4 @@ sub BasedOnObj {
     return $obj;
 }
 
-sub DerivativeCFs {
-    my $self = shift;
-    my $attrs = RT::Attributes->new( $self->CurrentUser );
-    $attrs->Limit( FIELD => 'ObjectType', VALUE => 'RT::CustomField' );
-    $attrs->Limit( FIELD => 'Name',       VALUE => 'BasedOn' );
-    $attrs->Limit( FIELD => 'Content',    VALUE => $self->id );
-
-    my @cfs;
-    push @cfs, $_->Object while $_ = $attrs->Next;
-    return @cfs;
-}
-
 1;
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 4aec2b0..8fe79f9 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -62,6 +62,26 @@
       <option value="<% $name %>"><% '&nbsp;' x $depth |n %><% $name %></option>
 %   }
     </select><br />
+% } elsif ($CustomField->BasedOnObj->id) {
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script>
+<script type="text/javascript"><!--
+doOnLoad(  function () {
+    var basedon = document.getElementById('<% $NamePrefix . $CustomField->BasedOnObj->id %>-Values');
+    if (basedon != null) {
+        var oldchange = basedon.onchange;
+        basedon.onchange = function () {
+            filter_cascade(
+                '<% $id %>-Values',
+                basedon.value,
+                1
+            );
+            if (oldchange != null)
+                oldchange();
+        };
+        basedon.onchange();
+    }
+});
+--></script>
 % }
 % if (@category) {
 %# this hidden select is to supply a full list of values,
@@ -71,16 +91,7 @@
 %       $m->out($out);
       </select>
 % }
-% my @Derivatives = map {$_->id} $CustomField->DerivativeCFs;
-% if (@Derivatives) {
-  <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script>
-<script type="text/javascript"><!--
-doOnLoad(  function () {<% join(";", map {"filter_cascade('$NamePrefix$_-Values',document.getElementById('$id-Values').value, 1)"} @Derivatives) |n%>} );
---></script>
-<select onchange="<% join(";", map {"filter_cascade('$NamePrefix$_-Values', this.value, 1)"} @Derivatives) |n%>"
-% } else {
 <select
-% }
   name="<%$id%>-Values" id="<%$id%>-Values" class="CF-<%$CustomField->id%>-Edit"
 % if ( $Rows && ( $Multiple || !@category ) ) {
   size="<% $Rows %>"

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


More information about the Rt-commit mailing list