';
@@ -170,13 +173,13 @@ function _project_comment_view_single($c
}
if ($comment->file_path && file_exists($comment->file_path)) {
- $summary[] = array(t('Attachment:'), '
'. basename($comment->file_path) .' ('. format_size($comment->file_size) .')');
+ $summary[] = array(t('Attachment:'), '
'. basename($comment->file_path) .' ('. format_size($comment->file_size) .')');
}
if ($summary || $comment->body) {
if ($count) {
$output .= '';
}
if ($summary) {
@@ -235,7 +238,7 @@ function project_comment_save($edit) {
_content_widget_invoke('process form values', $node);
}
- watchdog('content', t('project_issue: added comment %title', array('%title' => $edit->title)), WATCHDOG_NOTICE, l('view', "node/$node->nid"));
+ watchdog('content', 'project_issue: added comment %title', array('%title' => $edit->title), WATCHDOG_NOTICE, l('view', "node/$node->nid"));
$node->changed = time();
db_query("INSERT INTO {project_comments} (cid, nid, uid, created, changed, body, data, file_path, file_mime, file_size) VALUES (%d, %d, %d, %d, %d, %b, %b, '%s', '%s', %d)", $edit->cid, $edit->nid, $edit->uid, $node->changed, $node->changed, $edit->body, serialize($data), $file->filepath, $file->filemime, $file->filesize);
Index: issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.232
diff -u -u -p -r1.232 issue.inc
--- issue.inc 22 Jun 2007 12:05:18 -0000 1.232
+++ issue.inc 8 Jul 2007 14:58:53 -0000
@@ -1,13 +1,13 @@
nid && node_access('view', $project)) {
- $query = new StdClass();
+ $query = new stdClass();
$query->projects = array($project->nid);
project_issue_query_result($query, 'rss');
@@ -51,7 +51,7 @@ function project_issue_page() {
default:
$project = project_issue_build_form_url(arg(2));
if ($project->nid && node_access('view', $project)) {
- $query = new StdClass();
+ $query = new stdClass();
$query->projects = array($project->nid);
return project_issue_query_result($query);
@@ -343,32 +343,31 @@ function project_issue_statistics($proje
return $output;
}
-function project_issue_subscribe_submit($form_id, $form_values) {
-
+function project_issue_subscribe_submit($form, &$form_state) {
global $user;
$all = $_POST['all'];
$levels = array(0 => t('None'), 1 => t('Own issues'), 2 => t('All issues'));
- // Remove previous subscriptions for user.
- if ($nid = $form_values['single']) {
- db_query('DELETE FROM {project_subscriptions} WHERE nid = %d AND uid = %d', $nid, $user->uid);
- }
- else {
- db_query('DELETE FROM {project_subscriptions} WHERE uid = %d', $user->uid);
- }
+ // Remove previous subscriptions for user.
+ if ($nid = $form_state['values']['single']) {
+ db_query('DELETE FROM {project_subscriptions} WHERE nid = %d AND uid = %d', $nid, $user->uid);
+ }
+ else {
+ db_query('DELETE FROM {project_subscriptions} WHERE uid = %d', $user->uid);
+ }
- if ($all) {
- $_level = array_search($all, $levels);
- }
+ if ($all) {
+ $_level = array_search($all, $levels);
+ }
- foreach ($form_values['options'] as $nid => $level) {
- if ($_level !== 0 && $level !== 0) {
- db_query('INSERT INTO {project_subscriptions} (nid, uid, level) VALUES (%d, %d, %d)', $nid, $user->uid, $_level ? $_level : $level);
- }
+ foreach ($form_state['values']['options'] as $nid => $level) {
+ if ($_level !== 0 && $level !== 0) {
+ db_query('INSERT INTO {project_subscriptions} (nid, uid, level) VALUES (%d, %d, %d)', $nid, $user->uid, $_level ? $_level : $level);
}
- drupal_set_message(t('Subscription settings saved.'));
- drupal_goto('project/issues/subscribe-mail');
+ }
+ drupal_set_message(t('Subscription settings saved.'));
+ drupal_goto('project/issues/subscribe-mail');
}
@@ -490,7 +489,8 @@ function project_issue_form($node, $para
$form['#attributes'] = array('enctype' => 'multipart/form-data');
// Set the pre-render function for adjustments to the form stages
- $form['#pre_render'] = array('project_issue_form_pre_render');
+ // @TODO: what do we do now?
+//$form['#pre_render'] = array('project_issue_form_pre_render');
$form['page'] = array(
'#type' => 'hidden',
@@ -762,33 +762,30 @@ function _project_issue_form_add_require
}
}
-function project_issue_node_form_validate($form_id, $form) {
- global $form_values;
+function project_issue_node_form_validate($form, &$form_state) {
$edit = $_POST;
- if (!$form_values['pid']) {
+ if (!$form_state['values']['pid']) {
form_set_error('pid', t('You have to specify a valid project.'));
}
- if ($form_values['page'] == 2) {
- if ($form_values['pid'] && $project = node_load($form_values['pid'])) {
- $node->title = $form_values['title'];
+ if ($form_state['values']['page'] == 2) {
+ if ($form_state['values']['pid'] && $project = node_load($form_state['values']['pid'])) {
+ $node->title = $form_state['values']['title'];
if (module_exists('project_release') &&
$releases = project_release_get_releases($project, 0)) {
- empty($form_values['rid']) and form_set_error('rid', t('You have to specify a valid version.'));
+ empty($form_state['values']['rid']) and form_set_error('rid', t('You have to specify a valid version.'));
}
- if ($form_values['component'] && !in_array($form_values['component'], $project->components)) {
- $form_values['component'] = 0;
+ if ($form_state['values']['component'] && !in_array($form_state['values']['component'], $project->components)) {
+ $form_state['values']['component'] = 0;
}
- empty($form_values['component']) && form_set_error('component', t('You have to specify a valid component.'));
- empty($form_values['category']) && form_set_error('category', t('You have to specify a valid category.'));
- empty($form_values['title']) && form_set_error('title', t('You have to specify a valid title.'));
- empty($form_values['body']) && form_set_error('body', t('You have to specify a valid description.'));
-
- if ($file = file_check_upload('file_issue')) {
- if (project_issue_validate_file($file)) {
- $form_values['file'] = file_save_upload($file);
- }
+ empty($form_state['values']['component']) && form_set_error('component', t('You have to specify a valid component.'));
+ empty($form_state['values']['category']) && form_set_error('category', t('You have to specify a valid category.'));
+ empty($form_state['values']['title']) && form_set_error('title', t('You have to specify a valid title.'));
+ empty($form_state['values']['body']) && form_set_error('body', t('You have to specify a valid description.'));
+
+ if ($file = file_save_upload('file_issue', array('project_issue_validate_file'))) {
+ $form_state['values']['file'] = $file;
}
}
}
@@ -858,9 +855,8 @@ function project_issue_comment_validate(
}
}
- $file = file_check_upload('file_issue');
- if ($file && project_issue_validate_file($file)) {
- $node->file = file_save_upload($file);
+ if ($file = file_save_upload('file_issue', array('project_issue_validate_file'))) {
+ $node->file = $file;
}
}
elseif (isset($node->pid)) {
@@ -873,7 +869,7 @@ function project_issue_comment_validate(
/**
* Ensure only files with allowed extension are uploaded.
- *
+ * @TODO: are the right arguments passed?
*/
function project_issue_validate_file($file) {
global $user;
@@ -914,7 +910,7 @@ function project_issue_view($node, $teas
$rows[] = array(t('Assigned:'), $assigned);
$rows[] = array(t('Status:'), project_issue_state($node->sid));
if ($node->file_path && file_exists($node->file_path)) {
- $rows[] = array(t('Attachment:'), '
'. basename($node->file_path) .' ('. format_size($node->file_size) .')');
+ $rows[] = array(t('Attachment:'), '
'. basename($node->file_path) .' ('. format_size($node->file_size) .')');
}
$node->content['project_issue_summary'] = array(
'#value' => '
'. theme('table', array(), $rows) .'
',
@@ -1034,7 +1030,7 @@ function project_issue_state($sid = 0, $
}
}
- foreach($options as $state) {
+ foreach ($options as $state) {
if ($restrict) {
// Check if user has access, or if status is default status and therefore available to all,
// or if user is original issue poster and poster is granted access
@@ -1121,7 +1117,7 @@ function project_issue_query($project =
drupal_set_title(t('Search issues for all projects'));
}
if (is_null($query)) {
- $query = new StdClass();
+ $query = new stdClass();
}
$states = project_issue_state();
$priorities = project_issue_priority();
@@ -1311,7 +1307,7 @@ function theme_project_issue_admin_state
drupal_render($form['status_add']['default_query']),
NULL, NULL,
);
- $output = '
' . theme('table', $header, $rows) . '
';
+ $output = '
'. theme('table', $header, $rows) .'
';
$output .= drupal_render($form);
return $output;
}
@@ -1384,14 +1380,14 @@ function project_issue_admin_states_form
/**
* Submit handler for project_issue_admin_states_form.
*/
-function project_issue_admin_states_form_submit($form_id, $form_values) {
+function project_issue_admin_states_form_submit($form, &$form_state) {
// Check for and apply changes or additions to project issue status options.
- if (isset($form_values['default_state'])) {
- variable_set('project_issue_default_state', $form_values['default_state']);
+ if (isset($form_state['values']['default_state'])) {
+ variable_set('project_issue_default_state', $form_state['values']['default_state']);
}
// Update existing status options.
- if($form_values['status']) {
- foreach ($form_values['status'] as $sid => $value) {
+ if ($form_state['values']['status']) {
+ foreach ($form_state['values']['status'] as $sid => $value) {
$state = db_fetch_object(db_query('SELECT name, weight, author_has, default_query FROM {project_issue_state} WHERE sid = %d', $sid));
// Check to see whether the record needs updating.
if (($state->name != $value['name']) || ($state->weight != $value['weight']) || ($state->author_has != $value['author_has']) || ($state->default_query != $value['default_query'])) {
@@ -1400,14 +1396,14 @@ function project_issue_admin_states_form
}
}
// Add any new status options.
- if (isset($form_values['status_add']) && !empty($form_values['status_add']['name'])) {
+ if (isset($form_state['values']['status_add']) && !empty($form_state['values']['status_add']['name'])) {
// Check to see whether the state already exists:
- $query = db_query("SELECT name FROM {project_issue_state} WHERE name = '%s'", $form_values['status_add']['name']);
+ $query = db_query("SELECT name FROM {project_issue_state} WHERE name = '%s'", $form_state['values']['status_add']['name']);
if (!db_num_rows($query)) {
- db_query("INSERT INTO {project_issue_state} (name, weight, author_has, default_query) VALUES ('%s', %d, %d, %d)", $form_values['status_add']['name'], $form_values['status_add']['weight'], $form_values['status_add']['author_has'], $form_values['status_add']['default_query']);
+ db_query("INSERT INTO {project_issue_state} (name, weight, author_has, default_query) VALUES ('%s', %d, %d, %d)", $form_state['values']['status_add']['name'], $form_state['values']['status_add']['weight'], $form_state['values']['status_add']['author_has'], $form_state['values']['status_add']['default_query']);
}
else {
- drupal_set_message(t('Status %status already exists.', array ('%status' => $form_values['status_add']['name'])));
+ drupal_set_message(t('Status %status already exists.', array('%status' => $form_state['values']['status_add']['name'])));
}
}
}
@@ -1444,16 +1440,16 @@ function project_issue_delete_state_conf
);
}
-function project_issue_delete_state_confirm_submit($form_id, $form_values) {
- if($form_values['new_sid'] == $form_values['sid']) {
- form_set_error('new_sid', t('Choose a new issue status for
- existing issues of status %name.', array('%name' => $form_values['name'])));
- } else {
- if ($form_values['new_sid']) {
- db_query('UPDATE {project_issues} SET sid = %d WHERE sid = %d', $form_values['new_sid'], $form_values['sid']);
+function project_issue_delete_state_confirm_submit($form, &$form_state) {
+ if ($form_state['values']['new_sid'] == $form_state['values']['sid']) {
+ form_set_error('new_sid', t('Choose a new issue status for existing issues of status %name.', array('%name' => $form_state['values']['name'])));
+ }
+ else {
+ if ($form_state['values']['new_sid']) {
+ db_query('UPDATE {project_issues} SET sid = %d WHERE sid = %d', $form_state['values']['new_sid'], $form_state['values']['sid']);
}
- db_query('DELETE FROM {project_issue_state} WHERE sid = %d', $form_values['sid']);
- drupal_set_message(t('Project issue status %issue deleted.', array('%issue' => $form_values['name'])));
+ db_query('DELETE FROM {project_issue_state} WHERE sid = %d', $form_state['values']['sid']);
+ drupal_set_message(t('Project issue status %issue deleted.', array('%issue' => $form_state['values']['name'])));
drupal_goto('admin/project/project-issue-status');
}
}
@@ -1596,7 +1592,7 @@ function project_issue_query_result($que
$row[] = l($projects[$node->pid], "project/issues/$node->pid");
}
if (strlen($node->title) > 50) {
- $title = l(drupal_substr($node->title, 0, 50), "node/$node->nid", array('title' => $node->title));
+ $title = l(drupal_substr($node->title, 0, 50), "node/$node->nid", array('attributes' => array('title' => $node->title)));
}
else {
$title = l($node->title, "node/$node->nid");
@@ -1617,14 +1613,14 @@ function project_issue_query_result($que
}
$query = project_issue_query_pager($query);
- $rss = theme('feed_icon', url('project/issues/rss', project_issue_query_url($query)));
+ $rss = theme('feed_icon', url('project/issues/rss', array('query' => project_issue_query_url($query))));
$link = l(t('#'), 'project/issues', array('title' => t('Permalink to search query.')), project_issue_query_url($query));
if ($pager = theme('pager', NULL, 20, 0)) {
$rows[] = array(array('data' => $pager, 'colspan' => count($header)));
}
}
else {
- $rows[] = array(array('data' => t('No issues found.'), 'colspan'=> 8));
+ $rows[] = array(array('data' => t('No issues found.'), 'colspan' => 8));
}
$output = '
';
@@ -1680,35 +1676,35 @@ function project_issue_query_result_quic
}
$form['projects'] = array(
- '#type'=> 'select',
+ '#type' => 'select',
'#title' => t('Project'),
'#default_value' => $query->projects,
'#options' => $projects,
);
$form['states'] = array(
- '#type'=> 'select',
+ '#type' => 'select',
'#title' => t('Status'),
'#default_value' => $query->states,
'#options' => $states,
);
$form['categories'] = array(
- '#type'=> 'select',
+ '#type' => 'select',
'#title' => t('Category'),
'#default_value' => $query->categories,
'#options' => $categories,
);
$form['priorities'] = array(
- '#type'=> 'select',
+ '#type' => 'select',
'#title' => t('Priority'),
'#default_value' => $query->priorities,
'#options' => $priorities,
);
$form['users'] = array(
- '#type'=> 'hidden',
+ '#type' => 'hidden',
'#value' => $query->users,
);
$form['js'] = array(
- '#type'=> 'hidden',
+ '#type' => 'hidden',
'#value' => '0',
);
$form['submit'] = array(
@@ -1913,7 +1909,7 @@ function project_issue_query_rss($result
else {
$channel['title'] = variable_get('site_name', 'drupal') .' - '. t('issues');
}
- $channel['link'] = url('project/issues', NULL, NULL, TRUE); // not 100% correct
+ $channel['link'] = url('project/issues', array('absolute' => TRUE)); // not 100% correct
node_feed($result, $channel);
}
Index: mail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/mail.inc,v
retrieving revision 1.72
diff -u -u -p -r1.72 mail.inc
--- mail.inc 7 May 2007 19:47:09 -0000 1.72
+++ mail.inc 8 Jul 2007 14:58:53 -0000
@@ -1,6 +1,6 @@
type == 'project') {
@@ -127,7 +127,7 @@ function project_issue_mailhandler($node
function project_mail_urls($url = 0) {
static $urls = array();
if ($url) {
- $urls[] = strpos($url, '://') ? $url : url($url, NULL, NULL, 1);
+ $urls[] = strpos($url, '://') ? $url : url($url, array('absolute' => TRUE));
return count($urls);
}
return $urls;
@@ -245,8 +245,8 @@ function project_mail_notify($node) {
}
// Create link to related node
- $links = t('Issue status update for !link', array('!link' => "\n". url("node/$node->nid", NULL, NULL, 1))) ."\n";
- $links .= t('Post a follow up: !link', array('!link' => "\n". url("project/comments/add/$node->nid", NULL, NULL, 1))) ."\n";
+ $links = t('Issue status update for !link', array('!link' => "\n". url("node/$node->nid", array('absolute' => TRUE)))) ."\n";
+ $links .= t('Post a follow up: !link', array('!link' => "\n". url("project/comments/add/$node->nid", array('absolute' => TRUE)))) ."\n";
// Mail summary (status values)
foreach ($fields as $field => $text) {
@@ -279,9 +279,9 @@ function project_mail_notify($node) {
'From' => "$sender->name <$sender->mail>",
'X-Mailer' => 'Drupal Project module (http://drupal.org/project/project)',
'List-Id' => "$project->title <$project->uri-issues-$domain>",
- 'List-Archive' => '<'. url("project/issues/$project->uri", NULL, NULL, 1) .'>',
- 'List-Subscribe' => '<'. url("node/$project->uri", NULL, NULL, 1) .'>',
- 'List-Unsubscribe' => '<'. url("node/$project->uri", NULL, NULL, 1) .'>'
+ 'List-Archive' => '<'. url("project/issues/$project->uri", array('absolute' => TRUE)) .'>',
+ 'List-Subscribe' => '<'. url("node/$project->uri", array('absolute' => TRUE)) .'>',
+ 'List-Unsubscribe' => '<'. url("node/$project->uri", array('absolute' => TRUE)) .'>'
);
if ($replyto = variable_get('project_reply_to', '')) {
$header['Reply-To'] = "$project->title <$replyto>";
@@ -365,7 +365,7 @@ function project_mail_reminder() {
'From' => "$sender->name <$sender->mail>",
'X-Mailer' => 'Drupal Project Issues module (http://drupal.org/project/project_issue)',
'List-Id' => "$sender->name
',
- 'List-Archive' => '<'. url('project', NULL, NULL, 1) .'>',
+ 'List-Archive' => '<'. url('project', array('absolute' => TRUE)) .'>',
);
drupal_mail('project_issue_reminder', $mail, t('Your submitted bugs for !date', array('!date' => date('F d, Y', time()))), $body, NULL, $header);
@@ -387,7 +387,7 @@ function project_mail_reminder() {
}
$body .= ' state: '. project_issue_state($node->sid) ."\n";
$body .= ' age: '. format_interval(time() - $node->created) ."\n";
- $body .= ' url: '. url("node/$node->nid", NULL, NULL, 1) ."\n";
+ $body .= ' url: '. url("node/$node->nid", array('absolute' => TRUE)) ."\n";
$body .= "\n";
}
}
@@ -400,7 +400,7 @@ function project_mail_digest() {
'Date' => date('r'),
'X-Mailer' => 'Drupal Project Issues module (http://drupal.org/project/project_issue)',
'List-Id' => "$project->title <". preg_replace('|.+://([a-zA-Z0-9\._-]+).*|', '\1', $GLOBALS['base_url']) .'-project-issues-digest>',
- 'List-Archive' => '<'. url('project/issues?priorities=1', NULL, NULL, 1) .'>',
+ 'List-Archive' => '<'. url('project/issues?priorities=1', array('absolute' => TRUE)) .'>',
);
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, p.* FROM {node} n INNER JOIN {project_issue_projects} p ON n.nid = p.nid WHERE n.status = 1 AND p.mail_digest <> '' ORDER BY n.title, p.mail_digest"));
@@ -418,7 +418,7 @@ function project_mail_digest() {
$body[$project->mail_digest] .= ' assigned: '. $assigned->name ."\n";
}
$body[$project->mail_digest] .= ' age: '. format_interval(time() - $node->created) ."\n";
- $body[$project->mail_digest] .= ' url: '. url("node/$node->nid", NULL, NULL, 1) ."\n";
+ $body[$project->mail_digest] .= ' url: '. url("node/$node->nid", array('absolute' => TRUE)) ."\n";
$body[$project->mail_digest] .= "\n";
}
}
Index: project_issue.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.info,v
retrieving revision 1.3
diff -u -u -p -r1.3 project_issue.info
--- project_issue.info 13 Jun 2007 19:33:51 -0000 1.3
+++ project_issue.info 8 Jul 2007 14:58:53 -0000
@@ -3,3 +3,4 @@ name = Project issue tracking
description = Provides issue tracking for the project.module.
dependencies = project
package = Project
+core = 6.x
Index: project_issue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.27
diff -u -u -p -r1.27 project_issue.module
--- project_issue.module 15 May 2007 23:10:20 -0000 1.27
+++ project_issue.module 8 Jul 2007 14:58:53 -0000
@@ -1,6 +1,6 @@
project_issues
// issue comments -> project_comments
@@ -12,8 +12,8 @@ if (file_exists("$path/issue.inc")) {
require_once "$path/mail.inc";
}
-function project_issue_help($section) {
- switch ($section) {
+function project_issue_help($path, $arg) {
+ switch ($path) {
case 'admin/help#project_issue':
$help = t('Mailhandler support
'.
'Basic mail format:
'.
@@ -63,7 +63,7 @@ function project_issue_perm() {
'access own project issues'
);
$states = project_issue_state();
- foreach($states as $key => $value) {
+ foreach ($states as $key => $value) {
$perms[] = "set issue status ". str_replace("'", "", $value);
}
return $perms;
@@ -80,7 +80,7 @@ function project_issue_settings_form() {
'#default_value' => variable_get('project_directory_issues', 'issues'),
'#size' => 30,
'#maxlength' => 255,
- '#description' => t("Subdirectory in the directory '%dir' where attachments to issues will be stored.", array('%dir' => variable_get('file_directory_path', 'files') . '/')),
+ '#description' => t("Subdirectory in the directory '%dir' where attachments to issues will be stored.", array('%dir' => variable_get('file_directory_path', 'files') .'/')),
'#after_build' => array('project_issue_check_directory'),
);
@@ -162,149 +162,140 @@ function project_issue_link($type, $node
return $links;
}
-function project_issue_menu($may_cache) {
+function project_issue_menu() {
$items = array();
global $user;
- if ($may_cache) {
-
- // Issues
- $access = user_access('access project issues');
- $items[] = array(
- 'path' => 'project/issues',
- 'title' => t('Issues'),
- 'callback' => 'project_issue_page',
- 'access' => $access,
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -50,
- );
- $items[] = array(
- 'path' => 'project/issues/add',
- 'title' => t('Submit'),
- 'callback' => 'project_issue_page',
- 'access' => $access,
- 'type' => MENU_NORMAL_ITEM,
- );
- $items[] = array(
- 'path' => 'project/issues/update_project',
- 'callback' => 'project_issue_update_project',
- 'access' => $access,
- 'type' => MENU_CALLBACK,
- );
- $items[] = array(
- 'path' => 'project/issues/statistics',
- 'title' => t('Statistics'),
- 'callback' => 'project_issue_page',
- 'access' => $access,
- 'type' => MENU_NORMAL_ITEM,
- );
- $items[] = array(
- 'path' => 'project/issues/search',
- 'title' => t('Search'),
- 'callback' => 'project_issue_search_page',
- 'access' => $access,
- 'type' => MENU_NORMAL_ITEM,
- );
- if (module_exists('search')) {
- $items[] = array(
- 'path' => 'search/issues',
- 'title' => t('Issues'),
- 'callback' => 'project_issue_search_page',
- 'access' => $access,
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 4,
- );
- }
- $items[] = array(
- 'path' => 'project/issues/subscribe-mail',
- 'title' => t('Subscribe'),
- 'callback' => 'project_issue_page',
- 'access' => $GLOBALS['user']->uid && $access,
- 'type' => MENU_NORMAL_ITEM,
- );
-
- // "My projects" page (which shows all issues for all your projects)
- $items[] = array(
- 'path' => 'project/user',
- 'title' => t('My projects'),
- 'callback' => 'project_issue_user_page',
- 'access' => $user->uid && $access,
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -49,
- );
-
- $items[] = array(
- 'path' => 'project/issues/user',
- 'title' => t('My issues'),
- 'callback' => 'project_issue_page',
- 'access' => $GLOBALS['user']->uid && $access,
- 'type' => MENU_NORMAL_ITEM,
- );
-
- // Reply to issues
- $access = user_access('create project issues');
- $items[] = array(
- 'path' => 'project/comments',
- 'title' => t('Comments'),
- 'callback' => 'project_comment_page',
- 'access' => $access,
- 'type' => MENU_CALLBACK,
- );
-
- // Administrative pages
- $access = user_access('administer projects');
- $items[] = array(
- 'path' => 'admin/project/project-issue-settings',
- 'title' => t('Project issue settings'),
- 'description' => t('Specify where attachments to issues should be stored on your site, and what filename extensions should be allowed.'),
- 'callback' => 'drupal_get_form',
- 'callback arguments' => array('project_issue_settings_form'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => 1,
- 'access' => $access,
- );
-
- // Administer issue status settings
- $items[] = array(
- 'path' => 'admin/project/project-issue-status',
- 'title' => t('Project issue status options'),
- 'description' => t('Configure what issue status values should be used on your site.'),
- 'callback' => 'drupal_get_form',
- 'callback arguments' => array('project_issue_admin_states_form'),
- 'weight' => 1,
- 'access' => $access,
- 'type' => MENU_NORMAL_ITEM,
- );
- $items[] = array(
- 'path' => 'admin/project/project-issue-status/delete',
- 'title' => t('Delete'),
- 'callback' => 'drupal_get_form',
- 'callback arguments' => array('project_issue_delete_state_confirm'),
- 'access' => $access,
- 'type' => MENU_CALLBACK,
- );
+ // Issues
+ $items['project/issues'] = array(
+ 'title' => 'Issues',
+ 'page callback' => 'project_issue_page',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ 'weight' => -50,
+ );
+ $items['project/issues/add'] = array(
+ 'title' => 'Submit',
+ 'page callback' => 'project_issue_page',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+ $items['project/issues/update_project'] = array(
+ 'page callback' => 'project_issue_update_project',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_CALLBACK,
+ );
+ $items['project/issues/statistics'] = array(
+ 'title' => 'Statistics',
+ 'page callback' => 'project_issue_page',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+ $items['project/issues/search'] = array(
+ 'title' => 'Search',
+ 'page callback' => 'project_issue_search_page',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+ if (module_exists('search')) {
+ $items['search/issues'] = array(
+ 'title' => 'Issues',
+ 'page callback' => 'project_issue_search_page',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 4,
+ );
+ }
+ $items['project/issues/subscribe-mail'] = array(
+ 'title' => 'Subscribe',
+ 'page callback' => 'project_issue_page',
+ 'access callback' => '_project_user_access',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ // "My projects" page (which shows all issues for all your projects)
+ $items['project/user'] = array(
+ 'title' => 'My projects',
+ 'page callback' => 'project_issue_user_page',
+ 'access callback' => '_project_user_access',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ 'weight' => -49,
+ );
+
+ $items['project/issues/user'] = array(
+ 'title' => 'My issues',
+ 'page callback' => 'project_issue_page',
+ 'access callback' => '_project_user_access',
+ 'access arguments' => array('access project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ // Reply to issues
+ $items['project/comments'] = array(
+ 'title' => 'Comments',
+ 'page callback' => 'project_comment_page',
+ 'access arguments' => array('create project issues'),
+ 'type' => MENU_CALLBACK,
+ );
+
+ // Administrative pages
+ $items['admin/project/project-issue-settings'] = array(
+ 'title' => 'Project issue settings',
+ 'description' => 'Specify where attachments to issues should be stored on your site, and what filename extensions should be allowed.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('project_issue_settings_form'),
+ 'type' => MENU_NORMAL_ITEM,
+ 'weight' => 1,
+ 'access arguments' => array('create project issues'),
+ );
+
+ // Administer issue status settings
+ $items['admin/project/project-issue-status'] = array(
+ 'title' => 'Project issue status options',
+ 'description' => 'Configure what issue status values should be used on your site.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('project_issue_admin_states_form'),
+ 'weight' => 1,
+ 'access arguments' => array('create project issues'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+ $items['admin/project/project-issue-status/delete'] = array(
+ 'title' => 'Delete',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('project_issue_delete_state_confirm'),
+ 'access arguments' => array('create project issues'),
+ 'type' => MENU_CALLBACK,
+ );
- }
- else {
+/*
// Dynamic menu items
// Issues subtab on project node edit tab.
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'project_project' && node_access('update', $node)) {
- $items[] = array(
- 'path' => 'node/'. arg(1) .'/edit/issues',
- 'title' => t('Issues'),
- 'callback' => 'project_issue_project_edit_issues',
+ $items['node/%/edit/issues',
+ 'title' => 'Issues',
+ 'page callback' => 'project_issue_project_edit_issues',
+ 'map arguments' => array(1),
'type' => MENU_LOCAL_TASK,
);
}
}
+*/
- drupal_add_css(drupal_get_path('module', 'project_issue') .'/project_issue.css');
- }
+ drupal_add_css(drupal_get_path('module', 'project_issue') .'/project_issue.css');
return $items;
}
+function _project_user_access($auth) {
+ global $user;
+ if ($user->uid) {
+ return user_access($auth);
+ }
+}
+
/**
* Adds the issues subtab to the edit tab on project nodes.
*/
@@ -437,13 +428,13 @@ function project_issue_project_edit_form
* Submit handler when project admins use the issues subtab.
* @see project_issue_project_edit_issues
*/
-function project_issue_project_edit_form_submit($form_id, $form_values) {
- $components = serialize(explode("\n", str_replace("\r", '', $form_values['components'])));
- $mail_copy_filter = serialize($form_values['mail_copy_filter']);
- $mail_copy_filter_state = serialize($form_values['mail_copy_filter_state']);
+function project_issue_project_edit_form_submit($form, &$form_state) {
+ $components = serialize(explode("\n", str_replace("\r", '', $form_state['values']['components'])));
+ $mail_copy_filter = serialize($form_state['values']['mail_copy_filter']);
+ $mail_copy_filter_state = serialize($form_state['values']['mail_copy_filter_state']);
- db_query("UPDATE {project_issue_projects} SET issues = %d, components = '%s', mail_digest = '%s', mail_reminder = %d, mail_copy = '%s', mail_copy_filter = '%s', mail_copy_filter_state = '%s', help = '%s' WHERE nid = %d", $form_values['issues'], $components, $form_values['mail_digest'], $form_values['mail_reminder'], $form_values['mail_copy'], $mail_copy_filter, $mail_copy_filter_state, $form_values['help'], $form_values['nid']);
- db_query("UPDATE {node} SET changed = %d WHERE nid = %d", time(), $form_values['nid']);
+ db_query("UPDATE {project_issue_projects} SET issues = %d, components = '%s', mail_digest = '%s', mail_reminder = %d, mail_copy = '%s', mail_copy_filter = '%s', mail_copy_filter_state = '%s', help = '%s' WHERE nid = %d", $form_state['values']['issues'], $components, $form_state['values']['mail_digest'], $form_state['values']['mail_reminder'], $form_state['values']['mail_copy'], $mail_copy_filter, $mail_copy_filter_state, $form_state['values']['help'], $form_state['values']['nid']);
+ db_query("UPDATE {node} SET changed = %d WHERE nid = %d", time(), $form_state['values']['nid']);
drupal_set_message(t('Issue settings have been saved.'));
}