cvs diff: Diffing . Index: comment.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/comment.inc,v retrieving revision 1.134 diff -u -p -r1.134 comment.inc --- comment.inc 17 Dec 2008 08:07:14 -0000 1.134 +++ comment.inc 14 Jan 2009 01:59:35 -0000 @@ -22,9 +22,9 @@ function project_issue_comment(&$arg, $o // This is ugly, but the form workflow doesn't really offer a better // choice for this scenario. if (isset($_POST['project_info']['pid'])) { - $node->pid = $_POST['project_info']['pid']; + $node->project_issue['pid'] = $_POST['project_info']['pid']; } - $project = node_load(array('nid' => $node->pid, 'type' => 'project_project')); + $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project')); switch ($op) { case 'form': @@ -51,7 +51,7 @@ function project_issue_comment(&$arg, $o $form['project_info']['pid'] = array( '#type' => 'select', '#title' => t('Project'), - '#default_value' => $node->pid, + '#default_value' => $node->project_issue['pid'], '#options' => $projects, '#required' => TRUE, ); @@ -173,9 +173,9 @@ function project_issue_comment(&$arg, $o // release node for user selection. $invalid_rids = variable_get('project_issue_invalid_releases', array()); if (!empty($invalid_rids) && - ((empty($rid) && in_array($node->rid, $invalid_rids)) + ((empty($rid) && in_array($node->project_issue['rid'], $invalid_rids)) || in_array($rid, $invalid_rids))) { - form_set_error('project_info][rid', t('%version is not a valid version, please select a different value.', array('%version' => $releases[$node->rid]))); + form_set_error('project_info][rid', t('%version is not a valid version, please select a different value.', array('%version' => $releases[$node->project_issue['rid']]))); } elseif (empty($rid)) { form_set_error('project_info][rid', t('You have to specify a valid version.')); @@ -183,7 +183,7 @@ function project_issue_comment(&$arg, $o } // Validate component. $component = $arg['project_info']['component']; - if ($component && !in_array($component, $project->components)) { + if ($component && !in_array($component, $project->project_issue['components'])) { $component = 0; } empty($component) && form_set_error('project_info][component', t('You have to specify a valid component.')); Index: issue.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v retrieving revision 1.321 diff -u -p -r1.321 issue.inc --- issue.inc 7 Jan 2009 20:48:27 -0000 1.321 +++ issue.inc 14 Jan 2009 01:59:37 -0000 @@ -21,7 +21,7 @@ function project_issue_page() { $project = project_project_retrieve(arg(3)); // We assume that a user may create issues for projects that he may view. if ($project->nid && node_access('view', $project)) { - drupal_goto("node/add/project-issue/$project->uri"); + drupal_goto("node/add/project-issue/". $project->project['uri']); } else { drupal_goto("node/add/project-issue"); @@ -147,7 +147,7 @@ function project_issue_update_project($p // http://drupal.org/node/197281 lands. $issue = new stdClass; } - $issue->pid = $pid; + $issue->project_issue['pid'] = $pid; $return['assigned'] = ''; $assigned_choices = project_issue_assigned_choices($issue); @@ -260,7 +260,7 @@ function project_issue_quick_search($url drupal_not_found(); exit; } - $destination = 'project/issues/'. $project->uri; + $destination = 'project/issues/'. $project->project['uri']; } // if 'q' is the only thing in $_GET, and it == destination, don't redirect @@ -311,7 +311,7 @@ function project_issue_advanced_search($ drupal_not_found(); exit; } - $destination = 'project/issues/'. $project->uri; + $destination = 'project/issues/'. $project->project['uri']; drupal_goto($destination, drupal_query_string_encode($issue_filters)); } @@ -643,7 +643,7 @@ function project_issue_pick_project_form function project_issue_pick_project_form_submit($form_id, $form_values) { $project = node_load($form_values['pid']); - return 'node/add/project-issue/'. $project->uri; + return 'node/add/project-issue/'. $project->project['uri']; } /** @@ -690,18 +690,18 @@ function project_issue_form($node, $incl return; } - if (empty($node->pid)) { + if (empty($node->project_issue['pid'])) { $pid = arg(3); if (!empty($pid)) { if (is_numeric($pid)) { - $node->pid = db_result(db_query(db_rewrite_sql('SELECT p.nid FROM {project_projects} p WHERE p.nid = %d', 'p'), $pid), 0); + $node->project_issue['pid'] = db_result(db_query(db_rewrite_sql('SELECT p.nid FROM {project_projects} p WHERE p.nid = %d', 'p'), $pid), 0); } else { - $node->pid = db_result(db_query(db_rewrite_sql("SELECT p.nid FROM {project_projects} p WHERE p.uri = '%s'", 'p'), $pid), 0); + $node->project_issue['pid'] = db_result(db_query(db_rewrite_sql("SELECT p.nid FROM {project_projects} p WHERE p.uri = '%s'", 'p'), $pid), 0); } } } - $pid = $node->pid; + $pid = $node->project_issue['pid']; if (empty($pid)) { drupal_set_message(t('Invalid project selected.'), 'error'); @@ -731,10 +731,9 @@ function project_issue_form($node, $incl // Load the project and initialize some support arrays. $project = node_load(array('nid' => $pid, 'type' => 'project_project')); - if ($allow_metadata_changes) { if (module_exists('project_release') && - $releases = project_release_get_releases($project, 0, 'version', 'all', array($node->rid))) { + $releases = project_release_get_releases($project, 0, 'version', 'all', array($node->project_issue['rid']))) { $releases = array(t('')) + $releases; } // Remove releases marked as invalid release nodes for user selection. @@ -742,16 +741,16 @@ function project_issue_form($node, $incl unset($releases[$rid]); } $components = array(); - if ($project->components) { + if ($project->project_issue['components']) { $components = array(t('')); - foreach ($project->components as $component) { + foreach ($project->project_issue['components'] as $component) { $component = check_plain($component); $components[$component] = $component; } } $categories = array_merge(array(t('')), project_issue_category(0, 0)); $priorities = project_issue_priority(); - $states = project_issue_state(0, true, $node->nid && ($node->uid == $user->uid), $node->sid); + $states = project_issue_state(0, true, $node->nid && ($node->uid == $user->uid), $node->project_issue['sid']); $assigned = project_issue_assigned_choices($node); } @@ -764,7 +763,7 @@ function project_issue_form($node, $incl '#suffix' => '', ); } - $project_help = trim($project->help); + $project_help = trim($project->project_issue['help']); if (!empty($project_help)) { $form['project_help']['project'] = array( '#prefix' => '
', @@ -787,13 +786,13 @@ function project_issue_form($node, $incl ); $form['project_info']['pid'] = array( '#type' => 'value', - '#value' => $node->pid, + '#value' => $node->project_issue['pid'], ); if ($releases) { $form['project_info']['rid'] = array( '#type' => 'select', '#title' => t('Version'), - '#default_value' => $node->rid, + '#default_value' => $node->project_issue['rid'], '#options' => $releases, '#required' => TRUE, ); @@ -801,7 +800,7 @@ function project_issue_form($node, $incl $form['project_info']['component'] = array( '#type' => 'select', '#title' => t('Component'), - '#default_value' => $node->component, + '#default_value' => $node->project_issue['component'], '#options' => $components, '#required' => TRUE, ); @@ -814,27 +813,27 @@ function project_issue_form($node, $incl $form['issue_info']['category'] = array( '#type' => 'select', '#title' => t('Category'), - '#default_value' => $node->category ? $node->category : arg(4), + '#default_value' => $node->project_issue['category'] ? $node->project_issue['category'] : arg(4), '#options' => $categories, '#required' => TRUE, ); $form['issue_info']['priority'] = array( '#type' => 'select', '#title' => t('Priority'), - '#default_value' => $node->priority ? $node->priority : 2, + '#default_value' => $node->project_issue['priority'] ? $node->project_issue['priority'] : 2, '#options' => $priorities, ); $form['issue_info']['assigned'] = array( '#type' => 'select', '#title' => t('Assigned'), - '#default_value' => $node->assigned, + '#default_value' => $node->project_issue['assigned'], '#options' => $assigned, ); if (count($states) > 1) { $form['issue_info']['sid'] = array( '#type' => 'select', '#title' => t('Status'), - '#default_value' => $node->sid ? $node->sid : $default_state, + '#default_value' => $node->project_issue['sid'] ? $node->project_issue['sid'] : $default_state, '#options' => $states, ); } @@ -895,7 +894,7 @@ function project_issue_form($node, $incl * Build an array of users to whom an issue may be assigned. * * @param $issue - * The issue object. + * The fully loaded issue node object. * @return * A keyed array in the form uid => name containing users * to whom an issue may be assigned. @@ -908,7 +907,7 @@ function project_issue_assigned_choices( $function($assigned, $issue); } natcasesort($assigned); - $assigned = array(0 => empty($issue->assigned) ? t('Unassigned') : t('Unassign')) + $assigned; + $assigned = array(0 => empty($issue->project_issue['assigned']) ? t('Unassigned') : t('Unassign')) + $assigned; return $assigned; } @@ -920,6 +919,11 @@ function project_issue_assigned_choices( * project_issue_node_form_validate() since if we did, node_form_validate() * itself would not be invoked, which would lead to all kinds of problems, * including hook_nodeapi('validate') never being invoked. + * + * @param $node + * An object of form values from the project_issue node form, not a fully + * loaded issue node object. Therefore, the fields are not in the usual + * $node->project_issue array. */ function project_issue_validate(&$node) { // If $node->nid is set, that means that the node was being @@ -937,7 +941,7 @@ function project_issue_validate(&$node) form_set_error('rid', t('You have to specify a valid version.')); } } - if (isset($node->component) && !in_array($node->component, $project->components)) { + if (isset($node->component) && !in_array($node->component, $project->project_issue['components'])) { $node->component = 0; } if (empty($node->component)) { @@ -958,35 +962,35 @@ function project_issue_view($node, $teas $node->content['#prefix'] = '
'; $node->content['#suffix'] = '
'; - $project = node_load(array('nid' => $node->pid, 'type' => 'project_project')); - $release->nid = $node->rid; + $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project')); + $release->nid = $node->project_issue['rid']; if (module_exists('project_release')) { $release = project_release_load($release); } - $assigned = ($node->assigned && ($account = user_load(array('uid' => $node->assigned))) ? $account->name : t('Unassigned')); + $assigned = ($node->project_issue['assigned'] && ($account = user_load(array('uid' => $node->project_issue['assigned']))) ? $account->name : t('Unassigned')); $current_data = array(); $current_data['pid'] = array( 'label' => t('Project'), 'current' => $project->title, ); - if ($release->version) { + if ($release->project_release['version']) { $current_data['rid'] = array( 'label' => t('Version'), - 'current' => $release->version, + 'current' => $release->project_release['version'], ); } $current_data['component'] = array( 'label' => t('Component'), - 'current' => $node->component, + 'current' => $node->project_issue['component'], ); $current_data['category'] = array( 'label' => t('Category'), - 'current' => project_issue_category($node->category, 0), + 'current' => project_issue_category($node->project_issue['category'], 0), ); $current_data['priority'] = array( 'label' => t('Priority'), - 'current' => project_issue_priority($node->priority), + 'current' => project_issue_priority($node->project_issue['priority']), ); $current_data['assigned'] = array( 'label' => t('Assigned'), @@ -994,7 +998,7 @@ function project_issue_view($node, $teas ); $current_data['sid'] = array( 'label' => t('Status'), - 'current' => project_issue_state($node->sid), + 'current' => project_issue_state($node->project_issue['sid']), ); // Allow modules to alter the metadata displayed in the table on the actual @@ -1051,10 +1055,10 @@ function project_issue_view($node, $teas function project_issue_project_issue_assignees(&$assigned, $node) { global $user; if ($user->uid) { - if (isset($node->assigned) && $user->uid != $node->assigned) { + if (isset($node->project_issue['assigned']) && $user->uid != $node->project_issue['assigned']) { // Assigned to someone else, add the currently assigned user. - $account = user_load(array('uid' => $node->assigned)); - $assigned[$node->assigned] = $account->name; + $account = user_load(array('uid' => $node->project_issue['assigned'])); + $assigned[$node->project_issue['assigned']] = $account->name; } // Always let the person replying assign it to themselves. $assigned[$user->uid] = $user->name; @@ -1147,7 +1151,7 @@ function project_issue_internal_links($n // Link straight to comment form. if ($node->comment == COMMENT_NODE_READ_WRITE && (user_access('post comments') || user_access('post comments without approval'))) { // TODO: This conditional needs to be ripped out in D6. - $comment_form_location = isset($node->comment_form_location) ? $node->comment_form_location : variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE); + $comment_form_location = isset($node->project_issue['comment_form_location']) ? $node->project_issue['comment_form_location'] : variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE); // Comment form isn't on the page, link to the comment reply page. if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) { @@ -1163,21 +1167,30 @@ function project_issue_internal_links($n } function project_issue_load($node) { - $project = db_fetch_object(db_query(db_rewrite_sql('SELECT pi.* FROM {project_issues} pi WHERE pi.nid = %d', 'pi'), $node->nid)); + $additions = db_fetch_array(db_query(db_rewrite_sql('SELECT pi.* FROM {project_issues} pi WHERE pi.nid = %d', 'pi'), $node->nid)); // TODO: This need to be ripped out in D6. - $project->comment_form_location = variable_get('project_issue_comment_form_location', NULL); - - return $project; + $additions['comment_form_location'] = variable_get('project_issue_comment_form_location', NULL); + $issue = new stdClass; + $issue->project_issue = $additions; + return $issue; } +/** + * Implementation of hook_insert(). + * + * @param $node + * Object containing form values from the project_issue node form. This is + * NOT a fully loaded $node object, so the issue-related values are directly + * in $node, not in the $node->project_issue array. + */ function project_issue_insert($node) { - - // Permanently store the original issue states in a serialized array. This is a bit - // yucky, but we need them for proper handling of states workflow. The current states - // need to be stored in {project_issues} as well for query efficiency in issue queue - // searches, and it seems too messy to add a bunch of new columns to the {project_issues} - // table for the original states. + // Permanently store the original issue states in a serialized array. This + // is a bit yucky, but we need them for proper handling of states workflow. + // The current states need to be stored in {project_issues} as well for + // query efficiency in issue queue searches, and it seems too messy to add a + // bunch of new columns to the {project_issues} table for the original + // states. $original_issue_data = new stdClass(); $fields = array( 'pid' => 0, @@ -1352,7 +1365,7 @@ function project_issue_query($project = if (!empty($project->nid)) { drupal_set_title(t('Search issues for %name', array('%name' => $project->title))); project_project_set_breadcrumb($project, TRUE); - foreach ($project->components as $component) { + foreach ($project->project_issue['components'] as $component) { $component = check_plain($component); $components[$component] = $component; } @@ -1383,7 +1396,7 @@ function project_issue_query($project = $states = project_issue_state(); $priorities = project_issue_priority(); - $form['#action'] = url(isset($project->uri) ? "project/issues/$project->uri" : 'project/issues'); + $form['#action'] = url(isset($project->project['uri']) ? 'project/issues/'. $project->project['uri'] : 'project/issues'); $form['text'] = array( '#type' => 'textfield', '#title' => t('Search for'), @@ -1741,32 +1754,32 @@ function project_issue_query_result($que if (node_access('create', 'project_issue')) { $links['create'] = array( 'title' => t('Create'), - 'href' => "node/add/project-issue/$project->uri", - 'attributes' => array('title' => t('Create a new issue for @project.', array('@project' => $project->uri))), + 'href' => 'node/add/project-issue/'. $project->project['uri'], + 'attributes' => array('title' => t('Create a new issue for @project.', array('@project' => $project->project['uri']))), ); } else { $links['create'] = array( - 'title' => theme('project_issue_create_forbidden', $project->uri), + 'title' => theme('project_issue_create_forbidden', $project->project['uri']), 'html' => TRUE, ); } $links['statistics'] = array( 'title' => t('Statistics'), - 'href' => "project/issues/statistics/$project->uri", - 'attributes' => array('title' => t('See statistics about @project issues.', array('@project' => $project->uri))), + 'href' => 'project/issues/statistics/'. $project->project['uri'], + 'attributes' => array('title' => t('See statistics about @project issues.', array('@project' => $project->project['uri']))), ); if ($user->uid) { $links['subscribe'] = array( 'title' => t('Subscribe'), - 'href' => "project/issues/subscribe-mail/$project->uri", - 'attributes' => array('title' => t('Receive email updates about @project issues.', array('@project' => $project->uri))), + 'href' => 'project/issues/subscribe-mail/'. $project->project['uri'], + 'attributes' => array('title' => t('Receive email updates about @project issues.', array('@project' => $project->project['uri']))), ); } $links['search'] = array( 'title' => t('Advanced search'), - 'href' => "project/issues/search/$project->uri", - 'attributes' => array('title' => t('Use the advanced search page to find @project issues.', array('@project' => $project->uri))), + 'href' => 'project/issues/search/'. $project->project['uri'], + 'attributes' => array('title' => t('Use the advanced search page to find @project issues.', array('@project' => $project->project['uri']))), ); } else { @@ -1785,7 +1798,7 @@ function project_issue_query_result($que } else { $links['create'] = array( - 'title' => theme('project_issue_create_forbidden', $project->uri), + 'title' => theme('project_issue_create_forbidden', $project->project['uri']), 'html' => TRUE, ); } @@ -1860,9 +1873,9 @@ function project_issue_query_result($que while ($node = db_fetch_object($result)) { $node = node_load($node->nid); $row = array(); - $class = "state-$node->sid"; + $class = "state-". $node->project_issue['sid']; if (!$project->nid) { - $row[] = l($projects[$node->pid], "project/issues/$node->pid"); + $row[] = l($projects[$node->project_issue['pid']], "project/issues/". $node->project_issue['pid']); } if (strlen($node->title) > 50) { $title = l(drupal_substr($node->title, 0, 50), "node/$node->nid", array('title' => $node->title)); @@ -1871,14 +1884,14 @@ function project_issue_query_result($que $title = l($node->title, "node/$node->nid"); } $row[] = $title . theme('mark', node_mark($node->nid, $node->changed)); - $row[] = check_plain($states[$node->sid]); - $row[] = $priorities[$node->priority]; - $row[] = project_issue_category($node->category, 0); + $row[] = check_plain($states[$node->project_issue['sid']]); + $row[] = $priorities[$node->project_issue['priority']]; + $row[] = project_issue_category($node->project_issue['category'], 0); if (count($releases)) { - $row[] = $releases[$node->rid]; + $row[] = $releases[$node->project_issue['rid']]; } $row[] = array('data' => format_interval(time() - $node->changed, 2), 'align' => 'right'); - $row[] = ($node->assigned) ? theme('username', user_load(array('uid' => $node->assigned))) : ''; + $row[] = ($node->project_issue['assigned']) ? theme('username', user_load(array('uid' => $node->project_issue['assigned']))) : ''; $row = array('data' => $row, 'class' => $class); @@ -2271,9 +2284,9 @@ function project_issue_change_summary($f $release = project_release_load($release); } else { - $release->version = t('Unknown'); + $release->project_release['version'] = t('Unknown'); } - return $release->version; + return $release->project_release['version']; } return t(''); case 'assigned': Index: mail.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/mail.inc,v retrieving revision 1.111 diff -u -p -r1.111 mail.inc --- mail.inc 7 Jan 2009 20:48:27 -0000 1.111 +++ mail.inc 14 Jan 2009 01:59:37 -0000 @@ -39,44 +39,44 @@ function project_issue_mailhandler($node foreach ($fields as $var => $text) { $text = strtolower(str_replace(' ', '_', $text)); - if (isset($node->$text)) { - $node->$text = trim($node->$text); + if (isset($node->project_issue[$text])) { + $node->project_issue[$text] = trim($node->project_issue[$text]); switch ($var) { case 'pid': - $project = node_load($node->$text); + $project = node_load($node->project_issue[$text]); if ($project->nid) { - $entry->pid = $project->nid; + $entry->project_issue['pid'] = $project->nid; } break; case 'category': - if (($category = array_search($node->$text, project_issue_category(0, 0)))) { - $entry->category = $category; + if (($category = array_search($node->project_issue[$text], project_issue_category(0, 0)))) { + $entry->project_issue['category'] = $category; } break; case 'priority': - if (($priority = array_search($node->$text, project_issue_priority()))) { - $entry->priority = $priority; + if (($priority = array_search($node->project_issue[$text], project_issue_priority()))) { + $entry->project_issue['priority'] = $priority; } break; case 'rid': - if ($entry->pid && ($nid = db_result(db_query("SELECT nid FROM {project_release_nodes} WHERE pid = %d AND version = '%s'", $entry->pid, $node->$text), 0))) { - $entry->rid = $nid; + if ($entry->project_issue['pid'] && ($nid = db_result(db_query("SELECT nid FROM {project_release_nodes} WHERE pid = %d AND version = '%s'", $entry->project_issue['pid'], $node->project_issue[$text]), 0))) { + $entry->project_issue['rid'] = $nid; } break; case 'assigned': - if ($user = user_load(array('name' => $node->$text))) { - $entry->assigned = $user->uid; + if ($user = user_load(array('name' => $node->project_issue[$text]))) { + $entry->project_issue['assigned'] = $user->uid; } break; case 'sid': - if (($state = array_search($node->$text, project_issue_state()))) { - $entry->sid = $state; + if (($state = array_search($node->project_issue[$text], project_issue_state()))) { + $entry->project_issue['sid'] = $state; } break; case 'component': - if ($project->pid || ($entry->pid && ($project = node_load(array('nid' => $entry->pid, 'type' => 'project_project'))))) { - if ($project && in_array($node->$text, $project->components)) { - $entry->component = $node->$text; + if ($entry->project_issue['pid'] && ($project = node_load(array('nid' => $entry->project_issue['pid'], 'type' => 'project_project'))))) { + if ($project && in_array($node->project_issue[$text], $project->project_issue['components'])) { + $entry->project_issue['component'] = $node->project_issue[$text]; } } break; @@ -181,7 +181,7 @@ function project_mail_notify($nid) { // There could be stale data in the cached node, so reset the cache. $node = node_load($nid, NULL, TRUE); - $project = node_load(array('nid' => $node->pid, 'type' => 'project_project')); + $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project')); $fields = project_issue_field_labels('email'); @@ -191,10 +191,10 @@ function project_mail_notify($nid) { // Load in the original issue data here, since we want a running // reverse history. - $original_issue_data = unserialize($node->original_issue_data); + $original_issue_data = unserialize($node->project_issue['original_issue_data']); foreach ($fields as $field => $label) { if ($field != 'name' && $field != 'updator') { - $issue->$field = $original_issue_data->$field; + $issue->project_issue[$field] = $original_issue_data->$field; } } @@ -203,8 +203,8 @@ function project_mail_notify($nid) { if (!empty($node->uid)) { $uids[$node->uid] = $node->uid; } - if (!empty($node->assigned)) { - $uids[$node->assigned] = $node->assigned; + if (!empty($node->project_issue['assigned'])) { + $uids[$node->project_issue['assigned']] = $node->project_issue['assigned']; } // Create complete history of the bug report. @@ -228,7 +228,7 @@ function project_mail_notify($nid) { // Create mail header $sender->name = mime_header_encode(t('!name (!site)', array('!name' => $user->name, '!site' => variable_get('site_name', 'Drupal')))); - $sender->mail = strtr(variable_get('project_issue_reply_to', variable_get('site_mail', ini_get('sendmail_from'))), array('%project' => $project->uri)); + $sender->mail = strtr(variable_get('project_issue_reply_to', variable_get('site_mail', ini_get('sendmail_from'))), array('%project' => $project->project['uri'])); // The sender name is enclosed by double quotes below // to satisfy RFC2822 , @@ -240,10 +240,10 @@ function project_mail_notify($nid) { 'Return-Path' => "<$sender->mail>", 'Date' => date('r'), '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-Id' => "$project->title <". $project->project['uri'] ."-issues-$domain>", + 'List-Archive' => '<'. url("project/issues/". $project->project['uri'], NULL, NULL, 1) .'>', + 'List-Subscribe' => '<'. url("node/". $project->project['uri'], NULL, NULL, 1) .'>', + 'List-Unsubscribe' => '<'. url("node/". $project->project['uri'], NULL, NULL, 1) .'>' ); // Comments exist, set headers accordingly. @@ -259,11 +259,11 @@ function project_mail_notify($nid) { if (count($uids)) { $placeholders = implode(',', array_fill(0, count($uids), '%d')); - array_unshift($uids, $node->pid); + array_unshift($uids, $node->project_issue['pid']); $result = db_query("SELECT p.*, u.uid, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND (p.level = 2 OR (p.level = 1 AND u.uid IN ($placeholders)))", $uids); } else { - $result = db_query('SELECT p.*, u.uid, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND p.level = 2', $node->pid); + $result = db_query('SELECT p.*, u.uid, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND p.level = 2', $node->project_issue['pid']); } // Create link to related node @@ -290,7 +290,7 @@ function project_mail_notify($nid) { $check_node_access = $node->status != 1 || !$anon_auth_access || !empty($grants); project_mail_output($node->title, 0); - $subject = t('[!short_name] [!category] !title', array('!short_name' => $project->uri, '!category' => $node->category, '!title' => $node->title)); + $subject = t('[!short_name] [!category] !title', array('!short_name' => $project->project['uri'], '!category' => $node->project_issue['category'], '!title' => $node->title)); while ($recipient = db_fetch_object($result)) { // To save work, only go through a user_load if we need it. @@ -324,17 +324,17 @@ function project_mail_notify($nid) { } } - if (is_array($project->mail_copy_filter) && count(array_filter($project->mail_copy_filter)) && !$project->mail_copy_filter[$node->category]) { + if (is_array($project->project_issue['mail_copy_filter']) && count(array_filter($project->project_issue['mail_copy_filter'])) && !$project->project_issue['mail_copy_filter'][$node->project_issue['category']]) { return; } - if (is_array($project->mail_copy_filter_state) && count(array_filter($project->mail_copy_filter_state)) && !$project->mail_copy_filter_state[$node->sid]) { + if (is_array($project->project_issue['mail_copy_filter_state']) && count(array_filter($project->project_issue['mail_copy_filter_state'])) && !$project->project_issue['mail_copy_filter_state'][$node->project_issue['sid']]) { return; } - if ($project->mail_copy) { + if ($project->project_issue['mail_copy']) { $body = "$links\n". project_mail_generate_followup_mail_body($node, $history, TRUE); - drupal_mail('project_issue_update', $project->mail_copy, $subject, $body, $from, $header); + drupal_mail('project_issue_update', $project->project_issue['mail_copy'], $subject, $body, $from, $header); } } @@ -370,7 +370,7 @@ function project_mail_generate_followup_ // Get most recent update. $entry = array_pop($history); - $node->updator = $entry->name ? $entry->name : $user->name; + $node->project_issue['updator'] = $entry->name ? $entry->name : $user->name; // Check if the latest entry is actually the initial issue. if (empty($history)) { @@ -383,13 +383,15 @@ function project_mail_generate_followup_ $comment_changes = project_issue_metadata_changes($node, $previous, $entry, $fields); - // Since $node->name will always be the original issue author, and since $node->updator - // isn't a property of either $previous or #entry, these two properties - // will never show up as being different when project_issue_metadata_changes() is called, - // and therefore neither of these will ever be elements of the $comment_changes array. - // Since we do want them to be printed in issue emails, we just need to add their labels - // back into the $comment_changes array here, so that theme_project_issue_mail_summary_field() - // will know to print the data for these two fields. + // Since $node->name will always be the original issue author, and since + // $node->project_issue['updator'] isn't a property of either $previous or + // #entry, these two properties will never show up as being different when + // project_issue_metadata_changes() is called, and therefore neither of + // these will ever be elements of the $comment_changes array. Since we do + // want them to be printed in issue emails, we just need to add their labels + // back into the $comment_changes array here, so that + // theme_project_issue_mail_summary_field() will know to print the data for + // these two fields. $comment_changes['name'] = array( 'label' => $fields['name'], ); @@ -524,8 +526,9 @@ function theme_project_issue_mail_summar // which haven't changed but should be printed anyway get processed. // For example, the project, category, etc. are printed in each email // whether or not they have changed. - if (isset($node->$field_name)) { - $summary_row .= " $text". project_issue_change_summary($field_name, $node->$field_name) ."\n"; + // @TODO: Should we really assume the field in is $node->project_issue[]? + if (isset($node->project_issue[$field_name])) { + $summary_row .= " $text". project_issue_change_summary($field_name, $node->project_issue[$field_name]) ."\n"; } } } Index: project_issue.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v retrieving revision 1.99 diff -u -p -r1.99 project_issue.module --- project_issue.module 7 Jan 2009 20:48:27 -0000 1.99 +++ project_issue.module 14 Jan 2009 01:59:38 -0000 @@ -632,8 +632,8 @@ function project_issue_project_edit_issu project_project_set_breadcrumb($node); drupal_set_title(check_plain($node->title)); - if (isset($node->components) && is_array($node->components)) { - $node->components = implode("\n", $node->components); + if (isset($node->project_issue['components']) && is_array($node->project_issue['components'])) { + $node->project_issue['components'] = implode("\n", $node->project_issue['components']); } return drupal_get_form('project_issue_project_edit_form', $node); } @@ -656,20 +656,20 @@ function project_issue_project_edit_form '#type' => 'checkbox', '#title' => t('Enable issue tracker'), '#return_value' => 1, - '#default_value' => isset($node->issues) ? $node->issues : 1, + '#default_value' => isset($node->project_issue['issues']) ? $node->project_issue['issues'] : 1, '#description' => t('Let users submit bug requests, patches, feature requests, support requests, etc.'), ); $form['issue']['components'] = array( '#type' => 'textarea', '#title' => t('Components'), - '#default_value' => isset($node->components) ? $node->components : NULL, + '#default_value' => isset($node->project_issue['components']) ? $node->project_issue['components'] : NULL, '#cols' => 20, '#rows' => 5, ); $form['issue']['help'] = array( '#type' => 'textarea', '#title' => t('Submission guidelines'), - '#default_value' => isset($node->help) ? $node->help : NULL, + '#default_value' => isset($node->project_issue['help']) ? $node->project_issue['help'] : NULL, '#cols' => 20, '#rows' => 5, ); @@ -683,7 +683,7 @@ function project_issue_project_edit_form $form['email']['mail_digest'] = array( '#type' => 'textfield', '#title' => t('Weekly critical issues report'), - '#default_value' => isset($node->mail_digest) ? $node->mail_digest : NULL, + '#default_value' => isset($node->project_issue['mail_digest']) ? $node->project_issue['mail_digest'] : NULL, '#size' => 20, '#maxlength' => 255, '#description' => t('To get a weekly digest of critical issues specify an e-mail address.'), @@ -691,7 +691,7 @@ function project_issue_project_edit_form $form['email']['mail_copy'] = array( '#type' => 'textfield', '#title' => t('Issues e-mail address'), - '#default_value' => isset($node->mail_copy) ? $node->mail_copy : NULL, + '#default_value' => isset($node->project_issue['mail_copy']) ? $node->project_issue['mail_copy'] : NULL, '#size' => 20, '#maxlength' => 255, '#description' => t('If you wish to receive a copy of all the issues to a central location specify an address here. Note: the copy will contain links to file attachments.'), @@ -709,7 +709,7 @@ function project_issue_project_edit_form '#type' => 'checkbox', '#title' => $choice, '#return_value' => $key, - '#default_value' => isset($node->mail_copy_filter[$key]) ? $node->mail_copy_filter[$key] : NULL, + '#default_value' => isset($node->project_issue['mail_copy_filter'][$key]) ? $node->project_issue['mail_copy_filter'][$key] : NULL, ); } $options = project_issue_state(); @@ -724,7 +724,7 @@ function project_issue_project_edit_form '#type' => 'checkbox', '#title' => check_plain($choice), '#return_value' => $key, - '#default_value' => isset($node->mail_copy_filter_state[$key]) ? $node->mail_copy_filter_state[$key] : NULL, + '#default_value' => isset($node->project_issue['mail_copy_filter_state'][$key]) ? $node->project_issue['mail_copy_filter_state'][$key] : NULL, ); } @@ -737,7 +737,7 @@ function project_issue_project_edit_form '#type' => 'checkbox', '#title' => t('Send monthly reminders to users'), '#return_value' => 1, - '#default_value' => isset($node->mail_reminder) ? $node->mail_reminder : NULL, + '#default_value' => isset($node->project_issue['mail_reminder']) ? $node->project_issue['mail_reminder'] : NULL, '#description' => t('Enabling this will send a monthly reminder to users that have open issues registered.'), ); } @@ -925,8 +925,8 @@ function project_issue_user_page($arg = while ($node = db_fetch_object($result)) { $node_obj = node_load($node->nid); $node->is_admin = node_access('update', $node_obj); - $node->issues = $node_obj->issues; - $node->releases = isset($node_obj->releases) ? $node_obj->releases : 0; + $node->project_issue['issues'] = $node_obj->issues; + $node->project_release['releases'] = isset($node_obj->project_release['releases']) ? $node_obj->project_release['releases'] : 0; if ($node->is_admin) { $any_admin = TRUE; } @@ -1051,12 +1051,12 @@ function project_issue_project_load(&$no if (!$project) { return $node; } - //assert($project); - $node->components = unserialize($project->components); - $node->mail_copy_filter = unserialize($project->mail_copy_filter); - $node->mail_copy_filter_state = unserialize($project->mail_copy_filter_state); + $node->project_issue = array(); + $node->project_issue['components'] = unserialize($project->components); + $node->project_issue['mail_copy_filter'] = unserialize($project->mail_copy_filter); + $node->project_issue['mail_copy_filter_state'] = unserialize($project->mail_copy_filter_state); foreach (array('issues', 'help', 'mail_digest', 'mail_copy', 'mail_reminder') as $field) { - $node->$field = $project->$field; + $node->project_issue[$field] = $project->$field; } return $node; } @@ -1067,9 +1067,9 @@ function project_issue_project_insert($n // other issue-related project settings, like the email notifications) // they'd use the "issues" subtab of the project edit tab (since none // of these fields are present on the initial project add form). - $node->issues = 1; - $node->components = serialize(array(t('Code'), t('Documentation'), t('Miscellaneous'), t('User interface'))); - db_query("INSERT INTO {project_issue_projects} (nid, issues, components) VALUES (%d, %d, '%s')", $node->nid, $node->issues, $node->components); + $node->project_issue['issues'] = 1; + $node->project_issue['components'] = serialize(array(t('Code'), t('Documentation'), t('Miscellaneous'), t('User interface'))); + db_query("INSERT INTO {project_issue_projects} (nid, issues, components) VALUES (%d, %d, '%s')", $node->nid, $node->project_issue['issues', $node->project_issue['components']); } function project_issue_project_delete($node) { @@ -1118,7 +1118,7 @@ function project_issue_comment_mass_upda function project_issue_set_breadcrumb($node, $project) { $extra = array(); $extra[] = l($project->title, 'node/'. $project->nid); - $extra[] = l(t('Issues'), 'project/issues/'. $project->uri); + $extra[] = l(t('Issues'), 'project/issues/'. $project->project['uri']); // Add the issue title if we're on a comment reply page. if (project_issue_is_comment_reply()) { $extra[] = l($node->title, 'node/'. $node->nid); @@ -1187,7 +1187,7 @@ function project_issue_views_arguments() */ function theme_project_issue_issue_link($node, $comment_id = NULL, $comment_number = NULL) { $path = "node/$node->nid"; - $attributes = array('title' => project_issue_state($node->sid)); + $attributes = array('title' => project_issue_state($node->project_issue['sid'])); if ($comment_id) { $title = "#$node->nid-$comment_number: $node->title"; $link = l($title, $path, $attributes, NULL, "comment-$comment_id"); @@ -1196,7 +1196,7 @@ function theme_project_issue_issue_link( $title = "#$node->nid: $node->title"; $link = l($title, $path, $attributes); } - $output = "sid\">$link"; + $output = "project_issue['sid'] ."\">$link"; return $output; } cvs diff: Diffing generate cvs diff: Diffing generate/po cvs diff: Diffing includes cvs diff: Diffing po cvs diff: Diffing scripts