// $Id$ /** * @file * Override Drupal tabledrag methods to add support for nested fieldgroups. */ /** * Determine the valid indentations interval for the row at a given position * in the table. * * @param prevRow * DOM object for the row before the tested position * (or null for first position in the table). * @param nextRow * DOM object for the row after the tested position * (or null for last position in the table). */ Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) { var minIndent, maxIndent; // Minimum indentation: // Do not orphan the next row. minIndent = nextRow ? $('.indentation', nextRow).size() : 0; // Maximum indentation: if (!prevRow || ($(prevRow).is('.tabledrag-leaf') && !$('.indentation', prevRow).size() < $('.indentation', this.element).size())) { // Do not indent the first row in the table or 'root' rows. if (!prevRow) { maxIndent = 0; } else { maxIndent = $('.indentation', prevRow).size(); } } else { // Do not go deeper than as a child of the previous row. maxIndent = $('.indentation', prevRow).size() + ($(prevRow).is('.tabledrag-leaf') ? 0 : 1); // Limit by the maximum allowed depth for the table. if (this.maxDepth) { maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents)); } } return {'min':minIndent, 'max':maxIndent}; }