'; $output .= theme('citizenspeak_message_preview', $node); // Generate form, should probably be handled by forms.module $form = ''; foreach (array('name', 'email', 'address', 'city') as $field) { if (variable_get('citizenspeak_show_'.$field, 1)) { $form .= form_textfield(t(ucfirst($field)), $field, $edit[$field], '', '', null, null, true); } } if (variable_get('citizenspeak_show_state', 1)) { $state_array = array('', 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'); $form .= form_select(t('State'), 'state', $edit['state'], drupal_map_assoc($state_array), null, 0, false, true); } if (variable_get('citizenspeak_show_zip', 1)) { $form .= form_textfield(t('ZIP Code'), 'zip', $edit['zip'], 5, 5, null, null, true); } if (variable_get('citizenspeak_show_phone', 1)) { $form .= form_textfield(t('Phone'), 'phone', $edit['phone'], '', '', null, null, false); } if (variable_get('citizenspeak_show_fax', 1)) { $form .= form_textfield(t('Fax'), 'fax', $edit['fax'], '', '', null, null, false); } $form .= form_textarea(t('Personal Statement'), 'personal_statement', $edit['personal_statement'], 60, 20, t('This will be included in the email sent.')); // Only make it a form if the node has been saved if ($node->nid) { $form .= form_submit(t('Send')); $output .= form($form, 'post', url('node/'. $node->nid. '/send')); } else { $output .= $form; } $output .= ''; return $output; } // function theme_citizenspeak_form_display /** * Display what the emailed form will look like * * @param $node * A CitizenSpeak campaign node * @return A preview of the message CitizenSpeak will send * @ingroup themeable */ function theme_citizenspeak_message_preview($node) { $participant = new StdClass(); $participant->name = t('Your Name'); $participant->organization = t('Your Organization'); $participant->email = t('you@example.com'); $participant->address = t('123 Your St.'); $participant->city = t('Yousville'); $participant->state = t('YO'); $participant->zip = t('12345'); $participant->phone = t('(123)456-7890'); $participant->fax = t('(123)456-7890x123'); $participant->personal_statement = t('Your Personal Statement'); $message = theme("citizenspeak_message", $node, $participant); $headers = theme("citizenspeak_message_headers", $node, $participant); $output = '
'; $output .= ''; $output .= t("From: ") ."$participant->name <$participant->email>
"; if (variable_get('citizenspeak_show_to', 1)) { $output .= t("To: ") . htmlentities($node->email_recipients) ."
"; } $output .= t("Subject: ") . htmlentities($node->title, ENT_COMPAT, 'UTF-8') ."

"; $output .= check_output($message); $output .= '
'; $output .= '
'; return theme_box(t('Message Preview'), $output); } // function theme_citizenspeak_block_popular /** * Display the thank you page after the campaign has been participated in * * @param $node * A CitizenSpeak campaign node * @param $user * The owner of the node * @ingroup themeable */ function theme_citizenspeak_thank_you($node, $user) { $user = user_load(array("uid" => $node->uid)); drupal_set_title(t('Thank You')); $output = '
'; $output .= t('

Thank you for supporting our campaign. Your email is currently being sent to the individuals identified by %name. You can also be of great help to the campaign simply by passing the word along. All it takes is a brief letter to your e-mail circle.

', array("%name" => format_name($user))); // Add action list $tell_a_friend_text = t("Dear Friend, Please join me in supporting the %title campaign. It's easy, just go to %url and make your voice heard. Thank you, ", array('%title' => $node->title, '%url' => url('node/'. $node->nid, null, null, true))); $tell_a_friend_link = "mailto:?subject=". rawurlencode($node->title) ."&body=". rawurlencode($tell_a_friend_text); $actions = array(t('Tell a friend', array("%uri" => $tell_a_friend_link))); if ($user->request_memberships) { $membership_link = sprintf('https://www.paypal.com/xclick/business=%s&item_name=%s&amount=%.2f&no_note=1&no_shipping=1&tax=0¤cy_code=USD', urlencode($user->membership_paypal_id.t(" membership dues")), urlencode($user->username), urlencode($user->membership_paypal_amount)); $actions[] = t('Become a member. Join for $%amount per year.', array("%link" => $membership_link, "%amount" => $user->membership_paypal_amount)); } if ($user->request_donations) { $donation_link = sprintf('https://www.paypal.com/xclick/business=%s&item_name=%s&no_note=1&no_shipping=1&tax=0¤cy_code=USD', urlencode($user->donation_paypal_id), urlencode($user->username.t(' donation'))); $actions[] = t('Make a donation.', array("%link" => $donation_link)); } if ($user->request_volunteers) { $actions[] = t('Become a volunteer', array("%email" => $user->volunteer_email)); } $output .= theme('item_list', $actions); if ($user->include_additional_text) { $output .= "

$user->additional_text

"; } if ($user->request_feedback) { $output .= t('

If you have any questions, feel free to contact %email.

', array("%email" => $user->feedback_email)); } $output .= t('

Sincerely,
%name

', array("%name" => format_name($user))); $output .= '
'; return $output; } /** * Display the participation statistics page * * @param $params * An associative array with the following keys: * total_emails * total_zips * last_email * zips * @ingroup themeable */ function theme_citizenspeak_statistics_page($params) { drupal_set_title(t('Campaign Statistics')); $output = '
'; $output .= t("Total Emails Sent: %count
", array("%count" => $params['total_emails'])); $output .= t('Unique ZIP Codes: %count
', array("%count" => $params['total_zips'])); $output .= t('Last Email Sent: %count
', array("%count" => $params['last_email'])); $output .= t("

Download a report to your computer by choosing from the options below:

"); $download_fields .= form_select(t('File format'), 'format', null, array("text" => t("text file"), "excel" => t("excel file"), "dbimport" => t("db import file"))); $download_fields .= form_submit(t("download"), 'op'); // If clean URLs aren't enabled, include the path if (!variable_get('clean_url', 0)) { $download_fields .= ''; } $output .= form($download_fields, 'get'); $output .= t('

ZIP Code Summary

'); $output .= theme_table(array(t('ZIP Code'), t('Emails')), $params['zips']); $output .= '
'; return $output; } /** * The content of an email to be sent * * @param $node * A CitizenSpeak campaign node * @param $participant * A CitizenSpeak campaign participant * @ingroup themeable */ function theme_citizenspeak_message($node, $participant) { // campaign_format is whether to include the personal statement at the top if ($node->campaign_format) { $output .= "$participant->personal_statement "; } $output .= " $node->email_message $participant->name $participant->organization $participant->address $participant->city, $participant->state " . (variable_get('citizenspeak_show_zip', 1) ? $participant->zip : ""); if ($participant->phone && variable_get('citizenspeak_show_phone', 1)) { $output .= " Phone: $participant->phone"; } if ($participant->fax && variable_get('citizenspeak_show_fax', 1)) { $output .= " Fax: $participant->fax"; } if (!$node->campaign_format) { $output .= " p.s. $participant->personal_statement"; } $sig = t(variable_get('citizenspeak_signature', ""), array("%title" => $node->title, "%url" => url("node/". $node->nid, null, null, true), "%nid" => $node->nid)); if (strlen($sig)) { $output .= " -- $sig"; } return $output; } /** * Additional headers to add to emails * * @param $node * A CitizenSpeak campaign node * @param $participant * A CitizenSpeak campaign participant * @ingroup themeable */ function theme_citizenspeak_message_headers($node, $participant) { return "From: {$participant->name} <{$participant->email}> X-Citizenspeak-Id: $node->nid Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable"; } /** * Debugging Page * * @param $node * A CitizenSpeak campaign node * @param $message * The body of a message, from theme_citizenspeak_message() * @param $headers * Additional headers, from theme_citizenspeak_message_headers() */ function theme_citizenspeak_debug_page($node, $message, $headers) { drupal_set_title(t('Debugging Mode')); $output = t('

Message not sent because the system is in debugging mode. Use the CitizenSpeak settings to turn of debugging mode. The email that would have been sent is below.

', array("%settings_url" => url("admin/settings/citizenspeak"))); $output .= '
';
  $output .= htmlentities("{$headers}\n");
  $output .= htmlentities("To: {$node->email_recipients}\n");
  $output .= htmlentities("Subject: {$node->title}\n");
  $output .= htmlentities("\n{$message}\n");
  $output .= '
'; $output .= l(t('Continue to Thank You page'), "node/". $node->nid."/thank_you"); return $output; }