| 1 |
// $Id: taxonomy.js,v 1.2 2007/12/16 10:36:53 goba Exp $
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Move a category in the categories table from one hierarchy 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.categoryDrag = function(context) {
|
| 10 |
var table = $('#category', context);
|
| 11 |
var tableDrag = Drupal.tableDrag.category; // Get the category 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.category-category-preview', table).removeClass('category-category-preview');
|
| 17 |
$('tr.category-category-divider-top', table).removeClass('category-category-divider-top');
|
| 18 |
$('tr.category-category-divider-bottom', table).removeClass('category-category-divider-bottom');
|
| 19 |
|
| 20 |
if (Drupal.settings.category.backPeddle) {
|
| 21 |
for (var n = 0; n < Drupal.settings.category.backPeddle; n++) {
|
| 22 |
$(table[0].tBodies[0].rows[n]).addClass('category-category-preview');
|
| 23 |
}
|
| 24 |
$(table[0].tBodies[0].rows[Drupal.settings.category.backPeddle - 1]).addClass('category-category-divider-top');
|
| 25 |
$(table[0].tBodies[0].rows[Drupal.settings.category.backPeddle]).addClass('category-category-divider-bottom');
|
| 26 |
}
|
| 27 |
|
| 28 |
if (Drupal.settings.category.forwardPeddle) {
|
| 29 |
for (var n = rows - Drupal.settings.category.forwardPeddle - 1; n < rows - 1; n++) {
|
| 30 |
$(table[0].tBodies[0].rows[n]).addClass('category-category-preview');
|
| 31 |
}
|
| 32 |
$(table[0].tBodies[0].rows[rows - Drupal.settings.category.forwardPeddle - 2]).addClass('category-category-divider-top');
|
| 33 |
$(table[0].tBodies[0].rows[rows - Drupal.settings.category.forwardPeddle - 1]).addClass('category-category-divider-bottom');
|
| 34 |
}
|
| 35 |
};
|
| 36 |
};
|