Browse Source

Issue #72: Updating API to include 2.1 improvements: 3e42625

Stephen Ficklin 7 years ago
parent
commit
8e472e357b

+ 56 - 0
legacy/tripal_stock/includes/tripal_stock.chado_node.inc

@@ -926,3 +926,59 @@ function chado_stock_chado_node_default_title_format() {
 function chado_stock_chado_node_default_url_format() {
   return '/stock/[stock.organism_id>organism.genus]/[stock.organism_id>organism.species]/[stock.type_id>cvterm.name]/[stock.uniquename]';
 }
+
+/**
+ * Implement hook_node_access().
+ *
+ * This hook allows node modules to limit access to the node types they define.
+ *
+ *  @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet exist, the
+ *  type of node to be created
+ *
+ *  @param $op
+ *  The operation to be performed
+ *
+ *  @param $account
+ *  A user object representing the user for whom the operation is to be performed
+ *
+ *  @return
+ *  If the permission for the specified operation is not set then return FALSE. If the
+ *  permission is set then return NULL as this allows other modules to disable
+ *  access.  The only exception is when the $op == 'create'.  We will always
+ *  return TRUE if the permission is set.
+ *
+ * @ingroup tripal_stock
+ */
+
+function tripal_stock_node_access($node, $op, $account) {
+  $node_type = $node;
+  if (is_object($node)) {
+    $node_type = $node->type;
+  }
+
+  if($node_type == 'chado_stock') {
+    if ($op == 'create') {
+      if (!user_access('create chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+      return NODE_ACCESS_ALLOW;
+    }
+    if ($op == 'update') {
+      if (!user_access('edit chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+    }
+    if ($op == 'delete') {
+      if (!user_access('delete chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+    }
+    if ($op == 'view') {
+      if (!user_access('access chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+    }
+    return NODE_ACCESS_IGNORE;
+  }
+}

+ 0 - 56
legacy/tripal_stock/tripal_stock.module

@@ -183,62 +183,6 @@ function tripal_stock_permission() {
   );
 }
 
-/**
- * Implement hook_node_access().
- *
- * This hook allows node modules to limit access to the node types they define.
- *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
- *
- *  @param $op
- *  The operation to be performed
- *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
- *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
- *
- * @ingroup tripal_stock
- */
-
-function tripal_stock_node_access($node, $op, $account) {
-  $node_type = $node;
-  if (is_object($node)) {
-    $node_type = $node->type;
-  }
-
-  if($node_type == 'chado_stock') {
-    if ($op == 'create') {
-      if (!user_access('create chado_stock content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-      return NODE_ACCESS_ALLOW;
-    }
-    if ($op == 'update') {
-      if (!user_access('edit chado_stock content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-    if ($op == 'delete') {
-      if (!user_access('delete chado_stock content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-    if ($op == 'view') {
-      if (!user_access('access chado_stock content', $account)) {
-        return NODE_ACCESS_DENY;
-      }
-    }
-    return NODE_ACCESS_IGNORE;
-  }
-}
-
 /**
  * Implements hook_views_api().
  *

+ 5 - 4
tripal/api/tripal.notice.api.inc

@@ -210,10 +210,11 @@ function tripal_set_message($message, $importance = TRIPAL_INFO, $options = arra
  *   are supported.
  * @param $options
  *   An array of options where the following keys are supported:
- *     - first_progress_bar: this sohuld be used for the first log call for a progress bar
- *     - is_progress_bar: this option should be used for all but the first print of a
- *         progress bar to allow it all to be printed on the same line without intervening
- *         date prefixes
+ *     - first_progress_bar: this sohuld be used for the first log call for a
+ *       progress bar
+ *     - is_progress_bar: this option should be used for all but the first print
+ *       of a progress bar to allow it all to be printed on the same line
+ *       without intervening date prefixes
  * @return
  *   The number of bytes that were written to the file, or FALSE on failure
  */

+ 1 - 0
tripal_chado/includes/tripal_chado.install.inc

@@ -17,6 +17,7 @@ function tripal_chado_load_form($form, $form_state) {
   // get the effective version.  Pass true as second argument
   // to warn the user if the current version is not compatible
   $version = chado_get_version(FALSE, TRUE);
+
   if (array_key_exists('values', $form_state)) {
     if ($form_state['values']['action_to_do'] == "Upgrade Chado v1.2 to v1.3") {
       $tables_list = implode(', ', array('analysis_cvterm', 'analysis_dbxref', 'analysis_pub',