You are here

function support_admin_settings in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.admin.inc \support_admin_settings()
1 string reference to 'support_admin_settings'
support_menu in ./support.module
Implementation of hook_menu().

File

./support.admin.inc, line 358
support.admin.inc

Code

function support_admin_settings() {
  $form = array();
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['general']['support_autocomplete_limit'] = array(
    '#type' => 'select',
    '#title' => t('Auto-complete limit'),
    '#description' => t('A threshold above which select fields and checkboxes will turn into autocomplete text fields.  For example, if set to 20 and a ticket can be assigned to 25 users, the assigned widget will be a textfield requiring you to type the user name.  If set to 20 and a ticket can only be assigned to 10 users, the assigned widget will be a drop down select menu listing all matching users.'),
    '#options' => array(
      0 => t('always'),
    ) + drupal_map_assoc(array(
      5,
      10,
      15,
      20,
      25,
      50,
      75,
      100,
      250,
      500,
      750,
      1000,
    )),
    '#default_value' => variable_get('support_autocomplete_limit', 15),
  );
  $form['general']['support_autoassign_ticket'] = array(
    '#type' => 'textfield',
    '#autocomplete_path' => 'support/autocomplete/assigned',
    '#title' => t('Auto-assign new tickets to'),
    '#description' => t('Enter a username to autoassign new tickets to a specific user (the user must have %admin permissions). Enter %creator to autoassign new tickets to the user creating the ticket. Leave blank or enter %nobody to leave new tickets unassigned. This value can be overridden on a per-client basis.', array(
      '%admin' => t('administer support'),
      '%creator' => '<' . t('creator') . '>',
      '%nobody' => '<' . t('nobody') . '>',
    )),
    '#default_value' => variable_get('support_autoassign_ticket', '<nobody>'),
  );
  $form['general']['support_default_sort_tickets'] = array(
    '#type' => 'radios',
    '#title' => t('Default sort column'),
    '#description' => t('Ticket views are sorted by clicking on the title of any given column.  This options defines the default sort option if no column title has been clicked.'),
    '#options' => array(
      SUPPORT_SORT_NONE => t('None'),
      SUPPORT_SORT_UPDATE => t('Last update'),
      SUPPORT_SORT_NID => t('Node ID'),
      SUPPORT_SORT_STATE => t('State'),
      SUPPORT_SORT_PRIORITY => t('Priority'),
    ),
    '#default_value' => variable_get('support_default_sort_tickets', SUPPORT_SORT_UPDATE),
  );
  $form['general']['support_default_sort_order'] = array(
    '#type' => 'radios',
    '#title' => t('Default sort order'),
    '#description' => t('The default sort order.'),
    '#options' => array(
      t('Ascending'),
      t('Descending'),
    ),
    '#default_value' => variable_get('support_default_sort_order', SUPPORT_SORT_DESC),
  );
  $form['general']['support_secondary_sort_tickets'] = array(
    '#type' => 'radios',
    '#title' => t('Secondary sort column'),
    '#description' => t('Ticket views are sorted by clicking on the title of any given column.  This option allows you to set a secondary sort column.  For example, you can sort tickets by priority, and configure the secondary sort field here to sort all tickets of the same priority by node id. For best performance, do not set a secondary sort column.'),
    '#options' => array(
      SUPPORT_SORT_NONE => t('None'),
      SUPPORT_SORT_UPDATE => t('Last update'),
      SUPPORT_SORT_NID => t('Node ID'),
      SUPPORT_SORT_STATE => t('State'),
      SUPPORT_SORT_PRIORITY => t('Priority'),
    ),
    '#default_value' => variable_get('support_secondary_sort_tickets', SUPPORT_SORT_NONE),
  );
  $form['general']['support_secondary_sort_order'] = array(
    '#type' => 'radios',
    '#title' => t('Secondary sort order'),
    '#description' => t('If specifying a secondary sort column, you can also specify a secondary sort order..'),
    '#options' => array(
      t('Ascending'),
      t('Descending'),
    ),
    '#default_value' => variable_get('support_secondary_sort_order', SUPPORT_SORT_DESC),
  );
  $form['comments'] = array(
    '#type' => 'fieldset',
    '#title' => t('Comments'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['comments']['support_require_comment'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require comment when bulk-updating tickets'),
    '#description' => t('Require a comment when users with %perm1 or %perm2 permissions bulk-update ticket properties on the ticket overview page.', array(
      '%perm1' => t('edit multiple tickets'),
      '%perm2' => t('administer support'),
    )),
    '#default_value' => variable_get('support_require_comment', TRUE),
  );
  $form['comments']['support_disable_post_comment'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable %post header', array(
      '%post' => t('Add new comment'),
    )),
    '#description' => t('Disable the %post header displayed when viewing support tickets.', array(
      '%post' => t('Add new comment'),
    )),
    '#default_value' => variable_get('support_disable_post_comment', FALSE),
  );
  $form['comments']['support_disable_comment_reply'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable comment reply link'),
    '#description' => t('Disable the reply link displayed under comments for support tickets. This setting is generally only useful if you plan to display comments as a flat-list with the content submission form displayed inline, !link.', array(
      '!link' => l(t('configured here'), 'admin/structure/types/manage/support-ticket'),
    )),
    '#default_value' => variable_get('support_disable_comment_reply', FALSE),
  );
  $form['notification'] = array(
    '#type' => 'fieldset',
    '#title' => t('Notifications'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['notification']['support_notifications'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable'),
    '#description' => t('Globally enable support ticket notifications.  Disable this if you don\'t ever want the support module to send email notifications.  Alternatively, you can globally enable notifications and then disable them on a per-client basis.'),
    '#default_value' => variable_get('support_notifications', TRUE),
  );
  $form['notification']['support_admin_notify'] = array(
    '#type' => 'select',
    '#title' => t('Visual feedback'),
    '#description' => t('Provide visual feedback about to whom notifications are being sent.  Feedback can be provided just to users with %perm permissions, or to all users. %warn', array(
      '%perm' => t('administer support'),
      '%warn' => t('Visual feedback will reveal the email address of all users that receive notifications by displaying a message at the top of the page after a ticket is created or updated.'),
    )),
    '#options' => array(
      FALSE => t('Disabled'),
      1 => t('To users with "!perm" permissions', array(
        '!perm' => t('administer support'),
      )),
      2 => t('To all users'),
    ),
    '#default_value' => variable_get('support_admin_notify', FALSE),
  );
  $form['notification']['support_autosubscribe_creator'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent user creating or updating ticket from unsubscribing'),
    '#description' => t('Check this box to prevent the user creating or updating a ticket from unsubscribing from notifications.'),
    '#default_value' => variable_get('support_autosubscribe_creator', FALSE),
  );
  $form['notification']['support_autosubscribe_force'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent autosubscribed users from unsubscribing'),
    '#description' => t('Check this box to prevent administratively autosubscribed users from unsubscribing from notifications.'),
    '#default_value' => variable_get('support_autosubscribe_force', FALSE),
  );
  $form['notification']['support_autosubscribe_assigned'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent assigned users from unsubscribing'),
    '#description' => t('Check this box to prevent assigned users from unsubscribing from notifications.'),
    '#default_value' => variable_get('support_autosubscribe_assigned', FALSE),
  );
  $form['user'] = array(
    '#type' => 'fieldset',
    '#title' => t('Users'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['user']['support_display_user_links'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display support ticket links in profile'),
    '#description' => t('Check this box to display links from a user\'s profile page to create new and view their existing support tickets.'),
    '#default_value' => variable_get('support_display_user_links', TRUE),
  );
  $form['user']['support_autocreate_users'] = array(
    '#title' => t('Auto-create new users on incoming mail'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('support_autocreate_users', TRUE),
    '#description' => t('Check this box if you would like the support module to automatically create new user accounts when emails are received from unknown email addresses.  If you uncheck this box and have "Integrate inbound email" enabled for one or more of your clients, notification emails will be sent when emails are discarded notifying the sender that they have to register to be able to create or update support tickets via mail. This option can also be set on a per-client basis.'),
  );
  $admin = user_load(1);
  $form['user']['support_filter_uid1'] = array(
    '#title' => t('Filter UID1 from ticket assignment and subscription lists'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('support_filter_uid1', FALSE),
    '#description' => t('Check this box to prevent the user with UID 1 (%admin) from showing up in ticket assignment and subscription lists. Tickets can still be assigned to UID 1 if you use autocomplete text fields and manually type the username when assigning a ticket.', array(
      '%admin' => $admin->name,
    )),
  );
  $form['search'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['search']['support_remove_tickets'] = array(
    '#type' => 'checkbox',
    '#title' => t('Remove tickets from content search results'),
    '#description' => t('When checked, support will remove tickets from content search results, and tickets can only be searched in their own search tab.  This is necessary to enforce proper access control, only letting a user\'s search return tickets that they have access to.'),
    '#default_value' => variable_get('support_remove_tickets', TRUE),
  );
  $form['search']['support_override_theme'] = array(
    '#type' => 'checkbox',
    '#title' => t('Override theme search form'),
    '#description' => t('When checked, support will override the theme search box so that it searches tickets.  When not checked, the theme search box will work normally.'),
    '#default_value' => variable_get('support_override_theme', FALSE),
  );
  $form['search']['support_override_block'] = array(
    '#type' => 'checkbox',
    '#title' => t('Override block search form'),
    '#description' => t('When checked, support will override the default search block so that it searches tickets.  When not checked, the block search form will work normally.'),
    '#default_value' => variable_get('support_override_block', FALSE),
  );
  $form['mail'] = array(
    '#type' => 'fieldset',
    '#title' => t('Mail'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['mail']['support_global_mailfrom'] = array(
    '#type' => 'textfield',
    '#title' => t('Default mail from address'),
    '#description' => t('Optionally specify a default <em>from</em> address where support notifications will originate from for clients whose inbound email is not integrated.  If a client\'s inbound email is integrated, you will need to specify the <em>from</em> address on the client\'s configuration page as each client gets a unique <em>from</em> address to allow support to process replies to tickets via email.'),
    '#default_value' => _support_admin_default_mail(),
  );
  $form['mail']['support_cron_download_mail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Download mail via cron'),
    '#description' => t('When checked, support will try to download client emails each time cron is run.  You may want to disable this if you are not integrating support with email, or if you only wish to download mail manually or via the !path.  If automating the download of mail through the support fetch mail path, be sure to !assign permissions to the necessary role(s).', array(
      '!path' => l(t('support fetch mail path'), 'support/fetch'),
      '!assign' => l(t('assign "download mail via support/fetch"'), 'admin/people/permissions', array(
        'fragment' => 'module-support',
      )),
    )),
    '#default_value' => variable_get('support_cron_download_mail', TRUE),
  );
  $form['mail']['support_global_domains'] = array(
    '#type' => 'textfield',
    '#title' => t('Globally allowed domains'),
    '#description' => t('Optionally enter one or more comma separated domains which are allowed to automatically create tickets via email.  To allow tickets to be created by any domain enter "*". This value can be overridden on a per-client basis.'),
    '#default_value' => check_plain(variable_get('support_global_domains', '*')),
  );
  $form['mail']['support_thread_by_mail_headers'] = array(
    '#type' => 'checkbox',
    '#title' => t('Thread emails using mail headers'),
    '#description' => t('When checked, the %message_id, %in_reply_to and %references mail headers wil be used to match replies with the original tickets.', array(
      '%message_id' => t('message_id'),
      '%in_reply_to' => t('in_reply_to'),
      '%references' => t('references'),
    )),
    '#default_value' => variable_get('support_thread_by_mail_headers', TRUE),
  );
  $form['mail']['support_thread_by_subject'] = array(
    '#type' => 'select',
    '#title' => t('Thread emails using subject'),
    '#options' => array(
      1 => 'Disabled',
      2 => 'Match against new tickets',
      3 => 'Match against open tickets',
      4 => 'Match against all tickets',
    ),
    '#description' => t('When enabled, the entire message subject will be used to match replies with the original tickets.  By default the subject will only be matched against other open tickets.'),
    '#default_value' => variable_get('support_thread_by_subject', 3),
  );
  $form['mail']['support_use_aliased_urls'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use aliased URLs in support notification emails'),
    '#description' => t('By default when the support module generates notification emails it uses aliased URLs in any included links.  By unchecking this box, you configure the support module to use unaliased URLs.  You may want to uncheck this box if the aliased paths to tickets changes frequently, as unaliased paths never change.'),
    '#default_value' => variable_get('support_use_aliased_urls', TRUE),
  );
  return system_settings_form($form);
}