You are here

function biblio_admin_settings in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_settings()
  2. 6 biblio.admin.inc \biblio_admin_settings()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_settings()

Implementation of hook_settings().

1 string reference to 'biblio_admin_settings'
biblio_menu in ./biblio.module
Implements hook_menu().

File

includes/biblio.admin.inc, line 13
biblio.admin.inc

Code

function biblio_admin_settings() {
  $version = '$Name$ $Date$';
  $version = str_replace('$', '', $version);
  $form['biblio_settings'] = array(
    '#type' => 'vertical_tabs',
    '#weight' => 0,
  );
  $form['general'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('General'),
    '#group' => 'biblio_settings',
    '#weight' => 0,
    '#description' => '',
  );
  $form['general']['biblio_rev'] = array(
    '#markup' => $version,
  );
  $form['general']['biblio_base'] = array(
    '#type' => 'textfield',
    '#title' => t('Base URL'),
    '#size' => 20,
    '#default_value' => variable_get('biblio_base', 'biblio'),
    '#description' => t('This sets the base URL used to access the biblio module (e.g. /biblio ).'),
  );
  $form['#biblio_base'] = $form['general']['biblio_base']['#default_value'];
  $form['general']['biblio_base_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Biblio page title'),
    '#size' => 20,
    '#default_value' => variable_get('biblio_base_title', 'Biblio'),
    '#description' => t('The page title shown on the base URL.'),
  );
  $form['general']['biblio_rowsperpage'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of results per page'),
    '#default_value' => variable_get('biblio_rowsperpage', 25),
    '#size' => 6,
    '#maxlength' => 6,
    '#description' => t('This sets the number of results that will be displayed per page.'),
  );
  $form['general']['biblio_view_only_own'] = array(
    '#type' => 'checkbox',
    '#title' => t('Restrict users such that they can only view their own biblio entries'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_view_only_own', 0),
    '#description' => t('This option restricts the users capability to view biblio entries.  They will only be able to see the entries which they have created and own.'),
  );
  $form['general']['biblio_button_hide'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide next button in node form'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_button_hide', 1),
    '#description' => t('If checkbox is set a javascript adds the accesible system class "element-invisible" to the next button in node form. The next button is not needed if javascript is available and listening on changes.'),
  );
  $form['authors'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Authors'),
    '#group' => 'biblio_settings',
    '#weight' => 10,
    '#description' => '',
  );
  $form['authors']['biblio_auto_orphaned_author_delete'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically delete orphaned authors'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_auto_orphaned_author_delete', 0),
    '#description' => t('Orphaned authors are those which are no longer linked to any entries as the result of a biblio update or delete. This requires a functioning "cron" process.'),
  );
  $form['authors']['biblio_orphan_clean_interval'] = array(
    '#type' => 'radios',
    '#title' => t('Orphaned author cleaning frequency'),
    '#default_value' => variable_get('biblio_orphan_clean_interval', 24 * 60 * 60),
    '#options' => array(
      0 => t('Every CRON run'),
      3600 => t('Hourly'),
      86400 => t('Daily'),
      604800 => t('Weeekly'),
    ),
    '#description' => t('How frequently should we check for and delete orphans.'),
    '#states' => array(
      'invisible' => array(
        'input[name="biblio_auto_orphaned_author_delete"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['authors']['biblio_init_auth_count'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of contributor fields to initially display on the input form'),
    '#size' => 2,
    '#maxlength' => 2,
    '#default_value' => variable_get('biblio_init_auth_count', 4),
    '#description' => t('Increasing this value will increase the number of input fields displayed in the contributors section of the input form'),
  );
  $form['authors']['biblio_contrib_fields_delta'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of fields added by the "Add more" button on the contributor input form'),
    '#size' => 2,
    '#maxlength' => 2,
    '#default_value' => variable_get('biblio_contrib_fields_delta', 2),
    '#description' => t('This number of blank fields will be added to the contributors section of the input form each time the "Add more" button is pressed.'),
  );
  $form['bibtex'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('BibTeX settings'),
    '#group' => 'biblio_settings',
    '#weight' => 20,
    '#description' => '',
  );
  $form['bibtex']['biblio_hide_bibtex_braces'] = array(
    '#type' => 'checkbox',
    '#title' => t('Retain bibtex\'s {Protected} capitalization in the title string, but hide the braces on display'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_hide_bibtex_braces', 0),
    '#description' => '',
  );
  $form['bibtex']['biblio_remove_double_bibtex_braces'] = array(
    '#type' => 'checkbox',
    '#title' => t('Configure the BibTeX import parser to replace all double braces with single braces.'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_remove_double_bibtex_braces', 0),
    '#description' => t('<strong>{{</strong> will be replaced with <strong>{</strong> and <strong>}}</strong> will be replaced with <strong>}</strong>. This provides compatibility with importing BibTeX from the <a href="http://thomsonreuters.com/web-of-science/">Web of Science</a>. Be aware that this removes support for BibTeX "Protected Capitalization".'),
  );
  $result = db_query("SELECT b.name, bftd.title FROM {biblio_fields} b\n                      INNER JOIN {biblio_field_type} bt ON bt.fid=b.fid\n                      INNER JOIN {biblio_field_type_data} bftd ON bftd.ftdid=bt.ftdid\n                      WHERE bt.tid=0 ORDER by bftd.title ASC ");
  $schema = drupal_get_schema('biblio');
  $keys = array_keys($schema['fields']);
  $options = array();
  $options['nid'] = t('Node ID');
  foreach ($result as $row) {
    $options[$row->name] = $row->title;
  }
  $form['citekey'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Citekey'),
    '#description' => t('You can alter citekey related settings here.'),
    '#group' => 'biblio_settings',
    '#weight' => 30,
  );
  $form['citekey']['biblio_display_citation_key'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show citation key in results'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_display_citation_key', 0),
    '#description' => t('This will output the citekey as the first item in the citation string'),
  );
  $form['citekey']['biblio_auto_citekey'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto generate citekeys if not given'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_auto_citekey', 1),
    '#description' => t('This option will cause "citekey" entries to be automatically generated if a value is not provided.'),
  );
  $form['citekey']['biblio_citekey_prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Citekey prefix'),
    '#default_value' => variable_get('biblio_citekey_prefix', ''),
    '#size' => 10,
    '#maxlength' => 10,
    '#description' => t('This text will be combined with the field choosen below to form the auto generated citekey.'),
  );
  $form['citekey']['biblio_citekey_field1'] = array(
    '#type' => 'select',
    '#title' => t('Primary Citekey  field'),
    '#default_value' => variable_get('biblio_citekey_field1', 'nid'),
    '#options' => $options,
    '#description' => t('Select the field to be used when generating citekeys.'),
  );
  $form['citekey']['biblio_citekey_field2'] = array(
    '#type' => 'select',
    '#title' => t('Secondary Citekey field'),
    '#default_value' => variable_get('biblio_citekey_field2', 'nid'),
    '#options' => $options,
    '#description' => t('If the field above has no value this field will be used.'),
  );

  // Allow only users to modify PHP code which have PHP block visibility permissions.
  if (user_access('use PHP for block visibility')) {
    $form['citekey']['biblio_citekey_phpcode'] = array(
      '#type' => 'textarea',
      '#title' => t('PHP code for citekey generation'),
      '#default_value' => variable_get('biblio_citekey_phpcode', ''),
      '#description' => t('Advanced usage only: PHP code that returns the citekey. Should not include &lt;?php ?&gt; delimiters.'),
    );
  }
  $form['biblio_crossref'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('CrossRef Login Information'),
    '#group' => 'biblio_settings',
    '#weight' => 40,
  );
  $link_attrs = array(
    'attributes' => array(
      'target' => '_blank',
    ),
    'absolue' => TRUE,
  );
  $form['biblio_crossref']['biblio_show_crossref_profile_form'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow users to override these settings on their "My account" page'),
    '#return_value' => 1,
    '#description' => t('If this is selected, a form similar to this section will be available to the user when they edit their own account information.  This will allow them to override the global preferences set here.'),
    '#default_value' => variable_get('biblio_show_crossref_profile_form', '1'),
  );
  $form['biblio_crossref']['biblio_crossref_pid'] = array(
    '#type' => 'textfield',
    '#title' => t('CrossRef OpenURL Account ID'),
    '#default_value' => variable_get('biblio_crossref_pid', ''),
    '#description' => t('Enter your complimentary CrossRef OpenURL account ID which you can obtain here !url, OR enter your full CrossRef (colon separated) account:password combination.', array(
      '!url' => l(t('OpenURL Account Request Form'), 'http://www.crossref.org/requestaccount/', $link_attrs),
    )),
  );
  $form['footnotes'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Footnotes'),
    '#description' => t('You can integrate with the !url module here.', array(
      '!url' => l('footnotes', url("http://www.drupal.org/project/footnotes", array(
        'query' => NULL,
        'fragment' => NULL,
        'absolute' => TRUE,
      ))),
    )),
    '#group' => 'biblio_settings',
    '#weight' => 50,
  );
  if (!module_exists('footnotes')) {
    $additional_text = '<div class="admin-dependencies">' . t('Depends on') . ': ' . t('Footnotes') . ' (<span class="admin-disabled">' . t('disabled') . '</span>)</div>';
    $disabled = TRUE;
    variable_set('biblio_footnotes_integration', 0);
  }
  else {
    $additional_text = '<div class="admin-dependencies">' . t('Depends on') . ': ' . t('Footnotes') . ' (<span class="admin-enabled">' . t('enabled') . '</span>)</div>';
    $disabled = FALSE;
  }
  $form['footnotes']['biblio_footnotes_integration'] = array(
    '#type' => 'checkbox',
    '#title' => t('Integration with the footnotes module') . $additional_text,
    '#disabled' => $disabled,
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_footnotes_integration', 0),
    '#description' => t('This will convert &lt;bib&gt; tags into &lt;fn&gt; tags.  This will cause intermingled &lt;bib&gt; and &lt;fn&gt; tags to be sequentially numbered.  For this to work, you must put the &lt;bib&gt; filter ahead of the &lt;fn&gt; filter in the filter chain.  If this option is not set, &lt;bib&gt; and &lt;fn&gt; tags will be handled separately.'),
  );
  $form['isi_wok'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('ISI Web of Knowledge'),
    '#description' => '',
    '#group' => 'biblio_settings',
    '#weight' => 60,
  );
  $form['isi_wok']['biblio_fix_isi_links'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically replace "Go to ISI" links with the  URL below'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_fix_isi_links', 0),
    '#description' => t('This option automatically replaces any fake "Go to ISI" links with the supplied URL to ISI Web of Knowledge.  Note a subscription with ISI is required for these links to function.'),
  );
  $form['isi_wok']['biblio_isi_url'] = array(
    '#type' => 'textfield',
    '#title' => t('ISI Web of Knowledge URL'),
    '#size' => 128,
    '#maxlength' => 512,
    '#default_value' => variable_get('biblio_isi_url', 'http://apps.isiknowledge.com/InboundService.do?Func=Frame&product=WOS&action=retrieve&SrcApp=EndNote&Init=Yes&SrcAuth=ResearchSoft&mode=FullRecord&UT='),
    '#description' => t('Enter the URL which will replace the "Go to ISI" fake links imported from EndNote'),
  );
  $form['keywords'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Keywords'),
    '#description' => '',
    '#group' => 'biblio_settings',
    '#weight' => 70,
  );
  $form['keywords']['biblio_keyword_sep'] = array(
    '#type' => 'textfield',
    '#title' => t('Keyword separator'),
    '#size' => 2,
    '#default_value' => variable_get('biblio_keyword_sep', ','),
    '#description' => t('Enter the character which will be used to separate multiple keywords in the keyword field'),
  );
  $form['keywords']['biblio_keyword_orphan_autoclean'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically remove orphaned keywords'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_keyword_orphan_autoclean', 1),
    '#description' => t('This option automatically deletes keywords which are no longer associated with any publications (primarily due to the due to the removal of a publication or editing a keyword).'),
  );
  $taxo_mesg = '<div class="admin-dependencies">' . t('Depends on') . ': ' . t('Taxonomy') . ' (<span class="admin-disabled">' . t('disabled') . '</span>)</div>';
  $form['keywords']['biblio_copy_taxo_terms_to_keywords'] = array(
    '#type' => 'checkbox',
    '#title' => t('Copy any selected taxonomy terms to the biblio keyword database'),
    '#return_value' => 1,
    '#default_value' => module_exists('taxonomy') ? variable_get('biblio_copy_taxo_terms_to_keywords', 0) : 0,
    '#disabled' => !module_exists('taxonomy'),
    '#description' => module_exists('taxonomy') ? t('If this option is selected, the selected taxonomy terms will be copied to the @base_title keyword database and be displayed as keywords (as well as taxonomy terms) for this entry.', array(
      '@base_title',
      variable_get('biblio_base_title', 'Biblio'),
    )) : $taxo_mesg,
  );
  $form['keywords']['biblio_keyword_freetagging'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use keywords from biblio entries as taxonomy "free tags"'),
    '#return_value' => 1,
    '#default_value' => module_exists('taxonomy') ? variable_get('biblio_keyword_freetagging', 0) : 0,
    '#disabled' => !module_exists('taxonomy'),
    '#description' => module_exists('taxonomy') ? t('This option allows user to add keywords (free tags) to describe their documents. These keywords will be registered as taxonomy.') : $taxo_mesg,
  );
  $vocabularies = module_invoke('taxonomy', 'get_vocabularies');

  // ... and print a form to select the terms in each of them.
  $taxo_options = array();
  $taxo_options[0] = '<' . t('none') . '>';
  if (count($vocabularies)) {
    foreach ($vocabularies as $voc) {
      $taxo_options[$voc->vid] = $voc->name;
    }
    $form['keywords']['biblio_keyword_vocabulary'] = array(
      '#type' => 'select',
      '#title' => t('Vocabulary'),
      '#default_value' => variable_get('biblio_keyword_vocabulary', 0),
      '#options' => $taxo_options,
      '#description' => t('Select vocabulary (category) to use for free tags.'),
      '#multiple' => FALSE,
      // '#disabled' => (!variable_get('biblio_keyword_freetagging', 0)),
      //    '#size' => $multiple ? min(9, count($taxo_options)) : 0,.
      '#weight' => 15,
      '#states' => array(
        'invisible' => array(
          'input[name="biblio_keyword_freetagging"]' => array(
            'checked' => FALSE,
          ),
        ),
      ),
    );
  }
  $form['links'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Links'),
    '#group' => 'biblio_settings',
    '#weight' => 80,
  );
  $form['links']['export'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Export Links'),
  );
  $options = array();
  $export_defaults = array();
  $options = module_invoke_all('biblio_export_options');
  if (!empty($options)) {
    $export_defaults = array_combine(array_keys($options), array_keys($options));
  }
  $form['links']['export']['biblio_export_links'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Show export links'),
    '#default_value' => array_merge($export_defaults, variable_get('biblio_export_links', $export_defaults)),
    '#options' => $options,
    '#description' => t('You can select which export links to display here.'),
  );
  $form['links']['file_attachments'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('File Attachments'),
  );
  $form['links']['file_attachments']['biblio_file_link_type'] = array(
    '#type' => 'radios',
    '#title' => t('File attachment display'),
    '#default_value' => variable_get('biblio_file_link_type', 'text'),
    '#options' => array(
      'text' => t('Text'),
      'icon' => t('Icon'),
    ),
    '#description' => t('Display file attachments as either the file name or an icon'),
  );
  $form['links']['google'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Lookup Links'),
  );
  $options = module_invoke_all('biblio_lookup_link_settings');
  $options += array(
    'google' => 'Google Scholar',
  );
  $lookup_defaults = array_combine(array_keys($options), array_keys($options));
  $form['links']['google']['biblio_lookup_links'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Show lookup links'),
    '#default_value' => array_merge($lookup_defaults, variable_get('biblio_lookup_links', $lookup_defaults)),
    '#options' => $options,
    '#description' => t('You can select which lookup links to display here.'),
  );
  $form['links']['biblio_download_links_to_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Download links in "List" view link to "Node" view'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_download_links_to_node', 0),
    '#description' => t('If selected, the download links in the "List" view will link to the full "Node" view rather than the file itself, the file can then be downloaded from the node view'),
  );
  $form['links']['biblio_links_target_new_window'] = array(
    '#type' => 'checkbox',
    '#title' => t('Links open in new browser'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_links_target_new_window', 0),
    '#description' => t('This causes related URLs to open in a new browser window'),
  );
  $form['links']['biblio_link_title_url'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hyperlink titles using supplied URL if available'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_link_title_url', 0),
    '#description' => t('Selecting this links the titles to the supplied URL (if available) rather than the "node" view.'),
  );
  $form['links']['author'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Author Links'),
  );
  $form['links']['author']['biblio_author_links'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hyperlink author names'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_author_links', 1),
    '#description' => t('This creates a hyperlink on author names which, when clicked, will select entries which contain that author'),
  );
  $form['links']['author']['biblio_author_link_profile'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hyperlink author names to author profile page'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_author_link_profile', 0),
    '#description' => t('This creates a hyperlink on author names which, when clicked, will take the user to the authors profile page'),
  );
  $form['links']['author']['biblio_author_link_profile_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Path to profile page'),
    '#default_value' => variable_get('biblio_author_link_profile_path', 'user/[user:uid]'),
    '#description' => t('Do not include a leading "/"'),
  );
  $form['links']['author']['token_tree'] = array(
    '#theme' => 'token_tree',
    '#token_types' => array(
      'user',
    ),
  );
  $form['openurl'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('OpenURL'),
    '#description' => t('You can set an <a href="http://en.wikipedia.org/wiki/OpenURL">openurl</a> link here'),
    '#group' => 'biblio_settings',
    '#weight' => 90,
  );
  $form['openurl']['biblio_show_openurl_profile_form'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow users to override these settings on their "My account" page'),
    '#return_value' => 1,
    '#description' => t('If this is selected, a form similar to this section will be available to the user when they edit their own account information.  This will allow them to override the global preferences set here.'),
    '#default_value' => variable_get('biblio_show_openurl_profile_form', '1'),
  );
  $form['openurl']['biblio_baseopenurl'] = array(
    '#type' => 'textfield',
    '#title' => t('OpenURL Base URL'),
    '#size' => 95,
    '#default_value' => variable_get('biblio_baseopenurl', ''),
    '#description' => t('This sets your institution\'s base <a href="http://en.wikipedia.org/wiki/OpenURL">OpenURL</a> gateway, which is used to generate OpenURL links. To implement a "Universal" OpenURL system, try using OCLC\'s <a href="http://www.oclc.org/productworks/urlresolver.htm">OpenURL Resolver Registry</a> gateway: <a href="http://worldcatlibraries.org/registry/gateway">http://worldcatlibraries.org/registry/gateway</a>'),
  );
  $sid = "Biblio:" . variable_get('site_name', 'Drupal');
  $form['openurl']['biblio_openurl_sid'] = array(
    '#type' => 'textfield',
    '#title' => t('OpenURL Site ID'),
    '#size' => 95,
    '#default_value' => variable_get('biblio_openurl_sid', $sid),
    '#description' => t('This sets your institution\'s site name, some link resolvers will require a specific Site ID in order to process your requests.'),
  );
  $form['openurl']['biblio_openurlimage'] = array(
    '#type' => 'textfield',
    '#title' => t('OpenURL Image'),
    '#size' => 95,
    '#default_value' => variable_get('biblio_openurlimage', ''),
    '#description' => t('Enter a path to your image here, this image will be used as button which when clicked will find the entry via the OpenURL link'),
  );

  // Add profile page settings... this is done in a fucntion so it can be reused elsewhere.
  $form['biblio_profile'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Profile pages'),
    '#group' => 'biblio_settings',
    '#weight' => 100,
  );
  $form['biblio_profile'] += _biblio_get_user_profile_form();
  if (!module_exists('search')) {
    $search_text = '<div class="admin-dependencies">' . t('Depends on') . ': ' . t('Search') . ' (<span class="admin-disabled">' . t('disabled') . '</span>)</div>';
    $search_disabled = TRUE;
  }
  else {
    $search_text = '<div class="admin-dependencies">' . t('Depends on') . ': ' . t('Search') . ' (<span class="admin-enabled">' . t('enabled') . '</span>)</div>';
    $search_disabled = FALSE;
  }
  $form['search'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => $search_text,
    '#title' => t('Search'),
    '#group' => 'biblio_settings',
    '#weight' => 110,
  );
  $form['search']['biblio_search'] = array(
    '#type' => 'checkbox',
    '#disabled' => $search_disabled,
    '#title' => t('Enable a search box on the biblio page.'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_search', 0),
    '#description' => t('Shows a search box on the biblio page that returns drupal search results in the biblio style.'),
  );
  $form['search']['biblio_search_button_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Search button text'),
    '#disabled' => $search_disabled,
    '#size' => 95,
    '#default_value' => variable_get('biblio_search_button_text', t('Biblio search')),
    '#description' => t('This allows you to customize the text on the search button, it defaults to "Biblio search".'),
  );
  $form['search']['biblio_index'] = array(
    '#type' => 'checkbox',
    '#disabled' => $search_disabled,
    '#title' => t('Re-/Index a biblio node when creating or updating.'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_index', 0),
    '#description' => t('A biblio node must be indexed for the drupal search to know its content. You need to check this option if you want to search for a biblio node that you just created or updated. Otherwise you must wait for the cron job to reindex nodes.'),
  );
  $form['search']['biblio_search_form_filter'] = array(
    '#type' => 'checkbox',
    '#disabled' => $search_disabled,
    '#title' => t('Allow search filters on search form.'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_search_form_filter', 1),
    '#description' => t('Unchecking this box will remove search filters from the search form, but may improve performance on biblio search pages.'),
  );
  $form['sort'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Sorting'),
    '#description' => t('You can set the default sorting and ordering for the /biblio page here.'),
    '#group' => 'biblio_settings',
    '#weight' => 120,
  );
  $form['sort']['biblio_sort'] = array(
    '#type' => 'select',
    '#title' => t('Sort by'),
    '#default_value' => variable_get('biblio_sort', 'year'),
    '#options' => array(
      'author' => t('Author'),
      'keyword' => t('Keyword'),
      'title' => t('Title'),
      'type' => t('Type'),
      'year' => t('Year'),
    ),
    '#description' => t('This is the initial default sort.'),
  );
  $stop_words = 'a,an,is,on,the';
  $form['sort']['biblio_stop_words'] = array(
    '#type' => 'textfield',
    '#title' => t('Words to remove from the beginning of titles prior to sorting'),
    '#size' => 60,
    '#default_value' => variable_get('biblio_stop_words', $stop_words),
    '#description' => t('A comma separated list of (case insensitive) words to strip from the title for sorting purposes.  NOTE: quotation and punctuation are stripped automatically.'),
  );
  $form['sort']['biblio_sort_tabs'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Show sort links'),
    '#default_value' => variable_get('biblio_sort_tabs', array(
      'author',
      'title',
      'type',
      'year',
    )),
    '#options' => array(
      'author' => t('Author'),
      'keyword' => t('Keyword  (<i>Warning: sorting by keyword may produce many duplicates due to the fact that an entry is listed for each keyword attached to it.</i>)'),
      'title' => t('Title'),
      'type' => t('Type'),
      'year' => t('Year'),
    ),
    '#description' => t('You turn the sorting links at the top of the /biblio page here.'),
  );
  $form['sort']['biblio_sort_tabs_style'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show sort links as "tabs"'),
    '#default_value' => variable_get('biblio_sort_tabs_style', 0),
    '#return_value' => 1,
    '#description' => t('This changes the sort links from text links to tabs'),
  );
  $form['sort']['biblio_order'] = array(
    '#type' => 'radios',
    '#title' => t('Order'),
    '#default_value' => variable_get('biblio_order', 'DESC'),
    '#options' => array(
      'DESC' => t('Descending'),
      'ASC' => t('Ascending'),
    ),
  );
  $form['style'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Styling'),
    '#description' => t('You can set the default style for the /biblio page here.'),
    '#group' => 'biblio_settings',
    '#weight' => 130,
  );
  $form['style']['biblio_no_year_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text to display if no year of publication is available'),
    '#size' => 95,
    '#default_value' => variable_get('biblio_no_year_text', t('Submitted')),
    '#description' => t('The text that is displayed when no date of publication is given or it is deliberately set to <b>9999</b>, it defaults to "Submitted".'),
  );
  $form['style']['biblio_inpress_year_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text to display if year of publication is set to 9998'),
    '#size' => 95,
    '#default_value' => variable_get('biblio_inpress_year_text', t('In Press')),
    '#description' => t('The text that is displayed when the date of publication is deliberately set to <b>9998</b>, it defaults to "In Press".'),
  );
  if (module_exists('biblio_citeproc')) {
    $form['style']['biblio_citeproc_style'] = array(
      '#type' => 'select',
      '#title' => t('Style'),
      '#default_value' => variable_get('biblio_citeproc_style', 'ieee.csl'),
      '#options' => biblio_get_styles(),
      '#description' => t('Set the bibliographic style of the "list" view.'),
    );
  }
  else {
    $form['style']['biblio_style'] = array(
      '#type' => 'select',
      '#title' => t('Style'),
      '#default_value' => variable_get('biblio_style', 'cse'),
      '#options' => biblio_get_styles(),
      '#description' => t('Set the bibliographic style of the "list" view.'),
    );
  }
  $form['style']['biblio_node_layout'] = array(
    '#type' => 'radios',
    '#title' => t('Node Layout'),
    '#default_value' => variable_get('biblio_node_layout', 'tabular'),
    '#options' => array(
      'orig' => t('Original'),
      'ft' => t('Only Fulltext if available'),
      'tabular' => t('Tabular'),
      'cite' => t('Bibliographic style choosen above'),
    ),
    '#description' => t('This alters the layout of the "node" (full) view.'),
  );
  $form['style']['biblio_annotations'] = array(
    '#type' => 'select',
    '#title' => t('Annotations'),
    '#default_value' => variable_get('biblio_annotations', 'none'),
    '#options' => array(
      'none' => t('none'),
      'biblio_notes' => t('notes'),
      'biblio_custom1' => t('custom1'),
      'biblio_custom2' => t('custom2'),
      'biblio_custom3' => t('custom3'),
      'biblio_custom4' => t('custom4'),
      'biblio_custom5' => t('custom5'),
      'biblio_custom6' => t('custom6'),
      'biblio_custom7' => t('custom7'),
    ),
    '#description' => t('Select a field from which an annotation will be displayed below biblo entry in "short" listings'),
    '#multiple' => FALSE,
    '#size' => 0,
  );
  $form['syndication'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Syndication'),
    '#description' => t('You can set the RSS defaults here.'),
    '#group' => 'biblio_settings',
    '#weight' => 140,
  );
  $form['syndication']['biblio_rss'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow RSS feeds of new biblio entries'),
    '#return_value' => 1,
    '#default_value' => variable_get('biblio_rss', 0),
    '#description' => t('This will create an rss feed of the 10 most recent biblio entries. It will be available at /biblio/rss.xml'),
  );
  $form['syndication']['biblio_rss_number_of_entries'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of items in the RSS feed.'),
    '#default_value' => variable_get('biblio_rss_number_of_entries', 10),
    '#size' => 6,
    '#maxlength' => 6,
    '#description' => t('Limits the number of items in the /biblio/rss.xml feed to this number.'),
  );
  $form = system_settings_form($form);
  $form['#submit'][] = 'biblio_admin_settings_form_submit';

  // Our submit handler is added after the call to system settings form so that it gets
  // called after system_settings_form_submit, and thus the variables have been stored already
  // and the menu will be rebuilt correctly.
  return $form;
}