print_mail.admin.inc

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).

Contains the administrative functions of the send by email module.

This file is included by the send by email module, and includes the settings form.

Functions

Namesort descending Description
@print_mail_settings Menu callback for the send by email module settings form.
print_mail_strings_settings Menu callback for the send by email module text strings settings form.
print_mail_strings_settings_delete Reset button callback for text strings settings form

File

sites/all/modules/local_contrib/print/print_mail/print_mail.admin.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains the administrative functions of the send by email module.
  5. *
  6. * This file is included by the send by email module, and includes the
  7. * settings form.
  8. *
  9. * @ingroup print
  10. */
  11. // Include MIME library
  12. @include_once('Mail/mime.php');
  13. /**
  14. * Menu callback for the send by email module settings form.
  15. *
  16. * @ingroup forms
  17. */
  18. function print_mail_settings() {
  19. $form['settings'] = array(
  20. '#type' => 'fieldset',
  21. '#title' => t('Send by email options'),
  22. );
  23. $form['settings']['print_mail_link_pos'] = array(
  24. '#type' => 'checkboxes',
  25. '#title' => t('Send by email link'),
  26. '#default_value' => variable_get('print_mail_link_pos', drupal_json_decode(PRINT_MAIL_LINK_POS_DEFAULT)),
  27. '#options' => array('link' => t('Links area'), 'corner' => t('Content corner'), 'block' => t('Block'), 'help' => t('Help area')),
  28. '#description' => t('Choose the location of the link(s) to the send by email page. The Links area is usually below the node content, whereas the Content corner is placed in the upper-right corner of the node content. Unselect all options to disable the link. Even if the link is disabled, you can still send a node by email by going to !path/nid where nid is the numeric id of the node.', array('!path' => PRINTMAIL_PATH)),
  29. );
  30. $form['settings']['print_mail_link_teaser'] = array(
  31. '#type' => 'checkbox',
  32. '#title' => t('Display send by email link in teaser'),
  33. '#default_value' => variable_get('print_mail_link_teaser', PRINT_MAIL_LINK_TEASER_DEFAULT),
  34. '#description' => t('Enabling this will display the link in teaser mode.'),
  35. );
  36. $form['settings']['adv_link'] = array(
  37. '#type' => 'fieldset',
  38. '#title' => t('Advanced link options'),
  39. '#collapsible' => TRUE,
  40. '#collapsed' => FALSE,
  41. );
  42. $form['settings']['adv_link']['print_mail_show_link'] = array(
  43. '#type' => 'radios',
  44. '#title' => t('Link style'),
  45. '#default_value' => variable_get('print_mail_show_link', PRINT_MAIL_SHOW_LINK_DEFAULT),
  46. '#options' => array(1 => t('Text only'), 2 => t('Icon only'), 3 => t('Icon and Text')),
  47. '#description' => t('Select the visual style of the link.'),
  48. );
  49. $form['settings']['adv_link']['print_mail_link_use_alias'] = array(
  50. '#type' => 'checkbox',
  51. '#title' => t('Use URL alias instead of node ID'),
  52. '#default_value' => variable_get('print_mail_link_use_alias', PRINT_MAIL_LINK_USE_ALIAS_DEFAULT),
  53. '#description' => t('Enabling this will create the link using the URL alias instead of the node ID.'),
  54. );
  55. $form['settings']['adv_link']['print_mail_link_class'] = array(
  56. '#type' => 'textfield',
  57. '#title' => t('Link class'),
  58. '#default_value' => variable_get('print_mail_link_class', PRINT_MAIL_LINK_CLASS_DEFAULT),
  59. '#size' => 60,
  60. '#maxlength' => 250,
  61. '#description' => t('This can be used by themers to change the link style or by jQuery modules to open in a new window (e.g. greybox or thickbox). Multiple classes can be specified, separated by spaces.'),
  62. );
  63. $form['settings']['adv_link']['print_mail_node_link_visibility'] = array(
  64. '#type' => 'radios',
  65. '#title' => t('Link visibility'),
  66. '#default_value' => variable_get('print_mail_node_link_visibility', PRINT_MAIL_NODE_LINK_VISIBILITY_DEFAULT),
  67. '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')),
  68. );
  69. $form['settings']['adv_link']['print_mail_node_link_pages'] = array(
  70. '#type' => 'textarea',
  71. '#default_value' => variable_get('print_mail_node_link_pages', PRINT_MAIL_NODE_LINK_PAGES_DEFAULT),
  72. '#rows' => 3,
  73. '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
  74. );
  75. if (module_exists('php')) {
  76. $access = user_access('use PHP for settings');
  77. if ($form['settings']['adv_link']['print_mail_node_link_visibility']['#default_value'] == 2 && !$access) {
  78. $form['settings']['adv_link']['print_mail_node_link_visibility'] = array('#type' => 'value', '#value' => 2);
  79. $form['settings']['adv_link']['print_mail_node_link_pages'] = array('#type' => 'value', '#value' => $form['settings']['adv_link']['print_mail_node_link_pages']['#default_value']);
  80. }
  81. elseif ($access) {
  82. $form['settings']['adv_link']['print_mail_node_link_visibility']['#options'][] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
  83. $form['settings']['adv_link']['print_mail_node_link_pages']['#description'] .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
  84. }
  85. }
  86. $form['settings']['adv_link']['print_mail_sys_link_visibility'] = array(
  87. '#type' => 'radios',
  88. '#title' => t('Show link in system (non-content) pages'),
  89. '#description' => 'Any page that is not a Drupal node. Usually pages generated by Drupal or a module such as Views or Panels.',
  90. '#default_value' => variable_get('print_mail_sys_link_visibility', PRINT_MAIL_SYS_LINK_VISIBILITY_DEFAULT),
  91. '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')),
  92. );
  93. $form['settings']['adv_link']['print_mail_sys_link_pages'] = array(
  94. '#type' => 'textarea',
  95. '#default_value' => variable_get('print_mail_sys_link_pages', PRINT_MAIL_SYS_LINK_PAGES_DEFAULT),
  96. '#rows' => 3,
  97. '#description' => t('Setting this option will add a send by email link on pages created by Drupal or the enabled modules.') . '<br />' .
  98. t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
  99. );
  100. if (module_exists('php')) {
  101. if ($form['settings']['adv_link']['print_mail_sys_link_visibility']['#default_value'] == 2 && !$access) {
  102. $form['settings']['adv_link']['print_mail_sys_link_visibility'] = array('#type' => 'value', '#value' => 2);
  103. $form['settings']['adv_link']['print_mail_sys_link_pages'] = array('#type' => 'value', '#value' => $form['settings']['adv_link']['print_mail_sys_link_pages']['#default_value']);
  104. }
  105. elseif ($access) {
  106. $form['settings']['adv_link']['print_mail_sys_link_visibility']['#options'][] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
  107. $form['settings']['adv_link']['print_mail_sys_link_pages']['#description'] .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
  108. }
  109. }
  110. $form['settings']['adv_link']['print_mail_book_link'] = array(
  111. '#type' => 'radios',
  112. '#title' => t('Link in book hierarchy nodes'),
  113. '#default_value' => variable_get('print_mail_book_link', PRINT_MAIL_BOOK_LINK_DEFAULT),
  114. '#options' => array(t('No link'), t('Current page and sub-pages'), t('Current page only')),
  115. );
  116. $form['settings']['print_mail_hourly_threshold'] = array(
  117. '#type' => 'select',
  118. '#title' => t('Hourly threshold'),
  119. '#default_value' => variable_get('print_mail_hourly_threshold', PRINT_MAIL_HOURLY_THRESHOLD),
  120. '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)),
  121. '#description' => t('The maximum number of emails a user can send per hour.'),
  122. );
  123. $form['settings']['print_mail_use_reply_to'] = array(
  124. '#type' => 'checkbox',
  125. '#title' => t('Use Reply-To header'),
  126. '#default_value' => variable_get('print_mail_use_reply_to', PRINT_MAIL_USE_REPLY_TO),
  127. '#description' => t("When enabled, any email sent will use the provided user and username in the 'Reply-To' header, with the site's email address used in the 'From' header (configured in !link). Enabling this helps in preventing email being flagged as spam.", array('!link' => l(t('Site information'), 'admin/config/system/site-information'))),
  128. );
  129. $form['settings']['print_mail_teaser_default'] = array(
  130. '#type' => 'checkbox',
  131. '#title' => t('Send only the teaser'),
  132. '#default_value' => variable_get('print_mail_teaser_default', PRINT_MAIL_TEASER_DEFAULT_DEFAULT),
  133. '#description' => t("If selected, the default choice will be to send only the node's teaser instead of the full content."),
  134. );
  135. $form['settings']['print_mail_teaser_choice'] = array(
  136. '#type' => 'checkbox',
  137. '#title' => t('Enable teaser/full mode choice'),
  138. '#default_value' => variable_get('print_mail_teaser_choice', PRINT_MAIL_TEASER_CHOICE_DEFAULT),
  139. '#description' => t('If checked, the user will be able to choose between sending the full content or only the teaser at send time.'),
  140. );
  141. $form['settings']['print_mail_send_option_default'] = array(
  142. '#type' => 'select',
  143. '#title' => t('Default email sending format'),
  144. '#default_value' => variable_get('print_mail_send_option_default', PRINT_MAIL_SEND_OPTION_DEFAULT),
  145. '#options' => array(
  146. 'sendlink' => t('Link'),
  147. 'sendpage' => t('Inline HTML'),
  148. ),
  149. );
  150. if (class_exists('Mail_mime')) {
  151. $form['settings']['print_mail_send_option_default']['#options']['inline-attachment'] = t('Inline HTML with Attachment');
  152. $form['settings']['print_mail_send_option_default']['#options']['plain-attachment'] = t('Plain Text with Attachment');
  153. }
  154. $form['settings']['print_mail_job_queue'] = array(
  155. '#type' => 'checkbox',
  156. '#title' => t('Send emails using queue'),
  157. '#default_value' => variable_get('print_mail_job_queue', PRINT_MAIL_JOB_QUEUE_DEFAULT),
  158. '#description' => t("Selecting this option, email delivery will be performed by the system queue during each cron run. Leaving this unselected, the email will be sent immediately, but the site will take slightly longer to reply to the user."),
  159. );
  160. $form['settings']['print_mail_display_sys_urllist'] = array(
  161. '#type' => 'checkbox',
  162. '#title' => t('Printer-friendly URLs list in system pages'),
  163. '#default_value' => variable_get('print_mail_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
  164. '#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
  165. );
  166. return system_settings_form($form);
  167. }
  168. /**
  169. * Menu callback for the send by email module text strings settings form.
  170. *
  171. * @ingroup forms
  172. */
  173. function print_mail_strings_settings() {
  174. drupal_set_message(t("Saving these strings will disable their translation via Drupal's language system. Use the reset button to return them to the original state."), 'warning', FALSE);
  175. $form['print_mail_text'] = array(
  176. '#type' => 'fieldset',
  177. '#title' => t('Text strings'),
  178. );
  179. $form['print_mail_text']['print_mail_link_text'] = array(
  180. '#type' => 'textfield',
  181. '#title' => t('Link text'),
  182. '#default_value' => variable_get('print_mail_link_text', t('Send by email')),
  183. '#description' => t('Text used in the link to the send by-email form.'),
  184. );
  185. $form['print_mail_text']['print_mail_text_title'] = array(
  186. '#type' => 'textfield',
  187. '#title' => t('Form page title'),
  188. '#default_value' => variable_get('print_mail_text_title', t('Send page by email')),
  189. '#description' => t("Text used as the page title of the mail submission form. Requires a menu rebuild to apply."),
  190. );
  191. $form['print_mail_text']['print_mail_text_subject'] = array(
  192. '#type' => 'textfield',
  193. '#title' => t('Message subject'),
  194. '#default_value' => variable_get('print_mail_text_subject', t('!user has sent you a message from !site')),
  195. '#description' => t("email subject line. The sender's name will appear in place of !user in the subject. The web site name will be inserted in place of !site. The page title replaces !title."),
  196. );
  197. $form['print_mail_text']['print_mail_text_message'] = array(
  198. '#type' => 'textarea',
  199. '#title' => t('Message preamble'),
  200. '#default_value' => variable_get('print_mail_text_message', t('Message from sender')),
  201. '#description' => t('email message preamble. The sender will be able to add their own message after this.'),
  202. );
  203. $form['print_mail_text']['print_mail_text_content'] = array(
  204. '#type' => 'textarea',
  205. '#title' => t('Message content'),
  206. '#default_value' => variable_get('print_mail_text_content', ''),
  207. '#description' => t('Set the default contents of the message.'),
  208. );
  209. $form['print_mail_text']['print_mail_text_confirmation'] = array(
  210. '#type' => 'textfield',
  211. '#title' => t('Thank you message'),
  212. '#default_value' => variable_get('print_mail_text_confirmation', t('Thank you for spreading the word about !site.')),
  213. '#description' => t('This message will be displayed after the user successfully submits the form.'),
  214. );
  215. $form['print_mail_text']['reset'] = array(
  216. '#type' => 'submit',
  217. '#value' => t('Reset to defaults'),
  218. '#submit' => array('print_mail_strings_settings_delete'),
  219. );
  220. return system_settings_form($form);
  221. }
  222. /**
  223. * Reset button callback for text strings settings form
  224. *
  225. * @ingroup forms
  226. */
  227. function print_mail_strings_settings_delete() {
  228. variable_del('print_mail_link_text');
  229. variable_del('print_mail_text_title');
  230. variable_del('print_mail_text_subject');
  231. variable_del('print_mail_text_message');
  232. variable_del('print_mail_text_content');
  233. variable_del('print_mail_text_confirmation');
  234. }

Related topics

Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.