| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.5 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 7 | +--------------------------------------------------------------------+ |
| 8 | | This file is a part of CiviCRM. | |
| 9 | | | |
| 10 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 11 | | under the terms of the GNU Affero General Public License | |
| 12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 13 | | | |
| 14 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 17 | | See the GNU Affero General Public License for more details. | |
| 18 | | | |
| 19 | | You should have received a copy of the GNU Affero General Public | |
| 20 | | License and the CiviCRM Licensing Exception along | |
| 21 | | with this program; if not, contact CiviCRM LLC | |
| 22 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 23 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 25 | +--------------------------------------------------------------------+ |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * |
| 30 | * @package CRM |
| 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
| 32 | * $Id: Display.php 36505 2011-10-03 14:19:56Z lobo $ |
| 33 | * |
| 34 | */ |
| 35 | |
| 36 | /** |
| 37 | * This class generates form components for the component preferences |
| 38 | * |
| 39 | */ |
| 40 | class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences { |
| 41 | function preProcess() { |
| 42 | CRM_Utils_System::setTitle(ts('CiviMail Component Settings')); |
| 43 | $this->_varNames = array( |
| 44 | CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => |
| 45 | array( |
| 46 | 'profile_double_optin' => |
| 47 | array( |
| 48 | 'html_type' => 'checkbox', |
| 49 | 'title' => ts('Enable Double Opt-in for Profile Group(s) field'), |
| 50 | 'weight' => 1, |
| 51 | 'description' => ts('When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.'), |
| 52 | ), |
| 53 | 'profile_add_to_group_double_optin' => |
| 54 | array( |
| 55 | 'html_type' => 'checkbox', |
| 56 | 'title' => ts('Enable Double Opt-in for Profiles which use the "Add to Group" setting'), |
| 57 | 'weight' => 2, |
| 58 | 'description' => ts('When CiviMail is enabled and a profile uses the "Add to Group" setting, users who complete the profile form will receive a confirmation email. They must respond (opt-in) before they are added to the group.'), |
| 59 | ), |
| 60 | 'track_civimail_replies' => |
| 61 | array( |
| 62 | 'html_type' => 'checkbox', |
| 63 | 'title' => ts('Track replies using VERP in Reply-To header'), |
| 64 | 'weight' => 3, |
| 65 | 'description' => ts('If checked, mailings will default to tracking replies using VERP-ed Reply-To.'), |
| 66 | ), |
| 67 | 'civimail_workflow' => |
| 68 | array( |
| 69 | 'html_type' => 'checkbox', |
| 70 | 'title' => ts('Enable workflow support for CiviMail'), |
| 71 | 'weight' => 4, |
| 72 | 'description' => ts('Drupal-only. Rules module must be enabled (beta feature - use with caution).'), |
| 73 | ), |
| 74 | 'civimail_multiple_bulk_emails' => |
| 75 | array( |
| 76 | 'html_type' => 'checkbox', |
| 77 | 'title' => ts('Enable multiple bulk email address for a contact.'), |
| 78 | 'weight' => 5, |
| 79 | 'description' => ts('CiviMail will deliver a copy of the email to each bulk email listed for the contact.'), |
| 80 | ), |
| 81 | 'civimail_server_wide_lock' => |
| 82 | array( |
| 83 | 'html_type' => 'checkbox', |
| 84 | 'title' => ts('Enable global server wide lock for CiviMail'), |
| 85 | 'weight' => 6, |
| 86 | 'description' => NULL, |
| 87 | ), |
| 88 | 'include_message_id' => |
| 89 | array( |
| 90 | 'html_type' => 'checkbox', |
| 91 | 'title' => ts('Enable CiviMail to generate Message-ID header'), |
| 92 | 'weight' => 7, |
| 93 | 'description' => NULL, |
| 94 | ), |
| 95 | 'write_activity_record' => |
| 96 | array( |
| 97 | 'html_type' => 'checkbox', |
| 98 | 'title' => ts('Enable CiviMail to create activities on delivery'), |
| 99 | 'weight' => 8, |
| 100 | 'description' => NULL, |
| 101 | ), |
| 102 | 'disable_mandatory_tokens_check' => |
| 103 | array( |
| 104 | 'html_type' => 'checkbox', |
| 105 | 'title' => ts('Disable check for mandatory tokens'), |
| 106 | 'weight' => 9, |
| 107 | 'description' => ts('Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.'), |
| 108 | ), |
| 109 | 'dedupe_email_default' => |
| 110 | array( |
| 111 | 'html_type' => 'checkbox', |
| 112 | 'title' => ts('CiviMail dedupes e-mail addresses by default'), |
| 113 | 'weight' => 10, |
| 114 | 'description' => NULL, |
| 115 | ), |
| 116 | 'hash_mailing_url' => |
| 117 | array( |
| 118 | 'html_type' => 'checkbox', |
| 119 | 'title' => ts('Hashed Mailing URL\'s'), |
| 120 | 'weight' => 11, |
| 121 | 'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID', |
| 122 | ), |
| 123 | ), |
| 124 | ); |
| 125 | |
| 126 | parent::preProcess(); |
| 127 | } |
| 128 | |
| 129 | function postProcess() { |
| 130 | // check if mailing tab is enabled, if not prompt user to enable the tab if "write_activity_record" is disabled |
| 131 | $params = $this->controller->exportValues($this->_name); |
| 132 | |
| 133 | if (empty($params['write_activity_record'])) { |
| 134 | $existingViewOptions = CRM_Core_BAO_Setting::getItem( |
| 135 | CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, |
| 136 | 'contact_view_options' |
| 137 | ); |
| 138 | |
| 139 | $displayValue = CRM_Core_OptionGroup::getValue('contact_view_options', 'CiviMail', 'name'); |
| 140 | $viewOptions = explode(CRM_Core_DAO::VALUE_SEPARATOR, $existingViewOptions); |
| 141 | |
| 142 | if (!in_array($displayValue, $viewOptions)) { |
| 143 | $existingViewOptions .= $displayValue . CRM_Core_DAO::VALUE_SEPARATOR; |
| 144 | |
| 145 | CRM_Core_BAO_Setting::setItem($existingViewOptions, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options'); |
| 146 | CRM_Core_Session::setStatus(ts('We have automatically enabled the Mailings tab for the Contact Summary screens |
| 147 | so that you can view mailings sent to each contact.'), ts('Saved'), 'success'); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | parent::postProcess(); |
| 152 | } |
| 153 | } |