Sfoglia il codice sorgente

Tripal Bulk Loader adheres to Drupal coding standard

Pubudu Basnayaka 12 anni fa
parent
commit
f497599a7a

+ 21 - 9
tripal_bulk_loader/tripal_bulk_loader.constants.inc

@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * @todo Add file header description
+ */
 
 /**
  * Inserts/Updates a tripal bulk loading job constant
@@ -163,8 +167,8 @@ function tripal_bulk_loader_set_constants_form($form_state, $node) {
 
       $form['exposed_fields']['existing'][$group]['delete'] = array(
         '#type' => 'markup',
-        '#value' => l('Edit', 'node/' . $node->nid . '/constants/' . $group . '/edit') . '<br />'  .
-          l('Delete', 'node/' . $node->nid . '/constants/' . $group . '/delete'),
+        '#value' => l(t('Edit'), 'node/' . $node->nid . '/constants/' . $group . '/edit') . '<br />'  .
+          l(t('Delete'), 'node/' . $node->nid . '/constants/' . $group . '/delete'),
       );
 
     }
@@ -198,15 +202,15 @@ function tripal_bulk_loader_set_constants_form($form_state, $node) {
           case 'table field':
             $form['exposed_fields']['new'][$record_id . '-' . $field_id] = array(
               '#type' => 'textfield',
-              '#title' => t($field['title']),
-              '#description' => t($field['exposed_description']),
+              '#title' => t('%title', array('%title' => $field['title'])),
+              '#description' => t('%exposed_description', array('%exposed_description' => $field['exposed_description'])),
               '#default_value' => (isset($node->constants[$record_id][$field_id]['value'])) ? $node->constants[$record_id][$field_id]['value'] : $field['constant value'],
             );
           break;
           case 'constant':
             $form['exposed_fields']['new'][$record_id . '-' . $field_id] = array(
               '#type' => 'textfield',
-              '#title' => t($field['title']),
+              '#title' => t('%title', array('%title' => $field['title']) ),
               '#description' => t('Enter the case-sensitive value of this constant for your spreadsheet'),
               '#default_value' => (isset($node->constants[$record_id][$field_id]['value'])) ? $node->constants[$record_id][$field_id]['value'] : $field['constant value'],
             );
@@ -281,7 +285,15 @@ function tripal_bulk_loader_set_constants_form_validate($form, $form_state) {
               form_set_error($record_id . '-' . $field_id, $msg);
             }
             else {
-              drupal_set_message('Confirmed a '. $form['exposed_fields']['new'][$record_id . '-' . $field_id]['#title'] . ' of "'. $form['exposed_fields']['new'][$record_id . '-' . $field_id]['#value'] . '" already exists.');
+              drupal_set_message(
+                t(
+                  'Confirmed a %title of "%value" already exists.',
+                  array(
+                    '%title' => $form['exposed_fields']['new'][$record_id . '-' . $field_id]['#title'],
+                    '%value' => $form['exposed_fields']['new'][$record_id . '-' . $field_id]['#value']
+                  )
+                )
+              );
             }
           }
         }
@@ -418,15 +430,15 @@ function tripal_bulk_loader_edit_constant_set_form($form_state, $node, $group_id
           case 'table field':
             $form[$record_id . '-' . $field_id] = array(
               '#type' => 'textfield',
-              '#title' => t($field['title']),
-              '#description' => t($field['exposed_description']),
+              '#title' => t('%title', array('%title' => $field['title'])),
+              '#description' => t('%exposed_description', array('%exposed_description' => $field['exposed_description'])),
               '#default_value' => (isset($node->constants[$group_id][$record_id][$field_id]['value'])) ? $node->constants[$group_id][$record_id][$field_id]['value'] : $field['constant value'],
             );
           break;
           case 'constant':
             $form[$record_id . '-' . $field_id] = array(
               '#type' => 'textfield',
-              '#title' => t($field['title']),
+              '#title' => t('%title', array('%title' => $field['title'])),
               '#description' => t('Enter the case-sensitive value of this constant for your spreadsheet'),
               '#default_value' => (isset($node->constants[$group_id][$record_id][$field_id]['value'])) ? $node->constants[$group_id][$record_id][$field_id]['value'] : $field['constant value'],
             );

+ 5 - 0
tripal_bulk_loader/tripal_bulk_loader.install

@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ * @todo Add file header description
+ */
+
 
 /**
  * Implements hook_install

+ 8 - 3
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @file
+ * @todo Add file header description
+ */
+
 /**
  * Add Loader Job Form
  *
@@ -62,7 +67,7 @@ function tripal_bulk_loader_add_loader_job_form_submit($form, $form_state) {
       db_query("UPDATE {tripal_bulk_loader} SET job_status='%s' WHERE nid=%d", 'Submitted to Queue', $form_state['values']['nid']);
     }
     else {
-      drupal_set_message("Can not open " . $form_state['values']['file'] . ". Job not scheduled.");
+      drupal_set_message(t("Can not open %file. Job not scheduled.", array('%file' => $form_state['values']['file'])));
     }
   }
   elseif (preg_match('/Re-Submit Job/', $form_state['values']['op'])) {
@@ -82,11 +87,11 @@ function tripal_bulk_loader_add_loader_job_form_submit($form, $form_state) {
       db_query('DELETE FROM %s WHERE %s IN (%s)', $r->table_inserted_into, $r->table_primary_key, $r->ids_inserted);
       $result = db_fetch_object(db_query('SELECT true as present FROM %s WHERE %s IN (%s)', $r->table_inserted_into, $r->table_primary_key, $r->ids_inserted));
       if (!$result->present) {
-        drupal_set_message('Successfully Removed data Inserted into the ' . $r->table_inserted_into . ' table.');
+        drupal_set_message(t('Successfully Removed data Inserted into the %tableto table.', array('%tableto' => $r->table_inserted_into)));
         db_query('DELETE FROM {tripal_bulk_loader_inserted} WHERE tripal_bulk_loader_inserted_id=%d', $r->tripal_bulk_loader_inserted_id);
       }
       else {
-        drupal_set_message('Unable to remove data Inserted into the ' . $r->table_inserted_into . ' table!', 'error');
+        drupal_set_message(t('Unable to remove data Inserted into the %tableto table!', array('%tableto' => $r->table_inserted_into)), 'error');
       }
     }
 

+ 1 - 1
tripal_bulk_loader/tripal_bulk_loader.module

@@ -449,7 +449,7 @@ function tripal_bulk_loader_update($node) {
       tripal_add_job("Bulk Load: $fname", 'tripal_bulk_loader', 'tripal_bulk_loader_load_data', $job_args, $user->uid);
     }
     else {
-      drupal_set_message("Can not open $node->file. Job not scheduled.");
+      drupal_set_message(t("Can not open %file. Job not scheduled.", array('%file' => $node->file)));
     }
   }