123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <?php
- require_once "includes/charts.inc";
- require_once "includes/trees.inc";
- require_once "includes/obo_loader.inc";
- require_once "includes/tripal_cv_admin.inc";
- require_once "api/tripal_cv.api.inc";
- /**
- * @defgroup tripal_cv CV Module
- * @ingroup tripal_modules
- */
- /**
- * Implements hook_init().
- * Adds CSS and JS needed for this modules rendered content
- *
- * @ingroup tripal_cv
- */
- function tripal_cv_init() {
- // add the tripal_cv JS and CSS
- drupal_add_css(drupal_get_path('theme', 'tripal') . '/css/tripal_cv.css');
- drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_cv.js');
-
- // add the jgCharts.js
- drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jgcharts/jgcharts.js');
- // add the jsTree JS and CSS
- drupal_add_css(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/tree_component.css');
- drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/_lib.js');
- drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/tree_component.js');
- }
- /**
- * Implements hook_menu().
- * Registers all menu items associated with this module
- *
- * @ingroup tripal_cv
- */
- function tripal_cv_menu() {
- $items = array();
- $items['admin/tripal/tripal_cv'] = array(
- 'title' => 'Vocabularies',
- 'description' => 'Basic Description of Tripal CV Module Functionality',
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_cv_admin'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/tripal_cv/obo_loader'] = array(
- 'title' => 'Load Ontology',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_obo_form'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/tripal_cv/cvtermpath'] = array(
- 'title' => 'Update Chado cvtermpath table',
- 'description' => 'The Chado cvtermpath table provides lineage for terms and is useful for quickly finding any ancestor parent of a term. However, this table must be populated. This page allows for populating of this table one vocabulary at a time',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvtermpath_form'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
- /*
- * Menu items for adding and editing CVs
- */
- $items['admin/tripal/tripal_cv/cv/add'] = array(
- 'title' => 'Add a Vocabulary',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_add_form'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/tripal_cv/cv/edit'] = array(
- 'title' => 'Edit a Vocabulary',
- 'description' => 'Edit a controlled vocabularies/ontolgoies in Chado ',
- 'page callback' => 'tripal_cv_edit_page',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/tripal_cv/cv/edit/js'] = array(
- 'page callback' => 'tripal_ajax_cv_edit',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- /*
- * Menu items for adding and editing CV terms
- */
- $items['admin/tripal/tripal_cv/cvterm/add'] = array(
- 'title' => 'Add a Term',
- 'description' => 'Manage controlled vocabulary/ontology terms in Chado ',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvterm_form', 'add'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/tripal/tripal_cv/cvterm/ahah'] = array(
- 'page callback' => 'tripal_cv_cvterm_callback',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/tripal_cv/cvterm/auto_name/%/%'] = array(
- 'page callback' => 'tripal_cv_cvterm_name_autocomplete',
- 'page arguments' => array(5, 6),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/tripal_cv/cvterm/edit'] = array(
- 'title' => 'Edit a Term',
- 'description' => 'Edit an existing controlled vocabulary/ontology terms in Chado ',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvterm_form', 'edit'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- /*
- * Charts
- */
- $items['tripal_cv_chart'] = array(
- 'path' => 'tripal_cv_chart',
- 'page callback' => 'tripal_cv_chart',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
- /*
- * Menu items for working with CV Trees
- */
- $items['cv_browser'] = array(
- 'page callback' => 'tripal_cv_show_browser',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['tripal_cv_tree'] = array(
- 'path' => 'tripal_cv_tree',
- 'page callback' => 'tripal_cv_tree',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['tripal_cv_init_browser'] = array(
- 'path' => 'tripal_cv_init_browser',
- 'page callback' => 'tripal_cv_init_browser',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
- // menu item for interaction with the tree
- $items['tripal_cv_update_tree'] = array(
- 'path' => 'tripal_cv_update_tree',
- 'page callback' => 'tripal_cv_update_tree',
- 'page arguments' => array(2, 3),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
- // menu items for working with terms
- $items['tripal_cv_cvterm_info'] = array(
- 'path' => 'tripal_cv_cvterm_info',
- 'title' => 'CV Term Viewer',
- 'page callback' => 'tripal_cv_cvterm_info',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- '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_cv
- */
- function tripal_cv_perm() {
- return array(
- 'administer controlled vocabularies',
- );
- }
- /**
- * Implements hook_views_api()
- * Purpose: Essentially this hook tells drupal that there is views support for
- * for this module which then includes tripal_cv.views.inc where all the
- * views integration code is
- *
- * @ingroup tripal_cv
- */
- function tripal_cv_views_api() {
- return array('api' => 2.0);
- }
- /**
- * Implements hook_coder_ignore().
- * Defines the path to the file (tripal_cv.coder_ignores.txt) where ignore rules for coder are stored
- */
- function tripal_cv_coder_ignore() {
- return array(
- 'path' => drupal_get_path('module', 'tripal_cv'),
- 'line prefix' => drupal_get_path('module', 'tripal_cv'),
- );
- }
- /*
- *
- */
- function tripal_cv_form_alter(&$form, &$form_state, $form_id) {
- if ($form_id == "tripal_cv_cvterm_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'] == 'edit') {
- $form['#action'] = url("admin/tripal/tripal_cv/cvterm/edit");
- }
- else {
- $form['#action'] = url("admin/tripal/tripal_cv/cvterm/add");
- }
- }
- }
- /**
- * 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_cv_theme() {
- return array(
- 'tripal_cv_admin' => array(
- 'template' => 'tripal_cv_admin',
- 'arguments' => array(NULL),
- 'path' => drupal_get_path('module', 'tripal_cv') . '/theme',
- ),
- );
- }
|