123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <?php
- require 'api/tripal_library.api.inc';
- require 'theme/tripal_library.theme.inc';
- require 'includes/tripal_library.admin.inc';
- require 'includes/tripal_library.chado_node.inc';
- function tripal_library_permisssion() {
- return array(
- 'access chado_library content' => array(
- 'title' => t('View Libraries'),
- 'description' => t('Allow users to view library pages.'),
- ),
- 'create chado_library content' => array(
- 'title' => t('Create Libraries'),
- 'description' => t('Allow users to create new library pages.'),
- ),
- 'delete chado_library content' => array(
- 'title' => t('Delete Libraries'),
- 'description' => t('Allow users to delete library pages.'),
- ),
- 'edit chado_library content' => array(
- 'title' => t('Edit Libraries'),
- 'description' => t('Allow users to edit library pages.'),
- ),
- 'adminster tripal library' => array(
- 'title' => t('Administer Libraries'),
- 'description' => t('Allow users to administer all libraries.'),
- ),
- );
- }
- function tripal_library_menu() {
- $items = array();
-
- $items['admin/tripal/chado/tripal_library'] = array(
- 'title' => 'Libraries',
- 'description' => 'Any biological library. Examples of genomic libraries include BAC, cDNA, FOSMID, etc.',
- 'page callback' => 'tripal_library_admin_libraries_listing',
- 'access arguments' => array('administer tripal library'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/chado/tripal_library/help'] = array(
- 'title' => 'Help',
- 'description' => 'Basic Description of Tripal Library Module Functionality',
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_library_help'),
- 'access arguments' => array('administer tripal library'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/chado/tripal_library/configuration'] = array(
- 'title' => 'Settings',
- 'description' => 'Configure the Tripal Library module',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_library_admin'),
- 'access arguments' => array('administer tripal library'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 5
- );
- $items['admin/tripal/chado/tripal_library/sync'] = array(
- 'title' => ' Sync',
- 'description' => 'Create pages on this site for libraries stored in Chado',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_chado_node_sync_form', 'tripal_library', 'chado_library'),
- 'access arguments' => array('administer tripal library'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 2
- );
- $items['admin/tripal/chado/tripal_library/views/libraries/enable'] = array(
- 'title' => 'Enable Library Administrative View',
- 'page callback' => 'tripal_views_admin_enable_view',
- 'page arguments' => array('tripal_library_admin_libraries', 'admin/tripal/chado/tripal_library'),
- 'access arguments' => array('administer tripal library'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- function tripal_library_views_api() {
- return array(
- 'api' => 3.0,
- );
- }
- function tripal_library_theme($existing, $type, $theme, $path) {
- $core_path = drupal_get_path('module', 'tripal_core');
- $items = array(
- 'node__chado_library' => array(
- 'template' => 'node--chado-generic',
- 'render element' => 'node',
- 'base hook' => 'node',
- 'path' => "$core_path/theme",
- ),
-
- 'tripal_library_base' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_base',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_properties' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_properties',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_publications' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_publications',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_references' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_references',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_synonyms' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_synonyms',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_terms' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_terms',
- 'path' => "$path/theme/tripal_library",
- ),
- 'tripal_library_help' => array(
- 'template' => 'tripal_library_help',
- 'variables' => array(NULL),
- 'path' => "$path/theme",
- ),
-
- 'tripal_library_teaser' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_library_teaser',
- 'path' => "$path/theme/tripal_library",
- ),
-
- 'tripal_organism_libraries' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_organism_libraries',
- 'path' => "$path/theme/tripal_organism",
- ),
-
- 'tripal_feature_libraries' => array(
- 'variables' => array('node' => NULL),
- 'template' => 'tripal_feature_libraries',
- 'path' => "$path/theme/tripal_feature",
- ),
- );
- return $items;
- }
- function tripal_library_help ($path, $arg) {
- if ($path == 'admin/help#tripal_library') {
- return theme('tripal_library_help', array());
- }
- }
- function tripal_library_block_info() {
- $blocks['libreferences']['info'] = t('Tripal Library Cross References');
- $blocks['libreferences']['cache'] = DRUPAL_NO_CACHE;
- $blocks['libbase']['info'] = t('Tripal Library Details');
- $blocks['libbase']['cache'] = DRUPAL_NO_CACHE;
- $blocks['libterms']['info'] = t('Tripal Library Terms');
- $blocks['libterms']['cache'] = DRUPAL_NO_CACHE;
- $blocks['libsynonyms']['info'] = t('Tripal Library Synonyms');
- $blocks['libsynonyms']['cache'] = DRUPAL_NO_CACHE;
- $blocks['libproperties']['info'] = t('Tripal Library Properties');
- $blocks['libproperties']['cache'] = DRUPAL_NO_CACHE;
- $blocks['featurelibs']['info'] = t('Tripal Feature Libraries');
- $blocks['featurelibs']['cache'] = DRUPAL_NO_CACHE;
- $blocks['orglibs']['info'] = t('Tripal Organism Libraries');
- $blocks['orglibs']['cache'] = DRUPAL_NO_CACHE;
- return $blocks;
- }
- function tripal_library_block_view($delta = '') {
- if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
- $nid = arg(1);
- $node = node_load($nid);
- $block = array();
- switch ($delta) {
- case 'libreferences':
- $block['subject'] = t('Cross References');
- $block['content'] = theme('tripal_library_references', $node);
- break;
- case 'libbase':
- $block['subject'] = t('Library Details');
- $block['content'] = theme('tripal_library_base', $node);
- break;
- case 'libsynonyms':
- $block['subject'] = t('Synonyms');
- $block['content'] = theme('tripal_library_synonyms', $node);
- break;
- case 'libproperties':
- $block['subject'] = t('Properties');
- $block['content'] = theme('tripal_library_properties', $node);
- break;
- case 'libterms':
- $block['subject'] = t('Library Terms');
- $block['content'] = theme('tripal_library_terms', $node);
- break;
- case 'featurelibs':
- $block['subject'] = t('Libraries');
- $block['content'] = theme('tripal_feature_libraries', $node);
- break;
- case 'orglibs':
- $block['subject'] = t('Libraries');
- $block['content'] = theme('tripal_organism_libraries', $node);
- break;
- default :
- }
- return $block;
- }
- }
- function tripal_library_form_alter(&$form, &$form_state, $form_id) {
-
- if ($form_id == "chado_library_node_form") {
- $form['actions']['preview']['#access'] = FALSE;
- }
- }
|