123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <?php
- require_once "jobs.php";
- require_once "mviews.php";
- require_once "cvterms.php";
- require_once "chado_install.php";
- require_once "tripal_views_integration.inc";
- require_once "tripal_core.api.inc";
- require_once "tripal_core.views.inc";
-
- function tripal_core_init(){
-
-
-
-
-
-
- $previous = tripal_db_set_active('chado');
- tripal_db_set_active($previous);
-
-
- if(tripal_core_is_chado_installed()){
- $previous_db = tripal_db_set_active('chado');
- if(!db_fetch_object(db_query("SELECT * FROM {cv} WHERE name = 'tripal'"))){
- $results = db_query("INSERT INTO {cv} (name,definition) ".
- "VALUES ('tripal','Terms used by Tripal for modules to manage data such as that stored in property tables like featureprop, analysisprop, etc')");
- }
- if(!db_fetch_object(db_query("SELECT * FROM {db} WHERE name = 'tripal'"))){
- $results = db_query("INSERT INTO {db} (name,description) ".
- "VALUES ('tripal','Used as a database placeholder for tripal defined objects such as tripal cvterms')");
- }
- tripal_db_set_active($previous_db);
- }
-
- global $base_url;
- $theme_dir = drupal_get_path('theme', 'tripal');
- $clean_urls = variable_get('clean_url', 0);
- drupal_add_js("
- var baseurl = '$base_url';
- var themedir = '$theme_dir';
- var isClean = $clean_urls;",'inline');
-
-
-
- db_query("SET DATESTYLE TO '%s'",'MDY');
- }
- function tripal_core_menu() {
- $items = array();
-
-
- $items['admin/tripal'] = array(
- 'title' => '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'),
- );
- $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_jobs/cancel/%'] = array(
- 'title' => 'Jobs',
- 'description' => 'Cancel a pending job',
- 'page callback' => 'tripal_jobs_cancel',
- 'page arguments' => array(4),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_jobs/rerun/%'] = array(
- 'title' => 'Jobs',
- 'description' => 'Re-run an existing job.',
- 'page callback' => 'tripal_jobs_rerun',
- 'page arguments' => array(4),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_jobs/view/%'] = array(
- 'title' => 'Jobs Details',
- 'description' => 'View job details.',
- 'page callback' => 'tripal_jobs_view',
- 'page arguments' => array(4),
- '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/views'] = array(
- 'title' => t('Views'),
- 'description' => 'Management of Materialized Views & Integration with Drupal Views',
- 'page callback' => 'tripal_core_views_description_page',
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/mviews'] = array(
- 'title' => 'MViews',
- '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/views/mviews/report/%'] = 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(5),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/mviews/new'] = array(
- 'title' => 'Create MView',
- '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/views/mviews/edit/%'] = array(
- 'title' => 'Edit MView',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_form',5),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/mviews/action/%/%'] = array(
- 'title' => 'Create MView',
- 'description' => 'Materialized views are used to improve speed of large or complex queries.',
- 'page callback' => 'tripal_mviews_action',
- 'page arguments' => array(5,6),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/views/integration'] = array(
- 'title' => t('Drupal Views Integration'),
- 'description' => t('Allows you to select existing materialized views and provide details for integration with Drupal Views.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_views_integration_admin_form'),
- 'access arguments' => array('manage tripal_views_integration'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/integration/mviews'] = array(
- 'title' => t('Integrated MViews'),
- 'description' => t('Allows you to select existing materialized views and provide details for integration with Drupal Views.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_views_integration_admin_form'),
- 'access arguments' => array('manage tripal_views_integration'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/views/integration/mviews/new'] = array(
- 'title' => 'Add an MView',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_views_integration_new_setup_form'),
- 'access arguments' => array('manage tripal_views_integration'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/integration/chado'] = array(
- 'title' => t('Integrated Chado Table'),
- 'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_views_integration_admin_form'),
- 'access arguments' => array('manage tripal_views_integration'),
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/tripal/views/integration/chado/new'] = array(
- 'title' => 'Add a Chado table',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_views_integration_new_setup_form'),
- 'access arguments' => array('manage tripal_views_integration'),
- 'type' => MENU_NORMAL_ITEM,
- );
- return $items;
- }
- function tripal_core_perm(){
- return array(
- 'manage tripal_views_integration',
- );
- }
- function tripal_core_is_chado_installed(){
- global $db_url, $db_type;
-
-
- if(is_array($db_url)){
- if(isset($db_url['chado'])){
- return true;
- }
- }
-
- $sql = "select nspname from pg_catalog.pg_namespace where nspname = 'chado'";
- if(db_fetch_object(db_query($sql))){
- return true;
- }
- return false;
- }
-
- function tripal_core_views_api() {
- return array(
- 'api' => 2.0,
- );
- }
- function tripal_core_theme () {
- return array(
- 'tripal_core_job_view' => array (
- 'arguments' => array('job_id'=> null),
- 'template' => 'tripal_core_job_view',
- ),
- 'tripal_core_views_integration_new_setup_form' => array(
- 'arguments' => array('form' => NULL),
- 'template' => 'tripal_views_integration_fields_form',
- ),
- );
- }
- function tripal_core_job_describe_args($callback,$args){
- $new_args = array();
- if($callback == 'tripal_update_mview'){
-
- $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = %d ";
- $mview = db_fetch_object(db_query($sql,$args[0]));
- $new_args['View Name'] = $mview->name;
- }
- return $new_args;
- }
- function tripal_core_load_gff3($gff_file, $organism_id,$analysis_id,$add_only =0,
- $update = 0, $refresh = 0, $remove = 0, $job = NULL)
- {
- tripal_feature_load_gff3($gff_file, $organism_id,$analysis_id,$add_only,
- $update, $refresh, $remove, $job);
- }
|