Browse Source

Minor fixes

Stephen Ficklin 6 years ago
parent
commit
ee3bf0168b

+ 1 - 1
tripal/includes/TripalEntityController.inc

@@ -101,7 +101,7 @@ class TripalEntityController extends EntityAPIController {
 
     return TRUE;
   }
-
+  
   /**
    * Sets the title for an entity.
    *

+ 17 - 11
tripal_chado/includes/tripal_chado.unpublish_form.inc

@@ -9,26 +9,31 @@
 function tripal_chado_unpublish_form($form, &$form_state) {
   $bundles = tripal_chado_get_orphaned_bundles();
 
+  drupal_set_title('Unpublish Orphaned Content');
+  
   $form['description'] = [
-    '#markup' => t('<p>Unpublish entities that have no associated records in 
-                        their corresponding chado tables</p>')
+    '#type' => 'markup',
+    '#markup' => t('Sometimes published content can become orphaned. This can
+      occur if someone deletes records directly from the underlying data store
+      yet Tripal is not aware of it.  Here, you can unpublish orphaned content
+      '),
   ];
 
   if (empty($bundles)) {
     $form['message'] = [
       '#type' => 'markup',
-      '#markup' => t("<p>No orphaned entities detected.</p>"),
+      '#markup' => t("No orphaned content detected."),
     ];
 
     return $form;
   }
 
   $form['bundles'] = [
-    '#title' => t('Select a bundle'),
+    '#title' => t('Content type'),
     '#type' => 'select',
     '#options' => $bundles,
-    '#empty_option' => t('-- Select a Bundle --'),
-    '#description' => t('Select a bundle to check if it has orphaned entities.'),
+    '#empty_option' => t('-- Select a Content Type --'),
+    '#description' => t('Select a Tripal content type to find orphaned content.'),
     '#ajax' => [
       'callback' => 'tripal_chado_unpublish_form_callback',
       'wrapper' => 'bundle_info_fieldset_wrapper',
@@ -60,13 +65,13 @@ function tripal_chado_unpublish_form($form, &$form_state) {
     if ($count > 0) {
       $form['bundle_info_fieldset']['example_table'] = [
         '#type' => 'markup',
-        '#prefix' => t('<p>The following is an example of the records that will get removed. This table contains a maximum of 10 records.</p>'),
+        '#prefix' => t('The following is a subset of the records that will be unpublished. Only a maximum of 10 records are shown.'),
         '#markup' => tripal_chado_missing_records_table($selected_bundle_id),
       ];
 
       $form['bundle_info_fieldset']['submit'] = [
         '#type' => 'submit',
-        '#value' => 'Permanently Delete Orphaned Entities',
+        '#value' => 'Unpublish Orphaned Entities',
       ];
     }
   }
@@ -101,8 +106,8 @@ function tripal_chado_unpublish_form_submit($form, &$form_state) {
     'tripal_chado_delete_orphaned_entities', [$bundle_id], $user->uid, 10);
 
   drupal_set_message('Job submitted successfully!');
-  drupal_set_message('WARNING: It is expected to see a few tripal_chado errors
-   while the job is executing. The errors can be safely ignored.', 'warning');
+//   drupal_set_message('WARNING: It is expected to see a few tripal_chado errors
+//    while the job is executing. The errors can be safely ignored.', 'warning');
 }
 
 /**
@@ -113,7 +118,8 @@ function tripal_chado_unpublish_form_submit($form, &$form_state) {
 function tripal_chado_get_orphaned_bundles() {
   $bundles = db_query('SELECT bundle_id, data_table, label 
              FROM {chado_bundle} CB
-             INNER JOIN {tripal_bundle} TB ON TB.id = CB.bundle_id')->fetchAll();
+             INNER JOIN {tripal_bundle} TB ON TB.id = CB.bundle_id
+             ORDER BY label')->fetchAll();
 
   $mapped = [];
 

+ 2 - 3
tripal_chado/tripal_chado.module

@@ -213,9 +213,8 @@ function tripal_chado_menu() {
   );
 
   $items['admin/content/bio_data/unpublish'] = [
-    'title' => 'Delete Orphaned Entities',
-    'description' => t('Unpublish entities that have no associated records in 
-                        their corresponding chado tables'),
+    'title' => 'Unpublish Orphaned Content',
+    'description' => t('Unpublish content that has no associated records in the data store.'),
     'page callback' => 'drupal_get_form',
     'page arguments' => ['tripal_chado_unpublish_form'],
     'access arguments' => ['administer tripal'],