? .DS_Store
Index: casetracker.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/casetracker/casetracker.module,v
retrieving revision 1.123.2.11
diff -u -r1.123.2.11 casetracker.module
--- casetracker.module	29 May 2009 15:37:04 -0000	1.123.2.11
+++ casetracker.module	8 Jun 2009 16:30:59 -0000
@@ -871,7 +871,7 @@
 function casetracker_project_options() {
   $projects = array();
   // Fetch the views list of projects, which is space-aware.
-  if ($view = views_get_view('casetracker_project_options')) {
+  if ($view = views_get_view(variable_get('casetracker_view_project_options', 'casetracker_project_options'))) {
     $view->set_display();
     $view->set_items_per_page(0);
     $view->execute();
@@ -886,17 +886,20 @@
  * API function that returns valid user options.
  */
 function casetracker_user_options() {
-  $group = module_exists('og') ? og_get_group_context() : NULL;
-  $options = array(0 => variable_get('casetracker_default_assign_to', variable_get('anonymous', t('Anonymous'))));
-  if ($group) {
-    $gid = $group->nid;
-    $results = db_query('SELECT u.uid, u.name FROM {users} u INNER JOIN {og_uid} ou ON u.uid = ou.uid WHERE u.status > 0 AND u.uid > 0 AND ou.nid = %d ORDER BY u.name ASC', $gid);
-  }
-  else {
-    $results = db_query('SELECT u.uid, u.name FROM {users} u WHERE u.status > 0 AND u.uid > 0 ORDER BY u.name ASC');
+  $users = array();
+  $options = array();
+  if ($view = views_get_view(variable_get('casetracker_view_assignee_options', 'casetracker_assignee_options'))) {
+    $view->set_display();
+    $view->set_items_per_page(0);
+    $view->execute();
+    foreach ($view->result as $row) {
+      $options[$row->uid] = $row->users_name;
+    }
   }
-  while ($result = db_fetch_object($results)) {
-    $options[$result->uid] = check_plain($result->name);
+  // fill in anonymous value because view is not rendered and the redundant option in views is irrelevant
+  // @TODO render the view before display so this isn't needed.
+  if (isset($options[0])) {
+    $options[0] = variable_get('casetracker_default_assign_to', variable_get('anonymous', t('Anonymous')));
   }
   return $options;
 }
Index: casetracker.views_default.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/casetracker/casetracker.views_default.inc,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 casetracker.views_default.inc
--- casetracker.views_default.inc	1 Jun 2009 02:09:07 -0000	1.3.2.2
+++ casetracker.views_default.inc	8 Jun 2009 16:30:59 -0000
@@ -8,6 +8,7 @@
   $list = array(
     'casetracker_project_options',
     'casetracker_project_cases',
+    'casetracker_assignee_options',
   );
   $views = array();
   foreach ($list as $view_name) {
@@ -56,20 +57,6 @@
   }
 
   $filters = array(
-    'current' => array(
-      'operator' => 'active',
-      'value' => 'all',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'current',
-      'table' => 'spaces',
-      'field' => 'current',
-      'relationship' => 'none',
-    ),
     'status' => array(
       'operator' => '=',
       'value' => 1,
@@ -99,9 +86,6 @@
       'relationship' => 'none',
     ),
   );
-  if (!module_exists('spaces')) {
-    unset($filters['current']);
-  }
   $handler->override_option('filters', $filters);
   $handler->override_option('access', array(
     'type' => 'none',
@@ -110,6 +94,77 @@
   return $view;
 }
 
+function _view_casetracker_assignee_options() {
+  $view = new view;
+  $view->name = 'casetracker_assignee_options';
+  $view->description = 'Case tracker > Users by project page';
+  $view->tag = '';
+  $view->view_php = '';
+  $view->base_table = 'users';
+  $view->is_cacheable = FALSE;
+  $view->api_version = 2;
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'link_to_user' => 0,
+      'overwrite_anonymous' => 0,
+      'anonymous_text' => '',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'users',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'uid' => array(
+      'label' => 'Uid',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'link_to_user' => 0,
+      'exclude' => 0,
+      'id' => 'uid',
+      'table' => 'users',
+      'field' => 'uid',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'none',
+  ));
+  
+  return $view;
+}
 function _view_casetracker_project_cases() {
   $view = new view;
   $view->name = 'casetracker_project_cases';
Index: casetracker_admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/casetracker/casetracker_admin.inc,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 casetracker_admin.inc
--- casetracker_admin.inc	10 Mar 2009 12:53:45 -0000	1.2.2.3
+++ casetracker_admin.inc	8 Jun 2009 16:30:59 -0000
@@ -54,6 +54,32 @@
     '#description' => t('Select the node types that will be considered Case Tracker cases.'),
   );
   
+  $all_views = views_get_all_views();
+  $node_views = array();
+  $user_views = array();
+  foreach($all_views AS $view) {
+    if($view->base_table == 'node') {
+      $node_views[$view->name] = $view->name;
+    } else if($view->base_table = 'users') {
+      $user_views[$view->name] = $view->name;
+    }
+  }
+  $form['casetracker_general']['casetracker_view_project_options'] = array(
+    '#type' => 'select',
+    '#title' => t('Project options view'),
+    '#options' => $node_views,
+    '#default_value' => variable_get('casetracker_view_project_options', 'casetracker_project_options'),
+    '#description' => t('Select the view from which to fill the project selector on the add case page.'),
+  );
+  
+  $form['casetracker_general']['casetracker_view_assignee_options'] = array(
+    '#type' => 'select',
+    '#title' => t('Assignee options view'),
+    '#options' => $user_views,
+    '#default_value' => variable_get('casetracker_view_assignee_options', 'casetracker_assignee_options'),
+    '#description' => t('Select the view from which to fill the user assignment options on the add case page'),
+  );
+  
   $form['#submit'][] = 'casetracker_settings_submit';
   return system_settings_form($form);
 }
