Browse Source

Removed old relationship aggregator table and code. We don't use it.

spficklin 12 years ago
parent
commit
0b674f6e64

+ 0 - 245
tripal_feature/includes/tripal_feature.admin.inc

@@ -589,249 +589,4 @@ function get_tripal_feature_admin_form_url_set(&$form) {
     '#weight' => 3,
   );
 }
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_page() {
-  $add_url = url("admin/tripal/tripal_feature/aggregate/new");
-  $output = "<a href=\"$add_url\">Add a new aggregator</a>";
-  $output .= drupal_get_form('tripal_feature_aggregator_select_form');
-  $output .= '<div id="db-edit-div">Please select an aggregator base type to view or edit</div>';
-  return $output;
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_select_form() {
-
-  // get a list of base terms from chado for user to choose
-  $sql = "SELECT DISTINCT type_id FROM {tripal_feature_relagg} ORDER BY type_id ";
-  $results = db_query($sql);
-
-  $sql = "SELECT * FROM {cvterm} WHERE cvterm_id = %d";
-  $types = array();
-  $types[] = '';
-  while ($base = db_fetch_object($results)) {
-    $term = db_fetch_object(chado_query($sql, $base->type_id));
-    $types[$base->type_id] = $term->name;
-  }
-
-  $form['type_id'] = array(
-    '#title' => t('Aggregator Base Type'),
-    '#type' => 'select',
-    '#options' => $types,
-    '#ahah' => array(
-      'path' => 'admin/tripal/tripal_feature/aggregate/edit/js',
-      'wrapper' => 'db-edit-div',
-      'effect' => 'fade',
-      'event' => 'change',
-      'method' => 'replace',
-    ),
-  );
-
-  return $form;
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_form(&$form_state = NULL, $type_id = NULL) {
-
-  // get this requested database
-  if ($type_id) {
-    $sql = "SELECT * FROM {tripal_feature_relagg} WHERE type_id = %d ";
-    $tsql = "SELECT * FROM {cvterm} WHERE cvterm_id = %d ";
-
-    // get the default list of terms
-    $results = db_query($sql, $type_id);
-    while ($type = db_fetch_object($results)) {
-      $term = db_fetch_object(chado_query($tsql, $type->rel_type_id));
-      $default_others .= $term->name . " ";
-    }
-    $default_base = $base->name;
-    $action = 'Update';
-    $form['type_id'] = array(
-       '#type' => 'hidden',
-       '#value' => $type_id
-    );
-  }
-  else {
-    $action = 'Add';
-    $form['base']= array(
-       '#type'          => 'textfield',
-       '#title'         => t('Base Feature type'),
-       '#description'   => t('Please enter the Sequence Ontology (SO) term for the base feature type for this aggregator.'),
-       '#default_value' => $default_base,
-       '#required'      => TRUE,
-       '#weight'        => 1
-    );
-  }
-
-  $form['others']= array(
-    '#type'          => 'textarea',
-    '#title'         => t('Aggregate these types if a relationship exists'),
-    '#description'   => t('Please enter the Sequence Ontology (SO) terms that should be aggregated with the base feature type listed above.  Separate each by a space or newline'),
-    '#default_value' => $default_others,
-    '#required'      => TRUE,
-    '#weight'        => 2
-  );
-
-  if (strcmp($action, 'Update')==0) {
-    $form['update'] = array(
-      '#type'         => 'submit',
-      '#value'        => t('Update'),
-      '#weight'       => 5,
-      '#executes_submit_callback' => TRUE,
-    );
-    $form['delete'] = array(
-      '#type'         => 'submit',
-      '#value'        => t('Delete'),
-      '#weight'       => 6,
-      '#executes_submit_callback' => TRUE,
-    );
-  }
-  else {
-    $form['add'] = array(
-      '#type'         => 'submit',
-      '#value'        => t('Add'),
-      '#weight'       => 5,
-      '#executes_submit_callback' => TRUE,
-    );
-  }
-  $form['#redirect'] = 'admin/tripal/tripal_feature/aggregate';
 
-
-  return $form;
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_form_validate($form, &$form_state) {
-  $type_id  = $form_state['values']['type_id'];
-  $base     = $form_state['values']['base'];
-  $others   = $form_state['values']['others'];
-  $op      =  $form_state['values']['op'];
-
-  // split apart the feature types to be aggregated
-  $types = preg_split('/\s+/', $others);
-
-  // the SQL for finding the term
-  $tsql = "
-    SELECT *
-    FROM {cvterm} CVT
-       INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id
-    WHERE CVT.name = '%s' and CV.name = 'sequence'";
-
-
-  // make sure the base type exists
-  if ($base) {
-    $term = db_fetch_object(chado_query($tsql, $base));
-    if (!$term) {
-      form_set_error('base', t('The specified base type is not a valid SO term'));
-    }
-
-    // make sure this type doesn't already in the table
-    $sql = "SELECT * FROM {tripal_feature_relagg} WHERE type_id = %d ";
-    $agg = db_fetch_object(db_query($sql, $term->cvterm_id));
-    if ($agg) {
-      form_set_error('base', t('The specified base type is already used as a base type for another aggregator and cannot be readded.'));
-    }
-  }
-
-  // iterate through each type to be aggregated and make sure they are valid
-  foreach ($types as $type) {
-    $term = db_fetch_object(chado_query($tsql, $type));
-    if (!$term) {
-      form_set_error('others', t('The specified type %type is not a valid SO term', array('%type' => $type)));
-    }
-  }
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_form_submit($form, &$form_state) {
-
-  $type_id  = $form_state['values']['type_id'];
-  $base     = $form_state['values']['base'];
-  $others   = $form_state['values']['others'];
-  $op      =  $form_state['values']['op'];
-
-  // split apart the feature types to be aggregated
-  $types = preg_split('/\s+/', $others);
-
-  // the SQL for finding the term
-  $tsql = "
-    SELECT *
-    FROM {cvterm} CVT
-       INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id
-    WHERE CVT.name = '%s' and CV.name = 'sequence'";
-
-  // the SQL for deleting an aggregator
-  $dsql = "
-    DELETE FROM {tripal_feature_relagg}
-    WHERE type_id = %d
-  ";
-
-  // if this is an insert then we have a base type name.  We
-  // need to get the corresponding term id
-  if ($base) {
-    $term = db_fetch_object(chado_query($tsql, $base));
-    $type_id = $term->cvterm_id;
-  }
-
-  if (strcmp($op, 'Delete')==0) {
-    $result = db_query($dsql, $type_id);
-    if ($result) {
-      drupal_set_message(t("Aggregator deleted"));
-    }
-    else {
-      drupal_set_message(t("Failed to delete mailing list."));
-    }
-  }
-  else {
-    // for an update, first remove all the current aggregator settings
-    // and we'll add them again
-    $result = db_query($dsql, $type_id);
-
-    // the SQL for inserting the aggregated types
-    $isql = "
-       INSERT INTO {tripal_feature_relagg}
-        (type_id,rel_type_id)
-       VALUES
-        (%d,%d)
-    ";
-
-    // iterate through each type to be aggregated and add an entry in the table
-    foreach ($types as $type) {
-      $term = db_fetch_object(chado_query($tsql, $type));
-      $result = db_query($isql, $type_id, $term->cvterm_id);
-    }
-    drupal_set_message(t("Aggregator added"));
-  }
-  return '';
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_aggregator_ajax_edit() {
-  // get the database id, build the form and then return the JSON object
-  $type_id = filter_xss($_POST['type_id']);
-  $form = drupal_get_form('tripal_feature_aggregator_form', $type_id);
-  drupal_json(array('status' => TRUE, 'data' => $form));
-}

+ 0 - 11
tripal_feature/tripal_feature.install

@@ -162,17 +162,6 @@ function tripal_feature_get_schemas($table = NULL) {
       'primary key' => array('nid'),
     );
   }
-  if (!$table or strcmp($table, 'tripal_feature_relagg')==0) {
-    $schema['tripal_feature_relagg'] = array(
-      'fields' => array(
-        'type_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-        'rel_type_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      ),
-      'indexes' => array(
-        'type_id' => array('type_id')
-      ),
-    );
-  }
   return $schema;
 };
 

+ 1 - 44
tripal_feature/tripal_feature.module

@@ -265,30 +265,7 @@ function tripal_feature_menu() {
     'access arguments' => array('edit chado_feature content'),
     'type' => MENU_LOCAL_TASK,
     'weight' => 10,
-  );
-
-  // managing relationship aggregates
-  $items['admin/tripal/tripal_feature/aggregate'] = array(
-     'title' => 'Feature Relationship Aggegators',
-     'description' => 'Features have relationships with other features and it may be desirable to aggregate the content from one ore more child or parent feature.',
-     'page callback' => 'tripal_feature_aggregator_page',
-     'access arguments' => array('manage chado_feature aggregator'),
-     'type' => MENU_NORMAL_ITEM,
-  );
-
-  $items['admin/tripal/tripal_feature/aggregate/new'] = array(
-     'title' => 'Add an Aggregator',
-     'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_feature_aggregator_form'),
-     'access arguments' => array('manage chado_feature aggregator'),
-     'type' => MENU_NORMAL_ITEM,
-  );
-  $items['admin/tripal/tripal_feature/aggregate/edit/js'] = array(
-     'title' => 'Edit an Aggegator',
-     'page callback' => 'tripal_feature_aggregator_ajax_edit',
-     'access arguments' => array('manage chado_feature aggregator'),
-     'type' => MENU_CALLBACK,
-  );
+  ); 
 
   // the menu link for addressing any feature (by name, uniquename, synonym)
   $items['feature/%'] = array(
@@ -1166,26 +1143,6 @@ function tripal_feature_load_relationships($feature_id, $side = 'as_subject') {
   }
   return $relationships;
 }
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_get_aggregate_types($feature_id) {
-  // get the feature details
-  $sql = 'SELECT type_id FROM {feature} WHERE feature_id = %d';
-  $feature = db_fetch_object(chado_query($sql, $feature_id));
-
-  // check to see if this feature is of a type with an aggregate
-  $sql = "SELECT * FROM {tripal_feature_relagg} WHERE type_id = %d";
-  $types = array();
-  $results = db_query($sql, $feature->type_id);
-  while ($agg = db_fetch_object($results)) {
-    $types[] = $agg->rel_type_id;
-  }
-
-  return $types;
-}
 /**
  *
  *