123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?php
- require_once "api/tripal_db.api.inc";
- require_once "includes/tripal_db.admin.inc";
- /**
- * @defgroup tripal_db DB Module
- * @ingroup tripal_modules
- */
- /**
- *
- * @ingroup tripal_db
- */
- function tripal_db_init() {
- // add the tripal_db JS and CSS
- drupal_add_css(drupal_get_path('theme', 'tripal') . '/css/tripal_db.css');
- drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_db.js');
- }
- /**
- *
- * @ingroup tripal_db
- */
- function tripal_db_menu() {
- $items = array();
- $items['admin/tripal/tripal_db'] = array(
- 'title' => 'Databases',
- 'description' => 'Basic Description of Tripal DB Module Functionality',
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_db_admin'),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/tripal_db/edit_db'] = array(
- 'title' => 'Edit a Database',
- 'description' => 'Manage Databases ',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_db_form', 'Update'),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/tripal_db/add_db'] = array(
- 'title' => 'Add a Database',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_db_form', 'Add'),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer db cross-references'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/tripal_db/edit/js'] = array(
- 'page callback' => 'tripal_ajax_db_edit',
- 'access callback' => 'user_access',
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- /**
- * Set the permission types that the chado module uses. Essentially we
- * want permissionis that protect creation, editing and deleting of chado
- * data objects
- *
- * @ingroup tripal_db
- */
- function tripal_db_perm() {
- return array(
- 'administer db cross-references',
- );
- }
- /**
- * Implements hook_views_api()
- * Purpose: 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_db
- */
- function tripal_db_views_api() {
- return array('api' => 2.0);
- }
- function tripal_db_form_alter(&$form, &$form_state, $form_id) {
- if ($form_id == "tripal_db_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 ($form_state['values']['form_action'] == 'Update') {
- $form['#action'] = url("admin/tripal/tripal_db/edit_db");
- }
- if ($form_state['values']['form_action'] == 'Add') {
- $form['#action'] = url("admin/tripal/tripal_db/add_db");
- }
- }
- }
- /**
- * We need to let drupal know about our theme functions and their arguments.
- * We create theme functions to allow users of the module to customize the
- * look and feel of the output generated in this module
- *
- * @ingroup tripal_db
- */
- function tripal_db_theme() {
- return array(
- 'tripal_db_admin' => array(
- 'template' => 'tripal_db_admin',
- 'arguments' => array(NULL),
- 'path' => drupal_get_path('module', 'tripal_db') . '/theme',
- ),
- );
- }
|