Tripal v1.0 (6.x-1.0)
|
00001 <?php 00002 00003 require_once "api/tripal_db.api.inc"; 00004 require_once "includes/tripal_db.admin.inc"; 00005 00015 function tripal_db_init() { 00016 00017 // add the tripal_db JS and CSS 00018 drupal_add_css(drupal_get_path('theme', 'tripal') . '/css/tripal_db.css'); 00019 drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_db.js'); 00020 } 00025 function tripal_db_menu() { 00026 $items = array(); 00027 00028 $items['admin/tripal/tripal_db'] = array( 00029 'title' => 'Databases', 00030 'description' => 'Basic Description of Tripal DB Module Functionality', 00031 'page callback' => 'theme', 00032 'page arguments' => array('tripal_db_admin'), 00033 'access callback' => 'user_access', 00034 'access arguments' => array('administer db cross-references'), 00035 'type' => MENU_NORMAL_ITEM, 00036 ); 00037 00038 $items['admin/tripal/tripal_db/edit_db'] = array( 00039 'title' => 'Edit a Database', 00040 'description' => 'Manage Databases ', 00041 'page callback' => 'drupal_get_form', 00042 'page arguments' => array('tripal_db_form', 'Update'), 00043 'access callback' => 'user_access', 00044 'access arguments' => array('administer db cross-references'), 00045 'type' => MENU_NORMAL_ITEM, 00046 ); 00047 00048 $items['admin/tripal/tripal_db/add_db'] = array( 00049 'title' => 'Add a Database', 00050 'page callback' => 'drupal_get_form', 00051 'page arguments' => array('tripal_db_form', 'Add'), 00052 'access callback' => 'user_access', 00053 'access arguments' => array('administer db cross-references'), 00054 'type' => MENU_NORMAL_ITEM, 00055 ); 00056 $items['admin/tripal/tripal_db/edit/js'] = array( 00057 'page callback' => 'tripal_ajax_db_edit', 00058 'access callback' => 'user_access', 00059 'access arguments' => array('access administration pages'), 00060 'type' => MENU_CALLBACK, 00061 ); 00062 00063 return $items; 00064 } 00065 00073 function tripal_db_perm() { 00074 return array( 00075 'administer db cross-references', 00076 ); 00077 } 00078 00087 function tripal_db_views_api() { 00088 return array('api' => 2.0); 00089 } 00090 00091 function tripal_db_form_alter(&$form, &$form_state, $form_id) { 00092 if ($form_id == "tripal_db_form") { 00093 // updating the form through the ahah callback sets the action of 00094 // the form to the ahah callback URL. We need to set it back 00095 // to the normal form URL 00096 if ($form_state['values']['form_action'] == 'Update') { 00097 $form['#action'] = url("admin/tripal/tripal_db/edit_db"); 00098 } 00099 if ($form_state['values']['form_action'] == 'Add') { 00100 $form['#action'] = url("admin/tripal/tripal_db/add_db"); 00101 } 00102 } 00103 } 00104 00112 function tripal_db_theme() { 00113 return array( 00114 'tripal_db_admin' => array( 00115 'template' => 'tripal_db_admin', 00116 'arguments' => array(NULL), 00117 'path' => drupal_get_path('module', 'tripal_db') . '/theme', 00118 ), 00119 ); 00120 }