Tripal v1.0 (6.x-1.0)
|
00001 <?php 00002 00003 require_once "includes/charts.inc"; 00004 require_once "includes/trees.inc"; 00005 require_once "includes/obo_loader.inc"; 00006 require_once "includes/tripal_cv_admin.inc"; 00007 require_once "api/tripal_cv.api.inc"; 00008 00020 function tripal_cv_init() { 00021 00022 // add the tripal_cv JS and CSS 00023 drupal_add_css(drupal_get_path('theme', 'tripal') . '/css/tripal_cv.css'); 00024 drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_cv.js'); 00025 00026 // add the jgCharts.js 00027 drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jgcharts/jgcharts.js'); 00028 00029 // add the jsTree JS and CSS 00030 drupal_add_css(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/tree_component.css'); 00031 drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/_lib.js'); 00032 drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/jsTree/source/tree_component.js'); 00033 } 00034 00041 function tripal_cv_menu() { 00042 $items = array(); 00043 00044 $items['admin/tripal/tripal_cv'] = array( 00045 'title' => 'Vocabularies', 00046 'description' => 'Basic Description of Tripal CV Module Functionality', 00047 'page callback' => 'theme', 00048 'page arguments' => array('tripal_cv_admin'), 00049 'access arguments' => array('administer controlled vocabularies'), 00050 'type' => MENU_NORMAL_ITEM, 00051 ); 00052 00053 $items['admin/tripal/tripal_cv/obo_loader'] = array( 00054 'title' => 'Load Ontology', 00055 'page callback' => 'drupal_get_form', 00056 'page arguments' => array('tripal_cv_obo_form'), 00057 'access arguments' => array('administer controlled vocabularies'), 00058 'type' => MENU_NORMAL_ITEM, 00059 ); 00060 00061 $items['admin/tripal/tripal_cv/cvtermpath'] = array( 00062 'title' => 'Update Chado cvtermpath table', 00063 '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', 00064 'page callback' => 'drupal_get_form', 00065 'page arguments' => array('tripal_cv_cvtermpath_form'), 00066 'access arguments' => array('administer controlled vocabularies'), 00067 'type' => MENU_NORMAL_ITEM, 00068 ); 00069 00070 /* 00071 * Menu items for adding and editing CVs 00072 */ 00073 $items['admin/tripal/tripal_cv/cv/add'] = array( 00074 'title' => 'Add a Vocabulary', 00075 'page callback' => 'drupal_get_form', 00076 'page arguments' => array('tripal_cv_add_form'), 00077 'access arguments' => array('administer controlled vocabularies'), 00078 'type' => MENU_NORMAL_ITEM, 00079 ); 00080 00081 $items['admin/tripal/tripal_cv/cv/edit'] = array( 00082 'title' => 'Edit a Vocabulary', 00083 'description' => 'Edit a controlled vocabularies/ontolgoies in Chado ', 00084 'page callback' => 'tripal_cv_edit_page', 00085 'access arguments' => array('administer controlled vocabularies'), 00086 'type' => MENU_NORMAL_ITEM, 00087 ); 00088 00089 $items['admin/tripal/tripal_cv/cv/edit/js'] = array( 00090 'page callback' => 'tripal_ajax_cv_edit', 00091 'access arguments' => array('administer controlled vocabularies'), 00092 'type' => MENU_CALLBACK, 00093 ); 00094 00095 /* 00096 * Menu items for adding and editing CV terms 00097 */ 00098 $items['admin/tripal/tripal_cv/cvterm/add'] = array( 00099 'title' => 'Add a Term', 00100 'description' => 'Manage controlled vocabulary/ontology terms in Chado ', 00101 'page callback' => 'drupal_get_form', 00102 'page arguments' => array('tripal_cv_cvterm_form', 'add'), 00103 'access arguments' => array('administer controlled vocabularies'), 00104 'type' => MENU_NORMAL_ITEM, 00105 ); 00106 00107 $items['admin/tripal/tripal_cv/cvterm/ahah'] = array( 00108 'page callback' => 'tripal_cv_cvterm_callback', 00109 'access arguments' => array('administer controlled vocabularies'), 00110 'type' => MENU_CALLBACK, 00111 ); 00112 $items['admin/tripal/tripal_cv/cvterm/auto_name/%/%'] = array( 00113 'page callback' => 'tripal_cv_cvterm_name_autocomplete', 00114 'page arguments' => array(5, 6), 00115 'access arguments' => array('administer controlled vocabularies'), 00116 'type' => MENU_CALLBACK, 00117 ); 00118 00119 $items['admin/tripal/tripal_cv/cvterm/edit'] = array( 00120 'title' => 'Edit a Term', 00121 'description' => 'Edit an existing controlled vocabulary/ontology terms in Chado ', 00122 'page callback' => 'drupal_get_form', 00123 'page arguments' => array('tripal_cv_cvterm_form', 'edit'), 00124 'access arguments' => array('administer controlled vocabularies'), 00125 'type' => MENU_NORMAL_ITEM, 00126 ); 00127 00128 /* 00129 * Charts 00130 */ 00131 $items['tripal_cv_chart'] = array( 00132 'path' => 'tripal_cv_chart', 00133 'page callback' => 'tripal_cv_chart', 00134 'page arguments' => array(1), 00135 'access arguments' => array('access content'), 00136 'type' => MENU_CALLBACK 00137 ); 00138 00139 00140 /* 00141 * Menu items for working with CV Trees 00142 */ 00143 $items['cv_browser'] = array( 00144 'page callback' => 'tripal_cv_show_browser', 00145 'access arguments' => array('access content'), 00146 'type' => MENU_CALLBACK 00147 ); 00148 00149 $items['tripal_cv_tree'] = array( 00150 'path' => 'tripal_cv_tree', 00151 'page callback' => 'tripal_cv_tree', 00152 'page arguments' => array(1), 00153 'access arguments' => array('access content'), 00154 'type' => MENU_CALLBACK 00155 ); 00156 00157 $items['tripal_cv_init_browser'] = array( 00158 'path' => 'tripal_cv_init_browser', 00159 'page callback' => 'tripal_cv_init_browser', 00160 'page arguments' => array(1), 00161 'access arguments' => array('access content'), 00162 'type' => MENU_CALLBACK 00163 ); 00164 00165 // menu item for interaction with the tree 00166 $items['tripal_cv_update_tree'] = array( 00167 'path' => 'tripal_cv_update_tree', 00168 'page callback' => 'tripal_cv_update_tree', 00169 'page arguments' => array(2, 3), 00170 'access arguments' => array('access content'), 00171 'type' => MENU_CALLBACK 00172 ); 00173 00174 // menu items for working with terms 00175 $items['tripal_cv_cvterm_info'] = array( 00176 'path' => 'tripal_cv_cvterm_info', 00177 'title' => 'CV Term Viewer', 00178 'page callback' => 'tripal_cv_cvterm_info', 00179 'page arguments' => array(1), 00180 'access arguments' => array('access content'), 00181 'type' => MENU_CALLBACK 00182 ); 00183 00184 return $items; 00185 } 00186 00194 function tripal_cv_perm() { 00195 return array( 00196 'administer controlled vocabularies', 00197 ); 00198 } 00199 00208 function tripal_cv_views_api() { 00209 return array('api' => 2.0); 00210 } 00211 00216 function tripal_cv_coder_ignore() { 00217 return array( 00218 'path' => drupal_get_path('module', 'tripal_cv'), 00219 'line prefix' => drupal_get_path('module', 'tripal_cv'), 00220 ); 00221 } 00222 00223 /* 00224 * 00225 */ 00226 function tripal_cv_form_alter(&$form, &$form_state, $form_id) { 00227 if ($form_id == "tripal_cv_cvterm_form") { 00228 // updating the form through the ahah callback sets the action of 00229 // the form to the ahah callback URL. We need to set it back 00230 // to the normal form URL 00231 if ($form_state['values']['form_action'] == 'edit') { 00232 $form['#action'] = url("admin/tripal/tripal_cv/cvterm/edit"); 00233 } 00234 else { 00235 $form['#action'] = url("admin/tripal/tripal_cv/cvterm/add"); 00236 } 00237 } 00238 } 00239 00247 function tripal_cv_theme() { 00248 return array( 00249 'tripal_cv_admin' => array( 00250 'template' => 'tripal_cv_admin', 00251 'arguments' => array(NULL), 00252 'path' => drupal_get_path('module', 'tripal_cv') . '/theme', 00253 ), 00254 ); 00255 }