Index: draggableviews.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews.install,v
retrieving revision 1.6.2.5
diff -w -u -p -r1.6.2.5 draggableviews.install
--- draggableviews.install	14 Mar 2009 19:43:01 -0000	1.6.2.5
+++ draggableviews.install	12 Jun 2009 17:10:21 -0000
@@ -66,6 +66,11 @@ function draggableviews_schema() {
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
+      'args' => array (
+        'description' => t('Makes the order unique for a given set of arguments'),
+        'type' => 'varchar',
+        'length' => 255,
+      ),
       'value' => array(
         'description' => t('The value.'),
         'type' => 'int',
@@ -74,7 +79,7 @@ function draggableviews_schema() {
         'default' => 0,
       ),
     ),
-    'primary key' => array('vid', 'nid', 'delta'),
+    'primary key' => array('vid', 'nid', 'delta', 'args'),
   );
   return $schema;
 }
@@ -113,3 +118,15 @@ function draggableviews_update_6301() {
   db_add_primary_key($ret, 'draggableviews_collapsed', array('uid', 'vid', 'parent_nid'));
   return $ret;
 }
+
+/**
+ * Alter schema to add arguments field 
+ */
+function draggableviews_update_6400() {
+  $ret = array();
+  $ret[] = update_sql('ALTER TABLE {draggableviews_structure} DROP PRIMARY KEY');
+  db_add_field($ret, 'draggableviews_structure', 'args', array('type' => 'varchar', 'length' => 255,));
+  db_add_primary_key($ret, 'draggableviews_structure', array('nid', 'vid', 'delta', 'args'));
+  return $ret;
+}
+
Index: draggableviews_theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/draggableviews_theme.inc,v
retrieving revision 1.6.2.20
diff -w -u -p -r1.6.2.20 draggableviews_theme.inc
--- draggableviews_theme.inc	2 May 2009 22:10:33 -0000	1.6.2.20
+++ draggableviews_theme.inc	12 Jun 2009 17:10:21 -0000
@@ -427,6 +427,8 @@ function theme_draggableviews_ui_style_p
 
   $draggableviews_default_on_top = drupal_render($form['draggableviews_default_on_top']);
 
+  $draggableviews_arguments = drupal_render($form['draggableviews_arguments']);
+
   // Let extension modules append to the output
   $extensions = array();
   foreach (module_implements('draggableviews_style_plugin_render') as $module) {
@@ -468,6 +470,8 @@ function theme_draggableviews_ui_style_p
   $output .= $tabledrag_lock;
   // Append default behaviour radios.
   $output .= $draggableviews_default_on_top;
+  // Append argument checkbox.
+  $output .= $draggableviews_arguments;
   // append extension modules output
   $output .= implode('', $extensions);
 
Index: implementations/draggableviews_handler_native.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/implementations/Attic/draggableviews_handler_native.inc,v
retrieving revision 1.1.2.6
diff -w -u -p -r1.1.2.6 draggableviews_handler_native.inc
--- implementations/draggableviews_handler_native.inc	8 Mar 2009 01:16:33 -0000	1.1.2.6
+++ implementations/draggableviews_handler_native.inc	12 Jun 2009 17:10:21 -0000
@@ -28,8 +28,14 @@ class draggableviews_handler_native {
   }
 
   function save($nid, $value) {
-    db_query('DELETE FROM {draggableviews_structure} WHERE vid=%d AND nid=%d AND delta=%d', $this->view->vid, $nid, $this->delta);
-    db_query('INSERT INTO {draggableviews_structure}(vid, nid, delta, value) VALUES(%d, %d, %d, %d)', $this->view->vid, $nid, $this->delta, $value);
+    $args = NULL;
+
+    if (!empty($this->view->style_plugin->options['draggableviews_arguments']['use_args'])) {
+      $args = implode('/', $this->view->args);
+    }
+
+    db_query("DELETE FROM {draggableviews_structure} WHERE vid=%d AND nid=%d AND delta=%d AND args='%s'", $this->view->vid, $nid, $this->delta, $args);
+    db_query("INSERT INTO {draggableviews_structure}(vid, nid, delta, value, args) VALUES(%d, %d, %d, %d, '%s')", $this->view->vid, $nid, $this->delta, $value, $args);
   }
 
   function get_form_element($value, $attributes = array()) {
Index: views/draggableviews.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/views/draggableviews.views.inc,v
retrieving revision 1.1.2.4
diff -w -u -p -r1.1.2.4 draggableviews.views.inc
--- views/draggableviews.views.inc	22 Mar 2009 13:58:50 -0000	1.1.2.4
+++ views/draggableviews.views.inc	12 Jun 2009 17:10:21 -0000
@@ -109,6 +109,17 @@ function draggableviews_views_query_alte
           'value' => is_numeric($view->vid) ? $view->vid : 0,
           'numeric' => TRUE,
       );
+      if (!empty($view->style_plugin->options['draggableviews_arguments']['use_args'])) {
+        $args = NULL;
+        if(!empty($view->args)) {
+          $args = implode('/', $view->args);
+        }
+        $query->table_queue['draggableviews_structure'. $i]['join']->extra[] = array(
+          'field' => 'args',
+          'operator' => '=',
+          'value' =>  $args, 
+        );
+      }
     }
   }
 }
Index: views/draggableviews_plugin_style_draggabletable.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/draggableviews/views/draggableviews_plugin_style_draggabletable.inc,v
retrieving revision 1.1.2.19
diff -w -u -p -r1.1.2.19 draggableviews_plugin_style_draggabletable.inc
--- views/draggableviews_plugin_style_draggabletable.inc	10 May 2009 16:43:51 -0000	1.1.2.19
+++ views/draggableviews_plugin_style_draggabletable.inc	12 Jun 2009 17:10:21 -0000
@@ -114,6 +114,7 @@ class draggableviews_plugin_style_dragga
     // + Set field to save the parent in
     // + Apply tabledrag-type to content-types (Root (can't have parent), Leaf (can't have children)).
     // + Set if expand/collapse links should be shown
+    // + Toggle tracking of order with respect to View arguments
 
     $input = array();
     $input = $form_state['input'];
@@ -307,6 +308,14 @@ class draggableviews_plugin_style_dragga
       '#options' => array(t('On Bottom'), t('On Top')),
     );
 
+    $form['draggableviews_arguments'] = array(
+      '#type' => 'checkboxes',
+      '#name' => 'draggableviews_arguments',
+      '#options' => array('use_args' => t('Use arguments as well as view ID to order nodes.')),
+      '#description' => t('If checked, nodes can be reordered for any set of views arguments.  Use with care: If you have many combinations of arguments, your database could become very large.'),
+      '#default_value' => isset($current['draggableviews_arguments']) ? $current['draggableviews_arguments'] : array(),
+    );
+
     // Let extension modules alter the output
     foreach (module_implements('draggableviews_style_plugin_form_alter') as $module) {
       $function = $module .'_draggableviews_style_plugin_form_alter';
