'Bug bingo',
'page callback' => 'bingo_jump',
'page arguments' => array('bug-core'),
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items['contrib-bug-bingo'] = array(
'title' => 'Contrib bug bingo',
'page callback' => 'bingo_jump',
'page arguments' => array('bug-contrib'),
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items['patch-bingo'] = array(
'title' => 'Patch bingo',
'page callback' => 'bingo_jump',
'page arguments' => array('patch-core'),
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items['contrib-patch-bingo'] = array(
'title' => 'Contrib patch bingo',
'page callback' => 'bingo_jump',
'page arguments' => array('patch-contrib'),
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
return $items;
}
/**
* SQL randomizer for issues.
*/
function bingo_jump($type = NULL) {
$sql = array(
// Bug, core.
'bug-core' => "SELECT nid FROM {project_issues} WHERE sid IN (1) AND category = 'bug' AND pid = 3060 ORDER BY RAND() LIMIT 1",
// Bug, contrib.
'bug-contrib' => "SELECT nid FROM {project_issues} WHERE sid IN (1) AND category = 'bug' AND pid != 3060 ORDER BY RAND() LIMIT 1",
// Patch, core.
'patch-core' => "SELECT nid FROM {project_issues} WHERE sid IN (8,13,14) AND pid = 3060 ORDER BY RAND() LIMIT 1",
// Patch, contrib.
'patch-contrib' => "SELECT nid FROM {project_issues} WHERE sid IN (8,13,14) AND pid != 3060 ORDER BY RAND() LIMIT 1",
);
if (!isset($type) || !isset($sql[$type])) {
$type = 'bug-core';
}
$nid = db_result(db_query($sql[$type]));
if ($_GET['stop'] != 1) {
drupal_goto('node/'. $nid);
}
}
/**
* Implementation of hook_block().
*/
function bingo_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Contributor links');
return $blocks;
case 'view':
$block['subject'] = t('Contributor links');
$block['content'] = bingo_block_output();
return $block;
}
}
/**
* Output links with issue counts for different types of issues.
*/
function bingo_block_output() {
$counts = variable_get('drupalorg_issue_counts', array());
$counts_pending = $counts['Pending bugs'];
$counts_critical = $counts['Critical issues'];
$counts_queue = $counts['Patch queue'];
$counts_review = $counts['Patches to review'];
$versions = array_map('trim', explode(',', ISSUE_RIDS));
$links = array(
l('Community initiatives', 'community-initiatives'),
array(
'data' => 'Queues',
'children' => array(
l('My issues', 'project/issues/user'),
drupalorg_drupal_issue_link(
$counts_pending .' Pending bugs (D7)',
array(
'version' => $versions,
'status' => array(1),
'priorities' => array(1, 2, 4),
'categories' => array('bug'),
)
),
drupalorg_drupal_issue_link(
$counts_critical .' Critical issues (D7)',
array(
'version' => $versions,
'status' => array(1, 8, 13, 14),
'priorities' => array(1),
'categories' => array('bug', 'task'),
)
),
drupalorg_drupal_issue_link(
$counts_queue .' Patch queue (D7)',
array(
'version' => $versions,
'status' => array(8, 13, 14),
)
),
drupalorg_drupal_issue_link(
$counts_review .' Patches to review (D7)',
array(
'version' => $versions,
'status' => array(8, 14),
)
),
drupalorg_drupal_issue_link(
'Performance issues (D7)',
array(
'version' => array('7.x'),
'issue_tags' => 'Performance',
)
),
drupalorg_drupal_issue_link(
'Usability issues (D7)',
array(
'version' => array('7.x'),
'issue_tags' => 'Usability, d7ux',
)
),
drupalorg_drupal_issue_link(
'Accessibility issues (D7)',
array(
'version' => array('7.x'),
'issue_tags' => 'accessibility',
)
),
),
),
array(
'data' => 'Play patch bingo!',
'children' => array(
l('Drupal Core', 'patch-bingo', array('attributes' => array('title' => 'Select a random patch for review'))),
l('Contributions', 'contrib-patch-bingo', array('attributes' => array('title' => 'Select a random patch for review from the contributions'))),
),
),
array(
'data' => 'Play bug bingo!',
'children' => array(
l('Drupal Core', 'bug-bingo', array('attributes' => array('title' => 'Select a random bug to fix'))),
l('Contributions', 'contrib-bug-bingo', array('attributes' => array('title' => 'Select a random bug to fix from the contributions'))),
),
),
l('Mailing list archives', 'mailing-lists'),
l('Drupal.org webmasters', 'project/issues/webmasters'),
l('Drupal.org server administrators', 'project/issues/infrastructure'),
l('Drupal.org CVS applications', 'project/issues/cvsapplications'),
array(
'data' => 'Web links',
'children' => array(
l('Planet Drupal', 'planet'),
l('Drupal talk', 'talk'),
l('Drupal dojo', 'http://groups.drupal.org/drupal-dojo'),
),
),
);
return theme('item_list', $links);
}