'Tripal Management', 'description' => "Manage the behavior or Tripal and its various modules.", 'position' => 'right', 'weight' => -5, 'page callback' => 'system_admin_menu_block_page', 'access arguments' => array('administer site configuration'), 'file' => 'system.admin.inc', 'file path' => drupal_get_path('module', 'system'), ); // the administative settings menu /* $items['admin/tripal/tripal_core'] = array( 'title' => 'Tripal core settings', 'description' => 'Tripal Settings', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_core_admin'), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); */ $items['admin/tripal/tripal_jobs'] = array( 'title' => 'Jobs', 'description' => 'Jobs managed by Tripal', 'page callback' => 'tripal_jobs_report', 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/tripal_mview/%'] = array( 'title' => 'Materialized View', 'description' => 'Materialized views are used to improve speed of large or complex queries.', 'page callback' => 'tripal_mview_report', 'page arguments' => array(3), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/tripal_mviews'] = array( 'title' => 'Materialized Views', 'description' => 'Materialized views are used to improve speed of large or complex queries.', 'page callback' => 'tripal_mviews_report', 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/tripal_mviews/new'] = array( 'title' => 'Create View', 'description' => 'Materialized views are used to improve speed of large or complex queries.', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_mviews_form'), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/tripal_mviews/edit/%'] = array( 'title' => 'Edit View', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_mviews_form',4), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/tripal_mviews/action/%/%'] = array( 'title' => 'Create View', 'description' => 'Materialized views are used to improve speed of large or complex queries.', 'page callback' => 'tripal_mviews_action', 'page arguments' => array(4,5), 'access arguments' => array('access administration pages'), 'type' => MENU_CALLBACK, ); $items['tripal_toggle_box_menu/%/%/%'] = array( 'title' => t('Libraries'), 'page callback' => 'tripal_toggle_box_menu', 'page arguments' => array(1,2,3), 'access arguments' => array('access administration pages'), 'type' => MENU_CALLBACK | MENU_LINKS_TO_PARENT ); $items['admin/tripal/chado_1_11_install'] = array( 'title' => 'Install Chado v1.11', 'description' => 'Installs Chado version 1.11 inside the current Drupal database', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_core_chado_v1_11_load_form'), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/gff3_load'] = array( 'title' => 'Import a GFF3 file', 'description' => 'Import a GFF3 file into Chado', 'page callback' => 'drupal_get_form', 'page arguments' => array('tripal_core_gff3_load_form'), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/bulk_load/create'] = array( 'title' => 'Create Bulk Loader', 'description' => 'Create a bulk loader template for loading data into Chado', 'page callback' => 'tripal_core_bulk_loader_create', 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); return $items; } /************************************************************************ * The typical display for information on feature, organism, library, etc * pages is to use the Tripal expandable boxes. However, some sites may * prefer to use a menu system to keep the pages less cluttered. This * function provides a common interface for setting a Drupal variable * that indicates whether or not the content is displayed in a box or as * a menu item. This function just reverses the setting each time it is * called */ function tripal_toggle_box_menu($module,$box_name,$nid){ // if the content is not in a menu then we wnat to turn on the // menu. If the content is in a menu item then we want to turn // on the box. if(strcmp(variable_get("$module-box-$box_name","menu_off"),"menu_off")==0){ variable_set("$module-box-$box_name","menu_on"); } else { variable_set("$module-box-$box_name","menu_off"); } drupal_goto("node/$nid"); } /************************************************************************ * */ function tripal_core_admin () { $form['chado_feature_data_url'] = array ( '#title' => t('URL for data files'), '#type' => t('textfield'), '#description' => t("This is the base URL location (without a leading forward slash) for where files (e.g. blast .xml files) related to each feature are stored. All files available for download or parsing that a feature needs for display should be located in this base directory."), '#required' => TRUE, '#default_value' => variable_get('chado_feature_data_url','sites/default/files/data'), ); return system_settings_form($form); } /************************************************************************ * The tripal_db_set_active function is used to prevent namespace collisions * when chado and drupal are installed in the same database but in different * schemas. It is also used for backwards compatibility with older versions * of tripal or in cases where chado is located outside of the Drupal database. */ function tripal_db_set_active($dbname){ global $db_url, $db_type; $chado_exists = 0; // only postgres can support search paths. So if this is MysQL then // just run the normal tripal_db_set_active function. if(strcmp($db_type,'pgsql')==0){ // if the 'chado' database is in the $db_url variable then chado is // not in the same Drupal database if(is_array($db_url)){ if(isset($db_url[$dbname])){ return db_set_active($dbname); } } // check to make sure the chado schema exists $sql = "select nspname from pg_catalog.pg_namespace where nspname = 'chado'"; if(db_fetch_object(db_query($sql))){ $chado_exists = 1; } // here we make the assumption that the default database schema is // 'public'. This will most likely always be the case but if not, // then this code will break if($chado_exists && strcmp($dbname,'chado')==0){ db_query("set search_path to %s",'chado,public'); return 'public,chado'; } elseif($chado_exists) { db_query("set search_path to %s",'public,chado'); return 'chado,public'; } else { return db_set_active($dbname); } } else return db_set_active($dbname); } /************************************************************************* * Implements hook_views_api() * Purpose: Essentially this hook tells drupal that there is views support for * for this module which then includes tripal_core.views.inc where all the * views integration code is */ function tripal_core_views_api() { return array( 'api' => 2.0, ); }