@@ -9,45 +9,45 @@ discard block |
||
9 | 9 | * Implements hook_block() for Drupal 6 compatibility |
10 | 10 | */ |
11 | 11 | function node_comment_block_block($op = 'list', $delta = 0, $edit = array()) { |
12 | - switch ($op) { |
|
13 | - case 'view': |
|
12 | + switch ($op) { |
|
13 | + case 'view': |
|
14 | 14 | //$block = node_comment_block_block_view($delta); |
15 | 15 | $block = array(); |
16 | 16 | if ($delta == 'node_comments') { |
17 | - if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) { |
|
17 | + if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) { |
|
18 | 18 | $node = node_load($nid); |
19 | 19 | if ($node->comment !== 0) { |
20 | - $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements. |
|
21 | - $block['content'] = ''; |
|
22 | - if ($node->comment) { |
|
20 | + $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements. |
|
21 | + $block['content'] = ''; |
|
22 | + if ($node->comment) { |
|
23 | 23 | $block['content'] .= comment_render($node); |
24 | - } |
|
24 | + } |
|
25 | + } |
|
25 | 26 | } |
26 | - } |
|
27 | 27 | } |
28 | 28 | break; |
29 | - case 'list': |
|
29 | + case 'list': |
|
30 | 30 | $blocks = node_comment_block_block_info(); |
31 | 31 | return $blocks; |
32 | 32 | break; |
33 | - default: |
|
33 | + default: |
|
34 | 34 | } |
35 | - return $block; |
|
35 | + return $block; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Port Drupal 7 render() function to Drupal 6 |
40 | 40 | */ |
41 | 41 | function render(&$element) { |
42 | - if (is_array($element)) { |
|
42 | + if (is_array($element)) { |
|
43 | 43 | show($element); |
44 | 44 | return drupal_render($element); |
45 | - } |
|
46 | - else { |
|
45 | + } |
|
46 | + else { |
|
47 | 47 | // Safe-guard for inappropriate use of render() on flat variables: return |
48 | 48 | // the variable as-is. |
49 | 49 | return $element; |
50 | - } |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -56,50 +56,50 @@ discard block |
||
56 | 56 | * Implements hook_block_info(). |
57 | 57 | */ |
58 | 58 | function node_comment_block_block_info() { |
59 | - $blocks['node_comments'] = array( |
|
59 | + $blocks['node_comments'] = array( |
|
60 | 60 | 'info' => t('Node comments'), |
61 | - ); |
|
61 | + ); |
|
62 | 62 | |
63 | - return $blocks; |
|
63 | + return $blocks; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Implements hook_block_view(). |
68 | 68 | */ |
69 | 69 | function node_comment_block_block_view($delta = '') { |
70 | - $block = array(); |
|
70 | + $block = array(); |
|
71 | 71 | |
72 | - if ($delta == 'node_comments') { |
|
72 | + if ($delta == 'node_comments') { |
|
73 | 73 | if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) { |
74 | - $node = node_load($nid); |
|
74 | + $node = node_load($nid); |
|
75 | 75 | |
76 | - if ($node->comment !== 0) { |
|
76 | + if ($node->comment !== 0) { |
|
77 | 77 | $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements. |
78 | 78 | $block['content'] = ''; |
79 | 79 | |
80 | 80 | $node = node_view($node); |
81 | 81 | |
82 | 82 | if ($node['comments']) { |
83 | - $block['content'] .= render($node['comments']); |
|
83 | + $block['content'] .= render($node['comments']); |
|
84 | + } |
|
84 | 85 | } |
85 | - } |
|
86 | 86 | } |
87 | - } |
|
87 | + } |
|
88 | 88 | |
89 | - return $block; |
|
89 | + return $block; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Implements hook_preprocess_HOOK() for nodes. |
94 | 94 | */ |
95 | 95 | function node_comment_block_preprocess_node(&$variables) { |
96 | - $node = $variables['node']; |
|
97 | - // Only hide standard comments for news content |
|
98 | - if ($variables['type'] == 'news') { |
|
96 | + $node = $variables['node']; |
|
97 | + // Only hide standard comments for news content |
|
98 | + if ($variables['type'] == 'news') { |
|
99 | 99 | $variables['node']->comment = 0; |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | - /* Drupal 7... |
|
102 | + /* Drupal 7... |
|
103 | 103 | if ($node->comment !== 0 && $variables['view_mode'] == 'full') { |
104 | 104 | if (isset($variables['content']['comments'])) { |
105 | 105 | unset($variables['content']['comments']); |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | * Implements hook_form_FORM_ID_alter() for block_admin_configure. |
114 | 114 | */ |
115 | 115 | function node_comment_block_form_block_admin_configure_alter(&$form, &$form_state) { |
116 | - if (isset($form['delta'])) { |
|
116 | + if (isset($form['delta'])) { |
|
117 | 117 | if ($form['delta']['#value'] == 'node_comments') { |
118 | - $form['settings']['title']['#disabled'] = TRUE; |
|
119 | - $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.'); |
|
118 | + $form['settings']['title']['#disabled'] = TRUE; |
|
119 | + $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.'); |
|
120 | + } |
|
120 | 121 | } |
121 | - } |
|
122 | 122 | } |
@@ -7,15 +7,15 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | class views_handler_argument_boincteam_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 team_id FROM {boincteam} WHERE nid = %d", $id)); |
18 | 18 | $this->argument = $boinc_id; |
19 | 19 | return $this->validate_arg($boinc_id); |
20 | - } |
|
20 | + } |
|
21 | 21 | } |
@@ -13,80 +13,80 @@ |
||
13 | 13 | */ |
14 | 14 | function boincteam_forum_views_data() { |
15 | 15 | |
16 | - // ----------------------------------------------------------------------------------------------- |
|
17 | - // Definition for team table |
|
18 | - // ----------------------------------------------------------------------------------------------- |
|
16 | + // ----------------------------------------------------------------------------------------------- |
|
17 | + // Definition for team table |
|
18 | + // ----------------------------------------------------------------------------------------------- |
|
19 | 19 | |
20 | - $data['boincteam_forum_node']['table']['group'] = t('BOINC'); |
|
20 | + $data['boincteam_forum_node']['table']['group'] = t('BOINC'); |
|
21 | 21 | |
22 | - $data['boincteam_forum_node']['table']['base'] = array( |
|
23 | - 'field' => 'nid', |
|
24 | - 'title' => t('BOINC team forum topic'), |
|
25 | - 'help' => t('Forum topics for a team'), |
|
26 | - ); |
|
22 | + $data['boincteam_forum_node']['table']['base'] = array( |
|
23 | + 'field' => 'nid', |
|
24 | + 'title' => t('BOINC team forum topic'), |
|
25 | + 'help' => t('Forum topics for a team'), |
|
26 | + ); |
|
27 | 27 | |
28 | - // Describe each of the individual fields in this table to Views. For |
|
29 | - // each field, you may define what field, sort, argument, and/or filter |
|
30 | - // handlers it supports. This will determine where in the Views interface you |
|
31 | - // may use the field. |
|
28 | + // Describe each of the individual fields in this table to Views. For |
|
29 | + // each field, you may define what field, sort, argument, and/or filter |
|
30 | + // handlers it supports. This will determine where in the Views interface you |
|
31 | + // may use the field. |
|
32 | 32 | |
33 | - // Primary keys allowed as arguments |
|
33 | + // Primary keys allowed as arguments |
|
34 | 34 | |
35 | - $data['boincteam_forum_node']['tfid'] = array( |
|
35 | + $data['boincteam_forum_node']['tfid'] = array( |
|
36 | 36 | 'title' => t('Team forum ID'), |
37 | 37 | 'help' => t('The ID of the team forum containing this topic.'), |
38 | 38 | 'field' => array( |
39 | - 'handler' => 'views_handler_field_numeric', |
|
40 | - 'click sortable' => TRUE |
|
39 | + 'handler' => 'views_handler_field_numeric', |
|
40 | + 'click sortable' => TRUE |
|
41 | 41 | ), |
42 | 42 | 'argument' => array( |
43 | - 'handler' => 'views_handler_argument_numeric', |
|
44 | - 'name field' => 'title', // the field to display in the summary. |
|
45 | - 'numeric' => TRUE, |
|
46 | - 'validate type' => 'id' |
|
43 | + 'handler' => 'views_handler_argument_numeric', |
|
44 | + 'name field' => 'title', // the field to display in the summary. |
|
45 | + 'numeric' => TRUE, |
|
46 | + 'validate type' => 'id' |
|
47 | 47 | ), |
48 | 48 | 'relationship' => array( |
49 | - 'base' => 'boincteam_forum', |
|
50 | - 'field' => 'tfid', |
|
51 | - 'handler' => 'views_handler_relationship', |
|
52 | - 'label' => t('Team Forum') |
|
49 | + 'base' => 'boincteam_forum', |
|
50 | + 'field' => 'tfid', |
|
51 | + 'handler' => 'views_handler_relationship', |
|
52 | + 'label' => t('Team Forum') |
|
53 | 53 | ), |
54 | 54 | 'filter' => array( |
55 | - 'handler' => 'views_handler_filter_numeric' |
|
55 | + 'handler' => 'views_handler_filter_numeric' |
|
56 | 56 | ), |
57 | 57 | 'sort' => array( |
58 | - 'handler' => 'views_handler_sort_numeric' |
|
58 | + 'handler' => 'views_handler_sort_numeric' |
|
59 | 59 | ) |
60 | - ); |
|
60 | + ); |
|
61 | 61 | |
62 | - // Foreign key fields |
|
62 | + // Foreign key fields |
|
63 | 63 | |
64 | - $data['boincteam_forum_node']['nid'] = array( |
|
64 | + $data['boincteam_forum_node']['nid'] = array( |
|
65 | 65 | 'title' => t('Team forum node'), |
66 | 66 | 'help' => t('The node containing the content of this team forum topic.'), |
67 | 67 | // This is a foreign key to the {node} table. When the view is configured |
68 | 68 | // with this relationship, all the fields for the related user node will be |
69 | 69 | // available. |
70 | 70 | 'relationship' => array( |
71 | - 'base' => 'node', |
|
72 | - 'field' => 'nid', |
|
73 | - 'handler' => 'views_handler_relationship', |
|
74 | - 'label' => t('Team Forum Topic Node') |
|
71 | + 'base' => 'node', |
|
72 | + 'field' => 'nid', |
|
73 | + 'handler' => 'views_handler_relationship', |
|
74 | + 'label' => t('Team Forum Topic Node') |
|
75 | 75 | ), |
76 | 76 | 'field' => array( |
77 | - 'handler' => 'views_handler_field_numeric', |
|
78 | - 'click sortable' => TRUE |
|
77 | + 'handler' => 'views_handler_field_numeric', |
|
78 | + 'click sortable' => TRUE |
|
79 | 79 | ), |
80 | 80 | 'filter' => array( |
81 | - 'handler' => 'views_handler_filter_numeric' |
|
81 | + 'handler' => 'views_handler_filter_numeric' |
|
82 | 82 | ), |
83 | 83 | 'sort' => array( |
84 | - 'handler' => 'views_handler_sort_numeric' |
|
84 | + 'handler' => 'views_handler_sort_numeric' |
|
85 | 85 | ) |
86 | - ); |
|
86 | + ); |
|
87 | 87 | |
88 | - // Descriptions of general fields (alphabetized) |
|
89 | - // ... |
|
88 | + // Descriptions of general fields (alphabetized) |
|
89 | + // ... |
|
90 | 90 | |
91 | - return $data; |
|
91 | + return $data; |
|
92 | 92 | } |
@@ -7,15 +7,15 @@ |
||
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 | } |
@@ -6,15 +6,15 @@ |
||
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 | } |
@@ -6,12 +6,12 @@ |
||
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 | } |
@@ -6,11 +6,11 @@ |
||
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 | } |
@@ -15,42 +15,42 @@ |
||
15 | 15 | */ |
16 | 16 | function boinc_settings($saved_settings) { |
17 | 17 | |
18 | - // Get the default values from the .info file. |
|
19 | - $defaults = zen_theme_get_default_settings('boinc'); |
|
18 | + // Get the default values from the .info file. |
|
19 | + $defaults = zen_theme_get_default_settings('boinc'); |
|
20 | 20 | |
21 | - // Merge the saved variables and their default values. |
|
22 | - $settings = array_merge($defaults, $saved_settings); |
|
21 | + // Merge the saved variables and their default values. |
|
22 | + $settings = array_merge($defaults, $saved_settings); |
|
23 | 23 | |
24 | - /* |
|
24 | + /* |
|
25 | 25 | * Create the form using Forms API: http://api.drupal.org/api/6 |
26 | 26 | */ |
27 | - $form = array(); |
|
28 | - $form['boinc_stats_charts'] = array( |
|
27 | + $form = array(); |
|
28 | + $form['boinc_stats_charts'] = array( |
|
29 | 29 | '#type' => 'fieldset', |
30 | 30 | '#title' => t('Chart settings'), |
31 | 31 | '#attributes' => array( |
32 | - 'class' => 'zen-settings', |
|
32 | + 'class' => 'zen-settings', |
|
33 | 33 | ), |
34 | - ); |
|
35 | - $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
34 | + ); |
|
35 | + $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
36 | 36 | '#type' => 'textfield', |
37 | 37 | '#title' => t('Chart color'), |
38 | 38 | '#default_value' => $settings['boinc_stats_chart_color'], |
39 | 39 | '#description' => t('The primary color of the stats chart in hex format (e.g. #FAA341).'), |
40 | - ); |
|
41 | - $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
40 | + ); |
|
41 | + $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
42 | 42 | '#type' => 'textfield', |
43 | 43 | '#title' => t('Chart background color'), |
44 | 44 | '#default_value' => $settings['boinc_stats_chart_bcolor'], |
45 | 45 | '#description' => t('The background color of the stats chart in hex format (e.g. #FFFFFF).'), |
46 | - ); |
|
46 | + ); |
|
47 | 47 | |
48 | - // Add the base theme's settings. |
|
49 | - $form += zen_settings($saved_settings, $defaults); |
|
48 | + // Add the base theme's settings. |
|
49 | + $form += zen_settings($saved_settings, $defaults); |
|
50 | 50 | |
51 | - // Remove some of the base theme's settings. |
|
52 | - unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
51 | + // Remove some of the base theme's settings. |
|
52 | + unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
53 | 53 | |
54 | - // Return the form |
|
55 | - return $form; |
|
54 | + // Return the form |
|
55 | + return $form; |
|
56 | 56 | } |
@@ -4,34 +4,34 @@ |
||
4 | 4 | * Implementation of hook_strongarm(). |
5 | 5 | */ |
6 | 6 | function internationalization_strongarm() { |
7 | - $export = array(); |
|
7 | + $export = array(); |
|
8 | 8 | |
9 | - $strongarm = new stdClass; |
|
10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | - $strongarm->api_version = 1; |
|
12 | - $strongarm->name = 'i18nstrings_allowed_formats'; |
|
13 | - $strongarm->value = array( |
|
9 | + $strongarm = new stdClass; |
|
10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | + $strongarm->api_version = 1; |
|
12 | + $strongarm->name = 'i18nstrings_allowed_formats'; |
|
13 | + $strongarm->value = array( |
|
14 | 14 | 0 => 4, |
15 | 15 | 1 => 5, |
16 | - ); |
|
17 | - $export['i18nstrings_allowed_formats'] = $strongarm; |
|
16 | + ); |
|
17 | + $export['i18nstrings_allowed_formats'] = $strongarm; |
|
18 | 18 | |
19 | - $strongarm = new stdClass; |
|
20 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
21 | - $strongarm->api_version = 1; |
|
22 | - $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
23 | - $strongarm->value = array( |
|
19 | + $strongarm = new stdClass; |
|
20 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
21 | + $strongarm->api_version = 1; |
|
22 | + $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
23 | + $strongarm->value = array( |
|
24 | 24 | 2 => '1', |
25 | 25 | 1 => '0', |
26 | - ); |
|
27 | - $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
26 | + ); |
|
27 | + $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
28 | 28 | |
29 | - $strongarm = new stdClass; |
|
30 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
31 | - $strongarm->api_version = 1; |
|
32 | - $strongarm->name = 'language_negotiation'; |
|
33 | - $strongarm->value = '2'; |
|
34 | - $export['language_negotiation'] = $strongarm; |
|
29 | + $strongarm = new stdClass; |
|
30 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
31 | + $strongarm->api_version = 1; |
|
32 | + $strongarm->name = 'language_negotiation'; |
|
33 | + $strongarm->value = '2'; |
|
34 | + $export['language_negotiation'] = $strongarm; |
|
35 | 35 | |
36 | - return $export; |
|
36 | + return $export; |
|
37 | 37 | } |