Browse Source

Remove Tripal Example module

Stephen Ficklin 8 years ago
parent
commit
717c75c73e
24 changed files with 151 additions and 2712 deletions
  1. 0 110
      legacy/tripal_example/README.txt
  2. 0 35
      legacy/tripal_example/api/tripal_example.api.inc
  3. 0 96
      legacy/tripal_example/includes/tripal_example.admin.inc
  4. 0 880
      legacy/tripal_example/includes/tripal_example.chado_node.inc
  5. 0 0
      legacy/tripal_example/theme/css/tripal_example.css
  6. 0 9
      legacy/tripal_example/theme/js/tripal_example.js
  7. 0 85
      legacy/tripal_example/theme/templates/tripal_example_base.tpl.php
  8. 0 8
      legacy/tripal_example/theme/templates/tripal_example_help.tpl.php
  9. 0 70
      legacy/tripal_example/theme/templates/tripal_example_properties.tpl.php
  10. 0 70
      legacy/tripal_example/theme/templates/tripal_example_references.tpl.php
  11. 0 151
      legacy/tripal_example/theme/templates/tripal_example_relationships.tpl.php
  12. 0 14
      legacy/tripal_example/theme/templates/tripal_example_teaser.tpl.php
  13. 0 113
      legacy/tripal_example/theme/tripal_example.theme.inc
  14. 0 50
      legacy/tripal_example/tripal_example.info
  15. 0 608
      legacy/tripal_example/tripal_example.install
  16. 0 365
      legacy/tripal_example/tripal_example.module
  17. 0 9
      legacy/tripal_example/tripal_example.views.inc
  18. 0 25
      legacy/tripal_example/tripal_example.views_default.inc
  19. 3 14
      tripal/api/tripal.entities.api.inc
  20. 14 0
      tripal/tripal.module
  21. 49 0
      tripal_ws/includes/TripalContentTypeService.inc
  22. 0 0
      tripal_ws/includes/TripalVocabService.inc
  23. 66 0
      tripal_ws/includes/TripalWebService.inc
  24. 19 0
      tripal_ws/includes/TripalWebServiceProvider.inc

+ 0 - 110
legacy/tripal_example/README.txt

@@ -1,110 +0,0 @@
-This module is provided as a template for creating a custom Tripal Extension
-Module for Drupal 7 and Tripal 2.x.
-
-Drupal does provide quite a bit of documentation on its website at
-http://www.drupal.org but the easiest way to learn to program a Drupal module
-is to purchase the following book:
-
-  Tomlinson, VanDyk.  Pro Drupal Development. 2010. ISBN-13: 978-1430228387
-
-But this quick link can help get you started:
-
-  https://drupal.org/developing/modules/7
-
-Briefly, to create a Drupal module you must
-
-1) Create a directory to house all of your module's files
-2) Create a .info inside of the directory which provides information about your
-   module to Drupal
-3) Create a .module file which contains the functions used by your module
-4) Create a .install file which contains the functions used for installation,
-   enabling, disabling and uninstallation of your module.
-
-Examine the example functions and documentation in each of the files in this
-example module to learn how Tripal uses the Drupal API.
-
--------------------------
-DIRECTORY AND FILE NAMING
--------------------------
-When creating your Tripal Extension module, the following directory structure
-and file naming is suggested:
-
-For the required files:
-[module dir]/[module name].info
-[module dir]/[module name].module
-[module dir]/[module name].install
-
-If you want to include Drush commands for your module
-[module dir]/[module name].drush.inc
-
-If you want to integrate with Drupal Views 3.x:
-[module dir]/[module name].views.inc
-[module dir]/[module name].views_default.inc
-
-
-Include Files
--------------
-To limit the size of files, some functionality can be placed inside of
-"include" files. Include files are placed inside of an 'includes' directory.
-[module dir]/includes
-
-If your module creates a node type that uses data housed in Chado, you should
-place all of the Drupal hooks for nodes inside of an include named:
-[module dir]/includes/[module name].chado_node.inc
-
-If your module has an administrative interface, all of the functions related to
-administration should go in an include file named:
-[module dir]/includes/[module name].admin.inc
-
-All other include files should be named in the following way:
-[module dir]/includes/[module name].[function].inc
-
-where [function] is a brief description of the functionality provided by the
-include file. Please only use underscores inside of the [function] (no dashes
-or periods).
-
-
-Theme Files
--------------
-Tripal primarily uses template files for displaying content from Chado. This
-allows anyone to easily change the way data is displayed without needing to
-delve into the module's source code. A template typically provides data for
-a single data type (e.g. feature) or association (e.g. properties associated to
-features, or publications associated with featurmaps, etc.). These template
-files and any JavaScript, CSS or images needed to support them are all
-housed inside of a 'theme' directory with the following structure:
-[module dir]/theme
-[module dir]/theme/css       (for CSS files)
-[module dir]/theme/js        (for JS files)
-[module dir]/theme/images    (for images)
-[module dir]/theme/templates (for all Drupal template files)
-
-All Drupal hooks and functions related to theming of content should go in the
-file named:
-[module dir]/theme/[module name].theme.inc
-
-The functions in that file will typically be functions which directly
-generate content for a page or "preprocess" hooks that prepare variables that
-are passed to templates.
-
-Template files are named in the following way
-[module dir]/theme/templates/[module name]_[function].tpl.php.
-
-Notice that templates have an underscore separating the [module name] from the
-[function]. Typically a period is used (as with include files) but for
-backwards compatibility the underscores are kept.
-
-API Files
----------
-If your module will provide a set of functions that can be used as an
-Application Programming Interface (API), then those functions should be placed
-in files housed in the 'api' directory:
-[module dir]/api
-
-When creating API functions try to organize them into groups of related function
-and separate them into files by function with the following naming:
-[module dir]/api/[module name].[function].api.inc
-
-
-
-

+ 0 - 35
legacy/tripal_example/api/tripal_example.api.inc

@@ -1,35 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides an application programming interface (API) for working the example
- * module
- */
-
-/**
- * @defgroup tripal_example_api Example API
- * @ingroup tripal_api
- * @{
- * Provides an application programming interface (API) for working with features
- * @}
- */
-
-// EXPLANATION: This file is used for housing any API function that your module
-// creates. It is suggested you follow the naming style for Tripal API
-// functions. Below are naming rules for Tripal API functions:
-//
-// 1) Prefix the function with 'chado_' for all insert, updates, delete or get
-//    function on a table in the chado schema. Tripal should provide all of
-//    these functions for tables that come with Chado. But, you can use this
-//    prefix for API functions on custom tables that your module may add.
-// 2) For all other functions prefix the function with your module name. So
-//    for this example module the prefix would be 'tripal_example_'
-// 3) A 'verb' should follow the function prefix indicating the action that
-//    the function performs. Commonly used verbs are 'get', 'insert', 'update'
-//    'associate', 'execute', etc. An exception is for functions that
-//    test state rather than perform an action (e.g. does something exist).
-//    For functions that test state use 'does' instead of a verb
-//    (e.g. tripal_example_does_pub_exist)
-// 4) Follow the verb with a short predicate describing what is being acted
-//    upon.
-//

+ 0 - 96
legacy/tripal_example/includes/tripal_example.admin.inc

@@ -1,96 +0,0 @@
-<?php
-/**
- * @file
- * This file contains the functions used for administration of the module
- *
- */
-
-function tripal_example_admin_examples_listing() {
-  $output = '';
-
-  // set the breadcrumb
-  $breadcrumb = array();
-  $breadcrumb[] = l('Home', '<front>');
-  $breadcrumb[] = l('Administration', 'admin');
-  $breadcrumb[] = l('Tripal', 'admin/tripal');
-  $breadcrumb[] = l('Chado', 'admin/tripal/legacy');
-  $breadcrumb[] = l('Examples', 'admin/tripal/legacy/tripal_example');
-  drupal_set_breadcrumb($breadcrumb);
-
-
-  // EXPLANATION:  Typically for all Tripal modules the home administrative page
-  // for the module contains a search form to help the adminstrator locate
-  // records. The following example code adds a default View to the page
-  /*
-  // Add the view
-  $view = views_embed_view('tripal_example_admin_examples','default');
-  if (isset($view)) {
-    $output .= $view;
-  }
-  else {
-    $output .= '<p>The Tripal Example Module uses primarily views to provide an '
-      . 'administrative interface. Currently one or more views needed for this '
-      . 'administrative interface are disabled. <strong>Click each of the following links to '
-      . 'enable the pertinent views</strong>:</p>';
-    $output .= '<ul>';
-      $output .= '<li>'.l('Example Admin', 'admin/tripal/legacy/tripal_example/views/examples/enable').'</li>';
-    $output .= '</ul>';
-  }
-  */
-  $output = 'Typically a search view goes here';
-
-  return $output;
-}
-
-/**
- * Administrative settings form
- *
- * @ingroup tripal_example
- */
-function tripal_example_admin() {
-  $form = array();
-
-  $form['nothing'] = array(
-    '#markup' => t('There are currently no settings to configure.')
-  );
-
-  // If your module is using the Chado Node: Title & Path API to allow custom
-  // titles for your node type then you need to add the configuration form for
-  // this functionality. To do so, we first have to preapre a $details array
-  // the describe our node type.  Then we call the function to create the form
-  // elements.
-  $details = array(
-      // the name of the MODULE implementing the content type
-    'module' => 'tripal_example',
-    'content_type' => 'chado_example',
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable
-      // option
-    'options' => array(
-      '[example.name]' => 'Germplasm Name Only',
-      '[example.uniquename]' => 'Germplasm Unique Name Only',
-        // there should always be one options matching the unique constraint.
-        // If you have a more human-readable constraint, then that is
-        // preferable.
-        // See the tripal feature module for a good example of this.
-      '[example.example_id]' => 'Unique Constraint: The Chado ID for Examples'
-    ),
-    // the token indicating the unique constraint in the options array
-    'unique_option' => '[example.example_id]'
-  );
-  // This call adds the configuration form to your current form
-  // This sub-form handles it's own validation & submit
-  chado_add_admin_form_set_title($form, $form_state, $details);
-
-  return system_settings_form($form);
-}
-
-
-
-/**
- *
- * @ingroup tripal_example
- */
-function tripal_example_admin_validate($form, &$form_state) {
-
-}

+ 0 - 880
legacy/tripal_example/includes/tripal_example.chado_node.inc

@@ -1,880 +0,0 @@
-<?php
-
-/**
- * @file
- * This file should contain all Drupal hooks for interacting with nodes.
- *
- */
-
-/**
- *  Implementation of hook_node_info().
- *
- *  This hook provides information to Drupal about any node types that are being
- *  created by this module. If your module does not create any node types then
- *  this function is not required.
- *
- * @ingroup tripal_example
- */
-function tripal_example_node_info() {
-  $nodes = array();
-
-  // EXPLANATION: this array describes all of the node types that are created
-  // by this module. For many Tripal modules (e.g. tripal_example, tripal_stock,
-  // tripal_library, tripal_pub, etc.) new node types are created. It is
-  // customary to name all new node types that interact with data in Chado
-  // with a 'chado_' prefix.
-
-  $nodes['chado_example'] = array(
-    'name'        => t('Example'),
-    'base'        => 'chado_example',
-    'description' => t('A record from the fake chado example table'),
-    'has_title'   => TRUE,
-    'locked'      => TRUE,
-    // EXPLANATION: This section of the node type array specifies how Tripal
-    // will sync the node types with data in Chado. When Drupal creates a node
-    // it has no way of coordinating which node belongs to which record in
-    // Chado. Therefore, Tripal maintains tables in the Drupal schema that maps
-    // Drupal nodes to records in Chado. Syncing is the process of creating
-    // Drupal nodes and linking them to the appropriate record.
-    'chado_node_api' => array(
-      // the base table name (e.g. example, example, contact)
-      'base_table' => 'example',
-      // the node type hook prefix
-      'hook_prefix' => 'chado_example',
-      'record_type_title' => array(
-        // how to refer to the record
-        'singular' => t('Example'),
-        // how to refer to the record in plurals
-        'plural' => t('Examples')
-      ),
-      'sync_filters' => array(
-        'type_id' => TRUE,     // if the record has a type_id set to TRUE
-        'organism_id' => TRUE  // if the record has an organism_id set to TRUE
-      ),
-    )
-  );
-
-  return $nodes;
-}
-
-/**
- * Implement hook_access(). This hook provides instructions to Drupal for which
- * users can access the custom content types created in the function above. The
- * available permissions are set in the chado_example_permissions() hook in the
- * tripal_example.module file. This hook is not needed if no node types were
- * defined in the hook_node_info() hook.
- *
- * @return
- * This function should return null if it does not specifically deny access.
- * This allows for other mechanisms to to deny or reject access. If the return
- * value is TRUE then access is granted regardless of any other rules that might
- * be implemented by other modules.
- */
-function tripal_example_node_access($node, $op, $account) {
-  $node_type = $node;
-  if (is_object($node)) {
-    $node_type = $node->type;
-  }
-  // EXPLANATION:  in the tripal_example_permissions() function we created the
-  // permission types that are used here to check for access permissions to the
-  // 'chado_exmaple' node type.
-  if($node_type == 'chado_example') {
-    if ($op == 'create') {
-      if (!user_access('create chado_example content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-      return NODE_ACCESS_ALLOW;
-    }
-    if ($op == 'update') {
-      if (!user_access('edit chado_example content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-    if ($op == 'delete') {
-      if (!user_access('delete chado_example content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-    if ($op == 'view') {
-      if (!user_access('access chado_example content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-  }
-  return NODE_ACCESS_IGNORE;
-}
-
-/**
- * Implementation of hook_form()
- *
- * Creates the form for editing or inserting a record
- *
- * @ingroup tripal_example
- */
-function chado_example_form($node, &$form_state) {
-
-  // EXPLANATION: This function should construct a form array that is used by
-  // Drupal to construct a form for inserting or editing our new node type.
-  // See this page for information about the Form API:
-  // https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7
-  //
-  // The code below is laid out in the following order
-  // 1) Set default values
-  // 2) Add form elements used by this node type
-  // 3) Use the Tripal API to add form elements for properties,
-  //    dbxref's and relationships
-  //
-  // For the example code below we assume that the fake 'example' table only has
-  // a uniquename, organism_id, type_id and example_id.
-
-  $form = array();
-
-  // Default values can come in the following ways:
-  //
-  // 1) as elements of the $node object. This occurs when editing an existing
-  //    example
-  // 2) in the $form_state['values'] array which occurs on a failed validation
-  //    or ajax callbacks from non submit form elements
-  // 3) in the $form_state['input'[ array which occurs on ajax callbacks from
-  //    submit form elements and the form is being rebuilt
-  //
-  // set form field defaults
-
-
-  // SET FORM DEFAULTS
-  //---------------------------------------------
-  $example      = null; // holds the example object record
-  $example_id   = null; // when editing an example record we'll have an example_id
-
-  // initialize the defaults for the form fields
-  $uniquename   = '';
-  $example_type = '';
-  $organism_id  = '';
-  $description  = '';
-
-  // if we are editing an existing node then the 'example' record from Chado
-  // is already part of the node, so we set the defaults from that object
-  if (property_exists($node, 'example')) {
-    $example = $node->example;
-    $example_id   = $example->example_id;
-    $uniquename   = $example->uniquename;
-    $description  = $example->description;
-    $organism_id  = $example->organism_id;
-
-    // keep track of the example id
-    $form['example_id'] = array(
-      '#type' => 'value',
-      '#value' => $example_id,
-    );
-  }
-  // if we are re constructing the form from a failed validation or ajax
-  // callback then use the $form_state['values'] values
-  if (array_key_exists('values', $form_state)) {
-     $uniquename   = $form_state['values']['uniquename'];
-     $example_type = $form_state['values']['example_type'];
-     $description  = $form_state['values']['description'];
-     $organism_id  = $form_state['values']['organism_id'];
-  }
-  // if we are re building the form from after submission (from ajax call) then
-  // the values are in the $form_state['input'] array
-  if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-     $uniquename   = $form_state['input']['uniquename'];
-     $example_type = $form_state['input']['example_type'];
-     $organism_id  = $form_state['input']['organism_id'];
-  }
-
-
-  // FORM ELEMENTS
-  //---------------------------------------------
-  $form['uniquename'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Unique Name'),
-    '#required' => TRUE,
-    '#default_value' => $uniquename,
-    '#description' => t('Enter a unique name for this example. This name must be unique.'),
-    '#maxlength' => 255
-  );
-
-  // for the type_id we want to use the default vocabulary so that this field
-  // can have auto-complete functionality
-  $type_cv = tripal_get_default_cv('example', 'type_id');
-  $cv_id = $type_cv->cv_id;
-  $form['example_type'] = array(
-    '#title'       => t('Example Type'),
-    '#type'        => 'textfield',
-    '#description' => t("Choose the example type (e.g. Test Type)."),
-    '#required'    => TRUE,
-    '#default_value' => $example_type,
-    '#autocomplete_path' => "admin/tripal/vocab/cvterm/auto_name/$cv_id",
-  );
-
-  // add a select box of organisms
-  $organisms = tripal_get_organism_select_options();
-  $form['organism_id'] = array(
-    '#title'       => t('Organism'),
-    '#type'        => t('select'),
-    '#description' => t("Choose the organism with which this example is associated"),
-    '#required'    => TRUE,
-    '#default_value' => $organism_id,
-    '#options'     => $organisms,
-  );
-
-  $form['description'] = array(
-    '#type' => 'text_format',
-    '#title' => t('Description'),
-    '#required' => TRUE,
-    '#default_value' => $description,
-    '#description' => t('Enter a description for this example.'),
-  );
-
-  // PROPERTIES FORM
-  //---------------------------------------------
-  // If there is a exampleprop table and you want to allow users to add/remove
-  // entries from it through your node form then add this section to your own
-  // node form
-  $prop_cv = tripal_get_default_cv('exampleprop', 'type_id');
-  $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
-  $details = array(
-    // the name of the prop table
-    'property_table' => 'exampleprop',
-    // the value of example_id for this record
-    'chado_id' => $example_id,
-    // the cv.cv_id of the cv governing exampleprop.type_id
-    'cv_id' => $cv_id
-  );
-  // Adds the form elements to your current form
-  chado_add_node_form_properties($form, $form_state, $details);
-
-  // ADDITIONAL DBXREFS FORM
-  //---------------------------------------------
-  // If there is a example_dbxref table and you want to allow users to
-  // add/remove entries from it through your node form then add this section to
-  // your own node form
-  $details = array(
-    // the name of the _dbxref table
-    'linking_table' => 'example_dbxref',
-    // the name of the key in your base chado table
-    'base_foreign_key' => 'example_id',
-    // the value of example_id for this record
-    'base_key_value' => $example_id
-  );
-  // Adds the form elements to your current form
-  chado_add_node_form_dbxrefs($form, $form_state, $details);
-
-  // RELATIONSHIPS FORM
-  //---------------------------------------------
-  // If there is a example_relationship table and you want to allow users to
-  // add/remove entries from it through your node form then add this section to
-  // your own node form
-  $rels_cv = tripal_get_default_cv('example_relationship', 'type_id');
-  $cv_id = $rels_cv ? $rels_cv->cv_id : NULL;
-  $details = array(
-    // the name of the _relationship table
-    'relationship_table' => 'example_relationship',
-    // the name of your chado base table
-    'base_table' => 'example',
-    // the name of the key in your base chado table
-    'base_foreign_key' => 'example_id',
-    // the value of example_id for this record
-    'base_key_value' => $example_id,
-    // the human-readable name of your node type
-    'nodetype' => 'example',
-    // the cv.cv_id of the cv governing example_relationship.type_id
-    'cv_id' => $cv_id
-  );
-  // Adds the form elements to your current form
-  chado_add_node_form_relationships($form, $form_state, $details);
-
-  // return the form
-  return $form;
-}
-
-/**
- * Implementation of hook_validate
- *
- * This function validates a form prior to insert or update. If an error is
- * detected, it sets the error using form_set_error() which takes the user back
- * to the form to make corrections.
- *
- * This validation is being used for three activities:
- *   CASE A: Update a node that exists in both Drupal and Chado
- *   CASE B: Synchronizing a node from Chado to Drupal
- *   CASE C: Inserting a new node that exists in neither Drupal nor Chado
- *
- * @param $node
- *
- *
- * @ingroup tripal_example
- */
-function chado_example_validate($node, $form, &$form_state) {
-
-  // We only want to validate when the node is saved.
-  // Since this validate can be called on AJAX and Deletion of the node
-  // we need to make this check to ensure queries are not executed
-  // without the proper values.
-  if(property_exists($node, "op") and $node->op != 'Save') {
-    return;
-  }
-
-  // we are syncing if we do not have a node ID but we do have a example_id. We
-  // don't need to validate during syncing so just skip it.
-  if (!property_exists($node, 'nid') and property_exists($node, 'example_id') and $node->example_id != 0) {
-    return;
-  }
-
-  // be sure to always trim text fields
-  $node->uniquename   = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
-
-  // Validating for an update. If the 'nid' property is present in the node then
-  // this is an update and validation can be different for updates
-  if (property_exists($node, 'nid')) {
-
-    // make sure the example type is an allowed term
-    $type_cv = tripal_get_default_cv('example', 'type_id');
-    $type = tripal_get_cvterm(array(
-      'name' => $node->example_type,
-      'cv_id' => $type_cv->cv_id,
-    ));
-    if (!$type) {
-      form_set_error('example_type', t("The example type is not a valid name from the Sequence Ontology."));
-    }
-
-    // TODO: also we should check that the unique constraint is not invalidated
-    // by changing either the type_id, organism_id or uniquename.
-  }
-  // Validating for an insert
-  else {
-    // make sure the example type is an allowed term
-    $type_cv = tripal_get_default_cv('example', 'type_id');
-    $type = tripal_get_cvterm(array(
-      'name' => $node->example_type,
-      'cv_id' => $type_cv->cv_id,
-    ));
-    if (!$type) {
-      form_set_error('example_type', t("The example type is not a valid name from the Sequence Ontology."));
-    }
-
-    // TODO: also we should check that the unique constraint doesn't already exist
-  }
-}
-
-/**
- *  Implementation of hook_insert(). This function is called after the node is
- * inserted into the database. We need it so that we can insert appropriate
- * fields as provided by the user into the database. And so that we can link the
- * new Drupal node to the data in Chado via the chado_example linking table. We
- * can get to this function also during "syncing".
- * With syncing, however, the data already exists in Chado and we do not want
- * to try to re-add it. But we do need to add an entry to the chado_example
- * table to link the Drupal node with the data in the 'example' table of Chado.
- *
- *  This function is not required if the hook_node_info() does not define
- *  any custom node types.
- *
- * @ingroup tripal_example
- */
-function chado_example_insert($node) {
-
-  $example_id = '';
-
-  // if there is an example_id in the $node object then this must be a sync so
-  // we can skip adding the example as it is already there, although we do need
-  // to proceed with insertion into the chado/drupal linking table.
-  if (!property_exists($node, 'example_id')) {
-
-    // be sure to always trim text fields
-    $node->uniquename   = trim($node->uniquename);
-    $node->description  = trim($node->description['value']);
-
-    // get the example type record
-    $type_cv = tripal_get_default_cv('example', 'type_id');
-    $type = tripal_get_cvterm(array(
-        'name' => $node->example_type,
-        'cv_id' => $type_cv->cv_id,
-    ));
-
-    // perform the insert using the chado_insert_record function();
-    $values = array(
-      'uniquename' => $node->uniquename,
-      'description' => $node->description,
-      'type_id' => $type->cvterm_id,
-      'organism_id' => $node->organism_id,
-    );
-    $example = chado_insert_record('example', $values);
-    if (!$example) {
-      drupal_set_message(t('Unable to add example.'), 'warning');
-      tripal_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
-        array('%values' => print_r($values, TRUE)));
-      return;
-    }
-
-    // get the example_id for linking Drupal node with Chado data
-    $example_id = $example['example_id'];
-
-    // Only add to other Chado tables if the base record was inserted properly
-    if ($example_id > 0) {
-
-      // If you implemented the properties form in chado_example_form then you
-      // need to handle inserting these properties into your Chado prop table.
-      $details = array(
-        // the name of the prop table
-        'property_table'   => 'exampleprop',
-        // the name of your Chado base table
-        'base_table'       => 'example',
-        // the name of the key in your base table
-        'foreignkey_name'  => 'example_id',
-        // the value of the example_id key
-        'foreignkey_value' => $example_id
-      );
-      chado_update_node_form_properties($node, $details);
-
-      // If you implemented the dbxrefs form in chado_example_form then you need
-      // to handle inserting these database references into your Chado _dbxref
-      // table.
-      $details = array(
-        // the name of your _dbxref table
-        'linking_table'    => 'example_dbxref',
-        // the name of the key in your base table
-        'foreignkey_name'  => 'example_id',
-        // the value of the example_id key
-        'foreignkey_value' => $example_id
-      );
-      chado_update_node_form_dbxrefs($node, $details);
-
-      // If you implemented the relationships form in chado_example_form then
-      // you need to handle inserting these relationships into your Chado
-      // _relationship table.
-      $details = array(
-        // name of the _relationship table
-        'relationship_table' => 'example_relationship',
-        // value of the example_id key
-        'foreignkey_value' => $example_id
-      );
-      chado_update_node_form_relationships($node, $details);
-    }
-  }
-  else {
-    // the node has an example_id so get it for linking Drupal node with Chado
-    // data
-    $example_id = $node->example_id;
-  }
-
-  // Make sure the entry for this example doesn't already exist in the
-  // chado_example table if it doesn't exist then we want to add it.
-   $check_org_id = chado_get_id_from_nid('example', $node->nid);
-  if (!$check_org_id) {
-    $record = new stdClass();
-    $record->nid = $node->nid;
-    $record->vid = $node->vid;
-    $record->example_id = $example_id;
-    drupal_write_record('chado_example', $record);
-  }
-}
-
-/**
- * Implementation of hook_update(). This function runs after the node has been
- * inserted into the Drupal schema and allows us to update the record in Chado.
- *
- * This function is not required if the hook_node_info() does not define any
- * custom node types.
- *
- * @ingroup tripal_example
- */
-function chado_example_update($node) {
-  // be sure to always trim text fields
-  $node->uniquename   = trim($node->uniquename);
-  $node->description  = trim($node->description['value']);
-
-  // use the chado_update_record() function to update the record
-  $match = array(
-    'example_id' => $example_id,
-  );
-  $values = array(
-    'uniquename' => $node->uniquename,
-  );
-  $options = array('return_record' => TRUE);
-  $status = chado_update_record('example', $match, $values, $options);
-
-  if (!$status) {
-    drupal_set_message(t('Unable to update example.'), 'warning');
-    tripal_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
-      array('%values' => print_r($values, TRUE)));
-  }
-
-  // If you implemented the properties form in chado_example_form then you need
-  // to handle updating these properties into your Chado prop table.
-  $details = array(
-    'property_table' => 'exampleprop', // the name of the prop table
-    'base_table' => 'example',         // the name of your Chado base table
-    'foreignkey_name' => 'example_id', // the name of the key in your base table
-    'foreignkey_value' => $example_id  // the value of the example_id key
-  );
-  chado_update_node_form_properties($node, $details);
-
-  // If you implemented the dbxrefs form in chado_example_form then you need to
-  // handle updating these database references into your Chado _dbxref table.
-  $details = array(
-    'linking_table' => 'example_dbxref', // the name of your _dbxref table
-    'foreignkey_name' => 'example_id',   // the name of the key in your base table
-    'foreignkey_value' => $example_id    // the value of the example_id key
-  );
-  chado_update_node_form_dbxrefs($node, $details);
-
-  // If you implemented the relationships form in chado_example_form then you
-  // need to handle updating these relationships into your Chado _relationship
-  // table.
-  $details = array(
-    // name of the _relationship table
-    'relationship_table' => 'example_relationship',
-    // value of the example_id key
-    'foreignkey_value' => $example_id
-  );
-  chado_update_node_form_relationships($node, $details);
-
-}
-/**
- * Implementation of hook_delete(). This function runs after the node has been
- * deleted from the Drupal schema and allows us to delete the corresponding
- * record in Chado.
- *
- * This function is not required if the hook_node_info() does not define any
- * custom node types.
- *
- * @ingroup tripal_example
- */
-function chado_example_delete($node) {
-
-  // get the example id from the node
-  $example_id  = chado_get_id_from_nid('example', $node->nid);
-
-  // if we don't have a example id for this node then this isn't a node of type
-  // chado_example or the entry in the chado_example table was lost.
-  if (!$example_id) {
-    return;
-  }
-
-  // remove the entry in the chado_exapmle table linking the deleted
-  // Drupal node with the data in Chado
-  $sql_del = "DELETE FROM {chado_example} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
-
-  // Remove data from example tables of Chado database. This will
-  // cause a cascade delete and remove all data in referencing tables
-  // for this example
-  chado_query("DELETE FROM {example} WHERE example_id = :example_id", array(':example_id' => $example_id));
-
-  // inform the user that the data was deleted
-  drupal_set_message(t("The example and all associated data were removed from Chado"));
-
-}
-
-/**
- * Implementation of hook_load(). This function is necessary to load into the
- * $node object the fields of the table form Chado. For example for the example
- * table, the chado_example_load() function adds in a example object which
- * contains all of the fields and sub objects for data in tables with foreign
- * key relationships.
- *
- * This function is not required if the hook_node_info() does not define any
- * custom node types.
- *
- * @ingroup tripal_example
- */
-function chado_example_load($nodes) {
-
-  // EXPLANATION: when displaying or node or accessing the node in a template
-  // we need the data from Chado. This function finds the record in Chado that
-  // this node belongs to and adds the record.
-
-  // there may be multiple nodes that get passed in so we have to iterate
-  // through them all
-  foreach ($nodes as $nid => $node) {
-    // find the example and add in the details
-    $example_id = chado_get_id_from_nid('example', $nid);
-
-    // if the nid does not have a matching record then skip this node.
-    // this can happen with orphaned nodes.
-    if (!$example_id) {
-      continue;
-    }
-
-    // build the example variable by using the chado_generate_var() function
-    $values = array('example_id' => $example_id);
-    $example = chado_generate_var('example', $values);
-
-    // for fields in the table that are of type 'text' you may want to include
-    // those by default, the chado_generate_var does not include text fields as
-    // they may be very large and including a large text field can slow the page
-    // load.
-    // If you know a text field will never be large and it is important for the
-    // other functions that will see the node to have access to a field you can
-    // include it here using the chado_expand_var() function. In most
-    // cases it is probably best to let the end-user decide if text fields
-    // should be included by using this function in the templates.
-    $example = chado_expand_var($example, 'field', 'example.description');
-
-    // add the new example object to this node.
-    $nodes[$nid]->example = $example;
-
-    // If your module is using the Chado Node: Title & Path API to allow custom
-    // titles for your node type. Every time you want the title of the node, you
-    // need to use the following API function:
-    $node->title = chado_get_node_title($node);
-
-  }
-}
-
-/**
- * Implementation of hook_node_presave().
- *
- * Performs actions on a node object prior to it being saved
- *
- * @ingroup tripal_example
- */
-function tripal_example_node_presave($node) {
-
-  // EXPLANATION: This node is useful for making changes to the node prior to it
-  // being saved to the database.
-  // One useful case for this is to set the title of a node using values
-  // supplied by the user.
-  //
-  // This function is not required. You probably won't need it if you don't
-  // define a custom node type in the hook_node_info() function. But it is node
-  // type agnostic, so you can use this function to change the contents of any
-  // node regardless of it's type.
-
-  // set the node title
-  switch ($node->type) {
-    // This step is for setting the title for the Drupal node. This title is
-    // permanent and thus is created to be unique. Title changes provided by
-    // tokens are generated on the fly dynamically, but the node title seen in
-    // the content listing needs to be set here. Do not call the
-    // chado_get_node_title() function here to set the title as the node object
-    // isn't properly filled out and the function will fail.
-    case 'chado_example':
-      // for a form submission the 'uniquename' field will be set,
-      // for a sync, we must pull from the example object
-      if (property_exists($node, 'uniquename')) {
-        // set the title
-        $node->title = $node->uniquename;
-      }
-      else if (property_exists($node, 'example')) {
-        $node->title = $node->example->uniquename;
-      }
-      break;
-  }
-}
-
-/**
- * Implementation of hook node_insert().
- *
- * Performs actions after any node has been inserted.
- *
- * @ingroup tripal_example
- */
-function tripal_example_node_insert($node) {
-
-  // EXPLANATION: This function is used after any a node is inserted into the
-  // database. It is different from the hook_insert() function above in that it
-  // is called after any node is saved, regardless of it's type. This function
-  // is useful for making changes to the database after a node is inserted.
-  // An example comes from the tripal_feature module where the URL alias of a
-  // node cannot be set in the hook_insert() function. Therefore the
-  // tripal_feature module uses this function to set the URL path of a newly
-  // inserted example node.
-  //
-  // This function is not required. You probably won't need it if you don't
-  // define a custom node type in the hook_node_info() function. But it is node
-  // type agnostic, so you can use this function to do any activity after insert
-  // of any node.
-
-  // the Example code below will set the URL path after inserting. We do it here
-  // because we do not know the example_id in the pre-save and cannot do it in
-  // the hook_insert()
-  switch ($node->type) {
-    case 'chado_example':
-
-      // find the example and add in the details
-      $example_id = chado_get_id_from_nid('example', $nid);
-
-      // build the example variable by using the chado_generate_var() function
-      $values = array('example_id' => $example_id);
-      $example = chado_generate_var('example', $values);
-      $node->example = $example;
-
-
-      // EXPLANATION: You can allow the site admin to customize the
-      // title and URL of your node.  The 'Chado Node: Title & Path API'
-      // contains two functions that can be called to generate the title and
-      // URL based a schema provided by the site admin. These functions are
-      // named chado_get_node_title() and chado_set_node_url().  These
-      // functions use a string of tokens to build the URL and titles and the
-      // site admin has the ability to set these tokens.  There are
-      // form elements made available in the tripal_example_admin() function
-      // that allow the admin to set these tokens.  The default token string
-      // is provided to Tripal using two hook functions, and are found below.
-      // These are: chado_exmaple_chado_node_default_title() and
-      // chado_example_chdo_node_default_url().
-
-      // Set the Title and URL for this node.
-      $example->title = chado_get_node_title($node);
-      chado_set_node_url($node);
-      break;
-  }
-}
-
-/**
- * Implementation of hook node_update().
- *
- * Performs actions after any node has been updated.
- *
- */
-function tripal_example_node_update($node) {
-
-  // EXPLANATION: This function is used after any a node is updated in the
-  // database. It is different from the hook_update() function above in that it
-  // is called after any node is updated, regardless of it's type.
-  // An example comes from the tripal_feature module where the URL alias of a
-  // node cannot be set in the hook_update() function. Therefore the
-  // tripal_feature module uses this function to reset the URL path of an
-  // updated feature node.
-  //
-  // This function is not required. You probably won't need it if you don't
-  // define a custom node type in the hook_node_info() function. But it is node
-  // type agnostic, so you can use this function to do any activity after insert
-  // of a node.
-
-  // add items to other nodes, build index and search results
-  switch ($node->type) {
-    case 'chado_example':
-
-      // If your module is using the Chado Node: Title & Path API to allow
-      // custom titles for your node type. Every time you want the title of the
-      // node, you need to use the following API function:
-      $example->title = chado_get_node_title($node);
-
-      // set the URL for this example page
-      // see the code in the tripal_feature/includes/tripal_feature.chado_node.inc
-      // file in the function tripal_feature_node_insert for an example of how
-      // that module sets the URL. It uses a configuration file to allow the
-      // user to dynamically build a URL schema and then uses that schema to
-      // generate a URL string.
-      break;
-  }
-}
-/**
- * Implementation of hook_node_view().
- *
- * @ingroup tripal_example
- */
-function tripal_example_node_view($node, $view_mode, $langcode) {
-
-  // EXPLANATION: This function defines the content "blocks" that appear when
-  // the node is displayed. It is node type agnostic so we can add content to
-  // any node type. So, we use this function to add the content from all of our
-  // theme templates onto our new node type. We will also use this function to
-  // add content to other node types.
-
-  switch ($node->type) {
-    case 'chado_example':
-      // there are different ways a node can be viewed. Primarily Tripal
-      // supports full page view and teaser view.
-      if ($view_mode == 'full') {
-
-        // If you want to use the default Tripal node template then you need to
-        // tell Tripal to generate the Table of Contents. This is done by
-        // setting the following to TRUE. If your content type follows the
-        // chado_<base table> convention then this is the default. In this case
-        // if you don't want to use the default template then you need to set
-        // the following to FALSE.
-        $node->content['#tripal_generic_node_template'] = TRUE;
-
-        // There is always a base template. This is the template that is first
-        // shown when the example node type is first displayed.
-        // If you are using the default Tripal node template, then you should
-        // also set two additional items in each array:  tripal_toc_id and
-        // tripal_toc_title. The tripal_tock_id should be a single unique
-        // world that is used to reference the template. This ID is used for
-        // constructing URLs for the content. The tripal_toc_title contains
-        // the title that should appear in the table of contents for this
-        // content. You should only set the '#weight' element for the base
-        // template (or Overview) to ensure that it appears at the top of the
-        // list. Otherwise items are sorted alphabetically.
-        $node->content['tripal_example_base'] = array(
-          '#theme' => 'tripal_example_base',
-          '#node' => $node,
-          '#tripal_toc_id'    => 'base',
-          '#tripal_toc_title' => 'Overview',
-          '#weight' => -100,
-        );
-        // we can add other templates as well for properties, publications,
-        // dbxrefs, etc...
-        $node->content['tripal_example_properties'] = array(
-          '#theme' => 'tripal_example_properties',
-          '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
-          '#tripal_toc_title' => 'Properties',
-        );
-        $node->content['tripal_example_references'] = array(
-          '#theme' => 'tripal_example_references',
-          '#node' => $node,
-          '#tripal_toc_id'    => 'references',
-          '#tripal_toc_title' => 'Cross References',
-        );
-        $node->content['tripal_example_relationships'] = array(
-          '#theme' => 'tripal_example_relationships',
-          '#node' => $node,
-          '#tripal_toc_id'    => 'relationships',
-          '#tripal_toc_title' => 'Relationships',
-        );
-
-        // Note: if you create a template that you do not want a user to know
-        // where it is (discourage editing of it), you can add the following
-        // key:  '#tripal_template_show' => FALSE. If this key/value is set the
-        // administrator message that Tripal provides indicating where the
-        // template is housed will not be shown.
-      }
-      // set the content for the teaser view
-      if ($view_mode == 'teaser') {
-        // The teaser is also a required template
-        $node->content['tripal_example_teaser'] = array(
-          '#theme' => 'tripal_example_teaser',
-          '#node' => $node,
-        );
-      }
-      break;
-    // you can add custom content to any node type by adding content to the node
-    // in the same way as above.
-    case 'chado_organism':
-      if ($view_mode == 'full') {
-        $node->content['tripal_organism_examples'] = array(
-          '#theme' => 'tripal_organism_examples',
-          '#node' => $node,
-          '#tripal_toc_id'    => 'examples',
-          '#tripal_toc_title' => 'Examples',
-        );
-      }
-      break;
-    // ... etc
-  }
-}
-
-
-/**
- * Implements [content_type]_chado_node_default_title_format().
- *
- * Defines a default title format for the Chado Node API to set the titles on
- * Chado example nodes based on chado fields.
- */
-function chado_example_chado_node_default_title_format() {
-  return '[example.name], [example.uniquename] ([example.type_id>cvterm.name]) [example.organism_id>organism.genus] [example.organism_id>organism.species]';
-}
-
-/**
- * Implements hook_chado_node_default_url_format().
- *
- * Designates a default URL format for example nodes.
- */
-function chado_example_chado_node_default_url_format() {
-  return '/example/[example.organism_id>organism.genus]/[example.organism_id>organism.species]/[example.type_id>cvterm.name]/[example.uniquename]';
-}

+ 0 - 0
legacy/tripal_example/theme/css/tripal_example.css


+ 0 - 9
legacy/tripal_example/theme/js/tripal_example.js

@@ -1,9 +0,0 @@
-(function($) {
-  Drupal.behaviors.tripal_exampleBehavior = {
-    attach: function (context, settings){
-
-      // Place JavaScript code here
-
-    }
-  };
-})(jQuery);

+ 0 - 85
legacy/tripal_example/theme/templates/tripal_example_base.tpl.php

@@ -1,85 +0,0 @@
-<?php
-$example  = $variables['node']->example;  ?>
-
-<div class="tripal_example-data-block-desc tripal-data-block-desc"></div> <?php
-
-// the $headers array is an array of fields to use as the column headers.
-// additional documentation can be found here
-// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-// This table for the analysis has a vertical header (down the first column)
-// so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
-
-// the $rows array contains an array of rows where each row is an array
-// of values for each column of the table in that row. Additional documentation
-// can be found here:
-// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$rows = array();
-
-// Unique Name row
-$rows[] = array(
-  array(
-    'data' => 'Unique Name',
-    'header' => TRUE
-  ),
-  $example->uniquename
-);
-// Type row
-$rows[] = array(
-  array(
-    'data' => 'Type',
-    'header' => TRUE
-  ),
-  $example->type_id->name
-);
-// Organism row
-$organism = $example->organism_id->genus ." " . $example->organism_id->species ." (" . $example->organism_id->common_name .")";
-if (property_exists($example->organism_id, 'nid')) {
-  $organism = l("<i>" . $example->organism_id->genus . " " . $example->organism_id->species . "</i> (" . $example->organism_id->common_name .")", "node/".$example->organism_id->nid, array('html' => TRUE));
-}
-$rows[] = array(
-  array(
-    'data' => 'Organism',
-    'header' => TRUE,
-  ),
-  $organism
-);
-
-// allow site admins to see the example ID
-if (user_access('view ids')) {
-  // Feature ID
-  $rows[] = array(
-    array(
-      'data' => 'Example ID',
-      'header' => TRUE,
-      'class' => 'tripal-site-admin-only-table-row',
-    ),
-    array(
-      'data' => $example->example_id,
-      'class' => 'tripal-site-admin-only-table-row',
-    ),
-  );
-}
-
-
-// the $table array contains the headers and rows array as well as other options
-// for controlling the display of the table. Additional documentation can be
-// found here:
-// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
-  'header' => $headers,
-  'rows' => $rows,
-  'attributes' => array(
-    'id' => 'tripal_example-table-base',
-    'class' => 'tripal-data-table'
-  ),
-  'sticky' => FALSE,
-  'caption' => '',
-  'colgroups' => array(),
-  'empty' => '',
-);
-
-// once we have our table array structure defined, we call Drupal's
-// theme_table() function to generate the table.
-print theme_table($table); ?>
-<div style="text-align: justify"><?php print $example->description ?></div>

+ 0 - 8
legacy/tripal_example/theme/templates/tripal_example_help.tpl.php

@@ -1,8 +0,0 @@
-<h3>Module Description:</h3>
-<p>Place details about this module here.</p>
-
-<h3>Setup Instructions:</h3>
-<p>Instructions for setup of this module go here.</p>
-
-<h3>Features of this Module:</h3>
-<p>A description of this module's features go here.</p>

+ 0 - 70
legacy/tripal_example/theme/templates/tripal_example_properties.tpl.php

@@ -1,70 +0,0 @@
-<?php
-$example = $node->example;
-
-// expand the example to include the properties.
-$options = array(
-  'return_array' => 1,
-  'order_by' => array('rank' => 'ASC'),
-);
-$example = chado_expand_var($example,'table', 'exampleprop', $options);
-$exampleprops = $example->exampleprop;
-$properties = array();
-
-if (count($properties)) { ?>
-  <div class="tripal_example-data-block-desc tripal-data-block-desc">Additional details for this example include:</div> <?php
-
-  // the $headers array is an array of fields to use as the column headers.
-  // additional documentation can be found here
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
-
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row. Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-
-  $keywords = array();
-  foreach ($properties as $property) {
-    // each keyword is stored as a separate properties. We want to show them
-    // only in a single field not as a bunch of individual properties, so when
-    // we see one, save it in an array for later and don't add it yet to the
-    // table yet.
-    if ($property->type_id->name == 'Keywords') {
-      $keywords[] = $property->value;
-      continue;
-    }
-    $rows[] = array(
-      $property->type_id->name,
-      $property->value
-    );
-  }
-  // now add in a single row for all keywords
-  if (count($keywords) > 0) {
-    $rows[] = array(
-      'Keywords',
-      implode(', ', $keywords),
-    );
-  }
-
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table. Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_example-table-properties',
-      'class' => 'tripal-data-table'
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-
-  // once we have our table array structure defined, we call Drupal's
-  // theme_table() function to generate the table.
-  print theme_table($table);
-}

+ 0 - 70
legacy/tripal_example/theme/templates/tripal_example_references.tpl.php

@@ -1,70 +0,0 @@
-<?php
-$example = $variables['node']->example;
-
-// expand the example object to include the records from the example_dbxref
-// table
-$options = array('return_array' => 1);
-$example = chado_expand_var($example, 'table', 'example_dbxref', $options);
-$example_dbxrefs = $example->example_dbxref;
-
-$references = array();
-if (count($example_dbxrefs) > 0 ) {
-  foreach ($example_dbxrefs as $example_dbxref) {
-    $references[] = $example_dbxref->dbxref_id;
-  }
-}
-
-if(count($references) > 0){ ?>
-  <div class="tripal_example-data-block-desc tripal-data-block-desc">This example is also available in the following databases:</div><?php
-
-  // the $headers array is an array of fields to use as the colum headers.
-  // additional documentation can be found here
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Database', 'Accession');
-
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row. Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-
-  foreach ($references as $dbxref){
-    $database = $dbxref->db_id->name . ': ' . $dbxref->db_id->description;
-    if ($dbxref->db_id->url) {
-      $database = l($dbxref->db_id->name, $dbxref->db_id->url, array('attributes' => array('target' => '_blank'))) . ': ' . $dbxref->db_id->description;
-    }
-    $accession = $dbxref->db_id->name . ':' . $dbxref->accession;
-    if ($dbxref->db_id->urlprefix) {
-      $accession = l($accession, tripal_get_dbxref_url($dbxref), array('attributes' => array('target' => '_blank')));
-    }
-    if (property_exists($dbxref, 'is_primary')) {
-      $accession .= " <i>(primary cross-reference)</i>";
-    }
-
-    $rows[] = array(
-      $database,
-      $accession
-    );
-  }
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table. Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_example-table-references',
-      'class' => 'tripal-data-table'
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
-}
-

+ 0 - 151
legacy/tripal_example/theme/templates/tripal_example_relationships.tpl.php

@@ -1,151 +0,0 @@
-<?php
-/* Typically in a Tripal template, the data needed is retrieved using a call to
- * chado_expand_var function. For example, to retrieve all of the example
- * relationships for this node, the following function call would be made:
- *
- *   $example = chado_expand_var($example,'table','example_relationship');
- *
- * However, this function call can be extremely slow when there are numerous
- * relationships. This is because the chado_expand_var function is recursive and
- * expands all data following the foreign key relationships tree. Therefore, to
- * speed retrieval of data, a special variable is provided to this template:
- *
- *   $example->all_relationships;
- *
- * This variable is an array with two sub arrays with the keys 'object' and
- * 'subject'. The array with key 'object' contains relationships where the
- * example is the object, and the array with the key 'subject' contains
- * relationships where the example is the subject.
- */
-$example = $variables['node']->example;
-
-$all_relationships = $example->all_relationships;
-$object_rels = $all_relationships['object'];
-$subject_rels = $all_relationships['subject'];
-
-if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div class="tripal_example-data-block-desc tripal-data-block-desc"></div> <?php
-
-  // first add in the subject relationships.
-  foreach ($subject_rels as $rel_type => $rels){
-    foreach ($rels as $obj_type => $objects){ ?>
-      <p>This <?php print $example->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> example(s): <?php
-
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Publication');
-
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row. Additional
-      // documentation can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-
-      foreach ($objects as $object){
-        // link the example to it's node
-        $title = $object->record->object_id->title;
-        if (property_exists($object->record, 'nid')) {
-          $title = l($title, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-
-        // get the citation
-        $values = array(
-          'example_id' => $object->record->object_id->example_id,
-          'type_id' => array(
-            'name' => 'Citation',
-          ),
-        );
-        $citation = chado_generate_var('exampleprop', $values);
-        $citation = chado_expand_var($citation, 'field', 'exampleprop.value');
-
-        $rows[] = array(
-          $title . '<br>' . htmlspecialchars($citation->value),
-        );
-       }
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table. Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_example-table-relationship-object',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
-
-       // once we have our table array structure defined, we call Drupal's
-       // theme_table() function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
-  }
-
-  // second add in the object relationships.
-  foreach ($object_rels as $rel_type => $rels){
-    foreach ($rels as $subject_type => $subjects){?>
-      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> example(s) are <?php print $rel_type ?> this <?php print $example->type_id->name;?>: <?php
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Publication');
-
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row. Additional
-      // documentation can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-
-      foreach ($subjects as $subject){
-        // link the example to it's node
-        $title = $subject->record->subject_id->title;
-        if (property_exists($subject->record, 'nid')) {
-          $title = l($title, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-
-        // get the citation
-        $values = array(
-          'example_id' => $subject->record->subject_id->example_id,
-          'type_id' => array(
-            'name' => 'Citation',
-          ),
-        );
-        $citation = chado_generate_var('exampleprop', $values);
-        $citation = chado_expand_var($citation, 'field', 'exampleprop.value');
-
-        $rows[] = array(
-          $title . '<br>' . htmlspecialchars($citation->value),
-        );
-       }
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table. Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_example-table-relationship-subject',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
-
-       // once we have our table array structure defined, we call Drupal's
-       // theme_table() function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
-  }
-}

+ 0 - 14
legacy/tripal_example/theme/templates/tripal_example_teaser.tpl.php

@@ -1,14 +0,0 @@
-<?php
-$example  = $variables['node']->example; ?>
-
-<div class="tripal_example-teaser tripal-teaser"> 
-  <div class="tripal-example-teaser-title tripal-teaser-title"><?php 
-    print l("<i>$example->uniquename", "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-example-teaser-text tripal-teaser-text"> <?php
-    print substr($example->description, 0, 650);
-    if (strlen($example->description) > 650) {
-      print "... " . l("[more]", "node/$node->nid");
-    } ?>
-  </div>
-</div>

+ 0 - 113
legacy/tripal_example/theme/tripal_example.theme.inc

@@ -1,113 +0,0 @@
-<?php
-
-/**
- * @file
- *
- * This file should contain all Drupal hooks for theming content. For templates
- * that need specific the hook_preprocess functions should be included here
- *
- */
-
-/**
- * implementation of hook_preprocess_HOOK()
- *
- * Used to alter or add to theme variables. The variables are passed into
- * templates when processing. This function organizes the relationships
- * into more simple structures for parsing in the template file.
- *
- * @ingroup tripal_example
- */
-function tripal_example_preprocess_tripal_example_relationships(&$variables) {
-  // EXPLANATION:  If you have implemented a new Chado node type and the record
-  // that belongs to the node has a corresponding xxxx_relationship table
-  // this this function can be used to provide relationships to the template
-  // in a format that is easier to parse. This is one example where specific SQL
-  // statements can improve performance over Tripal API calls. SQL is not
-  // recommended inside of template files, but rather the Tripal API calls only.
-  // Therefore, this function queries the relationships and then organizes them
-  // into arrays that are easier and faster to parse. You should be able to
-  // copy the content of this function and adjust as necessary to change table
-  // names if your record has relationships.
-
-  $example = $variables['node']->example;
-
-   // expand the example object to include the example relationships.
-  $options = array(
-    'return_array' => 1,
-    // we don't want to fully recurs we only need information about the
-    // relationship type and the object and subject examples (including example
-    // type)
-    'include_fk' => array(
-      'type_id' => 1,
-      'object_id' => array(
-        'type_id' => 1,
-      ),
-      'subject_id'  => array(
-        'type_id' => 1,
-      ),
-    ),
-  );
-  $example = chado_expand_var($example, 'table', 'example_relationship', $options);
-
-  // get the subject relationships
-  $srelationships = $example->example_relationship->subject_id;
-  $orelationships = $example->example_relationship->object_id;
-
-  // combine both object and subject relationships into a single array
-  $relationships = array();
-  $relationships['object'] = array();
-  $relationships['subject'] = array();
-
-  // iterate through the object relationships
-  if ($orelationships) {
-    foreach ($orelationships as $relationship) {
-      $rel = new stdClass();
-      $rel->record = $relationship;
-
-      // get the relationship and child types
-      $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
-      $child_type = $relationship->subject_id->type_id->name;
-
-      // get the node id of the subject
-      $sql = "SELECT nid FROM {chado_example} WHERE example_id = :example_id";
-      $n = db_query($sql, array(':example_id' => $relationship->subject_id->example_id))->fetchObject();
-      if ($n) {
-        $rel->record->nid = $n->nid;
-      }
-
-      if (!array_key_exists($rel_type, $relationships['object'])) {
-        $relationships['object'][$rel_type] = array();
-      }
-      if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
-        $relationships['object'][$rel_type][$child_type] = array();
-      }
-      $relationships['object'][$rel_type][$child_type][] = $rel;
-    }
-  }
-
-  // now add in the subject relationships
-  if ($srelationships) {
-    foreach ($srelationships as $relationship) {
-      $rel = new stdClass();
-      $rel->record = $relationship;
-      $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
-      $parent_type = $relationship->object_id->type_id->name;
-
-      // get the node id of the subject
-      $sql = "SELECT nid FROM {chado_example} WHERE example_id = :example_id";
-      $n = db_query($sql, array(':example_id' => $relationship->object_id->example_id))->fetchObject();
-      if ($n) {
-        $rel->record->nid = $n->nid;
-      }
-
-      if (!array_key_exists($rel_type, $relationships['subject'])) {
-        $relationships['subject'][$rel_type] = array();
-      }
-      if (!array_key_exists($parent_type, $relationships['subject'][$rel_type])) {
-        $relationships['subject'][$rel_type][$parent_type] = array();
-      }
-      $relationships['subject'][$rel_type][$parent_type][] = $rel;
-    }
-  }
-  $example->all_relationships = $relationships;
-}

+ 0 - 50
legacy/tripal_example/tripal_example.info

@@ -1,50 +0,0 @@
-;
-; Provide details about your module in this file. Instruction for setup of this
-; file can be found here: https://drupal.org/node/542202
-;
-name = Tripal Example
-description = An example module that can be used as a template for anyone wanting to create a custom extension module for Tripal.
-
-;
-; The version of Drupal with which this module is compatible.
-;
-core = 7.x
-
-;
-; The computer-readable name for this module
-;
-project = tripal_example
-
-;
-; In order for this module to appear in the 'Tripal Extensions' section when
-; viewing the module administrative page, the package must be set to
-; 'Tripal Extensions'
-;
-package = Tripal v2 Legacy Extensions
-
-;
-; Follow these instructions when specifying the version:
-; https://drupal.org/node/1015226
-;
-version = 7.x-3.0-beta3
-
-;
-; Style-sheets containing CSS that should always be available for the
-; module should be specified here.
-;
-stylesheets[all][] = theme/css/tripal_example.css
-
-;
-; Javascript files that should always be available for the
-; module should be specified here.
-;
-scripts[]          = theme/js/tripal_example.js
-
-;
-; Add additional dependencies for other modules using the module project name.
-; These modules must be enabled before this module can be enabled
-;
-dependencies[] = tripal_core
-dependencies[] = tripal_chado_views
-dependencies[] = tripal_db
-dependencies[] = tripal_cv

+ 0 - 608
legacy/tripal_example/tripal_example.install

@@ -1,608 +0,0 @@
-<?php
-/**
- * @file
- * Installation of the example module
- */
-
-/**
- * Implements hook_disable().
- *
- * Perform actions when the module is disabled by the site administrator
- *
- * @ingroup tripal_example
- */
-function tripal_example_disable() {
-
-  // EXPLANATION: If you are using Drupal Views you want to ensure that any
-  // default views that your module provides are disabled when the module is
-  // disabled. Default views are specified in the
-  // [module name].views.default.inc file. The following code will disable these
-  // views. If your module does not create any default views you can remove the
-  // following code.
-
-  // Disable all default views provided by this module
-  require_once("tripal_example.views_default.inc");
-  $views = tripal_example_views_default_views();
-  foreach (array_keys($views) as $view_name) {
-    tripal_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
-  }
-
-}
-
-/**
- * Implements hook_requirements().
- *
- * Performs check to see if all required dependencies are met. Drupal will
- * automatically check for module dependencies but here you can check for other
- * requirements.
- *
- * @ingroup tripal_example
- */
-function tripal_example_requirements($phase) {
-
-
-  $requirements = array();
-  if ($phase == 'install') {
-    // EXPLANATION: It is essential that Chado be installed for almost all
-    // Tripal modules. Therefore, the following code checks to ensure Chado is
-    // installed and available. If your module does not require that Chado be
-    // installed, you can remove the following check.
-
-    // make sure chado is installed
-    if (!$GLOBALS["chado_is_installed"]) {
-      $requirements ['tripal_example'] = array(
-          'title' => "tripal_example",
-          'value' => "ERROR: Chado must be installed before this module can be enabled",
-          'severity' => REQUIREMENT_ERROR,
-      );
-    }
-  }
-  return $requirements;
-}
-
-/**
- * Implements hook_install().
- *
- * Performs actions when the modules is first installed.
- *
- * @ingroup tripal_example
- */
-function tripal_example_install() {
-
-  // EXPLANATION: Here is a good place to add any materialized views, controlled
-  // vocabularies CV, databases or CV terms needed by your module.
-  // To keep this module code short, create functions to do each of those tasks
-
-  // add any materialized view
-  tripal_example_add_mviews();
-
-  // add any external databases used by the example module.
-  tripal_example_add_dbs();
-
-  // add any controlled vocabularies used by the example module. You may need
-  // to add a vocabulary if you to set it as default (see next lines of code).
-  // For example, the Sequence Ontology (SO) is used by the feature module as
-  // the default vocabulary for the feature type_id field. But, that vocabulary
-  // does not yet exist in Chado until after the SO is loaded using the Tripal
-  // OBO loader. But, we can add it here as a place-holder so that we can then
-  // set it as a default vocabulary (see below).
-  tripal_example_add_cvs();
-
-
-  // add any controlled vocabulary terms
-  tripal_example_add_cvterms();
-
-  // EXPLANATION: Many tables in Chado have a 'type_id' column which allows for
-  // association of controlled vocabularies to describe the record. Chado places
-  // no restrictions on which vocabularies can be used, but Tripal can be
-  // instructed to provide a default vocabulary for any given field. For
-  // example, the feature.type_id column will typically use the Sequence
-  // Ontology. In that case, we can use the tripal_set_default_cv() function to
-  // specify the Sequence Ontology (sequence) as the default vocabulary.
-  tripal_set_default_cv('example', 'type_id', 'example_type');
-  tripal_set_default_cv('exampleprop', 'type_id', 'example_property');
-  tripal_set_default_cv('example_relationship', 'type_id', 'example_relationship');
-
-  // add any custom tables. For this case we will add an 'example' table to the
-  // chado schema
-  tripal_example_add_custom_tables();
-}
-
-
-/**
- * Implements hook_uninstall().
- *
- * Performs actions when the modules is uninstalled.
- *
- * @ingroup tripal_example
- */
-function tripal_example_uninstall() {
-
-}
-
-/**
- * Implementation of hook_schema().
- *
- * Provides a list of tables to be created inside of the Drupal schema (the
- * 'public' schema by default). It uses the Drupal Schema API array structure to
- * define the table, its indexes and constraints.
- *
- * Schema API documentation is here:
- * https://api.drupal.org/api/drupal/includes%21database%21schema.inc/group/schemaapi/7
- *
- * @ingroup tripal_example
- */
-function tripal_example_schema() {
-
-  // EXPLANATION: If your module creates a node type for data in the Chado
-  // database then you probably need to link Drupal nodes with a respective ID
-  // in the Chado table. The following is an example array for a table that will
-  // link the 'chado_example' node type (created by this example module) with a
-  // record in the fake Chado example table. This table will link the 'nid' of
-  // the node with the 'example_id' of the example record.
-  $schema['chado_example'] = array(
-    'fields' => array(
-      'vid' => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0
-       ),
-      'nid' => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0
-       ),
-      'example_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0
-      ),
-      'sync_date' => array(
-        'type' => 'int',
-        'not null' => FALSE,
-        'description' => 'UNIX integer sync date/time'
-      ),
-    ),
-    'indexes' => array(
-      'chado_example_idx1' => array('example_id')
-    ),
-    'unique keys' => array(
-      'chado_example_uq1' => array('nid', 'vid'),
-      'chado_example_uq2' => array('vid')
-    ),
-    'primary key' => array('nid'),
-  );
-
-  return $schema;
-};
-
-/**
- * Creates a materialized view that stores the type & number of examples per
- * organism.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_mviews() {
-
-  // EXPLANATION: use the tripal_add_mview() function to add a materialized view
-  // needed by your module. If you have more than one materialized view it is
-  // best to create a single function for each one and call each function here.
-  // Otherwise this function can become quite long.
-
-}
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_dbs() {
-  // EXPLANATION: use the tripal_insert_db() function to add any external
-  // databases needed by your module. If the database already exists then the
-  // function will gracefully return.
-
-  tripal_insert_db(array(
-    'name' => 'example_db',
-    'description' => 'An example database.'
-  ));
-}
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_cvs() {
-
-  // EXPLANATION: use the tripal_insert_cv() function to add any controlled
-  // vocabularies needed by your module. If the vocabulary already exists then
-  // the function will gracefully return. Chado conventions use a singular name
-  // for CV names (not plural).
-
-  tripal_insert_cv(
-    'example_property',
-    'Contains property terms for examples.'
-  );
-
-  tripal_insert_cv(
-    'example_type',
-    'Contains terms describing types of examples.'
-  );
-
-  tripal_insert_cv(
-   'example_relationship',
-   'Contains terms for describing relationship types between examples.'
-  );
-
-}
-
-/**
- * Adds controlled vocabulary terms needed by this module.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_cvterms() {
-
-  // EXPLANATION: for our test module to work we need to add some terms to our
-  // example_type controlled vocabulary. Ideally we should have a full OBO file
-  // for loading but sometimes we just have a small list that won't really
-  // change so we can add those terms here.
-  tripal_insert_cvterm(array(
-    'id'         => 'test',         // the term accession
-    'name'       => 'Test type',    // the human readable term name
-    'cv_name'    => 'example_type', // the CV name this term belongs to.
-    'definition' => 'A test type for the example module.',
-    'db_name'    => 'example_db',   // the database in which the term is found.
-  ));
-}
-
-/**
- * Add custom tables to Chado that are required by this module
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_custom_tables() {
-
-  // EXPLANATION: for this example module we will create a set of example tables
-  // that mimic Chado tables. These tables are:
-  //
-  //   1) example     (for storing the primary example records)
-  //   2) exampleprop (for sorting properties about the example)
-  //   3) example_relationship (for storing relationships about examples)
-  //   4) example_dbxref (for storing cross-references about an example)
-  //
-  // To make the code easier to read, each table is created by a separate
-  // function called here:
-
-  tripal_example_add_example_table();
-  tripal_example_add_exampleprop_table();
-  tripal_example_add_example_relationship_table();
-  tripal_example_add_example_dbxref_table();
-}
-
-/**
- * Adds the 'example' custom table to Chado.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_example_table() {
-  // EXPLANATION: use the Drupal Schema API to describe the custom table. Then
-  // add the table using the chado_create_custom_table() function.
-  $schema = array(
-    'table' => 'example',
-    'fields' => array(
-      'example_id' => array(
-        'type' => 'serial',
-        'not null' => true,
-      ),
-      'uniquename' => array(
-        'type' => 'varchar',
-        'length' => '255',
-        'not null' => TRUE,
-      ),
-      'type_id' => array(
-        'type' => 'int',
-        'not null' => true,
-      ),
-      'organism_id' => array(
-        'type' => 'int',
-        'not null' => true,
-      ),
-      'description' => array(
-        'type' => 'text',
-      ),
-    ),
-    'primary key' => array(
-      0 => 'example_id',
-    ),
-    'unique keys' => array(
-      'example_uq1' => array(
-        0 => 'uniquename',
-        1 => 'type_id',
-        2 => 'organism_id',
-      ),
-    ),
-    'indexes' => array(
-      'example_idx1' => array(
-        0 => 'example_id',
-      ),
-      'example_idx2' => array(
-        0 => 'uniquename',
-      ),
-    ),
-    'foreign keys' => array(
-      'cvterm' => array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-      ),
-      'organism' => array(
-        'table' => 'organism',
-        'columns' => array(
-          'organism_id' => 'organism_id',
-        ),
-      ),
-    ),
-    // EXPLANATION: the 'referring_tables' array is the list of tables that have
-    // a foreign key relationships with this table. This information is required
-    // for the Tripal API to be able to expand tables in templates.
-    'referring_tables' => array(
-      0 => 'example_relationship',
-      1 => 'exampleprop',
-      2 => 'example_dbxref',
-    ),
-  );
-  chado_create_custom_table('example', $schema, TRUE);
-}
-/**
- * Adds the 'example_relationship' custom table to Chado.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_exampleprop_table() {
-  // EXPLANATION: use the Drupal Schema API to describe the custom table. Then
-  // add the table using the chado_create_custom_table() function.
-
-  // Add the exampleprop table
-  $schema =  array(
-    'table' => 'exampleprop',
-    'fields' => array(
-      'exampleprop_id' => array(
-        'type' => 'serial',
-        'not null' => TRUE,
-      ),
-      'example_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'type_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'value' => array(
-        'type' => 'text',
-        'not null' => FALSE,
-      ),
-      'rank' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-    ),
-    'primary key' => array(
-      0 => 'exampleprop_id',
-    ),
-    'unique keys' => array(
-      'example_id_type_id_rank' => array(
-        0 => 'example_id',
-        1 => 'type_id',
-        2 => 'rank',
-      ),
-    ),
-    'foreign keys' => array(
-      'cvterm' => array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-      ),
-      'example' => array(
-        'table' => 'example',
-        'columns' => array(
-          'example_id' => 'example_id',
-        ),
-      ),
-    ),
-  );
-  chado_create_custom_table('exampleprop', $schema, TRUE);
-}
-
-/**
- * Adds the 'example_relationship' custom table to Chado.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_example_relationship_table() {
-  // EXPLANATION: use the Drupal Schema API to describe the custom table. Then
-  // add the table using the chado_create_custom_table() function.
-
-  $schema =  array(
-    'table' => 'example_relationship',
-    'fields' => array(
-      'example_relationship_id' => array(
-        'type' => 'serial',
-        'not null' => TRUE,
-      ),
-      'subject_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'object_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'type_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'value' => array(
-        'type' => 'text',
-        'not null' => FALSE,
-      ),
-      'rank' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-    ),
-    'primary key' => array(
-      0 => 'example_relationship_id',
-    ),
-    'unique keys' => array(
-      'example_relationship_c1' => array(
-        0 => 'subject_id',
-        1 => 'object_id',
-        2 => 'type_id',
-        3 => 'rank',
-      ),
-    ),
-    'indexes' => array(
-      'example_relationship_idx1' => array(
-        0 => 'subject_id',
-      ),
-      'example_relationship_idx2' => array(
-        0 => 'object_id',
-      ),
-      'example_relationship_idx3' => array(
-        0 => 'type_id',
-      ),
-    ),
-    'foreign keys' => array(
-      'cvterm' => array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-      ),
-      'example' => array(
-        'table' => 'example',
-        'columns' => array(
-          'subject_id' => 'example_id',
-          'object_id' => 'example_id',
-        ),
-      ),
-    ),
-  );
-  chado_create_custom_table('example_relationship', $schema, TRUE);
-}
-
-/**
- * Adds the 'example_dbxref' custom table to Chado.
- *
- * @ingroup tripal_example
- */
-function tripal_example_add_example_dbxref_table() {
-
-  // EXPLANATION: use the Drupal Schema API to describe the custom table. Then
-  // add the table using the chado_create_custom_table() function.
-
-  $schema =  array(
-    'table' => 'example_dbxref',
-    'fields' => array(
-      'example_dbxref_id' => array(
-        'type' => 'serial',
-        'not null' => TRUE,
-      ),
-      'example_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'dbxref_id' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'is_current' => array(
-        'type' => 'int',
-        'size' => 'tiny',
-        'not null' => TRUE,
-        'default' => 1,
-      ),
-    ),
-    'primary key' => array(
-      0 => 'example_dbxref_id',
-    ),
-    'unique keys' => array(
-      'example_dbxref_unq1' => array(
-        0 => 'example_id',
-        1 => 'dbxref_id',
-      ),
-    ),
-    'indexes' => array(
-      'example_dbxref_idx1' => array(
-        0 => 'example_id',
-      ),
-      'example_dbxref_idx2' => array(
-        0 => 'dbxref_id',
-      ),
-    ),
-    'foreign keys' => array(
-      'dbxref' => array(
-        'table' => 'dbxref',
-        'columns' => array(
-          'dbxref_id' => 'dbxref_id',
-        ),
-      ),
-      'example' => array(
-        'table' => 'example',
-        'columns' => array(
-          'example_id' => 'example_id',
-        ),
-      ),
-    ),
-  );
-  chado_create_custom_table('example_dbxref', $schema, TRUE);
-}
-/**
- * This is the required update for tripal_example.
- */
-function tripal_example_update_7200() {
-  // EXPLANATION: as you create new releases of your module you may find that
-  // tables your module created, or data may need to be adjusted. This function
-  // allows you to do that. This function is executed using the
-  // http://[your site]/update.php  URL or using the drush command 'updatedb'.
-  // This function should be named according to the instructions provided here:
-  // https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
-  //
-  // It is best not to use Tripal API calls inside of this function because an
-  // upgrade from Drupal 6 to Drupal 7 requires that all modules be disabled
-  // which means the Tripal API is not available. This is an unfortunate
-  // requirement, but will prevent errors during a major upgrade.
-
-  // it is good to wrap any database changes inside of a try catch block:
-  try {
-   // perform database changes
-  }
-  catch (\PDOException $e) {
-    $error = $e->getMessage();
-    throw new DrupalUpdateException('Could not apply updates: '. $error);
-  }
-}
-
-/**
- * Implementation of hook_update_dependencies(). It specifies a list of other
- * modules whose updates must be run prior to this one.
- */
-function tripal_example_update_dependencies() {
-  $dependencies = array();
-
-  // EXPLANATION: here we can specify which modules must be updated prior to
-  // applying the updates in this module. This is useful because it prevents
-  // updates from being executed out of order. The following example code shows
-  // that the 'tripal_example' module update number 7200 must be executed after
-  // the 'tripal_cv' module's 7200 update.
-  $dependencies['tripal_example'][7200] = array(
-    'tripal_cv' => 7200
-  );
-
-  return $dependencies;
-}

+ 0 - 365
legacy/tripal_example/tripal_example.module

@@ -1,365 +0,0 @@
-<?php
-
-/**
- * @file
- * This file contains all Drupal hooks for the module other than any node hooks
- * and block hooks. Those go in the [module name].chado_node.inc file and
- * [module_name].blocks.inc respectively
- *
- */
-
-// EXPLANATION: include any files needed for this module. That includes any API
-// file, the theme file, or files with functions for new node types.  Try to
-// include other files only when needed so as to reduce the loading time
-// for the module.
-require('api/tripal_example.api.inc');
-require('theme/tripal_example.theme.inc');
-require('includes/tripal_example.chado_node.inc');
-
-
-/**
- * Implementation of hook_permissions()
- *
- * Set the permission types that this module uses.
- *
- * @ingroup tripal_example
- */
-function tripal_example_permission() {
-
-  // EXPLANATION:  here we want to setup any of the permission types that this
-  // module needs. Our example module creates a new chado node type called
-  // 'chado_example'. Therefore, we need permissions to view, edit, delete,
-  // create our new node type. Additionally, we want to add a permission that
-  // allows for administration of this module. These permissions will appear in
-  // the 'People' -> 'Permissions' configuration page and allow the site admin
-  // to specify which user roles are allowed to perform specific actions.
-  return array(
-    'access chado_example content' => array(
-      'title' => t('View Examples'),
-      'description' => t('Allow users to view example pages.'),
-    ),
-    'create chado_example content' => array(
-      'title' => t('Create Examples'),
-      'description' => t('Allow users to create new example pages.'),
-    ),
-    'delete chado_example content' => array(
-      'title' => t('Delete Examples'),
-      'description' => t('Allow users to delete example pages.'),
-    ),
-    'edit chado_example content' => array(
-      'title' => t('Edit Examples'),
-      'description' => t('Allow users to edit example pages.'),
-    ),
-    'administer tripal example' => array(
-      'title' => t('Administer Examples'),
-      'description' => t('Allow users to administer all examples.'),
-    ),
-  );
-}
-
-/**
- * Implements hook_menu()
- *
- * Specifies menu items and URLs used by this module.
- *
- * @ingroup tripal_example
- */
-function tripal_example_menu() {
-  $items = array();
-
-  // EXPLANATION:  the $items array should be populated to contain a list of
-  // menu items or URL callbacks that our module needs.
-  // all Tripal Extension modules should provide at least these menu items:
-  //  * A menu item for an administrative home page
-  //  * A menu item for 'Help' documentation
-  //  * A menu item for a module configuration page
-  //
-  // Additionally, if your module defines a custom node type that is linked
-  // to a record in Chado:
-  //  * A menu item for syncing drupal nodes with Chado records.
-  //
-
-  // EXPLANATION:  all extension modules should have an administrative menu item
-  // with the path set to 'admin/tripal/extension/[module name]'. This will
-  // place the menu item in the 'Tripal' -> 'Extension Modules' page. Because
-  // this is an administrative menu item we must be sure to set the
-  // 'access arguments' to be 'administer tripal example' which is a permission
-  // type we created in the tripal_example_permissions() function above.
-  $items['admin/tripal/extension/tripal_example'] = array(
-    'title' => 'Examples',
-    'description' => 'Example module for help with development of new extension modules.',
-    'page callback' => 'tripal_example_admin_examples_listing',
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_NORMAL_ITEM,
-    // We include the file where the 'page callback' function
-    // is located.  This removes the need to include all of the
-    // include files at the top of the module, and speeds
-    // module loading time.
-    'file' => '/includes/tripal_example.admin.inc',
-  );
-
-  // EXPLANATION: all extension modules should provide help documentation to
-  // describe the functionality of the module and any installation or setup
-  // tasks that may be required. The menu 'type' is MENU_LOCAL_TASK so that the
-  // link appears in a tab on the extension module's administrative page.
-  // Here the 'page callback' specifies that we are using Drupal's theme
-  // function and the 'page_arguments' indicate the name of the template file
-  // Thus, all help documentation should be provided in the
-  // [module name]/theme/tripal_example_help.tpl.php file.
-  $items['admin/tripal/extension/tripal_example/help'] = array(
-    'title' => 'Help',
-    'description' => 'Basic Description of Tripal Library Module Functionality',
-    'page callback' => 'theme',
-    'page arguments' => array('tripal_example_help'),
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 10,
-  );
-
-  // EXPLANATION: all extension modules should provide a configuration page.
-  // Even if your module does not need configuration the menu item and page
-  // should be created. This helps users recognize that the module is installed
-  // and working. The configuration page can simply state that no configuration
-  // settings are available. Typically a form is provided for the module's
-  // configuration settings. Therefore the 'page callback' uses the
-  // drupal_get_form() function and the 'page argument' indicates the form
-  // to call is named 'tripal_eample_admin'. The function that describes
-  // to form is in the includes/tripal_example.admin.inc file.
-  $items['admin/tripal/extension/tripal_example/configuration'] = array(
-    'title' => 'Settings',
-    'description' => 'Configure the Tripal Library module',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_example_admin'),
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 5,
-  );
-
-  // EXPLANATION: If your module defines a new chado node type and that node
-  // type directly links to a record in Chado, then you can use the Tripal API
-  // to quickly provide syncing functionality. See the API documentation here
-  // for more information on how that is setup:
-  // http://api.tripal.info/api/tripal/tripal_core%21api%21tripal_core.chado_nodes.api.inc/function/chado_node_sync_form/2.x
-  $items['admin/tripal/extension/tripal_example/sync'] = array(
-    'title' => ' Sync',
-    'description' => 'Create pages on this site for examples stored in Chado',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('chado_node_sync_form', 'tripal_example', 'chado_example'),
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 2,
-  );
-
-  // EXPLANATION: If your module defines a new node type that uses the default
-  // table of contents (left-side bar of content panes on a page). Then a 'TOC'
-  // link will automatically appear on the node page to allow for customization
-  // of the TOC. However those customizations are only node specific. To provide
-  // a tab in the module's administrative pages add the following menu item.
-  // This menu will provide a form similar to the one found on the node that
-  // allows the user to set global TOC settings for the content type. Be sure to
-  // always use a menu path of the form:
-  //   admin/tripal/legacy/[module name]/[content type name]_toc
-  // this allows for a module to support TOC management when there are multiple
-  // content types provided by the module, as the content type is specified
-  // in the menu path.
-  $items['admin/tripal/legacy/tripal_example/chado_example_toc'] = array(
-    'title' => ' TOC',
-    'description' => 'Manage the table of contents for example nodes.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_core_content_type_toc_form', 'chado_example'),
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_LOCAL_TASK,
-    'file' =>  'includes/tripal_core.toc.inc',
-    'file path' => drupal_get_path('module', 'tripal_core'),
-    'weight' => 3
-  );
-
-  return $items;
-}
-
-/**
- * Implements hook_views_api()
- *
- * This hook tells Drupal that there is views support for this module which then
- * automatically includes the tripal_db.views.inc where all the views
- * integration code is found.
- *
- * @ingroup tripal_example
- */
-function tripal_example_views_api() {
-  return array(
-    'api' => 3.0,
-  );
-}
-
-
-/**
- * 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_example
- */
-function tripal_example_theme($existing, $type, $theme, $path) {
-  $core_path = drupal_get_path('module', 'tripal_core');
-
-  // EXPLANATION: this function defines all of the functions and templates that
-  // this module needs to provide content. These details are provided in the
-  // form of an array the indicates which functions or templates provide
-  // content. Please see the Drupal theming guide for an in-depth description
-  // for how theming works in Drupal:
-  // https://drupal.org/documentation/theme
-
-  $items = array(
-
-    // EXPLANATION:  If this module defines a new node type that displays Chado
-    // data then we should use Tripal's default node template. This template
-    // ensures that all content provided by Tripal and Tripal extension modules
-    // has the same look and feel. It is designed to be generic such that it
-    // won't interfere with the look-and-feel of the default theme. This generic
-    // template will organize the node into a table of contents found on the
-    // left-side of the page and place the content in the center of the page.
-    // User's will cycle through content on the page by clicking the links in
-    // the table of contents. If you do not want to use the default Tripal
-    // template you can change this array to your liking.
-    'node__chado_example' => array(
-      'template' => 'node--chado-generic',
-      'render element' => 'node',
-      'base hook' => 'node',
-      'path' => "$core_path/theme/templates",
-    ),
-
-    // EXPLANATION: the following defines all of the template files used for
-    // this module. Templates are named with underscores separating words, and
-    // correspond directly to a file with the extension '.tpl.php'. For example
-    // the 'tripal_example_base' template will have a corresponding
-    // tripal_example_base.tpl.php file where the display code is housed.
-    // The only required templates are the 'base',  'help' and 'teaser'
-    // templates. The base template provides the basic information about the
-    // record in Chado. The 'help' template provides the administrative help
-    // documentation, and the teaser provides a brief summary of the record that
-    // can be used as short description of the record in aggregated lists.
-
-    // the base template
-    'tripal_example_base' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_base',
-      'path' => "$path/theme/templates",
-    ),
-    // the help template
-    'tripal_example_help' => array(
-      'template' => 'tripal_example_help',
-      'variables' =>  array(NULL),
-      'path' => "$path/theme/templates",
-    ),
-    // the teaser template.
-    'tripal_example_teaser' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_teaser',
-      'path' => "$path/theme/templates",
-    ),
-
-
-    // EXPLANATION: Typically, a different template is created for each subset
-    // of data.
-    // For example, most Chado tables have a 'XXXXprop', 'XXXX_cvterm',
-    // 'XXXX_dbxref', 'XXXX_synonyms', 'XXXX_relationships' tables. Therefore,
-    // a template is created to display data from each of these tables.
-
-    'tripal_example_properties' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_properties',
-      'path' => "$path/theme/templates",
-    ),
-    'tripal_example_references' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_references',
-      'path' => "$path/theme/templates",
-    ),
-    'tripal_example_relationships' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_relationships',
-      'path' => "$path/theme/templates",
-    ),
-
-    // EXPLANATION: sometimes a module may want to add content to another
-    // modules' node types. For example, the feature module does this by
-    // adding a 'feature summary' data to an organism. To add data to another
-    // module's node, the templates belong to this module and are specified in
-    // the same way as above. However, the naming of the template is changed to
-    // include the name of the module that supplies the node type followed by
-    // our record name:
-
-    // tripal_organism templates
-    'tripal_organism_examples' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_organism_examples',
-      'path' => "$path/theme/templates",
-    ),
-  );
-
-  return $items;
-}
-
-/**
- * Implements hook_help()
- *
- * Adds a help page to the module list
- */
-function tripal_example_help ($path, $arg) {
-
-  // EXPLANATION: in the tripal_example_menu() function above we created a menu
-  // item for the help documentation. The menu item specified a function that
-  // should be called when the menu item is clicked. This is that function. But,
-  // rather than place HTML code in this function we want to have our help
-  // documentation in a template file. We specified in the
-  // tripal_example_theme() function that we have a template file so now we want
-  // to use get the contents of that template file and return it.
-  if ($path == 'admin/help#tripal_example') {
-    return theme('tripal_example_help', array());
-  }
-}
-
-
-/**
- * Implements hook_cron()
- *
- * @ingroup tripal_example
- */
-function tripal_example_cron() {
-
-  // EXPLANATION: here we can add any code that needs to be executed when the
-  // Drupal cron is run.
-}
-
-
-/**
- * Implementation of hook_form_alter()
- *
- * Allows a module to alter any form prior to it being rendered. For more
- * details about Drupal's Form API see this page:
- *
- * https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7
- *
- */
-function tripal_example_form_alter(&$form, &$form_state, $form_id) {
-
-  if ($form_id == "chado_example_node_form") {
-
-    // EXPLANATION:  The hook_form_alter() Drupal hook is used to alter a form
-    // before it is displayed. This allows any module to provide new form
-    // elements or change the form that another module creates. We do not need
-    // to alter a form created by another module, but we do want to alter the
-    // form for our new node type. For example, all node types will
-    // automatically have a 'Preview' button. For inserting or updating data
-    // for Chado we don't really need a Preview button and it complicates the
-    // form. So, we use the following code to disable the Preview button. If
-    // you want to keep the preview button then remove this code. turn of
-    // preview button for insert/updates
-    $form['actions']['preview']['#access'] = FALSE;
-
-    // EXPLANATION: Drupal always adds a 'body' field to all node types.
-    // Our node type doesn't use the 'body' field so we remove it from the form.
-    unset($form['body']);
-  }
-}

+ 0 - 9
legacy/tripal_example/tripal_example.views.inc

@@ -1,9 +0,0 @@
-<?php
-/**
- *  @file
- *  This file contains the basic functions for views integration of chado/tripal
- *  example tables
- */
-
-// EXPLANATION: see another tripal module (e.g. tripal_feature) for example
-// functions that can be used in this file.

+ 0 - 25
legacy/tripal_example/tripal_example.views_default.inc

@@ -1,25 +0,0 @@
-<?php
-/**
- * @file
-* Describe default example views
-*/
-
-/**
- * Implements hook_views_default_views().
-*
-* @ingroup tripal_example
-*/
-function tripal_example_views_default_views() {
-  $views = array();
-
-  // EXPLANATION: use this function to programmatically define any default
-  // Drupal views that your module will provide automatically. Typically there
-  // are two default views: 1) one for the administrator to quickly find data
-  // managed by your module, or 2) one for users to be able to search for public
-  // data.
-  //
-  // See another Tripal module such as tripal_feature for an example of how to
-  // setup a default views.
-
-  return $views;
-}

+ 3 - 14
tripal/api/tripal.entities.api.inc

@@ -446,20 +446,6 @@ function tripal_get_content_types() {
     ->fetchAll();
 }
 
-/**
- * Implements hook_cron().
- */
-function tripal_cron() {
-  if (variable_get('tripal_admin_notification_creation_during_cron', TRUE)) {
-    $modules = module_implements('tripal_cron_notification');
-    foreach ($modules as $module) {
-      $function = $module . '_tripal_cron_notification';
-      $function();
-    }
-    watchdog('tripal_cron', 'tripal_cron ran');
-  }
-}
-
 /**
  * Refreshes the bundle such that new fields added by modules will be found during cron.
  *
@@ -575,9 +561,12 @@ function tripal_refresh_bundle_fields($bundle_name) {
   }
   // Allow modules to add fields to the new bundle.
   $modules = module_implements('bundle_fields_info');
+  dpm($modules);
   foreach ($modules as $module) {
     $function = $module . '_bundle_fields_info';
     $info = $function('TripalEntity', $bundle);
+    dpm($module);
+    dpm($info);
     foreach ($info as $field_name => $details) {
       $field_type = $details['type'];
 

+ 14 - 0
tripal/tripal.module

@@ -814,4 +814,18 @@ function tripal_block_configure ($delta = '') {
 
 
   return $form;
+}
+
+/**
+ * Implements hook_cron().
+ */
+function tripal_cron() {
+  if (variable_get('tripal_admin_notification_creation_during_cron', TRUE)) {
+    $modules = module_implements('tripal_cron_notification');
+    foreach ($modules as $module) {
+      $function = $module . '_tripal_cron_notification';
+      $function();
+    }
+    watchdog('tripal_cron', 'tripal_cron ran');
+  }
 }

+ 49 - 0
tripal_ws/includes/TripalContentTypeService.inc

@@ -0,0 +1,49 @@
+<?php
+
+class TripalContentTypeService extends TripalWebService {
+
+  public static $label = 'Content Types';
+  public static $description = 'Provides acesss to the biological and ' .
+    'ancilliary data available on this site. Each content type represents ' .
+    'biological data that is defined in a controlled vocabulary (e.g. ' .
+    'Sequence Ontology term: gene (SO:0000704)).'
+  public static $name = 'content';
+
+  public function __construct() {
+    parent::__construct();
+
+    // Iterate through all of the entitie types (bundles) and add them as
+    // supported classes.
+    $bundles = db_select('tripal_bundle', 'tb')
+      ->fields('tb')
+      ->orderBy('tb.label', 'ASC')
+      ->execute();
+
+    // Iterate through the terms and add an entry in the collection.
+    $i = 0;
+    while ($bundle = $bundles->fetchObject()) {
+      $entity =  entity_load('TripalTerm', array('id' => $bundle->term_id));
+      $term = reset($entity);
+      $vocab = $term->vocab;
+
+      // Get the bundle description. If no description is provided then
+      // use the term definition
+      $description = tripal_get_bundle_variable('description', $bundle->id);
+      if (!$description) {
+        $description = $term->definition;
+      }
+      // Add the bundle as a content type.
+//       $response['member'][] = array(
+//         '@id' => url($api_url . '/content/' . urlencode($bundle->label), array('absolute' => TRUE)),
+//         '@type' => $term->name,
+//         'label' => $bundle->label,
+//         'description' => $description,
+//       );
+
+      $operations = array();
+      $properties = array();
+      $this->addSupportedClass($term->name, $bundle->label, $description, $operations, $properties);
+      $this->addContextItem($term->name, $term->url);
+    }
+  }
+}

+ 0 - 0
legacy/tripal_example/theme/templates/tripal_organism_examples.tpl.php → tripal_ws/includes/TripalVocabService.inc


+ 66 - 0
tripal_ws/includes/TripalWebService.inc

@@ -0,0 +1,66 @@
+<?php
+
+class TripalWebService {
+
+  public static $label;
+  public static $description;
+  public static $version;
+  public static $name;
+
+  private $context;
+  private $response;
+  private $supportedClasses;
+
+
+  /**
+   *
+   */
+  public function __construct() {
+    $this->context = array();
+    $this->response = array();
+    $this->supportedClasses = array();
+    $this->possibleStates = array();
+
+    // First, add the RDFS and Hydra vocabularies to the context.  All
+    // web services should use these.
+    $this->addContextItem('rdfs', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
+    $this->addContextItem('hydra', 'http://www.w3.org/ns/hydra/core#');
+
+  }
+
+
+  public function addSupportedClass($type, $title, $description, $operations = array(), $properties = array()) {
+    // TODO: add some checks.
+
+    $this->supportedClasses[] = array(
+      '@type' => $type,
+      'hydra:title' => $title,
+      'hydra:description' => $description,
+      'supportedOperation' => $operations,
+      'supportedProperty' => $properties,
+    );
+  }
+
+
+  public function getSupportedClasses() {
+    return $this->supportedClasses;
+  }
+
+  public function addContextItem($name, $details) {
+    $this->context[$name] = $details;
+  }
+
+  public function getContext() {
+    return $this->context;
+  }
+
+  public function getDocumentation() {
+     return array(
+       '@context' => $this->getContext(),
+       '@id' => '',
+       '@type' => 'ApiDocumentation',
+       'supportedClass' => $this->getSupportedClasses(),
+       'supportedStatus' => $this->getSuportedStatus(),
+     );
+  }
+}

+ 19 - 0
tripal_ws/includes/TripalWebServiceProvider.inc

@@ -0,0 +1,19 @@
+<?php
+
+class TripalWebServiceProvider {
+  private $services;
+  private $possibleStatus;
+
+
+  public function __construct() {
+    $this->services = array();
+  }
+
+  public function addService($service) {
+    $this->services[] = $service;
+  }
+
+  public function getPossibleStatus() {
+    return $this->possibleStatus;
+  }
+}