rendered paste bodyfunction project_project_view($node, $teaser = false, $page = false) {
$node = node_prepare($node, $teaser);
if ($page) {
// Breadcrumb navigation
project_project_set_breadcrumb($node);
// If theme_project_release_project_download_table is implemented, format
// the download table. If this function is not implemented (eg. if the
// project_release module is not enabled), there will not be an error
// but of course there will be no release table.
$project_table_output = theme('project_release_project_download_table', $node);
if (!empty($project_table_output)) {
$node->content['download_table'] = array(
'#value' => $project_table_output,
'#weight' => 1,
);
}
// Misc section
$links = array();
foreach (array('homepage' => t('Home page'), 'documentation' => t('Read documentation'), 'license' => t('Read license'), 'changelog' => t('Read complete log of changes'), 'demo' => t('Try out a demonstration'), 'screenshots' => t('Look at screenshots')) as $uri => $name) {
if (!empty($node->$uri)) {
$links[] = l($name, $node->$uri);
}
}
if ($links) {
$node->content['resources'] = array(
'#value' => theme('item_list', $links, t('Resources')),
'#weight' => 2,
);
}
// Flags that indicate what kind of access to project issues to allow.
$has_issues = module_exists('project_issue') && !empty($node->issues);
$view_issues = $has_issues && (user_access('access project issues') || user_access('access own project issues') || user_access('administer projects'));
$make_issues = $has_issues && node_access('create', 'project_issue');
// Support section.
$links = array();
if ($view_issues) {
$links[] = l(t('View all support requests'), 'project/issues/'. $node->uri, null, 'categories=support&states=all', null);
$links[] = l(t('View pending support requests'), 'project/issues/'. $node->uri, null, 'categories=support', null);
$links[] = l(t('View pending bug reports'), 'project/issues/'. $node->uri, null, 'categories=bug', null);
$links[] = l(t('View pending feature requests'), 'project/issues/'. $node->uri, null, 'categories=feature', null);
}
if ($make_issues) {
$links[] = l(t('Request support'), 'node/add/project_issue/'. $node->uri .'/support');
$links[] = l(t('Report new bug'), 'node/add/project_issue/'. $node->uri .'/bug');
$links[] = l(t('Request new feature'), 'node/add/project_issue/'. $node->uri .'/feature');
}
else {
$links[] = theme('project_issue_create_forbidden', $node->uri);
}
if ($links) {
$node->content['support'] = array(
'#value' => theme('item_list', $links, t('Support')),
'#weight' => 3,
);
}
// Developer section
$links = array();
if ($view_issues) {
$links[] = l(t('View pending patches'), 'project/issues/'. $node->uri, null, 'states=8,13,14', null);
$links[] = l(t('View available tasks'), 'project/issues/'. $node->uri, null, 'categories=task', null);
$links[] = l(t('View all pending issues'), 'project/issues/'. $node->uri);
}
if ($node->cvs) {
$links[] = l(t('Browse the CVS repository'), $node->cvs);
}
if (project_use_cvs($node)) {
$links[] = l(t('View CVS messages'), 'project/cvs/'. $node->nid);
$links[] = l(t('Developers'), 'project/developers/'. $node->nid);
}
if ($links) {
$node->content['development'] = array(
'#value' => theme('item_list', $links, t('Development')),
'#weight' => 4,
);
}
}
return $node;
}