function google_appliance_admin_settings in Google Search Appliance 7
Same name and namespace in other branches
- 5 google_appliance.module \google_appliance_admin_settings()
- 6.2 google_appliance.module \google_appliance_admin_settings()
Implements hook_admin_settings(). displays the Search Google Appliance module settings page.
See also
google_appliance_admin_settings_validate()
google_appliance_admin_settings_submit()
1 string reference to 'google_appliance_admin_settings'
- google_appliance_menu in ./
google_appliance.module - Implements hook_menu().
File
- ./
google_appliance.admin.inc, line 16 - admin callbacks for the Google Appliance module
Code
function google_appliance_admin_settings($form) {
// grab current settings
$settings = _google_appliance_get_settings();
// connection information
$form['connection_info'] = array(
'#title' => t('Connection Information'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['connection_info']['google_appliance_hostname'] = array(
'#type' => 'textfield',
'#title' => t('Google Search Appliance Host Name'),
'#description' => t('Valid URL or IP address of the GSA device, including <em>http://</em> or <em>https://</em>. Do <b>not</b> include <em>/search</em> at the end, or a trailing slash, but you should include a port number if needed. Example: <em>http://my.gsabox.com:8443</em>'),
'#default_value' => $settings['hostname'],
'#required' => TRUE,
);
$form['connection_info']['google_appliance_collection'] = array(
'#type' => 'textfield',
'#title' => t('Collection'),
'#description' => t('The name of a valid collection on the GSA device (case sensitive).'),
'#default_value' => $settings['collection'],
'#required' => TRUE,
);
$form['connection_info']['google_appliance_frontend'] = array(
'#type' => 'textfield',
'#title' => t('Frontend client'),
'#description' => t('The name of a valid frontend client on the GSA device (case sensitive).'),
'#default_value' => $settings['frontend'],
'#required' => TRUE,
);
$form['connection_info']['google_appliance_timeout'] = array(
'#type' => 'textfield',
'#title' => t('Search Timeout'),
'#description' => t('Length of time to wait for response from the GSA device before giving up (timeout in seconds).'),
'#default_value' => $settings['timeout'],
'#required' => TRUE,
);
// search query parameter configuration
$form['query_param'] = array(
"#title" => t("Search Query Parameter Setup"),
"#type" => "fieldset",
"#collapsible" => TRUE,
"#collapsed" => FALSE,
);
$form['query_param']['google_appliance_autofilter'] = array(
'#type' => 'select',
'#title' => t('Search Results Auto-Filtering Options'),
'#default_value' => $settings['autofilter'],
'#options' => array(
'0' => t('No filtering'),
's' => t('Duplicate Directory Filter'),
'p' => t('Duplicate Snippet Filter'),
'1' => t('Both Duplicate Directory and Duplicate Snippet Filters'),
),
'#description' => t('Learn more about GSA auto-filtering <a href="@gsa-doc-af">here</a>. In general, employing both filters enhances results, but sites with smaller indexes may suffer from over-filtered results.', array(
'@gsa-doc-af' => 'http://code.google.com/apis/searchappliance/documentation/68/xml_reference.html#request_filter_auto',
)),
);
if (module_exists('locale')) {
$form['query_param']['google_appliance_language_filter_toggle'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Language Filtering'),
'#default_value' => $settings['language_filter_toggle'],
);
$form['query_param']['google_appliance_language_filter_options'] = array(
'#type' => 'checkboxes',
'#title' => t('Restrict searches to specified languages'),
'#default_value' => $settings['language_filter_options'],
'#options' => array(
'***CURRENT_LANGUAGE***' => t("Current user's language"),
'***DEFAULT_LANGUAGE***' => t("Default site language"),
) + locale_language_list(),
'#states' => array(
'visible' => array(
':input[name=google_appliance_language_filter_toggle]' => array(
'checked' => TRUE,
),
),
),
'#description' => t('If there are no results in the specified language, the search appliance is expected to return results in all languages.'),
);
}
$form['query_param']['google_appliance_query_inspection'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Query Inspection'),
'#description' => t('Inspect the search query parameters sent to the GSA device in the Drupal message area every time a search is performed. Only really useful for sites not using the Devel module, as dsm() provides more information. The inspector is only shown to administrators, but should be disabled in a production environment.'),
'#default_value' => $settings['query_inspection'],
);
// search interface settings
$form['display_settings'] = array(
'#title' => t('Search Interface Settings'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['display_settings']['google_appliance_drupal_path'] = array(
'#title' => t('Search path'),
'#type' => 'textfield',
'#field_prefix' => '<span dir="ltr">' . url(NULL, array(
'absolute' => TRUE,
)) . (variable_get('clean_url', 0) ? '' : '?q='),
'#field_suffix' => '</span>‎',
'#default_value' => $settings['drupal_path'],
'#description' => t('The URL of the search page provided by this module. Include neither leading nor trailing slash.'),
'#required' => TRUE,
);
$form['display_settings']['google_appliance_search_title'] = array(
'#title' => t('Search Name'),
'#type' => 'textfield',
'#default_value' => $settings['search_title'],
'#description' => t('Serves as the page title on results pages and the default menu item title'),
'#required' => TRUE,
);
$form['display_settings']['google_appliance_results_per_page'] = array(
'#title' => t('Results per page'),
'#type' => 'textfield',
'#default_value' => $settings['results_per_page'],
'#description' => t('Number of results to show on the results page. More results will be available via a Drupal pager.'),
'#required' => TRUE,
);
$form['display_settings']['google_appliance_spelling_suggestions'] = array(
'#type' => 'checkbox',
'#title' => t('Display Spelling Suggestions'),
'#default_value' => $settings['spelling_suggestions'],
);
$form['display_settings']['google_appliance_advanced_search_reporting'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Advanced Search Reporting'),
'#default_value' => $settings['advanced_search_reporting'],
'#description' => t('Learn more about !this_feature. You need to enable Advanced Search Reporting on the front end client. The device should provide a file named "/clicklog_compiled.js" when using the search interface on the GSA.', array(
'!this_feature' => l(t('this feature'), 'http://www.google.com/support/enterprise/static/gsa/docs/admin/70/gsa_doc_set/xml_reference/advanced_search_reporting.html'),
)),
);
$form['display_settings']['google_appliance_sitelinks_search_box'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Google.com Sitelinks Search Box'),
'#default_value' => $settings['sitelinks_search_box'],
'#description' => t('Learn more about !this_feature. Note: your site may not necessarily be a candidate for the google.com Sitelinks search box.', array(
'!this_feature' => l(t('this feature'), 'https://developers.google.com/structured-data/slsb-overview'),
)),
);
$form['display_settings']['google_appliance_onebox_modules'] = array(
'#type' => 'textarea',
'#title' => t('Onebox modules'),
'#description' => t('A list of Onebox modules, one per line. Each module listed will have a corresponding block. These blocks must be placed via the block configuration page, or another layout mechanism like Context or Panels.'),
'#default_value' => implode("\n", $settings['onebox_modules']),
);
$form['display_settings']['google_appliance_error_gsa_no_results'] = array(
'#title' => t('No results error message'),
'#type' => 'text_format',
'#default_value' => $settings['error_gsa_no_results'],
'#format' => $settings['error_gsa_no_results_format'],
'#description' => t('The message displayed to the user when no results are found for the given search query.'),
'#required' => TRUE,
);
$form['display_settings']['google_appliance_error_curl_error'] = array(
'#title' => t('Connection error message'),
'#type' => 'text_format',
'#default_value' => $settings['error_curl_error'],
'#format' => $settings['error_curl_error_format'],
'#description' => t('The message displayed to the user when there is an error connecting to the search appliance.'),
'#required' => TRUE,
);
$form['display_settings']['google_appliance_error_lib_xml_parse_error'] = array(
'#title' => t('XML parse error message'),
'#type' => 'text_format',
'#default_value' => $settings['error_lib_xml_parse_error'],
'#format' => $settings['error_lib_xml_parse_error_format'],
'#description' => t('The message displayed to the user when the XML returned by the appliance is malformed.'),
'#required' => TRUE,
);
$form['#submit'][] = 'google_appliance_admin_settings_submit';
return system_settings_form($form);
}