? .svn
? p_219181_editown.patch
? p_238958_typos.patch
? p_239336_pagebreak.patch
? components/.svn
? po/.svn
Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.113.2.70.2.30
diff -u -p -r1.113.2.70.2.30 webform.module
--- webform.module 21 Mar 2008 23:46:54 -0000 1.113.2.70.2.30
+++ webform.module 28 Mar 2008 14:23:41 -0000
@@ -337,7 +337,7 @@ function webform_delete(&$node) {
}
/**
- * Implemenation of hook_load().
+ * Implementation of hook_load().
*/
function webform_load($node) {
$additions = new stdClass();
@@ -849,6 +849,16 @@ function webform_view(&$node, $teaser =
$node = node_prepare($node, $teaser);
$node->content['webform'] = array('#value' => $output, '#weight' => 1);
+ if (user_access('edit own webform submissions')) {
+ include_once(drupal_get_path('module', 'webform') ."/webform_submissions.inc");
+ $previous_submissions = webform_get_submissions($node->nid, NULL, $user->uid);
+ if (is_array($previous_submissions) && count($previous_submissions) >= 1) {
+ foreach ($previous_submissions as $sid => $submission) {
+ drupal_set_message(t('You may !edit from %date.', array('!edit' => l(t('edit your previous submission'), 'node/1/submission/'. $sid .'/edit'), '%date' => format_date($submission->submitted, 'small'))));
+ }
+ }
+ }
+
return $node;
}
@@ -998,10 +1008,10 @@ function webform_client_form(&$node, $su
'#suffix' => '',
);
$form['navigation']['previous'] = array(
- '#value' => $previous ? l(t('Previous submission'), 'node/'. $node->nid .'/submission/'. $previous . ($enabled ? '/edit' : '') , array('class' => 'webform-submission-previous'), ($enabled ? 'destination=node/'. $node->nid .'/submission/'. $previous .'/edit' : NULL)) : ''. t('Previous submission') .'',
+ '#value' => $previous ? l(t('Previous submission'), 'node/'. $node->nid .'/submission/'. $previous . ($enabled ? '/edit' : '') , array('class' => 'webform-submission-previous'), ($enabled ? 'destination=node/'. $node->nid .'/submission/'. $previous .'/edit' : NULL)) : NULL,
);
$form['navigation']['next'] = array(
- '#value' => $next ? l(t('Next submission'), 'node/'. $node->nid .'/submission/'. $next . ($enabled ? '/edit' : ''), array('class' => 'webform-submission-next'), ($enabled ? 'destination=node/'. $node->nid .'/submission/'. $next .'/edit' : NULL)) : ''. t('Next submission') .'',
+ '#value' => $next ? l(t('Next submission'), 'node/'. $node->nid .'/submission/'. $next . ($enabled ? '/edit' : ''), array('class' => 'webform-submission-next'), ($enabled ? 'destination=node/'. $node->nid .'/submission/'. $next .'/edit' : NULL)) : NULL,
);
$form['submission_info'] = array(
Index: webform_submissions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform_submissions.inc,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 webform_submissions.inc
--- webform_submissions.inc 21 Mar 2008 21:19:57 -0000 1.1.2.8
+++ webform_submissions.inc 28 Mar 2008 14:23:41 -0000
@@ -136,13 +136,13 @@ function webform_submission_delete_form(
$form['sid'] = array('#type' => 'value', '#value' => $sid);
$question = t("Are you sure you want to delete this submission?");
- return confirm_form($form, $question, 'node/'. $nid .'/results', NULL, t('Delete'), t('Cancel'));
+ return confirm_form($form, $question, 'node/'. $nid . (user_access('access webform results') ? '/results' : ''), NULL, t('Delete'), t('Cancel'));
}
function webform_submission_delete_form_submit($form_id, $form_values) {
webform_submission_delete($form_values['nid'], $form_values['sid']);
drupal_set_message(t("Submission deleted"));
- drupal_goto('node/'. $form_values['nid'] .'/results');
+ drupal_goto('node/'. $form_values['nid'] . (user_access('access webform results') ? '/results' : ''));
}
/**
@@ -151,21 +151,30 @@ function webform_submission_delete_form_
* @param $nid
* The node ID for which submissions are being fetched.
* @param $header
- * If the results of this fetch will be used in a sortable table, pass the
- * array header of the table.
+ * If the results of this fetch will be used in a sortable
+ * table, pass the array header of the table.
+ * @param $uid
+ * Optional; the user ID to filter the submissions by.
+ * @return $submissions
+ * An array of submissions matching your filters.
*/
-function webform_get_submissions($nid, $header = NULL) {
+function webform_get_submissions($nid, $header = NULL, $uid = NULL) {
$query = 'SELECT s.*, sd.cid, sd.no, sd.data, u.name, u.mail, u.status '.
'FROM {webform_submissions} s '.
'LEFT JOIN {webform_submitted_data} sd ON sd.sid = s.sid '.
'LEFT JOIN {users} u ON u.uid = s.uid '.
'WHERE sd.nid = %d';
+ if ($uid) {
+ $query .= ' AND u.uid = %d';
+ }
+
if (is_array($header)) {
$query .= tablesort_sql($header);
}
- $res = db_query($query, $nid);
+ // it's ok if $uid is NULL here.
+ $res = db_query($query, $nid, $uid);
$submissions = array();
$previous = array();