home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / drupal-6.0.exe / drupal-6.0 / modules / taxonomy / taxonomy.js < prev    next >
Encoding:
Text File  |  2007-12-16  |  1.8 KB  |  37 lines

  1. // $Id: taxonomy.js,v 1.2 2007/12/16 10:36:53 goba Exp $
  2.  
  3. /**
  4.  * Move a block in the blocks table from one region to another via select list.
  5.  *
  6.  * This behavior is dependent on the tableDrag behavior, since it uses the
  7.  * objects initialized in that behavior to update the row.
  8.  */
  9. Drupal.behaviors.termDrag = function(context) {
  10.   var table = $('#taxonomy', context);
  11.   var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
  12.   var rows = $('tr', table).size();
  13.  
  14.   // When a row is swapped, keep previous and next page classes set.
  15.   tableDrag.row.prototype.onSwap = function(swappedRow) {
  16.     $('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
  17.     $('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
  18.     $('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
  19.  
  20.     if (Drupal.settings.taxonomy.backPeddle) {
  21.       for (var n = 0; n < Drupal.settings.taxonomy.backPeddle; n++) {
  22.         $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
  23.       }
  24.       $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
  25.       $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
  26.     }
  27.  
  28.     if (Drupal.settings.taxonomy.forwardPeddle) {
  29.       for (var n = rows - Drupal.settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
  30.         $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
  31.       }
  32.       $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
  33.       $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
  34.     }
  35.   };
  36. };
  37.