123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <?php
- require_once 'api/tripal_db.DEPRECATED.inc';
- require_once 'includes/tripal_db.admin.inc';
- function tripal_db_menu() {
- $items = array();
- $items['admin/tripal/legacy/tripal_db'] = array(
- 'title' => 'Databases',
- 'description' => 'References to External Database sites such as NCBI',
- 'page callback' => 'tripal_db_admin_db_listing',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/legacy/tripal_db/help'] = array(
- 'title' => 'Help',
- 'description' => "A description of the Tripal Database module including a short description of it's usage.",
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_db_admin'),
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/legacy/tripal_db/edit/%'] = array(
- 'title' => 'Edit a Database Reference',
- 'description' => 'Edit existing Database References.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_db_db_edit_form',5),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/tripal_db/add'] = array(
- 'title' => 'Create a Database Reference',
- 'description' => 'Create a new reference to an External Database.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_db_db_add_form'),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/tripal_db/views/dbs/enable'] = array(
- 'title' => 'Enable Database Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_db_admin_dbs', 'admin/tripal/legacy/tripal_db'),
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/tripal_db/views/dbxrefs/enable'] = array(
- 'title' => 'Enable Reference Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_db_admin_dbxrefs', 'admin/tripal/legacy/tripal_db'),
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/tripal_db/dbxref/auto_name/%/%'] = array(
- 'page callback' => 'tripal_db_dbxref_accession_autocomplete',
- 'page arguments' => array(6, 7),
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- function tripal_db_help ($path, $arg) {
- if ($path == 'admin/help#tripal_db') {
- return theme('tripal_db_help', array());
- }
- }
- function tripal_db_permission() {
- return array(
- 'administer db cross-references' => array(
- 'title' => t('Administer External Database Cross-references.'),
- 'description' => t('Allows the user to add, edit or delete external databases references stored in the Chado database.'),
- ),
- );
- }
- function tripal_db_views_api() {
- return array('api' => 3.0);
- }
- function tripal_db_theme($existing, $type, $theme, $path) {
- $items = array(
- 'tripal_db_help' => array(
- 'template' => 'tripal_db_help',
- 'variables' => array(NULL),
- 'path' => "$path/theme/templates"
- )
- );
- return $items;
- }
- function tripal_db_dbxref_accession_autocomplete($db_id, $string = '') {
- if (!$db_id) {
- return drupal_json_output(array());
- }
- $sql = "
- SELECT dbxref_id, accession
- FROM {dbxref}
- WHERE db_id = :db_id and lower(accession) like lower(:accession)
- ORDER by accession
- LIMIT 25 OFFSET 0
- ";
- $results = chado_query($sql, array(':db_id' => $db_id, ':accession' => $string . '%'));
- $items = array();
- foreach ($results as $ref) {
- $items[$ref->accession] = $ref->accession;
- }
- drupal_json_output($items);
- }
|