'; $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 = '
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
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('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; }