Index: webform_report.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform_report/Attic/webform_report.inc,v retrieving revision 1.1.2.19 diff -u -p -r1.1.2.19 webform_report.inc --- webform_report.inc 28 Oct 2008 13:26:51 -0000 1.1.2.19 +++ webform_report.inc 19 Feb 2009 22:17:56 -0000 @@ -98,7 +98,9 @@ function _webform_report_get_body_conten $values[$row->sid][-2] = array('data' => date('Y-m-d', $row->submitted), 'field' => -2); $values[$row->sid][-3] = array('data' => date('H:s', $row->submitted), 'field' => -3); $values[$row->sid][-4] = array('data' => $row->remote_addr, 'field' => -4); - $values[$row->sid][-5] = array('data' => '' . t('edit') . '', 'field' => -5); + // Add destination to edit link. + $destination = drupal_get_destination(); + $values[$row->sid][-5] = array('data' => l(t('edit'), 'node/'. $row->nid .'/submission/'. $row->sid .'/edit', array('query' => $destination)), 'field' => -5); // The attribute 'field' is used to preserve the cid, as array_multisort re-indexes the array. $values[$row->sid][$row->cid] = array('data' => $row->data, 'field' => $row->cid); } @@ -250,13 +252,17 @@ function _webform_report_prepare_report_ if (is_array($node->components)) { $report_fields = array(); $report_values = array(); + // Get current user's uid. + global $user; foreach($fields as $key1 => $field) { if (in_array($key1, $node->components)) { $report_fields[$key1] = $fields[$key1]; } foreach($values as $key2 => $value) { if (in_array($value[$key1]['field'], $node->components)) { - $report_values[$key2][$key1] = $value[$key1]; + if (((user_access("access own webform results in reports")) && $user->uid == _webform_report_get_uid_for_user($value[-1]['data'])) || (user_access("access all webform results in reports"))) { + $report_values[$key2][$key1] = $value[$key1]; + } } } } @@ -306,6 +312,7 @@ function _webform_report_add_data_links( function _webform_report_filter_values($values, $node) { $filtered_values = array(); foreach($values as $key => $value) { + switch($node->filter_type) { // Begins with x. case 1: Index: webform_report.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform_report/webform_report.module,v retrieving revision 1.2.2.55.2.37 diff -u -p -r1.2.2.55.2.37 webform_report.module --- webform_report.module 28 Oct 2008 13:45:38 -0000 1.2.2.55.2.37 +++ webform_report.module 19 Feb 2009 22:17:56 -0000 @@ -31,7 +31,7 @@ function webform_report_help($path) { * Implementation of hook_perm */ function webform_report_perm() { - return array('access webform reports', 'create webform reports', 'edit webform reports', 'edit own webform reports'); + return array('access webform reports', 'create webform reports', 'edit webform reports', 'edit own webform reports', 'access all webform results in reports', 'access own webform results in reports'); } /** @@ -227,7 +227,7 @@ function webform_report_update($node) { // What to update, based on url arguments. if(arg(2) == 'add' | arg(2) == 'edit') { if(arg(4) == 'criteria') { - db_query("UPDATE {webform_report}u SET wnid = %d, kcid = %d, sort = %d, components = '%s', filter_type = %d, filter_value = '%s', results_per_page = %d + db_query("UPDATE {webform_report} SET wnid = %d, kcid = %d, sort = %d, components = '%s', filter_type = %d, filter_value = '%s', results_per_page = %d WHERE nid = '" . $node->nid . "'", $node->wnid, $node->kcid, $node->sort, addslashes(serialize($node->components)), $node->filter_type, $node->filter_value, $node->results_per_page );