You are here

function google_appliance_admin_settings in Google Search Appliance 5

Same name and namespace in other branches
  1. 6.2 google_appliance.module \google_appliance_admin_settings()
  2. 7 google_appliance.admin.inc \google_appliance_admin_settings()
1 string reference to 'google_appliance_admin_settings'
google_appliance_menu in ./google_appliance.module
Implementation of hook_menu()

File

./google_appliance.module, line 82
GSA integration

Code

function google_appliance_admin_settings() {
  $form = array();

  // initial required config fields
  $form["config_init"] = array(
    "#title" => t("Initial Configuration"),
    "#type" => "fieldset",
  );
  $form["config_init"]["google_appliance_name"] = array(
    "#type" => "textfield",
    "#size" => 30,
    "#title" => t("Search Name"),
    "#description" => t('The name of this search, to appear as sub-navigation on the search page.'),
    "#default_value" => variable_get('google_appliance_name', 'Google Appliance'),
    "#required" => true,
  );
  $form["config_init"]["google_appliance_host_name"] = array(
    "#type" => "textfield",
    "#size" => 50,
    "#title" => t("Host Name"),
    "#description" => t('Your Google Search Appliance host name or IP address (with http:// or https://), which were assigned when the appliance was set up.<br />You do <b>not</b> need to include "/search" at the end, or a trailing slash, but you should include a port number if needed.<br/> Example: http://mygooglebox.com'),
    "#default_value" => variable_get('google_appliance_host_name', ''),
    "#required" => true,
  );
  $form["config_init"]["google_appliance_collection"] = array(
    "#type" => "textfield",
    "#size" => 20,
    "#title" => t("Collection"),
    "#description" => t('The name of the collection of indexed content to search.'),
    "#default_value" => variable_get('google_appliance_collection', ''),
    "#required" => true,
  );
  $form["config_init"]["google_appliance_client"] = array(
    "#type" => "textfield",
    "#size" => 20,
    "#title" => t("Client"),
    "#description" => t('The name of a valid front-end, defined when you set up the appliance.'),
    "#default_value" => variable_get('google_appliance_client', ''),
    "#required" => true,
  );
  $form["config_init"]["google_appliance_cache_timeout"] = array(
    "#type" => "textfield",
    "#size" => 20,
    "#title" => t("Cache Timeout"),
    "#description" => t('If you wish to use caching of results (to reduce load on mini, enter a timeout here'),
    "#default_value" => variable_get('google_appliance_cache_timeout', ''),
  );
  $form["config_init"]["google_debug"] = array(
    "#type" => "textfield",
    "#size" => 20,
    "#title" => t("Debug Level"),
    "#description" => t('1 = watchdog, 2 = dpr(needs devel module), 3 = more dpr\'s'),
    "#default_value" => variable_get('google_debug', ''),
  );
  $form["config_init"]["google_appliance_limit_per_page"] = array(
    "#type" => "textfield",
    "#size" => 5,
    "#title" => t("Number of results per page"),
    "#description" => t('If you enter 0, it will return the max allowed by the appliance (100)'),
    "#default_value" => variable_get('google_appliance_limit_per_page', 10),
  );

  // error message config
  $form["config_messages"] = array(
    "#title" => t("Error Messages"),
    "#type" => "fieldset",
    "#collapsible" => true,
  );
  $form["config_messages"]["google_appliance_errorcode_1"] = array(
    "#title" => t("No results found"),
    "#type" => "textfield",
    "#size" => 100,
    "#maxlength" => 255,
    "#required" => true,
    "#description" => t('If there are no results for the search criteria.'),
    "#default_value" => variable_get('google_appliance_errorcode_1', 'No results were found that matched your criteria. Please try broadening your search.'),
  );
  $form["config_messages"]["google_appliance_errorcode_2"] = array(
    "#title" => t("More than 1,000 results"),
    "#type" => "textfield",
    "#size" => 100,
    "#maxlength" => 255,
    "#required" => true,
    "#description" => t('If there are more than 1,000 results for the search criteria.'),
    "#default_value" => variable_get('google_appliance_errorcode_2', 'Sorry, but our search does not return more than 1,000 records, please refine your criteria.'),
  );
  $form["config_messages"]["google_appliance_errorcode_neg_99"] = array(
    "#title" => t("Cannot perform search"),
    "#type" => "textfield",
    "#size" => 100,
    "#maxlength" => 255,
    "#required" => true,
    "#description" => t('If the search cannot perform due to a query error.'),
    "#default_value" => variable_get('google_appliance_errorcode_neg_99', 'We apologize, but your search cannot be completed at this time, please try again later.'),
  );
  $form["config_messages"]["google_appliance_errorcode_neg_100"] = array(
    "#title" => t("Cannot connect to Google Appliance"),
    "#type" => "textfield",
    "#size" => 100,
    "#maxlength" => 255,
    "#required" => true,
    "#description" => t('If the search cannot connect to the Google Appliance server.'),
    "#default_value" => variable_get('google_appliance_errorcode_neg_100', 'We apologize, but the connection to our search engine appears to be down at the moment, please try again later.'),
  );

  // optional metadata configuration

  /*
  $form["config_metadata"] = array(
    "#title" => t("Metadata Configuration"),
    "#type" => "fieldset",
    "#collapsible" => true,
  );
  */

  // last but not least, submit
  $form["submit"] = array(
    "#type" => "submit",
    "#value" => t("Save Settings"),
  );
  return $form;
}