function biblio_settings in Bibliography Module 5
Implementation of hook_settings().
1 string reference to 'biblio_settings'
- biblio_menu in ./
biblio.module - Implementation of hook_menu().
File
- ./
biblio.module, line 276
Code
function biblio_settings() {
include_once './includes/install.inc';
module_load_install('biblio');
if ($versions = drupal_get_schema_versions('biblio')) {
$installed_version = drupal_get_installed_schema_version('biblio');
if ($installed_version < max($versions)) {
drupal_set_message(t("There are updates available for the Biblio module, please run the update.php script"), 'error');
}
}
$version = '$Revision$ $Date$';
$version = str_replace('$', '', $version);
$form['biblio_rev'] = array(
'#value' => $version,
);
$form['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_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['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['biblio_input_full_text'] = array(
'#type' => 'checkbox',
'#title' => t('Allow users to input full text of publications'),
'#return_value' => 1,
'#default_value' => variable_get('biblio_input_full_text', 1),
'#description' => t('Un-checking this will remove the "Full Text" area from the input form'),
);
$form['block'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Block settings'),
'#description' => '',
);
$form['block']['biblio_rowsperblock'] = array(
'#type' => 'textfield',
'#title' => t('Number of results in the "New Publications" block'),
'#default_value' => variable_get('biblio_rowsperblock', 4),
'#size' => 2,
'#maxlength' => 2,
'#description' => t('This sets the number of results that will be displayed in the "New Publications" block.'),
);
$form['block']['biblio_block_order'] = array(
'#type' => 'radios',
'#title' => t('Order by'),
'#default_value' => variable_get('biblio_block_order', 'n.created'),
'#options' => array(
'n.created' => t('Date Created'),
'b.biblio_year' => t('Year Published'),
),
);
$result = db_query("SELECT b.name, b.title FROM {biblio_fields} b\n ORDER by b.title ASC ");
$choice = new stdClass();
$choice->option = array(
'nid' => t('Node ID'),
);
$options[0] = $choice;
while ($row = db_fetch_array($result)) {
$fields[$row['name']] = $row;
$choice = new stdClass();
$choice->option = array(
$row['name'] => $row['title'],
);
$options[] = $choice;
}
$form['citekey'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Citekey'),
'#description' => t('You can alter citekey related settings here.'),
);
$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.'),
);
$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", NULL, NULL, TRUE)),
)),
);
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 <bib> tags into <fn> tags. This will cause intermingled <bib> and <fn> tags to be sequentially numbered. For this to work, you must put the <bib> filter ahead of the <fn> filter in the filter chain. If this option is not set, <bib> and <fn> tags will be handled separately.'),
);
$form['keywords'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Keywords'),
'#description' => '',
);
$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['links'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Links'),
);
$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_inlinemode_in_links'] = array(
'#type' => 'checkbox',
'#title' => t('Carry "inline" mode through to all links'),
'#return_value' => 1,
'#default_value' => variable_get('biblio_inlinemode_in_links', 0),
'#description' => t('This causes the "inline" mode to be applied to all links such as titles, authors and keywords') );
*/
$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['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'),
);
$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>'),
);
$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'),
);
_biblio_get_user_profile_form($form);
$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.'),
);
$form['sort']['biblio_sort'] = array(
'#type' => 'radios',
'#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'),
),
);
$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'),
'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_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.'),
);
$form['style']['biblio_normalize'] = array(
'#type' => 'checkbox',
'#title' => t('Normalize author names when displaying biblio records'),
'#return_value' => 1,
'#default_value' => variable_get('biblio_normalize', 0),
'#description' => t('Tries (doesn\'t always work) to reformat author names so that they are displayed in the format "Lastname, Initials" e.g. Smith, J.S. (Note: This setting does not modify the entry in the database, it only reformats it\'s presentation. This option can be turned off at any time to diplay the oringal format.)'),
);
$form['style']['biblio_node_layout'] = array(
'#type' => 'radios',
'#title' => t('Node Layout'),
'#default_value' => variable_get('biblio_node_layout', 'orig'),
'#options' => array(
'orig' => t('Original'),
'ft' => t('Only Fulltext if available'),
'tabular' => t('Tabular'),
),
'#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['style']['biblio_style'] = array(
'#type' => 'radios',
'#title' => t('Style'),
'#default_value' => variable_get('biblio_style', 'classic'),
'#options' => _biblio_get_styles(),
'#description' => t('This alters the layout of the "list" (short) view.'),
);
$form['syndication'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Syndication'),
'#description' => t('You can set the RSS defaults here.'),
);
$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['taxo'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Taxonomy'),
'#description' => t('You can set the Taxonomy defaults here.'),
);
$form['taxo']['biblio_keyword_freetagging'] = array(
'#type' => 'checkbox',
'#title' => t('Use keywords from biblio entries as taxonomy "free tags"'),
'#return_value' => 1,
'#default_value' => variable_get('biblio_keyword_freetagging', 0),
'#description' => t('This option allows user to add keywords (free tags) to describe their documents. These keywords will be registered as taxonomy.'),
);
$vocabularies = module_invoke('taxonomy', 'get_vocabularies');
// ... and print a form to select the terms in each of them
$choice = new stdClass();
$choice->option = array(
0 => '<' . t('none') . '>',
);
$options[0] = $choice;
if (count($vocabularies)) {
foreach ($vocabularies as $voc) {
$choice = new stdClass();
$choice->option = array(
$voc->vid => $voc->name,
);
$options[] = $choice;
}
$form['taxo']['biblio_freetagging_vocab'] = array(
'#type' => 'select',
'#title' => t('Vocabulary'),
'#default_value' => variable_get('biblio_freetagging_vocab', 0),
'#options' => $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($options)) : 0,
'#weight' => 15,
);
}
return system_settings_form($form);
}