You are here

function biblio_menu in Bibliography Module 7.2

Same name and namespace in other branches
  1. 5 biblio.module \biblio_menu()
  2. 6.2 biblio.module \biblio_menu()
  3. 6 biblio.module \biblio_menu()
  4. 7 biblio.module \biblio_menu()

Implements hook_menu().

File

./biblio.module, line 610

Code

function biblio_menu() {
  global $user;
  $items = array();
  $base = variable_get('biblio_base', 'biblio');
  $base_title = check_plain(variable_get('biblio_base_title', 'Biblio'));

  // Main Biblio Content

  //----------------------------------------------------------------------------
  $items[$base] = array(
    'title' => $base_title,
    'page callback' => 'biblio_page',
    'access callback' => 'user_access',
    'access arguments' => array(
      'access biblio content',
    ),
    'file' => '/includes/biblio.pages.inc',
  );
  $items[$base . "/%biblio"] = array(
    'title callback' => 'biblio_page_title',
    'title arguments' => array(
      1,
    ),
    'page callback' => 'biblio_page_view',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'access biblio content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items[$base . "/%biblio/view"] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'access arguments' => array(
      'access biblio content',
    ),
  );
  $items[$base . "/%biblio/edit"] = array(
    'title' => 'Edit',
    'page callback' => 'biblio_page_edit',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'edit all biblio entries',
    ),
    'weight' => 0,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'file' => 'includes/biblio.admin.inc',
  );
  $items[$base . "/%biblio/delete"] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_delete_confirm',
      1,
    ),
    'access arguments' => array(
      'edit all biblio entries',
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'file' => 'includes/biblio.admin.inc',
  );
  $items[$base . "/contributor/%biblio_contributor"] = array(
    'title callback' => 'entity_label',
    'title arguments' => array(
      'biblio_contributor',
      2,
    ),
    //callback
    'page callback' => 'biblio_contributor_page_view',
    //callback
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'access biblio content',
    ),
  );
  $items[$base . "/contributor/%biblio_contributor/view"] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'access arguments' => array(
      'access biblio content',
    ),
  );
  $items[$base . "/contributor/%biblio_contributor/edit"] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_contributor_form',
      2,
    ),
    'access arguments' => array(
      'edit all biblio entries',
    ),
    'file' => 'includes/biblio.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items[$base . "/contributor/%biblio_contributor/delete"] = array(
    'title' => 'Delete Contributor',
    'title callback' => 'biblio_contributor_label',
    'title arguments' => array(
      2,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_contributor_delete_confirm',
      2,
    ),
    'access arguments' => array(
      'edit all biblio entries',
    ),
  );

  // Importing & Exporting

  //----------------------------------------------------------------------------
  $items[$base . "/import"] = array(
    'title' => 'Import',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_import_form',
    ),
    'file' => '/includes/biblio.import.export.inc',
    'access callback' => 'user_access',
    'access arguments' => array(
      'import from file',
    ),
    'weight' => 10,
  );
  $items[$base . "/export"] = array(
    'title' => '',
    'page callback' => 'biblio_export',
    'access callback' => 'user_access',
    'access arguments' => array(
      'show export links',
    ),
    'file' => '/includes/biblio.import.export.inc',
    'type' => MENU_CALLBACK,
  );
  $items[$base . "/pot"] = array(
    'title' => '',
    'page callback' => 'biblio_dump_db_data_for_pot',
    'access callback' => 'user_access',
    'access arguments' => array(
      'export pot data',
    ),
    'type' => MENU_CALLBACK,
  );

  // Biblio Content Management

  //----------------------------------------------------------------------------
  $items['admin/content/biblio'] = array(
    'title' => 'Biblio',
    'description' => 'List and edit Biblio entries.
      Use Biblio for scholarly content, such as journal papers and books.',
    'page callback' => 'biblio_admin_view',
    'page arguments' => array(
      'biblio_admin',
      'page',
    ),
    'access arguments' => array(
      'manage biblio content',
    ),
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
  );
  $items["admin/content/biblio/biblio-list"] = array(
    'title' => 'Biblios',
    'description' => 'View, Edit, and Delete Biblios',
    'access arguments' => array(
      'manage biblio content',
    ),
    'weight' => 0,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/content/biblio/add'] = array(
    'title' => 'Add Biblio',
    'access arguments' => array(
      'create biblio',
    ),
    'page callback' => 'biblio_add',
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/content/biblio/contributor'] = array(
    'title' => 'Contributors',
    'page callback' => 'biblio_admin_view',
    'page arguments' => array(
      'biblio_admin_contributors',
      'page',
    ),
    'access arguments' => array(
      'manage biblio content',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  $items['admin/content/biblio/contributor/add'] = array(
    'title' => 'Add Contributor',
    'page callback' => 'biblio_contributor_add',
    'access arguments' => array(
      'create biblio',
    ),
    'file' => 'includes/biblio.admin.inc',
  );

  // Biblio Structure Management
  // ---------------------------------------------------------------------------
  $items["admin/structure/biblio"] = array(
    'title' => 'Biblio',
    'description' => 'Manage Fields and Dislplay for Biblios and Contributors',
    'access arguments' => array(
      'administer biblio',
    ),
    'page callback' => 'biblio_overview_types',
    'page arguments' => array(
      'biblio',
    ),
    'file' => 'includes/biblio.admin.inc',
    'access arguments' => array(
      'manage biblio structure',
    ),
  );
  $items["admin/structure/biblio/publication-types"] = array(
    'title' => 'Publication Types',
    'description' => 'Manage Biblio Publication Types',
    'access arguments' => array(
      'manage biblio structure',
    ),
    'weight' => 0,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  foreach (biblio_types('biblio') as $type) {
    $bundle = biblio_bundle_name($type->entity);
    $type_url_str = str_replace('_', '-', $type->{$bundle});
    $entity_url_str = str_replace('_', '-', $type->entity);
    $url = 'admin/structure/biblio/publication-types/' . $type_url_str;
    $items[$url] = array(
      'title' => 'Edit ' . $type->name,
      'title callback' => 'check_plain',
      'page callback' => 'biblio_field_settings',
      'file' => '/includes/biblio.admin.inc',
      'page arguments' => array(
        4,
      ),
      'access arguments' => array(
        'manage biblio structure',
      ),
    );
  }
  $items["admin/structure/biblio/contributors"] = array(
    'title' => 'Contributors',
    'description' => 'Manage Biblio Contributor Fields/Display',
    'page callback' => 'biblio_overview_types',
    'page arguments' => array(
      'biblio_contributor',
    ),
    'file' => '/includes/biblio.admin.inc',
    'access arguments' => array(
      'manage biblio structure',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  foreach (biblio_types('biblio_contributor') as $type) {
    $bundle = biblio_bundle_name($type->entity);
    $type_url_str = str_replace('_', '-', $type->{$bundle});
    $entity_url_str = str_replace('_', '-', $type->entity);
    $url = 'admin/structure/biblio/contributors/' . $type_url_str;
    $items[$url] = array(
      'title' => 'Edit ' . $type->name,
      'title callback' => 'check_plain',
      'page callback' => 'biblio_field_settings',
      'file' => '/includes/biblio.admin.inc',
      'page arguments' => array(
        4,
      ),
      'access arguments' => array(
        'manage biblio structure',
      ),
    );
  }

  // Biblio Settings

  //----------------------------------------------------------------------------
  $items['admin/config/content/biblio'] = array(
    'title' => 'Biblio settings',
    'description' => 'Configure default behavior of the Biblio module.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_admin_settings',
    ),
    'access arguments' => array(
      'administer biblio',
    ),
    'file' => '/includes/biblio.admin.inc',
  );
  $items['admin/config/content/biblio/preferences'] = array(
    'title' => 'Preferences',
    'description' => 'Configure default behavior of the Biblio module.',
    'access arguments' => array(
      'administer biblio',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/config/content/biblio/iomap'] = array(
    'title' => 'Import/Export Mapping',
    'page callback' => 'biblio_admin_io_mapper_page',
    'access arguments' => array(
      'administer biblio',
    ),
    'file' => '/includes/biblio.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/config/content/biblio/iomap/formats'] = array(
    'title' => 'Import/Export Mapping',
    'page callback' => 'biblio_admin_io_mapper_page',
    'access arguments' => array(
      'administer biblio',
    ),
    'file' => '/includes/biblio.admin.inc',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -100,
  );
  $formats = module_invoke_all('biblio_mapper_options');
  foreach ($formats as $key => $format) {
    $items['admin/config/content/biblio/iomap/edit/' . $key] = array(
      'title' => $format['title'],
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'biblio_admin_io_mapper_form',
        6,
      ),
      'access arguments' => array(
        'administer biblio',
      ),
      'file' => '/includes/biblio.admin.inc',
      'tab_parent' => 'admin/config/content/biblio/iomap',
      'type' => MENU_LOCAL_TASK,
      'weight' => -1,
    );
  }
  $items['admin/config/content/biblio/iomap/%/%/add'] = array(
    'title' => '',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'biblio_admin_io_mapper_add_form',
      5,
      6,
    ),
    'access arguments' => array(
      'administer biblio',
    ),
    'tab_parent' => 'admin/config/content/biblio/iomap',
    'file' => '/includes/biblio.admin.inc',
    'type' => MENU_CALLBACK,
    'weight' => -1,
  );

  // Other Biblio Features

  //----------------------------------------------------------------------------
  $items['biblio/autocomplete'] = array(
    'title' => 'Autocomplete ',
    'page callback' => 'biblio_autocomplete',
    'access callback' => 'user_access',
    'access arguments' => array(
      'access biblio content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items["user/%user/" . $base] = array(
    'title' => 'Publications',
    'page callback' => 'biblio_profile_page',
    'page arguments' => array(
      1,
      'profile',
      'no_filters',
    ),
    'access callback' => '_biblio_profile_access',
    'access arguments' => array(
      1,
      'profile',
    ),
    'file' => '/includes/biblio.pages.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items[$base . "/user/%"] = array(
    'title' => 'My publications',
    'page callback' => 'biblio_profile_page',
    'page arguments' => array(
      2,
    ),
    'access callback' => '_biblio_profile_access',
    'access arguments' => array(
      2,
      'menu',
    ),
    'parent' => '',
    'file' => '/includes/biblio.pages.inc',
  );
  $items[$base . "/help"] = array(
    'title' => 'Help',
    'page callback' => 'biblio_help_page',
    'access callback' => 'user_access',
    'access arguments' => array(
      'access biblio content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items[$base . "/citekey"] = array(
    'title' => '',
    'page callback' => 'biblio_citekey_view',
    'access arguments' => array(
      'access biblio content',
    ),
    'file' => '/includes/biblio.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items[$base . "/recent/rss.xml"] = array(
    'title' => 'RSS feed',
    'page callback' => 'biblio_recent_feed',
    'access callback' => 'biblio_access',
    'access arguments' => array(
      'rss',
    ),
    'type' => MENU_CALLBACK,
  );
  biblio_menu_links();
  return $items;
}