'admin/hub', 'title' => t('Hub configuration'), 'description' => t('Adjust Hub portal configuration options.'), 'position' => 'right', 'weight' => -5, 'callback' => 'system_admin_menu_block_page', 'access' => $admin_access, ); $items[] = array( 'path' => 'admin/hub/global', 'title' => t('Global Hub configuration'), 'description' => t('Global Hub settings.'), 'callback' => 'drupal_get_form', 'callback arguments' => 'drupal_hub_admin_settings', 'access' => $admin_access, ); if (variable_get('drupal_hub_is_client', false)) { $items[] = array( 'path' => 'admin/hub/client', 'title' => t('Hub client configuration'), 'description' => t('Client Hub settings.'), 'callback' => 'drupal_get_form', 'callback arguments' => 'drupal_hub_client_admin_settings', 'access' => $admin_access, ); } if (variable_get('drupal_hub_is_server', false)) { $items[] = array( 'path' => 'admin/hub/server', 'title' => t('Hub server configuration'), 'description' => t('Server Hub settings.'), 'callback' => 'drupal_get_form', 'callback arguments' => 'drupal_hub_server_admin_settings', 'access' => $admin_access, ); } } return $items; } /** * Display global Hub admin settings */ function drupal_hub_admin_settings() { // we have to rebuild the menu, because certain menu items are built or removed accordingly menu_rebuild(); $form = array(); // Allow the admin to turn on or off all services offered by various Hub modules on the server. $form['services'] = array( '#type' => 'fieldset', '#title' => t('Active Services'), '#description' => t('Check the box for each Hub portal service you wish to activate for this host.'), '#collapsible' => true, '#collapsed' => false, ); $services = module_invoke_all('hubapi', 'list services'); $service_descriptions = module_invoke_all('hubapi', 'describe services'); foreach ($services as $service => $title) { $form['services'][$service] = array( '#type' => 'checkbox', '#title' => $title, '#description' => $service_descriptions[$service], '#default_value' => variable_get($service, false), ); } return system_settings_form($form); } /** * Implements hook_hubapi: * $op * 'list services': This will return an array of the hub services offered by this module. * This is used by the Hub server when associating node types to the server, so when a * client requests the listing options offered, they will also see which modules & services * are required to be included in that server's listings. * 'describe services': This is a brief description of the services offered. * 'field defaults': This returns an array of variables offered as defaults for listings. * Each field has a prefix that determines the type of variable passed: * v: signifies a variable stored as variable_get('variable', ...); * $: signifies a variable stored as a global $variable; * c: signifies a variable stored as a CONSTANT variable; * f: signifies a variable that will be returned by a function call; * s: signifies special handling for the variable, which must be determined by the calling module. * Note that anything other than v: must be handled by the calling module; the prefixes are for the * benefit of human programmers. * 'server defaults': A Hub module may define one or more default servers to list for * clients. This will return an array of $key => array('name' => $name, 'xmlrpc' => $xmlrpc), * where $key is a unique code, $name is the name of the server, and $xmlrpc is the * address for the server's xmlrpc calls. This server should be configured as a * Hub server. * * return values for $op: * 'list services': This should return an array of strings of the services offered by * the module, keyed by the variable for whether that service has been activated by the * client module. For instance, the Hub module allows two services, 'client' and 'server'. * The client service is activated with variable_get('drupal_hub_is_client', false), so the * resulting array is array('drupal_hub_is_client' => t('Hub client service'), 'drupal_hub_is_server' * => t('Hub server service')). * 'describe services': This returns a keyed array of strings for the descriptions offered * by the module, keyed by the same service variables as for 'list services'. */ function drupal_hub_hubapi($op) { switch ($op) { case 'list services': return array( 'drupal_hub_is_client' => t('Hub: Client service'), 'drupal_hub_is_server' => t('Hub: Server service') ); case 'describe services': return array( 'drupal_hub_is_client' => t('Hub Clients may be listed on Hub Servers they have registered with through admin screens on the client. Once registered, the Hub servers will periodically update their listing information.'), 'drupal_hub_is_server' => t('A Hub Server may list clients who have registered with their server, associating the clients with configurable nodes, so the nodes may be displayed through various views and blocks.'), ); case 'field defaults': return array( 'v:site_name' => t('Site Name'), '$:base_url' => t('Site URL'), 'v:site_mission' => t('Site Mission'), 'v:site_slogan' => t('Site Slogan'), 'v:site_mail' => t('Site Mail'), 'c:VERSION' => t('Version'), ); case 'server defaults': return array( 'drupal_hub_default_server_drupal_hub' => array( 'name' => t('Drupal Hub'), 'url_xmlrpc' => 'http://drupalhub.org/xmlrpc.php', ), ); } } /** * Implementation of hook_xmlrpc(). */ function drupal_hub_xmlrpc() { // TODO $xmlrpc = array(); if (variable_get('drupal_hub_is_server', false)) { $xmlrpc += _drupal_hub_server_xmlrpc(); /* $xmlrpc[] = array( 'drupal_hub.client.ping', 'drupal_hub_client_ping', array('array', 'array', 'array'), t('Handling ping request') ); */ } return $xmlrpc; // TODO: if (variable_get('drupal_hub_is_client', false)) { $xmlrpc = _drupal_hub_client_xmlrpc(); /* $xmlrpc[] = array( 'drupal.login', 'drupal_login', array('int', 'string', 'string'), t('Logging into a Drupal site') );*/ } return $xmlrpc; }