? draggableviews-393530.patch
? draggableviews-436124.patch
? draggableviews-464870.patch
? draggableviews-536846.patch
? draggableviews-DRUPAL-6--3_arg_schema.patch
? draggableviews_450070_blank_fields_fix.patch
? draggableviews_arg_ordering.patch
? modules/draggablebooks
? views/draggableviews_arg_ordering.patch
Index: draggableviews-view-draggabletable.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews-view-draggabletable.tpl.php,v
retrieving revision 1.6.2.5
diff -u -p -r1.6.2.5 draggableviews-view-draggabletable.tpl.php
--- draggableviews-view-draggabletable.tpl.php	25 Apr 2009 12:47:02 -0000	1.6.2.5
+++ draggableviews-view-draggabletable.tpl.php	14 Aug 2009 22:37:36 -0000
@@ -8,18 +8,18 @@
  * - $fields: An array of CSS IDs to use for each field id.
  * - $class: A class or classes to apply to the table, based on settings.
  * - $rows: An array of row items. Each row is an array of content
- *   keyed by field ID.
- * 
- * - $tabledrag: An array of tabledrag settings
+ *   keyed by field ID.
+ * 
+ * - $tabledrag: An array of tabledrag settings
  * - $tabledrag_tableId: The table id that drupal_add_tabledrag needs
  * @ingroup views_templates
- */
-
-  //add tabledrag
-  if (count($tabledrag) > 0) {
-    foreach ($tabledrag as $drag) {
-      drupal_add_tabledrag($tabledrag_table_id, $drag['action'], $drag['relationship'], $drag['group'], $drag['subgroup'], $drag['source'], $drag['hidden'], $drag['limit']);
-    }
+ */
+
+  //add tabledrag
+  if (count($tabledrag) > 0) {
+    foreach ($tabledrag as $drag) {
+      drupal_add_tabledrag($tabledrag_table_id, $drag['action'], $drag['relationship'], $drag['group'], $drag['subgroup'], $drag['source'], $drag['hidden'], $drag['limit']);
+    }
   }
 ?>
 <table class="<?php print $class; ?>" id="<?php print $tabledrag_table_id; ?>">
@@ -37,8 +37,8 @@
       <?php $zebra = ($count % 2 == 1) ? 'even' : 'odd'; ?>
       <tr class="draggable <?php print $zebra; ?><?php if ($draggableviews_extended[$count]) print ' '. 'draggableviews-extended'; ?><?php if ($tabledrag_type[$count]) print ' '. $tabledrag_type[$count]; ?>">
         <?php foreach ($row as $field => $content): ?>
-          <td class="views-field views-field-<?php print $fields[$field]; ?>"<?php if ($style[$field]) print ' style="'. $style[$field] .'"'; ?>><?php
-            print $content;
+          <td class="views-field views-field-<?php print $fields[$field]; ?>"<?php if ($style[$field]) print ' style="'. $style[$field] .'"'; ?>><?php
+            print $content;
           ?></td>
         <?php endforeach; ?>
       </tr>
Index: draggableviews.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews.inc,v
retrieving revision 1.7.2.28
diff -u -p -r1.7.2.28 draggableviews.inc
--- draggableviews.inc	16 Jul 2009 19:50:56 -0000	1.7.2.28
+++ draggableviews.inc	14 Aug 2009 22:37:37 -0000
@@ -159,14 +159,14 @@ function _draggableviews_info($view, $in
     // loop through all resulting nodes
     foreach ($results as $row) {
       if (is_numeric($row->{$info['order']['field']['field_alias']})) {
-        $info['nodes'][$row->nid]['order'][0] = (int)($row->{$info['order']['field']['field_alias']});
+        $info['nodes'][$row->{$view->base_field}]['order'][0] = (int)($row->{$info['order']['field']['field_alias']});
       }
       else {
         // Default position of new nodes.
-        $info['nodes'][$row->nid]['order'][0] = $info['default_on_top'] == 1 ? -1 : $view->total_rows;
+        $info['nodes'][$row->{$view->base_field}]['order'][0] = $info['default_on_top'] == 1 ? -1 : $view->total_rows;
       }
       if (isset($info['hierarchy'])) {
-        $info['nodes'][$row->nid]['parent'] = (int)($row->{$info['hierarchy']['field']['field_alias']});
+        $info['nodes'][$row->{$view->base_field}]['parent'] = (int)($row->{$info['hierarchy']['field']['field_alias']});
       }
     }
   }
@@ -177,13 +177,16 @@ function _draggableviews_info($view, $in
 /*
  * Quick Check Structure
  *
- * I used the word "Quick" because only visible nodes and only the very top hierarchy level will be checked. If the
- * return is TRUE we can be sure that the structure will be displayed correctly. But errors that don't affect the
- * current output can not be detected. Enhanced checks will be done when we have to rebuild a broken structure.
+ * I used the word "Quick" because only visible nodes will be checked. If the
+ * return is TRUE we can be sure that the structure will be displayed correctly.
+ * But errors that don't affect the current output can not be detected.
+ * Enhanced checks will be done when we have to rebuild a broken structure.
  *
  * We check for the following:
- *  - Wrong order values: The order values must constantly increase by 1, independent of the hierarchy level.
- *  - Parent mismatch: The parent_nid must equal with the nid we memorized before we entered the current hierarchy level.
+ *  - Wrong order values: The order values must constantly increase by 1,
+ *     independent of the hierarchy level.
+ *  - Parent mismatch: The parent_nid must equal with the nid we memorized
+ *     before we entered the current hierarchy level.
  *
  * @param $inputs
  *   The structured info array. Look at _draggableviews_info(..) to learn more.
@@ -294,7 +297,8 @@ function _draggableviews_build_hierarchy
     $nodes[$nid]['depth']             = $depth;
   }
 
-  // Last but not least sort nodes and finally assign ascending numbers. This is necessary since this module supports paging.
+  // Last but not least sort nodes and finally assign ascending numbers.
+  // This is necessary since this module supports paging.
   _draggableviews_sort_nodes($nodes);
   // calculate views page offset
   $pager  = $info['view']->pager;
@@ -329,9 +333,12 @@ function _draggableviews_rebuild_hierarc
   _draggableviews_calculate_depths($info);
 
   // Detect and repair ordering errors.
-  // The child node order values on the parent's level have to equal with the parent's order values. If they don't they will be set properly.
-  // In order to avoid ambiguous values we add unique float values ($safe_offset < 1) to all order values. This assures that
-  // child nodes always appear right after their parents even if there are other nodes with the same order value on the parents level.
+  // The child node order values on the parent's level have to equal
+  // with the parent's order values. If they don't equal they will be set properly.
+  // In order to avoid ambiguous values we add unique float
+  // values ($safe_offset < 1) to all order values. This assures that
+  // child nodes always appear right after their parents even if there
+  // are other nodes with the same order value on the parents level.
   $safe_offset = 0;
   foreach ($info['nodes'] AS $nid => $values) {
     $info['nodes'][$nid]['order'][$values['depth']] += $safe_offset;
@@ -339,9 +346,9 @@ function _draggableviews_rebuild_hierarc
   }
   _draggableviews_check_order($info);
 
-  // The last issue we have to deal with is the order itself. Probably there
-  // are more many with the same order value what could lead to display errors.
-  // We just sort the nodes by their current order values and then we subsequently assign ascending numbers.
+  // The last issue we have to deal with is the order itself.
+  // We just sort the nodes by their current order values and
+  // then we subsequently assign ascending numbers.
   _draggableviews_sort_nodes($info['nodes']);
   _draggableviews_ascending_numbers($info, 0, TRUE);
 
Index: draggableviews.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews.module,v
retrieving revision 1.6.2.20
diff -u -p -r1.6.2.20 draggableviews.module
--- draggableviews.module	16 Jul 2009 19:50:56 -0000	1.6.2.20
+++ draggableviews.module	14 Aug 2009 22:37:37 -0000
@@ -11,8 +11,8 @@
 // (This is essential to make sure that child nodes appear right after their parents)
 define('DRAGGABLEVIEWS_SAFE_OFFSET', 0.0001);
 
-require_once './'. drupal_get_path('module', 'draggableviews') ."/draggableviews.inc";
-require_once './'. drupal_get_path('module', 'draggableviews') ."/draggableviews_theme.inc";
+require_once './'. drupal_get_path('module', 'draggableviews') .'/draggableviews.inc';
+require_once './'. drupal_get_path('module', 'draggableviews') .'/draggableviews_theme.inc';
 
 /**
  * Display help and module information
@@ -351,11 +351,11 @@ function draggableviews_view_draggableta
     if (isset($info['order']['field'])) {
       // The input array must have the same structure as the node array.
       // E.g. because of _draggableviews_get_hierarchy_depth(..).
-      $info['input'][$row->nid]['order'][0] = $input[$info['order']['field']['field_name'] .'_'. $row->nid];
+      $info['input'][$row->{$view->base_field}]['order'][0] = $input[$info['order']['field']['field_name'] .'_'. $row->{$view->base_field}];
     }
     // Set parent values.
     if (isset($info['hierarchy'])) {
-      $info['input'][$row->nid]['parent'] = $input[$info['hierarchy']['field']['field_name'] .'_'. $row->nid];
+      $info['input'][$row->{$view->base_field}]['parent'] = $input[$info['hierarchy']['field']['field_name'] .'_'. $row->{$view->base_field}];
     }
   }
 
Index: draggableviews_theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews_theme.inc,v
retrieving revision 1.6.2.21
diff -u -p -r1.6.2.21 draggableviews_theme.inc
--- draggableviews_theme.inc	9 Jul 2009 14:51:23 -0000	1.6.2.21
+++ draggableviews_theme.inc	14 Aug 2009 22:37:37 -0000
@@ -120,17 +120,26 @@ function template_preprocess_draggablevi
   // loop through all rows the view returned
   foreach ($vars['rows'] as $i => $row) {
 
-    $nid = $result[$i]->nid;
+    $nid = $result[$i]->{$view->base_field};
 
     // build indentation (as tabledrag requires)
     $indentation = theme('indentation', $info['nodes'][$nid]['depth']);
 
     // get node object
-    $node = node_load(array('nid' => $nid));
+    switch ($view->base_table) {
+      case 'users':
+        $node = user_load($nid);
+        break;
+      case 'node':
+        $node = node_load(array('nid' => $nid));
+        break;
+    }
 
-    if (isset($info['types'][$node->type])) {
-      // set node type specification, if available (e.g. tabledrag-root)
-      $vars['tabledrag_type'][$i] = 'tabledrag-'. $info['types'][$node->type];
+    if (strcmp($view->base_table, 'node') == 0) {
+      if (isset($info['types'][$node->type])) {
+        // set node type specification, if available (e.g. tabledrag-root)
+        $vars['tabledrag_type'][$i] = 'tabledrag-'. $info['types'][$node->type];
+      }
     }
 
     // Tabledrag needs all concerned fields to be input elements.
@@ -139,16 +148,11 @@ function template_preprocess_draggablevi
     // give them names.
     //
     // Concerned fields are
-    //  *) the first order field
-    //  *) the parent field (if hierarchy used)
-    //
-    // The remaining fields are not used by tabledrag. But - depending
-    // on the depth - one of them will simulate the first order field.
-    // (This behaviour is based on the fact that tabledrag handles each depth as it was the only one.)
-
-    // this for loop should prevent copy->paste'ing code
-    for ($modus = 'hierarchy'; $modus !== FALSE ; $modus = ($modus == 'hierarchy' ? 'order' : FALSE)) {
+    //  *) the order field
+    //  *) the parent field (if hierarchy is used)
 
+    // This for loop should prevent copy->paste'ing code.
+    foreach (array('hierarchy', 'order') AS $modus) {
       if (isset($info[$modus])) {
         if ($modus == 'hierarchy') {
           $value = $info['nodes'][$nid]['parent'];
@@ -158,7 +162,7 @@ function template_preprocess_draggablevi
         }
         else {
           // get depth of current field
-          $depth = $info['nodes'][$node->nid]['depth'];
+          $depth = $info['nodes'][$nid]['depth'];
 
           $value = $info['nodes'][$nid]['order'][$depth];
 
@@ -166,15 +170,16 @@ function template_preprocess_draggablevi
           $field = &$info['order']['field'];
         }
 
-        // get the form element
+        // Get the form element.
         $form_element = $field['handler']->get_form_element($value, array('field_name' => $field['field_name'] .'_'. $nid, 'class' => $field['field_name']));
 
-        // render new form element
+        // Render the new form element.
         $vars['rows'][$i][$field['field_name']] = drupal_render($form_element);
 
         if (!user_access('Allow Reordering') || $info['locked']) {
           // The tabledrag js would hide the input fields (depending on the settings). But the
-          // tabledrag js will not be added (permissions or locked), so we have to hide the input fields on our own.
+          // tabledrag js will not be added (either because of missing permissions or because
+          // the hierarchy is locked), so we have to hide the input fields on our own.
           if (!$info[$modus]['visible']) {
             $vars['style'][$field['field_name']] = 'display: none;';
           }
Index: views/draggableviews.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/views/draggableviews.views.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 draggableviews.views.inc
--- views/draggableviews.views.inc	10 Jul 2009 18:31:02 -0000	1.1.2.6
+++ views/draggableviews.views.inc	14 Aug 2009 22:37:38 -0000
@@ -60,40 +60,49 @@ function draggableviews_views_handlers()
 function draggableviews_views_data() {
   $data = array();
 
-  for ($i = 0; $i < 2; $i++) {
-    $data['draggableviews_structure'. $i]['table'] = array(
-      'group' => t('Draggableviews'),
-      'join' => array(
-        'node' => array(
-          'table' => 'draggableviews_structure',
-          'left_field' => 'nid',
-          'field' => 'nid',
-          'extra' => array(
-            array(
-              'field' => 'delta',
-              'operator' => '=',
-              'value' => $i,
-              'numeric' => TRUE,
+  $base_tables = array(
+    'nid' => 'node',
+    'uid' => 'users',
+    'cid' => 'comments',
+    'vid' => 'node_revisions',
+  );
+
+  foreach ($base_tables AS $base_field => $base_table) {
+    for ($i = 0; $i < 2; $i++) {
+      $data['draggableviews_structure_'. $base_table . $i]['table'] = array(
+        'group' => t('Draggableviews'),
+        'join' => array(
+          $base_table => array(
+            'table' => 'draggableviews_structure',
+            'left_field' => $base_field,
+            'field' => 'nid',
+            'extra' => array(
+              array(
+                'field' => 'delta',
+                'operator' => '=',
+                'value' => $i,
+                'numeric' => TRUE,
+              ),
             ),
           ),
         ),
-      ),
-    );
-    $data['draggableviews_structure'. $i]['value'. $i] = array(
-      'real field' => 'value',
-      'title' => t($i == 0 ? 'Order' : 'Parent'),
-      'field' => array(
-        'handler' => 'views_handler_field_draggableviews_structure',
-        'help' => t('This value provided by draggableviews is unique for each view.'),
-        'click sortable' => $i == 0 ? TRUE : FALSE,
-        'draggableviews_delta' => $i,
-      ),
-    );
-    if ($i == 0) {
-      $data['draggableviews_structure'. $i]['value'. $i]['sort'] = array(
-        'handler' => 'views_handler_sort_draggableviews_structure',
-        'help' => t('Sort by value'),
       );
+      $data['draggableviews_structure_'. $base_table . $i]['value'. $i] = array(
+        'real field' => 'value',
+        'title' => t($i == 0 ? 'Order' : 'Parent'),
+        'field' => array(
+          'handler' => 'views_handler_field_draggableviews_structure',
+          'help' => t('This value provided by draggableviews is unique for each view.'),
+          'click sortable' => $i == 0 ? TRUE : FALSE,
+          'draggableviews_delta' => $i,
+        ),
+      );
+      if ($i == 0) {
+        $data['draggableviews_structure_'. $base_table . $i]['value'. $i]['sort'] = array(
+          'handler' => 'views_handler_sort_draggableviews_structure',
+          'help' => t('Sort by value'),
+        );
+      }
     }
   }
 
@@ -102,8 +111,8 @@ function draggableviews_views_data() {
 
 function draggableviews_views_query_alter(&$view, &$query) {
   for ($i = 0; $i < 2; $i++) {
-    if (isset($query->table_queue['draggableviews_structure'. $i])) {
-      $query->table_queue['draggableviews_structure'. $i]['join']->extra[] = array(
+    if (isset($query->table_queue['draggableviews_structure_'. $view->base_table . $i])) {
+      $query->table_queue['draggableviews_structure_'. $view->base_table . $i]['join']->extra[] = array(
         'field' => 'vid',
         'operator' => '=',
         'value' => is_numeric($view->vid) ? $view->vid : 0,
@@ -115,7 +124,7 @@ function draggableviews_views_query_alte
           $args = implode('/', $view->args);
         }
       }
-      $query->table_queue['draggableviews_structure'. $i]['join']->extra[] = array(
+      $query->table_queue['draggableviews_structure_'. $view->base_table . $i]['join']->extra[] = array(
         'field' => 'args',
         'operator' => '=',
         'value' =>  $args, 
