function document_settings_form in Document 6
Same name and namespace in other branches
- 7 document.admin.inc \document_settings_form()
- 8.x document.admin.inc \document_settings_form()
1 string reference to 'document_settings_form'
- document_menu in ./
document.module - Implementation of hook_menu().
File
- ./
document.admin.inc, line 5
Code
function document_settings_form(&$form_state) {
drupal_add_css(drupal_get_path('module', 'document') . '/document.css');
drupal_add_js(drupal_get_path('module', 'document') . '/document.js');
_document_register_validation_token();
drupal_add_js('$(document).ajaxSend(function(event, request, settings) {
$("#document_loading").show();
});
$(document).ajaxComplete(function(event, request, settings) {
$("#document_loading").hide();
});', 'inline');
$form = array();
$form['document_path'] = array(
'#type' => 'textfield',
'#title' => t('Documents Path'),
'#description' => t('Path where the Documents should be stored. This path would be considered relative the Drupal\'s File System Path. Changing this path would not automatically move existing documents.'),
'#default_value' => variable_get('document_path', ''),
);
$form['document_allow_external'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('document_allow_external', FALSE),
'#title' => t('Allow external document Urls'),
'#description' => t('Check to allow users to specify an external Url for a document. Unchecking would force users to upload a file while creating a document.'),
);
$form['document_allow_websearch'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('document_allow_websearch', FALSE),
'#title' => t('Allow Web search'),
'#description' => t('Check to add an extra option for searching web while searching for documents. Currently, Google would be used for web search. Future releases would allow you to choose your search provider.'),
);
$form['document_types_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Document Types'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['document_types_fieldset']['document_types'] = array(
'#type' => 'select',
'#multiple' => true,
'#title' => t('Document Types'),
'#description' => t('Document Types.'),
'#size' => 10,
'#options' => document_get_types(TRUE, TRUE),
);
$form['document_types_fieldset']['document_type'] = array(
'#type' => 'textfield',
'#title' => t('Add Document Type'),
'#description' => t('Add Document Type.'),
);
$form['document_types_fieldset']['document_type_add'] = array(
'#type' => 'button',
'#value' => t('Add Document Type'),
'#prefix' => '<div style="float: left">',
'#suffix' => theme_image(document_image_url('loading.gif'), 'Loading...', 'Loading...', array(
'id' => 'document_loading',
'style' => 'display:none',
), FALSE),
'#attributes' => array(
'onclick' => 'return(doc.add_type());',
),
);
$form['document_types_fieldset']['document_type_delete'] = array(
'#type' => 'button',
'#value' => t('Delete Selected Types'),
'#suffix' => '</div>',
'#attributes' => array(
'onclick' => 'return(doc.delete_types());',
),
);
$email_token_help = t('Available variables are:') . ' !site, !doc_link, !node_title, !node_title_link, !node_link, !uri, !uri_brief, !username, !mailto, !date.';
$form['document_email_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Email Settings'),
'#description' => t('Customize e-mail message sent when Document uploaded by a User is published.') . ' ' . $email_token_help,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['document_email_fieldset']['document_publish_email'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('document_publish_email', TRUE),
'#title' => t('Email on Publishing a Document'),
'#description' => t('Email the Creator of the Document when it is published by administrators.'),
);
$form['document_email_fieldset']['document_publish_subject'] = array(
'#type' => 'textfield',
'#title' => t('Publish Email Subject'),
'#description' => t('Subject template for the e-mail sent when a document is published.'),
'#required' => TRUE,
'#maxlength' => 180,
'#default_value' => document_mail_text('publish_subject'),
);
$form['document_email_fieldset']['document_publish_body'] = array(
'#type' => 'textarea',
'#title' => t('Publish Email Body'),
'#description' => t('Body template for the e-mail sent when a document is published.'),
'#required' => TRUE,
'#rows' => 15,
'#default_value' => document_mail_text('publish_body'),
);
$form['#submit'][] = 'document_settings_submit_handler';
return system_settings_form($form);
}