123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <?php
- /**
- * @file
- * Basic functionality of the pub module
- */
- /**
- * @defgroup tripal_legacy_pub Legacy Publication Module
- * @ingroup tripal_legacy_modules
- * @{
- * Integrates the Chado Publication module with Drupal Nodes & Views, as well as, provides
- * the ability to import publication from PubMed
- *
- * The Tripal Publication module allows you to search the PubMed database for academic articles,
- * that relate to user specified topic\s. As well, it allows management of publications so that
- * a user can enter specified details regarding a desired publication. This allows all of the important
- * information that is unique to a Academic Publication to be stored for access.
- * @}
- */
- require_once 'api/tripal_pub.DEPRECATED.inc';
- require_once 'theme/tripal_pub.theme.inc';
- require_once 'includes/tripal_pub.admin.inc';
- require_once 'includes/tripal_pub.chado_node.inc';
- /**
- * Implements hook_menu().
- *
- * Adds menu items for the tripal_pub module menu. This section
- * gives the outline for the main menu of the Tripal-Publication module
- *
- * @return
- * An array of menu items that is visible within the Drupal Menu, returned as soon
- * as the program is ran
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_menu() {
- $items = array();
- // because the publication search is not views we need to manually add
- // it to the Search Data list in the navigation menu
- $items['chado/publication' ]= array(
- 'title' => 'Publications',
- 'description' => ('Publications such as journal articles, conference proceedings, or other media.'),
- 'page callback' => 'tripal_pub_search_page',
- 'access arguments' => array('access chado_pub content'),
- 'type' => MENU_NORMAL_ITEM
- );
- // for backwards compatibility the same chado/publications is also found
- // at find/publications
- $items['admin/tripal/legacy/tripal_pub']= array(
- 'title' => 'Publications',
- 'description' => ('A documented provenance artefact - publications, documents, personal communication.'),
- 'page callback' => 'tripal_pub_admin_pub_view',
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_NORMAL_ITEM
- );
- $items['admin/tripal/legacy/tripal_pub/help']= array(
- 'title' => 'Help',
- 'description' => ('A module for interfacing the GMOD chado database with Drupal, providing viewing of publications'),
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_pub_help'),
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/legacy/tripal_pub/configuration'] = array(
- 'title' => 'Settings',
- 'description' => 'Configure the Tripal publication module.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_pub_admin'),
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 5
- );
- $items['admin/tripal/legacy/tripal_pub/sync'] = array(
- 'title' => ' Sync',
- 'description' => 'Create pages on this site for libraries stored in Chado',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('chado_node_sync_form', 'tripal_pub', 'chado_pub'),
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 2
- );
- $items['admin/tripal/legacy/tripal_pub/chado_pub_toc'] = array(
- 'title' => ' TOC',
- 'description' => 'Manage the table of contents for pub nodes.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_content_type_toc_form', 'chado_pub'),
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'includes/tripal_core.toc.inc',
- 'file path' => drupal_get_path('module', 'tripal_core'),
- 'weight' => 3
- );
- $items['admin/tripal/legacy/tripal_pub/citation'] = array(
- 'title' => 'Citations',
- 'description' => 'Update publication citations',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_pub_citation_form'),
- 'access arguments' => array('administer tripal pub'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 1
- );
- return $items;
- }
- /**
- * Implements hook_theme().
- * Register themeing functions for this module
- *
- * @return
- * An array of themeing functions to register
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_theme($existing, $type, $theme, $path) {
- $core_path = drupal_get_path('module', 'tripal_core');
- $items = array(
- 'node__chado_pub' => array(
- 'template' => 'node--chado-generic',
- 'render element' => 'node',
- 'base hook' => 'node',
- 'path' => "$core_path/theme/templates",
- ),
- // node templates
- 'tripal_pub_authors' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_authors',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_base' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_base',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_featuremaps' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_featuremaps',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_features' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_features',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_libraries' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_libraries',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_projects' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_projects',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_properties' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_properties',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_references' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_references',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_relationships' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_relationships',
- 'path' => "$path/theme/templates",
- ),
- 'tripal_pub_stocks' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_stocks',
- 'path' => "$path/theme/templates",
- ),
- // instructions page for the pub module
- 'tripal_pub_help' => array(
- 'variables' => array(NULL),
- 'template' => 'tripal_pub_help',
- 'path' => "$path/theme/templates",
- ),
- // teaser
- 'tripal_pub_teaser' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_pub_teaser',
- 'path' => "$path/theme/templates",
- ),
- );
- return $items;
- }
- /**
- * Implements hook_help().
- * Adds a help page to the module list
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_help ($path, $arg) {
- if ($path == 'admin/help#tripal_pub') {
- return theme('tripal_pub_help', array());
- }
- }
- /**
- * Implements hook_views_api().
- *
- * Essentially this hook tells drupal that there is views support for
- * for this module which then includes tripal_db.views.inc where all the
- * views integration code is
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_views_api() {
- return array(
- 'api' => 3.0,
- );
- }
- /**
- * Implement hook_permission().
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_permission() {
- return array(
- 'access chado_pub content' => array(
- 'title' => t('View Publications'),
- 'description' => t('Allow users to view publication pages.'),
- ),
- 'create chado_pub content' => array(
- 'title' => t('Create Publication'),
- 'description' => t('Allow users to create new publication pages.'),
- ),
- 'delete chado_pub content' => array(
- 'title' => t('Delete Publication'),
- 'description' => t('Allow users to delete publication pages.'),
- ),
- 'edit chado_pub content' => array(
- 'title' => t('Edit Publications'),
- 'description' => t('Allow users to edit publication pages.'),
- ),
- 'administer tripal pub' => array(
- 'title' => t('Administer Publications'),
- 'description' => t('Allow users to administer all publications.'),
- ),
- );
- }
- /**
- * Implementation of hook_form_alter().
- *
- * @param $form
- * @param $form_state
- * @param $form_id
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_form_alter(&$form, &$form_state, $form_id) {
- // turn of preview button for insert/updates
- if ($form_id == "chado_pub_node_form") {
- // turn of preview button for insert/updates
- $form['actions']['preview']['#access'] = FALSE;
- //remove the body field
- unset($form['body']);
- }
- if ($form_id == "tripal_pub_importer_setup_form") {
- /* // updating the form through the ahah callback sets the action of
- // the form to the ahah callback URL. We need to set it back
- // to the normal form URL
- if (array_key_exists('values', $form_state) and $form_state['values']['action'] == 'edit') {
- $form['#action'] = url("admin/tripal/legacy/tripal_pub/import/edit/" . $form_state['values']['pub_import_id']);
- }
- if (array_key_exists('values', $form_state) and $form_state['values']['action'] == 'new') {
- $form['#action'] = url("admin/tripal/legacy/tripal_pub/import/new");
- }
- */
- }
- if ($form_id == "tripal_pub_search_form") {
- $form['#action'] = url("find/publications");
- }
- if ($form_id == "chado_pub_node_form") {
- }
- }
- /**
- * Implements hook_job_describe_args().
- *
- * @ingroup tripal_legacy_pub
- */
- function tripal_pub_job_describe_args($callback, $args) {
- $new_args = array();
- if ($callback == 'chado_execute_pub_importer') {
- // get all of the loaders
- $qargs = array(':import_id' => $args[0]);
- $sql = "SELECT * FROM {tripal_pub_import} WHERE pub_import_id = :import_id ";
- $import = db_query($sql, $qargs)->fetchObject();
- $new_args['Importer'] = $import->name;
- }
- return $new_args;
- }
- /**
- * A simple wrapper function to put <pre> tags around the raw results
- * returned by the
- * @param unknown $dbxref
- * @return string
- */
- function tripal_get_remote_pub_raw_page($dbxref) {
- $pub = tripal_get_remote_pub($dbxref);
- if ($pub) {
- $page = "<strong>Raw results for $dbxref:</strong><br><br>";
- $page.= '<textarea cols=80 rows=20>' . $pub['raw'] . '</textarea>';
- return $page;
- }
- return "Cound not find the requested publication ($dbxref)";
- }
- /**
- *
- */
- function tripal_pub_search_biological_data_views() {
- return array(
- 'publications' => array(
- 'machine_name' => 'publications',
- 'human_name' => 'Publications',
- 'description' => 'Publications such as journal articles, conference proceedings, or other media.',
- 'link' => 'find/publications'
- ),
- );
- }
|