123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- <?php
- require_once 'api/tripal_core.chado_general.api.inc';
- require_once 'api/tripal_core.chado_query.api.inc';
- require_once 'api/tripal_core.chado_variables.api.inc';
- require_once 'api/tripal_core.chado_schema.api.inc';
- require_once 'api/tripal_core.chado_nodes.api.inc';
- require_once 'api/tripal_core.chado_nodes.title_and_path.inc';
- require_once 'api/tripal_core.chado_nodes.properties.api.inc';
- require_once 'api/tripal_core.chado_nodes.dbxrefs.api.inc';
- require_once 'api/tripal_core.chado_nodes.relationships.api.inc';
- require_once 'api/tripal_core.custom_tables.api.inc';
- require_once 'api/tripal_core.mviews.api.inc';
- require_once 'api/tripal_core.files.api.inc';
- require_once 'api/tripal_core.jobs.api.inc';
- require_once 'api/tripal_core.tripal.api.inc';
- require_once 'api/tripal_core.tripal_variables.api.inc';
- require_once 'api/tripal_core.d3js.api.inc';
- require_once 'api/tripal_core.DEPRECATED.inc';
- require_once 'includes/tripal_core.jobs.inc';
- require_once 'includes/tripal_core.mviews.inc';
- require_once 'includes/tripal_core.custom_tables.inc';
- require_once 'includes/tripal_core.chado_install.inc';
- require_once 'includes/tripal_core.form_elements.inc';
- tripal_core_set_globals();
- function tripal_core_set_globals() {
-
-
-
-
-
- $GLOBALS["chado_is_installed"] = chado_is_installed();
- if ($GLOBALS["chado_is_installed"]) {
- $GLOBALS["chado_is_local"] = chado_is_local();
- $GLOBALS["chado_version"] = chado_get_version();
- $GLOBALS["exact_chado_version"] = chado_get_version(TRUE);
- }
- }
- function tripal_core_init() {
- global $base_url;
-
-
- if ($GLOBALS["chado_is_installed"]) {
-
- $results = chado_query("SELECT * FROM {cv} WHERE name = 'tripal'");
- $tripal_cv = $results->fetchObject();
- if (!$tripal_cv) {
- $results = chado_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')"
- );
- }
-
- $results = chado_query("SELECT * FROM {db} WHERE name = 'tripal'");
- $tripal_db = $results->fetchObject();
- if (!$tripal_db) {
- $results = chado_query(
- "INSERT INTO {db} (name,description) " .
- "VALUES ('tripal', 'Used as a database placeholder for tripal defined objects such as tripal cvterms')"
- );
- }
- }
-
- $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', 'header');
-
-
-
- db_query("SET DATESTYLE TO :style", array(':style' => 'MDY'));
-
-
-
-
-
-
- module_load_include('inc', 'node', 'node.pages');
- }
- function tripal_core_menu() {
- $items = array();
-
- $items['admin/tripal'] = array(
- 'title' => 'Tripal',
- 'description' => t("Manage the behavior or Tripal and its various modules."),
- 'weight' => -8,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('administer tripal'),
- 'file' => 'system.admin.inc',
- 'file path' => drupal_get_path('module', 'system'),
- );
- $items['admin/tripal/schema'] = array(
- 'title' => 'Chado Schema',
- 'description' => t("Tools to extend the chado schema through custom tables & materialized views."),
- 'weight' => -2,
- 'access arguments' => array('administer tripal'),
- );
- $items['admin/tripal/chado'] = array(
- 'title' => 'Chado Modules',
- 'description' => t('Configuration for specific chado data types such as Vocabularies, Features, etc.'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -6
- );
- $items['admin/tripal/loaders'] = array(
- 'title' => 'Chado Data Loaders',
- 'description' => t('Tools facilitating loading data into the chado database. Includes a generic tab-delimited loader (Bulk Loader).'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -4
- );
- $items['admin/tripal/extension'] = array(
- 'title' => 'Extensions',
- 'description' => t('Configuration for Tripal extensions.'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => 0
- );
- $items['admin/tripal/extension/import'] = array(
- 'title' => 'Import Extensions',
- 'description' => 'Provides a list of the available extensions that are registered at the tripal.info site. From this page you can easily import or install extensions to your site.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_extensions_form'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'includes/tripal_core.extensions.inc',
- 'file path' => drupal_get_path('module', 'tripal_core'),
- 'weight' => -100,
- );
-
- $items['admin/tripal/setup'] = array(
- 'title' => 'Setup Tripal',
- 'description' => t('Tools for setup of Tripal'),
- 'access arguments' => array('administer tripal'),
- 'weight' => -8
- );
- $items['admin/tripal/setup/chado_install'] = array(
- 'title' => 'Install Chado Schema',
- 'description' => t('Installs the Chado database tables, views, etc., inside the current Drupal database'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_chado_load_form'),
- 'access arguments' => array('install chado'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -10
- );
- $items['admin/tripal/setup/customize'] = array(
- 'title' => 'Customize Tripal',
- 'description' => t('Information on how to customize tripal'),
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_core_customize'),
- 'access arguments' => array('administer tripal'),
- 'weight' => 10
- );
-
- $items['admin/tripal/tripal_jobs'] = array(
- 'title' => 'Jobs',
- 'description' => t('Jobs managed by Tripal'),
- 'page callback' => 'tripal_jobs_admin_view',
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -10
- );
- $items['admin/tripal/tripal_jobs/help'] = array(
- 'title' => 'Help',
- 'description' => t('Help for the tripal job management system'),
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_core_job_help'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/tripal_jobs/cancel/%'] = array(
- 'title' => 'Jobs',
- 'description' => t('Cancel a pending job'),
- 'page callback' => 'tripal_cancel_job',
- 'page arguments' => array(4),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_jobs/rerun/%'] = array(
- 'title' => 'Jobs',
- 'description' => t('Re-run an existing job.'),
- 'page callback' => 'tripal_rerun_job',
- 'page arguments' => array(4),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_jobs/view/%'] = array(
- 'title' => 'Jobs Details',
- 'description' => t('View job details.'),
- 'page callback' => 'tripal_jobs_view',
- 'page arguments' => array(4),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_jobs/views/jobs/enable'] = array(
- 'title' => 'Enable Jobs Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_core_admin_jobs', 'admin/tripal/tripal_jobs'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/schema/mviews'] = array(
- 'title' => 'Materialized Views',
- 'description' => t('Materialized views are used to improve speed of large or complex queries.'),
- 'page callback' => 'tripal_mview_admin_view',
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -10
- );
- $items['admin/tripal/schema/mviews/help'] = array(
- 'title' => 'Help',
- 'description' => t('Help for the materialized views management system'),
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_core_mviews_help'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/schema/mviews/report/%'] = array(
- 'title' => 'Materialized View',
- 'description' => t('Materialized views are used to improve speed of large or complex queries. These are database views as compared to Drupal views.'),
- 'page callback' => 'tripal_mview_report',
- 'page arguments' => array(5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/mviews/new'] = array(
- 'title' => 'Create Materialized View',
- 'description' => t('Create a new materialized view.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_form'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/mviews/edit/%'] = array(
- 'title' => 'Edit Materialized View',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_form', 5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/mviews/update/%'] = array(
- 'title' => 'Create Materialized View',
- 'description' => t('Materialized views are used to improve speed of large or complex queries.'),
- 'page callback' => 'tripal_mviews_add_populate_job',
- 'page arguments' => array(5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/mviews/delete/%'] = array(
- 'title' => 'Create Materialized View',
- 'description' => t('Materialized views are used to improve speed of large or complex queries.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_delete_form', 5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
-
-
- $items['admin/tripal/schema/mviews/import'] = array(
- 'title' => 'Import MView',
- 'description' => 'Import a materialized view from another Tripal instance.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_import_form'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/mviews/%tblid/export'] = array(
- 'title' => 'Export MView',
- 'description' => 'Export a materialized view for use by another Tripal instance.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_mviews_export_form', 5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/schema/custom_tables'] = array(
- 'title' => 'Custom Tables',
- 'description' => t('Creation of custom tables that are added to Chado database.'),
- 'page callback' => 'tripal_custom_table_admin_view',
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => -10
- );
- $items['admin/tripal/schema/custom_tables/help'] = array(
- 'title' => 'Help',
- 'description' => t('Help for the tripal job management system'),
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_core_job_help'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
- $items['admin/tripal/schema/custom_tables/view/%'] = array(
- 'title' => 'Custom Tables',
- 'description' => t('Custom tables are added to Chado.'),
- 'page callback' => 'tripal_custom_table_view',
- 'page arguments' => array(5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/custom_tables/new'] = array(
- 'title' => 'Create Custom Table',
- 'description' => t('An interface for creating your own custom tables.'),
- 'page callback' => 'tripal_custom_table_new_page',
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/custom_tables/edit/%'] = array(
- 'title' => 'Edit Custom Table',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_custom_tables_form', 5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/custom_tables/delete/%'] = array(
- 'title' => 'Create Custom Table',
- 'description' => t('Custom tables are added to Chado.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_custom_tables_delete_form', 5),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/schema/custom_tables/views/tables/enable'] = array(
- 'title' => 'Enable Custom Tables Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_core_admin_custom_table', 'admin/tripal/schema/custom_tables'),
- 'access arguments' => array('administer tripal'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['tripal_ajax/relationship_nodeform/%/%/name_to_id'] = array(
- 'page callback' => 'chado_add_node_form_relationships_name_to_id_callback',
- 'page arguments' => array(2,3),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['node/%node/tripal_toc'] = array(
- 'title' => 'TOC',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_core_node_toc_form', 1),
- 'access callback' => 'tripal_core_access_node_toc_form',
- 'access arguments' => array(1),
- 'type' => MENU_LOCAL_TASK,
- 'file' => '/includes/tripal_core.toc.inc',
- );
-
- return $items;
- }
- function tripal_core_access_node_toc_form($node) {
- $types = module_invoke_all('node_info');
- if (array_key_exists($node->type, $types) and
- array_key_exists('chado_node_api', $types[$node->type])) {
- return user_access('administer tripal');
- }
- return FALSE;
- }
- function tripal_core_permission() {
- return array(
- 'install chado' => array(
- 'title' => t('Install Chado'),
- 'description' => t('Allow the user to install or upgrade a Chado database in the existing Drupal database.')
- ),
- 'administer tripal' => array(
- 'title' => t('Administer Tripal'),
- 'description' => t('Allow the user to access administrative pages of Tripal.')
- ),
- 'view dev helps' => array(
- 'title' => t('View Developer Hints'),
- 'description' => t('Tripal will provide blue shaded boxes that provide
- instructions for how to customize or setup specific pages on a
- site. This permission should be enabled for developers. But can
- be disabled once developers are accustomed to these hints.'),
- 'restrict access' => TRUE,
- ),
- 'view ids' => array(
- 'title' => t('View Internal IDs'),
- 'description' => t('On content pages Tripal will typically provide
- a table of information pulled from the Chado database but the
- primary key IDs for that data is typically not shown. The
- default Tripal templates can show the primary key ID inside of a
- blue shaded table row if this permission is enabled. This can
- be useful for site developers who might want these IDs when working
- with the underlying database.'),
- 'restrict access' => TRUE,
- )
- );
- }
- function tripal_core_theme($existing, $type, $theme, $path) {
- return array(
- 'tripal_core_customize' => array(
- 'arguments' => array('job_id' => NULL),
- 'template' => 'tripal_core_customize',
- 'path' => "$path/theme/templates"
- ),
- 'theme_file_upload_combo' => array(
- 'render element' => 'element',
- ),
- 'theme_sequence_combo' => array(
- 'render element' => 'element',
- ),
- 'tripal_core_jobs_help' => array(
- 'template' => 'tripal_core_jobs_help',
- 'variables' => array(NULL),
- 'path' => "$path/theme/templates"
- ),
- 'tripal_core_customtables_help' => array(
- 'template' => 'tripal_core_customtables_help',
- 'variables' => array(NULL),
- 'path' => "$path/theme/templates"
- ),
-
-
-
- 'chado_node_properties_form_table' => array(
- 'function' => 'theme_chado_add_node_form_properties',
- 'render element' => 'element',
- ),
-
- 'chado_node_additional_dbxrefs_form_table' => array(
- 'function' => 'theme_chado_add_node_form_dbxrefs_table',
- 'render element' => 'element',
- ),
-
- 'chado_node_relationships_form_table' => array(
- 'function' => 'theme_chado_add_node_form_relationships_table',
- 'render element' => 'element',
- ),
-
-
- 'tripal_admin_message' => array(
- 'function' => 'theme_tripal_admin_message',
- 'variables' => array('message' => NULL),
- ),
-
-
- 'tripal_node_toc_items_table' => array(
- 'render element' => 'element',
- ),
-
- 'tripal_core_extensions_form_tables' => array(
- 'render element' => 'element',
- )
- );
- }
- function tripal_core_job_describe_args($callback, $args) {
- $new_args = array();
- if ($callback == 'tripal_populate_mview') {
-
- $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
- $results = db_query($sql, array(':mview_id' => $args[0]));
- $mview = $results->fetchObject();
- $new_args['View Name'] = $mview->name;
- }
- elseif ($callback == 'tripal_core_install_chado') {
- $new_args['Action'] = $args[0];
- }
- 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);
- }
- function tripal_core_coder_ignore() {
- return array(
- 'path' => drupal_get_path('module', 'tripal_core'),
- 'line prefix' => drupal_get_path('module', 'tripal_core'),
- );
- }
- function tripal_core_views_api() {
- return array(
- 'api' => 3.0,
- );
- }
- function tripal_core_node_view_alter(&$build) {
- module_load_include('inc', 'tripal_core', 'includes/tripal_core.toc');
- tripal_core_node_view_build_toc($build);
- }
- function tripal_core_node_view($node, $view_mode, $langcode) {
-
-
-
- if (preg_match('/^chado_/', $node->type)) {
-
- if ($view_mode == 'full') {
- if (!isset($node->content['#tripal_generic_node_template'])) {
- $node->content['#tripal_generic_node_template'] = TRUE;
- }
- }
- }
- }
- function tripal_core_exclude_type_by_default() {
- return array('text' => 'strlen("<field_value> ") > 250');
- }
|