');
// Prepare the form.
$form = array(
'redirect_path' => array(
'#type' => 'hidden',
'#value' => $path,
),
);
$form['#uaid'] = $form_state['uaid'];
if (!empty($form_state['uaid'])) {
$form['#uaid'] = $form_state['uaid'];
}
$output = confirm_form($form,
t('Are you sure you want to delete this message?'),
$path,
t('This action cannot be undone.'),
t('Delete'),
t('Cancel'));
return $output;
}
/**
* Handler for wipe confirmation
*/
function heartbeat_delete_log_confirm_submit($form, &$form_state) {
// Set the flag so the form knows it's been executed.
$form_state['executed'] = TRUE;
//$form_state['complete'] = TRUE;
if (!empty($form_state['uaid'])) {
// Delete the activity message.
heartbeat_activity_delete(array($form_state['uaid']));
}
}
/**
* ahah callback
*/
function heartbeat_activity_ahah($element) {
$form_state = array('storage' => NULL, 'submitted' => FALSE);
$form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters'];
$form_id = array_shift($args);
$form['#post'] = $_POST;
$form['#redirect'] = FALSE;
$form['#programmed'] = FALSE;
$form_state['post'] = $_POST;
drupal_process_form($form_id, $form, $form_state);
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
$javascript = drupal_add_js(NULL, NULL, 'header');
$_SESSION['messages'] = array();
if (isset($form['hb_fields'][$element])) {
$ahah_form = $form['hb_fields'][$element];
}
elseif(isset($form['fs_settings'][$element])) {
$ahah_form = $form['fs_settings'][$element];
}
if ($ahah_form) {
//drupal_set_message(_heartbeat_activity_get_time($form_state['values'][$element]));
$ahah_form['#description'] = '' . t('Currently set ') . _heartbeat_activity_get_time($form_state['values'][$element]) . '
';
unset($ahah_form['#prefix'], $ahah_form['#suffix']); // Prevent duplicate wrappers.
drupal_json(array(
'status' => TRUE,
'data' => theme('status_messages') . drupal_render($ahah_form),
'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
));
}
else {
drupal_json(array(
'status' => FALSE,
'data' => t('Element not found: @element', array('@element' => $element)),
'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
));
}
exit;
}