Completed
Pull Request — master (#2022)
by Christian
12:03
created
drupal/sites/default/boinc/modules/boincwork/includes/boincwork.helpers.inc 6 patches
Switch Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -643,9 +643,9 @@
 block discarded – undo
643 643
     }
644 644
     break;
645 645
     
646
-    default:
647
-      // Don't generate form elements for things that aren't explicitly form
648
-      // elements (i.e. 'title', '@attributes' keys, and the like)
646
+  default:
647
+    // Don't generate form elements for things that aren't explicitly form
648
+    // elements (i.e. 'title', '@attributes' keys, and the like)
649 649
   }
650 650
 }
651 651
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -977,6 +977,7 @@  discard block
 block discarded – undo
977 977
 
978 978
 /**
979 979
  * Format a number to be displayed using a maximum number of digits
980
+ * @param double $number
980 981
  */ 
981 982
 function boincwork_format_stats($number, $max_digits = 4) {
982 983
   $suffix = array(
@@ -1187,6 +1188,9 @@  discard block
 block discarded – undo
1187 1188
   //  xml_to_array(): Convert an XML DOM object to array format
1188 1189
   //------------------------------------------------------------------------------------------------
1189 1190
   
1191
+  /**
1192
+   * @param DOMDocument $xml
1193
+   */
1190 1194
   function xml_to_array($xml) {
1191 1195
       $node = $xml->firstChild; //$xml->first_child();
1192 1196
       $result = '';
@@ -1269,6 +1273,7 @@  discard block
 block discarded – undo
1269 1273
 
1270 1274
 /**
1271 1275
   * Determine output for host list views when no hosts are found.
1276
+  * @param string $context
1272 1277
   */
1273 1278
 function boincwork_views_host_list_empty_text($context = NULL) {
1274 1279
   
@@ -1818,6 +1823,7 @@  discard block
 block discarded – undo
1818 1823
 
1819 1824
 /**
1820 1825
  * Function to delete a column from an array.
1826
+ * @param integer $offset
1821 1827
  */
1822 1828
 function delete_col(&$array, $offset) {
1823 1829
   return array_walk($array, function (&$v) use ($offset) {
Please login to merge, or discard this patch.
Braces   +39 added lines, -68 removed lines patch added patch discarded remove patch
@@ -332,8 +332,7 @@  discard block
 block discarded – undo
332 332
         $name = $element['@attributes']['name'];
333 333
         if (isset($element['@attributes']['entitytype']) AND $element['@attributes']['entitytype'] == 'attribute') {
334 334
           $defaults['@attributes'][$name] = $values[$name];
335
-        }
336
-        else {
335
+        } else {
337 336
           $defaults[$name] = $values[$name];
338 337
         }
339 338
       }
@@ -384,8 +383,7 @@  discard block
 block discarded – undo
384 383
       if (isset($user_pref[$name])) {
385 384
         if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
386 385
           $value = $user_pref[$name]['@value'];
387
-        }
388
-        else {
386
+        } else {
389 387
           $value = $user_pref[$name];
390 388
         }
391 389
       }
@@ -447,8 +445,7 @@  discard block
 block discarded – undo
447 445
       if (isset($user_pref[$name])) {
448 446
         if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
449 447
           $value = $user_pref[$name]['@value'];
450
-        }
451
-        else {
448
+        } else {
452 449
           $value = $user_pref[$name];
453 450
         }
454 451
       }
@@ -492,8 +489,7 @@  discard block
 block discarded – undo
492 489
               isset($item['@attributes']['selected'])) {
493 490
             $default = ($item['@attributes']['selected'] == 'true') ? $item['@value'] : null;
494 491
           }
495
-        }
496
-        else {
492
+        } else {
497 493
           $value = $item;
498 494
         }
499 495
         $options[$value] = $value;
@@ -696,8 +692,7 @@  discard block
 block discarded – undo
696 692
       );
697 693
       if ($top_level) {
698 694
         $uncategorized[$key] = $prefs_element;
699
-      }
700
-      else {
695
+      } else {
701 696
         $prefs_table[$key] = $prefs_element;
702 697
       }
703 698
       break;
@@ -711,8 +706,7 @@  discard block
 block discarded – undo
711 706
       'name' => bts('Other settings', array(), NULL, 'boinc:account-preferences'),
712 707
       'elements' => $uncategorized,
713 708
     );
714
-  }
715
-  elseif ($uncategorized) {
709
+  } elseif ($uncategorized) {
716 710
     // If nothing is categorized, output all prefs under a general "settings"
717 711
     $prefs_table['settings'] = array(
718 712
       'name' => bts('Settings', array(), NULL, 'boinc:account-preferences'),
@@ -745,8 +739,7 @@  discard block
 block discarded – undo
745 739
       $main_prefs = load_configuration($boincuser->project_prefs);
746 740
       $main_prefs = (array) $main_prefs['project_preferences'];
747 741
     }
748
-  }
749
-  else {
742
+  } else {
750 743
     if ($boincuser->global_prefs) {
751 744
       $main_prefs = load_configuration($boincuser->global_prefs);
752 745
       $main_prefs = (array) $main_prefs['global_preferences'];
@@ -762,8 +755,7 @@  discard block
 block discarded – undo
762 755
     if (count($main_prefs) < 3)
763 756
         $main_prefs['@attributes'] = array('cleared' => 1);
764 757
     return $main_prefs;
765
-  }
766
-  else {
758
+  } else {
767 759
     if (isset($main_prefs['venue'])) {
768 760
       if (!is_numeric(key($main_prefs['venue']))) {
769 761
         $main_prefs['venue'] = array($main_prefs['venue']);
@@ -803,8 +795,7 @@  discard block
 block discarded – undo
803 795
       $main_prefs = load_configuration($boincuser->project_prefs);
804 796
       $main_prefs = (array) $main_prefs['project_preferences'];
805 797
     }
806
-  }
807
-  else {
798
+  } else {
808 799
     if ($boincuser->global_prefs) {
809 800
       $main_prefs = load_configuration($boincuser->global_prefs);
810 801
       $main_prefs = (array) $main_prefs['global_preferences'];
@@ -817,8 +808,7 @@  discard block
 block discarded – undo
817 808
   if (!$venue OR $venue == 'generic') {
818 809
     //$main_prefs = $prefs;
819 810
     $main_prefs = $prefs + $main_prefs;
820
-  }
821
-  else {
811
+  } else {
822 812
     if (isset($main_prefs['venue'])) {
823 813
       if (!is_numeric(key($main_prefs['venue']))) {
824 814
         $main_prefs['venue'] = array($main_prefs['venue']);
@@ -827,8 +817,7 @@  discard block
 block discarded – undo
827 817
         if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) {
828 818
           if ($prefs) {
829 819
             $main_prefs['venue'][$key] = $prefs;
830
-          }
831
-          else {
820
+          } else {
832 821
             // If prefs is null, clear out this preference set
833 822
             unset($main_prefs['venue'][$key]);
834 823
             if (count($main_prefs['venue']) == 0) {
@@ -870,8 +859,7 @@  discard block
 block discarded – undo
870 859
     db_set_active('boinc');
871 860
     $result = db_query("UPDATE user SET project_prefs = '{$boincuser->project_prefs}' WHERE id = '{$boincuser->id}'");
872 861
     db_set_active('default');
873
-  }
874
-  else {
862
+  } else {
875 863
     $main_prefs = array('global_preferences' => $main_prefs);
876 864
     $boincuser->global_prefs = save_configuration($main_prefs);
877 865
     db_set_active('boinc');
@@ -919,15 +907,13 @@  discard block
 block discarded – undo
919 907
       // Process nested form elements
920 908
       $parents[] = $field;
921 909
       boincwork_validate_form($rules, $values[$field], $parents);
922
-    }
923
-    else {
910
+    } else {
924 911
       if ($parents) {
925 912
         // form_set_error() identifies nested form elements with '][' as a
926 913
         // delimiter between each parent and child element
927 914
         $parents[] = $field;
928 915
         $form_field = implode('][', $parents);
929
-      }
930
-      else {
916
+      } else {
931 917
         $form_field = $field;
932 918
       }
933 919
       if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) {
@@ -1010,8 +996,7 @@  discard block
 block discarded – undo
1010 996
   //  load_configuration(): Convert structured text/xml to array
1011 997
   //------------------------------------------------------------------------------------------------
1012 998
   
1013
-  function load_configuration($text)
1014
-  {
999
+  function load_configuration($text) {
1015 1000
       if (preg_match('/^\<\?xml .*\?\>$/i', $text)) return null;
1016 1001
       if ($xml = text_to_xml($text)) return xml_to_array($xml);
1017 1002
       return false;
@@ -1021,8 +1006,7 @@  discard block
 block discarded – undo
1021 1006
   //  save_configuration(): Convert array to structured text/xml
1022 1007
   //------------------------------------------------------------------------------------------------
1023 1008
   
1024
-  function save_configuration($array)
1025
-  {
1009
+  function save_configuration($array) {
1026 1010
       if ($xml = array_to_xml($array)) return xml_to_text($xml, false, true);
1027 1011
       return false;
1028 1012
   }
@@ -1054,26 +1038,22 @@  discard block
 block discarded – undo
1054 1038
               $ordered_array[$item['@position']] = array(
1055 1039
                 $name => $item
1056 1040
               );
1057
-            }
1058
-            else {
1041
+            } else {
1059 1042
               $unordered_array[] = array(
1060 1043
                 $name => $item
1061 1044
               );
1062 1045
             }
1063 1046
           }
1064
-        }
1065
-        elseif (isset($value['@position'])) {
1047
+        } elseif (isset($value['@position'])) {
1066 1048
           $ordered_array[$value['@position']] = array(
1067 1049
             $name => $value
1068 1050
           );
1069
-        }
1070
-        else {
1051
+        } else {
1071 1052
           $unordered_array[] = array(
1072 1053
             $name => $value
1073 1054
           );
1074 1055
         }
1075
-      }
1076
-      else {
1056
+      } else {
1077 1057
         $unordered_array[] = array(
1078 1058
           $name => $value
1079 1059
         );
@@ -1159,8 +1139,7 @@  discard block
 block discarded – undo
1159 1139
   //  xml_to_text(): Convert an XML DOM object to string format
1160 1140
   //------------------------------------------------------------------------------------------------
1161 1141
   
1162
-  function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false)
1163
-  {
1142
+  function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false) {
1164 1143
       $xml->formatOutput = true;
1165 1144
       $text = $xml->saveXML();
1166 1145
       if (!$include_xml_declaration) {
@@ -1203,10 +1182,14 @@  discard block
 block discarded – undo
1203 1182
               $sibling = $node->nextSibling;
1204 1183
               
1205 1184
               // Determine if this node forms a set with siblings (share a node name)
1206
-              while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling;
1185
+              while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) {
1186
+                  $sibling = $sibling->nextSibling;
1187
+              }
1207 1188
               if (!$sibling) {
1208 1189
                   $sibling = $node->previousSibling;
1209
-                  while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling;
1190
+                  while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) {
1191
+                      $sibling = $sibling->previousSibling;
1192
+                  }
1210 1193
               }
1211 1194
               
1212 1195
               if ($sibling) {
@@ -1301,8 +1284,7 @@  discard block
 block discarded – undo
1301 1284
       . ' computers. Computers will be displayed when they have earned their'
1302 1285
       . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>';
1303 1286
     }
1304
-  }
1305
-  else {
1287
+  } else {
1306 1288
     $output .=  '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>';
1307 1289
     $output .=  '<p>' . bts('This user has chosen not to show information'
1308 1290
     . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>';
@@ -1462,8 +1444,7 @@  discard block
 block discarded – undo
1462 1444
     if (!$received_time) {
1463 1445
       if (time() < $deadline) {
1464 1446
         $output = '<span class="on-time">' . $output . '</span>';
1465
-      }
1466
-      else {
1447
+      } else {
1467 1448
         $output = '<span class="past-due">' . $output . '</span>';
1468 1449
       }
1469 1450
     }
@@ -1554,11 +1535,9 @@  discard block
 block discarded – undo
1554 1535
   // Use userid, hostid, or workunitid
1555 1536
   if ($category==0) {
1556 1537
     $sqlall .= "AND r.userid='%s' ";
1557
-  }
1558
-  elseif ($category==1) {
1538
+  } elseif ($category==1) {
1559 1539
     $sqlall .= "AND r.workunitid='%s' ";
1560
-  }
1561
-  elseif ($category==2) {
1540
+  } elseif ($category==2) {
1562 1541
     $sqlall .= "AND r.hostid='%s' ";
1563 1542
   }
1564 1543
   $sqlall .= "ORDER BY user_friendly_name";
@@ -1598,8 +1577,7 @@  discard block
 block discarded – undo
1598 1577
       }// if mystate
1599 1578
 
1600 1579
     }// while
1601
-  }
1602
-  else {
1580
+  } else {
1603 1581
   }
1604 1582
   
1605 1583
   // Entry for all applications.
@@ -1687,11 +1665,9 @@  discard block
 block discarded – undo
1687 1665
   // Use userid, hostid, or workunitid
1688 1666
   if ($category==0) {
1689 1667
     $sqlsub .= "AND r.userid = '%s' ";
1690
-  }
1691
-  elseif ($category==1) {
1668
+  } elseif ($category==1) {
1692 1669
     $sqlsub .= "AND r.workunitid = '%s' ";
1693
-  }
1694
-  elseif ($category==2) {
1670
+  } elseif ($category==2) {
1695 1671
     $sqlsub .= "AND r.hostid = '%s' ";
1696 1672
   }
1697 1673
 
@@ -1717,8 +1693,7 @@  discard block
 block discarded – undo
1717 1693
   if (is_numeric($app_id) AND $app_id>0 ) {
1718 1694
     $sqlsub .= " AND r.appid = '%s'";
1719 1695
     $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid, $app_id);
1720
-  }
1721
-  else {
1696
+  } else {
1722 1697
     $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid);
1723 1698
   }
1724 1699
   db_set_active('default');
@@ -1750,19 +1725,16 @@  discard block
 block discarded – undo
1750 1725
         $resultdata[] = array_values($prettyresult);
1751 1726
       }
1752 1727
     }// while
1753
-  }
1754
-  else {
1728
+  } else {
1755 1729
   }
1756 1730
   // Begin result navigation
1757 1731
 
1758 1732
   // Set pathprefix based on type
1759 1733
   if ($category==0) {
1760 1734
     $pathprefix = 'account/tasks';
1761
-  }
1762
-  elseif ($category==1) {
1735
+  } elseif ($category==1) {
1763 1736
     $pathprefix = 'workunit/' . $queryid . '/tasks';
1764
-  }
1765
-  elseif ($category==2) {
1737
+  } elseif ($category==2) {
1766 1738
     $pathprefix = 'host/' . $queryid . '/tasks';
1767 1739
   }
1768 1740
   // Need an "All" tab as well, maps to app_id of zero.
@@ -1772,8 +1744,7 @@  discard block
 block discarded – undo
1772 1744
     $mypath = $pathprefix . '/' . $state . '/' . $app_id;
1773 1745
     if ($state==STATE_ALL) {
1774 1746
       $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1775
-    }
1776
-    else {
1747
+    } else {
1777 1748
       $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1778 1749
     }
1779 1750
     $myitem = array(
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
   
168 168
   if ($preset) {
169 169
     // Load preset from configuration
170
-    $preset_prefs = (array) $preset_prefs['general_preferences'];
170
+    $preset_prefs = (array)$preset_prefs['general_preferences'];
171 171
     if (isset($preset_prefs['preset'])) {
172 172
       if (!is_numeric(key($preset_prefs['preset']))) {
173 173
         $preset_prefs['preset'] = array($preset_prefs['preset']);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 function boincwork_get_project_specific_config() {
189 189
   $raw_config_data = variable_get('boinc_project_specific_prefs_config', '');
190 190
   
191
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
191
+  $xsd = './'.drupal_get_path('module', 'boincwork').'/includes/projectprefs.xsd';
192 192
   libxml_use_internal_errors(true);
193 193
   
194 194
   $xml = new DomDocument();
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
   if (!$xml->schemaValidate($xsd)) {
197 197
     $errors = libxml_get_errors();
198 198
     $lines = explode("\r", $raw_config_data);
199
-    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
200
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
199
+    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}".
200
+      ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), 'error');
201 201
     return NULL;
202 202
   }
203 203
   
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
       
393 393
       // Use appropriate datatype
394 394
       if (isset($element['@attributes']['datatype'])) {
395
-        switch($element['@attributes']['datatype']) {
395
+        switch ($element['@attributes']['datatype']) {
396 396
         case 'integer':
397
-          $value = (int) $value;
397
+          $value = (int)$value;
398 398
           break;
399 399
           
400 400
         case 'float':
401
-          $value = number_format((float) $value, 2);
401
+          $value = number_format((float)$value, 2);
402 402
           break;
403 403
         
404 404
         default:
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         '#type' => 'textfield',
421 421
         '#default_value' => $value,
422 422
         '#size' => 5,
423
-        '#description' => $description . bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project')
423
+        '#description' => $description.bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project')
424 424
       );
425 425
     }
426 426
     break;
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
       $name = $element['@attributes']['name'];
485 485
       $default = null;
486 486
       $options = array();
487
-      foreach($element['items']['item'] as $item) {
487
+      foreach ($element['items']['item'] as $item) {
488 488
         if (is_array($item)) {
489 489
           $value = $item['@value'];
490 490
           if ($default === NULL AND
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         '#options' => $options,
527 527
         '#attributes' => array('class' => 'fancy'),
528 528
         '#default_value' => $value,
529
-        '#description' => $description . bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project')
529
+        '#description' => $description.bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project')
530 530
       );
531 531
     }
532 532
     break;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     }
592 592
     foreach ($elements as $key => $element) {
593 593
       $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
594
-      $name = str_replace(' ','_',strtolower($title));
594
+      $name = str_replace(' ', '_', strtolower($title));
595 595
       $name = "group_{$name}";
596 596
       
597 597
       // Translate elements as appropriate
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
   if ($type == 'project') {
744 744
     if ($boincuser->project_prefs) {
745 745
       $main_prefs = load_configuration($boincuser->project_prefs);
746
-      $main_prefs = (array) $main_prefs['project_preferences'];
746
+      $main_prefs = (array)$main_prefs['project_preferences'];
747 747
     }
748 748
   }
749 749
   else {
750 750
     if ($boincuser->global_prefs) {
751 751
       $main_prefs = load_configuration($boincuser->global_prefs);
752
-      $main_prefs = (array) $main_prefs['global_preferences'];
752
+      $main_prefs = (array)$main_prefs['global_preferences'];
753 753
     }
754 754
   }
755 755
   
@@ -801,13 +801,13 @@  discard block
 block discarded – undo
801 801
   if ($type == 'project') {
802 802
     if ($boincuser->project_prefs) {
803 803
       $main_prefs = load_configuration($boincuser->project_prefs);
804
-      $main_prefs = (array) $main_prefs['project_preferences'];
804
+      $main_prefs = (array)$main_prefs['project_preferences'];
805 805
     }
806 806
   }
807 807
   else {
808 808
     if ($boincuser->global_prefs) {
809 809
       $main_prefs = load_configuration($boincuser->global_prefs);
810
-      $main_prefs = (array) $main_prefs['global_preferences'];
810
+      $main_prefs = (array)$main_prefs['global_preferences'];
811 811
     }
812 812
   }
813 813
   
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
   $magnitude = 0;
997 997
   $precision = 0;
998 998
   if ($digits > $max_digits) {
999
-    $magnitude = floor(($digits - ($max_digits - 3)) / 3);
1000
-    $precision = $max_digits - ($digits - ($magnitude * 3) + 1);
1001
-    $number = round($number / pow(1000, $magnitude), $precision);
999
+    $magnitude = floor(($digits - ($max_digits - 3))/3);
1000
+    $precision = $max_digits - ($digits - ($magnitude*3) + 1);
1001
+    $number = round($number/pow(1000, $magnitude), $precision);
1002 1002
   }
1003
-  $number = number_format($number, $precision) . (($magnitude) ? "{$suffix[$magnitude]}" : '');
1003
+  $number = number_format($number, $precision).(($magnitude) ? "{$suffix[$magnitude]}" : '');
1004 1004
   
1005 1005
   return $number;
1006 1006
 }
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
   
1179 1179
   function text_to_xml($text) {
1180 1180
     $xml = new DomDocument();
1181
-    if ( !($xml->loadXML($text)) ) return false;
1181
+    if (!($xml->loadXML($text))) return false;
1182 1182
     return $xml;
1183 1183
   }
1184 1184
   
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
       while (!is_null($node)) {
1196 1196
           switch ($node->nodeType) {
1197 1197
           case XML_TEXT_NODE:
1198
-              if (trim($node->nodeValue)  != '') $result = $node->nodeValue;
1198
+              if (trim($node->nodeValue) != '') $result = $node->nodeValue;
1199 1199
               break;
1200 1200
           case XML_ELEMENT_NODE:
1201 1201
               $node_name = $node->nodeName;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
               if ($sibling) {
1213 1213
                   $result[$node_name][$index] = '';
1214 1214
                   if ($node->childNodes) {
1215
-                      $result[$node_name][$index] = xml_to_array($node) ;
1215
+                      $result[$node_name][$index] = xml_to_array($node);
1216 1216
                   }
1217 1217
                   if ($node->hasAttributes()) {
1218 1218
                       $attributes = $node->attributes;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
               } else {
1236 1236
                   $result[$node_name] = '';
1237 1237
                   if ($node->childNodes) {
1238
-                      $result[$node_name] = xml_to_array($node) ;
1238
+                      $result[$node_name] = xml_to_array($node);
1239 1239
                   }
1240 1240
                   if ($node->hasAttributes()) {
1241 1241
                       $attributes = $node->attributes;
1242 1242
                       if ($result[$node_name] !== '' AND !is_array($result[$node_name])) {
1243 1243
                           $result[$node_name] = array('@value' => $result[$node_name]);
1244 1244
                       }
1245
-                      foreach($attributes as $key => $attribute) {
1245
+                      foreach ($attributes as $key => $attribute) {
1246 1246
                           $result[$node_name]['@attributes'][$attribute->name] = $attribute->value;
1247 1247
                       }
1248 1248
                   }
@@ -1282,30 +1282,30 @@  discard block
 block discarded – undo
1282 1282
   // Determine if hosts are associated at all or just hidden
1283 1283
   $output = '';
1284 1284
   if ($boincuser->show_hosts) {
1285
-    switch($context) {
1285
+    switch ($context) {
1286 1286
     case 'active':
1287
-      $output .=  '<h2>' . bts('No active computers', array(), NULL, 'boinc:host-list') . '</h2>';
1288
-      $output .=  '<p>' . bts('This user has no computers that have been'
1289
-      . ' active in the last 30 days.', array(), NULL, 'boinc:host-list') . '</p>';
1287
+      $output .= '<h2>'.bts('No active computers', array(), NULL, 'boinc:host-list').'</h2>';
1288
+      $output .= '<p>'.bts('This user has no computers that have been'
1289
+      . ' active in the last 30 days.', array(), NULL, 'boinc:host-list').'</p>';
1290 1290
       break;
1291 1291
       
1292 1292
     case 'preferences':
1293
-      $output .=  '<h2>' . bts('No computers', array(), NULL, 'boinc:host-list') . '</h2>';
1294
-      $output .=  '<p>' . bts('There are no computers assigned to this'
1295
-      . ' preference set.', array(), NULL, 'boinc:host-list') . '</p>';
1293
+      $output .= '<h2>'.bts('No computers', array(), NULL, 'boinc:host-list').'</h2>';
1294
+      $output .= '<p>'.bts('There are no computers assigned to this'
1295
+      . ' preference set.', array(), NULL, 'boinc:host-list').'</p>';
1296 1296
       break;
1297 1297
     
1298 1298
     default:
1299
-      $output .=  '<h2>' . bts('Computers pending', array(), NULL, 'boinc:host-list') . '</h2>';
1300
-      $output .=  '<p>' . bts('This user does not yet have any associated'
1299
+      $output .= '<h2>'.bts('Computers pending', array(), NULL, 'boinc:host-list').'</h2>';
1300
+      $output .= '<p>'.bts('This user does not yet have any associated'
1301 1301
       . ' computers. Computers will be displayed when they have earned their'
1302
-      . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>';
1302
+      . ' first credits.', array(), NULL, 'boinc:host-list').'</p>';
1303 1303
     }
1304 1304
   }
1305 1305
   else {
1306
-    $output .=  '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>';
1307
-    $output .=  '<p>' . bts('This user has chosen not to show information'
1308
-    . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>';
1306
+    $output .= '<h2>'.bts('Computers hidden', array(), NULL, 'boinc:host-list').'</h2>';
1307
+    $output .= '<p>'.bts('This user has chosen not to show information'
1308
+    . ' about their computers.', array(), NULL, 'boinc:host-list').'</p>';
1309 1309
   }
1310 1310
   return $output;
1311 1311
 }
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
   
1318 1318
   // 
1319 1319
   $output = '';
1320
-  switch($context) {
1320
+  switch ($context) {
1321 1321
   default:
1322
-    $output .=  '<h2>' . bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list')
1322
+    $output .= '<h2>'.bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list')
1323 1323
     . '</h2>';
1324
-    $output .=  '<p>' . bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list')
1324
+    $output .= '<p>'.bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list')
1325 1325
     . '</p>';
1326 1326
   }
1327 1327
   return $output;
@@ -1343,10 +1343,10 @@  discard block
 block discarded – undo
1343 1343
       $output .= l(bts('Delete', array(), NULL, 'boinc:form-delete'), "host/{$host_id}/delete",
1344 1344
         array(
1345 1345
           'attributes' => array(
1346
-            'onclick' => 'return confirm(\'' . bts('This will delete host @id'
1346
+            'onclick' => 'return confirm(\''.bts('This will delete host @id'
1347 1347
               . ' from your account forever. Are you sure this is OK?',
1348 1348
               array('@id' => $host_id),
1349
-              NULL, 'boinc:account-host-delete') . '\')'
1349
+              NULL, 'boinc:account-host-delete').'\')'
1350 1350
           )
1351 1351
         )
1352 1352
       );
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
       "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location')
1437 1437
     );
1438 1438
     variable_set('jump_use_js_venues-Array', 1);
1439
-    drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
1440
-    drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
1439
+    drupal_add_js(drupal_get_path('module', 'jump').'/jump.js');
1440
+    drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme');
1441 1441
     // Get current venue
1442 1442
     db_set_active('boinc');
1443 1443
     $venue = db_result(db_query(
@@ -1461,10 +1461,10 @@  discard block
 block discarded – undo
1461 1461
     // Add a wrapper to deadline text
1462 1462
     if (!$received_time) {
1463 1463
       if (time() < $deadline) {
1464
-        $output = '<span class="on-time">' . $output . '</span>';
1464
+        $output = '<span class="on-time">'.$output.'</span>';
1465 1465
       }
1466 1466
       else {
1467
-        $output = '<span class="past-due">' . $output . '</span>';
1467
+        $output = '<span class="past-due">'.$output.'</span>';
1468 1468
       }
1469 1469
     }
1470 1470
   }
@@ -1498,15 +1498,15 @@  discard block
 block discarded – undo
1498 1498
  */
1499 1499
 function boincwork_tasktable($category = 0, $queryid = 1, $tselect = NULL, $app_id = 0) {
1500 1500
   // Check type parameter, if not (0,2) then return an error.
1501
-  if ( ($category!=0) AND ($category!=1) AND ($category!=2) ) {
1501
+  if (($category != 0) AND ($category != 1) AND ($category != 2)) {
1502 1502
     watchdog('boincwork', 'task table called with invalid category = %category', array('%category' => $category), WATCHDOG_WARNING);
1503 1503
     return '';
1504 1504
   }
1505 1505
 
1506
-  require_boinc( array('util', 'result') );
1506
+  require_boinc(array('util', 'result'));
1507 1507
 
1508 1508
   global $language;
1509
-  $locality=$language->language;
1509
+  $locality = $language->language;
1510 1510
   $nf = new NumberFormatter($locality, NumberFormatter::DECIMAL);
1511 1511
   $nf->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 0);
1512 1512
   $nf->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 0);
@@ -1554,13 +1554,13 @@  discard block
 block discarded – undo
1554 1554
       ."ON r.appid=a.id ";
1555 1555
 
1556 1556
   // Use userid, hostid, or workunitid
1557
-  if ($category==0) {
1557
+  if ($category == 0) {
1558 1558
     $sqlall .= "AND r.userid='%s' ";
1559 1559
   }
1560
-  elseif ($category==1) {
1560
+  elseif ($category == 1) {
1561 1561
     $sqlall .= "AND r.workunitid='%s' ";
1562 1562
   }
1563
-  elseif ($category==2) {
1563
+  elseif ($category == 2) {
1564 1564
     $sqlall .= "AND r.hostid='%s' ";
1565 1565
   }
1566 1566
   $sqlall .= "ORDER BY user_friendly_name";
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
   if ($dbres_all) {
1572 1572
     while ($result = db_fetch_object($dbres_all)) {
1573 1573
       $mystate = state_num($result);
1574
-      if ( ($result->appid==$app_id) OR ($app_id==0) OR ($app_id==-1) ) {
1574
+      if (($result->appid == $app_id) OR ($app_id == 0) OR ($app_id == -1)) {
1575 1575
         $taskstates[STATE_ALL]++;
1576 1576
         switch ($mystate) {
1577 1577
         case STATE_IN_PROGRESS:
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 
1595 1595
       //map holds a map between app ids and user friendly names for all applications.
1596 1596
       $application_map[$result->appid] = $result->user_friendly_name;
1597
-      if ( ($mystate == $tselect) OR ($tselect==STATE_ALL) ) {
1597
+      if (($mystate == $tselect) OR ($tselect == STATE_ALL)) {
1598 1598
         //count of appids in the results.
1599 1599
         $application_select_count[$result->appid]++;
1600 1600
       }// if mystate
@@ -1607,14 +1607,14 @@  discard block
 block discarded – undo
1607 1607
   // Entry for all applications.
1608 1608
   $allcount = $application_select_count ? array_sum($application_select_count) : 0;
1609 1609
   $applications[-1] = bts('Application', array(), NULL, 'boinc:task-table');
1610
-  $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table') . ' (' . $allcount . ')';
1610
+  $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table').' ('.$allcount.')';
1611 1611
   // Create application filter from application_map and application_select_count.
1612
-  foreach($application_map as $akey => $aname) {
1612
+  foreach ($application_map as $akey => $aname) {
1613 1613
     $acount = 0;
1614
-    if ( $application_select_count and array_key_exists($akey, $application_select_count) ) {
1614
+    if ($application_select_count and array_key_exists($akey, $application_select_count)) {
1615 1615
       $acount = $application_select_count[$akey];
1616 1616
     }
1617
-    $applications[$akey] = $aname . ' ('. $acount . ')';
1617
+    $applications[$akey] = $aname.' ('.$acount.')';
1618 1618
   }
1619 1619
   // Header array for (sub) results table.
1620 1620
   $resultheader = array(
@@ -1687,13 +1687,13 @@  discard block
 block discarded – undo
1687 1687
       ."ON av.platformid=pl.id ";
1688 1688
 
1689 1689
   // Use userid, hostid, or workunitid
1690
-  if ($category==0) {
1690
+  if ($category == 0) {
1691 1691
     $sqlsub .= "AND r.userid = '%s' ";
1692 1692
   }
1693
-  elseif ($category==1) {
1693
+  elseif ($category == 1) {
1694 1694
     $sqlsub .= "AND r.workunitid = '%s' ";
1695 1695
   }
1696
-  elseif ($category==2) {
1696
+  elseif ($category == 2) {
1697 1697
     $sqlsub .= "AND r.hostid = '%s' ";
1698 1698
   }
1699 1699
 
@@ -1716,12 +1716,12 @@  discard block
 block discarded – undo
1716 1716
     break;
1717 1717
   }
1718 1718
 
1719
-  if (is_numeric($app_id) AND $app_id>0 ) {
1719
+  if (is_numeric($app_id) AND $app_id > 0) {
1720 1720
     $sqlsub .= " AND r.appid = '%s'";
1721
-    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid, $app_id);
1721
+    $dbres_sub = pager_query($sqlsub.tablesort_sql($resultheader), 20, 0, NULL, $queryid, $app_id);
1722 1722
   }
1723 1723
   else {
1724
-    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid);
1724
+    $dbres_sub = pager_query($sqlsub.tablesort_sql($resultheader), 20, 0, NULL, $queryid);
1725 1725
   }
1726 1726
   db_set_active('default');
1727 1727
 
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
   if ($dbres_sub) {
1730 1730
     while ($result = db_fetch_object($dbres_sub)) {
1731 1731
       // check if state matches selection
1732
-      if ( (state_num($result) == $tselect) OR ($tselect==STATE_ALL) ) {
1732
+      if ((state_num($result) == $tselect) OR ($tselect == STATE_ALL)) {
1733 1733
         // create pretty result row
1734 1734
         $prettyresult = array(
1735 1735
           array(
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
           $nf->format($result->cpu_time),
1746 1746
           $nf->format($result->granted_credit),
1747 1747
           array(
1748
-            'data' => $result->user_friendly_name . " " . pretty_application_version($result->version_number, $result->plan_class, $result->platform),
1748
+            'data' => $result->user_friendly_name." ".pretty_application_version($result->version_number, $result->plan_class, $result->platform),
1749 1749
             'class' => 'task-app',
1750 1750
           ),
1751 1751
         );
@@ -1758,54 +1758,54 @@  discard block
 block discarded – undo
1758 1758
   // Begin result navigation
1759 1759
 
1760 1760
   // Set pathprefix based on type
1761
-  if ($category==0) {
1761
+  if ($category == 0) {
1762 1762
     $pathprefix = 'account/tasks';
1763 1763
   }
1764
-  elseif ($category==1) {
1765
-    $pathprefix = 'workunit/' . $queryid . '/tasks';
1764
+  elseif ($category == 1) {
1765
+    $pathprefix = 'workunit/'.$queryid.'/tasks';
1766 1766
   }
1767
-  elseif ($category==2) {
1768
-    $pathprefix = 'host/' . $queryid . '/tasks';
1767
+  elseif ($category == 2) {
1768
+    $pathprefix = 'host/'.$queryid.'/tasks';
1769 1769
   }
1770 1770
   // Need an "All" tab as well, maps to app_id of zero.
1771 1771
   $application_map[0] = bts('All', array(), NULL, 'boinc:task-table');
1772 1772
   $stitems = array();
1773 1773
   foreach ($taskstates as $state => $numstates) {
1774
-    $mypath = $pathprefix . '/' . $state . '/' . $app_id;
1775
-    if ($state==STATE_ALL) {
1776
-      $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1774
+    $mypath = $pathprefix.'/'.$state.'/'.$app_id;
1775
+    if ($state == STATE_ALL) {
1776
+      $ltext = '<span class="tab task-app-name">'.bts('All', array(), NULL, 'boinc:task-table').' ('.$numstates.')</span>';
1777 1777
     }
1778 1778
     else {
1779
-      $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1779
+      $ltext = '<span class="tab">'.bts($state_hnames[$state], array(), NULL, 'boinc:task-table').' ('.$numstates.')</span>';
1780 1780
     }
1781 1781
     $myitem = array(
1782
-      'data' => l($ltext, $mypath, array('html' => TRUE) ),
1782
+      'data' => l($ltext, $mypath, array('html' => TRUE)),
1783 1783
     );
1784
-    if ($state==$tselect) {
1784
+    if ($state == $tselect) {
1785 1785
       $myitem['class'] = 'active';
1786 1786
     }
1787 1787
     $stitems[] = $myitem;
1788 1788
   }
1789 1789
   // Add reset button
1790
-  $mypath = $pathprefix . '/0/0';
1791
-  $ltext = '<span class="tab">' . bts('Reset', array(), NULL, 'boinc:task-table') . '</span>';
1792
-  $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => TRUE) ) );
1790
+  $mypath = $pathprefix.'/0/0';
1791
+  $ltext = '<span class="tab">'.bts('Reset', array(), NULL, 'boinc:task-table').'</span>';
1792
+  $stitems[] = array('data' => l($ltext, $mypath, array('html' => TRUE)));
1793 1793
 
1794
-  $output .= theme_item_list($stitems, $title = NULL, $type='ul'. $attributes=' class="tabs secondary clearfix"');
1794
+  $output .= theme_item_list($stitems, $title = NULL, $type = 'ul'.$attributes = ' class="tabs secondary clearfix"');
1795 1795
 
1796 1796
   // Application select-drop down form
1797 1797
   // Hack to place Application form into header
1798 1798
   // App ID of zero maps to "-1" for drop-down box.
1799
-  if ($app_id==0) {
1800
-    $app_id=-1;
1799
+  if ($app_id == 0) {
1800
+    $app_id = -1;
1801 1801
   }
1802 1802
   $resultheader[] = drupal_get_form('boincwork_selectapp_form', $applications, $app_id);
1803 1803
 
1804 1804
   // Begin table of results
1805
-  if ( is_array($resultheader) AND is_array($resultdata) ) {
1805
+  if (is_array($resultheader) AND is_array($resultdata)) {
1806 1806
 
1807 1807
     // Take advantage of the fact that $category is the same as the row/column we want to remove.
1808
-    if ( ($category==1) OR ($category==2) ) {
1808
+    if (($category == 1) OR ($category == 2)) {
1809 1809
       unset($resultheader[$category]);
1810 1810
       delete_col($resultdata, $category);
1811 1811
     }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
  * Function to delete a column from an array.
1823 1823
  */
1824 1824
 function delete_col(&$array, $offset) {
1825
-  return array_walk($array, function (&$v) use ($offset) {
1825
+  return array_walk($array, function(&$v) use ($offset) {
1826 1826
      array_splice($v, $offset, 1);
1827 1827
   });
1828 1828
 }
Please login to merge, or discard this patch.
Indentation   +804 added lines, -804 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
  * that was selected
12 12
  */
13 13
 function boincwork_ahah_helper_venue_submit($form, &$form_state) {
14
-  $form_state['storage']['prefs']['preset'] = null;
15
-  ahah_helper_generic_submit($form, $form_state);
14
+    $form_state['storage']['prefs']['preset'] = null;
15
+    ahah_helper_generic_submit($form, $form_state);
16 16
 }
17 17
 
18 18
 /**
19 19
  * Get a predetermined set of preferences
20 20
  */
21 21
 function boincwork_get_preset_prefs($preset = null) {
22
-  $saved_state = variable_get('boincwork_preset_prefs', null);
22
+    $saved_state = variable_get('boincwork_preset_prefs', null);
23 23
   
24
-  // If not configured yet, use these values as for inital
25
-  // computing/general preferences.
26
-  if (!$saved_state) {
24
+    // If not configured yet, use these values as for inital
25
+    // computing/general preferences.
26
+    if (!$saved_state) {
27 27
     // Get BOINC project disk space configurations from config.xml to
28 28
     // fill in initial preference values.
29 29
     require_boinc(array('db', 'prefs'));
@@ -160,88 +160,88 @@  discard block
 block discarded – undo
160 160
           <dont_verify_images>0</dont_verify_images>
161 161
         </preset>
162 162
       </general_preferences>';
163
-  }
163
+    }
164 164
   
165
-  // Convert XML data to array format
166
-  $preset_prefs = load_configuration($saved_state);
165
+    // Convert XML data to array format
166
+    $preset_prefs = load_configuration($saved_state);
167 167
   
168
-  if ($preset) {
168
+    if ($preset) {
169 169
     // Load preset from configuration
170 170
     $preset_prefs = (array) $preset_prefs['general_preferences'];
171 171
     if (isset($preset_prefs['preset'])) {
172
-      if (!is_numeric(key($preset_prefs['preset']))) {
172
+        if (!is_numeric(key($preset_prefs['preset']))) {
173 173
         $preset_prefs['preset'] = array($preset_prefs['preset']);
174
-      }
175
-      foreach ($preset_prefs['preset'] as $key => $prefs) {
174
+        }
175
+        foreach ($preset_prefs['preset'] as $key => $prefs) {
176 176
         if (isset($prefs['@attributes']['name']) AND $prefs['@attributes']['name'] == $preset) {
177
-          return $preset_prefs['preset'][$key];
177
+            return $preset_prefs['preset'][$key];
178
+        }
178 179
         }
179
-      }
180 180
     }
181
-  }
182
-  return $preset_prefs;
181
+    }
182
+    return $preset_prefs;
183 183
 }
184 184
 
185 185
 /**
186 186
  * Load (and validate) the project specific configuration XML
187 187
  */
188 188
 function boincwork_get_project_specific_config() {
189
-  $raw_config_data = variable_get('boinc_project_specific_prefs_config', '');
189
+    $raw_config_data = variable_get('boinc_project_specific_prefs_config', '');
190 190
   
191
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
192
-  libxml_use_internal_errors(true);
191
+    $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
192
+    libxml_use_internal_errors(true);
193 193
   
194
-  $xml = new DomDocument();
195
-  $xml->loadXML($raw_config_data, LIBXML_NOBLANKS);
196
-  if (!$xml->schemaValidate($xsd)) {
194
+    $xml = new DomDocument();
195
+    $xml->loadXML($raw_config_data, LIBXML_NOBLANKS);
196
+    if (!$xml->schemaValidate($xsd)) {
197 197
     $errors = libxml_get_errors();
198 198
     $lines = explode("\r", $raw_config_data);
199 199
     drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
200
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
200
+        ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
201 201
     return NULL;
202
-  }
202
+    }
203 203
   
204
-  // Convert XML to array for validation
205
-  $xml = load_configuration($raw_config_data);
206
-  return $xml;
204
+    // Convert XML to array for validation
205
+    $xml = load_configuration($raw_config_data);
206
+    return $xml;
207 207
 }
208 208
 
209 209
 /**
210 210
  * Get rules by which to validate project specific data
211 211
  */
212 212
 function boincwork_get_project_specific_config_validation_rules($xml = array()) {
213
-  $rules = array();
214
-  if (!$xml) {
213
+    $rules = array();
214
+    if (!$xml) {
215 215
     // Read the config XML
216 216
     $xml = boincwork_get_project_specific_config();
217 217
     $xml = $xml['project_specific_preferences'];
218
-  }
219
-  foreach ($xml as $type => $elements) {
218
+    }
219
+    foreach ($xml as $type => $elements) {
220 220
     if (is_array($elements) AND !is_numeric(key($elements))) {
221
-      $elements = array($elements);
221
+        $elements = array($elements);
222 222
     }
223 223
     switch ($type) {
224 224
     case 'compound':
225 225
       foreach ($elements as $element) {
226 226
         $name = $element['@attributes']['name'];
227 227
         $rules[$name] = boincwork_get_project_specific_config_validation_rules($element['attributes']);
228
-      }
229
-      break;
228
+        }
229
+        break;
230 230
       
231 231
     case 'text':
232 232
       foreach ($elements as $element) {
233 233
         $name = $element['@attributes']['name'];
234 234
         $rules[$name] = array(
235
-          'datatype' => $element['@attributes']['datatype']
235
+            'datatype' => $element['@attributes']['datatype']
236 236
         );
237 237
         if (isset($element['@attributes']['min'])) {
238
-          $rules[$name]['min'] = $element['@attributes']['min'];
238
+            $rules[$name]['min'] = $element['@attributes']['min'];
239 239
         }
240 240
         if (isset($element['@attributes']['max'])) {
241
-          $rules[$name]['max'] = $element['@attributes']['max'];
241
+            $rules[$name]['max'] = $element['@attributes']['max'];
242 242
         }
243
-      }
244
-      break;
243
+        }
244
+        break;
245 245
     /*
246 246
     case 'radio':
247 247
     case 'dropdown':
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
       $rules['apps'] = array(
266 266
         'minimum selected' => 1,
267 267
         'list' => array()
268
-      );
269
-      foreach ($elements as $element) {
268
+        );
269
+        foreach ($elements as $element) {
270 270
         foreach ($element['app'] as $app) {
271
-          $name = "app_{$app['@attributes']['id']}";
272
-          $rules['apps']['list'][] = $name;
273
-          //$rules[$name] = array(
274
-          //  'options' => $options
275
-          //);
271
+            $name = "app_{$app['@attributes']['id']}";
272
+            $rules['apps']['list'][] = $name;
273
+            //$rules[$name] = array(
274
+            //  'options' => $options
275
+            //);
276 276
         }
277
-      }
278
-      break;
277
+        }
278
+        break;
279 279
       
280 280
     case 'group':
281 281
       foreach ($elements as $element) {
282 282
         $name = $element['@attributes']['name'];
283 283
         $rules += boincwork_get_project_specific_config_validation_rules($element);
284
-      }
285
-      break;
284
+        }
285
+        break;
286 286
     /*
287 287
     case 'boolean':
288 288
       // Shouldn't need to validate boolean...
@@ -290,39 +290,39 @@  discard block
 block discarded – undo
290 290
       */
291 291
     default:
292 292
     }
293
-  }
294
-  return $rules;
293
+    }
294
+    return $rules;
295 295
 }
296 296
 
297 297
 /**
298 298
  * Define how project specific settings should be saved
299 299
  */
300 300
 function boincwork_format_project_specific_prefs_data($values, $xml = array()) {
301
-  $defaults = array();
302
-  if (!$xml) {
301
+    $defaults = array();
302
+    if (!$xml) {
303 303
     // Read the config XML
304 304
     $xml = boincwork_get_project_specific_config();
305 305
     $xml = $xml['project_specific_preferences'];
306
-  }
307
-  foreach ($xml as $type => $elements) {
306
+    }
307
+    foreach ($xml as $type => $elements) {
308 308
     $structure_data = array();
309 309
     if (is_array($elements) AND !is_numeric(key($elements))) {
310
-      $elements = array($elements);
310
+        $elements = array($elements);
311 311
     }
312 312
     switch ($type) {
313 313
     case 'compound':
314 314
       foreach ($elements as $element) {
315 315
         $name = $element['@attributes']['name'];
316 316
         $default[$name]['@attributes'] = boincwork_format_project_specific_prefs_data($values[$name], $element['attributes']);
317
-      }
318
-      $defaults += $default;
319
-      break;
317
+        }
318
+        $defaults += $default;
319
+        break;
320 320
       
321 321
     case 'group':
322 322
       foreach ($elements as $element) {
323 323
         $defaults += boincwork_format_project_specific_prefs_data($values, $element);
324
-      }
325
-      break;
324
+        }
325
+        break;
326 326
       
327 327
     case 'text':
328 328
     case 'radio':
@@ -331,315 +331,315 @@  discard block
 block discarded – undo
331 331
       foreach ($elements as $element) {
332 332
         $name = $element['@attributes']['name'];
333 333
         if (isset($element['@attributes']['entitytype']) AND $element['@attributes']['entitytype'] == 'attribute') {
334
-          $defaults['@attributes'][$name] = $values[$name];
334
+            $defaults['@attributes'][$name] = $values[$name];
335 335
         }
336 336
         else {
337
-          $defaults[$name] = $values[$name];
337
+            $defaults[$name] = $values[$name];
338 338
         }
339
-      }
340
-      break;
339
+        }
340
+        break;
341 341
     
342 342
     case 'apps':
343 343
       foreach ($elements as $element) {
344 344
         $defaults['app_id'] = array();
345 345
         foreach ($element['app'] as $app) {
346
-          $app_id = $app['@attributes']['id'];
347
-          if ($values['applications']["app_{$app_id}"]) {
346
+            $app_id = $app['@attributes']['id'];
347
+            if ($values['applications']["app_{$app_id}"]) {
348 348
             $defaults['app_id'][] = $app_id;
349
-          }
349
+            }
350 350
         }
351
-      }
352
-      break;
351
+        }
352
+        break;
353 353
       
354 354
     default:
355 355
     }
356
-  }
357
-  return $defaults;
356
+    }
357
+    return $defaults;
358 358
 }
359 359
 
360 360
 /**
361 361
  * Add an element to the form based on its definition
362 362
  */
363 363
 function boincwork_generate_prefs_element(&$form, $type, $elements, $user_prefs = null) {
364
-  switch ($type) {
365
-  case 'text':
364
+    switch ($type) {
365
+    case 'text':
366 366
     if (!is_numeric(key($elements))) {
367
-      $elements = array($elements);
367
+        $elements = array($elements);
368 368
     }
369 369
     foreach ($elements as $element) {
370
-      $name = $element['@attributes']['name'];
371
-      $default = $element['@attributes']['default'];
372
-      $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
373
-      $description = '';
374
-      if (isset($element['description'])) {
370
+        $name = $element['@attributes']['name'];
371
+        $default = $element['@attributes']['default'];
372
+        $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
373
+        $description = '';
374
+        if (isset($element['description'])) {
375 375
         $description = is_array($element['description']) ? $element['description']['@value'] : $element['description'];
376
-      }
376
+        }
377 377
       
378
-      $value = $default;
379
-      $user_pref = $user_prefs;
380
-      $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
381
-      if ($entitytype == 'attribute') {
378
+        $value = $default;
379
+        $user_pref = $user_prefs;
380
+        $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
381
+        if ($entitytype == 'attribute') {
382 382
         $user_pref = $user_prefs['@attributes'];
383
-      }
384
-      if (isset($user_pref[$name])) {
383
+        }
384
+        if (isset($user_pref[$name])) {
385 385
         if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
386
-          $value = $user_pref[$name]['@value'];
386
+            $value = $user_pref[$name]['@value'];
387 387
         }
388 388
         else {
389
-          $value = $user_pref[$name];
389
+            $value = $user_pref[$name];
390
+        }
390 391
         }
391
-      }
392 392
       
393
-      // Use appropriate datatype
394
-      if (isset($element['@attributes']['datatype'])) {
393
+        // Use appropriate datatype
394
+        if (isset($element['@attributes']['datatype'])) {
395 395
         switch($element['@attributes']['datatype']) {
396 396
         case 'integer':
397 397
           $value = (int) $value;
398
-          break;
398
+            break;
399 399
           
400 400
         case 'float':
401 401
           $value = number_format((float) $value, 2);
402
-          break;
402
+            break;
403 403
         
404 404
         default:
405 405
         }
406
-      }
406
+        }
407 407
       
408
-      // Translate elements as appropriate
409
-      if ($title) {
408
+        // Translate elements as appropriate
409
+        if ($title) {
410 410
         i18nstrings_update('project:prefs_xml', $title);
411 411
         $title = i18nstrings('project:prefs_xml', $title);
412
-      }
413
-      if ($description) {
412
+        }
413
+        if ($description) {
414 414
         i18nstrings_update('project:prefs_xml', $description);
415 415
         $description = i18nstrings('project:prefs_xml', $description);
416
-      }
416
+        }
417 417
       
418
-      $form[$name] = array(
418
+        $form[$name] = array(
419 419
         '#title' => $title,
420 420
         '#type' => 'textfield',
421 421
         '#default_value' => $value,
422 422
         '#size' => 5,
423 423
         '#description' => $description . bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project')
424
-      );
424
+        );
425 425
     }
426 426
     break;
427 427
     
428
-  case 'boolean':
428
+    case 'boolean':
429 429
     if (!is_numeric(key($elements))) {
430
-      $elements = array($elements);
430
+        $elements = array($elements);
431 431
     }
432 432
     foreach ($elements as $element) {
433
-      $name = $element['@attributes']['name'];
434
-      $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
435
-      $default = (isset($element['@attributes']['selected']) AND $element['@attributes']['selected'] == 'true') ? 1 : 0;
436
-      $description = '';
437
-      if (isset($element['description'])) {
433
+        $name = $element['@attributes']['name'];
434
+        $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
435
+        $default = (isset($element['@attributes']['selected']) AND $element['@attributes']['selected'] == 'true') ? 1 : 0;
436
+        $description = '';
437
+        if (isset($element['description'])) {
438 438
         $description = is_array($element['description']) ? $element['description']['@value'] : $element['description'];
439
-      }
439
+        }
440 440
       
441
-      $value = $default;
442
-      $user_pref = $user_prefs;
443
-      $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
444
-      if ($entitytype == 'attribute') {
441
+        $value = $default;
442
+        $user_pref = $user_prefs;
443
+        $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
444
+        if ($entitytype == 'attribute') {
445 445
         $user_pref = $user_prefs['@attributes'];
446
-      }
447
-      if (isset($user_pref[$name])) {
446
+        }
447
+        if (isset($user_pref[$name])) {
448 448
         if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
449
-          $value = $user_pref[$name]['@value'];
449
+            $value = $user_pref[$name]['@value'];
450 450
         }
451 451
         else {
452
-          $value = $user_pref[$name];
452
+            $value = $user_pref[$name];
453
+        }
453 454
         }
454
-      }
455 455
       
456
-      // Translate elements as appropriate
457
-      if ($title) {
456
+        // Translate elements as appropriate
457
+        if ($title) {
458 458
         i18nstrings_update('project:prefs_xml', $title);
459 459
         $title = i18nstrings('project:prefs_xml', $title);
460
-      }
461
-      if ($description) {
460
+        }
461
+        if ($description) {
462 462
         i18nstrings_update('project:prefs_xml', $description);
463 463
         $description = i18nstrings('project:prefs_xml', $description);
464
-      }
464
+        }
465 465
       
466
-      $form[$name] = array(
466
+        $form[$name] = array(
467 467
         '#title' => $title,
468 468
         '#type' => 'radios',
469 469
         '#options' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')),
470 470
         '#attributes' => array('class' => 'fancy'),
471 471
         '#default_value' => $value,
472 472
         '#description' => $description
473
-      );
473
+        );
474 474
     }
475 475
     break;
476 476
     
477
-  case 'radio':
477
+    case 'radio':
478 478
   case 'dropdown':
479 479
     
480 480
     if (!is_numeric(key($elements))) {
481
-      $elements = array($elements);
481
+        $elements = array($elements);
482 482
     }
483 483
     foreach ($elements as $element) {
484
-      $name = $element['@attributes']['name'];
485
-      $default = null;
486
-      $options = array();
487
-      foreach($element['items']['item'] as $item) {
484
+        $name = $element['@attributes']['name'];
485
+        $default = null;
486
+        $options = array();
487
+        foreach($element['items']['item'] as $item) {
488 488
         if (is_array($item)) {
489
-          $value = $item['@value'];
490
-          if ($default === NULL AND
489
+            $value = $item['@value'];
490
+            if ($default === NULL AND
491 491
               isset($item['@attributes']) AND
492 492
               isset($item['@attributes']['selected'])) {
493 493
             $default = ($item['@attributes']['selected'] == 'true') ? $item['@value'] : null;
494
-          }
494
+            }
495 495
         }
496 496
         else {
497
-          $value = $item;
497
+            $value = $item;
498 498
         }
499 499
         $options[$value] = $value;
500
-      }
501
-      $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
502
-      $description = '';
503
-      if (isset($element['description'])) {
500
+        }
501
+        $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
502
+        $description = '';
503
+        if (isset($element['description'])) {
504 504
         $description = is_array($element['description']) ? $element['description']['@value'] : $element['description'];
505
-      }
506
-      $user_pref = $user_prefs;
507
-      $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
508
-      if ($entitytype == 'attribute') {
505
+        }
506
+        $user_pref = $user_prefs;
507
+        $entitytype = isset($element['@attributes']['entitytype']) ? $element['@attributes']['entitytype'] : 'element';
508
+        if ($entitytype == 'attribute') {
509 509
         $user_pref = $user_prefs['@attributes'];
510
-      }
511
-      $value = isset($user_pref[$name]) ? $user_pref[$name] : $default;
510
+        }
511
+        $value = isset($user_pref[$name]) ? $user_pref[$name] : $default;
512 512
       
513
-      // Translate elements as appropriate
514
-      if ($title) {
513
+        // Translate elements as appropriate
514
+        if ($title) {
515 515
         i18nstrings_update('project:prefs_xml', $title);
516 516
         $title = i18nstrings('project:prefs_xml', $title);
517
-      }
518
-      if ($description) {
517
+        }
518
+        if ($description) {
519 519
         i18nstrings_update('project:prefs_xml', $description);
520 520
         $description = i18nstrings('project:prefs_xml', $description);
521
-      }
521
+        }
522 522
       
523
-      $form[$name] = array(
523
+        $form[$name] = array(
524 524
         '#title' => $title,
525 525
         '#type' => ($type == 'radio') ? 'radios' : 'select',
526 526
         '#options' => $options,
527 527
         '#attributes' => array('class' => 'fancy'),
528 528
         '#default_value' => $value,
529 529
         '#description' => $description . bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project')
530
-      );
530
+        );
531 531
     }
532 532
     break;
533 533
     
534
-  case 'apps':
534
+    case 'apps':
535 535
     $title = is_array($elements['title']) ? $elements['title']['@value'] : $elements['title'];
536 536
     
537
-      // Translate elements as appropriate
538
-      if ($title) {
537
+        // Translate elements as appropriate
538
+        if ($title) {
539 539
         i18nstrings_update('project:prefs_xml', $title);
540 540
         $title = i18nstrings('project:prefs_xml', $title);
541
-      }
541
+        }
542 542
     
543 543
     $form['applications'] = array(
544
-      '#title' => bts('Applications', array(), NULL, 'boinc:account-preferences'),
545
-      '#type' => 'fieldset',
546
-      '#description' => $title,
547
-      '#collapsible' => TRUE,
548
-      '#collapsed' => FALSE
544
+        '#title' => bts('Applications', array(), NULL, 'boinc:account-preferences'),
545
+        '#type' => 'fieldset',
546
+        '#description' => $title,
547
+        '#collapsible' => TRUE,
548
+        '#collapsed' => FALSE
549 549
     );
550 550
     $applications = array();
551 551
     if (!is_array($user_prefs['app_id'])) {
552
-      $user_prefs['app_id'] = array($user_prefs['app_id']);
552
+        $user_prefs['app_id'] = array($user_prefs['app_id']);
553 553
     }
554 554
     foreach ($user_prefs['app_id'] as $app) {
555
-      if (!$app) continue;
556
-      if (is_array($app) AND isset($app['@value'])) {
555
+        if (!$app) continue;
556
+        if (is_array($app) AND isset($app['@value'])) {
557 557
         $app = $app['@value'];
558
-      }
559
-      $applications[] = $app;
558
+        }
559
+        $applications[] = $app;
560 560
     }
561 561
     foreach ($elements['app'] as $app) {
562
-      $app_id = $app['@attributes']['id'];
563
-      $app_name = $app['@value'];
564
-      $app_enabled = TRUE;
565
-      if (isset($app['@attributes']['enabled']) AND
562
+        $app_id = $app['@attributes']['id'];
563
+        $app_name = $app['@value'];
564
+        $app_enabled = TRUE;
565
+        if (isset($app['@attributes']['enabled']) AND
566 566
           $app['@attributes']['enabled'] == 'false') {
567 567
         $app_enabled = FALSE;
568
-      }
569
-      if ($applications) {
568
+        }
569
+        if ($applications) {
570 570
         $checked = in_array($app_id, $applications);
571
-      } else {
571
+        } else {
572 572
         $checked = TRUE;
573 573
         if (isset($app['@attributes']['selected']) AND
574 574
             $app['@attributes']['selected'] == 'false') {
575
-          $checked = FALSE;
575
+            $checked = FALSE;
576 576
         }
577
-      }
578
-      $form['applications']["app_{$app_id}"] = array(
577
+        }
578
+        $form['applications']["app_{$app_id}"] = array(
579 579
         '#title' => $app_name,
580 580
         '#type' => 'checkbox',
581 581
         '#default_value' => ($checked) ? 'x' : false,
582 582
         '#disabled' => !$app_enabled
583
-      );
583
+        );
584 584
     }
585 585
     
586 586
     break;
587 587
     
588
-  case 'group':
588
+    case 'group':
589 589
     if (!is_numeric(key($elements))) {
590
-      $elements = array($elements);
590
+        $elements = array($elements);
591 591
     }
592 592
     foreach ($elements as $key => $element) {
593
-      $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
594
-      $name = str_replace(' ','_',strtolower($title));
595
-      $name = "group_{$name}";
593
+        $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
594
+        $name = str_replace(' ','_',strtolower($title));
595
+        $name = "group_{$name}";
596 596
       
597
-      // Translate elements as appropriate
598
-      if ($title) {
597
+        // Translate elements as appropriate
598
+        if ($title) {
599 599
         i18nstrings_update('project:prefs_xml', $title);
600 600
         $title = i18nstrings('project:prefs_xml', $title);
601
-      }
601
+        }
602 602
       
603
-      $form[$name] = array(
604
-          '#title' => $title,
605
-          '#type' => 'fieldset',
606
-          '#tree' => FALSE,
607
-          //'#description' => t('Notes about this group of fields'),
608
-          '#collapsible' => TRUE,
609
-          '#collapsed' => FALSE
610
-      );
611
-      // Recursively populate the compound element
612
-      foreach ($element as $child_type => $child) {
603
+        $form[$name] = array(
604
+            '#title' => $title,
605
+            '#type' => 'fieldset',
606
+            '#tree' => FALSE,
607
+            //'#description' => t('Notes about this group of fields'),
608
+            '#collapsible' => TRUE,
609
+            '#collapsed' => FALSE
610
+        );
611
+        // Recursively populate the compound element
612
+        foreach ($element as $child_type => $child) {
613 613
         boincwork_generate_prefs_element($form[$name], $child_type, $child, $user_prefs);
614
-      }
614
+        }
615 615
     }
616 616
     break;
617 617
     
618
-  case 'compound':
618
+    case 'compound':
619 619
     if (!is_numeric(key($elements))) {
620
-      $elements = array($elements);
620
+        $elements = array($elements);
621 621
     }
622 622
     foreach ($elements as $element) {
623
-      $name = $element['@attributes']['name'];
624
-      $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
623
+        $name = $element['@attributes']['name'];
624
+        $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
625 625
       
626
-      // Translate elements as appropriate
627
-      if ($title) {
626
+        // Translate elements as appropriate
627
+        if ($title) {
628 628
         i18nstrings_update('project:prefs_xml', $title);
629 629
         $title = i18nstrings('project:prefs_xml', $title);
630
-      }
630
+        }
631 631
       
632
-      $form[$name] = array(
633
-          '#title' => $title,
634
-          '#type' => 'fieldset',
635
-          //'#description' => t('Notes about this group of fields'),
636
-          '#collapsible' => TRUE,
637
-          '#collapsed' => FALSE
638
-      );
639
-      // Recursively populate the compound element
640
-      foreach ($element['attributes'] as $child_type => $child) {
632
+        $form[$name] = array(
633
+            '#title' => $title,
634
+            '#type' => 'fieldset',
635
+            //'#description' => t('Notes about this group of fields'),
636
+            '#collapsible' => TRUE,
637
+            '#collapsed' => FALSE
638
+        );
639
+        // Recursively populate the compound element
640
+        foreach ($element['attributes'] as $child_type => $child) {
641 641
         boincwork_generate_prefs_element($form[$name], $child_type, $child, $user_prefs[$name]['@attributes']);
642
-      }
642
+        }
643 643
     }
644 644
     break;
645 645
     
@@ -655,24 +655,24 @@  discard block
 block discarded – undo
655 655
  */
656 656
 function boincwork_make_prefs_table($prefs, $top_level = TRUE) {
657 657
 
658
-  $prefs_table = array();
659
-  $uncategorized = array();
658
+    $prefs_table = array();
659
+    $uncategorized = array();
660 660
   
661
-  // Parse the project preferences form
662
-  foreach ($prefs as $key => $element) {
661
+    // Parse the project preferences form
662
+    foreach ($prefs as $key => $element) {
663 663
     
664 664
     // Determine which type of element this is and act accordingly
665 665
     $element_type = NULL;
666 666
     if (is_array($element) AND isset($element['#type'])) {
667
-      $element_type = $element['#type'];
667
+        $element_type = $element['#type'];
668 668
     }
669 669
     switch ($element_type) {
670 670
     case 'fieldset':
671 671
       $prefs_table[$key] = array(
672 672
         'name' => $element['#title'],
673 673
         'elements' => boincwork_make_prefs_table($element, FALSE),
674
-      );
675
-      break;
674
+        );
675
+        break;
676 676
     case 'textfield':
677 677
     case 'radios':
678 678
     case 'checkbox':
@@ -682,45 +682,45 @@  discard block
 block discarded – undo
682 682
         switch ($key) {
683 683
         case 'start_hour':
684 684
           $element['#title'] = bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing');
685
-          break;
685
+            break;
686 686
         case 'net_start_hour':
687 687
           $element['#title'] = bts('Transfer files only between:', array(), NULL, 'boinc:account-preferences-comuting');
688
-          break;
688
+            break;
689 689
         default:
690 690
         }
691
-      }
692
-      $prefs_element = array(
691
+        }
692
+        $prefs_element = array(
693 693
         'name' => (isset($element['#title'])) ? $element['#title'] : '',
694 694
         'description' => (isset($element['#description'])) ? $element['#description'] : '',
695 695
         'default_value' => (isset($element['#default_value'])) ? $element['#default_value'] : NULL,
696
-      );
697
-      if ($top_level) {
696
+        );
697
+        if ($top_level) {
698 698
         $uncategorized[$key] = $prefs_element;
699
-      }
700
-      else {
699
+        }
700
+        else {
701 701
         $prefs_table[$key] = $prefs_element;
702
-      }
703
-      break;
702
+        }
703
+        break;
704 704
     default:
705 705
     }
706
-  }
706
+    }
707 707
   
708
-  if ($prefs_table AND $uncategorized) {
708
+    if ($prefs_table AND $uncategorized) {
709 709
     // Throw any settings that don't fit elsewhere into "other"
710 710
     $prefs_table['other'] = array(
711
-      'name' => bts('Other settings', array(), NULL, 'boinc:account-preferences'),
712
-      'elements' => $uncategorized,
711
+        'name' => bts('Other settings', array(), NULL, 'boinc:account-preferences'),
712
+        'elements' => $uncategorized,
713 713
     );
714
-  }
715
-  elseif ($uncategorized) {
714
+    }
715
+    elseif ($uncategorized) {
716 716
     // If nothing is categorized, output all prefs under a general "settings"
717 717
     $prefs_table['settings'] = array(
718
-      'name' => bts('Settings', array(), NULL, 'boinc:account-preferences'),
719
-      'elements' => $uncategorized,
718
+        'name' => bts('Settings', array(), NULL, 'boinc:account-preferences'),
719
+        'elements' => $uncategorized,
720 720
     );
721
-  }
721
+    }
722 722
   
723
-  return $prefs_table;
723
+    return $prefs_table;
724 724
 }
725 725
  
726 726
 /**
@@ -728,33 +728,33 @@  discard block
 block discarded – undo
728 728
  */
729 729
 function boincwork_load_prefs($type = 'general', $venue = null, $account = null) {
730 730
   
731
-  require_boinc(array('user'));
731
+    require_boinc(array('user'));
732 732
   
733
-  // Load the BOINC user object
734
-  if (!$account) {
733
+    // Load the BOINC user object
734
+    if (!$account) {
735 735
     global $user;
736 736
     $account = $user;
737
-  }
738
-  $account = user_load($account->uid);
739
-  $boincuser = BoincUser::lookup_id($account->boincuser_id);
737
+    }
738
+    $account = user_load($account->uid);
739
+    $boincuser = BoincUser::lookup_id($account->boincuser_id);
740 740
   
741
-  // Load the desired preferences for the user
742
-  $main_prefs = array();
743
-  if ($type == 'project') {
741
+    // Load the desired preferences for the user
742
+    $main_prefs = array();
743
+    if ($type == 'project') {
744 744
     if ($boincuser->project_prefs) {
745
-      $main_prefs = load_configuration($boincuser->project_prefs);
746
-      $main_prefs = (array) $main_prefs['project_preferences'];
745
+        $main_prefs = load_configuration($boincuser->project_prefs);
746
+        $main_prefs = (array) $main_prefs['project_preferences'];
747 747
     }
748
-  }
749
-  else {
748
+    }
749
+    else {
750 750
     if ($boincuser->global_prefs) {
751
-      $main_prefs = load_configuration($boincuser->global_prefs);
752
-      $main_prefs = (array) $main_prefs['global_preferences'];
751
+        $main_prefs = load_configuration($boincuser->global_prefs);
752
+        $main_prefs = (array) $main_prefs['global_preferences'];
753
+    }
753 754
     }
754
-  }
755 755
   
756
-  // Return general preferences or a subset based on venue
757
-  if (!$venue OR $venue == 'generic') {
756
+    // Return general preferences or a subset based on venue
757
+    if (!$venue OR $venue == 'generic') {
758 758
     unset($main_prefs['venue']);
759 759
     // Use the length of the $main_prefs array as a condition as to
760 760
     // whether the preferences have already been set. This is
@@ -762,23 +762,23 @@  discard block
 block discarded – undo
762 762
     if (count($main_prefs) < 3)
763 763
         $main_prefs['@attributes'] = array('cleared' => 1);
764 764
     return $main_prefs;
765
-  }
766
-  else {
765
+    }
766
+    else {
767 767
     if (isset($main_prefs['venue'])) {
768
-      if (!is_numeric(key($main_prefs['venue']))) {
768
+        if (!is_numeric(key($main_prefs['venue']))) {
769 769
         $main_prefs['venue'] = array($main_prefs['venue']);
770
-      }
771
-      foreach ($main_prefs['venue'] as $key => $prefs_venue) {
770
+        }
771
+        foreach ($main_prefs['venue'] as $key => $prefs_venue) {
772 772
         if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) {
773
-          return $main_prefs['venue'][$key];
773
+            return $main_prefs['venue'][$key];
774
+        }
774 775
         }
775
-      }
776 776
     }
777
-  }
777
+    }
778 778
 
779
-  return array(
779
+    return array(
780 780
     '@attributes' => array('name' => $venue, 'cleared' => 1)
781
-  );
781
+    );
782 782
 }
783 783
 
784 784
 /**
@@ -786,99 +786,99 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function boincwork_save_prefs($prefs, $type = 'general', $venue = null, $account = null) {
788 788
   
789
-  require_boinc(array('user'));
789
+    require_boinc(array('user'));
790 790
   
791
-  // Load existing project prefs from the BOINC user object
792
-  if (!$account) {
791
+    // Load existing project prefs from the BOINC user object
792
+    if (!$account) {
793 793
     global $user;
794 794
     $account = $user;
795
-  }
796
-  $account = user_load($account->uid);
797
-  $boincuser = BoincUser::lookup_id($account->boincuser_id);
795
+    }
796
+    $account = user_load($account->uid);
797
+    $boincuser = BoincUser::lookup_id($account->boincuser_id);
798 798
   
799
-  // Load the specified preferences for the user
800
-  $main_prefs = array();
801
-  if ($type == 'project') {
799
+    // Load the specified preferences for the user
800
+    $main_prefs = array();
801
+    if ($type == 'project') {
802 802
     if ($boincuser->project_prefs) {
803
-      $main_prefs = load_configuration($boincuser->project_prefs);
804
-      $main_prefs = (array) $main_prefs['project_preferences'];
803
+        $main_prefs = load_configuration($boincuser->project_prefs);
804
+        $main_prefs = (array) $main_prefs['project_preferences'];
805 805
     }
806
-  }
807
-  else {
806
+    }
807
+    else {
808 808
     if ($boincuser->global_prefs) {
809
-      $main_prefs = load_configuration($boincuser->global_prefs);
810
-      $main_prefs = (array) $main_prefs['global_preferences'];
809
+        $main_prefs = load_configuration($boincuser->global_prefs);
810
+        $main_prefs = (array) $main_prefs['global_preferences'];
811
+    }
811 812
     }
812
-  }
813 813
   
814
-  // Save all preferences or a subset based on venue
815
-  //drupal_set_message('<pre>' . print_r($main_prefs, true) . '</pre>');
816
-  $new_venue = true;
817
-  if (!$venue OR $venue == 'generic') {
814
+    // Save all preferences or a subset based on venue
815
+    //drupal_set_message('<pre>' . print_r($main_prefs, true) . '</pre>');
816
+    $new_venue = true;
817
+    if (!$venue OR $venue == 'generic') {
818 818
     //$main_prefs = $prefs;
819 819
     $main_prefs = $prefs + $main_prefs;
820
-  }
821
-  else {
820
+    }
821
+    else {
822 822
     if (isset($main_prefs['venue'])) {
823
-      if (!is_numeric(key($main_prefs['venue']))) {
823
+        if (!is_numeric(key($main_prefs['venue']))) {
824 824
         $main_prefs['venue'] = array($main_prefs['venue']);
825
-      }
826
-      foreach ($main_prefs['venue'] as $key => $prefs_venue) {
825
+        }
826
+        foreach ($main_prefs['venue'] as $key => $prefs_venue) {
827 827
         if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) {
828
-          if ($prefs) {
828
+            if ($prefs) {
829 829
             $main_prefs['venue'][$key] = $prefs;
830
-          }
831
-          else {
830
+            }
831
+            else {
832 832
             // If prefs is null, clear out this preference set
833 833
             unset($main_prefs['venue'][$key]);
834 834
             if (count($main_prefs['venue']) == 0) {
835
-              // If that was the only preference set configured, unset the
836
-              // venue tag altogether
837
-              unset($main_prefs['venue']);
835
+                // If that was the only preference set configured, unset the
836
+                // venue tag altogether
837
+                unset($main_prefs['venue']);
838 838
             }
839
-          }
840
-          $new_venue = false;
841
-          break;
839
+            }
840
+            $new_venue = false;
841
+            break;
842
+        }
842 843
         }
843
-      }
844 844
     }
845 845
     if ($new_venue) {
846
-      $main_prefs['venue'][] = $prefs;
846
+        $main_prefs['venue'][] = $prefs;
847
+    }
847 848
     }
848
-  }
849 849
   
850
-  // Set modified time
851
-  if ($type == 'general') {
850
+    // Set modified time
851
+    if ($type == 'general') {
852 852
     if (!isset($main_prefs['mod_time'])) {
853
-      $main_prefs = array_merge(array('mod_time' => 0), $main_prefs);
853
+        $main_prefs = array_merge(array('mod_time' => 0), $main_prefs);
854 854
     }
855 855
     $main_prefs['mod_time'] = time();
856 856
     // unset source information, the Client will fill this in again
857 857
     if (isset($main_prefs['source_project'])) {
858
-      unset($main_prefs['source_project']);
858
+        unset($main_prefs['source_project']);
859 859
     }
860 860
     if (isset($main_prefs['source_scheduler'])) {
861
-      unset($main_prefs['source_scheduler']);
861
+        unset($main_prefs['source_scheduler']);
862
+    }
862 863
     }
863
-  }
864 864
   
865
-  // Convert prefs back to XML and save to database
866
-  $result = null;
867
-  if ($type == 'project') {
865
+    // Convert prefs back to XML and save to database
866
+    $result = null;
867
+    if ($type == 'project') {
868 868
     $main_prefs = array('project_preferences' => $main_prefs);
869 869
     $boincuser->project_prefs = save_configuration($main_prefs);
870 870
     db_set_active('boinc');
871 871
     $result = db_query("UPDATE user SET project_prefs = '{$boincuser->project_prefs}' WHERE id = '{$boincuser->id}'");
872 872
     db_set_active('default');
873
-  }
874
-  else {
873
+    }
874
+    else {
875 875
     $main_prefs = array('global_preferences' => $main_prefs);
876 876
     $boincuser->global_prefs = save_configuration($main_prefs);
877 877
     db_set_active('boinc');
878 878
     $result = db_query("UPDATE user SET global_prefs = '{$boincuser->global_prefs}' WHERE id = '{$boincuser->id}'");
879 879
     db_set_active('default');
880
-  }
881
-  return $result;
880
+    }
881
+    return $result;
882 882
 }
883 883
 
884 884
 
@@ -892,94 +892,94 @@  discard block
 block discarded – undo
892 892
  */ 
893 893
 function boincwork_set_default_venue($venue = '') {
894 894
   
895
-  global $user;
896
-  $account = user_load($user->uid);
895
+    global $user;
896
+    $account = user_load($user->uid);
897 897
   
898
-  if ($venue == 'generic') {
898
+    if ($venue == 'generic') {
899 899
     $venue = '';
900
-  }
900
+    }
901 901
   
902
-  db_set_active('boinc');
903
-  db_query("
902
+    db_set_active('boinc');
903
+    db_query("
904 904
     UPDATE user
905 905
     SET venue = '%s'
906 906
     WHERE id = %d",
907 907
     $venue, $account->boincuser_id
908
-  );
909
-  db_set_active('default');
908
+    );
909
+    db_set_active('default');
910 910
 }
911 911
 
912 912
 /**
913 913
  * Recursively validate submitted form values against a set of rules
914 914
  */ 
915 915
 function boincwork_validate_form($validation_rules, $values, $path = array()) {
916
-  foreach ($validation_rules as $field => $rules) {
916
+    foreach ($validation_rules as $field => $rules) {
917 917
     $parents = $path;
918 918
     if (is_array($values[$field])) {
919
-      // Process nested form elements
920
-      $parents[] = $field;
921
-      boincwork_validate_form($rules, $values[$field], $parents);
919
+        // Process nested form elements
920
+        $parents[] = $field;
921
+        boincwork_validate_form($rules, $values[$field], $parents);
922 922
     }
923 923
     else {
924
-      if ($parents) {
924
+        if ($parents) {
925 925
         // form_set_error() identifies nested form elements with '][' as a
926 926
         // delimiter between each parent and child element
927 927
         $parents[] = $field;
928 928
         $form_field = implode('][', $parents);
929
-      }
930
-      else {
929
+        }
930
+        else {
931 931
         $form_field = $field;
932
-      }
933
-      if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) {
932
+        }
933
+        if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) {
934 934
         form_set_error($form_field, bts('Invalid data type for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
935
-      }
936
-      if (isset($rules['min']) AND $values[$field] < $rules['min']) {
935
+        }
936
+        if (isset($rules['min']) AND $values[$field] < $rules['min']) {
937 937
         form_set_error($form_field, bts('Minimum value not met for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
938
-      }
939
-      if (isset($rules['max']) AND $values[$field] > $rules['max']) {
938
+        }
939
+        if (isset($rules['max']) AND $values[$field] > $rules['max']) {
940 940
         form_set_error($form_field, bts('Maximum value exceeded for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
941
-      }
941
+        }
942
+    }
942 943
     }
943
-  }
944 944
 }
945 945
 
946 946
 /**
947 947
  * Check that numeric data conforms to specifications
948 948
  */
949 949
 function boincwork_validate_datatype($data, $datatype = NULL) {
950
-  switch ($datatype) {
951
-  case 'float':
950
+    switch ($datatype) {
951
+    case 'float':
952 952
     if (!is_numeric($data)) {
953
-      return FALSE;
953
+        return FALSE;
954 954
     }
955 955
     $data += 0.0;
956 956
     if (!is_float($data)) {
957
-      return FALSE;
957
+        return FALSE;
958 958
     }
959 959
     break;
960 960
     
961
-  case 'integer':
961
+    case 'integer':
962 962
     if (!is_numeric($data)) {
963
-      return FALSE;
963
+        return FALSE;
964 964
     }
965 965
     $data += 0;
966 966
     if (!is_int($data)) {
967
-      return FALSE;
967
+        return FALSE;
968 968
     }
969 969
     break;
970 970
   
971
-  case 'text':
971
+    case 'text':
972 972
   default:
973 973
     
974 974
   }
975
-  return TRUE;
975
+    return TRUE;
976 976
 }
977 977
 
978 978
 /**
979 979
  * Format a number to be displayed using a maximum number of digits
980 980
  */ 
981 981
 function boincwork_format_stats($number, $max_digits = 4) {
982
-  $suffix = array(
982
+    $suffix = array(
983 983
     0 => '',
984 984
     1 => 'k',
985 985
     2 => 'M',
@@ -989,95 +989,95 @@  discard block
 block discarded – undo
989 989
     6 => 'E',
990 990
     7 => 'Z',
991 991
     8 => 'Y'
992
-  );
993
-  if (!is_numeric($number)) $number = 0;
992
+    );
993
+    if (!is_numeric($number)) $number = 0;
994 994
   
995
-  $digits = floor(log($number, 10)) + 1;
996
-  $magnitude = 0;
997
-  $precision = 0;
998
-  if ($digits > $max_digits) {
995
+    $digits = floor(log($number, 10)) + 1;
996
+    $magnitude = 0;
997
+    $precision = 0;
998
+    if ($digits > $max_digits) {
999 999
     $magnitude = floor(($digits - ($max_digits - 3)) / 3);
1000 1000
     $precision = $max_digits - ($digits - ($magnitude * 3) + 1);
1001 1001
     $number = round($number / pow(1000, $magnitude), $precision);
1002
-  }
1003
-  $number = number_format($number, $precision) . (($magnitude) ? "{$suffix[$magnitude]}" : '');
1002
+    }
1003
+    $number = number_format($number, $precision) . (($magnitude) ? "{$suffix[$magnitude]}" : '');
1004 1004
   
1005
-  return $number;
1005
+    return $number;
1006 1006
 }
1007 1007
 
1008 1008
 
1009
-  //------------------------------------------------------------------------------------------------
1010
-  //  load_configuration(): Convert structured text/xml to array
1011
-  //------------------------------------------------------------------------------------------------
1009
+    //------------------------------------------------------------------------------------------------
1010
+    //  load_configuration(): Convert structured text/xml to array
1011
+    //------------------------------------------------------------------------------------------------
1012 1012
   
1013
-  function load_configuration($text)
1014
-  {
1015
-      if (preg_match('/^\<\?xml .*\?\>$/i', $text)) return null;
1016
-      if ($xml = text_to_xml($text)) return xml_to_array($xml);
1017
-      return false;
1018
-  }
1013
+    function load_configuration($text)
1014
+    {
1015
+        if (preg_match('/^\<\?xml .*\?\>$/i', $text)) return null;
1016
+        if ($xml = text_to_xml($text)) return xml_to_array($xml);
1017
+        return false;
1018
+    }
1019 1019
   
1020
-  //------------------------------------------------------------------------------------------------
1021
-  //  save_configuration(): Convert array to structured text/xml
1022
-  //------------------------------------------------------------------------------------------------
1020
+    //------------------------------------------------------------------------------------------------
1021
+    //  save_configuration(): Convert array to structured text/xml
1022
+    //------------------------------------------------------------------------------------------------
1023 1023
   
1024
-  function save_configuration($array)
1025
-  {
1026
-      if ($xml = array_to_xml($array)) return xml_to_text($xml, false, true);
1027
-      return false;
1028
-  }
1024
+    function save_configuration($array)
1025
+    {
1026
+        if ($xml = array_to_xml($array)) return xml_to_text($xml, false, true);
1027
+        return false;
1028
+    }
1029 1029
   
1030
-  //------------------------------------------------------------------------------------------------
1031
-  //  array_to_xml(): Take a multidimensional array and convert it to a structured
1032
-  //  DOM XML object
1033
-  //------------------------------------------------------------------------------------------------
1030
+    //------------------------------------------------------------------------------------------------
1031
+    //  array_to_xml(): Take a multidimensional array and convert it to a structured
1032
+    //  DOM XML object
1033
+    //------------------------------------------------------------------------------------------------
1034 1034
   
1035
-  function array_to_xml($array, $dom = false, $parent_node = false) {
1035
+    function array_to_xml($array, $dom = false, $parent_node = false) {
1036 1036
     $is_root = false;
1037 1037
     if (!$dom) $dom = new DomDocument('1.0');
1038 1038
     if (!$parent_node) {
1039
-      $parent_node = $dom;
1040
-      $is_root = true;
1039
+        $parent_node = $dom;
1040
+        $is_root = true;
1041 1041
     }
1042 1042
     // Created an intermediate array to attempt to sort by @position
1043 1043
     $ordered_array = array();
1044 1044
     $unordered_array = array();
1045 1045
     foreach ($array as $name => $value) {
1046
-      if ($is_root) {
1046
+        if ($is_root) {
1047 1047
         $unordered_array[] = $array;
1048 1048
         break;
1049
-      }
1050
-      if (is_array($value)) {
1049
+        }
1050
+        if (is_array($value)) {
1051 1051
         if (is_numeric(key($value))) {
1052
-          foreach ($value as $item) {
1052
+            foreach ($value as $item) {
1053 1053
             if (is_array($item) AND isset($item['@position'])) {
1054
-              $ordered_array[$item['@position']] = array(
1054
+                $ordered_array[$item['@position']] = array(
1055 1055
                 $name => $item
1056
-              );
1056
+                );
1057 1057
             }
1058 1058
             else {
1059
-              $unordered_array[] = array(
1059
+                $unordered_array[] = array(
1060 1060
                 $name => $item
1061
-              );
1061
+                );
1062
+            }
1062 1063
             }
1063
-          }
1064 1064
         }
1065 1065
         elseif (isset($value['@position'])) {
1066
-          $ordered_array[$value['@position']] = array(
1066
+            $ordered_array[$value['@position']] = array(
1067 1067
             $name => $value
1068
-          );
1068
+            );
1069 1069
         }
1070 1070
         else {
1071
-          $unordered_array[] = array(
1071
+            $unordered_array[] = array(
1072 1072
             $name => $value
1073
-          );
1073
+            );
1074 1074
         }
1075
-      }
1076
-      else {
1075
+        }
1076
+        else {
1077 1077
         $unordered_array[] = array(
1078
-          $name => $value
1078
+            $name => $value
1079 1079
         );
1080
-      }
1080
+        }
1081 1081
     }
1082 1082
     
1083 1083
     // Now append items without explicit positions at the end
@@ -1085,39 +1085,39 @@  discard block
 block discarded – undo
1085 1085
     
1086 1086
     // Convert to XML...
1087 1087
     foreach ($primed_array as $item) {
1088
-      list($name, $value) = each($item);
1089
-      if (strcmp($name, '@attributes') == 0) {
1088
+        list($name, $value) = each($item);
1089
+        if (strcmp($name, '@attributes') == 0) {
1090 1090
         if (!is_array($value)) continue;
1091 1091
         foreach ($value as $attributeName => $attributeValue) {
1092
-          $parent_node->setAttribute($attributeName, $attributeValue);
1092
+            $parent_node->setAttribute($attributeName, $attributeValue);
1093 1093
         }
1094
-      } elseif (strcmp($name, '@value') == 0) {
1094
+        } elseif (strcmp($name, '@value') == 0) {
1095 1095
         if (isset($value)) $parent_node->nodeValue = $value;
1096
-      } elseif (strcmp($name, '@position') == 0) {
1096
+        } elseif (strcmp($name, '@position') == 0) {
1097 1097
         continue;
1098
-      } else {
1098
+        } else {
1099 1099
         if (is_numeric($name)) {
1100
-          $name = $parent_node->tagName;
1100
+            $name = $parent_node->tagName;
1101 1101
         }
1102 1102
         $current_item = $dom->createElement($name);
1103 1103
         if (is_array($value)) {
1104
-          if (is_numeric(key($value))) {
1104
+            if (is_numeric(key($value))) {
1105 1105
             $current_node = $parent_node->appendChild($current_item);
1106 1106
             $current_node = array_to_xml($value, $dom, $current_node);
1107 1107
             $child_count = $current_node->childNodes->length;
1108 1108
             for ($i = 0; $i < $child_count; $i++) {
1109
-              $parent_node->appendChild($current_node->childNodes->item(0));
1109
+                $parent_node->appendChild($current_node->childNodes->item(0));
1110 1110
             }
1111 1111
             $parent_node->removeChild($current_node);
1112
-          } else {
1112
+            } else {
1113 1113
             $current_node = $dom->appendChild($current_item);
1114 1114
             $parent_node->appendChild(array_to_xml($value, $dom, $current_node));
1115
-          }
1115
+            }
1116 1116
         } else {
1117
-          if (isset($value)) $current_item->nodeValue = $value;
1118
-          $parent_node->appendChild($current_item);
1117
+            if (isset($value)) $current_item->nodeValue = $value;
1118
+            $parent_node->appendChild($current_item);
1119
+        }
1119 1120
         }
1120
-      }
1121 1121
     }
1122 1122
     /*
1123 1123
     foreach ($array as $name => $value) {
@@ -1153,114 +1153,114 @@  discard block
 block discarded – undo
1153 1153
       }
1154 1154
     }*/
1155 1155
     return $parent_node;
1156
-  }
1156
+    }
1157 1157
   
1158
-  //------------------------------------------------------------------------------------------------
1159
-  //  xml_to_text(): Convert an XML DOM object to string format
1160
-  //------------------------------------------------------------------------------------------------
1158
+    //------------------------------------------------------------------------------------------------
1159
+    //  xml_to_text(): Convert an XML DOM object to string format
1160
+    //------------------------------------------------------------------------------------------------
1161 1161
   
1162
-  function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false)
1163
-  {
1164
-      $xml->formatOutput = true;
1165
-      $text = $xml->saveXML();
1166
-      if (!$include_xml_declaration) {
1162
+    function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false)
1163
+    {
1164
+        $xml->formatOutput = true;
1165
+        $text = $xml->saveXML();
1166
+        if (!$include_xml_declaration) {
1167 1167
         $text = preg_replace('/<\?xml version=.*\?>\s*/i', '', $text, 1);
1168
-      }
1169
-      if ($add_carriage_returns) {;
1168
+        }
1169
+        if ($add_carriage_returns) {;
1170 1170
         $text = preg_replace('/\n/i', "\r\n", $text);
1171
-      }
1172
-      return trim($text);
1173
-  }
1171
+        }
1172
+        return trim($text);
1173
+    }
1174 1174
   
1175
-  //------------------------------------------------------------------------------------------------
1176
-  //  text_to_xml(): Convert an XML DOM object to string format
1177
-  //------------------------------------------------------------------------------------------------
1175
+    //------------------------------------------------------------------------------------------------
1176
+    //  text_to_xml(): Convert an XML DOM object to string format
1177
+    //------------------------------------------------------------------------------------------------
1178 1178
   
1179
-  function text_to_xml($text) {
1179
+    function text_to_xml($text) {
1180 1180
     $xml = new DomDocument();
1181 1181
     if ( !($xml->loadXML($text)) ) return false;
1182 1182
     return $xml;
1183
-  }
1183
+    }
1184 1184
   
1185 1185
   
1186
-  //------------------------------------------------------------------------------------------------
1187
-  //  xml_to_array(): Convert an XML DOM object to array format
1188
-  //------------------------------------------------------------------------------------------------
1186
+    //------------------------------------------------------------------------------------------------
1187
+    //  xml_to_array(): Convert an XML DOM object to array format
1188
+    //------------------------------------------------------------------------------------------------
1189 1189
   
1190
-  function xml_to_array($xml) {
1191
-      $node = $xml->firstChild; //$xml->first_child();
1192
-      $result = '';
1193
-      $index = 1;
1194
-      $position = 0;
1195
-      while (!is_null($node)) {
1196
-          switch ($node->nodeType) {
1197
-          case XML_TEXT_NODE:
1190
+    function xml_to_array($xml) {
1191
+        $node = $xml->firstChild; //$xml->first_child();
1192
+        $result = '';
1193
+        $index = 1;
1194
+        $position = 0;
1195
+        while (!is_null($node)) {
1196
+            switch ($node->nodeType) {
1197
+            case XML_TEXT_NODE:
1198 1198
               if (trim($node->nodeValue)  != '') $result = $node->nodeValue;
1199
-              break;
1200
-          case XML_ELEMENT_NODE:
1199
+                break;
1200
+            case XML_ELEMENT_NODE:
1201 1201
               $node_name = $node->nodeName;
1202
-              $parent = $node->parentNode;
1203
-              $sibling = $node->nextSibling;
1202
+                $parent = $node->parentNode;
1203
+                $sibling = $node->nextSibling;
1204 1204
               
1205
-              // Determine if this node forms a set with siblings (share a node name)
1206
-              while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling;
1207
-              if (!$sibling) {
1208
-                  $sibling = $node->previousSibling;
1209
-                  while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling;
1210
-              }
1205
+                // Determine if this node forms a set with siblings (share a node name)
1206
+                while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling;
1207
+                if (!$sibling) {
1208
+                    $sibling = $node->previousSibling;
1209
+                    while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling;
1210
+                }
1211 1211
               
1212
-              if ($sibling) {
1213
-                  $result[$node_name][$index] = '';
1214
-                  if ($node->childNodes) {
1215
-                      $result[$node_name][$index] = xml_to_array($node) ;
1216
-                  }
1217
-                  if ($node->hasAttributes()) {
1218
-                      $attributes = $node->attributes;
1219
-                      if ($result[$node_name][$index] !== '' AND !is_array($result[$node_name][$index])) {
1220
-                          $result[$node_name][$index] = array('@value' => $result[$node_name][$index]);
1221
-                      }
1222
-                      foreach ($attributes as $key => $attribute) {
1223
-                          $result[$node_name][$index]['@attributes'][$attribute->name] = $attribute->value;
1224
-                      }
1225
-                  }
1226
-                  // Retain the position of the element
1227
-                  if (!is_array($result[$node_name][$index])) {
1212
+                if ($sibling) {
1213
+                    $result[$node_name][$index] = '';
1214
+                    if ($node->childNodes) {
1215
+                        $result[$node_name][$index] = xml_to_array($node) ;
1216
+                    }
1217
+                    if ($node->hasAttributes()) {
1218
+                        $attributes = $node->attributes;
1219
+                        if ($result[$node_name][$index] !== '' AND !is_array($result[$node_name][$index])) {
1220
+                            $result[$node_name][$index] = array('@value' => $result[$node_name][$index]);
1221
+                        }
1222
+                        foreach ($attributes as $key => $attribute) {
1223
+                            $result[$node_name][$index]['@attributes'][$attribute->name] = $attribute->value;
1224
+                        }
1225
+                    }
1226
+                    // Retain the position of the element
1227
+                    if (!is_array($result[$node_name][$index])) {
1228 1228
                     $result[$node_name][$index] = array(
1229
-                      '@value' => $result[$node_name][$index]
1229
+                        '@value' => $result[$node_name][$index]
1230 1230
                     );
1231
-                  }
1232
-                  $result[$node_name][$index]['@position'] = $position;
1233
-                  $position++;
1234
-                  $index++;
1235
-              } else {
1236
-                  $result[$node_name] = '';
1237
-                  if ($node->childNodes) {
1238
-                      $result[$node_name] = xml_to_array($node) ;
1239
-                  }
1240
-                  if ($node->hasAttributes()) {
1241
-                      $attributes = $node->attributes;
1242
-                      if ($result[$node_name] !== '' AND !is_array($result[$node_name])) {
1243
-                          $result[$node_name] = array('@value' => $result[$node_name]);
1244
-                      }
1245
-                      foreach($attributes as $key => $attribute) {
1246
-                          $result[$node_name]['@attributes'][$attribute->name] = $attribute->value;
1247
-                      }
1248
-                  }
1249
-                  // Retain the position of the element
1250
-                  if (!is_array($result[$node_name])) {
1231
+                    }
1232
+                    $result[$node_name][$index]['@position'] = $position;
1233
+                    $position++;
1234
+                    $index++;
1235
+                } else {
1236
+                    $result[$node_name] = '';
1237
+                    if ($node->childNodes) {
1238
+                        $result[$node_name] = xml_to_array($node) ;
1239
+                    }
1240
+                    if ($node->hasAttributes()) {
1241
+                        $attributes = $node->attributes;
1242
+                        if ($result[$node_name] !== '' AND !is_array($result[$node_name])) {
1243
+                            $result[$node_name] = array('@value' => $result[$node_name]);
1244
+                        }
1245
+                        foreach($attributes as $key => $attribute) {
1246
+                            $result[$node_name]['@attributes'][$attribute->name] = $attribute->value;
1247
+                        }
1248
+                    }
1249
+                    // Retain the position of the element
1250
+                    if (!is_array($result[$node_name])) {
1251 1251
                     $result[$node_name] = array(
1252
-                      '@value' => $result[$node_name]
1252
+                        '@value' => $result[$node_name]
1253 1253
                     );
1254
-                  }
1255
-                  $result[$node_name]['@position'] = $position;
1256
-                  $position++;
1257
-              }
1258
-              break;
1259
-          }
1260
-          $node = $node->nextSibling;
1261
-      }
1262
-      return $result;
1263
-  }
1254
+                    }
1255
+                    $result[$node_name]['@position'] = $position;
1256
+                    $position++;
1257
+                }
1258
+                break;
1259
+            }
1260
+            $node = $node->nextSibling;
1261
+        }
1262
+        return $result;
1263
+    }
1264 1264
   
1265 1265
 
1266 1266
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -1268,172 +1268,172 @@  discard block
 block discarded – undo
1268 1268
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
1269 1269
 
1270 1270
 /**
1271
-  * Determine output for host list views when no hosts are found.
1272
-  */
1271
+ * Determine output for host list views when no hosts are found.
1272
+ */
1273 1273
 function boincwork_views_host_list_empty_text($context = NULL) {
1274 1274
   
1275
-  // Pull the BOINC user ID from the view arguments to get show_hosts 
1276
-  // preference for that user
1277
-  require_boinc('boinc_db');
1278
-  $view = views_get_current_view();
1279
-  $account = user_load($view->args[0]);
1280
-  $boincuser = BoincUser::lookup_id($account->boincuser_id);
1275
+    // Pull the BOINC user ID from the view arguments to get show_hosts 
1276
+    // preference for that user
1277
+    require_boinc('boinc_db');
1278
+    $view = views_get_current_view();
1279
+    $account = user_load($view->args[0]);
1280
+    $boincuser = BoincUser::lookup_id($account->boincuser_id);
1281 1281
   
1282
-  // Determine if hosts are associated at all or just hidden
1283
-  $output = '';
1284
-  if ($boincuser->show_hosts) {
1282
+    // Determine if hosts are associated at all or just hidden
1283
+    $output = '';
1284
+    if ($boincuser->show_hosts) {
1285 1285
     switch($context) {
1286 1286
     case 'active':
1287 1287
       $output .=  '<h2>' . bts('No active computers', array(), NULL, 'boinc:host-list') . '</h2>';
1288
-      $output .=  '<p>' . bts('This user has no computers that have been'
1289
-      . ' active in the last 30 days.', array(), NULL, 'boinc:host-list') . '</p>';
1290
-      break;
1288
+        $output .=  '<p>' . bts('This user has no computers that have been'
1289
+        . ' active in the last 30 days.', array(), NULL, 'boinc:host-list') . '</p>';
1290
+        break;
1291 1291
       
1292 1292
     case 'preferences':
1293 1293
       $output .=  '<h2>' . bts('No computers', array(), NULL, 'boinc:host-list') . '</h2>';
1294
-      $output .=  '<p>' . bts('There are no computers assigned to this'
1295
-      . ' preference set.', array(), NULL, 'boinc:host-list') . '</p>';
1296
-      break;
1294
+        $output .=  '<p>' . bts('There are no computers assigned to this'
1295
+        . ' preference set.', array(), NULL, 'boinc:host-list') . '</p>';
1296
+        break;
1297 1297
     
1298 1298
     default:
1299 1299
       $output .=  '<h2>' . bts('Computers pending', array(), NULL, 'boinc:host-list') . '</h2>';
1300
-      $output .=  '<p>' . bts('This user does not yet have any associated'
1301
-      . ' computers. Computers will be displayed when they have earned their'
1302
-      . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>';
1300
+        $output .=  '<p>' . bts('This user does not yet have any associated'
1301
+        . ' computers. Computers will be displayed when they have earned their'
1302
+        . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>';
1303 1303
     }
1304
-  }
1305
-  else {
1304
+    }
1305
+    else {
1306 1306
     $output .=  '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>';
1307 1307
     $output .=  '<p>' . bts('This user has chosen not to show information'
1308 1308
     . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>';
1309
-  }
1310
-  return $output;
1309
+    }
1310
+    return $output;
1311 1311
 }
1312 1312
 
1313 1313
 /**
1314
-  * Determine output for task list views when no tasks are found.
1315
-  */
1314
+ * Determine output for task list views when no tasks are found.
1315
+ */
1316 1316
 function boincwork_views_task_list_empty_text($context = NULL) {
1317 1317
   
1318
-  // 
1319
-  $output = '';
1320
-  switch($context) {
1321
-  default:
1318
+    // 
1319
+    $output = '';
1320
+    switch($context) {
1321
+    default:
1322 1322
     $output .=  '<h2>' . bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list')
1323 1323
     . '</h2>';
1324 1324
     $output .=  '<p>' . bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list')
1325 1325
     . '</p>';
1326
-  }
1327
-  return $output;
1326
+    }
1327
+    return $output;
1328 1328
 }
1329 1329
 
1330 1330
 /**
1331
-  * Output links to perform host actions
1332
-  */
1331
+ * Output links to perform host actions
1332
+ */
1333 1333
 function boincwork_host_action_links($host_id) {
1334
-  $output = '';
1335
-  if (boincwork_host_user_is_owner($host_id)) {
1334
+    $output = '';
1335
+    if (boincwork_host_user_is_owner($host_id)) {
1336 1336
     // Show merge hosts option
1337 1337
     $output = '<ul class="tab-list"><li class="first tab">';
1338 1338
     $output .= l(bts('Merge', array(), NULL, 'boinc:form-merge'), "host/{$host_id}/merge");
1339 1339
     $output .= '</li>';
1340 1340
     // If host has no tasks, allow the host to be deleted
1341 1341
     if (!boincwork_host_get_task_count($host_id)) {
1342
-      $output .= '<li class="tab">';
1343
-      $output .= l(bts('Delete', array(), NULL, 'boinc:form-delete'), "host/{$host_id}/delete",
1342
+        $output .= '<li class="tab">';
1343
+        $output .= l(bts('Delete', array(), NULL, 'boinc:form-delete'), "host/{$host_id}/delete",
1344 1344
         array(
1345
-          'attributes' => array(
1345
+            'attributes' => array(
1346 1346
             'onclick' => 'return confirm(\'' . bts('This will delete host @id'
1347
-              . ' from your account forever. Are you sure this is OK?',
1348
-              array('@id' => $host_id),
1349
-              NULL, 'boinc:account-host-delete') . '\')'
1350
-          )
1347
+                . ' from your account forever. Are you sure this is OK?',
1348
+                array('@id' => $host_id),
1349
+                NULL, 'boinc:account-host-delete') . '\')'
1350
+            )
1351 1351
         )
1352
-      );
1353
-      $output .= '</li>';
1352
+        );
1353
+        $output .= '</li>';
1354 1354
     }
1355 1355
     $output .= '</ul>';
1356
-  }
1357
-  return $output;
1356
+    }
1357
+    return $output;
1358 1358
 }
1359 1359
 
1360 1360
 /**
1361 1361
  * Get details for a given host
1362 1362
  */
1363 1363
 function boincwork_host_get_info($host_id) {
1364
-  db_set_active('boinc');
1365
-  $host = db_fetch_object(db_query(
1364
+    db_set_active('boinc');
1365
+    $host = db_fetch_object(db_query(
1366 1366
     "SELECT * FROM {host} WHERE id = '%d'",
1367 1367
     $host_id
1368
-  ));
1369
-  db_set_active('default');
1370
-  return $host;
1368
+    ));
1369
+    db_set_active('default');
1370
+    return $host;
1371 1371
 }
1372 1372
 
1373 1373
 /**
1374 1374
  * Get the number of tasks associated with a given host
1375 1375
  */
1376 1376
 function boincwork_host_get_task_count($host_id) {
1377
-  db_set_active('boinc');
1378
-  $count = db_result(db_query(
1377
+    db_set_active('boinc');
1378
+    $count = db_result(db_query(
1379 1379
     "SELECT COUNT(*) FROM {result} WHERE hostid = '%d'",
1380 1380
     $host_id
1381
-  ));
1382
-  db_set_active('default');
1383
-  return $count;
1381
+    ));
1382
+    db_set_active('default');
1383
+    return $count;
1384 1384
 }
1385 1385
 
1386 1386
 /**
1387 1387
  * Check whether a user is the owner of a host
1388 1388
  */
1389 1389
 function boincwork_host_user_is_owner($host_id, $uid = NULL) {
1390
-  if (!$uid) {
1390
+    if (!$uid) {
1391 1391
     global $user;
1392 1392
     $uid = $user->uid;
1393
-  }
1394
-  $account = user_load($uid);
1395
-  // Get host owner
1396
-  db_set_active('boinc');
1397
-  $owner = db_result(db_query(
1393
+    }
1394
+    $account = user_load($uid);
1395
+    // Get host owner
1396
+    db_set_active('boinc');
1397
+    $owner = db_result(db_query(
1398 1398
     "SELECT userid FROM {host} WHERE id = '%d'",
1399 1399
     $host_id
1400
-  ));
1401
-  db_set_active('default');
1402
-  return ($account->boincuser_id === $owner);
1400
+    ));
1401
+    db_set_active('default');
1402
+    return ($account->boincuser_id === $owner);
1403 1403
 }
1404 1404
 
1405 1405
 /**
1406
-  * Determine output for host last contact time
1407
-  */
1406
+ * Determine output for host last contact time
1407
+ */
1408 1408
 function boincwork_host_last_contact($timestamp, $host_id = NULL, $context = NULL) {
1409
-  $output = '---';
1410
-  $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
1411
-  $log = '';
1412
-  if ($timestamp) {
1409
+    $output = '---';
1410
+    $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
1411
+    $log = '';
1412
+    if ($timestamp) {
1413 1413
     $output = date('j M Y G:i:s T', $timestamp);
1414
-  }
1415
-  if ($root_log_dir AND $host_id) {
1414
+    }
1415
+    if ($root_log_dir AND $host_id) {
1416 1416
     $subdir = substr($host_id, 0, -3) OR $subdir = 0;
1417 1417
     $log = implode('/', array($root_log_dir, $subdir, $host_id));
1418
-  }
1419
-  if ($log AND file_exists($log)) {
1418
+    }
1419
+    if ($log AND file_exists($log)) {
1420 1420
     $output = l($output, "host/{$host_id}/log");
1421
-  }
1422
-  return $output;
1421
+    }
1422
+    return $output;
1423 1423
 }
1424 1424
 
1425 1425
 /**
1426 1426
  * 
1427 1427
  */
1428 1428
 function boincwork_host_venue_selector($host_id) {
1429
-  $output = '';
1430
-  if (function_exists('jump_quickly')) {
1429
+    $output = '';
1430
+    if (function_exists('jump_quickly')) {
1431 1431
     $path = "host/{$host_id}/set-venue";
1432 1432
     $venues = array(
1433
-      "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
1434
-      "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
1435
-      "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location'),
1436
-      "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location')
1433
+        "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
1434
+        "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
1435
+        "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location'),
1436
+        "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location')
1437 1437
     );
1438 1438
     variable_set('jump_use_js_venues-Array', 1);
1439 1439
     drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -1441,34 +1441,34 @@  discard block
 block discarded – undo
1441 1441
     // Get current venue
1442 1442
     db_set_active('boinc');
1443 1443
     $venue = db_result(db_query(
1444
-      "SELECT venue FROM {host} WHERE id = '%d'",
1445
-      $host_id
1444
+        "SELECT venue FROM {host} WHERE id = '%d'",
1445
+        $host_id
1446 1446
     ));
1447 1447
     db_set_active('default');
1448 1448
     $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
1449
-  }
1450
-  return $output;
1449
+    }
1450
+    return $output;
1451 1451
 }
1452 1452
 
1453 1453
 /**
1454
-  * Determine output for task reported time / deadline
1455
-  */
1454
+ * Determine output for task reported time / deadline
1455
+ */
1456 1456
 function boincwork_task_time_reported($received_time = NULL, $deadline = NULL, $context = NULL) {
1457
-  $output = '---';
1458
-  if ($received_time OR $deadline) {
1457
+    $output = '---';
1458
+    if ($received_time OR $deadline) {
1459 1459
     $timestamp = ($received_time) ? $received_time : $deadline;
1460 1460
     $output = date('j M Y G:i:s T', $timestamp);
1461 1461
     // Add a wrapper to deadline text
1462 1462
     if (!$received_time) {
1463
-      if (time() < $deadline) {
1463
+        if (time() < $deadline) {
1464 1464
         $output = '<span class="on-time">' . $output . '</span>';
1465
-      }
1466
-      else {
1465
+        }
1466
+        else {
1467 1467
         $output = '<span class="past-due">' . $output . '</span>';
1468
-      }
1468
+        }
1469 1469
     }
1470
-  }
1471
-  return $output;
1470
+    }
1471
+    return $output;
1472 1472
 }
1473 1473
 
1474 1474
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -1497,341 +1497,341 @@  discard block
 block discarded – undo
1497 1497
  *   for all applications.
1498 1498
  */
1499 1499
 function boincwork_tasktable($category = 0, $queryid = 1, $tselect = NULL, $app_id = 0) {
1500
-  // Check type parameter, if not (0,2) then return an error.
1501
-  if ( ($category!=0) AND ($category!=1) AND ($category!=2) ) {
1500
+    // Check type parameter, if not (0,2) then return an error.
1501
+    if ( ($category!=0) AND ($category!=1) AND ($category!=2) ) {
1502 1502
     watchdog('boincwork', 'task table called with invalid category = %category', array('%category' => $category), WATCHDOG_WARNING);
1503 1503
     return '';
1504
-  }
1504
+    }
1505 1505
 
1506
-  require_boinc( array('util', 'result') );
1506
+    require_boinc( array('util', 'result') );
1507 1507
 
1508
-  global $language;
1509
-  $locality=$language->language;
1510
-  $nf = new NumberFormatter($locality, NumberFormatter::DECIMAL);
1511
-  $nf->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 0);
1512
-  $nf->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 0);
1508
+    global $language;
1509
+    $locality=$language->language;
1510
+    $nf = new NumberFormatter($locality, NumberFormatter::DECIMAL);
1511
+    $nf->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 0);
1512
+    $nf->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 0);
1513 1513
 
1514
-  $output = '';
1514
+    $output = '';
1515 1515
 
1516
-  $state_hnames = array(
1516
+    $state_hnames = array(
1517 1517
     STATE_ALL => 'All',
1518 1518
     STATE_IN_PROGRESS => 'In progress',
1519 1519
     STATE_PENDING => 'Pending',
1520 1520
     STATE_VALID => 'Valid',
1521 1521
     STATE_INVALID => 'Invalid',
1522 1522
     STATE_ERROR => 'Error',
1523
-  );
1524
-  // Array (hash) to count total number of results/tasks, and their states.
1525
-  $taskstates = array(
1523
+    );
1524
+    // Array (hash) to count total number of results/tasks, and their states.
1525
+    $taskstates = array(
1526 1526
     STATE_ALL => 0,
1527 1527
     STATE_IN_PROGRESS => 0,
1528 1528
     STATE_PENDING => 0,
1529 1529
     STATE_VALID => 0,
1530 1530
     STATE_INVALID => 0,
1531 1531
     STATE_ERROR => 0,
1532
-  );
1533
-  // Array to hold pretty-print result data to be displayed in a table.
1534
-  $resultdata = array();
1535
-  // Arrays for applications. Form below uses $applications as parameter.
1536
-  $application_map = array();
1537
-  $application_select_count = array();
1538
-  $applications = array();
1532
+    );
1533
+    // Array to hold pretty-print result data to be displayed in a table.
1534
+    $resultdata = array();
1535
+    // Arrays for applications. Form below uses $applications as parameter.
1536
+    $application_map = array();
1537
+    $application_select_count = array();
1538
+    $applications = array();
1539 1539
 
1540
-  // BOINC DB queries for results, application names
1541
-  db_set_active('boinc');
1540
+    // BOINC DB queries for results, application names
1541
+    db_set_active('boinc');
1542 1542
 
1543
-  // Query to retreive all results, in order to calculate status for a
1544
-  // host with application names for each result.
1545
-  $sqlall = "SELECT user_friendly_name,"
1546
-      ."r.appid as appid,"
1547
-      ."r.server_state AS server_state,"
1548
-      ."r.outcome AS outcome,"
1549
-      ."r.client_state AS client_state,"
1550
-      ."r.validate_state AS validate_state,"
1551
-      ."r.exit_status AS exit_status "
1552
-      ."FROM {result} AS r "
1553
-      ."INNER JOIN {app} AS a "
1554
-      ."ON r.appid=a.id ";
1543
+    // Query to retreive all results, in order to calculate status for a
1544
+    // host with application names for each result.
1545
+    $sqlall = "SELECT user_friendly_name,"
1546
+        ."r.appid as appid,"
1547
+        ."r.server_state AS server_state,"
1548
+        ."r.outcome AS outcome,"
1549
+        ."r.client_state AS client_state,"
1550
+        ."r.validate_state AS validate_state,"
1551
+        ."r.exit_status AS exit_status "
1552
+        ."FROM {result} AS r "
1553
+        ."INNER JOIN {app} AS a "
1554
+        ."ON r.appid=a.id ";
1555 1555
 
1556
-  // Use userid, hostid, or workunitid
1557
-  if ($category==0) {
1556
+    // Use userid, hostid, or workunitid
1557
+    if ($category==0) {
1558 1558
     $sqlall .= "AND r.userid='%s' ";
1559
-  }
1560
-  elseif ($category==1) {
1559
+    }
1560
+    elseif ($category==1) {
1561 1561
     $sqlall .= "AND r.workunitid='%s' ";
1562
-  }
1563
-  elseif ($category==2) {
1562
+    }
1563
+    elseif ($category==2) {
1564 1564
     $sqlall .= "AND r.hostid='%s' ";
1565
-  }
1566
-  $sqlall .= "ORDER BY user_friendly_name";
1567
-  $dbres_all = db_query($sqlall, $queryid);
1568
-  db_set_active('default');
1565
+    }
1566
+    $sqlall .= "ORDER BY user_friendly_name";
1567
+    $dbres_all = db_query($sqlall, $queryid);
1568
+    db_set_active('default');
1569 1569
 
1570
-  // Loop 1 of DB results
1571
-  if ($dbres_all) {
1570
+    // Loop 1 of DB results
1571
+    if ($dbres_all) {
1572 1572
     while ($result = db_fetch_object($dbres_all)) {
1573
-      $mystate = state_num($result);
1574
-      if ( ($result->appid==$app_id) OR ($app_id==0) OR ($app_id==-1) ) {
1573
+        $mystate = state_num($result);
1574
+        if ( ($result->appid==$app_id) OR ($app_id==0) OR ($app_id==-1) ) {
1575 1575
         $taskstates[STATE_ALL]++;
1576 1576
         switch ($mystate) {
1577 1577
         case STATE_IN_PROGRESS:
1578 1578
           $taskstates[STATE_IN_PROGRESS]++;
1579
-          break;
1579
+            break;
1580 1580
         case STATE_PENDING:
1581 1581
           $taskstates[STATE_PENDING]++;
1582
-          break;
1582
+            break;
1583 1583
         case STATE_VALID:
1584 1584
           $taskstates[STATE_VALID]++;
1585
-          break;
1585
+            break;
1586 1586
         case STATE_INVALID:
1587 1587
           $taskstates[STATE_INVALID]++;
1588
-          break;
1588
+            break;
1589 1589
         case STATE_ERROR:
1590 1590
           $taskstates[STATE_ERROR]++;
1591
-          break;
1591
+            break;
1592 1592
         }
1593
-      }// if app_id
1593
+        }// if app_id
1594 1594
 
1595
-      //map holds a map between app ids and user friendly names for all applications.
1596
-      $application_map[$result->appid] = $result->user_friendly_name;
1597
-      if ( ($mystate == $tselect) OR ($tselect==STATE_ALL) ) {
1595
+        //map holds a map between app ids and user friendly names for all applications.
1596
+        $application_map[$result->appid] = $result->user_friendly_name;
1597
+        if ( ($mystate == $tselect) OR ($tselect==STATE_ALL) ) {
1598 1598
         //count of appids in the results.
1599 1599
         $application_select_count[$result->appid]++;
1600
-      }// if mystate
1600
+        }// if mystate
1601 1601
 
1602 1602
     }// while
1603
-  }
1604
-  else {
1605
-  }
1603
+    }
1604
+    else {
1605
+    }
1606 1606
   
1607
-  // Entry for all applications.
1608
-  $allcount = $application_select_count ? array_sum($application_select_count) : 0;
1609
-  $applications[-1] = bts('Application', array(), NULL, 'boinc:task-table');
1610
-  $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table') . ' (' . $allcount . ')';
1611
-  // Create application filter from application_map and application_select_count.
1612
-  foreach($application_map as $akey => $aname) {
1607
+    // Entry for all applications.
1608
+    $allcount = $application_select_count ? array_sum($application_select_count) : 0;
1609
+    $applications[-1] = bts('Application', array(), NULL, 'boinc:task-table');
1610
+    $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table') . ' (' . $allcount . ')';
1611
+    // Create application filter from application_map and application_select_count.
1612
+    foreach($application_map as $akey => $aname) {
1613 1613
     $acount = 0;
1614 1614
     if ( $application_select_count and array_key_exists($akey, $application_select_count) ) {
1615
-      $acount = $application_select_count[$akey];
1615
+        $acount = $application_select_count[$akey];
1616 1616
     }
1617 1617
     $applications[$akey] = $aname . ' ('. $acount . ')';
1618
-  }
1619
-  // Header array for (sub) results table.
1620
-  $resultheader = array(
1618
+    }
1619
+    // Header array for (sub) results table.
1620
+    $resultheader = array(
1621 1621
     array(
1622
-      'data' => bts('Task ID', array(), NULL, 'boinc:task-table'),
1623
-      'field' => 'id',
1622
+        'data' => bts('Task ID', array(), NULL, 'boinc:task-table'),
1623
+        'field' => 'id',
1624 1624
     ),
1625 1625
     array(
1626
-      'data' => bts('Workunit ID', array(), NULL, 'boinc:task-table'),
1627
-      'field' => 'workunitid',
1626
+        'data' => bts('Workunit ID', array(), NULL, 'boinc:task-table'),
1627
+        'field' => 'workunitid',
1628 1628
     ),
1629 1629
     array(
1630
-      'data' => bts('Computer', array(), NULL, 'boinc:task-table'),
1631
-      'field' => 'hostid',
1630
+        'data' => bts('Computer', array(), NULL, 'boinc:task-table'),
1631
+        'field' => 'hostid',
1632 1632
     ),
1633 1633
     array(
1634
-      'data' => bts('Sent', array(), NULL, 'boinc:task-table'),
1635
-      'field' => 'sent_time',
1634
+        'data' => bts('Sent', array(), NULL, 'boinc:task-table'),
1635
+        'field' => 'sent_time',
1636 1636
     ),
1637 1637
     array(
1638
-      'data' => bts('Time Reported or Deadline', array(), NULL, 'boinc:task-table')
1638
+        'data' => bts('Time Reported or Deadline', array(), NULL, 'boinc:task-table')
1639 1639
     ),
1640 1640
     array(
1641
-      'data' => bts('Status', array(), NULL, 'boinc:task-table')
1641
+        'data' => bts('Status', array(), NULL, 'boinc:task-table')
1642 1642
     ),
1643 1643
     array(
1644
-      'data' => bts('Run time', array(), NULL, 'boinc:task-table'),
1645
-      'field' => 'elapsed_time',
1644
+        'data' => bts('Run time', array(), NULL, 'boinc:task-table'),
1645
+        'field' => 'elapsed_time',
1646 1646
     ),
1647 1647
     array(
1648
-      'data' => bts('CPU time', array(), NULL, 'boinc:task-table'),
1649
-      'field' => 'cpu_time',
1648
+        'data' => bts('CPU time', array(), NULL, 'boinc:task-table'),
1649
+        'field' => 'cpu_time',
1650 1650
     ),
1651 1651
     array(
1652
-      'data' => bts('Granted Credit', array(), NULL, 'boinc:task-table'),
1653
-      'field' => 'granted_credit',
1652
+        'data' => bts('Granted Credit', array(), NULL, 'boinc:task-table'),
1653
+        'field' => 'granted_credit',
1654 1654
     ),
1655 1655
     // Application is a column, but won't be added until after tablesort_sql().
1656
-  );
1656
+    );
1657 1657
 
1658
-  // Query to retreive a subset of the total results for the results table.
1659
-  db_set_active('boinc');
1660
-  $sqlsub = "SELECT r.id AS id,"
1661
-      ."r.name AS name,"
1662
-      ."r.workunitid AS workunitid,"
1663
-      ."r.hostid as hostid,"
1664
-      ."r.sent_time AS sent_time,"
1665
-      ."r.received_time AS received_time,"
1666
-      ."r.report_deadline AS report_deadline,"
1667
-      ."r.server_state AS server_state,"
1668
-      ."r.outcome AS outcome,"
1669
-      ."r.client_state AS client_state,"
1670
-      ."r.validate_state AS validate_state,"
1671
-      ."r.exit_status AS exit_status,"
1672
-      ."r.elapsed_time AS elapsed_time,"
1673
-      ."r.cpu_time AS cpu_time,"
1674
-      ."r.granted_credit AS granted_credit,"
1675
-      ."r.appid AS appid,"
1676
-      ."r.app_version_id AS app_version_id,"
1677
-      ."a.user_friendly_name,"
1678
-      ."av.version_num AS version_number,"
1679
-      ."av.plan_class AS plan_class,"
1680
-      ."pl.name AS platform "
1681
-      ."FROM {result} AS r "
1682
-      ."INNER JOIN {app} AS a "
1683
-      ."ON r.appid=a.id "
1684
-      ."INNER JOIN {app_version} AS av "
1685
-      ."ON r.app_version_id=av.id "
1686
-      ."INNER JOIN {platform} AS pl "
1687
-      ."ON av.platformid=pl.id ";
1658
+    // Query to retreive a subset of the total results for the results table.
1659
+    db_set_active('boinc');
1660
+    $sqlsub = "SELECT r.id AS id,"
1661
+        ."r.name AS name,"
1662
+        ."r.workunitid AS workunitid,"
1663
+        ."r.hostid as hostid,"
1664
+        ."r.sent_time AS sent_time,"
1665
+        ."r.received_time AS received_time,"
1666
+        ."r.report_deadline AS report_deadline,"
1667
+        ."r.server_state AS server_state,"
1668
+        ."r.outcome AS outcome,"
1669
+        ."r.client_state AS client_state,"
1670
+        ."r.validate_state AS validate_state,"
1671
+        ."r.exit_status AS exit_status,"
1672
+        ."r.elapsed_time AS elapsed_time,"
1673
+        ."r.cpu_time AS cpu_time,"
1674
+        ."r.granted_credit AS granted_credit,"
1675
+        ."r.appid AS appid,"
1676
+        ."r.app_version_id AS app_version_id,"
1677
+        ."a.user_friendly_name,"
1678
+        ."av.version_num AS version_number,"
1679
+        ."av.plan_class AS plan_class,"
1680
+        ."pl.name AS platform "
1681
+        ."FROM {result} AS r "
1682
+        ."INNER JOIN {app} AS a "
1683
+        ."ON r.appid=a.id "
1684
+        ."INNER JOIN {app_version} AS av "
1685
+        ."ON r.app_version_id=av.id "
1686
+        ."INNER JOIN {platform} AS pl "
1687
+        ."ON av.platformid=pl.id ";
1688 1688
 
1689
-  // Use userid, hostid, or workunitid
1690
-  if ($category==0) {
1689
+    // Use userid, hostid, or workunitid
1690
+    if ($category==0) {
1691 1691
     $sqlsub .= "AND r.userid = '%s' ";
1692
-  }
1693
-  elseif ($category==1) {
1692
+    }
1693
+    elseif ($category==1) {
1694 1694
     $sqlsub .= "AND r.workunitid = '%s' ";
1695
-  }
1696
-  elseif ($category==2) {
1695
+    }
1696
+    elseif ($category==2) {
1697 1697
     $sqlsub .= "AND r.hostid = '%s' ";
1698
-  }
1698
+    }
1699 1699
 
1700
-  // Append additional where clauses based on task selection.
1701
-  switch ($tselect) {
1702
-  case STATE_IN_PROGRESS:
1700
+    // Append additional where clauses based on task selection.
1701
+    switch ($tselect) {
1702
+    case STATE_IN_PROGRESS:
1703 1703
     $sqlsub .= "AND r.server_state = 4 ";
1704 1704
     break;
1705
-  case STATE_PENDING:
1705
+    case STATE_PENDING:
1706 1706
     $sqlsub .= "AND (r.server_state = 5) AND (r.outcome = 1) AND (r.validate_state >= 0) AND (r.validate_state <= 0 OR r.validate_state >= 4) AND (r.validate_state <= 4) ";
1707 1707
     break;
1708
-  case STATE_VALID:
1708
+    case STATE_VALID:
1709 1709
     $sqlsub .= "AND (r.server_state = 5) AND (r.outcome = 1) AND (r.validate_state = 1) ";
1710 1710
     break;
1711
-  case STATE_INVALID:
1711
+    case STATE_INVALID:
1712 1712
     $sqlsub .= "AND (r.server_state = 5) AND ((r.outcome = 6) OR ((r.outcome = 1) AND ((r.validate_state = 2) OR (r.validate_state = 3) OR (r.validate_state = 5)))) ";
1713 1713
     break;
1714
-  case STATE_ERROR:
1714
+    case STATE_ERROR:
1715 1715
     $sqlsub .= "AND (r.server_state = 5) AND (r.outcome >= 3) AND (r.outcome <= 4 OR r.outcome >= 7) AND (r.outcome <= 7) ";
1716 1716
     break;
1717
-  }
1717
+    }
1718 1718
 
1719
-  if (is_numeric($app_id) AND $app_id>0 ) {
1719
+    if (is_numeric($app_id) AND $app_id>0 ) {
1720 1720
     $sqlsub .= " AND r.appid = '%s'";
1721 1721
     $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid, $app_id);
1722
-  }
1723
-  else {
1722
+    }
1723
+    else {
1724 1724
     $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid);
1725
-  }
1726
-  db_set_active('default');
1725
+    }
1726
+    db_set_active('default');
1727 1727
 
1728
-  // Loop 2 over DB results.
1729
-  if ($dbres_sub) {
1728
+    // Loop 2 over DB results.
1729
+    if ($dbres_sub) {
1730 1730
     while ($result = db_fetch_object($dbres_sub)) {
1731
-      // check if state matches selection
1732
-      if ( (state_num($result) == $tselect) OR ($tselect==STATE_ALL) ) {
1731
+        // check if state matches selection
1732
+        if ( (state_num($result) == $tselect) OR ($tselect==STATE_ALL) ) {
1733 1733
         // create pretty result row
1734 1734
         $prettyresult = array(
1735
-          array(
1735
+            array(
1736 1736
             'data' => l($result->name, "task/{$result->id}"),
1737 1737
             'class' => 'task-name',
1738
-          ),
1739
-          l($result->workunitid, "workunit/{$result->workunitid}"),
1740
-          l($result->hostid, "host/{$result->hostid}"),
1741
-          date('j M Y G:i:s T', $result->sent_time),
1742
-          boincwork_task_time_reported($result->received_time, $result->report_deadline),
1743
-          state_string($result),
1744
-          $nf->format($result->elapsed_time),
1745
-          $nf->format($result->cpu_time),
1746
-          $nf->format($result->granted_credit),
1747
-          array(
1738
+            ),
1739
+            l($result->workunitid, "workunit/{$result->workunitid}"),
1740
+            l($result->hostid, "host/{$result->hostid}"),
1741
+            date('j M Y G:i:s T', $result->sent_time),
1742
+            boincwork_task_time_reported($result->received_time, $result->report_deadline),
1743
+            state_string($result),
1744
+            $nf->format($result->elapsed_time),
1745
+            $nf->format($result->cpu_time),
1746
+            $nf->format($result->granted_credit),
1747
+            array(
1748 1748
             'data' => $result->user_friendly_name . " " . pretty_application_version($result->version_number, $result->plan_class, $result->platform),
1749 1749
             'class' => 'task-app',
1750
-          ),
1750
+            ),
1751 1751
         );
1752 1752
         $resultdata[] = array_values($prettyresult);
1753
-      }
1753
+        }
1754 1754
     }// while
1755
-  }
1756
-  else {
1757
-  }
1758
-  // Begin result navigation
1755
+    }
1756
+    else {
1757
+    }
1758
+    // Begin result navigation
1759 1759
 
1760
-  // Set pathprefix based on type
1761
-  if ($category==0) {
1760
+    // Set pathprefix based on type
1761
+    if ($category==0) {
1762 1762
     $pathprefix = 'account/tasks';
1763
-  }
1764
-  elseif ($category==1) {
1763
+    }
1764
+    elseif ($category==1) {
1765 1765
     $pathprefix = 'workunit/' . $queryid . '/tasks';
1766
-  }
1767
-  elseif ($category==2) {
1766
+    }
1767
+    elseif ($category==2) {
1768 1768
     $pathprefix = 'host/' . $queryid . '/tasks';
1769
-  }
1770
-  // Need an "All" tab as well, maps to app_id of zero.
1771
-  $application_map[0] = bts('All', array(), NULL, 'boinc:task-table');
1772
-  $stitems = array();
1773
-  foreach ($taskstates as $state => $numstates) {
1769
+    }
1770
+    // Need an "All" tab as well, maps to app_id of zero.
1771
+    $application_map[0] = bts('All', array(), NULL, 'boinc:task-table');
1772
+    $stitems = array();
1773
+    foreach ($taskstates as $state => $numstates) {
1774 1774
     $mypath = $pathprefix . '/' . $state . '/' . $app_id;
1775 1775
     if ($state==STATE_ALL) {
1776
-      $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1776
+        $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1777 1777
     }
1778 1778
     else {
1779
-      $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1779
+        $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1780 1780
     }
1781 1781
     $myitem = array(
1782
-      'data' => l($ltext, $mypath, array('html' => TRUE) ),
1782
+        'data' => l($ltext, $mypath, array('html' => TRUE) ),
1783 1783
     );
1784 1784
     if ($state==$tselect) {
1785
-      $myitem['class'] = 'active';
1785
+        $myitem['class'] = 'active';
1786 1786
     }
1787 1787
     $stitems[] = $myitem;
1788
-  }
1789
-  // Add reset button
1790
-  $mypath = $pathprefix . '/0/0';
1791
-  $ltext = '<span class="tab">' . bts('Reset', array(), NULL, 'boinc:task-table') . '</span>';
1792
-  $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => TRUE) ) );
1788
+    }
1789
+    // Add reset button
1790
+    $mypath = $pathprefix . '/0/0';
1791
+    $ltext = '<span class="tab">' . bts('Reset', array(), NULL, 'boinc:task-table') . '</span>';
1792
+    $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => TRUE) ) );
1793 1793
 
1794
-  $output .= theme_item_list($stitems, $title = NULL, $type='ul'. $attributes=' class="tabs secondary clearfix"');
1794
+    $output .= theme_item_list($stitems, $title = NULL, $type='ul'. $attributes=' class="tabs secondary clearfix"');
1795 1795
 
1796
-  // Application select-drop down form
1797
-  // Hack to place Application form into header
1798
-  // App ID of zero maps to "-1" for drop-down box.
1799
-  if ($app_id==0) {
1796
+    // Application select-drop down form
1797
+    // Hack to place Application form into header
1798
+    // App ID of zero maps to "-1" for drop-down box.
1799
+    if ($app_id==0) {
1800 1800
     $app_id=-1;
1801
-  }
1802
-  $resultheader[] = drupal_get_form('boincwork_selectapp_form', $applications, $app_id);
1801
+    }
1802
+    $resultheader[] = drupal_get_form('boincwork_selectapp_form', $applications, $app_id);
1803 1803
 
1804
-  // Begin table of results
1805
-  if ( is_array($resultheader) AND is_array($resultdata) ) {
1804
+    // Begin table of results
1805
+    if ( is_array($resultheader) AND is_array($resultdata) ) {
1806 1806
 
1807 1807
     // Take advantage of the fact that $category is the same as the row/column we want to remove.
1808 1808
     if ( ($category==1) OR ($category==2) ) {
1809
-      unset($resultheader[$category]);
1810
-      delete_col($resultdata, $category);
1809
+        unset($resultheader[$category]);
1810
+        delete_col($resultdata, $category);
1811 1811
     }
1812 1812
 
1813 1813
     $output .= theme_table($resultheader, $resultdata);
1814 1814
     if (count($resultdata) > 0) {
1815
-      $output .= theme('pager');
1815
+        $output .= theme('pager');
1816 1816
     }
1817
-  }
1818
-  return $output;
1817
+    }
1818
+    return $output;
1819 1819
 }
1820 1820
 
1821 1821
 /**
1822 1822
  * Function to delete a column from an array.
1823 1823
  */
1824 1824
 function delete_col(&$array, $offset) {
1825
-  return array_walk($array, function (&$v) use ($offset) {
1826
-     array_splice($v, $offset, 1);
1827
-  });
1825
+    return array_walk($array, function (&$v) use ($offset) {
1826
+        array_splice($v, $offset, 1);
1827
+    });
1828 1828
 }
1829 1829
 
1830 1830
 /**
1831 1831
  * Pretty print the application version
1832 1832
  */
1833 1833
 function pretty_application_version($vernum, $plan_class, $plfm) {
1834
-  $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
1835
-  $prettyc = ($plan_class) ? "($av->plan_class)" : '';
1836
-  return "v$prettyv $prettyc $plfm";
1834
+    $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
1835
+    $prettyc = ($plan_class) ? "($av->plan_class)" : '';
1836
+    return "v$prettyv $prettyc $plfm";
1837 1837
 }
1838 1838
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $preset_prefs['preset'] = array($preset_prefs['preset']);
174 174
       }
175 175
       foreach ($preset_prefs['preset'] as $key => $prefs) {
176
-        if (isset($prefs['@attributes']['name']) AND $prefs['@attributes']['name'] == $preset) {
176
+        if (isset($prefs['@attributes']['name']) and $prefs['@attributes']['name'] == $preset) {
177 177
           return $preset_prefs['preset'][$key];
178 178
         }
179 179
       }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     $lines = explode("\r", $raw_config_data);
199 199
     drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
200 200
       ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
201
-    return NULL;
201
+    return null;
202 202
   }
203 203
   
204 204
   // Convert XML to array for validation
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     $xml = $xml['project_specific_preferences'];
218 218
   }
219 219
   foreach ($xml as $type => $elements) {
220
-    if (is_array($elements) AND !is_numeric(key($elements))) {
220
+    if (is_array($elements) and !is_numeric(key($elements))) {
221 221
       $elements = array($elements);
222 222
     }
223 223
     switch ($type) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
   }
307 307
   foreach ($xml as $type => $elements) {
308 308
     $structure_data = array();
309
-    if (is_array($elements) AND !is_numeric(key($elements))) {
309
+    if (is_array($elements) and !is_numeric(key($elements))) {
310 310
       $elements = array($elements);
311 311
     }
312 312
     switch ($type) {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     case 'boolean':
331 331
       foreach ($elements as $element) {
332 332
         $name = $element['@attributes']['name'];
333
-        if (isset($element['@attributes']['entitytype']) AND $element['@attributes']['entitytype'] == 'attribute') {
333
+        if (isset($element['@attributes']['entitytype']) and $element['@attributes']['entitytype'] == 'attribute') {
334 334
           $defaults['@attributes'][$name] = $values[$name];
335 335
         }
336 336
         else {
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         $user_pref = $user_prefs['@attributes'];
383 383
       }
384 384
       if (isset($user_pref[$name])) {
385
-        if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
385
+        if (is_array($user_pref[$name]) and isset($user_pref[$name]['@value'])) {
386 386
           $value = $user_pref[$name]['@value'];
387 387
         }
388 388
         else {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         '#type' => 'textfield',
421 421
         '#default_value' => $value,
422 422
         '#size' => 5,
423
-        '#description' => $description . bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project')
423
+        '#description' => $description . bts(' Default value: @default', array('@default' => $default), null, 'boinc:account-preferences-project')
424 424
       );
425 425
     }
426 426
     break;
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     foreach ($elements as $element) {
433 433
       $name = $element['@attributes']['name'];
434 434
       $title = is_array($element['title']) ? $element['title']['@value'] : $element['title'];
435
-      $default = (isset($element['@attributes']['selected']) AND $element['@attributes']['selected'] == 'true') ? 1 : 0;
435
+      $default = (isset($element['@attributes']['selected']) and $element['@attributes']['selected'] == 'true') ? 1 : 0;
436 436
       $description = '';
437 437
       if (isset($element['description'])) {
438 438
         $description = is_array($element['description']) ? $element['description']['@value'] : $element['description'];
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $user_pref = $user_prefs['@attributes'];
446 446
       }
447 447
       if (isset($user_pref[$name])) {
448
-        if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) {
448
+        if (is_array($user_pref[$name]) and isset($user_pref[$name]['@value'])) {
449 449
           $value = $user_pref[$name]['@value'];
450 450
         }
451 451
         else {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
       $form[$name] = array(
467 467
         '#title' => $title,
468 468
         '#type' => 'radios',
469
-        '#options' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')),
469
+        '#options' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')),
470 470
         '#attributes' => array('class' => 'fancy'),
471 471
         '#default_value' => $value,
472 472
         '#description' => $description
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
       foreach($element['items']['item'] as $item) {
488 488
         if (is_array($item)) {
489 489
           $value = $item['@value'];
490
-          if ($default === NULL AND
491
-              isset($item['@attributes']) AND
490
+          if ($default === null and
491
+              isset($item['@attributes']) and
492 492
               isset($item['@attributes']['selected'])) {
493 493
             $default = ($item['@attributes']['selected'] == 'true') ? $item['@value'] : null;
494 494
           }
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         '#options' => $options,
527 527
         '#attributes' => array('class' => 'fancy'),
528 528
         '#default_value' => $value,
529
-        '#description' => $description . bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project')
529
+        '#description' => $description . bts(' Default value: @default', array('@default' =>$default), null, 'boinc:account-preferences-project')
530 530
       );
531 531
     }
532 532
     break;
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
       }
542 542
     
543 543
     $form['applications'] = array(
544
-      '#title' => bts('Applications', array(), NULL, 'boinc:account-preferences'),
544
+      '#title' => bts('Applications', array(), null, 'boinc:account-preferences'),
545 545
       '#type' => 'fieldset',
546 546
       '#description' => $title,
547
-      '#collapsible' => TRUE,
548
-      '#collapsed' => FALSE
547
+      '#collapsible' => true,
548
+      '#collapsed' => false
549 549
     );
550 550
     $applications = array();
551 551
     if (!is_array($user_prefs['app_id'])) {
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     }
554 554
     foreach ($user_prefs['app_id'] as $app) {
555 555
       if (!$app) continue;
556
-      if (is_array($app) AND isset($app['@value'])) {
556
+      if (is_array($app) and isset($app['@value'])) {
557 557
         $app = $app['@value'];
558 558
       }
559 559
       $applications[] = $app;
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
     foreach ($elements['app'] as $app) {
562 562
       $app_id = $app['@attributes']['id'];
563 563
       $app_name = $app['@value'];
564
-      $app_enabled = TRUE;
565
-      if (isset($app['@attributes']['enabled']) AND
564
+      $app_enabled = true;
565
+      if (isset($app['@attributes']['enabled']) and
566 566
           $app['@attributes']['enabled'] == 'false') {
567
-        $app_enabled = FALSE;
567
+        $app_enabled = false;
568 568
       }
569 569
       if ($applications) {
570 570
         $checked = in_array($app_id, $applications);
571 571
       } else {
572
-        $checked = TRUE;
573
-        if (isset($app['@attributes']['selected']) AND
572
+        $checked = true;
573
+        if (isset($app['@attributes']['selected']) and
574 574
             $app['@attributes']['selected'] == 'false') {
575
-          $checked = FALSE;
575
+          $checked = false;
576 576
         }
577 577
       }
578 578
       $form['applications']["app_{$app_id}"] = array(
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
       $form[$name] = array(
604 604
           '#title' => $title,
605 605
           '#type' => 'fieldset',
606
-          '#tree' => FALSE,
606
+          '#tree' => false,
607 607
           //'#description' => t('Notes about this group of fields'),
608
-          '#collapsible' => TRUE,
609
-          '#collapsed' => FALSE
608
+          '#collapsible' => true,
609
+          '#collapsed' => false
610 610
       );
611 611
       // Recursively populate the compound element
612 612
       foreach ($element as $child_type => $child) {
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
           '#title' => $title,
634 634
           '#type' => 'fieldset',
635 635
           //'#description' => t('Notes about this group of fields'),
636
-          '#collapsible' => TRUE,
637
-          '#collapsed' => FALSE
636
+          '#collapsible' => true,
637
+          '#collapsed' => false
638 638
       );
639 639
       // Recursively populate the compound element
640 640
       foreach ($element['attributes'] as $child_type => $child) {
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
  * Generate a tabular structure out of preferences for use in comparison
654 654
  * views of preference sets
655 655
  */
656
-function boincwork_make_prefs_table($prefs, $top_level = TRUE) {
656
+function boincwork_make_prefs_table($prefs, $top_level = true) {
657 657
 
658 658
   $prefs_table = array();
659 659
   $uncategorized = array();
@@ -662,15 +662,15 @@  discard block
 block discarded – undo
662 662
   foreach ($prefs as $key => $element) {
663 663
     
664 664
     // Determine which type of element this is and act accordingly
665
-    $element_type = NULL;
666
-    if (is_array($element) AND isset($element['#type'])) {
665
+    $element_type = null;
666
+    if (is_array($element) and isset($element['#type'])) {
667 667
       $element_type = $element['#type'];
668 668
     }
669 669
     switch ($element_type) {
670 670
     case 'fieldset':
671 671
       $prefs_table[$key] = array(
672 672
         'name' => $element['#title'],
673
-        'elements' => boincwork_make_prefs_table($element, FALSE),
673
+        'elements' => boincwork_make_prefs_table($element, false),
674 674
       );
675 675
       break;
676 676
     case 'textfield':
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
       if (in_array($key, array('start_hour', 'net_start_hour'))) {
682 682
         switch ($key) {
683 683
         case 'start_hour':
684
-          $element['#title'] = bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing');
684
+          $element['#title'] = bts('Compute only between:', array(), null, 'boinc:account-preferences-computing');
685 685
           break;
686 686
         case 'net_start_hour':
687
-          $element['#title'] = bts('Transfer files only between:', array(), NULL, 'boinc:account-preferences-comuting');
687
+          $element['#title'] = bts('Transfer files only between:', array(), null, 'boinc:account-preferences-comuting');
688 688
           break;
689 689
         default:
690 690
         }
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
       $prefs_element = array(
693 693
         'name' => (isset($element['#title'])) ? $element['#title'] : '',
694 694
         'description' => (isset($element['#description'])) ? $element['#description'] : '',
695
-        'default_value' => (isset($element['#default_value'])) ? $element['#default_value'] : NULL,
695
+        'default_value' => (isset($element['#default_value'])) ? $element['#default_value'] : null,
696 696
       );
697 697
       if ($top_level) {
698 698
         $uncategorized[$key] = $prefs_element;
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
     }
706 706
   }
707 707
   
708
-  if ($prefs_table AND $uncategorized) {
708
+  if ($prefs_table and $uncategorized) {
709 709
     // Throw any settings that don't fit elsewhere into "other"
710 710
     $prefs_table['other'] = array(
711
-      'name' => bts('Other settings', array(), NULL, 'boinc:account-preferences'),
711
+      'name' => bts('Other settings', array(), null, 'boinc:account-preferences'),
712 712
       'elements' => $uncategorized,
713 713
     );
714 714
   }
715 715
   elseif ($uncategorized) {
716 716
     // If nothing is categorized, output all prefs under a general "settings"
717 717
     $prefs_table['settings'] = array(
718
-      'name' => bts('Settings', array(), NULL, 'boinc:account-preferences'),
718
+      'name' => bts('Settings', array(), null, 'boinc:account-preferences'),
719 719
       'elements' => $uncategorized,
720 720
     );
721 721
   }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
   }
755 755
   
756 756
   // Return general preferences or a subset based on venue
757
-  if (!$venue OR $venue == 'generic') {
757
+  if (!$venue or $venue == 'generic') {
758 758
     unset($main_prefs['venue']);
759 759
     // Use the length of the $main_prefs array as a condition as to
760 760
     // whether the preferences have already been set. This is
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         $main_prefs['venue'] = array($main_prefs['venue']);
770 770
       }
771 771
       foreach ($main_prefs['venue'] as $key => $prefs_venue) {
772
-        if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) {
772
+        if (isset($prefs_venue['@attributes']['name']) and $prefs_venue['@attributes']['name'] == $venue) {
773 773
           return $main_prefs['venue'][$key];
774 774
         }
775 775
       }
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
   // Save all preferences or a subset based on venue
815 815
   //drupal_set_message('<pre>' . print_r($main_prefs, true) . '</pre>');
816 816
   $new_venue = true;
817
-  if (!$venue OR $venue == 'generic') {
817
+  if (!$venue or $venue == 'generic') {
818 818
     //$main_prefs = $prefs;
819 819
     $main_prefs = $prefs + $main_prefs;
820 820
   }
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
         $main_prefs['venue'] = array($main_prefs['venue']);
825 825
       }
826 826
       foreach ($main_prefs['venue'] as $key => $prefs_venue) {
827
-        if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) {
827
+        if (isset($prefs_venue['@attributes']['name']) and $prefs_venue['@attributes']['name'] == $venue) {
828 828
           if ($prefs) {
829 829
             $main_prefs['venue'][$key] = $prefs;
830 830
           }
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
       else {
931 931
         $form_field = $field;
932 932
       }
933
-      if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) {
934
-        form_set_error($form_field, bts('Invalid data type for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
933
+      if (isset($rules['datatype']) and !boincwork_validate_datatype($values[$field], $rules['datatype'])) {
934
+        form_set_error($form_field, bts('Invalid data type for @field', array('@field' => $field), null, 'boinc:account-preferences'));
935 935
       }
936
-      if (isset($rules['min']) AND $values[$field] < $rules['min']) {
937
-        form_set_error($form_field, bts('Minimum value not met for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
936
+      if (isset($rules['min']) and $values[$field] < $rules['min']) {
937
+        form_set_error($form_field, bts('Minimum value not met for @field', array('@field' => $field), null, 'boinc:account-preferences'));
938 938
       }
939
-      if (isset($rules['max']) AND $values[$field] > $rules['max']) {
940
-        form_set_error($form_field, bts('Maximum value exceeded for @field', array('@field' => $field), NULL, 'boinc:account-preferences'));
939
+      if (isset($rules['max']) and $values[$field] > $rules['max']) {
940
+        form_set_error($form_field, bts('Maximum value exceeded for @field', array('@field' => $field), null, 'boinc:account-preferences'));
941 941
       }
942 942
     }
943 943
   }
@@ -946,25 +946,25 @@  discard block
 block discarded – undo
946 946
 /**
947 947
  * Check that numeric data conforms to specifications
948 948
  */
949
-function boincwork_validate_datatype($data, $datatype = NULL) {
949
+function boincwork_validate_datatype($data, $datatype = null) {
950 950
   switch ($datatype) {
951 951
   case 'float':
952 952
     if (!is_numeric($data)) {
953
-      return FALSE;
953
+      return false;
954 954
     }
955 955
     $data += 0.0;
956 956
     if (!is_float($data)) {
957
-      return FALSE;
957
+      return false;
958 958
     }
959 959
     break;
960 960
     
961 961
   case 'integer':
962 962
     if (!is_numeric($data)) {
963
-      return FALSE;
963
+      return false;
964 964
     }
965 965
     $data += 0;
966 966
     if (!is_int($data)) {
967
-      return FALSE;
967
+      return false;
968 968
     }
969 969
     break;
970 970
   
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
   default:
973 973
     
974 974
   }
975
-  return TRUE;
975
+  return true;
976 976
 }
977 977
 
978 978
 /**
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
       if (is_array($value)) {
1051 1051
         if (is_numeric(key($value))) {
1052 1052
           foreach ($value as $item) {
1053
-            if (is_array($item) AND isset($item['@position'])) {
1053
+            if (is_array($item) and isset($item['@position'])) {
1054 1054
               $ordered_array[$item['@position']] = array(
1055 1055
                 $name => $item
1056 1056
               );
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
               $sibling = $node->nextSibling;
1204 1204
               
1205 1205
               // Determine if this node forms a set with siblings (share a node name)
1206
-              while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling;
1206
+              while (($sibling) and (($sibling->nodeType != XML_ELEMENT_NODE) or ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling;
1207 1207
               if (!$sibling) {
1208 1208
                   $sibling = $node->previousSibling;
1209
-                  while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling;
1209
+                  while (($sibling) and (($sibling->nodeType != XML_ELEMENT_NODE) or ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling;
1210 1210
               }
1211 1211
               
1212 1212
               if ($sibling) {
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                   }
1217 1217
                   if ($node->hasAttributes()) {
1218 1218
                       $attributes = $node->attributes;
1219
-                      if ($result[$node_name][$index] !== '' AND !is_array($result[$node_name][$index])) {
1219
+                      if ($result[$node_name][$index] !== '' and !is_array($result[$node_name][$index])) {
1220 1220
                           $result[$node_name][$index] = array('@value' => $result[$node_name][$index]);
1221 1221
                       }
1222 1222
                       foreach ($attributes as $key => $attribute) {
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
                   }
1240 1240
                   if ($node->hasAttributes()) {
1241 1241
                       $attributes = $node->attributes;
1242
-                      if ($result[$node_name] !== '' AND !is_array($result[$node_name])) {
1242
+                      if ($result[$node_name] !== '' and !is_array($result[$node_name])) {
1243 1243
                           $result[$node_name] = array('@value' => $result[$node_name]);
1244 1244
                       }
1245 1245
                       foreach($attributes as $key => $attribute) {
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 /**
1271 1271
   * Determine output for host list views when no hosts are found.
1272 1272
   */
1273
-function boincwork_views_host_list_empty_text($context = NULL) {
1273
+function boincwork_views_host_list_empty_text($context = null) {
1274 1274
   
1275 1275
   // Pull the BOINC user ID from the view arguments to get show_hosts 
1276 1276
   // preference for that user
@@ -1284,28 +1284,28 @@  discard block
 block discarded – undo
1284 1284
   if ($boincuser->show_hosts) {
1285 1285
     switch($context) {
1286 1286
     case 'active':
1287
-      $output .=  '<h2>' . bts('No active computers', array(), NULL, 'boinc:host-list') . '</h2>';
1287
+      $output .=  '<h2>' . bts('No active computers', array(), null, 'boinc:host-list') . '</h2>';
1288 1288
       $output .=  '<p>' . bts('This user has no computers that have been'
1289
-      . ' active in the last 30 days.', array(), NULL, 'boinc:host-list') . '</p>';
1289
+      . ' active in the last 30 days.', array(), null, 'boinc:host-list') . '</p>';
1290 1290
       break;
1291 1291
       
1292 1292
     case 'preferences':
1293
-      $output .=  '<h2>' . bts('No computers', array(), NULL, 'boinc:host-list') . '</h2>';
1293
+      $output .=  '<h2>' . bts('No computers', array(), null, 'boinc:host-list') . '</h2>';
1294 1294
       $output .=  '<p>' . bts('There are no computers assigned to this'
1295
-      . ' preference set.', array(), NULL, 'boinc:host-list') . '</p>';
1295
+      . ' preference set.', array(), null, 'boinc:host-list') . '</p>';
1296 1296
       break;
1297 1297
     
1298 1298
     default:
1299
-      $output .=  '<h2>' . bts('Computers pending', array(), NULL, 'boinc:host-list') . '</h2>';
1299
+      $output .=  '<h2>' . bts('Computers pending', array(), null, 'boinc:host-list') . '</h2>';
1300 1300
       $output .=  '<p>' . bts('This user does not yet have any associated'
1301 1301
       . ' computers. Computers will be displayed when they have earned their'
1302
-      . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>';
1302
+      . ' first credits.', array(), null, 'boinc:host-list') . '</p>';
1303 1303
     }
1304 1304
   }
1305 1305
   else {
1306
-    $output .=  '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>';
1306
+    $output .=  '<h2>' . bts('Computers hidden', array(), null, 'boinc:host-list') . '</h2>';
1307 1307
     $output .=  '<p>' . bts('This user has chosen not to show information'
1308
-    . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>';
1308
+    . ' about their computers.', array(), null, 'boinc:host-list') . '</p>';
1309 1309
   }
1310 1310
   return $output;
1311 1311
 }
@@ -1313,15 +1313,15 @@  discard block
 block discarded – undo
1313 1313
 /**
1314 1314
   * Determine output for task list views when no tasks are found.
1315 1315
   */
1316
-function boincwork_views_task_list_empty_text($context = NULL) {
1316
+function boincwork_views_task_list_empty_text($context = null) {
1317 1317
   
1318 1318
   // 
1319 1319
   $output = '';
1320 1320
   switch($context) {
1321 1321
   default:
1322
-    $output .=  '<h2>' . bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list')
1322
+    $output .=  '<h2>' . bts('No @type tasks', array('@type' => $context), null, 'boinc:task-list')
1323 1323
     . '</h2>';
1324
-    $output .=  '<p>' . bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list')
1324
+    $output .=  '<p>' . bts('There are no tasks of this type on record', array(), null, 'boinc:task-list')
1325 1325
     . '</p>';
1326 1326
   }
1327 1327
   return $output;
@@ -1335,18 +1335,18 @@  discard block
 block discarded – undo
1335 1335
   if (boincwork_host_user_is_owner($host_id)) {
1336 1336
     // Show merge hosts option
1337 1337
     $output = '<ul class="tab-list"><li class="first tab">';
1338
-    $output .= l(bts('Merge', array(), NULL, 'boinc:form-merge'), "host/{$host_id}/merge");
1338
+    $output .= l(bts('Merge', array(), null, 'boinc:form-merge'), "host/{$host_id}/merge");
1339 1339
     $output .= '</li>';
1340 1340
     // If host has no tasks, allow the host to be deleted
1341 1341
     if (!boincwork_host_get_task_count($host_id)) {
1342 1342
       $output .= '<li class="tab">';
1343
-      $output .= l(bts('Delete', array(), NULL, 'boinc:form-delete'), "host/{$host_id}/delete",
1343
+      $output .= l(bts('Delete', array(), null, 'boinc:form-delete'), "host/{$host_id}/delete",
1344 1344
         array(
1345 1345
           'attributes' => array(
1346 1346
             'onclick' => 'return confirm(\'' . bts('This will delete host @id'
1347 1347
               . ' from your account forever. Are you sure this is OK?',
1348 1348
               array('@id' => $host_id),
1349
-              NULL, 'boinc:account-host-delete') . '\')'
1349
+              null, 'boinc:account-host-delete') . '\')'
1350 1350
           )
1351 1351
         )
1352 1352
       );
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 /**
1387 1387
  * Check whether a user is the owner of a host
1388 1388
  */
1389
-function boincwork_host_user_is_owner($host_id, $uid = NULL) {
1389
+function boincwork_host_user_is_owner($host_id, $uid = null) {
1390 1390
   if (!$uid) {
1391 1391
     global $user;
1392 1392
     $uid = $user->uid;
@@ -1405,18 +1405,18 @@  discard block
 block discarded – undo
1405 1405
 /**
1406 1406
   * Determine output for host last contact time
1407 1407
   */
1408
-function boincwork_host_last_contact($timestamp, $host_id = NULL, $context = NULL) {
1408
+function boincwork_host_last_contact($timestamp, $host_id = null, $context = null) {
1409 1409
   $output = '---';
1410 1410
   $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
1411 1411
   $log = '';
1412 1412
   if ($timestamp) {
1413 1413
     $output = date('j M Y G:i:s T', $timestamp);
1414 1414
   }
1415
-  if ($root_log_dir AND $host_id) {
1416
-    $subdir = substr($host_id, 0, -3) OR $subdir = 0;
1415
+  if ($root_log_dir and $host_id) {
1416
+    $subdir = substr($host_id, 0, -3) or $subdir = 0;
1417 1417
     $log = implode('/', array($root_log_dir, $subdir, $host_id));
1418 1418
   }
1419
-  if ($log AND file_exists($log)) {
1419
+  if ($log and file_exists($log)) {
1420 1420
     $output = l($output, "host/{$host_id}/log");
1421 1421
   }
1422 1422
   return $output;
@@ -1430,10 +1430,10 @@  discard block
 block discarded – undo
1430 1430
   if (function_exists('jump_quickly')) {
1431 1431
     $path = "host/{$host_id}/set-venue";
1432 1432
     $venues = array(
1433
-      "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
1434
-      "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
1435
-      "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location'),
1436
-      "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location')
1433
+      "{$path}/generic" => bts('Generic', array(), null, 'boinc:account-preferences-location'),
1434
+      "{$path}/home" => bts('Home', array(), null, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
1435
+      "{$path}/work" => bts('Work', array(), null, 'boinc:account-preferences-location'),
1436
+      "{$path}/school" => bts('School', array(), null, 'boinc:account-preferences-location')
1437 1437
     );
1438 1438
     variable_set('jump_use_js_venues-Array', 1);
1439 1439
     drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -1453,9 +1453,9 @@  discard block
 block discarded – undo
1453 1453
 /**
1454 1454
   * Determine output for task reported time / deadline
1455 1455
   */
1456
-function boincwork_task_time_reported($received_time = NULL, $deadline = NULL, $context = NULL) {
1456
+function boincwork_task_time_reported($received_time = null, $deadline = null, $context = null) {
1457 1457
   $output = '---';
1458
-  if ($received_time OR $deadline) {
1458
+  if ($received_time or $deadline) {
1459 1459
     $timestamp = ($received_time) ? $received_time : $deadline;
1460 1460
     $output = date('j M Y G:i:s T', $timestamp);
1461 1461
     // Add a wrapper to deadline text
@@ -1496,9 +1496,9 @@  discard block
 block discarded – undo
1496 1496
  *   Application id of the application chosen by user. 0 and -1 are
1497 1497
  *   for all applications.
1498 1498
  */
1499
-function boincwork_tasktable($category = 0, $queryid = 1, $tselect = NULL, $app_id = 0) {
1499
+function boincwork_tasktable($category = 0, $queryid = 1, $tselect = null, $app_id = 0) {
1500 1500
   // Check type parameter, if not (0,2) then return an error.
1501
-  if ( ($category!=0) AND ($category!=1) AND ($category!=2) ) {
1501
+  if ( ($category!=0) and ($category!=1) and ($category!=2) ) {
1502 1502
     watchdog('boincwork', 'task table called with invalid category = %category', array('%category' => $category), WATCHDOG_WARNING);
1503 1503
     return '';
1504 1504
   }
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
   if ($dbres_all) {
1572 1572
     while ($result = db_fetch_object($dbres_all)) {
1573 1573
       $mystate = state_num($result);
1574
-      if ( ($result->appid==$app_id) OR ($app_id==0) OR ($app_id==-1) ) {
1574
+      if ( ($result->appid==$app_id) or ($app_id==0) or ($app_id==-1) ) {
1575 1575
         $taskstates[STATE_ALL]++;
1576 1576
         switch ($mystate) {
1577 1577
         case STATE_IN_PROGRESS:
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 
1595 1595
       //map holds a map between app ids and user friendly names for all applications.
1596 1596
       $application_map[$result->appid] = $result->user_friendly_name;
1597
-      if ( ($mystate == $tselect) OR ($tselect==STATE_ALL) ) {
1597
+      if ( ($mystate == $tselect) or ($tselect==STATE_ALL) ) {
1598 1598
         //count of appids in the results.
1599 1599
         $application_select_count[$result->appid]++;
1600 1600
       }// if mystate
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
   
1607 1607
   // Entry for all applications.
1608 1608
   $allcount = $application_select_count ? array_sum($application_select_count) : 0;
1609
-  $applications[-1] = bts('Application', array(), NULL, 'boinc:task-table');
1610
-  $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table') . ' (' . $allcount . ')';
1609
+  $applications[-1] = bts('Application', array(), null, 'boinc:task-table');
1610
+  $applications[0] = bts('All applications', array(), null, 'boinc:task-table') . ' (' . $allcount . ')';
1611 1611
   // Create application filter from application_map and application_select_count.
1612 1612
   foreach($application_map as $akey => $aname) {
1613 1613
     $acount = 0;
@@ -1619,37 +1619,37 @@  discard block
 block discarded – undo
1619 1619
   // Header array for (sub) results table.
1620 1620
   $resultheader = array(
1621 1621
     array(
1622
-      'data' => bts('Task ID', array(), NULL, 'boinc:task-table'),
1622
+      'data' => bts('Task ID', array(), null, 'boinc:task-table'),
1623 1623
       'field' => 'id',
1624 1624
     ),
1625 1625
     array(
1626
-      'data' => bts('Workunit ID', array(), NULL, 'boinc:task-table'),
1626
+      'data' => bts('Workunit ID', array(), null, 'boinc:task-table'),
1627 1627
       'field' => 'workunitid',
1628 1628
     ),
1629 1629
     array(
1630
-      'data' => bts('Computer', array(), NULL, 'boinc:task-table'),
1630
+      'data' => bts('Computer', array(), null, 'boinc:task-table'),
1631 1631
       'field' => 'hostid',
1632 1632
     ),
1633 1633
     array(
1634
-      'data' => bts('Sent', array(), NULL, 'boinc:task-table'),
1634
+      'data' => bts('Sent', array(), null, 'boinc:task-table'),
1635 1635
       'field' => 'sent_time',
1636 1636
     ),
1637 1637
     array(
1638
-      'data' => bts('Time Reported or Deadline', array(), NULL, 'boinc:task-table')
1638
+      'data' => bts('Time Reported or Deadline', array(), null, 'boinc:task-table')
1639 1639
     ),
1640 1640
     array(
1641
-      'data' => bts('Status', array(), NULL, 'boinc:task-table')
1641
+      'data' => bts('Status', array(), null, 'boinc:task-table')
1642 1642
     ),
1643 1643
     array(
1644
-      'data' => bts('Run time', array(), NULL, 'boinc:task-table'),
1644
+      'data' => bts('Run time', array(), null, 'boinc:task-table'),
1645 1645
       'field' => 'elapsed_time',
1646 1646
     ),
1647 1647
     array(
1648
-      'data' => bts('CPU time', array(), NULL, 'boinc:task-table'),
1648
+      'data' => bts('CPU time', array(), null, 'boinc:task-table'),
1649 1649
       'field' => 'cpu_time',
1650 1650
     ),
1651 1651
     array(
1652
-      'data' => bts('Granted Credit', array(), NULL, 'boinc:task-table'),
1652
+      'data' => bts('Granted Credit', array(), null, 'boinc:task-table'),
1653 1653
       'field' => 'granted_credit',
1654 1654
     ),
1655 1655
     // Application is a column, but won't be added until after tablesort_sql().
@@ -1716,12 +1716,12 @@  discard block
 block discarded – undo
1716 1716
     break;
1717 1717
   }
1718 1718
 
1719
-  if (is_numeric($app_id) AND $app_id>0 ) {
1719
+  if (is_numeric($app_id) and $app_id>0 ) {
1720 1720
     $sqlsub .= " AND r.appid = '%s'";
1721
-    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid, $app_id);
1721
+    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, null, $queryid, $app_id);
1722 1722
   }
1723 1723
   else {
1724
-    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, NULL, $queryid);
1724
+    $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), 20, 0, null, $queryid);
1725 1725
   }
1726 1726
   db_set_active('default');
1727 1727
 
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
   if ($dbres_sub) {
1730 1730
     while ($result = db_fetch_object($dbres_sub)) {
1731 1731
       // check if state matches selection
1732
-      if ( (state_num($result) == $tselect) OR ($tselect==STATE_ALL) ) {
1732
+      if ( (state_num($result) == $tselect) or ($tselect==STATE_ALL) ) {
1733 1733
         // create pretty result row
1734 1734
         $prettyresult = array(
1735 1735
           array(
@@ -1768,18 +1768,18 @@  discard block
 block discarded – undo
1768 1768
     $pathprefix = 'host/' . $queryid . '/tasks';
1769 1769
   }
1770 1770
   // Need an "All" tab as well, maps to app_id of zero.
1771
-  $application_map[0] = bts('All', array(), NULL, 'boinc:task-table');
1771
+  $application_map[0] = bts('All', array(), null, 'boinc:task-table');
1772 1772
   $stitems = array();
1773 1773
   foreach ($taskstates as $state => $numstates) {
1774 1774
     $mypath = $pathprefix . '/' . $state . '/' . $app_id;
1775 1775
     if ($state==STATE_ALL) {
1776
-      $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1776
+      $ltext = '<span class="tab task-app-name">' . bts('All', array(), null, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1777 1777
     }
1778 1778
     else {
1779
-      $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1779
+      $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), null, 'boinc:task-table') . ' (' . $numstates . ')</span>';
1780 1780
     }
1781 1781
     $myitem = array(
1782
-      'data' => l($ltext, $mypath, array('html' => TRUE) ),
1782
+      'data' => l($ltext, $mypath, array('html' => true) ),
1783 1783
     );
1784 1784
     if ($state==$tselect) {
1785 1785
       $myitem['class'] = 'active';
@@ -1788,10 +1788,10 @@  discard block
 block discarded – undo
1788 1788
   }
1789 1789
   // Add reset button
1790 1790
   $mypath = $pathprefix . '/0/0';
1791
-  $ltext = '<span class="tab">' . bts('Reset', array(), NULL, 'boinc:task-table') . '</span>';
1792
-  $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => TRUE) ) );
1791
+  $ltext = '<span class="tab">' . bts('Reset', array(), null, 'boinc:task-table') . '</span>';
1792
+  $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => true) ) );
1793 1793
 
1794
-  $output .= theme_item_list($stitems, $title = NULL, $type='ul'. $attributes=' class="tabs secondary clearfix"');
1794
+  $output .= theme_item_list($stitems, $title = null, $type='ul'. $attributes=' class="tabs secondary clearfix"');
1795 1795
 
1796 1796
   // Application select-drop down form
1797 1797
   // Hack to place Application form into header
@@ -1802,10 +1802,10 @@  discard block
 block discarded – undo
1802 1802
   $resultheader[] = drupal_get_form('boincwork_selectapp_form', $applications, $app_id);
1803 1803
 
1804 1804
   // Begin table of results
1805
-  if ( is_array($resultheader) AND is_array($resultdata) ) {
1805
+  if ( is_array($resultheader) and is_array($resultdata) ) {
1806 1806
 
1807 1807
     // Take advantage of the fact that $category is the same as the row/column we want to remove.
1808
-    if ( ($category==1) OR ($category==2) ) {
1808
+    if ( ($category==1) or ($category==2) ) {
1809 1809
       unset($resultheader[$category]);
1810 1810
       delete_col($resultdata, $category);
1811 1811
     }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.admin.inc 3 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
   */
66 66
 function boincwork_admin_prefs_upload_form_validate($form, &$form_state) {
67 67
   
68
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
68
+  $xsd = './'.drupal_get_path('module', 'boincwork').'/includes/projectprefs.xsd';
69 69
   libxml_use_internal_errors(true);
70 70
   $xml = new DomDocument();
71 71
   $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72 72
   if (!$xml->schemaValidate($xsd)) {
73 73
     $errors = libxml_get_errors();
74 74
     $lines = explode("\r", $form_state['values']['prefs_xml']);
75
-    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
76
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
75
+    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}".
76
+      ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), 'error');
77 77
     form_set_error('upload', t('XML file failed validation'));
78 78
   }
79 79
 }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
       "{$path}/minimum" => t('Minimum')
102 102
     );
103 103
     variable_set('jump_use_js_presets-Array', 1);
104
-    drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
104
+    drupal_add_js(drupal_get_path('module', 'jump').'/jump.js');
105 105
     $output .= '<div class="simple-form-controls"><div class="form-item venue">';
106 106
     $output .= '<label>Preset:</label>';
107 107
     $output .= jump_quickly($preset_options, 'presets');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     '#type' => 'submit',
151 151
     '#value' => t('Save configuration')
152 152
   );
153
-  $form['saveuseconfigxml'] = array (
153
+  $form['saveuseconfigxml'] = array(
154 154
       '#type' => 'submit',
155 155
       '#value' => t('Save configuration with disk usage settings from config.xml'),
156 156
       '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
@@ -175,33 +175,33 @@  discard block
 block discarded – undo
175 175
   // Verify all non-boolean user input values and notify form API of failures
176 176
   
177 177
   // Processing preferences
178
-  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
-  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
-  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
-  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
-  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
-  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
-  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
-  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
178
+  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for')." \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
+  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for')." \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
+  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for')." \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
+  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for')." \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
+  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for')." \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
+  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for')." \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
+  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for')." \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
+  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for')." \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
186 186
 
187 187
   // Storage preferences
188
-  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
-  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
-  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
-  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
-  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
-  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
-  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
188
+  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for')." \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
+  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for')." \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
+  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for')." \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
+  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for')." \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
+  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for')." \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
+  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
+  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
195 195
 
196 196
   // Network preferences
197
-  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
-  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
-  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
-  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
-  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
-  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
-  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
-  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
197
+  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for')." \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
+  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for')." \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
+  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
+  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
+  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for')." \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
+  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for')." \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
+  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
+  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
205 205
 }
206 206
 
207 207
 /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
   // Processing preferences
218 218
   $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219 219
   $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
-  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
220
+  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1;
221 221
   $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222 222
   $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223 223
   $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
   
268 268
   // Get the full configuration
269 269
   $all_presets = boincwork_get_preset_prefs();
270
-  $all_presets = (array) $all_presets['general_preferences'];
270
+  $all_presets = (array)$all_presets['general_preferences'];
271 271
   
272 272
   // Check for sane config
273 273
   if (isset($all_presets['preset'])) {
Please login to merge, or discard this patch.
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -10,80 +10,80 @@  discard block
 block discarded – undo
10 10
  * Allow configuration of general options for preference pages
11 11
  */
12 12
 function boincwork_admin_prefs_options_form(&$form_state) {
13
-  $form = array(); 
14
-  $form['beta'] = array(
13
+    $form = array(); 
14
+    $form['beta'] = array(
15 15
     '#type' => 'checkbox',
16 16
     '#title' => t('Allow users to opt in to test beta applications'),
17 17
     '#default_value' => variable_get('boinc_prefs_options_beta', 0),
18 18
     '#required' => TRUE
19
-  );
20
-  $form['submit'] = array(
19
+    );
20
+    $form['submit'] = array(
21 21
     '#type' => 'submit',
22 22
     '#value' => t('Submit')
23
-  );
24
-  // Add the official mechanical things and return
25
-  //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
26
-  return $form;
23
+    );
24
+    // Add the official mechanical things and return
25
+    //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
26
+    return $form;
27 27
 } 
28 28
 
29 29
 /**
30
-  * Handle validation of preference general settings form.
31
-  */
30
+ * Handle validation of preference general settings form.
31
+ */
32 32
 function boincwork_admin_prefs_options_form_validate($form, &$form_state) {
33 33
 }
34 34
 
35 35
 /**
36
-  * Handle submission of preference general settings form.
37
-  */
36
+ * Handle submission of preference general settings form.
37
+ */
38 38
 function boincwork_admin_prefs_options_form_submit($form, &$form_state) {
39
-  variable_set('boinc_prefs_options_beta', $form_state['values']['beta']);
40
-  drupal_set_message('Preference options have been updated.');
39
+    variable_set('boinc_prefs_options_beta', $form_state['values']['beta']);
40
+    drupal_set_message('Preference options have been updated.');
41 41
 }
42 42
 
43 43
 /**
44 44
  * 
45 45
  */
46 46
 function boincwork_admin_prefs_upload_form(&$form_state) {
47
-  $form = array(); 
48
-  $form['prefs_xml'] = array(
47
+    $form = array(); 
48
+    $form['prefs_xml'] = array(
49 49
     '#type' => 'textarea',
50 50
     '#title' => t('Project specific preferences XML'),
51 51
     '#default_value' => variable_get('boinc_project_specific_prefs_config', "<project_specific_preferences>\n\n</project_specific_preferences>"),
52 52
     '#required' => TRUE
53
-  );
54
-  $form['submit'] = array(
53
+    );
54
+    $form['submit'] = array(
55 55
     '#type' => 'submit',
56 56
     '#value' => t('Submit')
57
-  );
58
-  // Add the official mechanical things and return
59
-  //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
60
-  return $form;
57
+    );
58
+    // Add the official mechanical things and return
59
+    //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
60
+    return $form;
61 61
 } 
62 62
 
63 63
 /**
64
-  * Handle validation of preference upload form.
65
-  */
64
+ * Handle validation of preference upload form.
65
+ */
66 66
 function boincwork_admin_prefs_upload_form_validate($form, &$form_state) {
67 67
   
68
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
69
-  libxml_use_internal_errors(true);
70
-  $xml = new DomDocument();
71
-  $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72
-  if (!$xml->schemaValidate($xsd)) {
68
+    $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
69
+    libxml_use_internal_errors(true);
70
+    $xml = new DomDocument();
71
+    $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72
+    if (!$xml->schemaValidate($xsd)) {
73 73
     $errors = libxml_get_errors();
74 74
     $lines = explode("\r", $form_state['values']['prefs_xml']);
75 75
     drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
76
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
76
+        ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
77 77
     form_set_error('upload', t('XML file failed validation'));
78
-  }
78
+    }
79 79
 }
80 80
 
81 81
 /**
82
-  * Handle submission of preference upload form.
83
-  */
82
+ * Handle submission of preference upload form.
83
+ */
84 84
 function boincwork_admin_prefs_upload_form_submit($form, &$form_state) {
85
-  variable_set('boinc_project_specific_prefs_config', $form_state['values']['prefs_xml']);
86
-  drupal_set_message('The XML has been validated and any changes to
85
+    variable_set('boinc_project_specific_prefs_config', $form_state['values']['prefs_xml']);
86
+    drupal_set_message('The XML has been validated and any changes to
87 87
       preferences are now in place.');
88 88
 }
89 89
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
  * 
92 92
  */
93 93
 function boincwork_admin_prefs_presets_page($preset = 'standard') {
94
-  // Configure preference presets
95
-  if (function_exists('jump_quickly')) {
94
+    // Configure preference presets
95
+    if (function_exists('jump_quickly')) {
96 96
     $path = 'admin/boinc/prefs/presets';
97 97
     $preset_options = array(
98
-      "{$path}/standard" => t('Standard'),
99
-      "{$path}/maximum" => t('Maximum'),
100
-      "{$path}/green" => t('Green'),
101
-      "{$path}/minimum" => t('Minimum')
98
+        "{$path}/standard" => t('Standard'),
99
+        "{$path}/maximum" => t('Maximum'),
100
+        "{$path}/green" => t('Green'),
101
+        "{$path}/minimum" => t('Minimum')
102 102
     );
103 103
     variable_set('jump_use_js_presets-Array', 1);
104 104
     drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
     $output .= '<label>Preset:</label>';
107 107
     $output .= jump_quickly($preset_options, 'presets');
108 108
     $output .= '</div></div>';
109
-  }
110
-  $output .= drupal_get_form('boincwork_admin_prefs_presets_form', $preset);
109
+    }
110
+    $output .= drupal_get_form('boincwork_admin_prefs_presets_form', $preset);
111 111
 
112
-  $output .= '<div>';
113
-  $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), NULL, 'boinc:admin-boinc-preference-presets');
114
-  $output .= '<p>';
115
-  $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), NULL, 'boinc:admin-boinc-preference-presets');
116
-  $output .= '</div>';
117
-  return $output;
112
+    $output .= '<div>';
113
+    $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), NULL, 'boinc:admin-boinc-preference-presets');
114
+    $output .= '<p>';
115
+    $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), NULL, 'boinc:admin-boinc-preference-presets');
116
+    $output .= '</div>';
117
+    return $output;
118 118
 }
119 119
 
120 120
 /**
@@ -122,141 +122,141 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function boincwork_admin_prefs_presets_form(&$form_state, $preset = 'standard') {
124 124
 
125
-  // Check database for preset prefs
126
-  if (!variable_get('boincwork_preset_prefs', null))
125
+    // Check database for preset prefs
126
+    if (!variable_get('boincwork_preset_prefs', null))
127 127
     drupal_set_message(bts('No presets found in database, loading a default set of preferences for each preset. These will be saved to the database once you click \'Save configuration\'.', array(), NULL, 'boinc:admin-boinc-preference-presets'), 'status');
128 128
 
129
-  // Load a copy of the general prefs form
130
-  $form = boincwork_generalprefs_form($form_state, NULL, $preset);
131
-  if ($key = array_search('boincwork_generalprefs_form_submit', $form['#submit'])) {
129
+    // Load a copy of the general prefs form
130
+    $form = boincwork_generalprefs_form($form_state, NULL, $preset);
131
+    if ($key = array_search('boincwork_generalprefs_form_submit', $form['#submit'])) {
132 132
     unset($form['#submit'][$key]);
133
-  }
134
-  $form['#submit'][] = 'boincwork_admin_prefs_presets_form_submit';
133
+    }
134
+    $form['#submit'][] = 'boincwork_admin_prefs_presets_form_submit';
135 135
   
136
-  // Just keep the necessary items
137
-  $form['processor'] = $form['prefs']['advanced']['processor'];
138
-  $form['storage'] = $form['prefs']['advanced']['storage'];
139
-  $form['network'] = $form['prefs']['advanced']['network'];
140
-  unset($form['prefs']);
136
+    // Just keep the necessary items
137
+    $form['processor'] = $form['prefs']['advanced']['processor'];
138
+    $form['storage'] = $form['prefs']['advanced']['storage'];
139
+    $form['network'] = $form['prefs']['advanced']['network'];
140
+    unset($form['prefs']);
141 141
   
142
-  // Tweak some things so it behaves a little better
143
-  $form['#tree'] = TRUE;
144
-  $form['processor']['#collapsible'] = TRUE;
145
-  $form['storage']['#collapsible'] = TRUE;
146
-  $form['network']['#collapsible'] = TRUE;
142
+    // Tweak some things so it behaves a little better
143
+    $form['#tree'] = TRUE;
144
+    $form['processor']['#collapsible'] = TRUE;
145
+    $form['storage']['#collapsible'] = TRUE;
146
+    $form['network']['#collapsible'] = TRUE;
147 147
   
148
-  // Add a submit button and a hidden field to pass the preset
149
-  $form['submit'] = array(
148
+    // Add a submit button and a hidden field to pass the preset
149
+    $form['submit'] = array(
150 150
     '#type' => 'submit',
151 151
     '#value' => t('Save configuration')
152
-  );
153
-  $form['saveuseconfigxml'] = array (
154
-      '#type' => 'submit',
155
-      '#value' => t('Save configuration with disk usage settings from config.xml'),
156
-      '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
157
-  );
158
-  $form['preset'] = array(
152
+    );
153
+    $form['saveuseconfigxml'] = array (
154
+        '#type' => 'submit',
155
+        '#value' => t('Save configuration with disk usage settings from config.xml'),
156
+        '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
157
+    );
158
+    $form['preset'] = array(
159 159
     '#type' => 'hidden',
160 160
     '#value' => $preset
161
-  );
161
+    );
162 162
   
163
-  // Add the official mechanical things and return
164
-  drupal_prepare_form('boincwork_admin_prefs_presets_form', $form, $form_state);
165
-  return $form;
163
+    // Add the official mechanical things and return
164
+    drupal_prepare_form('boincwork_admin_prefs_presets_form', $form, $form_state);
165
+    return $form;
166 166
 }
167 167
 
168 168
 /**
169
-  * Validate the preference presets form.
170
-  */
169
+ * Validate the preference presets form.
170
+ */
171 171
 function boincwork_admin_prefs_presets_form_validate($form, &$form_state) {
172
-  require_boinc('util');
173
-  $values = $form_state['values'];
172
+    require_boinc('util');
173
+    $values = $form_state['values'];
174 174
   
175
-  // Verify all non-boolean user input values and notify form API of failures
175
+    // Verify all non-boolean user input values and notify form API of failures
176 176
   
177
-  // Processing preferences
178
-  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
-  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
-  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
-  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
-  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
-  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
-  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
-  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
177
+    // Processing preferences
178
+    if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
+    if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
+    if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
+    if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
+    if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
+    if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
+    if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
+    if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
186 186
 
187
-  // Storage preferences
188
-  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
-  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
-  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
-  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
-  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
-  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
-  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
187
+    // Storage preferences
188
+    if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
+    if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
+    if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
+    if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
+    if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
+    if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
+    if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
195 195
 
196
-  // Network preferences
197
-  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
-  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
-  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
-  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
-  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
-  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
-  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
-  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
196
+    // Network preferences
197
+    if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
+    if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
+    if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
+    if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
+    if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
+    if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
+    if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
+    if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
205 205
 }
206 206
 
207 207
 /**
208
-  * Handle post-validation submission of preference presets form.
209
-  */
208
+ * Handle post-validation submission of preference presets form.
209
+ */
210 210
 function boincwork_admin_prefs_presets_form_submit($form, &$form_state) {
211
-  $values = $form_state['values'];
212
-  $preset = $form_state['values']['preset'];
211
+    $values = $form_state['values'];
212
+    $preset = $form_state['values']['preset'];
213 213
   
214
-  // Load baseline settings from configuration
215
-  $prefs = boincwork_get_preset_prefs($preset);
214
+    // Load baseline settings from configuration
215
+    $prefs = boincwork_get_preset_prefs($preset);
216 216
   
217
-  // Processing preferences
218
-  $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219
-  $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
-  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
221
-  $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222
-  $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223
-  $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
224
-  $prefs['start_hour'] = $values['processor']['start_hour'];
225
-  $prefs['end_hour'] = $values['processor']['end_hour'];
226
-  $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0;
227
-  $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes'];
228
-  $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct'];
229
-  $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit'];
217
+    // Processing preferences
218
+    $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219
+    $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
+    $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
221
+    $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222
+    $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223
+    $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
224
+    $prefs['start_hour'] = $values['processor']['start_hour'];
225
+    $prefs['end_hour'] = $values['processor']['end_hour'];
226
+    $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0;
227
+    $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes'];
228
+    $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct'];
229
+    $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit'];
230 230
   
231
-  // Storage preferences
232
-  $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb'];
233
-  $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb'];
234
-  $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct'];
235
-  $prefs['disk_interval'] = $values['storage']['disk_interval'];
236
-  $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct'];
237
-  $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct'];
238
-  $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct'];
231
+    // Storage preferences
232
+    $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb'];
233
+    $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb'];
234
+    $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct'];
235
+    $prefs['disk_interval'] = $values['storage']['disk_interval'];
236
+    $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct'];
237
+    $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct'];
238
+    $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct'];
239 239
   
240
-  // Network preferences
241
-  $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days'];
242
-  $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days'];
243
-  $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0;
244
-  $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0;
245
-  $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000;
246
-  $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000;
247
-  $prefs['net_start_hour'] = $values['network']['net_start_hour'];
248
-  $prefs['net_end_hour'] = $values['network']['net_end_hour'];
249
-  $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb'];
250
-  $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days'];
251
-  $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0;
240
+    // Network preferences
241
+    $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days'];
242
+    $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days'];
243
+    $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0;
244
+    $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0;
245
+    $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000;
246
+    $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000;
247
+    $prefs['net_start_hour'] = $values['network']['net_start_hour'];
248
+    $prefs['net_end_hour'] = $values['network']['net_end_hour'];
249
+    $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb'];
250
+    $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days'];
251
+    $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0;
252 252
   
253
-  //Remove @attributes to match new format (see boincwork.forms.inc
254
-  //function boincwork_generalprefs_form)
255
-  unset($prefs['@attributes']['preset']);
253
+    //Remove @attributes to match new format (see boincwork.forms.inc
254
+    //function boincwork_generalprefs_form)
255
+    unset($prefs['@attributes']['preset']);
256 256
   
257
-  // Update the configuration
258
-  boincwork_save_preset_prefs($prefs, $preset);
259
-  drupal_set_message(t('The "@name" preset has been updated.',
257
+    // Update the configuration
258
+    boincwork_save_preset_prefs($prefs, $preset);
259
+    drupal_set_message(t('The "@name" preset has been updated.',
260 260
     array('@name' => $preset)));
261 261
 }
262 262
 
@@ -265,26 +265,26 @@  discard block
 block discarded – undo
265 265
  */
266 266
 function boincwork_save_preset_prefs($updated_prefs, $preset = 'standard') {
267 267
   
268
-  // Get the full configuration
269
-  $all_presets = boincwork_get_preset_prefs();
270
-  $all_presets = (array) $all_presets['general_preferences'];
268
+    // Get the full configuration
269
+    $all_presets = boincwork_get_preset_prefs();
270
+    $all_presets = (array) $all_presets['general_preferences'];
271 271
   
272
-  // Check for sane config
273
-  if (isset($all_presets['preset'])) {
272
+    // Check for sane config
273
+    if (isset($all_presets['preset'])) {
274 274
     if (!is_numeric(key($all_presets['preset']))) {
275
-      $all_presets['preset'] = array($all_presets['preset']);
275
+        $all_presets['preset'] = array($all_presets['preset']);
276 276
     }
277 277
     foreach ($all_presets['preset'] as $key => $old_preset) {
278
-      // Find the preset being updated and... update it
279
-      if (isset($old_preset['@attributes']['name']) AND $old_preset['@attributes']['name'] == $preset) {
278
+        // Find the preset being updated and... update it
279
+        if (isset($old_preset['@attributes']['name']) AND $old_preset['@attributes']['name'] == $preset) {
280 280
         $all_presets['preset'][$key] = $updated_prefs + $old_preset;
281
-      }
281
+        }
282
+    }
282 283
     }
283
-  }
284 284
   
285
-  // Convert prefs back to XML and save to database
286
-  $all_presets = array('general_preferences' => $all_presets);
287
-  variable_set('boincwork_preset_prefs', save_configuration($all_presets));
285
+    // Convert prefs back to XML and save to database
286
+    $all_presets = array('general_preferences' => $all_presets);
287
+    variable_set('boincwork_preset_prefs', save_configuration($all_presets));
288 288
 }
289 289
 
290 290
 /**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     '#type' => 'checkbox',
16 16
     '#title' => t('Allow users to opt in to test beta applications'),
17 17
     '#default_value' => variable_get('boinc_prefs_options_beta', 0),
18
-    '#required' => TRUE
18
+    '#required' => true
19 19
   );
20 20
   $form['submit'] = array(
21 21
     '#type' => 'submit',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     '#type' => 'textarea',
50 50
     '#title' => t('Project specific preferences XML'),
51 51
     '#default_value' => variable_get('boinc_project_specific_prefs_config', "<project_specific_preferences>\n\n</project_specific_preferences>"),
52
-    '#required' => TRUE
52
+    '#required' => true
53 53
   );
54 54
   $form['submit'] = array(
55 55
     '#type' => 'submit',
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
   $output .= drupal_get_form('boincwork_admin_prefs_presets_form', $preset);
111 111
 
112 112
   $output .= '<div>';
113
-  $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), NULL, 'boinc:admin-boinc-preference-presets');
113
+  $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), null, 'boinc:admin-boinc-preference-presets');
114 114
   $output .= '<p>';
115
-  $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), NULL, 'boinc:admin-boinc-preference-presets');
115
+  $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), null, 'boinc:admin-boinc-preference-presets');
116 116
   $output .= '</div>';
117 117
   return $output;
118 118
 }
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 
125 125
   // Check database for preset prefs
126 126
   if (!variable_get('boincwork_preset_prefs', null))
127
-    drupal_set_message(bts('No presets found in database, loading a default set of preferences for each preset. These will be saved to the database once you click \'Save configuration\'.', array(), NULL, 'boinc:admin-boinc-preference-presets'), 'status');
127
+    drupal_set_message(bts('No presets found in database, loading a default set of preferences for each preset. These will be saved to the database once you click \'Save configuration\'.', array(), null, 'boinc:admin-boinc-preference-presets'), 'status');
128 128
 
129 129
   // Load a copy of the general prefs form
130
-  $form = boincwork_generalprefs_form($form_state, NULL, $preset);
130
+  $form = boincwork_generalprefs_form($form_state, null, $preset);
131 131
   if ($key = array_search('boincwork_generalprefs_form_submit', $form['#submit'])) {
132 132
     unset($form['#submit'][$key]);
133 133
   }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
   unset($form['prefs']);
141 141
   
142 142
   // Tweak some things so it behaves a little better
143
-  $form['#tree'] = TRUE;
144
-  $form['processor']['#collapsible'] = TRUE;
145
-  $form['storage']['#collapsible'] = TRUE;
146
-  $form['network']['#collapsible'] = TRUE;
143
+  $form['#tree'] = true;
144
+  $form['processor']['#collapsible'] = true;
145
+  $form['storage']['#collapsible'] = true;
146
+  $form['network']['#collapsible'] = true;
147 147
   
148 148
   // Add a submit button and a hidden field to pass the preset
149 149
   $form['submit'] = array(
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     }
277 277
     foreach ($all_presets['preset'] as $key => $old_preset) {
278 278
       // Find the preset being updated and... update it
279
-      if (isset($old_preset['@attributes']['name']) AND $old_preset['@attributes']['name'] == $preset) {
279
+      if (isset($old_preset['@attributes']['name']) and $old_preset['@attributes']['name'] == $preset) {
280 280
         $all_presets['preset'][$key] = $updated_prefs + $old_preset;
281 281
       }
282 282
     }
Please login to merge, or discard this patch.
boinc/modules/boincwork/views/views_handler_argument_boincuser_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincuser_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
modules/boincwork/views/views_handler_field_boincwork_host_app_et_avg.inc 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_et_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $gflops = 0;
15 15
     if ($values->host_app_version_et_avg) {
16
-      $gflops = 1e-9 / $values->host_app_version_et_avg;
16
+        $gflops = 1e-9 / $values->host_app_version_et_avg;
17 17
     }
18 18
     return round($gflops, 2) . ' GFLOPS';
19
-  }
19
+    }
20 20
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
   function render($values) {
14 14
     $gflops = 0;
15 15
     if ($values->host_app_version_et_avg) {
16
-      $gflops = 1e-9 / $values->host_app_version_et_avg;
16
+      $gflops = 1e-9/$values->host_app_version_et_avg;
17 17
     }
18
-    return round($gflops, 2) . ' GFLOPS';
18
+    return round($gflops, 2).' GFLOPS';
19 19
   }
20 20
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_host_app_turnaround_avg.inc 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_turnaround_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $time_in_days = $values->host_app_version_turnaround_avg / (24*60*60);
15 15
     return round($time_in_days, 2) . ' ' . t('days');
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
   }
12 12
 
13 13
   function render($values) {
14
-    $time_in_days = $values->host_app_version_turnaround_avg / (24*60*60);
15
-    return round($time_in_days, 2) . ' ' . t('days');
14
+    $time_in_days = $values->host_app_version_turnaround_avg/(24*60*60);
15
+    return round($time_in_days, 2).' '.t('days');
16 16
   }
17 17
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_app_version_number.inc 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_app_version_number extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100);
15
-  }
15
+    }
16 16
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
   }
12 12
 
13 13
   function render($values) {
14
-    return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100);
14
+    return sprintf("%01.2f", $values->app_version_host_app_version_version_num/100);
15 15
   }
16 16
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.views.inc 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1637,7 +1637,7 @@
 block discarded – undo
1637 1637
   
1638 1638
   return array(
1639 1639
     'info' => array(
1640
-      'path' => drupal_get_path('module', 'boincwork') . '/views',
1640
+      'path' => drupal_get_path('module', 'boincwork').'/views',
1641 1641
     ),
1642 1642
     'handlers' => array(
1643 1643
       'views_handler_argument_boincuser_id' => array(
Please login to merge, or discard this patch.
Indentation   +793 added lines, -793 removed lines patch added patch discarded remove patch
@@ -13,1660 +13,1660 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function boincwork_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for host table
18
-  // -----------------------------------------------------------------------------------------------
16
+    // -----------------------------------------------------------------------------------------------
17
+    // Definition for host table
18
+    // -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['host']['table']['group'] = t('BOINC');
20
+    $data['host']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['host']['table']['base'] = array(
23
-      'field' => 'id',
24
-      'title' => t('BOINC host'),
25
-      'help' => t('Computers attached to BOINC'),
26
-      'database' => 'boinc'
27
-  );
22
+    $data['host']['table']['base'] = array(
23
+        'field' => 'id',
24
+        'title' => t('BOINC host'),
25
+        'help' => t('Computers attached to BOINC'),
26
+        'database' => 'boinc'
27
+    );
28 28
   
29
-  // This table references the {user} table.
30
-  // This join creates an 'implicit' relationship to the user table, so that when
31
-  // "User" is the base table, the fields are automatically available.
29
+    // This table references the {user} table.
30
+    // This join creates an 'implicit' relationship to the user table, so that when
31
+    // "User" is the base table, the fields are automatically available.
32 32
   
33
-  // Index this array by the table name to which this table refers.
34
-  // 'left_field' is the primary key in the referenced table.
35
-  // 'field' is the foreign key in this table.
33
+    // Index this array by the table name to which this table refers.
34
+    // 'left_field' is the primary key in the referenced table.
35
+    // 'field' is the foreign key in this table.
36 36
   
37
-  $data['host']['table']['join'] = array(
37
+    $data['host']['table']['join'] = array(
38 38
     'user' => array(
39
-      'left_field' => 'id',
40
-      'field' => 'userid',
39
+        'left_field' => 'id',
40
+        'field' => 'userid',
41 41
     )
42
-  );
42
+    );
43 43
 
44
-  // Describe each of the individual fields in this table to Views. For
45
-  // each field, you may define what field, sort, argument, and/or filter
46
-  // handlers it supports. This will determine where in the Views interface you
47
-  // may use the field.
44
+    // Describe each of the individual fields in this table to Views. For
45
+    // each field, you may define what field, sort, argument, and/or filter
46
+    // handlers it supports. This will determine where in the Views interface you
47
+    // may use the field.
48 48
   
49
-  // Primary keys allowed as arguments
49
+    // Primary keys allowed as arguments
50 50
   
51
-  $data['host']['id'] = array(
51
+    $data['host']['id'] = array(
52 52
     'title' => bts('Computer ID', array(), NULL, 'boinc:host-list'),
53 53
     'help' => t('The ID number of this host.'),
54 54
     'field' => array(
55
-      'handler' => 'views_handler_field_numeric',
56
-      'click sortable' => TRUE
55
+        'handler' => 'views_handler_field_numeric',
56
+        'click sortable' => TRUE
57 57
     ),
58 58
     'argument' => array(
59
-      'handler' => 'views_handler_argument',
60
-      'name field' => 'title',
61
-      'numeric' => TRUE,
62
-      'validate type' => 'id'
59
+        'handler' => 'views_handler_argument',
60
+        'name field' => 'title',
61
+        'numeric' => TRUE,
62
+        'validate type' => 'id'
63 63
     ),
64 64
     'filter' => array(
65
-      'handler' => 'views_handler_filter_numeric'
65
+        'handler' => 'views_handler_filter_numeric'
66 66
     ),
67 67
     'sort' => array(
68
-      'handler' => 'views_handler_sort_numeric'
68
+        'handler' => 'views_handler_sort_numeric'
69 69
     )
70
-  );
71
-  $data['host']['venue'] = array(
70
+    );
71
+    $data['host']['venue'] = array(
72 72
     'title' => bts('Location', array(), NULL, 'boinc:host-list'),
73 73
     'help' => t('The name of the preference set assigned to this host.'),
74 74
     'field' => array(
75
-      'handler' => 'views_handler_field',
76
-      'click sortable' => TRUE
75
+        'handler' => 'views_handler_field',
76
+        'click sortable' => TRUE
77 77
     ),
78 78
     'argument' => array(
79
-      'handler' => 'views_handler_argument',
80
-      'name field' => 'title'
79
+        'handler' => 'views_handler_argument',
80
+        'name field' => 'title'
81 81
     ),
82 82
     'filter' => array(
83
-      'handler' => 'views_handler_filter_string'
83
+        'handler' => 'views_handler_filter_string'
84 84
     ),
85 85
     'sort' => array(
86
-      'handler' => 'views_handler_sort_string'
86
+        'handler' => 'views_handler_sort_string'
87 87
     )
88
-  );
88
+    );
89 89
   
90
-  // Foreign key fields
90
+    // Foreign key fields
91 91
   
92
-  $data['host']['userid'] = array(
92
+    $data['host']['userid'] = array(
93 93
     'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
94 94
     'help' => t('The owner of this host.'),
95 95
     // Because this is a foreign key to the {user} table. This allows us to
96 96
     // have, when the view is configured with this relationship, all the fields
97 97
     // for the related node available.
98 98
     'argument' => array(
99
-      'handler' => 'views_handler_argument_boincuser_id',
100
-      'name field' => 'title',
101
-      'numeric' => TRUE,
102
-      'validate type' => 'id'
99
+        'handler' => 'views_handler_argument_boincuser_id',
100
+        'name field' => 'title',
101
+        'numeric' => TRUE,
102
+        'validate type' => 'id'
103 103
     ),
104 104
     'relationship' => array(
105
-      'base' => 'user',
106
-      'field' => 'userid',
107
-      'handler' => 'views_handler_relationship',
108
-      'label' => t('User')
105
+        'base' => 'user',
106
+        'field' => 'userid',
107
+        'handler' => 'views_handler_relationship',
108
+        'label' => t('User')
109 109
     ),
110 110
     'field' => array(
111
-      'handler' => 'views_handler_field_numeric',
112
-      'click sortable' => TRUE
111
+        'handler' => 'views_handler_field_numeric',
112
+        'click sortable' => TRUE
113 113
     ),
114 114
     'filter' => array(
115
-      'handler' => 'views_handler_filter_numeric'
115
+        'handler' => 'views_handler_filter_numeric'
116 116
     ),
117 117
     'sort' => array(
118
-      'handler' => 'views_handler_sort_numeric'
118
+        'handler' => 'views_handler_sort_numeric'
119 119
     )
120
-  );
120
+    );
121 121
   
122
-  // Descriptions of general host fields (alphabetized)
122
+    // Descriptions of general host fields (alphabetized)
123 123
   
124
-  $data['host']['active_frac'] = array(
124
+    $data['host']['active_frac'] = array(
125 125
     'title' => bts('While BOINC running, % of time work is allowed', array(), NULL, 'boinc:host-details'),
126 126
     'help' => t('The percentage of time that work is allowed.'),
127 127
     'field' => array(
128
-      'handler' => 'views_handler_field_numeric',
129
-      'click sortable' => TRUE,
130
-      'float' => TRUE
128
+        'handler' => 'views_handler_field_numeric',
129
+        'click sortable' => TRUE,
130
+        'float' => TRUE
131 131
     ),
132 132
     'filter' => array(
133
-      'handler' => 'views_handler_filter_numeric'
133
+        'handler' => 'views_handler_filter_numeric'
134 134
     ),
135 135
     'sort' => array(
136
-      'handler' => 'views_handler_sort_numeric'
136
+        'handler' => 'views_handler_sort_numeric'
137 137
     )
138
-  );
139
-  $data['host']['avg_turnaround'] = array(
138
+    );
139
+    $data['host']['avg_turnaround'] = array(
140 140
     'title' => bts('Average turnaround time', array(), NULL, 'boinc:host-details'),
141 141
     'help' => t('The average time required for work to be completed.'),
142 142
     'field' => array(
143
-      'handler' => 'views_handler_field_numeric',
144
-      'click sortable' => TRUE,
145
-      'float' => TRUE
143
+        'handler' => 'views_handler_field_numeric',
144
+        'click sortable' => TRUE,
145
+        'float' => TRUE
146 146
     ),
147 147
     'filter' => array(
148
-      'handler' => 'views_handler_filter_numeric'
148
+        'handler' => 'views_handler_filter_numeric'
149 149
     ),
150 150
     'sort' => array(
151
-      'handler' => 'views_handler_sort_numeric'
151
+        'handler' => 'views_handler_sort_numeric'
152 152
     )
153
-  );
154
-  $data['host']['create_time'] = array(
153
+    );
154
+    $data['host']['create_time'] = array(
155 155
     'title' => bts('Created', array(), NULL, 'boinc:host-details'),
156 156
     'help' => t('The time the host record was created.'),
157 157
     'field' => array(
158
-      'handler' => 'views_handler_field_date',
159
-      'click sortable' => TRUE
158
+        'handler' => 'views_handler_field_date',
159
+        'click sortable' => TRUE
160 160
     ),
161 161
     'filter' => array(
162
-      'handler' => 'views_handler_filter_date'
162
+        'handler' => 'views_handler_filter_date'
163 163
     ),
164 164
     'sort' => array(
165
-      'handler' => 'views_handler_sort_date'
165
+        'handler' => 'views_handler_sort_date'
166 166
     )
167
-  );
168
-  $data['host']['connected_frac'] = array(
167
+    );
168
+    $data['host']['connected_frac'] = array(
169 169
     'title' => bts('While BOINC running, % of time host has an Internet connection', array(), NULL, 'boinc:host-details'),
170 170
     'help' => t('The percentage of time that the host has an Internet connection.'),
171 171
     'field' => array(
172
-      'handler' => 'views_handler_field_numeric',
173
-      'click sortable' => TRUE,
174
-      'float' => TRUE
172
+        'handler' => 'views_handler_field_numeric',
173
+        'click sortable' => TRUE,
174
+        'float' => TRUE
175 175
     ),
176 176
     'filter' => array(
177
-      'handler' => 'views_handler_filter_numeric'
177
+        'handler' => 'views_handler_filter_numeric'
178 178
     ),
179 179
     'sort' => array(
180
-      'handler' => 'views_handler_sort_numeric'
180
+        'handler' => 'views_handler_sort_numeric'
181 181
     )
182
-  );
183
-  $data['host']['cpu_efficiency'] = array(
182
+    );
183
+    $data['host']['cpu_efficiency'] = array(
184 184
     'title' => bts('Average CPU efficiency', array(), NULL, 'boinc:host-details'),
185 185
     'help' => t('The average efficiency of the host CPU.'),
186 186
     'field' => array(
187
-      'handler' => 'views_handler_field_numeric',
188
-      'click sortable' => TRUE,
189
-      'float' => TRUE
187
+        'handler' => 'views_handler_field_numeric',
188
+        'click sortable' => TRUE,
189
+        'float' => TRUE
190 190
     ),
191 191
     'filter' => array(
192
-      'handler' => 'views_handler_filter_numeric'
192
+        'handler' => 'views_handler_filter_numeric'
193 193
     ),
194 194
     'sort' => array(
195
-      'handler' => 'views_handler_sort_numeric'
195
+        'handler' => 'views_handler_sort_numeric'
196 196
     )
197
-  );
198
-  $data['host']['d_free'] = array(
197
+    );
198
+    $data['host']['d_free'] = array(
199 199
     'title' => bts('Free disk space', array(), NULL, 'boinc:host-details'),
200 200
     'help' => t('The amount of disk space that is not in use.'),
201 201
     'field' => array(
202
-      'handler' => 'views_handler_field_numeric',
203
-      'click sortable' => TRUE
202
+        'handler' => 'views_handler_field_numeric',
203
+        'click sortable' => TRUE
204 204
     ),
205 205
     'filter' => array(
206
-      'handler' => 'views_handler_filter_numeric'
206
+        'handler' => 'views_handler_filter_numeric'
207 207
     ),
208 208
     'sort' => array(
209
-      'handler' => 'views_handler_sort_numeric'
209
+        'handler' => 'views_handler_sort_numeric'
210 210
     )
211
-  );
212
-  $data['host']['d_total'] = array(
211
+    );
212
+    $data['host']['d_total'] = array(
213 213
     'title' => bts('Total disk space', array(), NULL, 'boinc:host-details'),
214 214
     'help' => t('The size of the disk on which BOINC is installed.'),
215 215
     'field' => array(
216
-      'handler' => 'views_handler_field_numeric',
217
-      'click sortable' => TRUE
216
+        'handler' => 'views_handler_field_numeric',
217
+        'click sortable' => TRUE
218 218
     ),
219 219
     'filter' => array(
220
-      'handler' => 'views_handler_filter_numeric'
220
+        'handler' => 'views_handler_filter_numeric'
221 221
     ),
222 222
     'sort' => array(
223
-      'handler' => 'views_handler_sort_numeric'
223
+        'handler' => 'views_handler_sort_numeric'
224 224
     )
225
-  );
226
-  $data['host']['domain_name'] = array(
225
+    );
226
+    $data['host']['domain_name'] = array(
227 227
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
228 228
     'help' => t('The name of the host.'),
229 229
     'field' => array(
230
-      'handler' => 'views_handler_field',
231
-      'click sortable' => TRUE
230
+        'handler' => 'views_handler_field',
231
+        'click sortable' => TRUE
232 232
     ),
233 233
     'filter' => array(
234
-      'handler' => 'views_handler_filter_string'
234
+        'handler' => 'views_handler_filter_string'
235 235
     ),
236 236
     'sort' => array(
237
-      'handler' => 'views_handler_sort_string'
237
+        'handler' => 'views_handler_sort_string'
238 238
     )
239
-  );
240
-  $data['host']['duration_correction_factor'] = array(
239
+    );
240
+    $data['host']['duration_correction_factor'] = array(
241 241
     'title' => bts('Task duration correction factor', array(), NULL, 'boinc:host-details'),
242 242
     'help' => t('Task duration correction factor.'),
243 243
     'field' => array(
244
-      'handler' => 'views_handler_field_numeric',
245
-      'click sortable' => TRUE,
246
-      'float' => TRUE
244
+        'handler' => 'views_handler_field_numeric',
245
+        'click sortable' => TRUE,
246
+        'float' => TRUE
247 247
     ),
248 248
     'filter' => array(
249
-      'handler' => 'views_handler_filter_numeric'
249
+        'handler' => 'views_handler_filter_numeric'
250 250
     ),
251 251
     'sort' => array(
252
-      'handler' => 'views_handler_sort_numeric'
252
+        'handler' => 'views_handler_sort_numeric'
253 253
     )
254
-  );
255
-  $data['host']['expavg_credit'] = array(
254
+    );
255
+    $data['host']['expavg_credit'] = array(
256 256
     'title' => bts('Avg. credit', array(), NULL, 'boinc:host-details'),
257 257
     'help' => t('A decaying average of credit per day.'),
258 258
     'field' => array(
259
-      'handler' => 'views_handler_field_numeric',
260
-      'click sortable' => TRUE,
261
-      'float' => TRUE
259
+        'handler' => 'views_handler_field_numeric',
260
+        'click sortable' => TRUE,
261
+        'float' => TRUE
262 262
     ),
263 263
     'filter' => array(
264
-      'handler' => 'views_handler_filter_numeric'
264
+        'handler' => 'views_handler_filter_numeric'
265 265
     ),
266 266
     'sort' => array(
267
-      'handler' => 'views_handler_sort_numeric'
267
+        'handler' => 'views_handler_sort_numeric'
268 268
     )
269
-  );
270
-  $data['host']['external_ip_addr'] = array(
269
+    );
270
+    $data['host']['external_ip_addr'] = array(
271 271
     'title' => bts('External IP address', array(), NULL, 'boinc:host-details'),
272 272
     'help' => t('The IP address from which the host last communicated.'),
273 273
     'field' => array(
274
-      'handler' => 'views_handler_field',
275
-      'click sortable' => TRUE
274
+        'handler' => 'views_handler_field',
275
+        'click sortable' => TRUE
276 276
     ),
277 277
     'filter' => array(
278
-      'handler' => 'views_handler_filter_string'
278
+        'handler' => 'views_handler_filter_string'
279 279
     ),
280 280
     'sort' => array(
281
-      'handler' => 'views_handler_sort_string'
281
+        'handler' => 'views_handler_sort_string'
282 282
     )
283
-  );
284
-  $data['host']['host_cpid'] = array(
283
+    );
284
+    $data['host']['host_cpid'] = array(
285 285
     'title' => bts('Cross project ID', array(), NULL, 'boinc:host-details'),
286 286
     'help' => t('The consistent identifier of the host across projects.'),
287 287
     'field' => array(
288
-      'handler' => 'views_handler_field',
289
-      'click sortable' => TRUE
288
+        'handler' => 'views_handler_field',
289
+        'click sortable' => TRUE
290 290
     ),
291 291
     'filter' => array(
292
-      'handler' => 'views_handler_filter_string'
292
+        'handler' => 'views_handler_filter_string'
293 293
     ),
294 294
     'sort' => array(
295
-      'handler' => 'views_handler_sort_string'
295
+        'handler' => 'views_handler_sort_string'
296 296
     )
297
-  );
298
-  $data['host']['last_ip_addr'] = array(
297
+    );
298
+    $data['host']['last_ip_addr'] = array(
299 299
     'title' => bts('Last IP address', array(), NULL, 'boinc:host-details'),
300 300
     'help' => t('The IP address of the host at last communication.'),
301 301
     'field' => array(
302
-      'handler' => 'views_handler_field',
303
-      'click sortable' => TRUE
302
+        'handler' => 'views_handler_field',
303
+        'click sortable' => TRUE
304 304
     ),
305 305
     'filter' => array(
306
-      'handler' => 'views_handler_filter_string'
306
+        'handler' => 'views_handler_filter_string'
307 307
     ),
308 308
     'sort' => array(
309
-      'handler' => 'views_handler_sort_string'
309
+        'handler' => 'views_handler_sort_string'
310 310
     )
311
-  );
312
-  $data['host']['m_cache'] = array(
311
+    );
312
+    $data['host']['m_cache'] = array(
313 313
     'title' => bts('Cache', array(), NULL, 'boinc:host-details'),
314 314
     'help' => t('The amount of cache on the processor(s).'),
315 315
     'field' => array(
316
-      'handler' => 'views_handler_field_numeric',
317
-      'click sortable' => TRUE
316
+        'handler' => 'views_handler_field_numeric',
317
+        'click sortable' => TRUE
318 318
     ),
319 319
     'filter' => array(
320
-      'handler' => 'views_handler_filter_numeric'
320
+        'handler' => 'views_handler_filter_numeric'
321 321
     ),
322 322
     'sort' => array(
323
-      'handler' => 'views_handler_sort_numeric'
323
+        'handler' => 'views_handler_sort_numeric'
324 324
     )
325
-  );
326
-  $data['host']['m_nbytes'] = array(
325
+    );
326
+    $data['host']['m_nbytes'] = array(
327 327
     'title' => bts('Memory', array(), NULL, 'boinc:host-details'),
328 328
     'help' => t('The amount of memory installed.'),
329 329
     'field' => array(
330
-      'handler' => 'views_handler_field_numeric',
331
-      'click sortable' => TRUE
330
+        'handler' => 'views_handler_field_numeric',
331
+        'click sortable' => TRUE
332 332
     ),
333 333
     'filter' => array(
334
-      'handler' => 'views_handler_filter_numeric'
334
+        'handler' => 'views_handler_filter_numeric'
335 335
     ),
336 336
     'sort' => array(
337
-      'handler' => 'views_handler_sort_numeric'
337
+        'handler' => 'views_handler_sort_numeric'
338 338
     )
339
-  );
340
-  $data['host']['m_swap'] = array(
339
+    );
340
+    $data['host']['m_swap'] = array(
341 341
     'title' => bts('Swap space', array(), NULL, 'boinc:host-details'),
342 342
     'help' => t('The amount of swap space configured.'),
343 343
     'field' => array(
344
-      'handler' => 'views_handler_field_numeric',
345
-      'click sortable' => TRUE
344
+        'handler' => 'views_handler_field_numeric',
345
+        'click sortable' => TRUE
346 346
     ),
347 347
     'filter' => array(
348
-      'handler' => 'views_handler_filter_numeric'
348
+        'handler' => 'views_handler_filter_numeric'
349 349
     ),
350 350
     'sort' => array(
351
-      'handler' => 'views_handler_sort_numeric'
351
+        'handler' => 'views_handler_sort_numeric'
352 352
     )
353
-  );
354
-  $data['host']['max_results_day'] = array(
353
+    );
354
+    $data['host']['max_results_day'] = array(
355 355
     'title' => bts('Maximum daily WU quota per CPU', array(), NULL, 'boinc:host-details'),
356 356
     'help' => t('The maximum number of workunits to be allocated per CPU.'),
357 357
     'field' => array(
358
-      'handler' => 'views_handler_field_numeric',
359
-      'click sortable' => TRUE
358
+        'handler' => 'views_handler_field_numeric',
359
+        'click sortable' => TRUE
360 360
     ),
361 361
     'filter' => array(
362
-      'handler' => 'views_handler_filter_numeric'
362
+        'handler' => 'views_handler_filter_numeric'
363 363
     ),
364 364
     'sort' => array(
365
-      'handler' => 'views_handler_sort_numeric'
365
+        'handler' => 'views_handler_sort_numeric'
366 366
     )
367
-  );
368
-  $data['host']['n_bwdown'] = array(
367
+    );
368
+    $data['host']['n_bwdown'] = array(
369 369
     'title' => bts('Average download rate', array(), NULL, 'boinc:host-details'),
370 370
     'help' => t('The average rate at which new work is downloaded.'),
371 371
     'field' => array(
372
-      'handler' => 'views_handler_field_numeric',
373
-      'click sortable' => TRUE,
374
-      'float' => TRUE
372
+        'handler' => 'views_handler_field_numeric',
373
+        'click sortable' => TRUE,
374
+        'float' => TRUE
375 375
     ),
376 376
     'filter' => array(
377
-      'handler' => 'views_handler_filter_numeric'
377
+        'handler' => 'views_handler_filter_numeric'
378 378
     ),
379 379
     'sort' => array(
380
-      'handler' => 'views_handler_sort_numeric'
380
+        'handler' => 'views_handler_sort_numeric'
381 381
     )
382
-  );
383
-  $data['host']['n_bwup'] = array(
382
+    );
383
+    $data['host']['n_bwup'] = array(
384 384
     'title' => bts('Average upload rate', array(), NULL, 'boinc:host-details'),
385 385
     'help' => t('The average rate at which completed work is uploaded.'),
386 386
     'field' => array(
387
-      'handler' => 'views_handler_field_numeric',
388
-      'click sortable' => TRUE,
389
-      'float' => TRUE
387
+        'handler' => 'views_handler_field_numeric',
388
+        'click sortable' => TRUE,
389
+        'float' => TRUE
390 390
     ),
391 391
     'filter' => array(
392
-      'handler' => 'views_handler_filter_numeric'
392
+        'handler' => 'views_handler_filter_numeric'
393 393
     ),
394 394
     'sort' => array(
395
-      'handler' => 'views_handler_sort_numeric'
395
+        'handler' => 'views_handler_sort_numeric'
396 396
     )
397
-  );
398
-  $data['host']['nsame_ip_addr'] = array(
397
+    );
398
+    $data['host']['nsame_ip_addr'] = array(
399 399
     'title' => bts('Same IP address count', array(), NULL, 'boinc:host-details'),
400 400
     'help' => t('The number of times the last IP address.'),
401 401
     'field' => array(
402
-      'handler' => 'views_handler_field',
403
-      'click sortable' => TRUE
402
+        'handler' => 'views_handler_field',
403
+        'click sortable' => TRUE
404 404
     ),
405 405
     'filter' => array(
406
-      'handler' => 'views_handler_filter_string'
406
+        'handler' => 'views_handler_filter_string'
407 407
     ),
408 408
     'sort' => array(
409
-      'handler' => 'views_handler_sort_string'
409
+        'handler' => 'views_handler_sort_string'
410 410
     )
411
-  );
412
-  $data['host']['on_frac'] = array(
411
+    );
412
+    $data['host']['on_frac'] = array(
413 413
     'title' => bts('% of time BOINC client is running', array(), NULL, 'boinc:host-details'),
414 414
     'help' => t('The percentage of time that the BOINC client is running.'),
415 415
     'field' => array(
416
-      'handler' => 'views_handler_field_numeric',
417
-      'click sortable' => TRUE,
418
-      'float' => TRUE
416
+        'handler' => 'views_handler_field_numeric',
417
+        'click sortable' => TRUE,
418
+        'float' => TRUE
419 419
     ),
420 420
     'filter' => array(
421
-      'handler' => 'views_handler_filter_numeric'
421
+        'handler' => 'views_handler_filter_numeric'
422 422
     ),
423 423
     'sort' => array(
424
-      'handler' => 'views_handler_sort_numeric'
424
+        'handler' => 'views_handler_sort_numeric'
425 425
     )
426
-  );
427
-  $data['host']['os_name'] = array(
426
+    );
427
+    $data['host']['os_name'] = array(
428 428
     'title' => bts('Operating system', array(), NULL, 'boinc:host-details'),
429 429
     'help' => t('The name of the host operating system.'),
430 430
     'field' => array(
431
-      'handler' => 'views_handler_field',
432
-      'click sortable' => TRUE
431
+        'handler' => 'views_handler_field',
432
+        'click sortable' => TRUE
433 433
     ),
434 434
     'filter' => array(
435
-      'handler' => 'views_handler_filter_string'
435
+        'handler' => 'views_handler_filter_string'
436 436
     ),
437 437
     'sort' => array(
438
-      'handler' => 'views_handler_sort_string'
438
+        'handler' => 'views_handler_sort_string'
439 439
     )
440
-  );  
441
-  $data['host']['os_version'] = array(
440
+    );  
441
+    $data['host']['os_version'] = array(
442 442
     'title' => bts('Operating system version', array(), NULL, 'boinc:host-details'),
443 443
     'help' => t('The version of the host operating system.'),
444 444
     'field' => array(
445
-      'handler' => 'views_handler_field',
446
-      'click sortable' => TRUE
445
+        'handler' => 'views_handler_field',
446
+        'click sortable' => TRUE
447 447
     ),
448 448
     'filter' => array(
449
-      'handler' => 'views_handler_filter_string'
449
+        'handler' => 'views_handler_filter_string'
450 450
     ),
451 451
     'sort' => array(
452
-      'handler' => 'views_handler_sort_string'
452
+        'handler' => 'views_handler_sort_string'
453 453
     )
454
-  );
455
-  $data['host']['p_fpops'] = array(
454
+    );
455
+    $data['host']['p_fpops'] = array(
456 456
     'title' => bts('Measured floating point speed', array(), NULL, 'boinc:host-details'),
457 457
     'help' => t('The capability of the host in floating point operations per second.'),
458 458
     'field' => array(
459
-      'handler' => 'views_handler_field_numeric',
460
-      'click sortable' => TRUE,
461
-      'float' => TRUE
459
+        'handler' => 'views_handler_field_numeric',
460
+        'click sortable' => TRUE,
461
+        'float' => TRUE
462 462
     ),
463 463
     'filter' => array(
464
-      'handler' => 'views_handler_filter_numeric'
464
+        'handler' => 'views_handler_filter_numeric'
465 465
     ),
466 466
     'sort' => array(
467
-      'handler' => 'views_handler_sort_numeric'
467
+        'handler' => 'views_handler_sort_numeric'
468 468
     )
469
-  );
470
-  $data['host']['p_iops'] = array(
469
+    );
470
+    $data['host']['p_iops'] = array(
471 471
     'title' => bts('Measured integer speed', array(), NULL, 'boinc:host-details'),
472 472
     'help' => t('The capability of the host in integer operations per second.'),
473 473
     'field' => array(
474
-      'handler' => 'views_handler_field_numeric',
475
-      'click sortable' => TRUE,
476
-      'float' => TRUE
474
+        'handler' => 'views_handler_field_numeric',
475
+        'click sortable' => TRUE,
476
+        'float' => TRUE
477 477
     ),
478 478
     'filter' => array(
479
-      'handler' => 'views_handler_filter_numeric'
479
+        'handler' => 'views_handler_filter_numeric'
480 480
     ),
481 481
     'sort' => array(
482
-      'handler' => 'views_handler_sort_numeric'
482
+        'handler' => 'views_handler_sort_numeric'
483 483
     )
484
-  );
485
-  $data['host']['p_model'] = array(
484
+    );
485
+    $data['host']['p_model'] = array(
486 486
     'title' => bts('CPU model', array(), NULL, 'boinc:host-details'),
487 487
     'help' => t('The model of the CPU in the host.'),
488 488
     'field' => array(
489
-      'handler' => 'views_handler_field',
490
-      'click sortable' => TRUE
489
+        'handler' => 'views_handler_field',
490
+        'click sortable' => TRUE
491 491
     ),
492 492
     'filter' => array(
493
-      'handler' => 'views_handler_filter_string'
493
+        'handler' => 'views_handler_filter_string'
494 494
     ),
495 495
     'sort' => array(
496
-      'handler' => 'views_handler_sort_string'
496
+        'handler' => 'views_handler_sort_string'
497 497
     )
498
-  );
499
-  $data['host']['p_ncpus'] = array(
498
+    );
499
+    $data['host']['p_ncpus'] = array(
500 500
     'title' => bts('Number of processors', array(), NULL, 'boinc:host-details'),
501 501
     'help' => t('The count of CPU cores in the system.'),
502 502
     'field' => array(
503
-      'handler' => 'views_handler_field',
504
-      'click sortable' => TRUE
503
+        'handler' => 'views_handler_field',
504
+        'click sortable' => TRUE
505 505
     ),
506 506
     'filter' => array(
507
-      'handler' => 'views_handler_filter_string'
507
+        'handler' => 'views_handler_filter_string'
508 508
     ),
509 509
     'sort' => array(
510
-      'handler' => 'views_handler_sort_string'
510
+        'handler' => 'views_handler_sort_string'
511 511
     )
512
-  );
513
-  $data['host']['p_vendor'] = array(
512
+    );
513
+    $data['host']['p_vendor'] = array(
514 514
     'title' => bts('CPU', array(), NULL, 'boinc:host-details'),
515 515
     'help' => t('The manufacturer of the CPU in the host.'),
516 516
     'field' => array(
517
-      'handler' => 'views_handler_field',
518
-      'click sortable' => TRUE
517
+        'handler' => 'views_handler_field',
518
+        'click sortable' => TRUE
519 519
     ),
520 520
     'filter' => array(
521
-      'handler' => 'views_handler_filter_string'
521
+        'handler' => 'views_handler_filter_string'
522 522
     ),
523 523
     'sort' => array(
524
-      'handler' => 'views_handler_sort_string'
524
+        'handler' => 'views_handler_sort_string'
525 525
     )
526
-  );
527
-  $data['host']['rpc_seqno'] = array(
526
+    );
527
+    $data['host']['rpc_seqno'] = array(
528 528
     'title' => bts('Number of times client has contacted server', array(), NULL, 'boinc:host-details'),
529 529
     'help' => t('The number of times the client has contacted the server.'),
530 530
     'field' => array(
531
-      'handler' => 'views_handler_field_numeric',
532
-      'click sortable' => TRUE
531
+        'handler' => 'views_handler_field_numeric',
532
+        'click sortable' => TRUE
533 533
     ),
534 534
     'filter' => array(
535
-      'handler' => 'views_handler_filter_numeric'
535
+        'handler' => 'views_handler_filter_numeric'
536 536
     ),
537 537
     'sort' => array(
538
-      'handler' => 'views_handler_sort_numeric'
538
+        'handler' => 'views_handler_sort_numeric'
539 539
     )
540
-  );
541
-  $data['host']['rpc_time'] = array(
540
+    );
541
+    $data['host']['rpc_time'] = array(
542 542
     'title' => bts('Last contact', array(), NULL, 'boinc:host-details'),
543 543
     'help' => t('The time of the last RPC contact with the host.'),
544 544
     'field' => array(
545
-      'handler' => 'views_handler_field_date',
546
-      'click sortable' => TRUE
545
+        'handler' => 'views_handler_field_date',
546
+        'click sortable' => TRUE
547 547
     ),
548 548
     'filter' => array(
549
-      'handler' => 'views_handler_filter_date'
549
+        'handler' => 'views_handler_filter_date'
550 550
     ),
551 551
     'sort' => array(
552
-      'handler' => 'views_handler_sort_date'
552
+        'handler' => 'views_handler_sort_date'
553 553
     )
554
-  );
555
-  $data['host']['serialnum'] = array(
554
+    );
555
+    $data['host']['serialnum'] = array(
556 556
     'title' => bts('Serial number', array(), NULL, 'boinc:host-details'),
557 557
     'help' => t('Contains the release number of the BOINC application in use and the GPU of the host.'),
558 558
     'field' => array(
559
-      'handler' => 'views_handler_field',
560
-      'click sortable' => TRUE
559
+        'handler' => 'views_handler_field',
560
+        'click sortable' => TRUE
561 561
     ),
562 562
     'filter' => array(
563
-      'handler' => 'views_handler_filter_string'
563
+        'handler' => 'views_handler_filter_string'
564 564
     ),
565 565
     'sort' => array(
566
-      'handler' => 'views_handler_sort_string'
566
+        'handler' => 'views_handler_sort_string'
567 567
     )
568
-  );
569
-  $data['host']['timezone'] = array(
568
+    );
569
+    $data['host']['timezone'] = array(
570 570
     'title' => bts('Timezone', array(), NULL, 'boinc:host-details'),
571 571
     'help' => t('The UTC offset of the local time.'),
572 572
     'field' => array(
573
-      'handler' => 'views_handler_field_numeric',
574
-      'click sortable' => TRUE
573
+        'handler' => 'views_handler_field_numeric',
574
+        'click sortable' => TRUE
575 575
     ),
576 576
     'filter' => array(
577
-      'handler' => 'views_handler_filter_numeric'
577
+        'handler' => 'views_handler_filter_numeric'
578 578
     ),
579 579
     'sort' => array(
580
-      'handler' => 'views_handler_sort_numeric'
580
+        'handler' => 'views_handler_sort_numeric'
581 581
     )
582
-  );
583
-  $data['host']['total_credit'] = array(
582
+    );
583
+    $data['host']['total_credit'] = array(
584 584
     'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
585 585
     'help' => t('The total accumulated BOINC credit for a host.'),
586 586
     'field' => array(
587
-      'handler' => 'views_handler_field_numeric',
588
-      'click sortable' => TRUE,
589
-      'float' => TRUE
587
+        'handler' => 'views_handler_field_numeric',
588
+        'click sortable' => TRUE,
589
+        'float' => TRUE
590 590
     ),
591 591
     'filter' => array(
592
-      'handler' => 'views_handler_filter_numeric'
592
+        'handler' => 'views_handler_filter_numeric'
593 593
     ),
594 594
     'sort' => array(
595
-      'handler' => 'views_handler_sort_numeric'
595
+        'handler' => 'views_handler_sort_numeric'
596 596
     )
597
-  );
597
+    );
598 598
   
599
-  // ------------------------------------------------------------------------------------------------
600
-  // Definition for platform table
601
-  // ------------------------------------------------------------------------------------------------
599
+    // ------------------------------------------------------------------------------------------------
600
+    // Definition for platform table
601
+    // ------------------------------------------------------------------------------------------------
602 602
   
603
-  $data['platform']['table']['group'] = t('BOINC');
604
-  $data['platform']['table']['base'] = array(
605
-      'field' => 'id',
606
-      'title' => t('BOINC platform'),
607
-      'help' => t('Operating system platforms'),
608
-      'database' => 'boinc'
609
-  );
603
+    $data['platform']['table']['group'] = t('BOINC');
604
+    $data['platform']['table']['base'] = array(
605
+        'field' => 'id',
606
+        'title' => t('BOINC platform'),
607
+        'help' => t('Operating system platforms'),
608
+        'database' => 'boinc'
609
+    );
610 610
   
611
-  // Primary keys allowed as arguments
611
+    // Primary keys allowed as arguments
612 612
 
613
-  $data['platform']['id'] = array(
613
+    $data['platform']['id'] = array(
614 614
     'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
615 615
     'help' => t('The ID number of the platform.'),
616 616
     'field' => array(
617
-      'handler' => 'views_handler_field_numeric',
618
-      'click sortable' => TRUE
617
+        'handler' => 'views_handler_field_numeric',
618
+        'click sortable' => TRUE
619 619
     ),
620 620
     'argument' => array(
621
-      'handler' => 'views_handler_argument',
622
-      'name field' => 'title',
623
-      'numeric' => TRUE,
624
-      'validate type' => 'id'
621
+        'handler' => 'views_handler_argument',
622
+        'name field' => 'title',
623
+        'numeric' => TRUE,
624
+        'validate type' => 'id'
625 625
     ),
626 626
     'filter' => array(
627
-      'handler' => 'views_handler_filter_numeric'
627
+        'handler' => 'views_handler_filter_numeric'
628 628
     ),
629 629
     'sort' => array(
630
-      'handler' => 'views_handler_sort_numeric'
630
+        'handler' => 'views_handler_sort_numeric'
631 631
     )
632
-  );
632
+    );
633 633
   
634
-  // Descriptions of app fields (alphabetized)
634
+    // Descriptions of app fields (alphabetized)
635 635
   
636
-  $data['platform']['name'] = array(
636
+    $data['platform']['name'] = array(
637 637
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
638 638
     'help' => t('The name of the platform.'),
639 639
     'field' => array(
640
-      'handler' => 'views_handler_field',
641
-      'click sortable' => TRUE
640
+        'handler' => 'views_handler_field',
641
+        'click sortable' => TRUE
642 642
     ),
643 643
     'filter' => array(
644
-      'handler' => 'views_handler_filter_string'
644
+        'handler' => 'views_handler_filter_string'
645 645
     ),
646 646
     'sort' => array(
647
-      'handler' => 'views_handler_sort_string'
647
+        'handler' => 'views_handler_sort_string'
648 648
     )
649
-  );
649
+    );
650 650
   
651
-  // ------------------------------------------------------------------------------------------------
652
-  // Definition for result (task) table
653
-  // ------------------------------------------------------------------------------------------------
651
+    // ------------------------------------------------------------------------------------------------
652
+    // Definition for result (task) table
653
+    // ------------------------------------------------------------------------------------------------
654 654
   
655
-  $data['result']['table']['group'] = t('BOINC');
656
-  $data['result']['table']['base'] = array(
657
-      'field' => 'id',
658
-      'title' => t('BOINC result'),
659
-      'help' => t('Results produced by BOINC'),
660
-      'database' => 'boinc'
661
-  );
655
+    $data['result']['table']['group'] = t('BOINC');
656
+    $data['result']['table']['base'] = array(
657
+        'field' => 'id',
658
+        'title' => t('BOINC result'),
659
+        'help' => t('Results produced by BOINC'),
660
+        'database' => 'boinc'
661
+    );
662 662
   
663
-  // Create implicit relationships to the user, workunit, and host tables
663
+    // Create implicit relationships to the user, workunit, and host tables
664 664
   
665
-  $data['result']['table']['join'] = array(
665
+    $data['result']['table']['join'] = array(
666 666
     'user' => array(
667
-      'left_field' => 'id',
668
-      'field' => 'userid'
667
+        'left_field' => 'id',
668
+        'field' => 'userid'
669 669
     ),
670 670
     'workunit' => array(
671
-      'left_field' => 'id',
672
-      'field' => 'workunitid'
671
+        'left_field' => 'id',
672
+        'field' => 'workunitid'
673 673
     ),
674 674
     'host' => array(
675
-      'left_field' => 'id',
676
-      'field' => 'hostid'
675
+        'left_field' => 'id',
676
+        'field' => 'hostid'
677 677
     )
678
-  );
678
+    );
679 679
   
680
-  // Primary keys allowed as arguments
680
+    // Primary keys allowed as arguments
681 681
 
682
-  $data['result']['id'] = array(
682
+    $data['result']['id'] = array(
683 683
     'title' => bts('Task ID', array(), NULL, 'boinc:task-details'),
684 684
     'help' => t('The ID number of this result.'),
685 685
     'field' => array(
686
-      'handler' => 'views_handler_field_numeric',
687
-      'click sortable' => TRUE
686
+        'handler' => 'views_handler_field_numeric',
687
+        'click sortable' => TRUE
688 688
     ),
689 689
     'argument' => array(
690
-      'handler' => 'views_handler_argument',
691
-      'name field' => 'title',
692
-      'numeric' => TRUE,
693
-      'validate type' => 'id'
690
+        'handler' => 'views_handler_argument',
691
+        'name field' => 'title',
692
+        'numeric' => TRUE,
693
+        'validate type' => 'id'
694 694
     ),
695 695
     'filter' => array(
696
-      'handler' => 'views_handler_filter_numeric'
696
+        'handler' => 'views_handler_filter_numeric'
697 697
     ),
698 698
     'sort' => array(
699
-      'handler' => 'views_handler_sort_numeric'
699
+        'handler' => 'views_handler_sort_numeric'
700 700
     )
701
-  );
701
+    );
702 702
   
703
-  // Foreign key fields
703
+    // Foreign key fields
704 704
   
705
-  $data['result']['userid'] = array(
705
+    $data['result']['userid'] = array(
706 706
     'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
707 707
     'help' => t('The owner of this result.'),
708 708
     // Foreign key to the {user} table
709 709
     'argument' => array(
710
-      'handler' => 'views_handler_argument_boincuser_id',
711
-      'name field' => 'title',
712
-      'numeric' => TRUE,
713
-      'validate type' => 'id'
710
+        'handler' => 'views_handler_argument_boincuser_id',
711
+        'name field' => 'title',
712
+        'numeric' => TRUE,
713
+        'validate type' => 'id'
714 714
     ),
715 715
     'relationship' => array(
716
-      'base' => 'user',
717
-      'field' => 'userid',
718
-      'handler' => 'views_handler_relationship',
719
-      'label' => t('User')
716
+        'base' => 'user',
717
+        'field' => 'userid',
718
+        'handler' => 'views_handler_relationship',
719
+        'label' => t('User')
720 720
     )
721
-  );
722
-  $data['result']['workunitid'] = array(
721
+    );
722
+    $data['result']['workunitid'] = array(
723 723
     'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
724 724
     'help' => t('The workunit associated with this result.'),
725 725
     // Foreign key to the {workunit} table
726 726
     'argument' => array(
727
-      'handler' => 'views_handler_argument',
728
-      'name field' => 'title',
729
-      'numeric' => TRUE,
730
-      'validate type' => 'id'
727
+        'handler' => 'views_handler_argument',
728
+        'name field' => 'title',
729
+        'numeric' => TRUE,
730
+        'validate type' => 'id'
731 731
     ),
732 732
     'relationship' => array(
733
-      'base' => 'workunit',
734
-      'field' => 'workunitid',
735
-      'handler' => 'views_handler_relationship',
736
-      'label' => t('Workunit')
733
+        'base' => 'workunit',
734
+        'field' => 'workunitid',
735
+        'handler' => 'views_handler_relationship',
736
+        'label' => t('Workunit')
737 737
     ),
738 738
     'field' => array(
739
-      'handler' => 'views_handler_field_numeric',
740
-      'click sortable' => TRUE
739
+        'handler' => 'views_handler_field_numeric',
740
+        'click sortable' => TRUE
741 741
     ),
742 742
     'filter' => array(
743
-      'handler' => 'views_handler_filter_numeric'
743
+        'handler' => 'views_handler_filter_numeric'
744 744
     ),
745 745
     'sort' => array(
746
-      'handler' => 'views_handler_sort_numeric'
746
+        'handler' => 'views_handler_sort_numeric'
747 747
     )
748
-  );
749
-  $data['result']['hostid'] = array(
748
+    );
749
+    $data['result']['hostid'] = array(
750 750
     'title' => bts('Host ID', array(), NULL, 'boinc:task-details'),
751 751
     'help' => t('The host associated with this result.'),
752 752
     // Foreign key to the {host} table
753 753
     'argument' => array(
754
-      'handler' => 'views_handler_argument',
755
-      'name field' => 'title',
756
-      'numeric' => TRUE,
757
-      'validate type' => 'id'
754
+        'handler' => 'views_handler_argument',
755
+        'name field' => 'title',
756
+        'numeric' => TRUE,
757
+        'validate type' => 'id'
758 758
     ),
759 759
     'relationship' => array(
760
-      'base' => 'host',
761
-      'field' => 'hostid',
762
-      'handler' => 'views_handler_relationship',
763
-      'label' => t('Host')
760
+        'base' => 'host',
761
+        'field' => 'hostid',
762
+        'handler' => 'views_handler_relationship',
763
+        'label' => t('Host')
764 764
     ),
765 765
     'field' => array(
766
-      'handler' => 'views_handler_field_numeric',
767
-      'click sortable' => TRUE
766
+        'handler' => 'views_handler_field_numeric',
767
+        'click sortable' => TRUE
768 768
     ),
769 769
     'filter' => array(
770
-      'handler' => 'views_handler_filter_numeric'
770
+        'handler' => 'views_handler_filter_numeric'
771 771
     ),
772 772
     'sort' => array(
773
-      'handler' => 'views_handler_sort_numeric'
773
+        'handler' => 'views_handler_sort_numeric'
774 774
     )
775
-  );
775
+    );
776 776
   
777
-  // Descriptions of result fields (alphabetized)
777
+    // Descriptions of result fields (alphabetized)
778 778
   
779
-  $data['result']['appid'] = array(
779
+    $data['result']['appid'] = array(
780 780
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
781 781
     'help' => t('The ID number of the application.'),
782 782
     'field' => array(
783
-      'handler' => 'views_handler_field_numeric',
784
-      'click sortable' => TRUE
783
+        'handler' => 'views_handler_field_numeric',
784
+        'click sortable' => TRUE
785 785
     ),
786 786
     'filter' => array(
787
-      'handler' => 'views_handler_filter_numeric'
787
+        'handler' => 'views_handler_filter_numeric'
788 788
     ),
789 789
     'sort' => array(
790
-      'handler' => 'views_handler_sort_numeric'
790
+        'handler' => 'views_handler_sort_numeric'
791 791
     )
792
-  );
793
-  $data['result']['app_version_id'] = array(
792
+    );
793
+    $data['result']['app_version_id'] = array(
794 794
     'title' => bts('Application version', array(), NULL, 'boinc:task-details'),
795 795
     'help' => t('The version number of the application.'),
796 796
     'field' => array(
797
-      'handler' => 'views_handler_field_numeric',
798
-      'click sortable' => TRUE
797
+        'handler' => 'views_handler_field_numeric',
798
+        'click sortable' => TRUE
799 799
     ),
800 800
     'filter' => array(
801
-      'handler' => 'views_handler_filter_numeric'
801
+        'handler' => 'views_handler_filter_numeric'
802 802
     ),
803 803
     'sort' => array(
804
-      'handler' => 'views_handler_sort_numeric'
804
+        'handler' => 'views_handler_sort_numeric'
805 805
     )
806
-  );
807
-  $data['result']['claimed_credit'] = array(
806
+    );
807
+    $data['result']['claimed_credit'] = array(
808 808
     'title' => bts('Claimed credit', array(), NULL, 'boinc:task-details'),
809 809
     'help' => t('The credit claimed for this result.'),
810 810
     'field' => array(
811
-      'handler' => 'views_handler_field_numeric',
812
-      'click sortable' => TRUE,
813
-      'float' => TRUE
811
+        'handler' => 'views_handler_field_numeric',
812
+        'click sortable' => TRUE,
813
+        'float' => TRUE
814 814
     ),
815 815
     'filter' => array(
816
-      'handler' => 'views_handler_filter_numeric'
816
+        'handler' => 'views_handler_filter_numeric'
817 817
     ),
818 818
     'sort' => array(
819
-      'handler' => 'views_handler_sort_numeric'
819
+        'handler' => 'views_handler_sort_numeric'
820 820
     )
821
-  );
822
-  $data['result']['client_state'] = array(
821
+    );
822
+    $data['result']['client_state'] = array(
823 823
     'title' => bts('Client state', array(), NULL, 'boinc:task-details'),
824 824
     'help' => t('The state of the task on the client side.'),
825 825
     'field' => array(
826
-      'handler' => 'views_handler_field_numeric',
827
-      'click sortable' => TRUE
826
+        'handler' => 'views_handler_field_numeric',
827
+        'click sortable' => TRUE
828 828
     ),
829 829
     'filter' => array(
830
-      'handler' => 'views_handler_filter_numeric'
830
+        'handler' => 'views_handler_filter_numeric'
831 831
     ),
832 832
     'sort' => array(
833
-      'handler' => 'views_handler_sort_numeric'
833
+        'handler' => 'views_handler_sort_numeric'
834 834
     )
835
-  );
836
-  $data['result']['cpu_time'] = array(
835
+    );
836
+    $data['result']['cpu_time'] = array(
837 837
     'title' => bts('CPU time', array(), NULL, 'boinc:task-details'),
838 838
     'help' => t('The CPU time spent on the task.'),
839 839
     'field' => array(
840
-      'handler' => 'views_handler_field_numeric',
841
-      'click sortable' => TRUE,
842
-      'float' => TRUE
840
+        'handler' => 'views_handler_field_numeric',
841
+        'click sortable' => TRUE,
842
+        'float' => TRUE
843 843
     ),
844 844
     'filter' => array(
845
-      'handler' => 'views_handler_filter_numeric'
845
+        'handler' => 'views_handler_filter_numeric'
846 846
     ),
847 847
     'sort' => array(
848
-      'handler' => 'views_handler_sort_numeric'
848
+        'handler' => 'views_handler_sort_numeric'
849 849
     )
850
-  );
851
-  $data['result']['create_time'] = array(
850
+    );
851
+    $data['result']['create_time'] = array(
852 852
     'title' => bts('Created', array(), NULL, 'boinc:task-details:-1:ignoreoverwrite'),
853 853
     'help' => t('The time that the task was created.'),
854 854
     'field' => array(
855
-      'handler' => 'views_handler_field_date',
856
-      'click sortable' => TRUE
855
+        'handler' => 'views_handler_field_date',
856
+        'click sortable' => TRUE
857 857
     ),
858 858
     'filter' => array(
859
-      'handler' => 'views_handler_filter_date'
859
+        'handler' => 'views_handler_filter_date'
860 860
     ),
861 861
     'sort' => array(
862
-      'handler' => 'views_handler_sort_date'
862
+        'handler' => 'views_handler_sort_date'
863 863
     )
864
-  );
865
-  $data['result']['elapsed_time'] = array(
864
+    );
865
+    $data['result']['elapsed_time'] = array(
866 866
     'title' => bts('Run time', array(), NULL, 'boinc:task-details'),
867 867
     'help' => t('The run time of the task.'),
868 868
     'field' => array(
869
-      'handler' => 'views_handler_field_numeric',
870
-      'click sortable' => TRUE,
871
-      'float' => TRUE
869
+        'handler' => 'views_handler_field_numeric',
870
+        'click sortable' => TRUE,
871
+        'float' => TRUE
872 872
     ),
873 873
     'filter' => array(
874
-      'handler' => 'views_handler_filter_numeric'
874
+        'handler' => 'views_handler_filter_numeric'
875 875
     ),
876 876
     'sort' => array(
877
-      'handler' => 'views_handler_sort_numeric'
877
+        'handler' => 'views_handler_sort_numeric'
878 878
     )
879
-  );
880
-  $data['result']['exit_status'] = array(
879
+    );
880
+    $data['result']['exit_status'] = array(
881 881
     'title' => bts('Exit status', array(), NULL, 'boinc:task-details'),
882 882
     'help' => t('The exit code of the task.'),
883 883
     'field' => array(
884
-      'handler' => 'views_handler_field_numeric',
885
-      'click sortable' => TRUE
884
+        'handler' => 'views_handler_field_numeric',
885
+        'click sortable' => TRUE
886 886
     ),
887 887
     'filter' => array(
888
-      'handler' => 'views_handler_filter_numeric'
888
+        'handler' => 'views_handler_filter_numeric'
889 889
     ),
890 890
     'sort' => array(
891
-      'handler' => 'views_handler_sort_numeric'
891
+        'handler' => 'views_handler_sort_numeric'
892 892
     )
893
-  );
894
-  $data['result']['granted_credit'] = array(
893
+    );
894
+    $data['result']['granted_credit'] = array(
895 895
     'title' => bts('Granted credit', array(), NULL, 'boinc:task-details'),
896 896
     'help' => t('The credit granted for this result.'),
897 897
     'field' => array(
898
-      'handler' => 'views_handler_field_numeric',
899
-      'click sortable' => TRUE,
900
-      'float' => TRUE
898
+        'handler' => 'views_handler_field_numeric',
899
+        'click sortable' => TRUE,
900
+        'float' => TRUE
901 901
     ),
902 902
     'filter' => array(
903
-      'handler' => 'views_handler_filter_numeric'
903
+        'handler' => 'views_handler_filter_numeric'
904 904
     ),
905 905
     'sort' => array(
906
-      'handler' => 'views_handler_sort_numeric'
906
+        'handler' => 'views_handler_sort_numeric'
907 907
     )
908
-  );
909
-  $data['result']['name'] = array(
908
+    );
909
+    $data['result']['name'] = array(
910 910
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
911 911
     'help' => t('The name of the task.'),
912 912
     'field' => array(
913
-      'handler' => 'views_handler_field',
914
-      'click sortable' => TRUE
913
+        'handler' => 'views_handler_field',
914
+        'click sortable' => TRUE
915 915
     ),
916 916
     'filter' => array(
917
-      'handler' => 'views_handler_filter_string'
917
+        'handler' => 'views_handler_filter_string'
918 918
     ),
919 919
     'sort' => array(
920
-      'handler' => 'views_handler_sort_string'
920
+        'handler' => 'views_handler_sort_string'
921 921
     )
922
-  );
923
-  $data['result']['outcome'] = array(
922
+    );
923
+    $data['result']['outcome'] = array(
924 924
     'title' => bts('Outcome', array(), NULL, 'boinc:task-details'),
925 925
     'help' => t('The outcome of the task.'),
926 926
     'field' => array(
927
-      'handler' => 'views_handler_field_numeric',
928
-      'click sortable' => TRUE
927
+        'handler' => 'views_handler_field_numeric',
928
+        'click sortable' => TRUE
929 929
     ),
930 930
     'filter' => array(
931
-      'handler' => 'views_handler_filter_numeric'
931
+        'handler' => 'views_handler_filter_numeric'
932 932
     ),
933 933
     'sort' => array(
934
-      'handler' => 'views_handler_sort_numeric'
934
+        'handler' => 'views_handler_sort_numeric'
935 935
     )
936
-  );
937
-  $data['result']['received_time'] = array(
936
+    );
937
+    $data['result']['received_time'] = array(
938 938
     'title' => bts('Received time', array(), NULL, 'boinc:task-details'),
939 939
     'help' => t('The time that the result was received.'),
940 940
     'field' => array(
941
-      'handler' => 'views_handler_field_date',
942
-      'click sortable' => TRUE
941
+        'handler' => 'views_handler_field_date',
942
+        'click sortable' => TRUE
943 943
     ),
944 944
     'filter' => array(
945
-      'handler' => 'views_handler_filter_date'
945
+        'handler' => 'views_handler_filter_date'
946 946
     ),
947 947
     'sort' => array(
948
-      'handler' => 'views_handler_sort_date'
948
+        'handler' => 'views_handler_sort_date'
949 949
     )
950
-  );
951
-  $data['result']['report_deadline'] = array(
950
+    );
951
+    $data['result']['report_deadline'] = array(
952 952
     'title' => bts('Report deadline', array(), NULL, 'boinc:task-details'),
953 953
     'help' => t('The deadline for the task.'),
954 954
     'field' => array(
955
-      'handler' => 'views_handler_field_date',
956
-      'click sortable' => TRUE
955
+        'handler' => 'views_handler_field_date',
956
+        'click sortable' => TRUE
957 957
     ),
958 958
     'filter' => array(
959
-      'handler' => 'views_handler_filter_date'
959
+        'handler' => 'views_handler_filter_date'
960 960
     ),
961 961
     'sort' => array(
962
-      'handler' => 'views_handler_sort_date'
962
+        'handler' => 'views_handler_sort_date'
963 963
     )
964
-  );
965
-  $data['result']['sent_time'] = array(
964
+    );
965
+    $data['result']['sent_time'] = array(
966 966
     'title' => bts('Sent', array(), NULL, 'boinc:task-details'),
967 967
     'help' => t('The time that the task was sent.'),
968 968
     'field' => array(
969
-      'handler' => 'views_handler_field_date',
970
-      'click sortable' => TRUE
969
+        'handler' => 'views_handler_field_date',
970
+        'click sortable' => TRUE
971 971
     ),
972 972
     'filter' => array(
973
-      'handler' => 'views_handler_filter_date'
973
+        'handler' => 'views_handler_filter_date'
974 974
     ),
975 975
     'sort' => array(
976
-      'handler' => 'views_handler_sort_date'
976
+        'handler' => 'views_handler_sort_date'
977 977
     )
978
-  );
979
-  $data['result']['server_state'] = array(
978
+    );
979
+    $data['result']['server_state'] = array(
980 980
     'title' => bts('Server state', array(), NULL, 'boinc:task-details'),
981 981
     'help' => t('The state of task on the server side.'),
982 982
     'field' => array(
983
-      'handler' => 'views_handler_field_numeric',
984
-      'click sortable' => TRUE
983
+        'handler' => 'views_handler_field_numeric',
984
+        'click sortable' => TRUE
985 985
     ),
986 986
     'filter' => array(
987
-      'handler' => 'views_handler_filter_numeric'
987
+        'handler' => 'views_handler_filter_numeric'
988 988
     ),
989 989
     'sort' => array(
990
-      'handler' => 'views_handler_sort_numeric'
990
+        'handler' => 'views_handler_sort_numeric'
991 991
     )
992
-  );
993
-  $data['result']['stderr_out'] = array(
992
+    );
993
+    $data['result']['stderr_out'] = array(
994 994
     'title' => bts('Stderr out', array(), NULL, 'boinc:task-details'),
995 995
     'help' => t('The output to standard error.'),
996 996
     'field' => array(
997
-      'handler' => 'views_handler_field',
998
-      'click sortable' => TRUE
997
+        'handler' => 'views_handler_field',
998
+        'click sortable' => TRUE
999 999
     ),
1000 1000
     'filter' => array(
1001
-      'handler' => 'views_handler_filter_string'
1001
+        'handler' => 'views_handler_filter_string'
1002 1002
     ),
1003 1003
     'sort' => array(
1004
-      'handler' => 'views_handler_sort_string'
1004
+        'handler' => 'views_handler_sort_string'
1005 1005
     )
1006
-  );
1007
-  $data['result']['validate_state'] = array(
1006
+    );
1007
+    $data['result']['validate_state'] = array(
1008 1008
     'title' => bts('Validation state', array(), NULL, 'boinc:task-details'),
1009 1009
     'help' => t('The state of validation of this result.'),
1010 1010
     'field' => array(
1011
-      'handler' => 'views_handler_field_numeric',
1012
-      'click sortable' => TRUE
1011
+        'handler' => 'views_handler_field_numeric',
1012
+        'click sortable' => TRUE
1013 1013
     ),
1014 1014
     'filter' => array(
1015
-      'handler' => 'views_handler_filter_numeric'
1015
+        'handler' => 'views_handler_filter_numeric'
1016 1016
     ),
1017 1017
     'sort' => array(
1018
-      'handler' => 'views_handler_sort_numeric'
1018
+        'handler' => 'views_handler_sort_numeric'
1019 1019
     )
1020
-  );
1021
-  $data['result']['peak_working_set_size'] = array(
1020
+    );
1021
+    $data['result']['peak_working_set_size'] = array(
1022 1022
     'title' => bts('Peak working set size', array(), NULL, 'boinc:task-details'),
1023 1023
     'help' => t('Peak working set size.'),
1024 1024
     'field' => array(
1025
-      'handler' => 'views_handler_field_numeric',
1026
-      'click sortable' => TRUE
1025
+        'handler' => 'views_handler_field_numeric',
1026
+        'click sortable' => TRUE
1027 1027
     ),
1028 1028
     'filter' => array(
1029
-      'handler' => 'views_handler_filter_numeric'
1029
+        'handler' => 'views_handler_filter_numeric'
1030 1030
     ),
1031 1031
     'sort' => array(
1032
-      'handler' => 'views_handler_sort_numeric'
1032
+        'handler' => 'views_handler_sort_numeric'
1033 1033
     )
1034
-  );
1035
-  $data['result']['peak_swap_size'] = array(
1034
+    );
1035
+    $data['result']['peak_swap_size'] = array(
1036 1036
     'title' => bts('Peak swap size', array(), NULL, 'boinc:task-details'),
1037 1037
     'help' => t('Peak swap size.'),
1038 1038
     'field' => array(
1039
-      'handler' => 'views_handler_field_numeric',
1040
-      'click sortable' => TRUE
1039
+        'handler' => 'views_handler_field_numeric',
1040
+        'click sortable' => TRUE
1041 1041
     ),
1042 1042
     'filter' => array(
1043
-      'handler' => 'views_handler_filter_numeric'
1043
+        'handler' => 'views_handler_filter_numeric'
1044 1044
     ),
1045 1045
     'sort' => array(
1046
-      'handler' => 'views_handler_sort_numeric'
1046
+        'handler' => 'views_handler_sort_numeric'
1047 1047
     )
1048
-  );
1048
+    );
1049 1049
     $data['result']['peak_disk_usage'] = array(
1050 1050
     'title' => bts('Peak disk usage', array(), NULL, 'boinc:task-details'),
1051 1051
     'help' => t('Peak disk usage.'),
1052 1052
     'field' => array(
1053
-      'handler' => 'views_handler_field_numeric',
1054
-      'click sortable' => TRUE
1053
+        'handler' => 'views_handler_field_numeric',
1054
+        'click sortable' => TRUE
1055 1055
     ),
1056 1056
     'filter' => array(
1057
-      'handler' => 'views_handler_filter_numeric'
1057
+        'handler' => 'views_handler_filter_numeric'
1058 1058
     ),
1059 1059
     'sort' => array(
1060
-      'handler' => 'views_handler_sort_numeric'
1060
+        'handler' => 'views_handler_sort_numeric'
1061 1061
     )
1062
-  );
1062
+    );
1063 1063
 
1064 1064
   
1065
-  // ------------------------------------------------------------------------------------------------
1066
-  // Definition for workunit table
1067
-  // ------------------------------------------------------------------------------------------------
1065
+    // ------------------------------------------------------------------------------------------------
1066
+    // Definition for workunit table
1067
+    // ------------------------------------------------------------------------------------------------
1068 1068
   
1069
-  $data['workunit']['table']['group'] = t('BOINC');
1070
-  $data['workunit']['table']['base'] = array(
1071
-      'field' => 'id',
1072
-      'title' => t('BOINC workunit'),
1073
-      'help' => t('Workunits produced by BOINC'),
1074
-      'database' => 'boinc'
1075
-  );
1069
+    $data['workunit']['table']['group'] = t('BOINC');
1070
+    $data['workunit']['table']['base'] = array(
1071
+        'field' => 'id',
1072
+        'title' => t('BOINC workunit'),
1073
+        'help' => t('Workunits produced by BOINC'),
1074
+        'database' => 'boinc'
1075
+    );
1076 1076
   
1077
-  // Create implicit relationship to the app table
1077
+    // Create implicit relationship to the app table
1078 1078
   
1079
-  $data['workunit']['table']['join'] = array(
1079
+    $data['workunit']['table']['join'] = array(
1080 1080
     'app' => array(
1081
-      'left_field' => 'id',
1082
-      'field' => 'appid'
1081
+        'left_field' => 'id',
1082
+        'field' => 'appid'
1083 1083
     )
1084
-  );
1084
+    );
1085 1085
   
1086
-  // Primary keys allowed as arguments
1086
+    // Primary keys allowed as arguments
1087 1087
   
1088
-  $data['workunit']['id'] = array(
1088
+    $data['workunit']['id'] = array(
1089 1089
     'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
1090 1090
     'help' => t('The ID number of this workunit.'),
1091 1091
     'field' => array(
1092
-      'handler' => 'views_handler_field_numeric',
1093
-      'click sortable' => TRUE
1092
+        'handler' => 'views_handler_field_numeric',
1093
+        'click sortable' => TRUE
1094 1094
     ),
1095 1095
     'argument' => array(
1096
-      'handler' => 'views_handler_argument',
1097
-      'name field' => 'title',
1098
-      'numeric' => TRUE,
1099
-      'validate type' => 'id'
1096
+        'handler' => 'views_handler_argument',
1097
+        'name field' => 'title',
1098
+        'numeric' => TRUE,
1099
+        'validate type' => 'id'
1100 1100
     ),
1101 1101
     'filter' => array(
1102
-      'handler' => 'views_handler_filter_numeric'
1102
+        'handler' => 'views_handler_filter_numeric'
1103 1103
     ),
1104 1104
     'sort' => array(
1105
-      'handler' => 'views_handler_sort_numeric'
1105
+        'handler' => 'views_handler_sort_numeric'
1106 1106
     )
1107
-  );
1107
+    );
1108 1108
   
1109
-  // Foreign key fields
1109
+    // Foreign key fields
1110 1110
   
1111
-  $data['workunit']['appid'] = array(
1111
+    $data['workunit']['appid'] = array(
1112 1112
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1113 1113
     'help' => t('The application associated with this workunit.'), 
1114 1114
     'argument' => array( // foreign key to the {app} table
1115
-      'handler' => 'views_handler_argument',
1116
-      'name field' => 'title',
1117
-      'numeric' => TRUE,
1118
-      'validate type' => 'id'
1115
+        'handler' => 'views_handler_argument',
1116
+        'name field' => 'title',
1117
+        'numeric' => TRUE,
1118
+        'validate type' => 'id'
1119 1119
     ),
1120 1120
     'relationship' => array(
1121
-      'base' => 'app',
1122
-      'field' => 'appid',
1123
-      'handler' => 'views_handler_relationship',
1124
-      'label' => t('Application')
1121
+        'base' => 'app',
1122
+        'field' => 'appid',
1123
+        'handler' => 'views_handler_relationship',
1124
+        'label' => t('Application')
1125 1125
     ),
1126 1126
     'field' => array(
1127
-      'handler' => 'views_handler_field_numeric',
1128
-      'click sortable' => TRUE
1127
+        'handler' => 'views_handler_field_numeric',
1128
+        'click sortable' => TRUE
1129 1129
     ),
1130 1130
     'filter' => array(
1131
-      'handler' => 'views_handler_filter_numeric'
1131
+        'handler' => 'views_handler_filter_numeric'
1132 1132
     ),
1133 1133
     'sort' => array(
1134
-      'handler' => 'views_handler_sort_numeric'
1134
+        'handler' => 'views_handler_sort_numeric'
1135 1135
     )
1136
-  );
1136
+    );
1137 1137
   
1138
-  // Descriptions of workunit fields (alphabetized)
1138
+    // Descriptions of workunit fields (alphabetized)
1139 1139
   
1140
-  $data['workunit']['canonical_credit'] = array(
1140
+    $data['workunit']['canonical_credit'] = array(
1141 1141
     'title' => bts('Canonical credit', array(), NULL, 'boinc:workunit-details'),
1142 1142
     'help' => t('The canonical credit of the workunit.'),
1143 1143
     'field' => array(
1144
-      'handler' => 'views_handler_field_numeric',
1145
-      'click sortable' => TRUE,
1146
-      'float' => TRUE
1144
+        'handler' => 'views_handler_field_numeric',
1145
+        'click sortable' => TRUE,
1146
+        'float' => TRUE
1147 1147
     ),
1148 1148
     'filter' => array(
1149
-      'handler' => 'views_handler_filter_numeric'
1149
+        'handler' => 'views_handler_filter_numeric'
1150 1150
     ),
1151 1151
     'sort' => array(
1152
-      'handler' => 'views_handler_sort_numeric'
1152
+        'handler' => 'views_handler_sort_numeric'
1153 1153
     )
1154
-  );
1155
-  $data['workunit']['canonical_resultid'] = array(
1154
+    );
1155
+    $data['workunit']['canonical_resultid'] = array(
1156 1156
     'title' => bts('Canonical result ID', array(), NULL, 'boinc:workunit-details'),
1157 1157
     'help' => t('The ID of the canonical result associated with the workunit.'),
1158 1158
     'field' => array(
1159
-      'handler' => 'views_handler_field_numeric',
1160
-      'click sortable' => TRUE
1159
+        'handler' => 'views_handler_field_numeric',
1160
+        'click sortable' => TRUE
1161 1161
     ),
1162 1162
     'filter' => array(
1163
-      'handler' => 'views_handler_filter_numeric'
1163
+        'handler' => 'views_handler_filter_numeric'
1164 1164
     ),
1165 1165
     'sort' => array(
1166
-      'handler' => 'views_handler_sort_numeric'
1166
+        'handler' => 'views_handler_sort_numeric'
1167 1167
     )
1168
-  );
1169
-  $data['workunit']['create_time'] = array(
1168
+    );
1169
+    $data['workunit']['create_time'] = array(
1170 1170
     'title' => bts('Created time', array(), NULL, 'boinc:workunit-details'),
1171 1171
     'help' => t('The time that the workunit was created.'),
1172 1172
     'field' => array(
1173
-      'handler' => 'views_handler_field_date',
1174
-      'click sortable' => TRUE
1173
+        'handler' => 'views_handler_field_date',
1174
+        'click sortable' => TRUE
1175 1175
     ),
1176 1176
     'filter' => array(
1177
-      'handler' => 'views_handler_filter_date'
1177
+        'handler' => 'views_handler_filter_date'
1178 1178
     ),
1179 1179
     'sort' => array(
1180
-      'handler' => 'views_handler_sort_date'
1180
+        'handler' => 'views_handler_sort_date'
1181 1181
     )
1182
-  );
1183
-  $data['workunit']['error_mask'] = array(
1182
+    );
1183
+    $data['workunit']['error_mask'] = array(
1184 1184
     'title' => bts('Error mask', array(), NULL, 'boinc:workunit-details'),
1185 1185
     'help' => t('Error mask of the workunit.'),
1186 1186
     'field' => array(
1187
-      'handler' => 'views_handler_field_numeric',
1188
-      'click sortable' => TRUE
1187
+        'handler' => 'views_handler_field_numeric',
1188
+        'click sortable' => TRUE
1189 1189
     ),
1190 1190
     'filter' => array(
1191
-      'handler' => 'views_handler_filter_numeric'
1191
+        'handler' => 'views_handler_filter_numeric'
1192 1192
     ),
1193 1193
     'sort' => array(
1194
-      'handler' => 'views_handler_sort_numeric'
1194
+        'handler' => 'views_handler_sort_numeric'
1195 1195
     )
1196
-  );
1197
-  $data['workunit']['min_quorum'] = array(
1196
+    );
1197
+    $data['workunit']['min_quorum'] = array(
1198 1198
     'title' => bts('Minimum quorum', array(), NULL, 'boinc:workunit-details'),
1199 1199
     'help' => t('Minimum quorum of the workunit.'),
1200 1200
     'field' => array(
1201
-      'handler' => 'views_handler_field_numeric',
1202
-      'click sortable' => TRUE
1201
+        'handler' => 'views_handler_field_numeric',
1202
+        'click sortable' => TRUE
1203 1203
     ),
1204 1204
     'filter' => array(
1205
-      'handler' => 'views_handler_filter_numeric'
1205
+        'handler' => 'views_handler_filter_numeric'
1206 1206
     ),
1207 1207
     'sort' => array(
1208
-      'handler' => 'views_handler_sort_numeric'
1208
+        'handler' => 'views_handler_sort_numeric'
1209 1209
     )
1210
-  );
1211
-  $data['workunit']['name'] = array(
1210
+    );
1211
+    $data['workunit']['name'] = array(
1212 1212
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'),
1213 1213
     'help' => t('The name of the workunit.'),
1214 1214
     'field' => array(
1215
-      'handler' => 'views_handler_field',
1216
-      'click sortable' => TRUE
1215
+        'handler' => 'views_handler_field',
1216
+        'click sortable' => TRUE
1217 1217
     ),
1218 1218
     'filter' => array(
1219
-      'handler' => 'views_handler_filter_string'
1219
+        'handler' => 'views_handler_filter_string'
1220 1220
     ),
1221 1221
     'sort' => array(
1222
-      'handler' => 'views_handler_sort_string'
1222
+        'handler' => 'views_handler_sort_string'
1223 1223
     )
1224
-  );
1225
-  $data['workunit']['max_error_results'] = array(
1224
+    );
1225
+    $data['workunit']['max_error_results'] = array(
1226 1226
     'title' => bts('Max error tasks', array(), NULL, 'boinc:workunit-details'),
1227 1227
     'help' => t('The maximum number of error tasks in the workunit.'),
1228 1228
     'field' => array(
1229
-      'handler' => 'views_handler_field_numeric',
1230
-      'click sortable' => TRUE
1229
+        'handler' => 'views_handler_field_numeric',
1230
+        'click sortable' => TRUE
1231 1231
     ),
1232 1232
     'filter' => array(
1233
-      'handler' => 'views_handler_filter_numeric'
1233
+        'handler' => 'views_handler_filter_numeric'
1234 1234
     ),
1235 1235
     'sort' => array(
1236
-      'handler' => 'views_handler_sort_numeric'
1236
+        'handler' => 'views_handler_sort_numeric'
1237 1237
     )
1238
-  );
1239
-  $data['workunit']['max_success_results'] = array(
1238
+    );
1239
+    $data['workunit']['max_success_results'] = array(
1240 1240
     'title' => bts('Max success tasks', array(), NULL, 'boinc:workunit-details'),
1241 1241
     'help' => t('The maximum number of successful tasks in the workunit.'),
1242 1242
     'field' => array(
1243
-      'handler' => 'views_handler_field_numeric',
1244
-      'click sortable' => TRUE
1243
+        'handler' => 'views_handler_field_numeric',
1244
+        'click sortable' => TRUE
1245 1245
     ),
1246 1246
     'filter' => array(
1247
-      'handler' => 'views_handler_filter_numeric'
1247
+        'handler' => 'views_handler_filter_numeric'
1248 1248
     ),
1249 1249
     'sort' => array(
1250
-      'handler' => 'views_handler_sort_numeric'
1250
+        'handler' => 'views_handler_sort_numeric'
1251 1251
     )
1252
-  );
1253
-  $data['workunit']['max_total_results'] = array(
1252
+    );
1253
+    $data['workunit']['max_total_results'] = array(
1254 1254
     'title' => bts('Max total tasks', array(), NULL, 'boinc:workunit-details'),
1255 1255
     'help' => t('The maximum number of total tasks in the workunit.'),
1256 1256
     'field' => array(
1257
-      'handler' => 'views_handler_field_numeric',
1258
-      'click sortable' => TRUE
1257
+        'handler' => 'views_handler_field_numeric',
1258
+        'click sortable' => TRUE
1259 1259
     ),
1260 1260
     'filter' => array(
1261
-      'handler' => 'views_handler_filter_numeric'
1261
+        'handler' => 'views_handler_filter_numeric'
1262 1262
     ),
1263 1263
     'sort' => array(
1264
-      'handler' => 'views_handler_sort_numeric'
1264
+        'handler' => 'views_handler_sort_numeric'
1265 1265
     )
1266
-  );
1267
-  $data['workunit']['need_validate'] = array(
1266
+    );
1267
+    $data['workunit']['need_validate'] = array(
1268 1268
     'title' => bts('Needs validation', array(), NULL, 'boinc:workunit-details'),
1269 1269
     'help' => t('Whether or not a workunit needs validation.'),
1270 1270
     'field' => array(
1271
-      'handler' => 'views_handler_field_numeric',
1272
-      'click sortable' => TRUE
1271
+        'handler' => 'views_handler_field_numeric',
1272
+        'click sortable' => TRUE
1273 1273
     ),
1274 1274
     'filter' => array(
1275
-      'handler' => 'views_handler_filter_numeric'
1275
+        'handler' => 'views_handler_filter_numeric'
1276 1276
     ),
1277 1277
     'sort' => array(
1278
-      'handler' => 'views_handler_sort_numeric'
1278
+        'handler' => 'views_handler_sort_numeric'
1279 1279
     )
1280
-  );
1281
-  $data['workunit']['target_nresults'] = array(
1280
+    );
1281
+    $data['workunit']['target_nresults'] = array(
1282 1282
     'title' => bts('Initial replication', array(), NULL, 'boinc:workunit-details'),
1283 1283
     'help' => t('The target number of results for the workunit.'),
1284 1284
     'field' => array(
1285
-      'handler' => 'views_handler_field_numeric',
1286
-      'click sortable' => TRUE
1285
+        'handler' => 'views_handler_field_numeric',
1286
+        'click sortable' => TRUE
1287 1287
     ),
1288 1288
     'filter' => array(
1289
-      'handler' => 'views_handler_filter_numeric'
1289
+        'handler' => 'views_handler_filter_numeric'
1290 1290
     ),
1291 1291
     'sort' => array(
1292
-      'handler' => 'views_handler_sort_numeric'
1292
+        'handler' => 'views_handler_sort_numeric'
1293 1293
     )
1294
-  );
1294
+    );
1295 1295
   
1296
-  // ------------------------------------------------------------------------------------------------
1297
-  // Definition for app table
1298
-  // ------------------------------------------------------------------------------------------------
1296
+    // ------------------------------------------------------------------------------------------------
1297
+    // Definition for app table
1298
+    // ------------------------------------------------------------------------------------------------
1299 1299
   
1300
-  $data['app']['table']['group'] = t('BOINC');
1301
-  $data['app']['table']['base'] = array(
1302
-      'field' => 'id',
1303
-      'title' => t('BOINC app'),
1304
-      'help' => t('Research applications run by BOINC'),
1305
-      'database' => 'boinc'
1306
-  );
1300
+    $data['app']['table']['group'] = t('BOINC');
1301
+    $data['app']['table']['base'] = array(
1302
+        'field' => 'id',
1303
+        'title' => t('BOINC app'),
1304
+        'help' => t('Research applications run by BOINC'),
1305
+        'database' => 'boinc'
1306
+    );
1307 1307
   
1308
-  // Primary keys allowed as arguments
1308
+    // Primary keys allowed as arguments
1309 1309
 
1310
-  $data['app']['id'] = array(
1310
+    $data['app']['id'] = array(
1311 1311
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1312 1312
     'help' => t('The ID number of this application.'),
1313 1313
     'field' => array(
1314
-      'handler' => 'views_handler_field_numeric',
1315
-      'click sortable' => TRUE
1314
+        'handler' => 'views_handler_field_numeric',
1315
+        'click sortable' => TRUE
1316 1316
     ),
1317 1317
     'argument' => array(
1318
-      'handler' => 'views_handler_argument',
1319
-      'name field' => 'title',
1320
-      'numeric' => TRUE,
1321
-      'validate type' => 'id'
1318
+        'handler' => 'views_handler_argument',
1319
+        'name field' => 'title',
1320
+        'numeric' => TRUE,
1321
+        'validate type' => 'id'
1322 1322
     ),
1323 1323
     'filter' => array(
1324
-      'handler' => 'views_handler_filter_numeric'
1324
+        'handler' => 'views_handler_filter_numeric'
1325 1325
     ),
1326 1326
     'sort' => array(
1327
-      'handler' => 'views_handler_sort_numeric'
1327
+        'handler' => 'views_handler_sort_numeric'
1328 1328
     )
1329
-  );
1329
+    );
1330 1330
   
1331
-  // Descriptions of app fields (alphabetized)
1331
+    // Descriptions of app fields (alphabetized)
1332 1332
   
1333
-  $data['app']['target_nresults'] = array(
1333
+    $data['app']['target_nresults'] = array(
1334 1334
     'title' => bts('Target number of results', array(), NULL, 'boinc:application-details'),
1335 1335
     'help' => t('The number of times to replicate tasks in this application.'),
1336 1336
     'field' => array(
1337
-      'handler' => 'views_handler_field_numeric',
1338
-      'click sortable' => TRUE
1337
+        'handler' => 'views_handler_field_numeric',
1338
+        'click sortable' => TRUE
1339 1339
     ),
1340 1340
     'filter' => array(
1341
-      'handler' => 'views_handler_filter_numeric'
1341
+        'handler' => 'views_handler_filter_numeric'
1342 1342
     ),
1343 1343
     'sort' => array(
1344
-      'handler' => 'views_handler_sort_numeric'
1344
+        'handler' => 'views_handler_sort_numeric'
1345 1345
     )
1346
-  );
1347
-  $data['app']['user_friendly_name'] = array(
1346
+    );
1347
+    $data['app']['user_friendly_name'] = array(
1348 1348
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1349 1349
     'help' => t('The user friendly name of the application.'),
1350 1350
     'field' => array(
1351
-      'handler' => 'views_handler_field',
1352
-      'click sortable' => TRUE
1351
+        'handler' => 'views_handler_field',
1352
+        'click sortable' => TRUE
1353 1353
     ),
1354 1354
     'filter' => array(
1355
-      'handler' => 'views_handler_filter_string'
1355
+        'handler' => 'views_handler_filter_string'
1356 1356
     ),
1357 1357
     'sort' => array(
1358
-      'handler' => 'views_handler_sort_string'
1358
+        'handler' => 'views_handler_sort_string'
1359 1359
     )
1360
-  );
1360
+    );
1361 1361
   
1362
-  // ------------------------------------------------------------------------------------------------
1363
-  // Definition for app_version table
1364
-  // ------------------------------------------------------------------------------------------------
1362
+    // ------------------------------------------------------------------------------------------------
1363
+    // Definition for app_version table
1364
+    // ------------------------------------------------------------------------------------------------
1365 1365
   
1366
-  $data['app_version']['table']['group'] = t('BOINC');
1367
-  $data['app_version']['table']['base'] = array(
1368
-      'field' => 'id',
1369
-      'title' => t('BOINC app version'),
1370
-      'help' => t('Versions of research applications run by BOINC'),
1371
-      'database' => 'boinc'
1372
-  );
1366
+    $data['app_version']['table']['group'] = t('BOINC');
1367
+    $data['app_version']['table']['base'] = array(
1368
+        'field' => 'id',
1369
+        'title' => t('BOINC app version'),
1370
+        'help' => t('Versions of research applications run by BOINC'),
1371
+        'database' => 'boinc'
1372
+    );
1373 1373
   
1374
-  // Primary keys allowed as arguments
1374
+    // Primary keys allowed as arguments
1375 1375
 
1376
-  $data['app_version']['id'] = array(
1376
+    $data['app_version']['id'] = array(
1377 1377
     'title' => bts('Application version ID', array(), NULL, 'boinc:application-details'),
1378 1378
     'help' => t('The ID number of this application version.'),
1379 1379
     'field' => array(
1380
-      'handler' => 'views_handler_field_numeric',
1381
-      'click sortable' => TRUE
1380
+        'handler' => 'views_handler_field_numeric',
1381
+        'click sortable' => TRUE
1382 1382
     ),
1383 1383
     'argument' => array(
1384
-      'handler' => 'views_handler_argument',
1385
-      'name field' => 'title',
1386
-      'numeric' => TRUE,
1387
-      'validate type' => 'id'
1384
+        'handler' => 'views_handler_argument',
1385
+        'name field' => 'title',
1386
+        'numeric' => TRUE,
1387
+        'validate type' => 'id'
1388 1388
     ),
1389 1389
     'filter' => array(
1390
-      'handler' => 'views_handler_filter_numeric'
1390
+        'handler' => 'views_handler_filter_numeric'
1391 1391
     ),
1392 1392
     'sort' => array(
1393
-      'handler' => 'views_handler_sort_numeric'
1393
+        'handler' => 'views_handler_sort_numeric'
1394 1394
     )
1395
-  );
1395
+    );
1396 1396
   
1397
-  // Foreign key fields
1397
+    // Foreign key fields
1398 1398
   
1399
-  $data['app_version']['appid'] = array(
1399
+    $data['app_version']['appid'] = array(
1400 1400
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1401 1401
     'help' => t('The application ID associated with this app version.'),
1402 1402
     // Because this is a foreign key to the {app} table. This allows us to
1403 1403
     // have, when the view is configured with this relationship, all the fields
1404 1404
     // for the related node available.
1405 1405
     'argument' => array(
1406
-      'handler' => 'views_handler_argument_numeric',
1407
-      'name field' => 'title',
1408
-      'numeric' => TRUE,
1409
-      'validate type' => 'id'
1406
+        'handler' => 'views_handler_argument_numeric',
1407
+        'name field' => 'title',
1408
+        'numeric' => TRUE,
1409
+        'validate type' => 'id'
1410 1410
     ),
1411 1411
     'relationship' => array(
1412
-      'base' => 'app',
1413
-      'field' => 'id',
1414
-      'handler' => 'views_handler_relationship',
1415
-      'label' => t('App ID')
1412
+        'base' => 'app',
1413
+        'field' => 'id',
1414
+        'handler' => 'views_handler_relationship',
1415
+        'label' => t('App ID')
1416 1416
     ),
1417 1417
     'field' => array(
1418
-      'handler' => 'views_handler_field_numeric',
1419
-      'click sortable' => TRUE
1418
+        'handler' => 'views_handler_field_numeric',
1419
+        'click sortable' => TRUE
1420 1420
     ),
1421 1421
     'filter' => array(
1422
-      'handler' => 'views_handler_filter_numeric'
1422
+        'handler' => 'views_handler_filter_numeric'
1423 1423
     ),
1424 1424
     'sort' => array(
1425
-      'handler' => 'views_handler_sort_numeric'
1425
+        'handler' => 'views_handler_sort_numeric'
1426 1426
     )
1427
-  );
1427
+    );
1428 1428
   
1429
-  $data['app_version']['platformid'] = array(
1429
+    $data['app_version']['platformid'] = array(
1430 1430
     'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
1431 1431
     'help' => t('The platform ID associated with this app version.'),
1432 1432
     // Because this is a foreign key to the {platform} table. This allows us to
1433 1433
     // have, when the view is configured with this relationship, all the fields
1434 1434
     // for the related node available.
1435 1435
     'argument' => array(
1436
-      'handler' => 'views_handler_argument_numeric',
1437
-      'name field' => 'title',
1438
-      'numeric' => TRUE,
1439
-      'validate type' => 'id'
1436
+        'handler' => 'views_handler_argument_numeric',
1437
+        'name field' => 'title',
1438
+        'numeric' => TRUE,
1439
+        'validate type' => 'id'
1440 1440
     ),
1441 1441
     'relationship' => array(
1442
-      'base' => 'platform',
1443
-      'field' => 'id',
1444
-      'handler' => 'views_handler_relationship',
1445
-      'label' => t('Platform ID')
1442
+        'base' => 'platform',
1443
+        'field' => 'id',
1444
+        'handler' => 'views_handler_relationship',
1445
+        'label' => t('Platform ID')
1446 1446
     ),
1447 1447
     'field' => array(
1448
-      'handler' => 'views_handler_field_numeric',
1449
-      'click sortable' => TRUE
1448
+        'handler' => 'views_handler_field_numeric',
1449
+        'click sortable' => TRUE
1450 1450
     ),
1451 1451
     'filter' => array(
1452
-      'handler' => 'views_handler_filter_numeric'
1452
+        'handler' => 'views_handler_filter_numeric'
1453 1453
     ),
1454 1454
     'sort' => array(
1455
-      'handler' => 'views_handler_sort_numeric'
1455
+        'handler' => 'views_handler_sort_numeric'
1456 1456
     )
1457
-  );
1457
+    );
1458 1458
   
1459
-  // Descriptions of app fields (alphabetized)
1459
+    // Descriptions of app fields (alphabetized)
1460 1460
   
1461
-  $data['app_version']['plan_class'] = array(
1461
+    $data['app_version']['plan_class'] = array(
1462 1462
     'title' => bts('Plan class', array(), NULL, 'boinc:application-details'),
1463 1463
     'help' => t('App version plan class.'),
1464 1464
     'field' => array(
1465
-      'handler' => 'views_handler_field',
1466
-      'click sortable' => TRUE
1465
+        'handler' => 'views_handler_field',
1466
+        'click sortable' => TRUE
1467 1467
     ),
1468 1468
     'filter' => array(
1469
-      'handler' => 'views_handler_filter_string'
1469
+        'handler' => 'views_handler_filter_string'
1470 1470
     ),
1471 1471
     'sort' => array(
1472
-      'handler' => 'views_handler_sort_string'
1472
+        'handler' => 'views_handler_sort_string'
1473 1473
     )
1474
-  );
1475
-  $data['app_version']['version_num'] = array(
1474
+    );
1475
+    $data['app_version']['version_num'] = array(
1476 1476
     'title' => bts('Version number', array(), NULL, 'boinc:application-details'),
1477 1477
     'help' => t('The application version number.'),
1478 1478
     'field' => array(
1479
-      'handler' => 'views_handler_field_boincwork_app_version_number',
1480
-      'click sortable' => TRUE,
1481
-      'float' => TRUE,
1479
+        'handler' => 'views_handler_field_boincwork_app_version_number',
1480
+        'click sortable' => TRUE,
1481
+        'float' => TRUE,
1482 1482
     ),
1483 1483
     'filter' => array(
1484
-      'handler' => 'views_handler_filter_numeric'
1484
+        'handler' => 'views_handler_filter_numeric'
1485 1485
     ),
1486 1486
     'sort' => array(
1487
-      'handler' => 'views_handler_sort_numeric'
1487
+        'handler' => 'views_handler_sort_numeric'
1488 1488
     )
1489
-  );
1489
+    );
1490 1490
   
1491
-  // ------------------------------------------------------------------------------------------------
1492
-  // Definition for host_app_version table
1493
-  // ------------------------------------------------------------------------------------------------
1491
+    // ------------------------------------------------------------------------------------------------
1492
+    // Definition for host_app_version table
1493
+    // ------------------------------------------------------------------------------------------------
1494 1494
   
1495
-  $data['host_app_version']['table']['group'] = t('BOINC');
1495
+    $data['host_app_version']['table']['group'] = t('BOINC');
1496 1496
   
1497
-  // This table references the {host} table.
1498
-  // This join creates an 'implicit' relationship to the host table, so that when
1499
-  // "Host" is the base table, the fields are automatically available.
1497
+    // This table references the {host} table.
1498
+    // This join creates an 'implicit' relationship to the host table, so that when
1499
+    // "Host" is the base table, the fields are automatically available.
1500 1500
   
1501
-  // Index this array by the table name to which this table refers.
1502
-  // 'left_field' is the primary key in the referenced table.
1503
-  // 'field' is the foreign key in this table.
1501
+    // Index this array by the table name to which this table refers.
1502
+    // 'left_field' is the primary key in the referenced table.
1503
+    // 'field' is the foreign key in this table.
1504 1504
   
1505
-  $data['host_app_version']['table']['join'] = array(
1505
+    $data['host_app_version']['table']['join'] = array(
1506 1506
     'host' => array(
1507
-      'left_field' => 'id',
1508
-      'field' => 'host_id',
1507
+        'left_field' => 'id',
1508
+        'field' => 'host_id',
1509 1509
     )
1510
-  );
1510
+    );
1511 1511
   
1512
-  // Primary keys allowed as arguments
1512
+    // Primary keys allowed as arguments
1513 1513
 
1514
-  $data['host_app_version']['host_id'] = array(
1514
+    $data['host_app_version']['host_id'] = array(
1515 1515
     'title' => bts('Computer', array(), NULL, 'boinc:host-details'),
1516 1516
     'help' => t('The host ID connected to this app version data.'),
1517 1517
     'field' => array(
1518
-      'handler' => 'views_handler_field_numeric',
1519
-      'click sortable' => TRUE
1518
+        'handler' => 'views_handler_field_numeric',
1519
+        'click sortable' => TRUE
1520 1520
     ),
1521 1521
     'argument' => array(
1522
-      'handler' => 'views_handler_argument',
1523
-      'name field' => 'title',
1524
-      'numeric' => TRUE,
1525
-      'validate type' => 'id'
1522
+        'handler' => 'views_handler_argument',
1523
+        'name field' => 'title',
1524
+        'numeric' => TRUE,
1525
+        'validate type' => 'id'
1526 1526
     ),
1527 1527
     'filter' => array(
1528
-      'handler' => 'views_handler_filter_numeric'
1528
+        'handler' => 'views_handler_filter_numeric'
1529 1529
     ),
1530 1530
     'sort' => array(
1531
-      'handler' => 'views_handler_sort_numeric'
1531
+        'handler' => 'views_handler_sort_numeric'
1532 1532
     )
1533
-  );
1533
+    );
1534 1534
   
1535
-  // Foreign key fields
1535
+    // Foreign key fields
1536 1536
   
1537
-  $data['host_app_version']['app_version_id'] = array(
1537
+    $data['host_app_version']['app_version_id'] = array(
1538 1538
     'title' => bts('App version ID', array(), NULL, 'boinc:application-details'),
1539 1539
     'help' => t('The app version ID connected to this host data.'),
1540 1540
     // Because this is a foreign key to the {host} table. This allows us to
1541 1541
     // have, when the view is configured with this relationship, all the fields
1542 1542
     // for the related node available.
1543 1543
     'argument' => array(
1544
-      'handler' => 'views_handler_argument_numeric',
1545
-      'name field' => 'title',
1546
-      'numeric' => TRUE,
1547
-      'validate type' => 'id'
1544
+        'handler' => 'views_handler_argument_numeric',
1545
+        'name field' => 'title',
1546
+        'numeric' => TRUE,
1547
+        'validate type' => 'id'
1548 1548
     ),
1549 1549
     'relationship' => array(
1550
-      'base' => 'app_version',
1551
-      'field' => 'id',
1552
-      'handler' => 'views_handler_relationship',
1553
-      'label' => t('App version')
1550
+        'base' => 'app_version',
1551
+        'field' => 'id',
1552
+        'handler' => 'views_handler_relationship',
1553
+        'label' => t('App version')
1554 1554
     ),
1555 1555
     'field' => array(
1556
-      'handler' => 'views_handler_field_numeric',
1557
-      'click sortable' => TRUE
1556
+        'handler' => 'views_handler_field_numeric',
1557
+        'click sortable' => TRUE
1558 1558
     ),
1559 1559
     'filter' => array(
1560
-      'handler' => 'views_handler_filter_numeric'
1560
+        'handler' => 'views_handler_filter_numeric'
1561 1561
     ),
1562 1562
     'sort' => array(
1563
-      'handler' => 'views_handler_sort_numeric'
1563
+        'handler' => 'views_handler_sort_numeric'
1564 1564
     )
1565
-  );
1565
+    );
1566 1566
   
1567
-  // Descriptions of host_app_version fields (alphabetized)
1567
+    // Descriptions of host_app_version fields (alphabetized)
1568 1568
   
1569
-  $data['host_app_version']['consecutive_valid'] = array(
1569
+    $data['host_app_version']['consecutive_valid'] = array(
1570 1570
     'title' => bts('Consecutive valid tasks', array(), NULL, 'boinc:application-details'),
1571 1571
     'help' => t('The number of consecutive valid tasks for this app and by this host.'),
1572 1572
     'field' => array(
1573
-      'handler' => 'views_handler_field_numeric',
1574
-      'click sortable' => TRUE
1573
+        'handler' => 'views_handler_field_numeric',
1574
+        'click sortable' => TRUE
1575 1575
     ),
1576 1576
     'filter' => array(
1577
-      'handler' => 'views_handler_filter_numeric'
1577
+        'handler' => 'views_handler_filter_numeric'
1578 1578
     ),
1579 1579
     'sort' => array(
1580
-      'handler' => 'views_handler_sort_numeric'
1580
+        'handler' => 'views_handler_sort_numeric'
1581 1581
     )
1582
-  );
1583
-  $data['host_app_version']['et_avg'] = array(
1582
+    );
1583
+    $data['host_app_version']['et_avg'] = array(
1584 1584
     'title' => t('Average processing rate'),
1585 1585
     'help' => t('The "et_avg" for this app and by this host.'),
1586 1586
     'field' => array(
1587
-      'handler' => 'views_handler_field_boincwork_host_app_et_avg',
1588
-      'click sortable' => TRUE
1587
+        'handler' => 'views_handler_field_boincwork_host_app_et_avg',
1588
+        'click sortable' => TRUE
1589 1589
     ),
1590 1590
     'filter' => array(
1591
-      'handler' => 'views_handler_filter_numeric'
1591
+        'handler' => 'views_handler_filter_numeric'
1592 1592
     ),
1593 1593
     'sort' => array(
1594
-      'handler' => 'views_handler_sort_numeric'
1594
+        'handler' => 'views_handler_sort_numeric'
1595 1595
     )
1596
-  );
1597
-  $data['host_app_version']['et_n'] = array(
1596
+    );
1597
+    $data['host_app_version']['et_n'] = array(
1598 1598
     'title' => bts('Number of tasks completed', array(), NULL, 'boinc:application-details'),
1599 1599
     'help' => t('The tasks completed for this app and by this host.'),
1600 1600
     'field' => array(
1601
-      'handler' => 'views_handler_field_numeric',
1602
-      'click sortable' => TRUE
1601
+        'handler' => 'views_handler_field_numeric',
1602
+        'click sortable' => TRUE
1603 1603
     ),
1604 1604
     'filter' => array(
1605
-      'handler' => 'views_handler_filter_numeric'
1605
+        'handler' => 'views_handler_filter_numeric'
1606 1606
     ),
1607 1607
     'sort' => array(
1608
-      'handler' => 'views_handler_sort_numeric'
1608
+        'handler' => 'views_handler_sort_numeric'
1609 1609
     )
1610
-  );
1611
-  $data['host_app_version']['max_jobs_per_day'] = array(
1610
+    );
1611
+    $data['host_app_version']['max_jobs_per_day'] = array(
1612 1612
     'title' => bts('Max tasks per day', array(), NULL, 'boinc:application-details'),
1613 1613
     'help' => t('The maximum tasks per day for this app and by this host.'),
1614 1614
     'field' => array(
1615
-      'handler' => 'views_handler_field_numeric',
1616
-      'click sortable' => TRUE
1615
+        'handler' => 'views_handler_field_numeric',
1616
+        'click sortable' => TRUE
1617 1617
     ),
1618 1618
     'filter' => array(
1619
-      'handler' => 'views_handler_filter_numeric'
1619
+        'handler' => 'views_handler_filter_numeric'
1620 1620
     ),
1621 1621
     'sort' => array(
1622
-      'handler' => 'views_handler_sort_numeric'
1622
+        'handler' => 'views_handler_sort_numeric'
1623 1623
     )
1624
-  );
1625
-  $data['host_app_version']['n_jobs_today'] = array(
1624
+    );
1625
+    $data['host_app_version']['n_jobs_today'] = array(
1626 1626
     'title' => bts('Number of tasks today', array(), NULL, 'boinc:application-details'),
1627 1627
     'help' => t('The number of tasks today for this app and by this host.'),
1628 1628
     'field' => array(
1629
-      'handler' => 'views_handler_field_numeric',
1630
-      'click sortable' => TRUE
1629
+        'handler' => 'views_handler_field_numeric',
1630
+        'click sortable' => TRUE
1631 1631
     ),
1632 1632
     'filter' => array(
1633
-      'handler' => 'views_handler_filter_numeric'
1633
+        'handler' => 'views_handler_filter_numeric'
1634 1634
     ),
1635 1635
     'sort' => array(
1636
-      'handler' => 'views_handler_sort_numeric'
1636
+        'handler' => 'views_handler_sort_numeric'
1637 1637
     )
1638
-  );
1639
-  $data['host_app_version']['turnaround_avg'] = array(
1638
+    );
1639
+    $data['host_app_version']['turnaround_avg'] = array(
1640 1640
     'title' => bts('Average turnaround time', array(), NULL, 'boinc:application-details:-1:ignoreoverwrite'),
1641 1641
     'help' => t('The average turnaround time per task for this app and by this host.'),
1642 1642
     'field' => array(
1643
-      'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg',
1644
-      'click sortable' => TRUE,
1645
-      'float' => TRUE,
1643
+        'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg',
1644
+        'click sortable' => TRUE,
1645
+        'float' => TRUE,
1646 1646
     ),
1647 1647
     'filter' => array(
1648
-      'handler' => 'views_handler_filter_numeric'
1648
+        'handler' => 'views_handler_filter_numeric'
1649 1649
     ),
1650 1650
     'sort' => array(
1651
-      'handler' => 'views_handler_sort_numeric'
1651
+        'handler' => 'views_handler_sort_numeric'
1652 1652
     )
1653
-  );
1654
-  $data['host_app_version']['user_friendly_name'] = array(
1653
+    );
1654
+    $data['host_app_version']['user_friendly_name'] = array(
1655 1655
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1656 1656
     'help' => t('The user friendly name of the application.'),
1657 1657
     'field' => array(
1658
-      'handler' => 'views_handler_field',
1659
-      'click sortable' => TRUE
1658
+        'handler' => 'views_handler_field',
1659
+        'click sortable' => TRUE
1660 1660
     ),
1661 1661
     'filter' => array(
1662
-      'handler' => 'views_handler_filter_string'
1662
+        'handler' => 'views_handler_filter_string'
1663 1663
     ),
1664 1664
     'sort' => array(
1665
-      'handler' => 'views_handler_sort_string'
1665
+        'handler' => 'views_handler_sort_string'
1666 1666
     )
1667
-  );
1667
+    );
1668 1668
   
1669
-  return $data;
1669
+    return $data;
1670 1670
 }
1671 1671
 
1672 1672
 /*
@@ -1678,23 +1678,23 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
 function boincwork_views_handlers() {
1680 1680
   
1681
-  return array(
1681
+    return array(
1682 1682
     'info' => array(
1683
-      'path' => drupal_get_path('module', 'boincwork') . '/views',
1683
+        'path' => drupal_get_path('module', 'boincwork') . '/views',
1684 1684
     ),
1685 1685
     'handlers' => array(
1686
-      'views_handler_argument_boincuser_id' => array(
1686
+        'views_handler_argument_boincuser_id' => array(
1687 1687
         'parent' => 'views_handler_argument_numeric'
1688
-      ),
1689
-      'views_handler_field_boincwork_app_version_number' => array(
1688
+        ),
1689
+        'views_handler_field_boincwork_app_version_number' => array(
1690 1690
         'parent' => 'views_handler_field_numeric'
1691
-      ),
1692
-      'views_handler_field_boincwork_host_app_et_avg' => array(
1691
+        ),
1692
+        'views_handler_field_boincwork_host_app_et_avg' => array(
1693 1693
         'parent' => 'views_handler_field_numeric'
1694
-      ),
1695
-      'views_handler_field_boincwork_host_app_turnaround_avg' => array(
1694
+        ),
1695
+        'views_handler_field_boincwork_host_app_turnaround_avg' => array(
1696 1696
         'parent' => 'views_handler_field_numeric'
1697
-      ),
1697
+        ),
1698 1698
     )
1699
-  );
1699
+    );
1700 1700
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
   // Primary keys allowed as arguments
50 50
   
51 51
   $data['host']['id'] = array(
52
-    'title' => bts('Computer ID', array(), NULL, 'boinc:host-list'),
52
+    'title' => bts('Computer ID', array(), null, 'boinc:host-list'),
53 53
     'help' => t('The ID number of this host.'),
54 54
     'field' => array(
55 55
       'handler' => 'views_handler_field_numeric',
56
-      'click sortable' => TRUE
56
+      'click sortable' => true
57 57
     ),
58 58
     'argument' => array(
59 59
       'handler' => 'views_handler_argument',
60 60
       'name field' => 'title',
61
-      'numeric' => TRUE,
61
+      'numeric' => true,
62 62
       'validate type' => 'id'
63 63
     ),
64 64
     'filter' => array(
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
     )
70 70
   );
71 71
   $data['host']['venue'] = array(
72
-    'title' => bts('Location', array(), NULL, 'boinc:host-list'),
72
+    'title' => bts('Location', array(), null, 'boinc:host-list'),
73 73
     'help' => t('The name of the preference set assigned to this host.'),
74 74
     'field' => array(
75 75
       'handler' => 'views_handler_field',
76
-      'click sortable' => TRUE
76
+      'click sortable' => true
77 77
     ),
78 78
     'argument' => array(
79 79
       'handler' => 'views_handler_argument',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
   // Foreign key fields
91 91
   
92 92
   $data['host']['userid'] = array(
93
-    'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
93
+    'title' => bts('User ID', array(), null, 'boinc:user-details'),
94 94
     'help' => t('The owner of this host.'),
95 95
     // Because this is a foreign key to the {user} table. This allows us to
96 96
     // have, when the view is configured with this relationship, all the fields
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     'argument' => array(
99 99
       'handler' => 'views_handler_argument_boincuser_id',
100 100
       'name field' => 'title',
101
-      'numeric' => TRUE,
101
+      'numeric' => true,
102 102
       'validate type' => 'id'
103 103
     ),
104 104
     'relationship' => array(
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     ),
110 110
     'field' => array(
111 111
       'handler' => 'views_handler_field_numeric',
112
-      'click sortable' => TRUE
112
+      'click sortable' => true
113 113
     ),
114 114
     'filter' => array(
115 115
       'handler' => 'views_handler_filter_numeric'
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
   // Descriptions of general host fields (alphabetized)
123 123
   
124 124
   $data['host']['active_frac'] = array(
125
-    'title' => bts('While BOINC running, % of time work is allowed', array(), NULL, 'boinc:host-details'),
125
+    'title' => bts('While BOINC running, % of time work is allowed', array(), null, 'boinc:host-details'),
126 126
     'help' => t('The percentage of time that work is allowed.'),
127 127
     'field' => array(
128 128
       'handler' => 'views_handler_field_numeric',
129
-      'click sortable' => TRUE,
130
-      'float' => TRUE
129
+      'click sortable' => true,
130
+      'float' => true
131 131
     ),
132 132
     'filter' => array(
133 133
       'handler' => 'views_handler_filter_numeric'
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
     )
138 138
   );
139 139
   $data['host']['avg_turnaround'] = array(
140
-    'title' => bts('Average turnaround time', array(), NULL, 'boinc:host-details'),
140
+    'title' => bts('Average turnaround time', array(), null, 'boinc:host-details'),
141 141
     'help' => t('The average time required for work to be completed.'),
142 142
     'field' => array(
143 143
       'handler' => 'views_handler_field_numeric',
144
-      'click sortable' => TRUE,
145
-      'float' => TRUE
144
+      'click sortable' => true,
145
+      'float' => true
146 146
     ),
147 147
     'filter' => array(
148 148
       'handler' => 'views_handler_filter_numeric'
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
     )
153 153
   );
154 154
   $data['host']['create_time'] = array(
155
-    'title' => bts('Created', array(), NULL, 'boinc:host-details'),
155
+    'title' => bts('Created', array(), null, 'boinc:host-details'),
156 156
     'help' => t('The time the host record was created.'),
157 157
     'field' => array(
158 158
       'handler' => 'views_handler_field_date',
159
-      'click sortable' => TRUE
159
+      'click sortable' => true
160 160
     ),
161 161
     'filter' => array(
162 162
       'handler' => 'views_handler_filter_date'
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
     )
167 167
   );
168 168
   $data['host']['connected_frac'] = array(
169
-    'title' => bts('While BOINC running, % of time host has an Internet connection', array(), NULL, 'boinc:host-details'),
169
+    'title' => bts('While BOINC running, % of time host has an Internet connection', array(), null, 'boinc:host-details'),
170 170
     'help' => t('The percentage of time that the host has an Internet connection.'),
171 171
     'field' => array(
172 172
       'handler' => 'views_handler_field_numeric',
173
-      'click sortable' => TRUE,
174
-      'float' => TRUE
173
+      'click sortable' => true,
174
+      'float' => true
175 175
     ),
176 176
     'filter' => array(
177 177
       'handler' => 'views_handler_filter_numeric'
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
     )
182 182
   );
183 183
   $data['host']['cpu_efficiency'] = array(
184
-    'title' => bts('Average CPU efficiency', array(), NULL, 'boinc:host-details'),
184
+    'title' => bts('Average CPU efficiency', array(), null, 'boinc:host-details'),
185 185
     'help' => t('The average efficiency of the host CPU.'),
186 186
     'field' => array(
187 187
       'handler' => 'views_handler_field_numeric',
188
-      'click sortable' => TRUE,
189
-      'float' => TRUE
188
+      'click sortable' => true,
189
+      'float' => true
190 190
     ),
191 191
     'filter' => array(
192 192
       'handler' => 'views_handler_filter_numeric'
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
     )
197 197
   );
198 198
   $data['host']['d_free'] = array(
199
-    'title' => bts('Free disk space', array(), NULL, 'boinc:host-details'),
199
+    'title' => bts('Free disk space', array(), null, 'boinc:host-details'),
200 200
     'help' => t('The amount of disk space that is not in use.'),
201 201
     'field' => array(
202 202
       'handler' => 'views_handler_field_numeric',
203
-      'click sortable' => TRUE
203
+      'click sortable' => true
204 204
     ),
205 205
     'filter' => array(
206 206
       'handler' => 'views_handler_filter_numeric'
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
     )
211 211
   );
212 212
   $data['host']['d_total'] = array(
213
-    'title' => bts('Total disk space', array(), NULL, 'boinc:host-details'),
213
+    'title' => bts('Total disk space', array(), null, 'boinc:host-details'),
214 214
     'help' => t('The size of the disk on which BOINC is installed.'),
215 215
     'field' => array(
216 216
       'handler' => 'views_handler_field_numeric',
217
-      'click sortable' => TRUE
217
+      'click sortable' => true
218 218
     ),
219 219
     'filter' => array(
220 220
       'handler' => 'views_handler_filter_numeric'
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
     )
225 225
   );
226 226
   $data['host']['domain_name'] = array(
227
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
227
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
228 228
     'help' => t('The name of the host.'),
229 229
     'field' => array(
230 230
       'handler' => 'views_handler_field',
231
-      'click sortable' => TRUE
231
+      'click sortable' => true
232 232
     ),
233 233
     'filter' => array(
234 234
       'handler' => 'views_handler_filter_string'
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
     )
239 239
   );
240 240
   $data['host']['duration_correction_factor'] = array(
241
-    'title' => bts('Task duration correction factor', array(), NULL, 'boinc:host-details'),
241
+    'title' => bts('Task duration correction factor', array(), null, 'boinc:host-details'),
242 242
     'help' => t('Task duration correction factor.'),
243 243
     'field' => array(
244 244
       'handler' => 'views_handler_field_numeric',
245
-      'click sortable' => TRUE,
246
-      'float' => TRUE
245
+      'click sortable' => true,
246
+      'float' => true
247 247
     ),
248 248
     'filter' => array(
249 249
       'handler' => 'views_handler_filter_numeric'
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
     )
254 254
   );
255 255
   $data['host']['expavg_credit'] = array(
256
-    'title' => bts('Avg. credit', array(), NULL, 'boinc:host-details'),
256
+    'title' => bts('Avg. credit', array(), null, 'boinc:host-details'),
257 257
     'help' => t('A decaying average of credit per day.'),
258 258
     'field' => array(
259 259
       'handler' => 'views_handler_field_numeric',
260
-      'click sortable' => TRUE,
261
-      'float' => TRUE
260
+      'click sortable' => true,
261
+      'float' => true
262 262
     ),
263 263
     'filter' => array(
264 264
       'handler' => 'views_handler_filter_numeric'
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
     )
269 269
   );
270 270
   $data['host']['external_ip_addr'] = array(
271
-    'title' => bts('External IP address', array(), NULL, 'boinc:host-details'),
271
+    'title' => bts('External IP address', array(), null, 'boinc:host-details'),
272 272
     'help' => t('The IP address from which the host last communicated.'),
273 273
     'field' => array(
274 274
       'handler' => 'views_handler_field',
275
-      'click sortable' => TRUE
275
+      'click sortable' => true
276 276
     ),
277 277
     'filter' => array(
278 278
       'handler' => 'views_handler_filter_string'
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
     )
283 283
   );
284 284
   $data['host']['host_cpid'] = array(
285
-    'title' => bts('Cross project ID', array(), NULL, 'boinc:host-details'),
285
+    'title' => bts('Cross project ID', array(), null, 'boinc:host-details'),
286 286
     'help' => t('The consistent identifier of the host across projects.'),
287 287
     'field' => array(
288 288
       'handler' => 'views_handler_field',
289
-      'click sortable' => TRUE
289
+      'click sortable' => true
290 290
     ),
291 291
     'filter' => array(
292 292
       'handler' => 'views_handler_filter_string'
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
     )
297 297
   );
298 298
   $data['host']['last_ip_addr'] = array(
299
-    'title' => bts('Last IP address', array(), NULL, 'boinc:host-details'),
299
+    'title' => bts('Last IP address', array(), null, 'boinc:host-details'),
300 300
     'help' => t('The IP address of the host at last communication.'),
301 301
     'field' => array(
302 302
       'handler' => 'views_handler_field',
303
-      'click sortable' => TRUE
303
+      'click sortable' => true
304 304
     ),
305 305
     'filter' => array(
306 306
       'handler' => 'views_handler_filter_string'
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
     )
311 311
   );
312 312
   $data['host']['m_cache'] = array(
313
-    'title' => bts('Cache', array(), NULL, 'boinc:host-details'),
313
+    'title' => bts('Cache', array(), null, 'boinc:host-details'),
314 314
     'help' => t('The amount of cache on the processor(s).'),
315 315
     'field' => array(
316 316
       'handler' => 'views_handler_field_numeric',
317
-      'click sortable' => TRUE
317
+      'click sortable' => true
318 318
     ),
319 319
     'filter' => array(
320 320
       'handler' => 'views_handler_filter_numeric'
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
     )
325 325
   );
326 326
   $data['host']['m_nbytes'] = array(
327
-    'title' => bts('Memory', array(), NULL, 'boinc:host-details'),
327
+    'title' => bts('Memory', array(), null, 'boinc:host-details'),
328 328
     'help' => t('The amount of memory installed.'),
329 329
     'field' => array(
330 330
       'handler' => 'views_handler_field_numeric',
331
-      'click sortable' => TRUE
331
+      'click sortable' => true
332 332
     ),
333 333
     'filter' => array(
334 334
       'handler' => 'views_handler_filter_numeric'
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
     )
339 339
   );
340 340
   $data['host']['m_swap'] = array(
341
-    'title' => bts('Swap space', array(), NULL, 'boinc:host-details'),
341
+    'title' => bts('Swap space', array(), null, 'boinc:host-details'),
342 342
     'help' => t('The amount of swap space configured.'),
343 343
     'field' => array(
344 344
       'handler' => 'views_handler_field_numeric',
345
-      'click sortable' => TRUE
345
+      'click sortable' => true
346 346
     ),
347 347
     'filter' => array(
348 348
       'handler' => 'views_handler_filter_numeric'
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
     )
353 353
   );
354 354
   $data['host']['max_results_day'] = array(
355
-    'title' => bts('Maximum daily WU quota per CPU', array(), NULL, 'boinc:host-details'),
355
+    'title' => bts('Maximum daily WU quota per CPU', array(), null, 'boinc:host-details'),
356 356
     'help' => t('The maximum number of workunits to be allocated per CPU.'),
357 357
     'field' => array(
358 358
       'handler' => 'views_handler_field_numeric',
359
-      'click sortable' => TRUE
359
+      'click sortable' => true
360 360
     ),
361 361
     'filter' => array(
362 362
       'handler' => 'views_handler_filter_numeric'
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
     )
367 367
   );
368 368
   $data['host']['n_bwdown'] = array(
369
-    'title' => bts('Average download rate', array(), NULL, 'boinc:host-details'),
369
+    'title' => bts('Average download rate', array(), null, 'boinc:host-details'),
370 370
     'help' => t('The average rate at which new work is downloaded.'),
371 371
     'field' => array(
372 372
       'handler' => 'views_handler_field_numeric',
373
-      'click sortable' => TRUE,
374
-      'float' => TRUE
373
+      'click sortable' => true,
374
+      'float' => true
375 375
     ),
376 376
     'filter' => array(
377 377
       'handler' => 'views_handler_filter_numeric'
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
     )
382 382
   );
383 383
   $data['host']['n_bwup'] = array(
384
-    'title' => bts('Average upload rate', array(), NULL, 'boinc:host-details'),
384
+    'title' => bts('Average upload rate', array(), null, 'boinc:host-details'),
385 385
     'help' => t('The average rate at which completed work is uploaded.'),
386 386
     'field' => array(
387 387
       'handler' => 'views_handler_field_numeric',
388
-      'click sortable' => TRUE,
389
-      'float' => TRUE
388
+      'click sortable' => true,
389
+      'float' => true
390 390
     ),
391 391
     'filter' => array(
392 392
       'handler' => 'views_handler_filter_numeric'
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
     )
397 397
   );
398 398
   $data['host']['nsame_ip_addr'] = array(
399
-    'title' => bts('Same IP address count', array(), NULL, 'boinc:host-details'),
399
+    'title' => bts('Same IP address count', array(), null, 'boinc:host-details'),
400 400
     'help' => t('The number of times the last IP address.'),
401 401
     'field' => array(
402 402
       'handler' => 'views_handler_field',
403
-      'click sortable' => TRUE
403
+      'click sortable' => true
404 404
     ),
405 405
     'filter' => array(
406 406
       'handler' => 'views_handler_filter_string'
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
     )
411 411
   );
412 412
   $data['host']['on_frac'] = array(
413
-    'title' => bts('% of time BOINC client is running', array(), NULL, 'boinc:host-details'),
413
+    'title' => bts('% of time BOINC client is running', array(), null, 'boinc:host-details'),
414 414
     'help' => t('The percentage of time that the BOINC client is running.'),
415 415
     'field' => array(
416 416
       'handler' => 'views_handler_field_numeric',
417
-      'click sortable' => TRUE,
418
-      'float' => TRUE
417
+      'click sortable' => true,
418
+      'float' => true
419 419
     ),
420 420
     'filter' => array(
421 421
       'handler' => 'views_handler_filter_numeric'
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
     )
426 426
   );
427 427
   $data['host']['os_name'] = array(
428
-    'title' => bts('Operating system', array(), NULL, 'boinc:host-details'),
428
+    'title' => bts('Operating system', array(), null, 'boinc:host-details'),
429 429
     'help' => t('The name of the host operating system.'),
430 430
     'field' => array(
431 431
       'handler' => 'views_handler_field',
432
-      'click sortable' => TRUE
432
+      'click sortable' => true
433 433
     ),
434 434
     'filter' => array(
435 435
       'handler' => 'views_handler_filter_string'
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
     )
440 440
   );  
441 441
   $data['host']['os_version'] = array(
442
-    'title' => bts('Operating system version', array(), NULL, 'boinc:host-details'),
442
+    'title' => bts('Operating system version', array(), null, 'boinc:host-details'),
443 443
     'help' => t('The version of the host operating system.'),
444 444
     'field' => array(
445 445
       'handler' => 'views_handler_field',
446
-      'click sortable' => TRUE
446
+      'click sortable' => true
447 447
     ),
448 448
     'filter' => array(
449 449
       'handler' => 'views_handler_filter_string'
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
     )
454 454
   );
455 455
   $data['host']['p_fpops'] = array(
456
-    'title' => bts('Measured floating point speed', array(), NULL, 'boinc:host-details'),
456
+    'title' => bts('Measured floating point speed', array(), null, 'boinc:host-details'),
457 457
     'help' => t('The capability of the host in floating point operations per second.'),
458 458
     'field' => array(
459 459
       'handler' => 'views_handler_field_numeric',
460
-      'click sortable' => TRUE,
461
-      'float' => TRUE
460
+      'click sortable' => true,
461
+      'float' => true
462 462
     ),
463 463
     'filter' => array(
464 464
       'handler' => 'views_handler_filter_numeric'
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
     )
469 469
   );
470 470
   $data['host']['p_iops'] = array(
471
-    'title' => bts('Measured integer speed', array(), NULL, 'boinc:host-details'),
471
+    'title' => bts('Measured integer speed', array(), null, 'boinc:host-details'),
472 472
     'help' => t('The capability of the host in integer operations per second.'),
473 473
     'field' => array(
474 474
       'handler' => 'views_handler_field_numeric',
475
-      'click sortable' => TRUE,
476
-      'float' => TRUE
475
+      'click sortable' => true,
476
+      'float' => true
477 477
     ),
478 478
     'filter' => array(
479 479
       'handler' => 'views_handler_filter_numeric'
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
     )
484 484
   );
485 485
   $data['host']['p_model'] = array(
486
-    'title' => bts('CPU model', array(), NULL, 'boinc:host-details'),
486
+    'title' => bts('CPU model', array(), null, 'boinc:host-details'),
487 487
     'help' => t('The model of the CPU in the host.'),
488 488
     'field' => array(
489 489
       'handler' => 'views_handler_field',
490
-      'click sortable' => TRUE
490
+      'click sortable' => true
491 491
     ),
492 492
     'filter' => array(
493 493
       'handler' => 'views_handler_filter_string'
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
     )
498 498
   );
499 499
   $data['host']['p_ncpus'] = array(
500
-    'title' => bts('Number of processors', array(), NULL, 'boinc:host-details'),
500
+    'title' => bts('Number of processors', array(), null, 'boinc:host-details'),
501 501
     'help' => t('The count of CPU cores in the system.'),
502 502
     'field' => array(
503 503
       'handler' => 'views_handler_field',
504
-      'click sortable' => TRUE
504
+      'click sortable' => true
505 505
     ),
506 506
     'filter' => array(
507 507
       'handler' => 'views_handler_filter_string'
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
     )
512 512
   );
513 513
   $data['host']['p_vendor'] = array(
514
-    'title' => bts('CPU', array(), NULL, 'boinc:host-details'),
514
+    'title' => bts('CPU', array(), null, 'boinc:host-details'),
515 515
     'help' => t('The manufacturer of the CPU in the host.'),
516 516
     'field' => array(
517 517
       'handler' => 'views_handler_field',
518
-      'click sortable' => TRUE
518
+      'click sortable' => true
519 519
     ),
520 520
     'filter' => array(
521 521
       'handler' => 'views_handler_filter_string'
@@ -525,11 +525,11 @@  discard block
 block discarded – undo
525 525
     )
526 526
   );
527 527
   $data['host']['rpc_seqno'] = array(
528
-    'title' => bts('Number of times client has contacted server', array(), NULL, 'boinc:host-details'),
528
+    'title' => bts('Number of times client has contacted server', array(), null, 'boinc:host-details'),
529 529
     'help' => t('The number of times the client has contacted the server.'),
530 530
     'field' => array(
531 531
       'handler' => 'views_handler_field_numeric',
532
-      'click sortable' => TRUE
532
+      'click sortable' => true
533 533
     ),
534 534
     'filter' => array(
535 535
       'handler' => 'views_handler_filter_numeric'
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
     )
540 540
   );
541 541
   $data['host']['rpc_time'] = array(
542
-    'title' => bts('Last contact', array(), NULL, 'boinc:host-details'),
542
+    'title' => bts('Last contact', array(), null, 'boinc:host-details'),
543 543
     'help' => t('The time of the last RPC contact with the host.'),
544 544
     'field' => array(
545 545
       'handler' => 'views_handler_field_date',
546
-      'click sortable' => TRUE
546
+      'click sortable' => true
547 547
     ),
548 548
     'filter' => array(
549 549
       'handler' => 'views_handler_filter_date'
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
     )
554 554
   );
555 555
   $data['host']['serialnum'] = array(
556
-    'title' => bts('Serial number', array(), NULL, 'boinc:host-details'),
556
+    'title' => bts('Serial number', array(), null, 'boinc:host-details'),
557 557
     'help' => t('Contains the release number of the BOINC application in use and the GPU of the host.'),
558 558
     'field' => array(
559 559
       'handler' => 'views_handler_field',
560
-      'click sortable' => TRUE
560
+      'click sortable' => true
561 561
     ),
562 562
     'filter' => array(
563 563
       'handler' => 'views_handler_filter_string'
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
     )
568 568
   );
569 569
   $data['host']['timezone'] = array(
570
-    'title' => bts('Timezone', array(), NULL, 'boinc:host-details'),
570
+    'title' => bts('Timezone', array(), null, 'boinc:host-details'),
571 571
     'help' => t('The UTC offset of the local time.'),
572 572
     'field' => array(
573 573
       'handler' => 'views_handler_field_numeric',
574
-      'click sortable' => TRUE
574
+      'click sortable' => true
575 575
     ),
576 576
     'filter' => array(
577 577
       'handler' => 'views_handler_filter_numeric'
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
     )
582 582
   );
583 583
   $data['host']['total_credit'] = array(
584
-    'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
584
+    'title' => bts('Total credit', array(), null, 'boinc:user-or-team-total-credits'),
585 585
     'help' => t('The total accumulated BOINC credit for a host.'),
586 586
     'field' => array(
587 587
       'handler' => 'views_handler_field_numeric',
588
-      'click sortable' => TRUE,
589
-      'float' => TRUE
588
+      'click sortable' => true,
589
+      'float' => true
590 590
     ),
591 591
     'filter' => array(
592 592
       'handler' => 'views_handler_filter_numeric'
@@ -611,16 +611,16 @@  discard block
 block discarded – undo
611 611
   // Primary keys allowed as arguments
612 612
 
613 613
   $data['platform']['id'] = array(
614
-    'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
614
+    'title' => bts('Platform ID', array(), null, 'boinc:platform-details'),
615 615
     'help' => t('The ID number of the platform.'),
616 616
     'field' => array(
617 617
       'handler' => 'views_handler_field_numeric',
618
-      'click sortable' => TRUE
618
+      'click sortable' => true
619 619
     ),
620 620
     'argument' => array(
621 621
       'handler' => 'views_handler_argument',
622 622
       'name field' => 'title',
623
-      'numeric' => TRUE,
623
+      'numeric' => true,
624 624
       'validate type' => 'id'
625 625
     ),
626 626
     'filter' => array(
@@ -634,11 +634,11 @@  discard block
 block discarded – undo
634 634
   // Descriptions of app fields (alphabetized)
635 635
   
636 636
   $data['platform']['name'] = array(
637
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
637
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
638 638
     'help' => t('The name of the platform.'),
639 639
     'field' => array(
640 640
       'handler' => 'views_handler_field',
641
-      'click sortable' => TRUE
641
+      'click sortable' => true
642 642
     ),
643 643
     'filter' => array(
644 644
       'handler' => 'views_handler_filter_string'
@@ -680,16 +680,16 @@  discard block
 block discarded – undo
680 680
   // Primary keys allowed as arguments
681 681
 
682 682
   $data['result']['id'] = array(
683
-    'title' => bts('Task ID', array(), NULL, 'boinc:task-details'),
683
+    'title' => bts('Task ID', array(), null, 'boinc:task-details'),
684 684
     'help' => t('The ID number of this result.'),
685 685
     'field' => array(
686 686
       'handler' => 'views_handler_field_numeric',
687
-      'click sortable' => TRUE
687
+      'click sortable' => true
688 688
     ),
689 689
     'argument' => array(
690 690
       'handler' => 'views_handler_argument',
691 691
       'name field' => 'title',
692
-      'numeric' => TRUE,
692
+      'numeric' => true,
693 693
       'validate type' => 'id'
694 694
     ),
695 695
     'filter' => array(
@@ -703,13 +703,13 @@  discard block
 block discarded – undo
703 703
   // Foreign key fields
704 704
   
705 705
   $data['result']['userid'] = array(
706
-    'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
706
+    'title' => bts('User ID', array(), null, 'boinc:user-details'),
707 707
     'help' => t('The owner of this result.'),
708 708
     // Foreign key to the {user} table
709 709
     'argument' => array(
710 710
       'handler' => 'views_handler_argument_boincuser_id',
711 711
       'name field' => 'title',
712
-      'numeric' => TRUE,
712
+      'numeric' => true,
713 713
       'validate type' => 'id'
714 714
     ),
715 715
     'relationship' => array(
@@ -720,13 +720,13 @@  discard block
 block discarded – undo
720 720
     )
721 721
   );
722 722
   $data['result']['workunitid'] = array(
723
-    'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
723
+    'title' => bts('Workunit ID', array(), null, 'boinc:workunit-details'),
724 724
     'help' => t('The workunit associated with this result.'),
725 725
     // Foreign key to the {workunit} table
726 726
     'argument' => array(
727 727
       'handler' => 'views_handler_argument',
728 728
       'name field' => 'title',
729
-      'numeric' => TRUE,
729
+      'numeric' => true,
730 730
       'validate type' => 'id'
731 731
     ),
732 732
     'relationship' => array(
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     ),
738 738
     'field' => array(
739 739
       'handler' => 'views_handler_field_numeric',
740
-      'click sortable' => TRUE
740
+      'click sortable' => true
741 741
     ),
742 742
     'filter' => array(
743 743
       'handler' => 'views_handler_filter_numeric'
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
     )
748 748
   );
749 749
   $data['result']['hostid'] = array(
750
-    'title' => bts('Host ID', array(), NULL, 'boinc:task-details'),
750
+    'title' => bts('Host ID', array(), null, 'boinc:task-details'),
751 751
     'help' => t('The host associated with this result.'),
752 752
     // Foreign key to the {host} table
753 753
     'argument' => array(
754 754
       'handler' => 'views_handler_argument',
755 755
       'name field' => 'title',
756
-      'numeric' => TRUE,
756
+      'numeric' => true,
757 757
       'validate type' => 'id'
758 758
     ),
759 759
     'relationship' => array(
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
     ),
765 765
     'field' => array(
766 766
       'handler' => 'views_handler_field_numeric',
767
-      'click sortable' => TRUE
767
+      'click sortable' => true
768 768
     ),
769 769
     'filter' => array(
770 770
       'handler' => 'views_handler_filter_numeric'
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
   // Descriptions of result fields (alphabetized)
778 778
   
779 779
   $data['result']['appid'] = array(
780
-    'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
780
+    'title' => bts('Application ID', array(), null, 'boinc:application-details'),
781 781
     'help' => t('The ID number of the application.'),
782 782
     'field' => array(
783 783
       'handler' => 'views_handler_field_numeric',
784
-      'click sortable' => TRUE
784
+      'click sortable' => true
785 785
     ),
786 786
     'filter' => array(
787 787
       'handler' => 'views_handler_filter_numeric'
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
     )
792 792
   );
793 793
   $data['result']['app_version_id'] = array(
794
-    'title' => bts('Application version', array(), NULL, 'boinc:task-details'),
794
+    'title' => bts('Application version', array(), null, 'boinc:task-details'),
795 795
     'help' => t('The version number of the application.'),
796 796
     'field' => array(
797 797
       'handler' => 'views_handler_field_numeric',
798
-      'click sortable' => TRUE
798
+      'click sortable' => true
799 799
     ),
800 800
     'filter' => array(
801 801
       'handler' => 'views_handler_filter_numeric'
@@ -805,12 +805,12 @@  discard block
 block discarded – undo
805 805
     )
806 806
   );
807 807
   $data['result']['claimed_credit'] = array(
808
-    'title' => bts('Claimed credit', array(), NULL, 'boinc:task-details'),
808
+    'title' => bts('Claimed credit', array(), null, 'boinc:task-details'),
809 809
     'help' => t('The credit claimed for this result.'),
810 810
     'field' => array(
811 811
       'handler' => 'views_handler_field_numeric',
812
-      'click sortable' => TRUE,
813
-      'float' => TRUE
812
+      'click sortable' => true,
813
+      'float' => true
814 814
     ),
815 815
     'filter' => array(
816 816
       'handler' => 'views_handler_filter_numeric'
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
     )
821 821
   );
822 822
   $data['result']['client_state'] = array(
823
-    'title' => bts('Client state', array(), NULL, 'boinc:task-details'),
823
+    'title' => bts('Client state', array(), null, 'boinc:task-details'),
824 824
     'help' => t('The state of the task on the client side.'),
825 825
     'field' => array(
826 826
       'handler' => 'views_handler_field_numeric',
827
-      'click sortable' => TRUE
827
+      'click sortable' => true
828 828
     ),
829 829
     'filter' => array(
830 830
       'handler' => 'views_handler_filter_numeric'
@@ -834,12 +834,12 @@  discard block
 block discarded – undo
834 834
     )
835 835
   );
836 836
   $data['result']['cpu_time'] = array(
837
-    'title' => bts('CPU time', array(), NULL, 'boinc:task-details'),
837
+    'title' => bts('CPU time', array(), null, 'boinc:task-details'),
838 838
     'help' => t('The CPU time spent on the task.'),
839 839
     'field' => array(
840 840
       'handler' => 'views_handler_field_numeric',
841
-      'click sortable' => TRUE,
842
-      'float' => TRUE
841
+      'click sortable' => true,
842
+      'float' => true
843 843
     ),
844 844
     'filter' => array(
845 845
       'handler' => 'views_handler_filter_numeric'
@@ -849,11 +849,11 @@  discard block
 block discarded – undo
849 849
     )
850 850
   );
851 851
   $data['result']['create_time'] = array(
852
-    'title' => bts('Created', array(), NULL, 'boinc:task-details:-1:ignoreoverwrite'),
852
+    'title' => bts('Created', array(), null, 'boinc:task-details:-1:ignoreoverwrite'),
853 853
     'help' => t('The time that the task was created.'),
854 854
     'field' => array(
855 855
       'handler' => 'views_handler_field_date',
856
-      'click sortable' => TRUE
856
+      'click sortable' => true
857 857
     ),
858 858
     'filter' => array(
859 859
       'handler' => 'views_handler_filter_date'
@@ -863,12 +863,12 @@  discard block
 block discarded – undo
863 863
     )
864 864
   );
865 865
   $data['result']['elapsed_time'] = array(
866
-    'title' => bts('Run time', array(), NULL, 'boinc:task-details'),
866
+    'title' => bts('Run time', array(), null, 'boinc:task-details'),
867 867
     'help' => t('The run time of the task.'),
868 868
     'field' => array(
869 869
       'handler' => 'views_handler_field_numeric',
870
-      'click sortable' => TRUE,
871
-      'float' => TRUE
870
+      'click sortable' => true,
871
+      'float' => true
872 872
     ),
873 873
     'filter' => array(
874 874
       'handler' => 'views_handler_filter_numeric'
@@ -878,11 +878,11 @@  discard block
 block discarded – undo
878 878
     )
879 879
   );
880 880
   $data['result']['exit_status'] = array(
881
-    'title' => bts('Exit status', array(), NULL, 'boinc:task-details'),
881
+    'title' => bts('Exit status', array(), null, 'boinc:task-details'),
882 882
     'help' => t('The exit code of the task.'),
883 883
     'field' => array(
884 884
       'handler' => 'views_handler_field_numeric',
885
-      'click sortable' => TRUE
885
+      'click sortable' => true
886 886
     ),
887 887
     'filter' => array(
888 888
       'handler' => 'views_handler_filter_numeric'
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
     )
893 893
   );
894 894
   $data['result']['granted_credit'] = array(
895
-    'title' => bts('Granted credit', array(), NULL, 'boinc:task-details'),
895
+    'title' => bts('Granted credit', array(), null, 'boinc:task-details'),
896 896
     'help' => t('The credit granted for this result.'),
897 897
     'field' => array(
898 898
       'handler' => 'views_handler_field_numeric',
899
-      'click sortable' => TRUE,
900
-      'float' => TRUE
899
+      'click sortable' => true,
900
+      'float' => true
901 901
     ),
902 902
     'filter' => array(
903 903
       'handler' => 'views_handler_filter_numeric'
@@ -907,11 +907,11 @@  discard block
 block discarded – undo
907 907
     )
908 908
   );
909 909
   $data['result']['name'] = array(
910
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
910
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
911 911
     'help' => t('The name of the task.'),
912 912
     'field' => array(
913 913
       'handler' => 'views_handler_field',
914
-      'click sortable' => TRUE
914
+      'click sortable' => true
915 915
     ),
916 916
     'filter' => array(
917 917
       'handler' => 'views_handler_filter_string'
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
     )
922 922
   );
923 923
   $data['result']['outcome'] = array(
924
-    'title' => bts('Outcome', array(), NULL, 'boinc:task-details'),
924
+    'title' => bts('Outcome', array(), null, 'boinc:task-details'),
925 925
     'help' => t('The outcome of the task.'),
926 926
     'field' => array(
927 927
       'handler' => 'views_handler_field_numeric',
928
-      'click sortable' => TRUE
928
+      'click sortable' => true
929 929
     ),
930 930
     'filter' => array(
931 931
       'handler' => 'views_handler_filter_numeric'
@@ -935,11 +935,11 @@  discard block
 block discarded – undo
935 935
     )
936 936
   );
937 937
   $data['result']['received_time'] = array(
938
-    'title' => bts('Received time', array(), NULL, 'boinc:task-details'),
938
+    'title' => bts('Received time', array(), null, 'boinc:task-details'),
939 939
     'help' => t('The time that the result was received.'),
940 940
     'field' => array(
941 941
       'handler' => 'views_handler_field_date',
942
-      'click sortable' => TRUE
942
+      'click sortable' => true
943 943
     ),
944 944
     'filter' => array(
945 945
       'handler' => 'views_handler_filter_date'
@@ -949,11 +949,11 @@  discard block
 block discarded – undo
949 949
     )
950 950
   );
951 951
   $data['result']['report_deadline'] = array(
952
-    'title' => bts('Report deadline', array(), NULL, 'boinc:task-details'),
952
+    'title' => bts('Report deadline', array(), null, 'boinc:task-details'),
953 953
     'help' => t('The deadline for the task.'),
954 954
     'field' => array(
955 955
       'handler' => 'views_handler_field_date',
956
-      'click sortable' => TRUE
956
+      'click sortable' => true
957 957
     ),
958 958
     'filter' => array(
959 959
       'handler' => 'views_handler_filter_date'
@@ -963,11 +963,11 @@  discard block
 block discarded – undo
963 963
     )
964 964
   );
965 965
   $data['result']['sent_time'] = array(
966
-    'title' => bts('Sent', array(), NULL, 'boinc:task-details'),
966
+    'title' => bts('Sent', array(), null, 'boinc:task-details'),
967 967
     'help' => t('The time that the task was sent.'),
968 968
     'field' => array(
969 969
       'handler' => 'views_handler_field_date',
970
-      'click sortable' => TRUE
970
+      'click sortable' => true
971 971
     ),
972 972
     'filter' => array(
973 973
       'handler' => 'views_handler_filter_date'
@@ -977,11 +977,11 @@  discard block
 block discarded – undo
977 977
     )
978 978
   );
979 979
   $data['result']['server_state'] = array(
980
-    'title' => bts('Server state', array(), NULL, 'boinc:task-details'),
980
+    'title' => bts('Server state', array(), null, 'boinc:task-details'),
981 981
     'help' => t('The state of task on the server side.'),
982 982
     'field' => array(
983 983
       'handler' => 'views_handler_field_numeric',
984
-      'click sortable' => TRUE
984
+      'click sortable' => true
985 985
     ),
986 986
     'filter' => array(
987 987
       'handler' => 'views_handler_filter_numeric'
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
     )
992 992
   );
993 993
   $data['result']['stderr_out'] = array(
994
-    'title' => bts('Stderr out', array(), NULL, 'boinc:task-details'),
994
+    'title' => bts('Stderr out', array(), null, 'boinc:task-details'),
995 995
     'help' => t('The output to standard error.'),
996 996
     'field' => array(
997 997
       'handler' => 'views_handler_field',
998
-      'click sortable' => TRUE
998
+      'click sortable' => true
999 999
     ),
1000 1000
     'filter' => array(
1001 1001
       'handler' => 'views_handler_filter_string'
@@ -1005,11 +1005,11 @@  discard block
 block discarded – undo
1005 1005
     )
1006 1006
   );
1007 1007
   $data['result']['validate_state'] = array(
1008
-    'title' => bts('Validation state', array(), NULL, 'boinc:task-details'),
1008
+    'title' => bts('Validation state', array(), null, 'boinc:task-details'),
1009 1009
     'help' => t('The state of validation of this result.'),
1010 1010
     'field' => array(
1011 1011
       'handler' => 'views_handler_field_numeric',
1012
-      'click sortable' => TRUE
1012
+      'click sortable' => true
1013 1013
     ),
1014 1014
     'filter' => array(
1015 1015
       'handler' => 'views_handler_filter_numeric'
@@ -1019,11 +1019,11 @@  discard block
 block discarded – undo
1019 1019
     )
1020 1020
   );
1021 1021
   $data['result']['peak_working_set_size'] = array(
1022
-    'title' => bts('Peak working set size', array(), NULL, 'boinc:task-details'),
1022
+    'title' => bts('Peak working set size', array(), null, 'boinc:task-details'),
1023 1023
     'help' => t('Peak working set size.'),
1024 1024
     'field' => array(
1025 1025
       'handler' => 'views_handler_field_numeric',
1026
-      'click sortable' => TRUE
1026
+      'click sortable' => true
1027 1027
     ),
1028 1028
     'filter' => array(
1029 1029
       'handler' => 'views_handler_filter_numeric'
@@ -1033,11 +1033,11 @@  discard block
 block discarded – undo
1033 1033
     )
1034 1034
   );
1035 1035
   $data['result']['peak_swap_size'] = array(
1036
-    'title' => bts('Peak swap size', array(), NULL, 'boinc:task-details'),
1036
+    'title' => bts('Peak swap size', array(), null, 'boinc:task-details'),
1037 1037
     'help' => t('Peak swap size.'),
1038 1038
     'field' => array(
1039 1039
       'handler' => 'views_handler_field_numeric',
1040
-      'click sortable' => TRUE
1040
+      'click sortable' => true
1041 1041
     ),
1042 1042
     'filter' => array(
1043 1043
       'handler' => 'views_handler_filter_numeric'
@@ -1047,11 +1047,11 @@  discard block
 block discarded – undo
1047 1047
     )
1048 1048
   );
1049 1049
     $data['result']['peak_disk_usage'] = array(
1050
-    'title' => bts('Peak disk usage', array(), NULL, 'boinc:task-details'),
1050
+    'title' => bts('Peak disk usage', array(), null, 'boinc:task-details'),
1051 1051
     'help' => t('Peak disk usage.'),
1052 1052
     'field' => array(
1053 1053
       'handler' => 'views_handler_field_numeric',
1054
-      'click sortable' => TRUE
1054
+      'click sortable' => true
1055 1055
     ),
1056 1056
     'filter' => array(
1057 1057
       'handler' => 'views_handler_filter_numeric'
@@ -1086,16 +1086,16 @@  discard block
 block discarded – undo
1086 1086
   // Primary keys allowed as arguments
1087 1087
   
1088 1088
   $data['workunit']['id'] = array(
1089
-    'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
1089
+    'title' => bts('Workunit ID', array(), null, 'boinc:workunit-details'),
1090 1090
     'help' => t('The ID number of this workunit.'),
1091 1091
     'field' => array(
1092 1092
       'handler' => 'views_handler_field_numeric',
1093
-      'click sortable' => TRUE
1093
+      'click sortable' => true
1094 1094
     ),
1095 1095
     'argument' => array(
1096 1096
       'handler' => 'views_handler_argument',
1097 1097
       'name field' => 'title',
1098
-      'numeric' => TRUE,
1098
+      'numeric' => true,
1099 1099
       'validate type' => 'id'
1100 1100
     ),
1101 1101
     'filter' => array(
@@ -1109,12 +1109,12 @@  discard block
 block discarded – undo
1109 1109
   // Foreign key fields
1110 1110
   
1111 1111
   $data['workunit']['appid'] = array(
1112
-    'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1112
+    'title' => bts('Application ID', array(), null, 'boinc:application-details'),
1113 1113
     'help' => t('The application associated with this workunit.'), 
1114 1114
     'argument' => array( // foreign key to the {app} table
1115 1115
       'handler' => 'views_handler_argument',
1116 1116
       'name field' => 'title',
1117
-      'numeric' => TRUE,
1117
+      'numeric' => true,
1118 1118
       'validate type' => 'id'
1119 1119
     ),
1120 1120
     'relationship' => array(
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
     ),
1126 1126
     'field' => array(
1127 1127
       'handler' => 'views_handler_field_numeric',
1128
-      'click sortable' => TRUE
1128
+      'click sortable' => true
1129 1129
     ),
1130 1130
     'filter' => array(
1131 1131
       'handler' => 'views_handler_filter_numeric'
@@ -1138,12 +1138,12 @@  discard block
 block discarded – undo
1138 1138
   // Descriptions of workunit fields (alphabetized)
1139 1139
   
1140 1140
   $data['workunit']['canonical_credit'] = array(
1141
-    'title' => bts('Canonical credit', array(), NULL, 'boinc:workunit-details'),
1141
+    'title' => bts('Canonical credit', array(), null, 'boinc:workunit-details'),
1142 1142
     'help' => t('The canonical credit of the workunit.'),
1143 1143
     'field' => array(
1144 1144
       'handler' => 'views_handler_field_numeric',
1145
-      'click sortable' => TRUE,
1146
-      'float' => TRUE
1145
+      'click sortable' => true,
1146
+      'float' => true
1147 1147
     ),
1148 1148
     'filter' => array(
1149 1149
       'handler' => 'views_handler_filter_numeric'
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
     )
1154 1154
   );
1155 1155
   $data['workunit']['canonical_resultid'] = array(
1156
-    'title' => bts('Canonical result ID', array(), NULL, 'boinc:workunit-details'),
1156
+    'title' => bts('Canonical result ID', array(), null, 'boinc:workunit-details'),
1157 1157
     'help' => t('The ID of the canonical result associated with the workunit.'),
1158 1158
     'field' => array(
1159 1159
       'handler' => 'views_handler_field_numeric',
1160
-      'click sortable' => TRUE
1160
+      'click sortable' => true
1161 1161
     ),
1162 1162
     'filter' => array(
1163 1163
       'handler' => 'views_handler_filter_numeric'
@@ -1167,11 +1167,11 @@  discard block
 block discarded – undo
1167 1167
     )
1168 1168
   );
1169 1169
   $data['workunit']['create_time'] = array(
1170
-    'title' => bts('Created time', array(), NULL, 'boinc:workunit-details'),
1170
+    'title' => bts('Created time', array(), null, 'boinc:workunit-details'),
1171 1171
     'help' => t('The time that the workunit was created.'),
1172 1172
     'field' => array(
1173 1173
       'handler' => 'views_handler_field_date',
1174
-      'click sortable' => TRUE
1174
+      'click sortable' => true
1175 1175
     ),
1176 1176
     'filter' => array(
1177 1177
       'handler' => 'views_handler_filter_date'
@@ -1181,11 +1181,11 @@  discard block
 block discarded – undo
1181 1181
     )
1182 1182
   );
1183 1183
   $data['workunit']['error_mask'] = array(
1184
-    'title' => bts('Error mask', array(), NULL, 'boinc:workunit-details'),
1184
+    'title' => bts('Error mask', array(), null, 'boinc:workunit-details'),
1185 1185
     'help' => t('Error mask of the workunit.'),
1186 1186
     'field' => array(
1187 1187
       'handler' => 'views_handler_field_numeric',
1188
-      'click sortable' => TRUE
1188
+      'click sortable' => true
1189 1189
     ),
1190 1190
     'filter' => array(
1191 1191
       'handler' => 'views_handler_filter_numeric'
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
     )
1196 1196
   );
1197 1197
   $data['workunit']['min_quorum'] = array(
1198
-    'title' => bts('Minimum quorum', array(), NULL, 'boinc:workunit-details'),
1198
+    'title' => bts('Minimum quorum', array(), null, 'boinc:workunit-details'),
1199 1199
     'help' => t('Minimum quorum of the workunit.'),
1200 1200
     'field' => array(
1201 1201
       'handler' => 'views_handler_field_numeric',
1202
-      'click sortable' => TRUE
1202
+      'click sortable' => true
1203 1203
     ),
1204 1204
     'filter' => array(
1205 1205
       'handler' => 'views_handler_filter_numeric'
@@ -1209,11 +1209,11 @@  discard block
 block discarded – undo
1209 1209
     )
1210 1210
   );
1211 1211
   $data['workunit']['name'] = array(
1212
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'),
1212
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'),
1213 1213
     'help' => t('The name of the workunit.'),
1214 1214
     'field' => array(
1215 1215
       'handler' => 'views_handler_field',
1216
-      'click sortable' => TRUE
1216
+      'click sortable' => true
1217 1217
     ),
1218 1218
     'filter' => array(
1219 1219
       'handler' => 'views_handler_filter_string'
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
     )
1224 1224
   );
1225 1225
   $data['workunit']['max_error_results'] = array(
1226
-    'title' => bts('Max error tasks', array(), NULL, 'boinc:workunit-details'),
1226
+    'title' => bts('Max error tasks', array(), null, 'boinc:workunit-details'),
1227 1227
     'help' => t('The maximum number of error tasks in the workunit.'),
1228 1228
     'field' => array(
1229 1229
       'handler' => 'views_handler_field_numeric',
1230
-      'click sortable' => TRUE
1230
+      'click sortable' => true
1231 1231
     ),
1232 1232
     'filter' => array(
1233 1233
       'handler' => 'views_handler_filter_numeric'
@@ -1237,11 +1237,11 @@  discard block
 block discarded – undo
1237 1237
     )
1238 1238
   );
1239 1239
   $data['workunit']['max_success_results'] = array(
1240
-    'title' => bts('Max success tasks', array(), NULL, 'boinc:workunit-details'),
1240
+    'title' => bts('Max success tasks', array(), null, 'boinc:workunit-details'),
1241 1241
     'help' => t('The maximum number of successful tasks in the workunit.'),
1242 1242
     'field' => array(
1243 1243
       'handler' => 'views_handler_field_numeric',
1244
-      'click sortable' => TRUE
1244
+      'click sortable' => true
1245 1245
     ),
1246 1246
     'filter' => array(
1247 1247
       'handler' => 'views_handler_filter_numeric'
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
     )
1252 1252
   );
1253 1253
   $data['workunit']['max_total_results'] = array(
1254
-    'title' => bts('Max total tasks', array(), NULL, 'boinc:workunit-details'),
1254
+    'title' => bts('Max total tasks', array(), null, 'boinc:workunit-details'),
1255 1255
     'help' => t('The maximum number of total tasks in the workunit.'),
1256 1256
     'field' => array(
1257 1257
       'handler' => 'views_handler_field_numeric',
1258
-      'click sortable' => TRUE
1258
+      'click sortable' => true
1259 1259
     ),
1260 1260
     'filter' => array(
1261 1261
       'handler' => 'views_handler_filter_numeric'
@@ -1265,11 +1265,11 @@  discard block
 block discarded – undo
1265 1265
     )
1266 1266
   );
1267 1267
   $data['workunit']['need_validate'] = array(
1268
-    'title' => bts('Needs validation', array(), NULL, 'boinc:workunit-details'),
1268
+    'title' => bts('Needs validation', array(), null, 'boinc:workunit-details'),
1269 1269
     'help' => t('Whether or not a workunit needs validation.'),
1270 1270
     'field' => array(
1271 1271
       'handler' => 'views_handler_field_numeric',
1272
-      'click sortable' => TRUE
1272
+      'click sortable' => true
1273 1273
     ),
1274 1274
     'filter' => array(
1275 1275
       'handler' => 'views_handler_filter_numeric'
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
     )
1280 1280
   );
1281 1281
   $data['workunit']['target_nresults'] = array(
1282
-    'title' => bts('Initial replication', array(), NULL, 'boinc:workunit-details'),
1282
+    'title' => bts('Initial replication', array(), null, 'boinc:workunit-details'),
1283 1283
     'help' => t('The target number of results for the workunit.'),
1284 1284
     'field' => array(
1285 1285
       'handler' => 'views_handler_field_numeric',
1286
-      'click sortable' => TRUE
1286
+      'click sortable' => true
1287 1287
     ),
1288 1288
     'filter' => array(
1289 1289
       'handler' => 'views_handler_filter_numeric'
@@ -1308,16 +1308,16 @@  discard block
 block discarded – undo
1308 1308
   // Primary keys allowed as arguments
1309 1309
 
1310 1310
   $data['app']['id'] = array(
1311
-    'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1311
+    'title' => bts('Application ID', array(), null, 'boinc:application-details'),
1312 1312
     'help' => t('The ID number of this application.'),
1313 1313
     'field' => array(
1314 1314
       'handler' => 'views_handler_field_numeric',
1315
-      'click sortable' => TRUE
1315
+      'click sortable' => true
1316 1316
     ),
1317 1317
     'argument' => array(
1318 1318
       'handler' => 'views_handler_argument',
1319 1319
       'name field' => 'title',
1320
-      'numeric' => TRUE,
1320
+      'numeric' => true,
1321 1321
       'validate type' => 'id'
1322 1322
     ),
1323 1323
     'filter' => array(
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
   // Descriptions of app fields (alphabetized)
1332 1332
   
1333 1333
   $data['app']['target_nresults'] = array(
1334
-    'title' => bts('Target number of results', array(), NULL, 'boinc:application-details'),
1334
+    'title' => bts('Target number of results', array(), null, 'boinc:application-details'),
1335 1335
     'help' => t('The number of times to replicate tasks in this application.'),
1336 1336
     'field' => array(
1337 1337
       'handler' => 'views_handler_field_numeric',
1338
-      'click sortable' => TRUE
1338
+      'click sortable' => true
1339 1339
     ),
1340 1340
     'filter' => array(
1341 1341
       'handler' => 'views_handler_filter_numeric'
@@ -1345,11 +1345,11 @@  discard block
 block discarded – undo
1345 1345
     )
1346 1346
   );
1347 1347
   $data['app']['user_friendly_name'] = array(
1348
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1348
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1349 1349
     'help' => t('The user friendly name of the application.'),
1350 1350
     'field' => array(
1351 1351
       'handler' => 'views_handler_field',
1352
-      'click sortable' => TRUE
1352
+      'click sortable' => true
1353 1353
     ),
1354 1354
     'filter' => array(
1355 1355
       'handler' => 'views_handler_filter_string'
@@ -1374,16 +1374,16 @@  discard block
 block discarded – undo
1374 1374
   // Primary keys allowed as arguments
1375 1375
 
1376 1376
   $data['app_version']['id'] = array(
1377
-    'title' => bts('Application version ID', array(), NULL, 'boinc:application-details'),
1377
+    'title' => bts('Application version ID', array(), null, 'boinc:application-details'),
1378 1378
     'help' => t('The ID number of this application version.'),
1379 1379
     'field' => array(
1380 1380
       'handler' => 'views_handler_field_numeric',
1381
-      'click sortable' => TRUE
1381
+      'click sortable' => true
1382 1382
     ),
1383 1383
     'argument' => array(
1384 1384
       'handler' => 'views_handler_argument',
1385 1385
       'name field' => 'title',
1386
-      'numeric' => TRUE,
1386
+      'numeric' => true,
1387 1387
       'validate type' => 'id'
1388 1388
     ),
1389 1389
     'filter' => array(
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
   // Foreign key fields
1398 1398
   
1399 1399
   $data['app_version']['appid'] = array(
1400
-    'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1400
+    'title' => bts('Application ID', array(), null, 'boinc:application-details'),
1401 1401
     'help' => t('The application ID associated with this app version.'),
1402 1402
     // Because this is a foreign key to the {app} table. This allows us to
1403 1403
     // have, when the view is configured with this relationship, all the fields
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
     'argument' => array(
1406 1406
       'handler' => 'views_handler_argument_numeric',
1407 1407
       'name field' => 'title',
1408
-      'numeric' => TRUE,
1408
+      'numeric' => true,
1409 1409
       'validate type' => 'id'
1410 1410
     ),
1411 1411
     'relationship' => array(
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
     ),
1417 1417
     'field' => array(
1418 1418
       'handler' => 'views_handler_field_numeric',
1419
-      'click sortable' => TRUE
1419
+      'click sortable' => true
1420 1420
     ),
1421 1421
     'filter' => array(
1422 1422
       'handler' => 'views_handler_filter_numeric'
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
   );
1428 1428
   
1429 1429
   $data['app_version']['platformid'] = array(
1430
-    'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
1430
+    'title' => bts('Platform ID', array(), null, 'boinc:platform-details'),
1431 1431
     'help' => t('The platform ID associated with this app version.'),
1432 1432
     // Because this is a foreign key to the {platform} table. This allows us to
1433 1433
     // have, when the view is configured with this relationship, all the fields
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
     'argument' => array(
1436 1436
       'handler' => 'views_handler_argument_numeric',
1437 1437
       'name field' => 'title',
1438
-      'numeric' => TRUE,
1438
+      'numeric' => true,
1439 1439
       'validate type' => 'id'
1440 1440
     ),
1441 1441
     'relationship' => array(
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
     ),
1447 1447
     'field' => array(
1448 1448
       'handler' => 'views_handler_field_numeric',
1449
-      'click sortable' => TRUE
1449
+      'click sortable' => true
1450 1450
     ),
1451 1451
     'filter' => array(
1452 1452
       'handler' => 'views_handler_filter_numeric'
@@ -1459,11 +1459,11 @@  discard block
 block discarded – undo
1459 1459
   // Descriptions of app fields (alphabetized)
1460 1460
   
1461 1461
   $data['app_version']['plan_class'] = array(
1462
-    'title' => bts('Plan class', array(), NULL, 'boinc:application-details'),
1462
+    'title' => bts('Plan class', array(), null, 'boinc:application-details'),
1463 1463
     'help' => t('App version plan class.'),
1464 1464
     'field' => array(
1465 1465
       'handler' => 'views_handler_field',
1466
-      'click sortable' => TRUE
1466
+      'click sortable' => true
1467 1467
     ),
1468 1468
     'filter' => array(
1469 1469
       'handler' => 'views_handler_filter_string'
@@ -1473,12 +1473,12 @@  discard block
 block discarded – undo
1473 1473
     )
1474 1474
   );
1475 1475
   $data['app_version']['version_num'] = array(
1476
-    'title' => bts('Version number', array(), NULL, 'boinc:application-details'),
1476
+    'title' => bts('Version number', array(), null, 'boinc:application-details'),
1477 1477
     'help' => t('The application version number.'),
1478 1478
     'field' => array(
1479 1479
       'handler' => 'views_handler_field_boincwork_app_version_number',
1480
-      'click sortable' => TRUE,
1481
-      'float' => TRUE,
1480
+      'click sortable' => true,
1481
+      'float' => true,
1482 1482
     ),
1483 1483
     'filter' => array(
1484 1484
       'handler' => 'views_handler_filter_numeric'
@@ -1512,16 +1512,16 @@  discard block
 block discarded – undo
1512 1512
   // Primary keys allowed as arguments
1513 1513
 
1514 1514
   $data['host_app_version']['host_id'] = array(
1515
-    'title' => bts('Computer', array(), NULL, 'boinc:host-details'),
1515
+    'title' => bts('Computer', array(), null, 'boinc:host-details'),
1516 1516
     'help' => t('The host ID connected to this app version data.'),
1517 1517
     'field' => array(
1518 1518
       'handler' => 'views_handler_field_numeric',
1519
-      'click sortable' => TRUE
1519
+      'click sortable' => true
1520 1520
     ),
1521 1521
     'argument' => array(
1522 1522
       'handler' => 'views_handler_argument',
1523 1523
       'name field' => 'title',
1524
-      'numeric' => TRUE,
1524
+      'numeric' => true,
1525 1525
       'validate type' => 'id'
1526 1526
     ),
1527 1527
     'filter' => array(
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
   // Foreign key fields
1536 1536
   
1537 1537
   $data['host_app_version']['app_version_id'] = array(
1538
-    'title' => bts('App version ID', array(), NULL, 'boinc:application-details'),
1538
+    'title' => bts('App version ID', array(), null, 'boinc:application-details'),
1539 1539
     'help' => t('The app version ID connected to this host data.'),
1540 1540
     // Because this is a foreign key to the {host} table. This allows us to
1541 1541
     // have, when the view is configured with this relationship, all the fields
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
     'argument' => array(
1544 1544
       'handler' => 'views_handler_argument_numeric',
1545 1545
       'name field' => 'title',
1546
-      'numeric' => TRUE,
1546
+      'numeric' => true,
1547 1547
       'validate type' => 'id'
1548 1548
     ),
1549 1549
     'relationship' => array(
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
     ),
1555 1555
     'field' => array(
1556 1556
       'handler' => 'views_handler_field_numeric',
1557
-      'click sortable' => TRUE
1557
+      'click sortable' => true
1558 1558
     ),
1559 1559
     'filter' => array(
1560 1560
       'handler' => 'views_handler_filter_numeric'
@@ -1567,11 +1567,11 @@  discard block
 block discarded – undo
1567 1567
   // Descriptions of host_app_version fields (alphabetized)
1568 1568
   
1569 1569
   $data['host_app_version']['consecutive_valid'] = array(
1570
-    'title' => bts('Consecutive valid tasks', array(), NULL, 'boinc:application-details'),
1570
+    'title' => bts('Consecutive valid tasks', array(), null, 'boinc:application-details'),
1571 1571
     'help' => t('The number of consecutive valid tasks for this app and by this host.'),
1572 1572
     'field' => array(
1573 1573
       'handler' => 'views_handler_field_numeric',
1574
-      'click sortable' => TRUE
1574
+      'click sortable' => true
1575 1575
     ),
1576 1576
     'filter' => array(
1577 1577
       'handler' => 'views_handler_filter_numeric'
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
     'help' => t('The "et_avg" for this app and by this host.'),
1586 1586
     'field' => array(
1587 1587
       'handler' => 'views_handler_field_boincwork_host_app_et_avg',
1588
-      'click sortable' => TRUE
1588
+      'click sortable' => true
1589 1589
     ),
1590 1590
     'filter' => array(
1591 1591
       'handler' => 'views_handler_filter_numeric'
@@ -1595,11 +1595,11 @@  discard block
 block discarded – undo
1595 1595
     )
1596 1596
   );
1597 1597
   $data['host_app_version']['et_n'] = array(
1598
-    'title' => bts('Number of tasks completed', array(), NULL, 'boinc:application-details'),
1598
+    'title' => bts('Number of tasks completed', array(), null, 'boinc:application-details'),
1599 1599
     'help' => t('The tasks completed for this app and by this host.'),
1600 1600
     'field' => array(
1601 1601
       'handler' => 'views_handler_field_numeric',
1602
-      'click sortable' => TRUE
1602
+      'click sortable' => true
1603 1603
     ),
1604 1604
     'filter' => array(
1605 1605
       'handler' => 'views_handler_filter_numeric'
@@ -1609,11 +1609,11 @@  discard block
 block discarded – undo
1609 1609
     )
1610 1610
   );
1611 1611
   $data['host_app_version']['max_jobs_per_day'] = array(
1612
-    'title' => bts('Max tasks per day', array(), NULL, 'boinc:application-details'),
1612
+    'title' => bts('Max tasks per day', array(), null, 'boinc:application-details'),
1613 1613
     'help' => t('The maximum tasks per day for this app and by this host.'),
1614 1614
     'field' => array(
1615 1615
       'handler' => 'views_handler_field_numeric',
1616
-      'click sortable' => TRUE
1616
+      'click sortable' => true
1617 1617
     ),
1618 1618
     'filter' => array(
1619 1619
       'handler' => 'views_handler_filter_numeric'
@@ -1623,11 +1623,11 @@  discard block
 block discarded – undo
1623 1623
     )
1624 1624
   );
1625 1625
   $data['host_app_version']['n_jobs_today'] = array(
1626
-    'title' => bts('Number of tasks today', array(), NULL, 'boinc:application-details'),
1626
+    'title' => bts('Number of tasks today', array(), null, 'boinc:application-details'),
1627 1627
     'help' => t('The number of tasks today for this app and by this host.'),
1628 1628
     'field' => array(
1629 1629
       'handler' => 'views_handler_field_numeric',
1630
-      'click sortable' => TRUE
1630
+      'click sortable' => true
1631 1631
     ),
1632 1632
     'filter' => array(
1633 1633
       'handler' => 'views_handler_filter_numeric'
@@ -1637,12 +1637,12 @@  discard block
 block discarded – undo
1637 1637
     )
1638 1638
   );
1639 1639
   $data['host_app_version']['turnaround_avg'] = array(
1640
-    'title' => bts('Average turnaround time', array(), NULL, 'boinc:application-details:-1:ignoreoverwrite'),
1640
+    'title' => bts('Average turnaround time', array(), null, 'boinc:application-details:-1:ignoreoverwrite'),
1641 1641
     'help' => t('The average turnaround time per task for this app and by this host.'),
1642 1642
     'field' => array(
1643 1643
       'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg',
1644
-      'click sortable' => TRUE,
1645
-      'float' => TRUE,
1644
+      'click sortable' => true,
1645
+      'float' => true,
1646 1646
     ),
1647 1647
     'filter' => array(
1648 1648
       'handler' => 'views_handler_filter_numeric'
@@ -1652,11 +1652,11 @@  discard block
 block discarded – undo
1652 1652
     )
1653 1653
   );
1654 1654
   $data['host_app_version']['user_friendly_name'] = array(
1655
-    'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1655
+    'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1656 1656
     'help' => t('The user friendly name of the application.'),
1657 1657
     'field' => array(
1658 1658
       'handler' => 'views_handler_field',
1659
-      'click sortable' => TRUE
1659
+      'click sortable' => true
1660 1660
     ),
1661 1661
     'filter' => array(
1662 1662
       'handler' => 'views_handler_filter_string'
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.module 5 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -180,12 +180,12 @@
 block discarded – undo
180 180
  */
181 181
 function boincwork_locale($op = 'groups', $group = NULL) {
182 182
   switch ($op) {
183
-    case 'groups':
184
-      return array('project' => bts('Project'));
185
-    case 'info':
186
-      $info['project']['refresh callback'] = 'boincwork_locale_refresh';
187
-      $info['project']['format'] = FALSE;
188
-      return $info;
183
+  case 'groups':
184
+    return array('project' => bts('Project'));
185
+  case 'info':
186
+    $info['project']['refresh callback'] = 'boincwork_locale_refresh';
187
+    $info['project']['format'] = FALSE;
188
+    return $info;
189 189
   }
190 190
 }
191 191
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -301,8 +301,7 @@  discard block
 block discarded – undo
301 301
             }
302 302
             if (!$special) {
303 303
               $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
304
-            }
305
-            else {
304
+            } else {
306 305
               // The "very special" case where we merge two prefs
307 306
               $second_pref = $special_map[$name];
308 307
               $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
@@ -310,8 +309,7 @@  discard block
 block discarded – undo
310 309
               $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
311 310
                 " {$second_value} {$second_pref_setting['#field_suffix']} </td>";
312 311
             }
313
-          }
314
-          else  {
312
+          } else {
315 313
             $output .= '<td>---</td>';
316 314
           }
317 315
         }
@@ -836,22 +834,19 @@  discard block
 block discarded – undo
836 834
         drupal_set_message(t('Host @id has been removed from your account.',
837 835
           array('@id' => $host_id)));
838 836
         drupal_goto('account/computers');
839
-      }
840
-      else {
837
+      } else {
841 838
         drupal_set_message(t('Host @id could not be deleted. Not sure why...',
842 839
           array('@id' => $host_id)), 'error'
843 840
         );
844 841
       }
845
-    }
846
-    else {
842
+    } else {
847 843
       drupal_set_message(t('Host @id cannot be deleted because it still has
848 844
         tasks associated with it. These tasks should be processed within the
849 845
         next few days, after which the host can be deleted.', 
850 846
         array('@id' => $host_id)), 'warning'
851 847
       );
852 848
     }
853
-  }
854
-  else {
849
+  } else {
855 850
     drupal_set_message(t('You are not the owner of host @id, so you cannot
856 851
       delete it.', 
857 852
       array('@id' => $host_id)), 'error'
@@ -896,15 +891,13 @@  discard block
 block discarded – undo
896 891
         bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details')
897 892
         . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details')
898 893
       );
899
-    }
900
-    else {
894
+    } else {
901 895
       drupal_set_message(
902 896
         bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'),
903 897
         'error'
904 898
       );
905 899
     }
906
-  }
907
-  else {
900
+  } else {
908 901
     drupal_set_message(
909 902
       bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
910 903
       'warning'
@@ -996,8 +989,7 @@  discard block
 block discarded – undo
996 989
       $venue = $active_venue;
997 990
       //unset($_SESSION['prefs venue']);
998 991
     }
999
-  }
1000
-  else {
992
+  } else {
1001 993
     // Set the active venue to keep it selected between computing and project
1002 994
     // preference pages
1003 995
     $_SESSION['prefs venue'] = $venue;
Please login to merge, or discard this patch.
Indentation   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 // $Id$
3 3
 
4 4
 /**
5
-  * @file
6
-  * Enable BOINC features related to processing work and credit.
7
-  */
5
+ * @file
6
+ * Enable BOINC features related to processing work and credit.
7
+ */
8 8
 
9 9
 
10 10
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -20,52 +20,52 @@  discard block
 block discarded – undo
20 20
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
21 21
 
22 22
 /**
23
-  * Implementation of hook_menu().
24
-  */
23
+ * Implementation of hook_menu().
24
+ */
25 25
 function boincwork_menu() {
26
-  require_boinc('util');
27
-  $items['account/prefs'] = array(
26
+    require_boinc('util');
27
+    $items['account/prefs'] = array(
28 28
     'title' => 'Computing',
29 29
     'description' => '',
30 30
     'page callback' => 'generalprefs_page', 
31 31
     'access callback' => 'user_is_logged_in',
32 32
     'type' => MENU_NORMAL_ITEM
33
-  );
34
-  $items['account/prefs/computing'] = array(
33
+    );
34
+    $items['account/prefs/computing'] = array(
35 35
     'title' => 'Computing',
36 36
     'page callback' => 'generalprefs_page',
37 37
     'access callback' => 'user_is_logged_in',
38 38
     'type' => MENU_DEFAULT_LOCAL_TASK,
39 39
     'weight' => 0
40
-  );
41
-  $items['account/prefs/project'] = array(
40
+    );
41
+    $items['account/prefs/project'] = array(
42 42
     'title' => 'Project',
43 43
     'page callback' => 'projectprefs_page',
44 44
     'access callback' => 'user_is_logged_in',
45 45
     'type' => MENU_LOCAL_TASK,
46 46
     'weight' => 5
47
-  );
48
-  $items['account/prefs/community'] = array(
47
+    );
48
+    $items['account/prefs/community'] = array(
49 49
     'title' => 'Community',
50 50
     'page callback' => 'communityprefs_page',
51 51
     'access callback' => 'user_is_logged_in',
52 52
     'type' => MENU_LOCAL_TASK,
53 53
     'weight' => 10
54
-  );
55
-  $items['account/prefs/privacy'] = array(
54
+    );
55
+    $items['account/prefs/privacy'] = array(
56 56
     'title' => 'Privacy',
57 57
     'page callback' => 'privacyprefs_page',
58 58
     'access callback' => 'user_is_logged_in',
59 59
     'type' => MENU_LOCAL_TASK,
60 60
     'weight' => 15
61
-  );
62
-  $items['account/certs'] = array(
61
+    );
62
+    $items['account/certs'] = array(
63 63
     'title' =>'Account certificate',
64 64
     'page callback' => 'boincwork_certificates',
65 65
     'access arguments' => array('access content'),
66 66
     'type' => MENU_CALLBACK
67
-  );
68
-  $items['admin/boinc/prefs/general'] = array(
67
+    );
68
+    $items['admin/boinc/prefs/general'] = array(
69 69
     'title' => 'Preferences: General',
70 70
     'description' => 'Set options for BOINC preference set pages',
71 71
     'page callback' => 'drupal_get_form',
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
     'access arguments' => array('administer site configuration'),
74 74
     'type' => MENU_NORMAL_ITEM,
75 75
     'file' => 'boincwork.admin.inc'
76
-  );
77
-  $items['admin/boinc/prefs/presets'] = array(
76
+    );
77
+    $items['admin/boinc/prefs/presets'] = array(
78 78
     'title' => 'Preferences: Presets',
79 79
     'description' => 'Set values for BOINC preference set presets.',
80 80
     'page callback' => 'boincwork_admin_prefs_presets_page',
81 81
     'access arguments' => array('administer site configuration'),
82 82
     'type' => MENU_NORMAL_ITEM,
83 83
     'file' => 'boincwork.admin.inc'
84
-  );
85
-  $items['admin/boinc/prefs/upload'] = array(
84
+    );
85
+    $items['admin/boinc/prefs/upload'] = array(
86 86
     'title' => 'Preferences: Project-specific XML upload',
87 87
     'description' => 'Upload XML configuration for project specific preferences.',
88 88
     'page callback' => 'drupal_get_form',
@@ -90,142 +90,142 @@  discard block
 block discarded – undo
90 90
     'access arguments' => array('administer site configuration'),
91 91
     'type' => MENU_NORMAL_ITEM,
92 92
     'file' => 'boincwork.admin.inc'
93
-  );
94
-  $items['host/%/delete'] = array(
93
+    );
94
+    $items['host/%/delete'] = array(
95 95
     'title' => 'Delete host',
96 96
     'page callback' => 'boincwork_host_delete',
97 97
     'page arguments' => array(1),
98 98
     'access callback' => 'user_is_logged_in',
99 99
     'type' => MENU_CALLBACK,
100
-  );
101
-  $items['host/%/log'] = array(
100
+    );
101
+    $items['host/%/log'] = array(
102 102
     'title' => 'Host log',
103 103
     'page callback' => 'boincwork_host_log',
104 104
     'page arguments' => array(1),
105 105
     'access callback' => 'user_is_logged_in',
106 106
     'type' => MENU_CALLBACK,
107
-  );
108
-  $items['host/%/merge'] = array(
107
+    );
108
+    $items['host/%/merge'] = array(
109 109
     'title' => 'Merge computer',
110 110
     'page callback' => 'drupal_get_form',
111 111
     'page arguments' => array('boincwork_host_merge_form', 1),
112 112
     'access callback' => 'user_is_logged_in',
113 113
     'type' => MENU_CALLBACK,
114
-  );
115
-  $items['host/%/set-venue/%'] = array(
114
+    );
115
+    $items['host/%/set-venue/%'] = array(
116 116
     'title' => 'Set host venue',
117 117
     'page callback' => 'boincwork_host_set_venue',
118 118
     'page arguments' => array(1,3),
119 119
     'access callback' => 'user_is_logged_in',
120 120
     'type' => MENU_CALLBACK,
121
-  );
122
-  $items['user/%/mobile'] = array(
121
+    );
122
+    $items['user/%/mobile'] = array(
123 123
     'title' => 'Mobile stats',
124 124
     'page callback' => 'boincwork_mobile_stats',
125 125
     'page arguments' => array(1),
126 126
     'access callback' => 'user_is_logged_in',
127 127
     'type' => MENU_CALLBACK
128
-  );
129
-  $items['server_status.php'] = array(
128
+    );
129
+    $items['server_status.php'] = array(
130 130
     'title' => 'Server status',
131 131
     'page callback' => 'boincwork_server_status',
132 132
     'access arguments' => array('access content'),
133 133
     'type' => MENU_CALLBACK
134
-  );
135
-  $items['job_file.php'] = array(
134
+    );
135
+    $items['job_file.php'] = array(
136 136
     'title' => 'Job file input',
137 137
     'page callback' => 'boincwork_job_file',
138 138
     'access arguments' => array('access content'),
139 139
     'type' => MENU_CALLBACK
140
-  );
141
-  $items['get_output.php'] = array(
140
+    );
141
+    $items['get_output.php'] = array(
142 142
     'title' => 'Get output file',
143 143
     'page callback' => 'boincwork_get_output',
144 144
     'access arguments' => array('access content'),
145 145
     'type' => MENU_CALLBACK
146
-  );
147
-  $items['get_project_config.php'] = array(
146
+    );
147
+    $items['get_project_config.php'] = array(
148 148
     'title' => 'Project config',
149 149
     'page callback' => 'boincwork_get_project_config',
150 150
     'access arguments' => array('access content'),
151 151
     'type' => MENU_CALLBACK
152
-  );
153
-  $items['submit_rpc_handler.php'] = array(
152
+    );
153
+    $items['submit_rpc_handler.php'] = array(
154 154
     'title' => 'Remote job submission',
155 155
     'page callback' => 'boincwork_submit_rpc_handler',
156 156
     'access arguments' => array('access content'),
157 157
     'type' => MENU_CALLBACK
158
-  );
159
-  $items['userw.php'] = array(
158
+    );
159
+    $items['userw.php'] = array(
160 160
     'title' => 'User WAP',
161 161
     'page callback' => 'boincwork_user_wap',
162 162
     'access arguments' => array('access content'),
163 163
     'type' => MENU_CALLBACK
164
-  );
165
-  $items['account/tasks/%/%'] = array(
164
+    );
165
+    $items['account/tasks/%/%'] = array(
166 166
     'title' => 'Account Tasks Table',
167 167
     'description' => '',
168 168
     'page callback' => 'boincwork_account_task_table',
169 169
     'page arguments' => array(2,3),
170 170
     'access arguments' => array('access content'),
171 171
     'type' => MENU_CALLBACK,
172
-  );
173
-  $items['host/%/tasks/%/%'] = array(
172
+    );
173
+    $items['host/%/tasks/%/%'] = array(
174 174
     'title' => 'Host Tasks Table',
175 175
     'description' => '',
176 176
     'page callback' => 'boincwork_host_task_table',
177 177
     'page arguments' => array(1,3,4),
178 178
     'access arguments' => array('access content'),
179 179
     'type' => MENU_CALLBACK,
180
-  );
181
-  // Workunit task table disabled
182
-  //$items['workunit/%/tasks/%/%'] = array(
183
-  //  'title' => 'Workunit Tasks Table',
184
-  //  'description' => '',
185
-  //  'page callback' => 'boincwork_workunit_task_table',
186
-  //  'page arguments' => array(1,3,4),
187
-  //  'access arguments' => array('access content'),
188
-  //  'type' => MENU_CALLBACK,
189
-  //);
190
-  return $items;
180
+    );
181
+    // Workunit task table disabled
182
+    //$items['workunit/%/tasks/%/%'] = array(
183
+    //  'title' => 'Workunit Tasks Table',
184
+    //  'description' => '',
185
+    //  'page callback' => 'boincwork_workunit_task_table',
186
+    //  'page arguments' => array(1,3,4),
187
+    //  'access arguments' => array('access content'),
188
+    //  'type' => MENU_CALLBACK,
189
+    //);
190
+    return $items;
191 191
 }
192 192
 
193 193
 /**
194 194
 * Implementation of hook_views_api().
195 195
 */
196 196
 function boincwork_views_api() {
197
-  return array(
197
+    return array(
198 198
     'api' => 2.0,
199 199
     'path' => drupal_get_path('module', 'boincwork')
200
-  );
200
+    );
201 201
 }
202 202
 
203 203
 /**
204 204
  * Implementation of hook_locale().
205 205
  */
206 206
 function boincwork_locale($op = 'groups', $group = NULL) {
207
-  switch ($op) {
207
+    switch ($op) {
208 208
     case 'groups':
209 209
       return array('project' => bts('Project'));
210 210
     case 'info':
211 211
       $info['project']['refresh callback'] = 'boincwork_locale_refresh';
212
-      $info['project']['format'] = FALSE;
213
-      return $info;
214
-  }
212
+        $info['project']['format'] = FALSE;
213
+        return $info;
214
+    }
215 215
 }
216 216
 
217 217
 /**
218 218
  * Refresh strings.
219 219
  */
220 220
 function boincwork_locale_refresh() {
221
-  // Mimic process of adding project specific prefs to the project preferences
222
-  // form -- this parses the prefs XML and calls i18nstrings_update()
223
-  $form = array();
224
-  $prefs = array(
221
+    // Mimic process of adding project specific prefs to the project preferences
222
+    // form -- this parses the prefs XML and calls i18nstrings_update()
223
+    $form = array();
224
+    $prefs = array(
225 225
     'project_specific' => array(),
226
-  );
227
-  boincwork_add_project_specific_prefs($form, $prefs);
228
-  return TRUE; // Meaning it completed with no issues
226
+    );
227
+    boincwork_add_project_specific_prefs($form, $prefs);
228
+    return TRUE; // Meaning it completed with no issues
229 229
 }
230 230
 
231 231
 
@@ -234,41 +234,41 @@  discard block
 block discarded – undo
234 234
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
235 235
  
236 236
 /**
237
-  * General preferences menu callback.
238
-  * Called when user goes to edit preferences page
239
-  */
237
+ * General preferences menu callback.
238
+ * Called when user goes to edit preferences page
239
+ */
240 240
 function generalprefs_page($action = null, $venue = null, $advanced = FALSE) {
241 241
   
242
-  // Keep the venue selected across preference pages
243
-  boincwork_select_venue($venue);
242
+    // Keep the venue selected across preference pages
243
+    boincwork_select_venue($venue);
244 244
   
245
-  $pref_sets = array('generic', 'home', 'school', 'work');
246
-  $output = null;
247
-  // Set the page title
248
-  $title = 'Computing';
249
-  drupal_set_title($title);
245
+    $pref_sets = array('generic', 'home', 'school', 'work');
246
+    $output = null;
247
+    // Set the page title
248
+    $title = 'Computing';
249
+    drupal_set_title($title);
250 250
   
251
-  switch ($action) {
251
+    switch ($action) {
252 252
   
253
-  case 'clear':
253
+    case 'clear':
254 254
     // Remove settings from this preference set
255 255
     if ($venue AND $venue != 'generic') {
256
-      boincwork_save_prefs(NULL, 'general', $venue);
257
-      drupal_set_message(t('Settings for the "@name" preference set have been
256
+        boincwork_save_prefs(NULL, 'general', $venue);
257
+        drupal_set_message(t('Settings for the "@name" preference set have been
258 258
         cleared', array('@name' => ucfirst($venue))));
259
-      // Set the generic preference set as active
260
-      $_SESSION['prefs venue'] = 'generic';
259
+        // Set the generic preference set as active
260
+        $_SESSION['prefs venue'] = 'generic';
261 261
     }
262 262
     drupal_goto();
263 263
     break;
264 264
     
265
-  case 'combined':
265
+    case 'combined':
266 266
     // Compare preference sets; tabular view
267 267
     
268 268
     foreach ($pref_sets as $pref_set) {
269
-      $form_state = array();
270
-      $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set);
271
-      drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
269
+        $form_state = array();
270
+        $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set);
271
+        drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
272 272
     }
273 273
 
274 274
     $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>';
@@ -281,29 +281,29 @@  discard block
 block discarded – undo
281 281
     $prefs_table = boincwork_make_prefs_table($prefs['generic']['prefs']['advanced']);
282 282
     
283 283
     foreach ($prefs_table as $category => $section) {
284
-      $output .= '<tr class="section-heading">';
285
-      $output .= "<td>{$section['name']}</td>";
286
-      foreach ($pref_sets as $pref_set) {
284
+        $output .= '<tr class="section-heading">';
285
+        $output .= "<td>{$section['name']}</td>";
286
+        foreach ($pref_sets as $pref_set) {
287 287
         $output .= '<td>' . $pref_set . '</td>';
288
-      }
289
-      $output .= '</tr>';
290
-      foreach ($section['elements'] as $name => $setting) {
288
+        }
289
+        $output .= '</tr>';
290
+        foreach ($section['elements'] as $name => $setting) {
291 291
         // Output the setting name and description, with an ugly exception
292 292
         // made for preferences with special formatting
293 293
         $special_map = array(
294
-          'start_hour' => 'end_hour',
295
-          'net_start_hour'=> 'net_end_hour',
296
-          'daily_xfer_limit_mb' => 'daily_xfer_period_days',
294
+            'start_hour' => 'end_hour',
295
+            'net_start_hour'=> 'net_end_hour',
296
+            'daily_xfer_limit_mb' => 'daily_xfer_period_days',
297 297
         );
298 298
         $special_delimiter = array(
299
-          'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'),
300
-          'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'),
301
-          'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'),
299
+            'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'),
300
+            'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'),
301
+            'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'),
302 302
         );
303 303
         $special = isset($special_map[$name]);
304 304
         $very_special = in_array($name, $special_map);
305 305
         if ($very_special) {
306
-          continue;
306
+            continue;
307 307
         }
308 308
         $output .= '<tr>';
309 309
         $output .= '<td>';
@@ -313,35 +313,35 @@  discard block
 block discarded – undo
313 313
         // Output values for each preference set, again with ugly hacks for
314 314
         // time range preferences
315 315
         foreach ($pref_sets as $pref_set) {
316
-          if (($prefs[$pref_set]) AND 
316
+            if (($prefs[$pref_set]) AND 
317 317
               $prefs[$pref_set]['#established'] AND
318 318
               isset($prefs[$pref_set]['prefs']['advanced'][$category])) {
319 319
             $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name];
320 320
             $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value'];
321 321
             if ($value == '') {
322
-              $value = '---';
322
+                $value = '---';
323 323
             }
324 324
             if (!isset($pref_setting['#field_suffix'])) {
325
-              $pref_setting['#field_suffix'] = '';
325
+                $pref_setting['#field_suffix'] = '';
326 326
             }
327 327
             if (!$special) {
328
-              $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
328
+                $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
329 329
             }
330 330
             else {
331
-              // The "very special" case where we merge two prefs
332
-              $second_pref = $special_map[$name];
333
-              $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
334
-              $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value'];
335
-              $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
331
+                // The "very special" case where we merge two prefs
332
+                $second_pref = $special_map[$name];
333
+                $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
334
+                $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value'];
335
+                $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
336 336
                 " {$second_value} {$second_pref_setting['#field_suffix']} </td>";
337 337
             }
338
-          }
339
-          else  {
338
+            }
339
+            else  {
340 340
             $output .= '<td>---</td>';
341
-          }
341
+            }
342 342
         }
343 343
         $output .= '</tr>';
344
-      }
344
+        }
345 345
     }
346 346
     
347 347
     // Empty line above action links... :/
@@ -357,24 +357,24 @@  discard block
 block discarded – undo
357 357
     $output .= '<tr>';
358 358
     $output .= '<td></td>';
359 359
     foreach ($pref_sets as $pref_set) {
360
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
361
-      $output .= '<td><ul class="tab-list"><li class="first tab">';
362
-      $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1",
360
+        $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
361
+        $output .= '<td><ul class="tab-list"><li class="first tab">';
362
+        $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1",
363 363
         array('fragment' => "")
364
-      );
365
-      // Show Clear links for established preference sets
366
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
364
+        );
365
+        // Show Clear links for established preference sets
366
+        if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
367 367
         $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
368
-          array(
368
+            array(
369 369
             'query' => drupal_get_destination(),
370 370
             'attributes' => array(
371
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
371
+                'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
372 372
                 array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')'
373 373
             )
374
-          )
374
+            )
375 375
         );
376
-      }
377
-      $output .= '</li></ul></td>';
376
+        }
377
+        $output .= '</li></ul></td>';
378 378
     }
379 379
     $output .= '</tr>';
380 380
     
@@ -382,28 +382,28 @@  discard block
 block discarded – undo
382 382
     
383 383
     break;
384 384
     
385
-  case 'edit':
385
+    case 'edit':
386 386
   default:
387 387
   
388 388
     // Return the HTML generated from the $form data structure.
389 389
     if (function_exists('jump_quickly')) {
390
-      $path = 'account/prefs/computing/edit';
391
-      $venues = array(
390
+        $path = 'account/prefs/computing/edit';
391
+        $venues = array(
392 392
         "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
393 393
         "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
394 394
         "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
395 395
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
396
-      );
397
-      variable_set('jump_use_js_venues-Array', 1);
398
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
399
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
396
+        );
397
+        variable_set('jump_use_js_venues-Array', 1);
398
+        drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
399
+        drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
400 400
       
401
-      $output .= '<div id="venue-selector" class="simple-form-controls">';
402
-      $output .= '  <div class="form-item venue">';
403
-      $output .= '    <label>Preference set:</label>';
404
-      $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
405
-      $output .= '  </div>';
406
-      $output .= '</div>';
401
+        $output .= '<div id="venue-selector" class="simple-form-controls">';
402
+        $output .= '  <div class="form-item venue">';
403
+        $output .= '    <label>Preference set:</label>';
404
+        $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
405
+        $output .= '  </div>';
406
+        $output .= '</div>';
407 407
     }
408 408
     $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced);
409 409
     
@@ -414,54 +414,54 @@  discard block
 block discarded – undo
414 414
     drupal_prepare_form('boincwork_generalprefs_form', $current_set, $form_state);
415 415
 
416 416
     if (!$current_set['#established']) {
417
-      drupal_set_message(bts(
418
-          "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
419
-          array( '@venue' => $venue, ),
420
-          NULL, 'boinc:account-preferences'), 'status');
417
+        drupal_set_message(bts(
418
+            "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
419
+            array( '@venue' => $venue, ),
420
+            NULL, 'boinc:account-preferences'), 'status');
421 421
     }
422 422
     
423 423
     break;
424
-  }
424
+    }
425 425
   
426
-  return $output;
426
+    return $output;
427 427
 }
428 428
 
429 429
 /**
430
-  * Project preferences menu callback
431
-  * Called when user goes to edit project preferences page.
432
-  */
430
+ * Project preferences menu callback
431
+ * Called when user goes to edit project preferences page.
432
+ */
433 433
 function projectprefs_page($action = null, $venue = null) {
434 434
   
435
-  // Keep the venue selected across preference pages
436
-  boincwork_select_venue($venue);
435
+    // Keep the venue selected across preference pages
436
+    boincwork_select_venue($venue);
437 437
   
438
-  require_boinc(array('util', 'prefs'));
439
-  global $project_has_beta;
440
-  $pref_sets = array('generic', 'home', 'school', 'work');
441
-  $output = null;
438
+    require_boinc(array('util', 'prefs'));
439
+    global $project_has_beta;
440
+    $pref_sets = array('generic', 'home', 'school', 'work');
441
+    $output = null;
442 442
   
443
-  $title = 'Project';
444
-  drupal_set_title($title);
443
+    $title = 'Project';
444
+    drupal_set_title($title);
445 445
   
446
-  switch ($action) {
446
+    switch ($action) {
447 447
   
448
-  case 'clear':
448
+    case 'clear':
449 449
     // Remove settings from this preference set
450 450
     if ($venue AND $venue != 'generic') {
451
-      boincwork_save_prefs(NULL, 'project', $venue);
452
-      drupal_set_message(t('Settings for the "@name" preference set have been
451
+        boincwork_save_prefs(NULL, 'project', $venue);
452
+        drupal_set_message(t('Settings for the "@name" preference set have been
453 453
         cleared', array('@name' => ucfirst($venue))));
454 454
       
455
-      // Set the generic preference set as active
456
-      $_SESSION['prefs venue'] = 'generic';
455
+        // Set the generic preference set as active
456
+        $_SESSION['prefs venue'] = 'generic';
457 457
       
458
-      // If the user has removed their default preference set, make it generic
459
-      boincwork_set_default_venue();
458
+        // If the user has removed their default preference set, make it generic
459
+        boincwork_set_default_venue();
460 460
     }
461 461
     drupal_goto();
462 462
     break;
463 463
     
464
-  case 'combined':
464
+    case 'combined':
465 465
   
466 466
     // Compare preference sets; tabular view
467 467
     
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
     $boincuser = BoincUser::lookup_id($account->boincuser_id);
471 471
     
472 472
     foreach ($pref_sets as $pref_set) {
473
-      $form_state = array();
474
-      $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set);
475
-      drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
473
+        $form_state = array();
474
+        $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set);
475
+        drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
476 476
     }
477 477
     
478 478
     $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>';
@@ -482,20 +482,20 @@  discard block
 block discarded – undo
482 482
     $prefs_table = boincwork_make_prefs_table($prefs['generic']);
483 483
     
484 484
     foreach ($prefs_table as $category => $section) {
485
-      $output .= '<tr class="section-heading">';
486
-      $output .= "<td>{$section['name']}</td>";
487
-      foreach ($pref_sets as $pref_set) {
485
+        $output .= '<tr class="section-heading">';
486
+        $output .= "<td>{$section['name']}</td>";
487
+        foreach ($pref_sets as $pref_set) {
488 488
         $output .= '<td>' . $pref_set . '</td>';
489
-      }
490
-      $output .= '</tr>';
491
-      foreach ($section['elements'] as $name => $setting) {
489
+        }
490
+        $output .= '</tr>';
491
+        foreach ($section['elements'] as $name => $setting) {
492 492
         $output .= '<tr>';
493 493
         $output .= '<td>';
494 494
         $output .= "<div class=\"title\">{$setting['name']}</div>";
495 495
         $output .= "<div class=\"description\">{$setting['description']}</div>";
496 496
         $output .= '</td>';
497 497
         foreach ($pref_sets as $pref_set) {
498
-          if (($prefs[$pref_set]) AND
498
+            if (($prefs[$pref_set]) AND
499 499
               $prefs[$pref_set]['#established'] AND
500 500
               isset($prefs[$pref_set][$category])) {
501 501
             $pref_setting = $prefs[$pref_set][$category][$name];
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
             if ($value == '') $value = '---';
504 504
             if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = '';
505 505
             $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
506
-          } else $output .= '<td>---</td>';
506
+            } else $output .= '<td>---</td>';
507 507
         }
508 508
         $output .= '</tr>';
509
-      }
509
+        }
510 510
     }
511 511
     
512 512
     // Empty line above action links... :/
@@ -522,29 +522,29 @@  discard block
 block discarded – undo
522 522
     $output .= '<tr>';
523 523
     $output .= '<td></td>';
524 524
     foreach ($pref_sets as $pref_set) {
525
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
526
-      $output .= '<td><ul class="tab-list"><li class="first tab">';
527
-      $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
528
-      // Show Clear links for established preference sets
529
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
525
+        $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
526
+        $output .= '<td><ul class="tab-list"><li class="first tab">';
527
+        $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
528
+        // Show Clear links for established preference sets
529
+        if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
530 530
         $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
531
-          array(
531
+            array(
532 532
             'query' => drupal_get_destination(),
533 533
             'attributes' => array(
534
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
534
+                'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
535 535
                 array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')'
536 536
             )
537
-          )
537
+            )
538 538
         );
539
-      }
540
-      $output .= '</li></ul></td>';
539
+        }
540
+        $output .= '</li></ul></td>';
541 541
     }
542 542
     
543 543
     $output .= '</table>';
544 544
     
545 545
     break;
546 546
     
547
-  case 'set-default':
547
+    case 'set-default':
548 548
     // Set this preference set as the one to use for any new hosts attached
549 549
     // to the user account
550 550
     boincwork_set_default_venue($venue);
@@ -552,30 +552,30 @@  discard block
 block discarded – undo
552 552
     drupal_goto('account/prefs/project/combined');
553 553
     break;
554 554
     
555
-  case 'edit':
555
+    case 'edit':
556 556
   default:
557 557
     
558 558
     // Return the HTML generated from the $form data structure.
559 559
     require_boinc('util');
560 560
     
561 561
     if (function_exists('jump_quickly')) {
562
-      $path = 'account/prefs/project/edit';
563
-      $venues = array(
562
+        $path = 'account/prefs/project/edit';
563
+        $venues = array(
564 564
         "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
565 565
         "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
566 566
         "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
567 567
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
568
-      );
569
-      variable_set('jump_use_js_venues-Array', 1);
570
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
571
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
568
+        );
569
+        variable_set('jump_use_js_venues-Array', 1);
570
+        drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
571
+        drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
572 572
       
573
-      $output .= '<div id="venue-selector" class="simple-form-controls">';
574
-      $output .= '  <div class="form-item venue">';
575
-      $output .= '    <label>Preference set:</label>';
576
-      $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
577
-      $output .= '  </div>';
578
-      $output .= '</div>';
573
+        $output .= '<div id="venue-selector" class="simple-form-controls">';
574
+        $output .= '  <div class="form-item venue">';
575
+        $output .= '    <label>Preference set:</label>';
576
+        $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
577
+        $output .= '  </div>';
578
+        $output .= '</div>';
579 579
     }
580 580
     $output .= drupal_get_form('boincwork_projectprefs_form', $venue);
581 581
     
@@ -586,63 +586,63 @@  discard block
 block discarded – undo
586 586
     drupal_prepare_form('boincwork_projectprefs_form', $current_set, $form_state);
587 587
     
588 588
     if (!$current_set['#established']) {
589
-      drupal_set_message(bts(
590
-          "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
591
-          array( '@venue' => $venue, ),
592
-          NULL, 'boinc:account-preferences'), 'status');
589
+        drupal_set_message(bts(
590
+            "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
591
+            array( '@venue' => $venue, ),
592
+            NULL, 'boinc:account-preferences'), 'status');
593 593
     }
594 594
     
595 595
     break;
596 596
     
597
-  }
598
-  return $output;
597
+    }
598
+    return $output;
599 599
 }
600 600
 
601 601
 /**
602
-  * Community preferences menu callback
603
-  * Called when user goes to edit community preferences page.
604
-  */
602
+ * Community preferences menu callback
603
+ * Called when user goes to edit community preferences page.
604
+ */
605 605
 function communityprefs_page($action = null) {
606 606
   
607
-  require_boinc(array('util', 'prefs'));
608
-  $output = null;
607
+    require_boinc(array('util', 'prefs'));
608
+    $output = null;
609 609
   
610
-  $title = 'Community';
611
-  drupal_set_title($title);
610
+    $title = 'Community';
611
+    drupal_set_title($title);
612 612
   
613
-  //$output .= '<h2>Community preferences</h2>';
613
+    //$output .= '<h2>Community preferences</h2>';
614 614
   
615
-  $output .= drupal_get_form('communityprefs_form');
615
+    $output .= drupal_get_form('communityprefs_form');
616 616
   
617
-  return $output;
617
+    return $output;
618 618
 }
619 619
 
620 620
 /**
621
-  * Privacy preferences menu callback
622
-  * Called when user goes to edit privacy preferences page.
623
-  */
621
+ * Privacy preferences menu callback
622
+ * Called when user goes to edit privacy preferences page.
623
+ */
624 624
 function privacyprefs_page($action = null) {
625 625
   
626
-  require_boinc(array('util', 'prefs'));
627
-  $output = null;
628
-  $title = 'Privacy';
629
-  drupal_set_title($title);
626
+    require_boinc(array('util', 'prefs'));
627
+    $output = null;
628
+    $title = 'Privacy';
629
+    drupal_set_title($title);
630 630
   
631
-  switch ($action) {
632
-  case 'view':
631
+    switch ($action) {
632
+    case 'view':
633 633
     $form_state = array();
634 634
     $prefs = drupal_retrieve_form('boincwork_privacyprefs_form', $form_state);
635 635
     drupal_prepare_form('boincwork_privacyprefs_form', $prefs, $form_state);
636 636
     $output .= '<table>';
637 637
     
638 638
     $sections = array(
639
-      'privacy' => $prefs['privacy']
639
+        'privacy' => $prefs['privacy']
640 640
     );
641 641
     
642 642
     foreach ($sections as $section) {
643
-      $output .= '<tr class="section-heading">';
644
-      $output .= "<td>{$section['#title']}</td></tr>";
645
-      foreach ($section as $name => $setting) {
643
+        $output .= '<tr class="section-heading">';
644
+        $output .= "<td>{$section['#title']}</td></tr>";
645
+        foreach ($section as $name => $setting) {
646 646
         if ($name{0} == '#') continue;
647 647
         $value = isset($setting['#default_value']) ? $setting['#default_value'] : '';
648 648
         if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value];
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>";
655 655
         $output .= "<td>{$value} {$setting['#field_suffix']}</td>";
656 656
         $output .= '</tr>';
657
-      }
657
+        }
658 658
     }
659 659
     
660 660
     // Edit preferences link
@@ -667,33 +667,33 @@  discard block
 block discarded – undo
667 667
     
668 668
     break;
669 669
     
670
-  case 'edit':
670
+    case 'edit':
671 671
   default:
672 672
     require_boinc('util');
673 673
     // Return the HTML generated from the $form data structure.
674 674
     $output .= drupal_get_form('boincwork_privacyprefs_form');
675 675
     break;
676 676
     
677
-  }
677
+    }
678 678
   
679
-  return $output;
679
+    return $output;
680 680
 }
681 681
 
682 682
 /**
683
-  * Certificates menu callback
684
-  * Called when user goes to account certificate pages
685
-  */
683
+ * Certificates menu callback
684
+ * Called when user goes to account certificate pages
685
+ */
686 686
 function boincwork_certificates($type = null, $border = null) {
687
-  global $user;
688
-  $drupuser = user_load($user->uid);
689
-  // Load BOINC account and pre-authenticate with BOINC code
690
-  require_boinc(array('util', 'cert'));
691
-  $boincuser = BoincUser::lookup_id($drupuser->boincuser_id);
692
-  //global $g_logged_in_user;
693
-  //$g_logged_in_user = $boincuser;
694
-  //print_r($boincuser); exit;
695
-  switch ($type) {
696
-  case 'all':
687
+    global $user;
688
+    $drupuser = user_load($user->uid);
689
+    // Load BOINC account and pre-authenticate with BOINC code
690
+    require_boinc(array('util', 'cert'));
691
+    $boincuser = BoincUser::lookup_id($drupuser->boincuser_id);
692
+    //global $g_logged_in_user;
693
+    //$g_logged_in_user = $boincuser;
694
+    //print_r($boincuser); exit;
695
+    switch ($type) {
696
+    case 'all':
697 697
     //include_boinc('user/cert_all.php');
698 698
     require_boinc(array('util','cert','user'));
699 699
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
     ";
764 764
     break;
765 765
     
766
-  case 'account':
766
+    case 'account':
767 767
   default:
768 768
     //include_boinc('user/cert1.php');
769 769
     require_boinc(array('util','cert'));
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
     echo "
840 840
     </td><tr></table>
841 841
     ";
842
-  }
842
+    }
843 843
 }
844 844
 
845 845
 /**
@@ -847,42 +847,42 @@  discard block
 block discarded – undo
847 847
  * Called when user selects to delete a host
848 848
  */
849 849
 function boincwork_host_delete($host_id) {
850
-  // Verify that host has no tasks
851
-  if (boincwork_host_user_is_owner($host_id)) {
850
+    // Verify that host has no tasks
851
+    if (boincwork_host_user_is_owner($host_id)) {
852 852
     if (!boincwork_host_get_task_count($host_id)) {
853
-      // Delete the host record
854
-      db_set_active('boinc');
855
-      $host_deleted = db_query(
853
+        // Delete the host record
854
+        db_set_active('boinc');
855
+        $host_deleted = db_query(
856 856
         "DELETE FROM {host} WHERE id = '%d'",
857 857
         $host_id
858
-      );
859
-      db_set_active('default');
860
-      if ($host_deleted) {
858
+        );
859
+        db_set_active('default');
860
+        if ($host_deleted) {
861 861
         drupal_set_message(t('Host @id has been removed from your account.',
862
-          array('@id' => $host_id)));
862
+            array('@id' => $host_id)));
863 863
         drupal_goto('account/computers');
864
-      }
865
-      else {
864
+        }
865
+        else {
866 866
         drupal_set_message(t('Host @id could not be deleted. Not sure why...',
867
-          array('@id' => $host_id)), 'error'
867
+            array('@id' => $host_id)), 'error'
868 868
         );
869
-      }
869
+        }
870 870
     }
871 871
     else {
872
-      drupal_set_message(t('Host @id cannot be deleted because it still has
872
+        drupal_set_message(t('Host @id cannot be deleted because it still has
873 873
         tasks associated with it. These tasks should be processed within the
874 874
         next few days, after which the host can be deleted.', 
875 875
         array('@id' => $host_id)), 'warning'
876
-      );
876
+        );
877
+    }
877 878
     }
878
-  }
879
-  else {
879
+    else {
880 880
     drupal_set_message(t('You are not the owner of host @id, so you cannot
881 881
       delete it.', 
882
-      array('@id' => $host_id)), 'error'
882
+        array('@id' => $host_id)), 'error'
883 883
     );
884
-  }
885
-  drupal_goto("host/{$host_id}");
884
+    }
885
+    drupal_goto("host/{$host_id}");
886 886
 }
887 887
 
888 888
 /**
@@ -890,55 +890,55 @@  discard block
 block discarded – undo
890 890
  * Called when user accesses the log for a host
891 891
  */
892 892
 function boincwork_host_log($host_id = null) {
893
-  $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
894
-  $log = '';
895
-  if ($root_log_dir AND $host_id) {
893
+    $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
894
+    $log = '';
895
+    if ($root_log_dir AND $host_id) {
896 896
     $subdir = substr($host_id, 0, -3) OR $subdir = 0;
897 897
     $log = implode('/', array($root_log_dir, $subdir, $host_id));
898
-  }
899
-  if ($log AND file_exists($log)) {
898
+    }
899
+    if ($log AND file_exists($log)) {
900 900
     header('Content-type: text/plain');
901 901
     include($log);
902
-  }
902
+    }
903 903
 }
904 904
 
905 905
 function boincwork_host_set_venue($host_id = NULL, $venue = NULL) {
906
-  global $user;
907
-  $account = user_load($user->uid);
908
-  db_set_active('boinc');
909
-  // Verify that this is my host
910
-  $host_owner = db_result(db_query(
906
+    global $user;
907
+    $account = user_load($user->uid);
908
+    db_set_active('boinc');
909
+    // Verify that this is my host
910
+    $host_owner = db_result(db_query(
911 911
     "SELECT userid FROM {host} WHERE id = '%d'",
912 912
     $host_id
913
-  ));
914
-  db_set_active('default');
915
-  if ($host_owner AND $host_owner == $account->boincuser_id) {
913
+    ));
914
+    db_set_active('default');
915
+    if ($host_owner AND $host_owner == $account->boincuser_id) {
916 916
     db_set_active('boinc');
917 917
     $updated = db_query(
918
-      "UPDATE {host} SET venue = '%s' WHERE id = '%d'",
919
-      $venue, $host_id
918
+        "UPDATE {host} SET venue = '%s' WHERE id = '%d'",
919
+        $venue, $host_id
920 920
     );
921 921
     db_set_active('default');
922 922
     if ($updated) {
923
-      drupal_set_message(
923
+        drupal_set_message(
924 924
         bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details')
925 925
         . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details')
926
-      );
926
+        );
927 927
     }
928 928
     else {
929
-      drupal_set_message(
929
+        drupal_set_message(
930 930
         bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'),
931 931
         'error'
932
-      );
932
+        );
933 933
     }
934
-  }
935
-  else {
934
+    }
935
+    else {
936 936
     drupal_set_message(
937
-      bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
938
-      'warning'
937
+        bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
938
+        'warning'
939 939
     );
940
-  }
941
-  drupal_goto("host/{$host_id}");
940
+    }
941
+    drupal_goto("host/{$host_id}");
942 942
 }
943 943
 
944 944
 /**
@@ -946,8 +946,8 @@  discard block
 block discarded – undo
946 946
  * Called when user accesses cell phone stats
947 947
  */
948 948
 function boincwork_mobile_stats($userid = null) {
949
-  $_GET['id'] = $userid;
950
-  include_boinc('user/userw.php');
949
+    $_GET['id'] = $userid;
950
+    include_boinc('user/userw.php');
951 951
 }
952 952
 
953 953
 /**
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
  * Called to build the server status page
956 956
  */
957 957
 function boincwork_server_status() {
958
-  include_boinc('user/server_status.php');
958
+    include_boinc('user/server_status.php');
959 959
 }
960 960
 
961 961
 /**
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
  * RPC for managing job input files
964 964
  */
965 965
 function boincwork_job_file() {
966
-  include_boinc('user/job_file.php');
966
+    include_boinc('user/job_file.php');
967 967
 }
968 968
 
969 969
 /**
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
  * Get output file from remote job submission
972 972
  */
973 973
 function boincwork_get_output() {
974
-  include_boinc('user/get_output.php');
974
+    include_boinc('user/get_output.php');
975 975
 }
976 976
 
977 977
 /**
@@ -979,23 +979,23 @@  discard block
 block discarded – undo
979 979
  * Get the project configuration XML; used by client software
980 980
  */
981 981
 function boincwork_get_project_config() {
982
-  include_boinc('user/get_project_config.php');
982
+    include_boinc('user/get_project_config.php');
983 983
 }
984 984
 
985 985
 /**
986 986
  * Page callback for the remote job submission RPC (submit_rpc_handler.php).
987 987
  */
988 988
 function boincwork_submit_rpc_handler() {
989
-  include_boinc('user/submit_rpc_handler.php');
989
+    include_boinc('user/submit_rpc_handler.php');
990 990
 }
991 991
 
992 992
 /**
993 993
  * Page callback for user WAP (userw.php).
994 994
  */
995 995
 function boincwork_user_wap() {
996
-  // Remove q from the GET request or BOINC will panic
997
-  unset($_GET['q']);
998
-  include_boinc('user/userw.php');
996
+    // Remove q from the GET request or BOINC will panic
997
+    unset($_GET['q']);
998
+    include_boinc('user/userw.php');
999 999
 }
1000 1000
 
1001 1001
 
@@ -1003,44 +1003,44 @@  discard block
 block discarded – undo
1003 1003
  * Page callback for user account task table
1004 1004
  */
1005 1005
 function boincwork_account_task_table($tselect = NULL, $app_id = NULL) {
1006
-  $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table');
1007
-  drupal_set_title($title);
1006
+    $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table');
1007
+    drupal_set_title($title);
1008 1008
 
1009
-  global $user;
1010
-  $account = user_load($user->uid);
1011
-  return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id);
1009
+    global $user;
1010
+    $account = user_load($user->uid);
1011
+    return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id);
1012 1012
 }
1013 1013
 
1014 1014
 /**
1015 1015
  * Page callback for host task table
1016 1016
  */
1017 1017
 function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) {
1018
-  require_boinc( array('util', 'result') );
1018
+    require_boinc( array('util', 'result') );
1019 1019
 
1020
-  $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1021
-  drupal_set_title($title);
1020
+    $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1021
+    drupal_set_title($title);
1022 1022
 
1023
-  if (is_null($host_id)) {
1023
+    if (is_null($host_id)) {
1024 1024
     drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error');
1025 1025
     return '';
1026
-  }
1026
+    }
1027 1027
 
1028
-  return boincwork_tasktable(2, $host_id, $tselect, $app_id);
1028
+    return boincwork_tasktable(2, $host_id, $tselect, $app_id);
1029 1029
 }
1030 1030
 
1031 1031
 /**
1032 1032
  * Page callback for workunit task table
1033 1033
  */
1034 1034
 function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) {
1035
-  $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table');
1036
-  drupal_set_title($title);
1035
+    $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table');
1036
+    drupal_set_title($title);
1037 1037
 
1038
-  if (is_null($workunit_id)) {
1038
+    if (is_null($workunit_id)) {
1039 1039
     drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error');
1040 1040
     return '';
1041
-  }
1041
+    }
1042 1042
   
1043
-  return boincwork_tasktable(1, $workunit_id, $tselect, $app_id);
1043
+    return boincwork_tasktable(1, $workunit_id, $tselect, $app_id);
1044 1044
 }
1045 1045
 
1046 1046
 /**
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
  * Take a node ID and render that node as a page
1049 1049
  */
1050 1050
 function boincwork_view_page($nid) {
1051
-  $node = node_load($nid);
1052
-  return node_page_view($node);
1051
+    $node = node_load($nid);
1052
+    return node_page_view($node);
1053 1053
 }
1054 1054
 
1055 1055
 
@@ -1061,16 +1061,16 @@  discard block
 block discarded – undo
1061 1061
  * Determine which venue should be selected
1062 1062
  */
1063 1063
 function boincwork_select_venue(&$venue) {
1064
-  if (!$venue) {
1064
+    if (!$venue) {
1065 1065
     $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL;
1066 1066
     if ($active_venue) {
1067
-      $venue = $active_venue;
1068
-      //unset($_SESSION['prefs venue']);
1067
+        $venue = $active_venue;
1068
+        //unset($_SESSION['prefs venue']);
1069
+    }
1069 1070
     }
1070
-  }
1071
-  else {
1071
+    else {
1072 1072
     // Set the active venue to keep it selected between computing and project
1073 1073
     // preference pages
1074 1074
     $_SESSION['prefs venue'] = $venue;
1075
-  }
1075
+    }
1076 1076
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
   $items['host/%/set-venue/%'] = array(
116 116
     'title' => 'Set host venue',
117 117
     'page callback' => 'boincwork_host_set_venue',
118
-    'page arguments' => array(1,3),
118
+    'page arguments' => array(1, 3),
119 119
     'access callback' => 'user_is_logged_in',
120 120
     'type' => MENU_CALLBACK,
121 121
   );
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     'title' => 'Account Tasks Table',
167 167
     'description' => '',
168 168
     'page callback' => 'boincwork_account_task_table',
169
-    'page arguments' => array(2,3),
169
+    'page arguments' => array(2, 3),
170 170
     'access arguments' => array('access content'),
171 171
     'type' => MENU_CALLBACK,
172 172
   );
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     'title' => 'Host Tasks Table',
175 175
     'description' => '',
176 176
     'page callback' => 'boincwork_host_task_table',
177
-    'page arguments' => array(1,3,4),
177
+    'page arguments' => array(1, 3, 4),
178 178
     'access arguments' => array('access content'),
179 179
     'type' => MENU_CALLBACK,
180 180
   );
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
       drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
272 272
     }
273 273
 
274
-    $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>';
275
-    $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing') . '</p>';
276
-    $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences-computing') . '</p>';
277
-    $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>';
274
+    $output .= '<p>'.bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing').'<br/>';
275
+    $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing').'</p>';
276
+    $output .= '<p>'.bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences-computing').'</p>';
277
+    $output .= '<h2>'.bts('Combined preferences', array(), NULL, 'boinc:account-preferences').' '.l('('.bts('Switch View', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/computing').'</h2>';
278 278
     
279 279
     $output .= '<table class="preferences combined">';
280 280
     
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
       $output .= '<tr class="section-heading">';
285 285
       $output .= "<td>{$section['name']}</td>";
286 286
       foreach ($pref_sets as $pref_set) {
287
-        $output .= '<td>' . $pref_set . '</td>';
287
+        $output .= '<td>'.$pref_set.'</td>';
288 288
       }
289 289
       $output .= '</tr>';
290 290
       foreach ($section['elements'] as $name => $setting) {
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
               $second_pref = $special_map[$name];
333 333
               $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
334 334
               $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value'];
335
-              $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
335
+              $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}".
336 336
                 " {$second_value} {$second_pref_setting['#field_suffix']} </td>";
337 337
             }
338 338
           }
339
-          else  {
339
+          else {
340 340
             $output .= '<td>---</td>';
341 341
           }
342 342
         }
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
       );
365 365
       // Show Clear links for established preference sets
366 366
       if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
367
-        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
367
+        $output .= ' </li><li class="tab"> '.l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
368 368
           array(
369 369
             'query' => drupal_get_destination(),
370 370
             'attributes' => array(
371
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
372
-                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')'
371
+              'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
372
+                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences').'\')'
373 373
             )
374 374
           )
375 375
         );
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
396 396
       );
397 397
       variable_set('jump_use_js_venues-Array', 1);
398
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
399
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
398
+      drupal_add_js(drupal_get_path('module', 'jump').'/jump.js');
399
+      drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme');
400 400
       
401 401
       $output .= '<div id="venue-selector" class="simple-form-controls">';
402 402
       $output .= '  <div class="form-item venue">';
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     if (!$current_set['#established']) {
417 417
       drupal_set_message(bts(
418 418
           "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
419
-          array( '@venue' => $venue, ),
419
+          array('@venue' => $venue,),
420 420
           NULL, 'boinc:account-preferences'), 'status');
421 421
     }
422 422
     
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
       drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
476 476
     }
477 477
     
478
-    $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>';
478
+    $output .= '<h2>'.bts('Combined preferences', array(), NULL, 'boinc:account-preferences').' '.l('('.bts('Switch View', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/project').'</h2>';
479 479
     
480 480
     $output .= '<table class="preferences combined">';
481 481
     
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
       $output .= '<tr class="section-heading">';
486 486
       $output .= "<td>{$section['name']}</td>";
487 487
       foreach ($pref_sets as $pref_set) {
488
-        $output .= '<td>' . $pref_set . '</td>';
488
+        $output .= '<td>'.$pref_set.'</td>';
489 489
       }
490 490
       $output .= '</tr>';
491 491
       foreach ($section['elements'] as $name => $setting) {
@@ -527,12 +527,12 @@  discard block
 block discarded – undo
527 527
       $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
528 528
       // Show Clear links for established preference sets
529 529
       if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
530
-        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
530
+        $output .= ' </li><li class="tab"> '.l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
531 531
           array(
532 532
             'query' => drupal_get_destination(),
533 533
             'attributes' => array(
534
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
535
-                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')'
534
+              'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
535
+                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project').'\')'
536 536
             )
537 537
           )
538 538
         );
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     // Set this preference set as the one to use for any new hosts attached
549 549
     // to the user account
550 550
     boincwork_set_default_venue($venue);
551
-    drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project') );
551
+    drupal_set_message(bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project'));
552 552
     drupal_goto('account/prefs/project/combined');
553 553
     break;
554 554
     
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
568 568
       );
569 569
       variable_set('jump_use_js_venues-Array', 1);
570
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
571
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
570
+      drupal_add_js(drupal_get_path('module', 'jump').'/jump.js');
571
+      drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme');
572 572
       
573 573
       $output .= '<div id="venue-selector" class="simple-form-controls">';
574 574
       $output .= '  <div class="form-item venue">';
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     if (!$current_set['#established']) {
589 589
       drupal_set_message(bts(
590 590
           "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
591
-          array( '@venue' => $venue, ),
591
+          array('@venue' => $venue,),
592 592
           NULL, 'boinc:account-preferences'), 'status');
593 593
     }
594 594
     
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
     // Edit preferences link
661 661
     $output .= '<tr>';
662 662
     $output .= '<td></td>';
663
-    $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>';
663
+    $output .= '<td>'.l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit").'</td>';
664 664
     $output .= '</tr>';
665 665
     
666 666
     $output .= '</table>';
@@ -695,15 +695,15 @@  discard block
 block discarded – undo
695 695
   switch ($type) {
696 696
   case 'all':
697 697
     //include_boinc('user/cert_all.php');
698
-    require_boinc(array('util','cert','user'));
698
+    require_boinc(array('util', 'cert', 'user'));
699 699
 
700 700
     $join = date('j F Y', $boincuser->create_time);
701 701
     $today = date('j F Y', time(0));
702 702
 
703
-    if ($border=="no") {
703
+    if ($border == "no") {
704 704
         $border = 0;
705 705
     } else {
706
-        $border=8;
706
+        $border = 8;
707 707
     }
708 708
 
709 709
     $title_font = "\"Optima,ZapfChancery\"";
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr>
748 748
     ";
749 749
     foreach ($boincuser->projects as $p) {
750
-        if ($p->total_credit<100) continue;
750
+        if ($p->total_credit < 100) continue;
751 751
         show_proj($p);
752 752
     }
753 753
     echo "
@@ -766,15 +766,15 @@  discard block
 block discarded – undo
766 766
   case 'account':
767 767
   default:
768 768
     //include_boinc('user/cert1.php');
769
-    require_boinc(array('util','cert'));
769
+    require_boinc(array('util', 'cert'));
770 770
 
771 771
     $join = date('j F Y', $boincuser->create_time);
772 772
     $today = date('j F Y', time(0));
773 773
 
774
-    if ($border=="no") {
774
+    if ($border == "no") {
775 775
         $border = 0;
776 776
     } else {
777
-        $border=8;
777
+        $border = 8;
778 778
     }
779 779
 
780 780
     $credit = credit_string($boincuser->total_credit, false);
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
  * Page callback for host task table
1016 1016
  */
1017 1017
 function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) {
1018
-  require_boinc( array('util', 'result') );
1018
+  require_boinc(array('util', 'result'));
1019 1019
 
1020 1020
   $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1021 1021
   drupal_set_title($title);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 /**
204 204
  * Implementation of hook_locale().
205 205
  */
206
-function boincwork_locale($op = 'groups', $group = NULL) {
206
+function boincwork_locale($op = 'groups', $group = null) {
207 207
   switch ($op) {
208 208
     case 'groups':
209 209
       return array('project' => bts('Project'));
210 210
     case 'info':
211 211
       $info['project']['refresh callback'] = 'boincwork_locale_refresh';
212
-      $info['project']['format'] = FALSE;
212
+      $info['project']['format'] = false;
213 213
       return $info;
214 214
   }
215 215
 }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     'project_specific' => array(),
226 226
   );
227 227
   boincwork_add_project_specific_prefs($form, $prefs);
228
-  return TRUE; // Meaning it completed with no issues
228
+  return true; // Meaning it completed with no issues
229 229
 }
230 230
 
231 231
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
   * General preferences menu callback.
238 238
   * Called when user goes to edit preferences page
239 239
   */
240
-function generalprefs_page($action = null, $venue = null, $advanced = FALSE) {
240
+function generalprefs_page($action = null, $venue = null, $advanced = false) {
241 241
   
242 242
   // Keep the venue selected across preference pages
243 243
   boincwork_select_venue($venue);
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
   
253 253
   case 'clear':
254 254
     // Remove settings from this preference set
255
-    if ($venue AND $venue != 'generic') {
256
-      boincwork_save_prefs(NULL, 'general', $venue);
255
+    if ($venue and $venue != 'generic') {
256
+      boincwork_save_prefs(null, 'general', $venue);
257 257
       drupal_set_message(t('Settings for the "@name" preference set have been
258 258
         cleared', array('@name' => ucfirst($venue))));
259 259
       // Set the generic preference set as active
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
       drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
272 272
     }
273 273
 
274
-    $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>';
275
-    $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing') . '</p>';
276
-    $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences-computing') . '</p>';
277
-    $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>';
274
+    $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), null, 'boinc:account-preferences-computing') . '<br/>';
275
+    $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), null, 'boinc:account-preferences-computing') . '</p>';
276
+    $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), null, 'boinc:account-preferences-computing') . '</p>';
277
+    $output .= '<h2>' . bts('Combined preferences', array(), null, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>';
278 278
     
279 279
     $output .= '<table class="preferences combined">';
280 280
     
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
           'daily_xfer_limit_mb' => 'daily_xfer_period_days',
297 297
         );
298 298
         $special_delimiter = array(
299
-          'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'),
300
-          'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'),
301
-          'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'),
299
+          'start_hour' => bts('and', array(), null, 'boinc:account-preference'),
300
+          'net_start_hour'=> bts('and', array(), null, 'boinc:account-preference'),
301
+          'daily_xfer_limit_mb' => bts('every', array(), null, 'boinc:account-preference'),
302 302
         );
303 303
         $special = isset($special_map[$name]);
304 304
         $very_special = in_array($name, $special_map);
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
         // Output values for each preference set, again with ugly hacks for
314 314
         // time range preferences
315 315
         foreach ($pref_sets as $pref_set) {
316
-          if (($prefs[$pref_set]) AND 
317
-              $prefs[$pref_set]['#established'] AND
316
+          if (($prefs[$pref_set]) and 
317
+              $prefs[$pref_set]['#established'] and
318 318
               isset($prefs[$pref_set]['prefs']['advanced'][$category])) {
319 319
             $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name];
320 320
             $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value'];
@@ -357,19 +357,19 @@  discard block
 block discarded – undo
357 357
     $output .= '<tr>';
358 358
     $output .= '<td></td>';
359 359
     foreach ($pref_sets as $pref_set) {
360
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
360
+      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), null, 'boinc:form-edit') : bts('Add', array(), null, 'boinc:form-add');
361 361
       $output .= '<td><ul class="tab-list"><li class="first tab">';
362 362
       $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1",
363 363
         array('fragment' => "")
364 364
       );
365 365
       // Show Clear links for established preference sets
366
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
367
-        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
366
+      if ($pref_set != 'generic' and $prefs[$pref_set]['#established']) {
367
+        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
368 368
           array(
369 369
             'query' => drupal_get_destination(),
370 370
             'attributes' => array(
371 371
               'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
372
-                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')'
372
+                array('@name' => ucfirst($pref_set)), null, 'boinc:account-computing-preferences') . '\')'
373 373
             )
374 374
           )
375 375
         );
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
     if (function_exists('jump_quickly')) {
390 390
       $path = 'account/prefs/computing/edit';
391 391
       $venues = array(
392
-        "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
393
-        "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
394
-        "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
395
-        "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
392
+        "{$path}/generic" => bts('Generic', array(), null, 'boinc:account-preferences-location'),
393
+        "{$path}/home" => bts('Home', array(), null, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
394
+        "{$path}/school" => bts('School', array(), null, 'boinc:account-preferences-location'),
395
+        "{$path}/work" => bts('Work', array(), null, 'boinc:account-preferences-location')
396 396
       );
397 397
       variable_set('jump_use_js_venues-Array', 1);
398 398
       drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
       $output .= '  </div>';
406 406
       $output .= '</div>';
407 407
     }
408
-    $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced);
408
+    $output .= drupal_get_form('boincwork_generalprefs_form', $venue, null, $advanced);
409 409
     
410 410
     // If viewing the edit page for a preference set that doesn't
411 411
     // exist, inform the user that preferences are not set.
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
       drupal_set_message(bts(
418 418
           "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
419 419
           array( '@venue' => $venue, ),
420
-          NULL, 'boinc:account-preferences'), 'status');
420
+          null, 'boinc:account-preferences'), 'status');
421 421
     }
422 422
     
423 423
     break;
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
   
448 448
   case 'clear':
449 449
     // Remove settings from this preference set
450
-    if ($venue AND $venue != 'generic') {
451
-      boincwork_save_prefs(NULL, 'project', $venue);
450
+    if ($venue and $venue != 'generic') {
451
+      boincwork_save_prefs(null, 'project', $venue);
452 452
       drupal_set_message(t('Settings for the "@name" preference set have been
453 453
         cleared', array('@name' => ucfirst($venue))));
454 454
       
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
       drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
476 476
     }
477 477
     
478
-    $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>';
478
+    $output .= '<h2>' . bts('Combined preferences', array(), null, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>';
479 479
     
480 480
     $output .= '<table class="preferences combined">';
481 481
     
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
         $output .= "<div class=\"description\">{$setting['description']}</div>";
496 496
         $output .= '</td>';
497 497
         foreach ($pref_sets as $pref_set) {
498
-          if (($prefs[$pref_set]) AND
499
-              $prefs[$pref_set]['#established'] AND
498
+          if (($prefs[$pref_set]) and
499
+              $prefs[$pref_set]['#established'] and
500 500
               isset($prefs[$pref_set][$category])) {
501 501
             $pref_setting = $prefs[$pref_set][$category][$name];
502 502
             $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value'];
@@ -522,17 +522,17 @@  discard block
 block discarded – undo
522 522
     $output .= '<tr>';
523 523
     $output .= '<td></td>';
524 524
     foreach ($pref_sets as $pref_set) {
525
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
525
+      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), null, 'boinc:form-edit') : bts('Add', array(), null, 'boinc:form-add');
526 526
       $output .= '<td><ul class="tab-list"><li class="first tab">';
527 527
       $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
528 528
       // Show Clear links for established preference sets
529
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
530
-        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
529
+      if ($pref_set != 'generic' and $prefs[$pref_set]['#established']) {
530
+        $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
531 531
           array(
532 532
             'query' => drupal_get_destination(),
533 533
             'attributes' => array(
534 534
               'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
535
-                array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')'
535
+                array('@name' => ucfirst($pref_set)), null, 'boinc:account-preferences-project') . '\')'
536 536
             )
537 537
           )
538 538
         );
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     // Set this preference set as the one to use for any new hosts attached
549 549
     // to the user account
550 550
     boincwork_set_default_venue($venue);
551
-    drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project') );
551
+    drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), null, 'boinc:account-preferences-project') );
552 552
     drupal_goto('account/prefs/project/combined');
553 553
     break;
554 554
     
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
     if (function_exists('jump_quickly')) {
562 562
       $path = 'account/prefs/project/edit';
563 563
       $venues = array(
564
-        "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
565
-        "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
566
-        "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
567
-        "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
564
+        "{$path}/generic" => bts('Generic', array(), null, 'boinc:account-preferences-location'),
565
+        "{$path}/home" => bts('Home', array(), null, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
566
+        "{$path}/school" => bts('School', array(), null, 'boinc:account-preferences-location'),
567
+        "{$path}/work" => bts('Work', array(), null, 'boinc:account-preferences-location')
568 568
       );
569 569
       variable_set('jump_use_js_venues-Array', 1);
570 570
       drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
       drupal_set_message(bts(
590 590
           "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
591 591
           array( '@venue' => $venue, ),
592
-          NULL, 'boinc:account-preferences'), 'status');
592
+          null, 'boinc:account-preferences'), 'status');
593 593
     }
594 594
     
595 595
     break;
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
       foreach ($section as $name => $setting) {
646 646
         if ($name{0} == '#') continue;
647 647
         $value = isset($setting['#default_value']) ? $setting['#default_value'] : '';
648
-        if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value];
648
+        if ($value and isset($setting['#options'])) $value = $setting['#options'][$value];
649 649
         elseif ($value == '') $value = '---';
650 650
         if (!isset($setting['#title'])) $setting['#title'] = '';
651 651
         if (!isset($setting['#description'])) $setting['#description'] = '';
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
     // Edit preferences link
661 661
     $output .= '<tr>';
662 662
     $output .= '<td></td>';
663
-    $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>';
663
+    $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), null, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>';
664 664
     $output .= '</tr>';
665 665
     
666 666
     $output .= '</table>';
@@ -892,17 +892,17 @@  discard block
 block discarded – undo
892 892
 function boincwork_host_log($host_id = null) {
893 893
   $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
894 894
   $log = '';
895
-  if ($root_log_dir AND $host_id) {
896
-    $subdir = substr($host_id, 0, -3) OR $subdir = 0;
895
+  if ($root_log_dir and $host_id) {
896
+    $subdir = substr($host_id, 0, -3) or $subdir = 0;
897 897
     $log = implode('/', array($root_log_dir, $subdir, $host_id));
898 898
   }
899
-  if ($log AND file_exists($log)) {
899
+  if ($log and file_exists($log)) {
900 900
     header('Content-type: text/plain');
901 901
     include($log);
902 902
   }
903 903
 }
904 904
 
905
-function boincwork_host_set_venue($host_id = NULL, $venue = NULL) {
905
+function boincwork_host_set_venue($host_id = null, $venue = null) {
906 906
   global $user;
907 907
   $account = user_load($user->uid);
908 908
   db_set_active('boinc');
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
     $host_id
913 913
   ));
914 914
   db_set_active('default');
915
-  if ($host_owner AND $host_owner == $account->boincuser_id) {
915
+  if ($host_owner and $host_owner == $account->boincuser_id) {
916 916
     db_set_active('boinc');
917 917
     $updated = db_query(
918 918
       "UPDATE {host} SET venue = '%s' WHERE id = '%d'",
@@ -921,20 +921,20 @@  discard block
 block discarded – undo
921 921
     db_set_active('default');
922 922
     if ($updated) {
923 923
       drupal_set_message(
924
-        bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details')
925
-        . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details')
924
+        bts('The location for this host has been updated.', array(), null, 'boinc:account-host-details')
925
+        . bts('This will take effect next time the host contacts the project.', array(), null, 'boinc:account-host-details')
926 926
       );
927 927
     }
928 928
     else {
929 929
       drupal_set_message(
930
-        bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'),
930
+        bts('Unable to save changes to this host for some reason!', array(), null, 'boinc:account-host-details'),
931 931
         'error'
932 932
       );
933 933
     }
934 934
   }
935 935
   else {
936 936
     drupal_set_message(
937
-      bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
937
+      bts('You are not allowed to make changes to this host.', array(), null, 'boinc:account-host-details'),
938 938
       'warning'
939 939
     );
940 940
   }
@@ -1002,8 +1002,8 @@  discard block
 block discarded – undo
1002 1002
 /**
1003 1003
  * Page callback for user account task table
1004 1004
  */
1005
-function boincwork_account_task_table($tselect = NULL, $app_id = NULL) {
1006
-  $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table');
1005
+function boincwork_account_task_table($tselect = null, $app_id = null) {
1006
+  $title = bts('Tasks for your account', array(), null, 'boinc:account-task-table');
1007 1007
   drupal_set_title($title);
1008 1008
 
1009 1009
   global $user;
@@ -1014,14 +1014,14 @@  discard block
 block discarded – undo
1014 1014
 /**
1015 1015
  * Page callback for host task table
1016 1016
  */
1017
-function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) {
1017
+function boincwork_host_task_table($host_id = null, $tselect = null, $app_id = null) {
1018 1018
   require_boinc( array('util', 'result') );
1019 1019
 
1020
-  $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1020
+  $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), null, 'boinc:host-task-table');
1021 1021
   drupal_set_title($title);
1022 1022
 
1023 1023
   if (is_null($host_id)) {
1024
-    drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error');
1024
+    drupal_set_message(bts('ERROR: Invalid host ID', array(), null, 'boinc:host-task-table'), 'error');
1025 1025
     return '';
1026 1026
   }
1027 1027
 
@@ -1031,12 +1031,12 @@  discard block
 block discarded – undo
1031 1031
 /**
1032 1032
  * Page callback for workunit task table
1033 1033
  */
1034
-function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) {
1035
-  $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table');
1034
+function boincwork_workunit_task_table($workunit_id = null, $tselect = null, $app_id = null) {
1035
+  $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), null, 'boinc:workunit-task-table');
1036 1036
   drupal_set_title($title);
1037 1037
 
1038 1038
   if (is_null($workunit_id)) {
1039
-    drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error');
1039
+    drupal_set_message(bts('ERROR: Invalid workunit ID', array(), null, 'boinc:workunit-task-table'), 'error');
1040 1040
     return '';
1041 1041
   }
1042 1042
   
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function boincwork_select_venue(&$venue) {
1064 1064
   if (!$venue) {
1065
-    $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL;
1065
+    $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : null;
1066 1066
     if ($active_venue) {
1067 1067
       $venue = $active_venue;
1068 1068
       //unset($_SESSION['prefs venue']);
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boinccore/boinccore.admin.inc 4 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -7,185 +7,185 @@  discard block
 block discarded – undo
7 7
 */
8 8
 
9 9
 /**
10
-  * The BOINC community form allows the setting of requirements for interaction
11
-  * in the community sections of the site.
12
-  */
10
+ * The BOINC community form allows the setting of requirements for interaction
11
+ * in the community sections of the site.
12
+ */
13 13
 function boinccore_admin_community(&$form_state) {
14
-  $form = array();
15
-  $default = array(
14
+    $form = array();
15
+    $default = array(
16 16
     'min_credit_to_post' => variable_get('boinc_comment_min_credit', 0),
17 17
     'penalty_period' => variable_get('boinc_penalty_period', 7*24*60*60),
18 18
     'moderator_mailing_list' => variable_get('boinc_moderator_mailing_list', ''),
19 19
     'moderator_force_individual_notifications' => variable_get('boinc_moderator_force_individual_notifications', 0),
20
-  );
20
+    );
21 21
   
22
-  // Define the form
23
-  $form['boinc_comment_min_credit'] = array(
22
+    // Define the form
23
+    $form['boinc_comment_min_credit'] = array(
24 24
     '#type' => 'textfield',
25 25
     '#title' => t('Credit required for community participation'),
26 26
     '#default_value' => $default['min_credit_to_post'],
27 27
     '#description' => t('Set a minimum threshold of credit a user must have
28 28
       earned before being allowed to create a profile, post comments or participate in forums.'),
29
-  );
30
-  $form['boinc_penalty_period'] = array(
29
+    );
30
+    $form['boinc_penalty_period'] = array(
31 31
     '#type' => 'textfield',
32 32
     '#title' => t('Penalty period'),
33 33
     '#default_value' => $default['penalty_period'],
34 34
     '#description' => t('The amount of time (in seconds) that user privileges
35 35
       are revoked when a user is banned from community participation.'),
36
-  );
37
-  $form['boinc_moderator_mailing_list'] = array(
36
+    );
37
+    $form['boinc_moderator_mailing_list'] = array(
38 38
     '#type' => 'textfield',
39 39
     '#title' => t('Moderator mailing list'),
40 40
     '#default_value' => $default['moderator_mailing_list'],
41 41
     '#description' => t('As an alternative to sending moderator notifications
42 42
       to individual users with the moderator role, enter a mailing list address
43 43
       here to be the only target of the notification emails.'),
44
-  );
45
-  $form['boinc_moderator_force_individual_notifications'] = array(
44
+    );
45
+    $form['boinc_moderator_force_individual_notifications'] = array(
46 46
     '#type' => 'checkbox',
47 47
     '#title' => t('Always send individual notifications'),
48 48
     '#default_value' => $default['moderator_force_individual_notifications'],
49 49
     '#description' => t('Continue to send individual moderator notification
50 50
       emails even when a mailing list is provided.'),
51
-  );
51
+    );
52 52
   
53
-  $form['tools'] = array(
53
+    $form['tools'] = array(
54 54
     '#title' => t('Tools'),
55 55
     '#type' => 'fieldset',
56 56
     '#description' => '',
57 57
     '#collapsible' => TRUE,
58 58
     '#collapsed' => FALSE,
59 59
     '#attributes' => array('class' => '')
60
-  );
61
-  $form['tools']['reset_uotd'] = array(
60
+    );
61
+    $form['tools']['reset_uotd'] = array(
62 62
     '#type' => 'submit',
63 63
     '#value' => t('Force new UOTD'),
64 64
     '#submit' => array('boinccore_reset_user_of_the_day'),
65
-  );
65
+    );
66 66
   
67
-  return system_settings_form($form);
67
+    return system_settings_form($form);
68 68
 }
69 69
 
70 70
 /**
71
-  * Validate the BOINC community form.
72
-  */
71
+ * Validate the BOINC community form.
72
+ */
73 73
 function boinccore_admin_community_validate($form, &$form_state) {
74
-  $values = $form_state['values'];
75
-  if (!is_numeric($values['boinc_comment_min_credit'])) {
74
+    $values = $form_state['values'];
75
+    if (!is_numeric($values['boinc_comment_min_credit'])) {
76 76
     form_set_error('boinc_comment_min_credit', t('The minimum credit value must be a number.'));
77
-  }
77
+    }
78 78
 }
79 79
 
80 80
 /**
81
-  * Handle post-validation submission of BOINC community form.
82
-  */
81
+ * Handle post-validation submission of BOINC community form.
82
+ */
83 83
 function boinccore_admin_community_submit($form, &$form_state) {
84
-  drupal_set_message(t('BOINC community settings have been updated.'));
84
+    drupal_set_message(t('BOINC community settings have been updated.'));
85 85
 }
86 86
 
87 87
 /**
88 88
  * Force a reset of the user of the day
89 89
  */
90 90
 function boinccore_reset_user_of_the_day() {
91
-  if (boincuser_select_user_of_the_day()) {
91
+    if (boincuser_select_user_of_the_day()) {
92 92
     drupal_set_message(t('The user of the day has been reset.'));
93
-  }
93
+    }
94 94
 }
95 95
 
96 96
 /**
97
-  * The standard page generator form provides an interface to create standard
98
-  * pages, such as a Help or About page.
99
-  */
97
+ * The standard page generator form provides an interface to create standard
98
+ * pages, such as a Help or About page.
99
+ */
100 100
 function boinccore_admin_default_content(&$form_state) {
101
-  $form = array();
101
+    $form = array();
102 102
   
103
-  // Define the form
104
-  $form['page'] = array(
103
+    // Define the form
104
+    $form['page'] = array(
105 105
     '#type' => 'select',
106 106
     '#title' => t('Generate default content for'),
107 107
     '#options' => array(
108
-      0 => t('all standard pages'),
108
+        0 => t('all standard pages'),
109 109
 //      'about' => t('About page'),
110
-      'help' => t('Help page'),
110
+        'help' => t('Help page'),
111 111
     ),
112
-  );
113
-  $form['submit'] = array(
112
+    );
113
+    $form['submit'] = array(
114 114
     '#type' => 'submit',
115 115
     '#value' => 'Generate content',
116
-  );
116
+    );
117 117
   
118
-  return $form;
118
+    return $form;
119 119
 }
120 120
 
121 121
 /**
122
-  * Generate content based on the selection made on the form
123
-  */
122
+ * Generate content based on the selection made on the form
123
+ */
124 124
 function boinccore_admin_default_content_submit($form, &$form_state) {
125
-  $option = $form_state['values']['page'];
126
-  $page_list = boinccore_admin_default_content_generate($option);
127
-  $pages_generated = count($page_list);
128
-  if ($pages_generated > 0) {
125
+    $option = $form_state['values']['page'];
126
+    $page_list = boinccore_admin_default_content_generate($option);
127
+    $pages_generated = count($page_list);
128
+    if ($pages_generated > 0) {
129 129
     switch ($pages_generated) {
130 130
     case 1:
131 131
       $page_list = reset($page_list);
132
-      break;
132
+        break;
133 133
     case 2:
134 134
       $page_list = implode(' and ', $page_list);
135
-      break;
135
+        break;
136 136
     default:
137 137
       end($page_list);
138
-      $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
139
-      $page_list = implode(', ', $page_list);
138
+        $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
139
+        $page_list = implode(', ', $page_list);
140 140
     }
141 141
     drupal_set_message(t('Default content has been generated for the @listed
142 142
       @pages.', array(
143 143
         '@listed' => $page_list, 
144 144
         '@pages' => format_plural($pages_generated, 'page', 'pages'),
145
-      )
145
+        )
146 146
     ));
147
-  }
148
-  else {
147
+    }
148
+    else {
149 149
     if ($option) {
150
-      drupal_set_message(t('The @specified page already exists.',
150
+        drupal_set_message(t('The @specified page already exists.',
151 151
         array('@specified' => $option)), 'warning');
152 152
     }
153 153
     else {
154
-      drupal_set_message(t('All pages already exist, so none can be recreated
154
+        drupal_set_message(t('All pages already exist, so none can be recreated
155 155
         automatically.'), 'warning');
156 156
     }
157 157
     drupal_set_message(t('To recreate a page, first delete the existing page (or
158 158
       remove its URL alias), then try this function again.'), 'warning');
159
-  }
159
+    }
160 160
 }
161 161
 
162 162
 /**
163
-  * 
164
-  */
163
+ * 
164
+ */
165 165
 function boinccore_admin_default_content_generate($pages = array()) {
166
-  if (!$pages) {
166
+    if (!$pages) {
167 167
     // If not specified, attempt to generate all pages by default
168 168
     $pages = array(
169
-      'help',
169
+        'help',
170 170
 //      'about',
171 171
     );
172
-  }
173
-  elseif (!is_array($pages)) {
172
+    }
173
+    elseif (!is_array($pages)) {
174 174
     $pages = array($pages);
175
-  }
176
-  $pages_generated = array();
177
-  if (in_array('about', $pages)) {
175
+    }
176
+    $pages_generated = array();
177
+    if (in_array('about', $pages)) {
178 178
     // Create the default About page, if it doesn't exist
179 179
     // TODO: what is the default About page...?
180 180
     if (!drupal_lookup_path('source', 'about')) {
181
-      drupal_set_message('The about page doesn\'t yet have a definition...', 'warning');
182
-      //$pages_generated[] = 'about';
181
+        drupal_set_message('The about page doesn\'t yet have a definition...', 'warning');
182
+        //$pages_generated[] = 'about';
183
+    }
183 184
     }
184
-  }
185
-  if (in_array('help', $pages)) {
185
+    if (in_array('help', $pages)) {
186 186
     // Create the default Help page, if it doesn't exist
187 187
     if (!drupal_lookup_path('source', 'help')) {
188
-      $node = array(
188
+        $node = array(
189 189
         'type' => 'page',
190 190
         'title' => t('Help'),
191 191
         'uid' => 1,
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         'comment' => 0, // disable comments
199 199
         'moderate' => 0,
200 200
         'body' => preg_replace('/>\s+</', '><',
201
-          '<p>Use this page to provide help and support for your site\'s
201
+            '<p>Use this page to provide help and support for your site\'s
202 202
           visitors:</p>
203 203
           <ul>
204 204
             <li>Add a link to your primary forum for getting help</li>
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
         'sticky' => 0,
210 210
         'format' => 4,
211 211
         //'teaser' => $teaser,
212
-      );
213
-      $node = (object) $node; // node_save requires an object
214
-      node_save($node);
212
+        );
213
+        $node = (object) $node; // node_save requires an object
214
+        node_save($node);
215 215
       
216
-      $item = array(
216
+        $item = array(
217 217
         'link_path' => drupal_get_normal_path('help'),
218 218
         'link_title' => t('Help'),
219 219
         'menu_name' => 'primary-links',
220 220
         'weight' => 50,
221
-      );
222
-      menu_link_save($item);
223
-      $pages_generated[] = 'help';
221
+        );
222
+        menu_link_save($item);
223
+        $pages_generated[] = 'help';
224
+    }
224 225
     }
225
-  }
226
-  // Refresh the cache with these changes
227
-  menu_cache_clear_all();
228
-  return $pages_generated;
226
+    // Refresh the cache with these changes
227
+    menu_cache_clear_all();
228
+    return $pages_generated;
229 229
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
       break;
136 136
     default:
137 137
       end($page_list);
138
-      $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
138
+      $page_list[key($page_list)] = 'and '.$page_list[key($page_list)];
139 139
       $page_list = implode(', ', $page_list);
140 140
     }
141 141
     drupal_set_message(t('Default content has been generated for the @listed
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         'type' => 'page',
190 190
         'title' => t('Help'),
191 191
         'uid' => 1,
192
-        'status' => 1,  // published
192
+        'status' => 1, // published
193 193
         'promote' => 0, // not promoted to front page
194 194
         'path' => 'help',
195 195
         'pathauto_perform_alias' => FALSE,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         'format' => 4,
211 211
         //'teaser' => $teaser,
212 212
       );
213
-      $node = (object) $node; // node_save requires an object
213
+      $node = (object)$node; // node_save requires an object
214 214
       node_save($node);
215 215
       
216 216
       $item = array(
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,13 +144,11 @@  discard block
 block discarded – undo
144 144
         '@pages' => format_plural($pages_generated, 'page', 'pages'),
145 145
       )
146 146
     ));
147
-  }
148
-  else {
147
+  } else {
149 148
     if ($option) {
150 149
       drupal_set_message(t('The @specified page already exists.',
151 150
         array('@specified' => $option)), 'warning');
152
-    }
153
-    else {
151
+    } else {
154 152
       drupal_set_message(t('All pages already exist, so none can be recreated
155 153
         automatically.'), 'warning');
156 154
     }
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
       'help',
170 168
 //      'about',
171 169
     );
172
-  }
173
-  elseif (!is_array($pages)) {
170
+  } elseif (!is_array($pages)) {
174 171
     $pages = array($pages);
175 172
   }
176 173
   $pages_generated = array();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     '#title' => t('Tools'),
55 55
     '#type' => 'fieldset',
56 56
     '#description' => '',
57
-    '#collapsible' => TRUE,
58
-    '#collapsed' => FALSE,
57
+    '#collapsible' => true,
58
+    '#collapsed' => false,
59 59
     '#attributes' => array('class' => '')
60 60
   );
61 61
   $form['tools']['reset_uotd'] = array(
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         'status' => 1,  // published
193 193
         'promote' => 0, // not promoted to front page
194 194
         'path' => 'help',
195
-        'pathauto_perform_alias' => FALSE,
195
+        'pathauto_perform_alias' => false,
196 196
         'created' => time(),
197 197
         'changed' => time(),
198 198
         'comment' => 0, // disable comments
Please login to merge, or discard this patch.