--- casetracker.module.orig 2007-01-30 02:34:28.000000000 +0000 +++ casetracker.module 2007-02-01 10:42:49.000000000 +0000 @@ -821,8 +821,33 @@ function casetracker_projects_overview($ $node_types = node_get_types('names'); $rows = array(); while ($result = db_fetch_object($results)) { + + // providing preselected audience checkboxes for projects as groups (og) + // checking if project is group + $node_result = node_load($result->nid); + if ($node_result->type == 'group') { + $querystring = 'gids[]='.$node_result->nid; + //checking if group-project is part of another group + if ($node_result->og_groups) { + foreach ($node_result->og_groups as $group) { + $querystring .= '&gids[]='.$group; + } + } + } + //checking if project is part of a group + elseif ($node_result->og_groups && $node_result->type !== 'group') { + $n = 0; + foreach ($node_result->og_groups as $group) { + $n == 0 ? $querystring = 'gids[]='.$group : $querystring .= '&gids[]='.$group; + $n = $n + 1; + } + } + //leaving empty if project has nothing to do with groups + else { + $querystring = NULL; + } $operations = array(array('data' => l(t('view cases'), 'casetracker/cases/'.$result->nid.'/all'), 'class' => 'operation')); - foreach ($case_types as $case_type) { $operations[] = array('data' => l(t('add !name', array('!name' => $node_types[$case_type])), 'node/add/'.$case_type.'/'.$result->nid), 'class' => 'operation'); } + foreach ($case_types as $case_type) { $operations[] = l(t('add !name', array('!name' => $node_types[$case_type])), 'node/add/'.$case_type.'/'.$result->nid, array(), $querystring); } $rows[] = array_merge(array(array('data' => $result->project_number, 'class' => 'project-number'), array('data' => l($result->title, 'node/'.$result->nid), 'class' => 'title')), $operations); } if (count($rows) == 0) { $rows[] = array(array('data' => t('No projects found.'), 'colspan' => 3 + $colspan_count)); } @@ -876,9 +901,33 @@ function theme_casetracker_project_summa $rows[] = array(t('Opened on:'), format_date($project->created, 'large')); $rows[] = array(t('Last modified:'), format_date($project->changed, 'large')); + // providing preselected audience checkboxes for projects as groups (og) + // checking if project is group + if ($project->type == 'group') { + $querystring = 'gids[]='.$project->nid; + //checking if group-project is part of another group + if ($project->og_groups) { + foreach ($project->og_groups as $group) { + $querystring .= '&gids[]='.$group; + } + } + } + //checking if project is part of a group + elseif ($project->og_groups && $project->type !== 'group') { + $n = 0; + foreach ($project->og_groups as $group) { + $n == 0 ? $querystring = 'gids[]='.$group : $querystring .= '&gids[]='.$group; + $n = $n + 1; + } + } + //leaving empty if project has nothing to do with groups + else { + $querystring = NULL; + } + $operations = array(); $node_types = node_get_types('names'); foreach (array_filter(variable_get('casetracker_case_node_types', array('casetracker_basic_case'))) as $type) { - $operations[] = l(t('add !name', array('!name' => $node_types[$type])), 'node/add/'.$type.'/'.$project->nid); + $operations[] = l(t('add !name', array('!name' => $node_types[$type])), 'node/add/'.$type.'/'.$project->nid, array(), $querystring); } $operations = implode(' | ', $operations); // ready for printing in our Operations table cell - delimited by a pipe. nonstandard. $rows[] = array(t('Operations:'), $operations.' | '.l(t('view all project cases'), 'casetracker/cases/'.$project->nid.'/all'));