Index: modules/project_issue/project_issue.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v retrieving revision 1.54 diff -u -p -u -p -r1.54 project_issue.module --- modules/project_issue/project_issue.module 4 Oct 2007 17:32:56 -0000 1.54 +++ modules/project_issue/project_issue.module 6 Oct 2007 06:54:18 -0000 @@ -339,7 +339,11 @@ function project_issue_menu($may_cache) } } - drupal_add_css(drupal_get_path('module', 'project_issue') .'/project_issue.css'); + $project_issue_path = drupal_get_path('module', 'project_issue'); + if (module_exists('views')) { + require './'. $project_issue_path .'/project_issue_views.inc'; + } + drupal_add_css($project_issue_path .'/project_issue.css'); } return $items; } Index: modules/project_issue/project_issue_views.inc =================================================================== RCS file: modules/project_issue/project_issue_views.inc diff -N modules/project_issue/project_issue_views.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/project_issue/project_issue_views.inc 6 Oct 2007 06:54:18 -0000 @@ -0,0 +1,129 @@ + 'project_issues', + 'join' => array( + 'type' => 'inner', + 'left' => array( + 'table' => 'node', + 'field' => 'nid' + ), + 'right' => array( + 'field' => 'nid' + ), + ), + 'fields' => array( + // To be useful, 'pid' requires another JOIN on {node}, so see + // the project_issue_project_node definition below. + 'category' => array( + 'name' => t('Project Issue: Category'), + 'sortable' => true, + 'help' => t('The issue\'s category (bug, task, feature, etc).'), + ), + 'component' => array( + 'name' => t('Project Issue: Component'), + 'sortable' => true, + 'help' => t('The issue\'s component (the options are controlled per-project).'), + ), + 'priority' => array( + 'name' => t('Project Issue: Priority'), + 'handler' => 'views_handler_field_project_issue_priority', + 'sortable' => true, + 'help' => t('The issue\'s priority (critical, normal, minor).'), + ), +/* + 'rid' => array( + 'name' => t('Project Issue: Version'), + 'query_handler' => 'views_query_handler_field_project_issue_version', + 'handler' => 'views_handler_field_project_issue_version', + 'addlfields' => array('version'), + 'sortable' => true, + 'help' => t('The version associated with the issue (depends on project_release.module)'); + ), +*/ + // TODO: handlers + 'assigned' => array( + 'name' => t('Project Issue: Assigned'), + 'help' => t('The user a given issue is assigned to.'), + 'sortable' => true, + ), + // TODO: handlers + 'sid' => array( + 'name' => t('Project Issue: Status'), + 'help' => t('The status of each issue.'), + 'sortable' => true, + ), + ), + ); + + $tables['project_issue_project_node'] = array( + 'name' => 'node', + 'join' => array( + 'type' => 'inner', + 'left' => array( + 'table' => 'project_issues', + 'field' => 'pid' + ), + 'right' => array( + 'field' => 'nid' + ), + ), + 'fields' => array( + 'title' => array( + 'name' => t('Project Issue Project Node: Title'), + 'handler' => array( + 'views_handler_field_nodelink' => t('Normal'), + 'views_handler_field_nodelink_with_mark' => t('With updated mark') + ), + ), + ), + ); + return $tables; +} + +/** + * Displays a field indicating the priority of an issue. + */ +function views_handler_field_project_issue_priority($fieldinfo, $fielddata, $value, $data) { + return project_issue_priority($value); +} + +/** + * Modifies the query for views that include a field for the issue's + * version, and JOIN's against {node} and {project_release_nodes} to + * find the version string of a given release id (rid). + * + * @todo Need to figure out how to make this really work. + */ +function views_query_handler_field_project_issue_version($fielddata, $fieldinfo, &$query) { +/* + $joininfo = array( + 'type' => 'LEFT', + 'left' => array( + 'table' => 'project_issues', + 'field' => 'rid' + ), + 'right' => array( + 'field' => 'nid' + ), + ); + $num = $query->add_table('node', false, 1, $joininfo); + $query->add_field('version', $query->get_table_name('node', $num), $field['tablename'] . '_name'); +*/ +} + +function views_handler_field_project_issue_version($fieldinfo, $fielddata, $value, $data) { + /// @todo +}